Skip to content

Commit

Permalink
dom_shim: fix definition of placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
mitranim committed Aug 12, 2024
1 parent 646d25a commit 22e786f
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 74 deletions.
6 changes: 3 additions & 3 deletions docs/cli_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
CLI args:

```js
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/cli.mjs'
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/cli.mjs'

const cli = cl.Flag.os()

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

```js
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/cli.mjs'
import * as cl from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/cli.mjs'

cl.emptty()
```

Clearing the console only once, before running your code:

```js
import 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/cli_emptty.mjs'
import 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/cli_emptty.mjs'
```

## API
Expand Down
8 changes: 4 additions & 4 deletions docs/coll_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Port and rework of https://github.com/mitranim/jol.
## Usage

```js
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/coll.mjs'
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/coll.mjs'
```

## API
Expand Down Expand Up @@ -101,8 +101,8 @@ Links: [source](../coll.mjs#L101); [test/example](../test/coll_test.mjs#L218).
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).

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/coll.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/coll.mjs'

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

```js
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/coll.mjs'
import * as c from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/coll.mjs'

console.log(new c.Vec())
// Vec{$: []}
Expand Down
4 changes: 2 additions & 2 deletions docs/dom_global_native_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ In code intended only for browsers, simply use DOM globals. In code intended onl
```js
/*
Use a bundler or importmap to alias this import to one of:
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_global_native.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_global_shim.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_global_native.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_global_shim.mjs
*/
import * as dg from 'dom_global'

Expand Down
4 changes: 2 additions & 2 deletions docs/dom_global_shim_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ In code intended only for non-browser environments, simply import [`dom_global_s
```js
/*
Use a bundler or importmap to alias this import to one of:
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_global_native.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_global_shim.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_global_native.mjs
https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_global_shim.mjs
*/
import * as dg from 'dom_global'

Expand Down
2 changes: 1 addition & 1 deletion docs/dom_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Usage

```js
import * as d from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom.mjs'
import * as d from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom.mjs'
```

## API
Expand Down
4 changes: 2 additions & 2 deletions docs/dom_reg_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Example mockup for a pushstate link.

```js
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_reg.mjs'
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_reg.mjs'

// Immediately ready for use. Tag is automatically set to `a-btn`.
class Btn extends dr.HTMLButtonElement {
Expand Down Expand Up @@ -74,7 +74,7 @@ Registry for custom DOM element classes. Automatically derives tag name from cla
By default, this registry has **no global side effects**. To enable global registration, provide a "definer" to the registry.

```js
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_reg.mjs'
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_reg.mjs'

class Btn extends HTMLButtonElement {
// Optional. If omitted, `dr.reg` autogenerates
Expand Down
2 changes: 1 addition & 1 deletion docs/dom_shim_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Usage

```js
import * as ds from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_shim.mjs'
import * as ds from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_shim.mjs'
```

## API
Expand Down
8 changes: 4 additions & 4 deletions docs/http_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HTTP request/response utils are ported and reworked from https://github.com/mitr
## Usage

```js
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/http.mjs'
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/http.mjs'

const reqBody = {msg: `hello world`}
const resBody = await h.reqBui().to(`/api`).post().json(reqBody).fetchOkJson()
Expand Down Expand Up @@ -234,8 +234,8 @@ rou.groups // {key: `path`}
Routing is imperative:

```js
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/http.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/http.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

const nextPage = route(window.location)

Expand Down Expand Up @@ -263,7 +263,7 @@ Short for "request router" or "request-response router". Advanced version of [#`
Routing can be shared between SSR and SPA:

```js
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/http.mjs'
import * as h from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/http.mjs'

function route(rou) {
l.reqInst(rou, h.ReqRou)
Expand Down
20 changes: 10 additions & 10 deletions docs/iter_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Port and rework of https://github.com/mitranim/fpx.
## Usage

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'
```

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

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obj.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obj.mjs'

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

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'

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

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

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

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

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

```js
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as i from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/iter.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

i.omit({one: -20, two: -10, three: 10, four: 20}, l.isFinPos)
// {one: -20, two: -10}
Expand Down
22 changes: 11 additions & 11 deletions docs/lang_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Port and rework of https://github.com/mitranim/fpx.
## Usage

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'
```

## API
Expand All @@ -120,7 +120,7 @@ Links: [source](../lang.mjs#L3); [test/example](../test/lang_test.mjs#L222).
True for `null` and `undefined`. Same as `value == null`. Incidentally, these are the only values that produce an exception when attempting to read a property: `null.someProperty`.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

// Definition
function isNil(value) {return value == null}
Expand Down Expand Up @@ -154,7 +154,7 @@ Links: [source](../lang.mjs#L19); [test/example](../test/lang_test.mjs#L247).
Same as `typeof val === 'number'`. True if the value is a primitive number, _including_ `NaN` and `±Infinity`. In most cases you should use [#`isFin`](#function-isfin) instead.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

l.isNum(1)
// true
Expand All @@ -173,7 +173,7 @@ Links: [source](../lang.mjs#L25); [test/example](../test/lang_test.mjs#L259).
Same as ES2015's [`Number.isFinite`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite). True if `val` is a primitive number and is _not_ `NaN` or `±Infinity`. In most cases you should prefer `isFin` over `isNum`.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

l.isFin(1)
// true
Expand Down Expand Up @@ -501,7 +501,7 @@ Signature: `(val, test) => val` where `test: val => bool`.
Short for "require". Minification-friendly assertion. If `!test(val)`, throws an informative `TypeError`. Otherwise, returns `val` as-is.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

l.req({one: `two`}, l.isObj)
// {one: `two`}
Expand Down Expand Up @@ -600,7 +600,7 @@ Identity test: same as `===`, but considers `NaN` equal to `NaN`. Equivalent to
Note that [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) implements [_SameValue_](https://www.ecma-international.org/ecma-262/6.0/#sec-samevalue), which treats `-0` and `+0` as _distinct values_. This is typically undesirable. As a result, you should prefer `l.is` over `===` or `Object.is`.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

l.is(1, '1')
// false
Expand Down Expand Up @@ -640,7 +640,7 @@ Links: [source](../lang.mjs#L423); [test/example](../test/lang_test.mjs#L1712).
Takes a value and creates a function that always returns that value. Sometimes useful with higher order functions.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

const constant = l.val(1)

Expand All @@ -658,7 +658,7 @@ Links: [source](../lang.mjs#L424); [test/example](../test/lang_test.mjs#L1726).
Same as `throw` but an expression rather than a statement. Also sometimes useful with higher-order functions.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

const x = someTest ? someValue : l.panic(Error(`unreachable`))
```
Expand All @@ -678,7 +678,7 @@ Like [`Function.prototype.bind`](https://developer.mozilla.org/en-US/docs/Web/Ja
Returns a new function that represents [partial application](https://en.wikipedia.org/wiki/Partial_application) of the given function, a common tool in functional programming. When called, it joins arguments from both calls and invokes the original function. Think of it like splitting a function call in two, or more. Performance is inferior to closures; avoid in hotspots.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

const inc = l.bind(l.add, 1)

Expand All @@ -695,7 +695,7 @@ Links: [source](../lang.mjs#L430); [test/example](../test/lang_test.mjs#L1689).
Returns a new function that negates the result of the given function, like a delayed `!`.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

function eq(a, b) {return a === b}

Expand Down Expand Up @@ -727,7 +727,7 @@ Links: [source](../lang.mjs#L437); [test/example](../test/lang_test.mjs#L1148).
Returns `true` if the target is [#non-primitive](#function-iscomp) and has the given property on its prototype. As a consequence, this returns `false` if the target is a primitive, or has the given property as an "own" property, either enumerable or not.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'

l.hasInherited([10, 20, 30], `length`)
// false
Expand Down
12 changes: 6 additions & 6 deletions docs/obj_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Usage

```js
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obj.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obj.mjs'
```

## API
Expand Down Expand Up @@ -82,8 +82,8 @@ Performance characteristics:
* When the number of declared properties is significantly smaller than the number of provided properties, this tends to be faster than the aforementioned assignment functions.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obj.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obj.mjs'

class Person extends o.Struct {
static Spec = class extends super.Spec {
Expand Down Expand Up @@ -126,8 +126,8 @@ Differences from [#`Struct`](#class-struct):
* Measurably worse performance.

```js
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/lang.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obj.mjs'
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/lang.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obj.mjs'

class Person extends o.StructLax {
static Spec = class extends super.Spec {
Expand Down Expand Up @@ -160,7 +160,7 @@ Links: [source](../obj.mjs#L304); [test/example](../test/obj_test.mjs#L786).
Takes a class and hacks its prototype, converting all non-inherited getters to lazy/memoizing versions of themselves that only execute _once_. The resulting value replaces the getter. Inherited getters are unaffected.

```js
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obj.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obj.mjs'

class Bucket {
static {o.memGet(this)}
Expand Down
6 changes: 3 additions & 3 deletions docs/obs_dom_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Optionally combine with [`dom_reg`](dom_reg_readme.md) for automatic registratio
`MixReac` is a "mixin" that adds reactivity to the class:

```js
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obs.mjs'
import * as od from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/obs_dom.mjs'
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/dom_reg.mjs'
import * as o from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obs.mjs'
import * as od from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/obs_dom.mjs'
import * as dr from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/dom_reg.mjs'

const obs = o.obs({msg: `hello!`})

Expand Down
6 changes: 3 additions & 3 deletions docs/path_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Known limitations:
Using a specific implementation:

```js
import * as p from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/path.mjs'
import * as p from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/path.mjs'

console.log(p.posix.join(`one`, `two`))
// 'one/two'
Expand All @@ -40,7 +40,7 @@ console.log(p.windows.join(`one`, `two`))
Using the default implementation for the current OS:

```js
import {paths as p} from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/io_deno.mjs'
import {paths as p} from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/io_deno.mjs'

console.log(p.join(`one`, `two`))
// 'one/two' or 'one\\two' depending on your OS
Expand All @@ -55,7 +55,7 @@ Links: [source](../path.mjs#L33); [test/example](../test/path_test.mjs#L17).
Idempotently converts a path from Windows-style to Posix-style. Useful in some edge case scenarios.

```js
import * as p from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].55/path.mjs'
import * as p from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected].56/path.mjs'

console.log(p.toPosix(`one\\two\\three`))
// 'one/two/three'
Expand Down
Loading

0 comments on commit 22e786f

Please sign in to comment.