synstate-dom 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/internal/as-constant.d.mts +4 -4
- package/dist/internal/dom-tables.d.mts.map +1 -1
- package/dist/internal/dom-tables.mjs +3 -0
- package/dist/internal/dom-tables.mjs.map +1 -1
- package/dist/jsx/element-props.d.mts +15 -2
- package/dist/jsx/element-props.d.mts.map +1 -1
- package/dist/keyboard/index.d.mts +2 -0
- package/dist/keyboard/index.d.mts.map +1 -0
- package/dist/keyboard/index.mjs +2 -0
- package/dist/keyboard/index.mjs.map +1 -0
- package/dist/keyboard/is-ime-key-down.d.mts +11 -0
- package/dist/keyboard/is-ime-key-down.d.mts.map +1 -0
- package/dist/keyboard/is-ime-key-down.mjs +15 -0
- package/dist/keyboard/is-ime-key-down.mjs.map +1 -0
- package/package.json +7 -7
- package/src/index.mts +1 -0
- package/src/internal/as-constant.mts +4 -4
- package/src/internal/dom-tables.mts +3 -0
- package/src/jsx/element-props.mts +39 -2
- package/src/keyboard/index.mts +1 -0
- package/src/keyboard/is-ime-key-down.mts +20 -0
- package/src/keyboard/is-ime-key-down.test.mts +42 -0
package/README.md
CHANGED
|
@@ -215,6 +215,7 @@ synstate derivations are not lazy: a derivation is computed whenever its parent
|
|
|
215
215
|
- `For`: one row per key, each in a scope of its own; `item$` and `index$` are derived from `items`, and rows are moved as little as the longest increasing subsequence allows.
|
|
216
216
|
- `Portal`: mounts its children into another element, in the scope where it is written.
|
|
217
217
|
- `subscribeInScope`, `listenInScope` and `createAfterUpdate`: what a component, called once, does in place of an effect. A subscription or an event listener lasts until the current scope is disposed, and work runs in a microtask once the update under way has finished, dropped if the scope has been disposed by then.
|
|
218
|
+
- `isImeKeyDown(event)`: whether a key down belongs to an input method, so that a handler for Enter or Escape leaves it alone. That is a key sent while a composition is going on, or the Enter or Escape that confirmed or cancelled one, which Safari sends after `compositionend` with key code 229.
|
|
218
219
|
|
|
219
220
|
## Naming
|
|
220
221
|
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Constant } from '../constant/index.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* The one type assertion
|
|
4
|
-
* only in the type system, so marking a value as one changes nothing at
|
|
5
|
-
* time; this is what {@link constant} and the helpers that derive one
|
|
6
|
-
* from another call.
|
|
3
|
+
* The one type assertion that brands a value. `Constant<T>` is a brand that
|
|
4
|
+
* exists only in the type system, so marking a value as one changes nothing at
|
|
5
|
+
* run time; this is what {@link constant} and the helpers that derive one
|
|
6
|
+
* constant from another call.
|
|
7
7
|
*/
|
|
8
8
|
export declare const asConstant: <T>(value: T) => Constant<T>;
|
|
9
9
|
//# sourceMappingURL=as-constant.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-tables.d.mts","sourceRoot":"","sources":["../../src/internal/dom-tables.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,YACxB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,CACC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dom-tables.d.mts","sourceRoot":"","sources":["../../src/internal/dom-tables.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,YACxB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,CACC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,CAOjD,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,WAAW,2uBA+DrB,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YAC5B,WAAW,EACX,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,mBAAmB,EACnB,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,cAAc,EACd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,qBAAqB,EACrB,GAAG,EACH,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,YAAY,EACZ,OAAO,EACP,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,CACI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-tables.mjs","sourceRoot":"","sources":["../../src/internal/dom-tables.mts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,eAAe;IACf,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;IACX,OAAO;CACC,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC;IAC7D,aAAa,EAAE,gBAAgB;IAC/B,OAAO,EAA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AAc;IACd,QAAQ;IACR,qBAAqB;IACrB,GAAG;IACH,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,YAAY;IACZ,cAAc;IACd,QAAQ;IACR,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,UAAU;IACV,aAAa;IACb,WAAW;IACX,SAAS;IACT,YAAY;IACZ,OAAO;IACP,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;CACI,CAAC"}
|
|
1
|
+
{"version":3,"file":"dom-tables.mjs","sourceRoot":"","sources":["../../src/internal/dom-tables.mts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,eAAe;IACf,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;IACX,OAAO;CACC,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC;IAC7D,aAAa,EAAE,gBAAgB;IAC/B,YAAY,EAAE,OAAO;IACrB,eAAe,EAAE,UAAU;IAC3B,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,YAAY;CACf,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,eAAe;IACf,kBAAkB;IAClB,QAAQ;IACR,UAAU;IACV,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,eAAe;IACf,qBAAqB;IACrB,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;IACd,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,SAAS;IACT,SAAS;IACT,aAAa;IACb,cAAc;IACd,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,aAAa;IACb,QAAQ;IACR,cAAc;IACd,QAAQ;IACR,eAAe;IACf,GAAG;IACH,OAAO;IACP,MAAM;IACN,gBAAgB;IAChB,QAAQ;IACR,MAAM;IACN,UAAU;IACV,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,UAAU;IACV,OAAO;IACP,KAAK;IACL,MAAM;CAIL,CAAC;AAIJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,WAAW;IACX,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,mBAAmB;IACnB,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,cAAc;IACd,WAAW;IACX,QAAQ;IACR,aAAa;IACb,WAAW;IACX,aAAa;IACb,IAAI;IACJ,IAAI;IACJ,mBAAmB;IACnB,eAAe;IACf,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;IACb,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,QAAQ;IACR,qBAAqB;IACrB,GAAG;IACH,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,YAAY;IACZ,cAAc;IACd,QAAQ;IACR,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,UAAU;IACV,aAAa;IACb,WAAW;IACX,SAAS;IACT,YAAY;IACZ,OAAO;IACP,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;CACI,CAAC"}
|
|
@@ -71,8 +71,21 @@ type ReflectedKey<E, K extends keyof E> = string extends K ? never : number exte
|
|
|
71
71
|
type IsWritable<E, K extends keyof E> = TypeEq<StrictPick<E, K>, Readonly<StrictPick<E, K>>> extends true ? false : true;
|
|
72
72
|
/**
|
|
73
73
|
* Writable primitive properties that are not attributes, or that are props of
|
|
74
|
-
* their own (`class`, `style`).
|
|
74
|
+
* their own (`class`, `style`). The binding would pass them to `setAttribute`,
|
|
75
|
+
* which makes an attribute nothing reads (#2934): the parts of `<a>`'s `href`
|
|
76
|
+
* (`hash` … `username`), the text of `<a>`, `<option>`, `<script>` and
|
|
77
|
+
* `<title>` (`text`), media playback state (`currentTime` … `volume`), and form
|
|
78
|
+
* control state (`returnValue` … `length`), and the obsolete `ch` and `chOff`
|
|
79
|
+
* of table cells, whose attributes are `char` and `charoff`. A property written as a property is
|
|
80
|
+
* in `propertyNames`, and one whose attribute is spelt differently in
|
|
81
|
+
* `attributeNameOf`. Checked in Chromium by setting the attribute and reading
|
|
82
|
+
* the property back.
|
|
83
|
+
*
|
|
84
|
+
* The keys are left out of every element, so a name that is an attribute on one
|
|
85
|
+
* element and not on another goes by the common case: `<body>`'s obsolete
|
|
86
|
+
* `text` attribute is left out with the rest, and `<style>`'s `disabled`, which
|
|
87
|
+
* has no attribute, stays in with every other `disabled`.
|
|
75
88
|
*/
|
|
76
|
-
type ExcludedKey = 'className' | 'innerHTML' | 'innerText' | 'nodeValue' | 'outerHTML' | 'outerText' | 'scrollLeft' | 'scrollTop' | 'textContent';
|
|
89
|
+
type ExcludedKey = 'className' | 'innerHTML' | 'innerText' | 'nodeValue' | 'outerHTML' | 'outerText' | 'scrollLeft' | 'scrollTop' | 'textContent' | 'hash' | 'host' | 'hostname' | 'password' | 'pathname' | 'port' | 'protocol' | 'search' | 'username' | 'text' | 'currentTime' | 'defaultPlaybackRate' | 'playbackRate' | 'preservesPitch' | 'volume' | 'returnValue' | 'selectedIndex' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'valueAsNumber' | 'length' | 'ch' | 'chOff';
|
|
77
90
|
export {};
|
|
78
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P,KAAK,CAAC;AAEhB,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAClC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAC7D,KAAK,GACL,IAAI,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,WAAW,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,YAAY,GACZ,WAAW,GACX,aAAa,GACb,MAAM,GACN,MAAM,GACN,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,UAAU,GACV,QAAQ,GACR,UAAU,GACV,MAAM,GACN,aAAa,GACb,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,QAAQ,GACR,IAAI,GACJ,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/keyboard/index.mts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/keyboard/index.mts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StrictPick } from 'ts-type-forge';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a key down is an input method's rather than the field's: one sent
|
|
4
|
+
* while a composition is going on, or the Enter or Escape that confirmed or
|
|
5
|
+
* cancelled one, which Safari sends after `compositionend`, told from the
|
|
6
|
+
* field's by its key code alone. Other keys with that key code are the field's:
|
|
7
|
+
* a virtual keyboard on Android sends it for the keys that type text, and its
|
|
8
|
+
* arrow keys may carry it too.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isImeKeyDown: (event: StrictPick<KeyboardEvent, 'isComposing' | 'key' | 'keyCode'>) => boolean;
|
|
11
|
+
//# sourceMappingURL=is-ime-key-down.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-ime-key-down.d.mts","sourceRoot":"","sources":["../../src/keyboard/is-ime-key-down.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,UAChB,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC,KAClE,OAI8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-ime-key-down.mjs","sourceRoot":"","sources":["../../src/keyboard/is-ime-key-down.mts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAmE,EAC1D,EAAE,CACX,KAAK,CAAC,WAAW;IACjB,CAAC,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;QAChD,6GAA6G;QAC7G,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;AAElC,6DAA6D;AAC7D,MAAM,UAAU,GAAG,GAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synstate-dom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Compiler-free fine-grained UI library that binds synstate observables directly to the DOM",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@vitest/browser-playwright": "5.0.5",
|
|
47
|
-
"eslint-config-typed": "7.3.
|
|
48
|
-
"eslint-plugin-ts-data-forge": "0.10.
|
|
47
|
+
"eslint-config-typed": "7.3.1",
|
|
48
|
+
"eslint-plugin-ts-data-forge": "0.10.8",
|
|
49
49
|
"eslint-plugin-ts-fortress": "1.3.12",
|
|
50
50
|
"eslint-plugin-ts-type-forge": "0.8.17",
|
|
51
51
|
"playwright": "1.64.1",
|
|
52
52
|
"prettier": "3.9.10",
|
|
53
53
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
54
54
|
"prettier-plugin-packagejson": "3.0.2",
|
|
55
|
-
"synstate": "6.
|
|
56
|
-
"ts-data-forge": "14.10.
|
|
55
|
+
"synstate": "6.2.1",
|
|
56
|
+
"ts-data-forge": "14.10.2",
|
|
57
57
|
"ts-repo-utils": "10.7.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"synstate": ">=6.
|
|
61
|
-
"ts-data-forge": ">=14.10.
|
|
60
|
+
"synstate": ">=6.2.1",
|
|
61
|
+
"ts-data-forge": ">=14.10.2"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.23.4",
|
package/src/index.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Constant } from '../constant/index.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The one type assertion
|
|
5
|
-
* only in the type system, so marking a value as one changes nothing at
|
|
6
|
-
* time; this is what {@link constant} and the helpers that derive one
|
|
7
|
-
* from another call.
|
|
4
|
+
* The one type assertion that brands a value. `Constant<T>` is a brand that
|
|
5
|
+
* exists only in the type system, so marking a value as one changes nothing at
|
|
6
|
+
* run time; this is what {@link constant} and the helpers that derive one
|
|
7
|
+
* constant from another call.
|
|
8
8
|
*/
|
|
9
9
|
export const asConstant = <T,>(value: T): Constant<T> =>
|
|
10
10
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion -- a brand has no run-time part to check
|
|
@@ -28,6 +28,9 @@ export const propertyNames = [
|
|
|
28
28
|
*/
|
|
29
29
|
export const attributeNameOf: ReadonlyRecord<string, string> = {
|
|
30
30
|
acceptCharset: 'accept-charset',
|
|
31
|
+
defaultMuted: 'muted',
|
|
32
|
+
defaultSelected: 'selected',
|
|
33
|
+
encoding: 'enctype',
|
|
31
34
|
htmlFor: 'for',
|
|
32
35
|
httpEquiv: 'http-equiv',
|
|
33
36
|
} as const;
|
|
@@ -118,7 +118,20 @@ type IsWritable<E, K extends keyof E> =
|
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Writable primitive properties that are not attributes, or that are props of
|
|
121
|
-
* their own (`class`, `style`).
|
|
121
|
+
* their own (`class`, `style`). The binding would pass them to `setAttribute`,
|
|
122
|
+
* which makes an attribute nothing reads (#2934): the parts of `<a>`'s `href`
|
|
123
|
+
* (`hash` … `username`), the text of `<a>`, `<option>`, `<script>` and
|
|
124
|
+
* `<title>` (`text`), media playback state (`currentTime` … `volume`), and form
|
|
125
|
+
* control state (`returnValue` … `length`), and the obsolete `ch` and `chOff`
|
|
126
|
+
* of table cells, whose attributes are `char` and `charoff`. A property written as a property is
|
|
127
|
+
* in `propertyNames`, and one whose attribute is spelt differently in
|
|
128
|
+
* `attributeNameOf`. Checked in Chromium by setting the attribute and reading
|
|
129
|
+
* the property back.
|
|
130
|
+
*
|
|
131
|
+
* The keys are left out of every element, so a name that is an attribute on one
|
|
132
|
+
* element and not on another goes by the common case: `<body>`'s obsolete
|
|
133
|
+
* `text` attribute is left out with the rest, and `<style>`'s `disabled`, which
|
|
134
|
+
* has no attribute, stays in with every other `disabled`.
|
|
122
135
|
*/
|
|
123
136
|
type ExcludedKey =
|
|
124
137
|
| 'className'
|
|
@@ -129,4 +142,28 @@ type ExcludedKey =
|
|
|
129
142
|
| 'outerText'
|
|
130
143
|
| 'scrollLeft'
|
|
131
144
|
| 'scrollTop'
|
|
132
|
-
| 'textContent'
|
|
145
|
+
| 'textContent'
|
|
146
|
+
| 'hash'
|
|
147
|
+
| 'host'
|
|
148
|
+
| 'hostname'
|
|
149
|
+
| 'password'
|
|
150
|
+
| 'pathname'
|
|
151
|
+
| 'port'
|
|
152
|
+
| 'protocol'
|
|
153
|
+
| 'search'
|
|
154
|
+
| 'username'
|
|
155
|
+
| 'text'
|
|
156
|
+
| 'currentTime'
|
|
157
|
+
| 'defaultPlaybackRate'
|
|
158
|
+
| 'playbackRate'
|
|
159
|
+
| 'preservesPitch'
|
|
160
|
+
| 'volume'
|
|
161
|
+
| 'returnValue'
|
|
162
|
+
| 'selectedIndex'
|
|
163
|
+
| 'selectionDirection'
|
|
164
|
+
| 'selectionEnd'
|
|
165
|
+
| 'selectionStart'
|
|
166
|
+
| 'valueAsNumber'
|
|
167
|
+
| 'length'
|
|
168
|
+
| 'ch'
|
|
169
|
+
| 'chOff';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './is-ime-key-down.mjs';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StrictPick } from 'ts-type-forge';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Whether a key down is an input method's rather than the field's: one sent
|
|
5
|
+
* while a composition is going on, or the Enter or Escape that confirmed or
|
|
6
|
+
* cancelled one, which Safari sends after `compositionend`, told from the
|
|
7
|
+
* field's by its key code alone. Other keys with that key code are the field's:
|
|
8
|
+
* a virtual keyboard on Android sends it for the keys that type text, and its
|
|
9
|
+
* arrow keys may carry it too.
|
|
10
|
+
*/
|
|
11
|
+
export const isImeKeyDown = (
|
|
12
|
+
event: StrictPick<KeyboardEvent, 'isComposing' | 'key' | 'keyCode'>,
|
|
13
|
+
): boolean =>
|
|
14
|
+
event.isComposing ||
|
|
15
|
+
((event.key === 'Enter' || event.key === 'Escape') &&
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- the key code is all that tells Safari's apart
|
|
17
|
+
event.keyCode === imeKeyCode);
|
|
18
|
+
|
|
19
|
+
/** The key code of a key down that an input method takes. */
|
|
20
|
+
const imeKeyCode = 229;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isImeKeyDown } from './is-ime-key-down.mjs';
|
|
2
|
+
|
|
3
|
+
// Plain objects stand in for `KeyboardEvent`s: it reads only these fields, and
|
|
4
|
+
// Node.js has no `KeyboardEvent`.
|
|
5
|
+
describe(isImeKeyDown, () => {
|
|
6
|
+
test('is a key down sent while an input method is composing', () => {
|
|
7
|
+
assert.isTrue(isImeKeyDown(keyDown('a', 229, true)));
|
|
8
|
+
|
|
9
|
+
assert.isTrue(isImeKeyDown(keyDown('ArrowUp', 229, true)));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test.each(['Enter', 'Escape'])(
|
|
13
|
+
'is %s with key code 229, which Safari sends after compositionend',
|
|
14
|
+
(key) => {
|
|
15
|
+
assert.isTrue(isImeKeyDown(keyDown(key, 229)));
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
test('is not another key with key code 229, as an Android virtual keyboard sends every key', () => {
|
|
20
|
+
assert.isFalse(isImeKeyDown(keyDown('ArrowUp', 229)));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test.each([
|
|
24
|
+
['Enter', 13],
|
|
25
|
+
['Escape', 27],
|
|
26
|
+
['a', 65],
|
|
27
|
+
] as const)('is not a plain %s', (key, code) => {
|
|
28
|
+
assert.isFalse(isImeKeyDown(keyDown(key, code)));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/** The fields of a key down that `isImeKeyDown` reads. */
|
|
33
|
+
const keyDown = (
|
|
34
|
+
key: string,
|
|
35
|
+
code: number,
|
|
36
|
+
isComposing: boolean = false,
|
|
37
|
+
): Readonly<{ key: string; keyCode: number; isComposing: boolean }> =>
|
|
38
|
+
({
|
|
39
|
+
key,
|
|
40
|
+
keyCode: code,
|
|
41
|
+
isComposing,
|
|
42
|
+
}) as const;
|