Skip to content

Commit 58f93f2

Browse files
committed
minor additions in prax; minor fix in dom_shim
`prax.mjs`: * Added `Ren..appendChi`. * Added `Ren..prependChi`. * `Ren..replaceChi` is now variadic. `dom_shim.mjs`: the `.tabIndex` setter now accepts nil values, matching the actual DOM behavior.
1 parent cd9ac41 commit 58f93f2

25 files changed

+192
-169
lines changed

docs/cli_readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
CLI args:
2424

2525
```js
26-
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/cli.mjs'
26+
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/cli.mjs'
2727

2828
const cli = cl.Flag.os()
2929

@@ -34,15 +34,15 @@ console.log(...cli.args)
3434
Console clearing:
3535

3636
```js
37-
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/cli.mjs'
37+
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/cli.mjs'
3838

3939
cl.emptty()
4040
```
4141

4242
Clearing the console only once, before running your code:
4343

4444
```js
45-
import 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/cli_emptty.mjs'
45+
import 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/cli_emptty.mjs'
4646
```
4747

4848
## API

docs/coll_readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Port and rework of https://github.com/mitranim/jol.
2626
## Usage
2727

2828
```js
29-
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/coll.mjs'
29+
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/coll.mjs'
3030
```
3131

3232
## API
@@ -101,8 +101,8 @@ Links: [source](../coll.mjs#L100); [test/example](../test/coll_test.mjs#L218).
101101
Variant of [#`Bmap`](#class-bmap) with support for key and value checks. Subclasses must override methods `.reqKey` and `.reqVal`. These methods are automatically called by `.set`. Method `.reqKey` must validate and return the given key, and method `.reqVal` must validate and return the given value. Use type assertions provided by [`lang`](lang_readme.md).
102102

103103
```js
104-
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/lang.mjs'
105-
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/coll.mjs'
104+
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/lang.mjs'
105+
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/coll.mjs'
106106

107107
class StrNatMap extends c.TypedMap {
108108
reqKey(key) {return l.reqStr(key)}
@@ -242,7 +242,7 @@ Differences and advantages over `Array`:
242242
The overhead of the wrapper is insignificant.
243243

244244
```js
245-
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/coll.mjs'
245+
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/coll.mjs'
246246

247247
console.log(new c.Vec())
248248
// Vec{Symbol(val): []}

docs/dom_global_native_readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ In code intended only for browsers, simply use DOM globals. In code intended onl
1515
```js
1616
/*
1717
Use a bundler or importmap to alias this import to one of:
18-
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_global_native.mjs
19-
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_global_shim.mjs
18+
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_global_native.mjs
19+
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_global_shim.mjs
2020
*/
2121
import * as dg from 'dom_global'
2222

docs/dom_global_shim_readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ In code intended only for non-browser environments, simply import [`dom_global_s
1515
```js
1616
/*
1717
Use a bundler or importmap to alias this import to one of:
18-
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_global_native.mjs
19-
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_global_shim.mjs
18+
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_global_native.mjs
19+
https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_global_shim.mjs
2020
*/
2121
import * as dg from 'dom_global'
2222

docs/dom_readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## Usage
1212

1313
```js
14-
import * as d from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom.mjs'
14+
import * as d from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom.mjs'
1515
```
1616

1717
## API

docs/dom_reg_readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Example mockup for a pushstate link.
2828

2929
```js
30-
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_reg.mjs'
30+
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_reg.mjs'
3131

3232
// Immediately ready for use. Tag is automatically set to `a-btn`.
3333
// The mixin `MixReg` enables automatic registration on instantiation.
@@ -66,7 +66,7 @@ Apps which use server-side rendering and client-side upgrading of custom element
6666
Instead, use `dr.reg`, which is also used internally by `MixReg`. This is simply a shortcut for using the [#default registry](#class-reg) provided by this module.
6767

6868
```js
69-
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_reg.mjs'
69+
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_reg.mjs'
7070

7171
class Btn extends HTMLButtonElement {
7272
/*
@@ -106,7 +106,7 @@ For browser-only code, prefer the mixin `MixReg` from the same module which is e
106106
Simple usage:
107107

108108
```js
109-
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_reg.mjs'
109+
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_reg.mjs'
110110

111111
class Btn extends HTMLButtonElement {
112112
/*
@@ -126,7 +126,7 @@ document.body.append(new Btn())
126126
You can unset the default definer to defer registration:
127127

128128
```js
129-
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_reg.mjs'
129+
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_reg.mjs'
130130

131131
dr.Reg.main.setDefiner()
132132

docs/dom_shim_readme.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## Usage
1212

1313
```js
14-
import * as ds from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/dom_shim.mjs'
14+
import * as ds from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/dom_shim.mjs'
1515
```
1616

1717
## API
@@ -81,44 +81,44 @@ The following APIs are exported but undocumented. Check [dom_shim.mjs](../dom_sh
8181
* [`class Attr`](../dom_shim.mjs#L346)
8282
* [`class NamedNodeMap`](../dom_shim.mjs#L356)
8383
* [`class Element`](../dom_shim.mjs#L394)
84-
* [`class HTMLElement`](../dom_shim.mjs#L600)
85-
* [`class HTMLMetaElement`](../dom_shim.mjs#L615)
86-
* [`class HTMLAnchorElement`](../dom_shim.mjs#L620)
87-
* [`class HTMLLabelElement`](../dom_shim.mjs#L642)
88-
* [`class HTMLButtonElement`](../dom_shim.mjs#L652)
89-
* [`class HTMLInputElement`](../dom_shim.mjs#L677)
90-
* [`class HTMLTextAreaElement`](../dom_shim.mjs#L689)
91-
* [`class HTMLObjectElement`](../dom_shim.mjs#L691)
92-
* [`class HTMLOutputElement`](../dom_shim.mjs#L693)
93-
* [`class HTMLSelectElement`](../dom_shim.mjs#L699)
94-
* [`class HTMLOptionElement`](../dom_shim.mjs#L707)
95-
* [`class HTMLFieldSetElement`](../dom_shim.mjs#L715)
96-
* [`class HTMLFormElement`](../dom_shim.mjs#L717)
97-
* [`class HTMLTableElement`](../dom_shim.mjs#L721)
98-
* [`class RawTextElement`](../dom_shim.mjs#L740)
99-
* [`class HTMLScriptElement`](../dom_shim.mjs#L745)
100-
* [`class HTMLStyleElement`](../dom_shim.mjs#L746)
101-
* [`class SVGElement`](../dom_shim.mjs#L753)
102-
* [`class DocumentType`](../dom_shim.mjs#L758)
103-
* [`class Document`](../dom_shim.mjs#L782)
104-
* [`class HTMLDocument`](../dom_shim.mjs#L875)
105-
* [`class DOMImplementation`](../dom_shim.mjs#L892)
106-
* [`class CustomElementRegistry`](../dom_shim.mjs#L924)
107-
* [`class DictPh`](../dom_shim.mjs#L951)
108-
* [`class StylePh`](../dom_shim.mjs#L964)
109-
* [`class ClassList`](../dom_shim.mjs#L1083)
110-
* [`class HTMLFormControlsCollection`](../dom_shim.mjs#L1179)
111-
* [`class FormControlMap`](../dom_shim.mjs#L1242)
112-
* [`class RadioNodeList`](../dom_shim.mjs#L1265)
113-
* [`const global`](../dom_shim.mjs#L1289)
114-
* [`const document`](../dom_shim.mjs#L1290)
115-
* [`const customElements`](../dom_shim.mjs#L1291)
116-
* [`function escapeAttr`](../dom_shim.mjs#L1324)
117-
* [`function escapeText`](../dom_shim.mjs#L1335)
118-
* [`function escapeChar`](../dom_shim.mjs#L1341)
119-
* [`function unescape`](../dom_shim.mjs#L1350)
120-
* [`function unescapeMatch`](../dom_shim.mjs#L1354)
121-
* [`class STYLE_TO_CSS`](../dom_shim.mjs#L1369)
122-
* [`class CAMEL_TO_DATA`](../dom_shim.mjs#L1373)
123-
* [`class DATA_TO_CAMEL`](../dom_shim.mjs#L1377)
124-
* [`const OUTER_HTML`](../dom_shim.mjs#L1382)
84+
* [`class HTMLElement`](../dom_shim.mjs#L602)
85+
* [`class HTMLMetaElement`](../dom_shim.mjs#L617)
86+
* [`class HTMLAnchorElement`](../dom_shim.mjs#L622)
87+
* [`class HTMLLabelElement`](../dom_shim.mjs#L644)
88+
* [`class HTMLButtonElement`](../dom_shim.mjs#L654)
89+
* [`class HTMLInputElement`](../dom_shim.mjs#L679)
90+
* [`class HTMLTextAreaElement`](../dom_shim.mjs#L691)
91+
* [`class HTMLObjectElement`](../dom_shim.mjs#L693)
92+
* [`class HTMLOutputElement`](../dom_shim.mjs#L695)
93+
* [`class HTMLSelectElement`](../dom_shim.mjs#L701)
94+
* [`class HTMLOptionElement`](../dom_shim.mjs#L709)
95+
* [`class HTMLFieldSetElement`](../dom_shim.mjs#L717)
96+
* [`class HTMLFormElement`](../dom_shim.mjs#L719)
97+
* [`class HTMLTableElement`](../dom_shim.mjs#L723)
98+
* [`class RawTextElement`](../dom_shim.mjs#L742)
99+
* [`class HTMLScriptElement`](../dom_shim.mjs#L747)
100+
* [`class HTMLStyleElement`](../dom_shim.mjs#L748)
101+
* [`class SVGElement`](../dom_shim.mjs#L755)
102+
* [`class DocumentType`](../dom_shim.mjs#L760)
103+
* [`class Document`](../dom_shim.mjs#L784)
104+
* [`class HTMLDocument`](../dom_shim.mjs#L877)
105+
* [`class DOMImplementation`](../dom_shim.mjs#L894)
106+
* [`class CustomElementRegistry`](../dom_shim.mjs#L926)
107+
* [`class DictPh`](../dom_shim.mjs#L953)
108+
* [`class StylePh`](../dom_shim.mjs#L966)
109+
* [`class ClassList`](../dom_shim.mjs#L1085)
110+
* [`class HTMLFormControlsCollection`](../dom_shim.mjs#L1181)
111+
* [`class FormControlMap`](../dom_shim.mjs#L1244)
112+
* [`class RadioNodeList`](../dom_shim.mjs#L1267)
113+
* [`const global`](../dom_shim.mjs#L1291)
114+
* [`const document`](../dom_shim.mjs#L1292)
115+
* [`const customElements`](../dom_shim.mjs#L1293)
116+
* [`function escapeAttr`](../dom_shim.mjs#L1326)
117+
* [`function escapeText`](../dom_shim.mjs#L1337)
118+
* [`function escapeChar`](../dom_shim.mjs#L1343)
119+
* [`function unescape`](../dom_shim.mjs#L1352)
120+
* [`function unescapeMatch`](../dom_shim.mjs#L1356)
121+
* [`class STYLE_TO_CSS`](../dom_shim.mjs#L1371)
122+
* [`class CAMEL_TO_DATA`](../dom_shim.mjs#L1375)
123+
* [`class DATA_TO_CAMEL`](../dom_shim.mjs#L1379)
124+
* [`const OUTER_HTML`](../dom_shim.mjs#L1384)

docs/http_deno_readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Also see [`http`](http_readme.md) for routing and cookies, and [`live_deno`](liv
1919
Simple example of a server that serves files from the current directory, automatically matching URL paths to HTML files:
2020

2121
```js
22-
import * as hd from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/http_deno.mjs'
22+
import * as hd from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/http_deno.mjs'
2323

2424
// Finds files in the current folder, with no filtering.
2525
const DIRS = hd.Dirs.of(hd.dirRel(`.`))

docs/http_readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Also see [`http_deno`](http_deno_readme.md) for Deno HTTP servers, [`http_srv`](
2424
## Usage
2525

2626
```js
27-
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/http.mjs'
27+
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/http.mjs'
2828

2929
const reqBody = {msg: `hello world`}
3030
const resBody = await h.reqBui().to(`/api`).post().json(reqBody).fetchOkJson()
@@ -41,7 +41,7 @@ Signature: `(res: Response | Promise<Response>) => Promise<Response>`.
4141
Missing feature of the [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). If the response is OK (HTTP code between 200 and 299, `.ok === true`), the resulting promise resolves to that response as-is. Otherwise the resulting promise is rejected with a descriptive [#`ErrHttp`](#class-errhttp) which includes the response status code, the response body (if any) as the error message, and the response itself for introspection if needed.
4242

4343
```js
44-
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/http.mjs'
44+
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/http.mjs'
4545

4646
// If response is unsuccessful, this will throw `h.ErrHttp`.
4747
const res = await h.resOk(await fetch(someUrl, someOpt))
@@ -104,8 +104,8 @@ rou.groups // {key: `path`}
104104
Routing is imperative:
105105

106106
```js
107-
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/http.mjs'
108-
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/lang.mjs'
107+
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/http.mjs'
108+
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/lang.mjs'
109109

110110
const nextPage = route(window.location)
111111

docs/iter_readme.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Port and rework of https://github.com/mitranim/fpx.
8787
## Usage
8888

8989
```js
90-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
90+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
9191
```
9292

9393
## Perf
@@ -314,8 +314,8 @@ Signature: `(Iter<A>, {new(A): B}) => B[]`.
314314
Similar to [#`map`](#function-map), but instead of taking an arbitrary function, takes a class and calls it with `new` for each element.
315315

316316
```js
317-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
318-
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/obj.mjs'
317+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
318+
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/obj.mjs'
319319

320320
class Model extends o.Dict {pk() {return this.id}}
321321
class Person extends Model {}
@@ -603,7 +603,7 @@ Links: [source](../iter.mjs#L401); [test/example](../test/iter_test.mjs#L1133).
603603
Syntactic shortcut for creating a `Set` via variadic call.
604604

605605
```js
606-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
606+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
607607

608608
i.setOf(10, 20, 30)
609609
// Set{10, 20, 30}
@@ -676,8 +676,8 @@ Similar to [#`map`](#function-map) but for dicts.
676676
* The mapping function receives only one argument: each value.
677677

678678
```js
679-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
680-
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/lang.mjs'
679+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
680+
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/lang.mjs'
681681

682682
i.mapDict({one: 10, two: 20}, l.inc)
683683
// {one: 11, two: 21}
@@ -698,8 +698,8 @@ Similar to [#`filter`](#function-filter) but for dicts.
698698
* The mapping function receives each value.
699699

700700
```js
701-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
702-
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/lang.mjs'
701+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
702+
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/lang.mjs'
703703

704704
i.pick({one: -20, two: -10, three: 10, four: 20}, l.isFinPos)
705705
// {three: 10, four: 20}
@@ -720,8 +720,8 @@ Similar to [#`reject`](#function-reject) but for dicts.
720720
* The mapping function receives each value.
721721

722722
```js
723-
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/iter.mjs'
724-
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.71/lang.mjs'
723+
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/iter.mjs'
724+
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.72/lang.mjs'
725725

726726
i.omit({one: -20, two: -10, three: 10, four: 20}, l.isFinPos)
727727
// {one: -20, two: -10}

0 commit comments

Comments
 (0)