synstate-dom 0.0.0-stage → 0.2.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/LICENSE +201 -0
- package/README.md +218 -2
- package/dist/bind/bind-props.d.mts +9 -0
- package/dist/bind/bind-props.d.mts.map +1 -0
- package/dist/bind/bind-props.mjs +117 -0
- package/dist/bind/bind-props.mjs.map +1 -0
- package/dist/bind/index.d.mts +2 -0
- package/dist/bind/index.d.mts.map +1 -0
- package/dist/bind/index.mjs +2 -0
- package/dist/bind/index.mjs.map +1 -0
- package/dist/constant/bindable.d.mts +11 -0
- package/dist/constant/bindable.d.mts.map +1 -0
- package/dist/constant/bindable.mjs +2 -0
- package/dist/constant/bindable.mjs.map +1 -0
- package/dist/constant/constant.d.mts +20 -0
- package/dist/constant/constant.d.mts.map +1 -0
- package/dist/constant/constant.mjs +10 -0
- package/dist/constant/constant.mjs.map +1 -0
- package/dist/constant/derive.d.mts +16 -0
- package/dist/constant/derive.d.mts.map +1 -0
- package/dist/constant/derive.mjs +28 -0
- package/dist/constant/derive.mjs.map +1 -0
- package/dist/constant/index.d.mts +7 -0
- package/dist/constant/index.d.mts.map +1 -0
- package/dist/constant/index.mjs +7 -0
- package/dist/constant/index.mjs.map +1 -0
- package/dist/constant/map-bindable.d.mts +10 -0
- package/dist/constant/map-bindable.d.mts.map +1 -0
- package/dist/constant/map-bindable.mjs +16 -0
- package/dist/constant/map-bindable.mjs.map +1 -0
- package/dist/constant/to-observable.d.mts +12 -0
- package/dist/constant/to-observable.d.mts.map +1 -0
- package/dist/constant/to-observable.mjs +16 -0
- package/dist/constant/to-observable.mjs.map +1 -0
- package/dist/constant/view.d.mts +25 -0
- package/dist/constant/view.d.mts.map +1 -0
- package/dist/constant/view.mjs +15 -0
- package/dist/constant/view.mjs.map +1 -0
- package/dist/control/for.d.mts +29 -0
- package/dist/control/for.d.mts.map +1 -0
- package/dist/control/for.mjs +201 -0
- package/dist/control/for.mjs.map +1 -0
- package/dist/control/if.d.mts +16 -0
- package/dist/control/if.d.mts.map +1 -0
- package/dist/control/if.mjs +12 -0
- package/dist/control/if.mjs.map +1 -0
- package/dist/control/index.d.mts +6 -0
- package/dist/control/index.d.mts.map +1 -0
- package/dist/control/index.mjs +6 -0
- package/dist/control/index.mjs.map +1 -0
- package/dist/control/longest-increasing-subsequence.d.mts +7 -0
- package/dist/control/longest-increasing-subsequence.d.mts.map +1 -0
- package/dist/control/longest-increasing-subsequence.mjs +37 -0
- package/dist/control/longest-increasing-subsequence.mjs.map +1 -0
- package/dist/control/match-optional.d.mts +19 -0
- package/dist/control/match-optional.d.mts.map +1 -0
- package/dist/control/match-optional.mjs +21 -0
- package/dist/control/match-optional.mjs.map +1 -0
- package/dist/control/match-result.d.mts +19 -0
- package/dist/control/match-result.d.mts.map +1 -0
- package/dist/control/match-result.mjs +27 -0
- package/dist/control/match-result.mjs.map +1 -0
- package/dist/control/mount-switch.d.mts +18 -0
- package/dist/control/mount-switch.d.mts.map +1 -0
- package/dist/control/mount-switch.mjs +51 -0
- package/dist/control/mount-switch.mjs.map +1 -0
- package/dist/control/portal.d.mts +15 -0
- package/dist/control/portal.d.mts.map +1 -0
- package/dist/control/portal.mjs +22 -0
- package/dist/control/portal.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/as-constant.d.mts +9 -0
- package/dist/internal/as-constant.d.mts.map +1 -0
- package/dist/internal/as-constant.mjs +10 -0
- package/dist/internal/as-constant.mjs.map +1 -0
- package/dist/internal/bind-value.d.mts +14 -0
- package/dist/internal/bind-value.d.mts.map +1 -0
- package/dist/internal/bind-value.mjs +39 -0
- package/dist/internal/bind-value.mjs.map +1 -0
- package/dist/internal/dom-tables.d.mts +30 -0
- package/dist/internal/dom-tables.d.mts.map +1 -0
- package/dist/internal/dom-tables.mjs +167 -0
- package/dist/internal/dom-tables.mjs.map +1 -0
- package/dist/internal/index.d.mts +7 -0
- package/dist/internal/index.d.mts.map +1 -0
- package/dist/internal/index.mjs +7 -0
- package/dist/internal/index.mjs.map +1 -0
- package/dist/internal/is-view.d.mts +3 -0
- package/dist/internal/is-view.d.mts.map +1 -0
- package/dist/internal/is-view.mjs +4 -0
- package/dist/internal/is-view.mjs.map +1 -0
- package/dist/internal/mountable-tag.d.mts +6 -0
- package/dist/internal/mountable-tag.d.mts.map +1 -0
- package/dist/internal/mountable-tag.mjs +6 -0
- package/dist/internal/mountable-tag.mjs.map +1 -0
- package/dist/internal/view-tag.d.mts +7 -0
- package/dist/internal/view-tag.d.mts.map +1 -0
- package/dist/internal/view-tag.mjs +7 -0
- package/dist/internal/view-tag.mjs.map +1 -0
- package/dist/jsx/child.d.mts +20 -0
- package/dist/jsx/child.d.mts.map +1 -0
- package/dist/jsx/child.mjs +33 -0
- package/dist/jsx/child.mjs.map +1 -0
- package/dist/jsx/element-props.d.mts +78 -0
- package/dist/jsx/element-props.d.mts.map +1 -0
- package/dist/jsx/element-props.mjs +2 -0
- package/dist/jsx/element-props.mjs.map +1 -0
- package/dist/jsx/event-prop-names.d.mts +120 -0
- package/dist/jsx/event-prop-names.d.mts.map +1 -0
- package/dist/jsx/event-prop-names.mjs +2 -0
- package/dist/jsx/event-prop-names.mjs.map +1 -0
- package/dist/jsx/index.d.mts +7 -0
- package/dist/jsx/index.d.mts.map +1 -0
- package/dist/jsx/index.mjs +7 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/jsx-namespace.d.mts +11 -0
- package/dist/jsx/jsx-namespace.d.mts.map +1 -0
- package/dist/jsx/jsx-namespace.mjs +2 -0
- package/dist/jsx/jsx-namespace.mjs.map +1 -0
- package/dist/jsx/jsx.d.mts +18 -0
- package/dist/jsx/jsx.d.mts.map +1 -0
- package/dist/jsx/jsx.mjs +46 -0
- package/dist/jsx/jsx.mjs.map +1 -0
- package/dist/jsx/mountable.d.mts +25 -0
- package/dist/jsx/mountable.d.mts.map +1 -0
- package/dist/jsx/mountable.mjs +7 -0
- package/dist/jsx/mountable.mjs.map +1 -0
- package/dist/jsx-dev-runtime.d.mts +7 -0
- package/dist/jsx-dev-runtime.d.mts.map +1 -0
- package/dist/jsx-dev-runtime.mjs +7 -0
- package/dist/jsx-dev-runtime.mjs.map +1 -0
- package/dist/jsx-runtime.d.mts +7 -0
- package/dist/jsx-runtime.d.mts.map +1 -0
- package/dist/jsx-runtime.mjs +7 -0
- package/dist/jsx-runtime.mjs.map +1 -0
- package/dist/render.d.mts +14 -0
- package/dist/render.d.mts.map +1 -0
- package/dist/render.mjs +25 -0
- package/dist/render.mjs.map +1 -0
- package/package.json +97 -3
- package/src/bind/bind-props.mts +174 -0
- package/src/bind/index.mts +1 -0
- package/src/constant/bindable.mts +19 -0
- package/src/constant/constant.mts +24 -0
- package/src/constant/constant.test.mts +70 -0
- package/src/constant/derive.mts +51 -0
- package/src/constant/derive.test.mts +64 -0
- package/src/constant/index.mts +6 -0
- package/src/constant/map-bindable.mts +23 -0
- package/src/constant/map-bindable.test.mts +63 -0
- package/src/constant/to-observable.mts +20 -0
- package/src/constant/to-observable.test.mts +37 -0
- package/src/constant/view.mts +35 -0
- package/src/constant/view.test.mts +40 -0
- package/src/control/for.mts +362 -0
- package/src/control/if.mts +28 -0
- package/src/control/index.mts +5 -0
- package/src/control/longest-increasing-subsequence.mts +59 -0
- package/src/control/longest-increasing-subsequence.test.mts +26 -0
- package/src/control/match-optional.mts +41 -0
- package/src/control/match-result.mts +48 -0
- package/src/control/mount-switch.mts +75 -0
- package/src/control/portal.mts +32 -0
- package/src/index.mts +4 -0
- package/src/internal/as-constant.mts +11 -0
- package/src/internal/bind-value.mts +58 -0
- package/src/internal/dom-tables.mts +176 -0
- package/src/internal/index.mts +6 -0
- package/src/internal/is-view.mts +6 -0
- package/src/internal/mountable-tag.mts +5 -0
- package/src/internal/view-tag.mts +6 -0
- package/src/jsx/child.mts +51 -0
- package/src/jsx/element-props.mts +132 -0
- package/src/jsx/element-props.test.mts +28 -0
- package/src/jsx/event-prop-names.mts +119 -0
- package/src/jsx/index.mts +6 -0
- package/src/jsx/jsx-namespace.mts +11 -0
- package/src/jsx/jsx.mts +63 -0
- package/src/jsx/mountable.mts +31 -0
- package/src/jsx-dev-runtime.mts +6 -0
- package/src/jsx-runtime.mts +11 -0
- package/src/render.mts +32 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.mjs","sourceRoot":"","sources":["../../src/jsx/child.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AASzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAY,EAAwB,EAAE;IAC/D,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAE7C,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACzB,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAwB,EAAE,CACnE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAW,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAkB,EAAE,CACxD,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;IAClB,QAAQ,CAAC,KAAK,CAAC;IACf,QAAQ,CAAC,KAAK,CAAC;IACf,YAAY,CAAC,KAAK,CAAC;IACnB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,WAAW,GAAG,CAAC,KAAY,EAAsB,EAAE,CACvD,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ReadonlyRecord, StrictPick, TypeEq } from 'ts-type-forge';
|
|
2
|
+
import type { Bindable } from '../constant/index.mjs';
|
|
3
|
+
import type { propertyNames, svgAttributeNames, SvgTagName } from '../internal/index.mjs';
|
|
4
|
+
import type { Child } from './child.mjs';
|
|
5
|
+
import type { EventPropNames } from './event-prop-names.mjs';
|
|
6
|
+
/**
|
|
7
|
+
* The props every intrinsic element takes.
|
|
8
|
+
*
|
|
9
|
+
* - `ref` is called once with the element, right after it is created and
|
|
10
|
+
* before its children are mounted or anything is bound.
|
|
11
|
+
* - `class` is either a string or an object of `Bindable<boolean>`s, one per
|
|
12
|
+
* class name, never both (SPEC.md 7.2).
|
|
13
|
+
* - `style` is either a `cssText` string or an object of CSS properties, each
|
|
14
|
+
* bound with `style.setProperty`, so the keys are the hyphenated names
|
|
15
|
+
* (`'background-color'`, `'--accent'`).
|
|
16
|
+
*/
|
|
17
|
+
export type CommonElementProps<E extends Element> = Readonly<{
|
|
18
|
+
ref?: (element: E) => void;
|
|
19
|
+
children?: Child;
|
|
20
|
+
class?: Bindable<string> | ClassObject;
|
|
21
|
+
style?: Bindable<string> | StyleObject;
|
|
22
|
+
}> & Partial<ReadonlyRecord<`aria-${string}` | `data-${string}`, Bindable<string | undefined>>>;
|
|
23
|
+
/** `class` as one `Bindable<boolean>` per class name. */
|
|
24
|
+
export type ClassObject = ReadonlyRecord<string, Bindable<boolean>>;
|
|
25
|
+
/**
|
|
26
|
+
* `style` as one `Bindable<string | undefined>` per hyphenated CSS property
|
|
27
|
+
* name; `undefined` removes the property.
|
|
28
|
+
*/
|
|
29
|
+
export type StyleObject = ReadonlyRecord<string, Bindable<string | undefined>>;
|
|
30
|
+
/**
|
|
31
|
+
* The props of an HTML element: the common ones, one `Bindable` per writable
|
|
32
|
+
* primitive DOM property of `E` (`id`, `disabled`, `value`, `tabIndex`, …),
|
|
33
|
+
* and one handler per event of `HTMLElementEventMap`.
|
|
34
|
+
*
|
|
35
|
+
* An attribute, `aria-*` and `data-*` included, also takes `undefined`, which
|
|
36
|
+
* removes it: a value that comes and goes is an observable of `T | undefined`
|
|
37
|
+
* (SPEC.md 4.1). A DOM property of `propertyNames` (`value`, `checked`, …) has
|
|
38
|
+
* no absent state and does not.
|
|
39
|
+
*/
|
|
40
|
+
export type HtmlElementProps<E extends HTMLElement> = CommonElementProps<E> & ReflectedProps<E> & EventProps<E, HTMLElementEventMap>;
|
|
41
|
+
/**
|
|
42
|
+
* The props of an SVG element: the common ones, the attributes of
|
|
43
|
+
* `svgAttributeNames`, and one handler per event of `SVGElementEventMap`.
|
|
44
|
+
*/
|
|
45
|
+
export type SvgElementProps<E extends SVGElement> = CommonElementProps<E> & Partial<ReadonlyRecord<(typeof svgAttributeNames)[number], Bindable<number | string | undefined>>> & EventProps<E, SVGElementEventMap>;
|
|
46
|
+
/**
|
|
47
|
+
* One handler per event, named `on` followed by the event's name in
|
|
48
|
+
* PascalCase (`onClick`, `onPointerDown`). `currentTarget` is narrowed to the
|
|
49
|
+
* element. A handler is a function, never an observable.
|
|
50
|
+
*/
|
|
51
|
+
export type EventProps<E extends Element, M> = Readonly<{
|
|
52
|
+
[K in keyof M & keyof EventPropNames as EventPropNames[K]]?: (event: M[K] & Readonly<{
|
|
53
|
+
currentTarget: E;
|
|
54
|
+
}>) => void;
|
|
55
|
+
}>;
|
|
56
|
+
export type GeneratedIntrinsicElements = Readonly<{
|
|
57
|
+
[K in keyof HTMLElementTagNameMap]: HtmlElementProps<HTMLElementTagNameMap[K]>;
|
|
58
|
+
}> & Readonly<{
|
|
59
|
+
[K in SvgTagName]: SvgElementProps<SVGElementTagNameMap[K]>;
|
|
60
|
+
}>;
|
|
61
|
+
type ReflectedProps<E> = Readonly<{
|
|
62
|
+
[K in keyof E as ReflectedKey<E, K>]?: Bindable<K extends PropertyName ? NonNullable<E[K]> : NonNullable<E[K]> | undefined>;
|
|
63
|
+
}>;
|
|
64
|
+
type PropertyName = (typeof propertyNames)[number];
|
|
65
|
+
/**
|
|
66
|
+
* `K` if it is a writable primitive property of `E`, and `never` otherwise.
|
|
67
|
+
* An index signature is dropped: `HTMLFormElement` has one for its named
|
|
68
|
+
* controls, which would otherwise swallow every other key.
|
|
69
|
+
*/
|
|
70
|
+
type ReflectedKey<E, K extends keyof E> = string extends K ? never : number extends K ? never : K extends ExcludedKey | `aria${string}` | `on${string}` ? never : NonNullable<E[K]> extends boolean | number | string ? IsWritable<E, K> extends true ? K : never : never;
|
|
71
|
+
type IsWritable<E, K extends keyof E> = TypeEq<StrictPick<E, K>, Readonly<StrictPick<E, K>>> extends true ? false : true;
|
|
72
|
+
/**
|
|
73
|
+
* Writable primitive properties that are not attributes, or that are props of
|
|
74
|
+
* their own (`class`, `style`).
|
|
75
|
+
*/
|
|
76
|
+
type ExcludedKey = 'className' | 'innerHTML' | 'innerText' | 'nodeValue' | 'outerHTML' | 'outerText' | 'scrollLeft' | 'scrollTop' | 'textContent';
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=element-props.d.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G,SAAS,CAC3E;CACF,CAAC,CAAC;AAEH,KAAK,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;;;GAIG;AACH,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,MAAM,SAAS,CAAC,GACtD,KAAK,GACL,MAAM,SAAS,CAAC,GACd,KAAK,GACL,CAAC,SAAS,WAAW,GAAG,OAAO,MAAM,EAAE,GAAG,KAAK,MAAM,EAAE,GACrD,KAAK,GACL,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,GAAG,MAAM,GAAG,MAAM,GACjD,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,GAC3B,CAAC,GACD,KAAK,GACP,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;;;GAGG;AACH,KAAK,WAAW,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,YAAY,GACZ,WAAW,GACX,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-props.mjs","sourceRoot":"","sources":["../../src/jsx/element-props.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prop name of each DOM event, in the PascalCase React uses
|
|
3
|
+
* (`pointerdown` → `onPointerDown`). The event names are single lower-case
|
|
4
|
+
* words, so the word boundaries have to be written down; binding needs no
|
|
5
|
+
* table, since lower-casing the prop name gives the event name back.
|
|
6
|
+
*
|
|
7
|
+
* Covers every key of `HTMLElementEventMap` and `SVGElementEventMap`, which
|
|
8
|
+
* `element-props.test.mts` asserts.
|
|
9
|
+
*/
|
|
10
|
+
export type EventPropNames = Readonly<{
|
|
11
|
+
abort: 'onAbort';
|
|
12
|
+
animationcancel: 'onAnimationCancel';
|
|
13
|
+
animationend: 'onAnimationEnd';
|
|
14
|
+
animationiteration: 'onAnimationIteration';
|
|
15
|
+
animationstart: 'onAnimationStart';
|
|
16
|
+
auxclick: 'onAuxClick';
|
|
17
|
+
beforeinput: 'onBeforeInput';
|
|
18
|
+
beforematch: 'onBeforeMatch';
|
|
19
|
+
beforetoggle: 'onBeforeToggle';
|
|
20
|
+
blur: 'onBlur';
|
|
21
|
+
cancel: 'onCancel';
|
|
22
|
+
canplay: 'onCanPlay';
|
|
23
|
+
canplaythrough: 'onCanPlayThrough';
|
|
24
|
+
change: 'onChange';
|
|
25
|
+
click: 'onClick';
|
|
26
|
+
close: 'onClose';
|
|
27
|
+
command: 'onCommand';
|
|
28
|
+
compositionend: 'onCompositionEnd';
|
|
29
|
+
compositionstart: 'onCompositionStart';
|
|
30
|
+
compositionupdate: 'onCompositionUpdate';
|
|
31
|
+
contextlost: 'onContextLost';
|
|
32
|
+
contextmenu: 'onContextMenu';
|
|
33
|
+
contextrestored: 'onContextRestored';
|
|
34
|
+
copy: 'onCopy';
|
|
35
|
+
cuechange: 'onCueChange';
|
|
36
|
+
cut: 'onCut';
|
|
37
|
+
dblclick: 'onDblClick';
|
|
38
|
+
drag: 'onDrag';
|
|
39
|
+
dragend: 'onDragEnd';
|
|
40
|
+
dragenter: 'onDragEnter';
|
|
41
|
+
dragleave: 'onDragLeave';
|
|
42
|
+
dragover: 'onDragOver';
|
|
43
|
+
dragstart: 'onDragStart';
|
|
44
|
+
drop: 'onDrop';
|
|
45
|
+
durationchange: 'onDurationChange';
|
|
46
|
+
emptied: 'onEmptied';
|
|
47
|
+
ended: 'onEnded';
|
|
48
|
+
error: 'onError';
|
|
49
|
+
focus: 'onFocus';
|
|
50
|
+
focusin: 'onFocusIn';
|
|
51
|
+
focusout: 'onFocusOut';
|
|
52
|
+
formdata: 'onFormData';
|
|
53
|
+
fullscreenchange: 'onFullscreenChange';
|
|
54
|
+
fullscreenerror: 'onFullscreenError';
|
|
55
|
+
gotpointercapture: 'onGotPointerCapture';
|
|
56
|
+
input: 'onInput';
|
|
57
|
+
invalid: 'onInvalid';
|
|
58
|
+
keydown: 'onKeyDown';
|
|
59
|
+
keypress: 'onKeyPress';
|
|
60
|
+
keyup: 'onKeyUp';
|
|
61
|
+
load: 'onLoad';
|
|
62
|
+
loadeddata: 'onLoadedData';
|
|
63
|
+
loadedmetadata: 'onLoadedMetadata';
|
|
64
|
+
loadstart: 'onLoadStart';
|
|
65
|
+
lostpointercapture: 'onLostPointerCapture';
|
|
66
|
+
mousedown: 'onMouseDown';
|
|
67
|
+
mouseenter: 'onMouseEnter';
|
|
68
|
+
mouseleave: 'onMouseLeave';
|
|
69
|
+
mousemove: 'onMouseMove';
|
|
70
|
+
mouseout: 'onMouseOut';
|
|
71
|
+
mouseover: 'onMouseOver';
|
|
72
|
+
mouseup: 'onMouseUp';
|
|
73
|
+
paste: 'onPaste';
|
|
74
|
+
pause: 'onPause';
|
|
75
|
+
play: 'onPlay';
|
|
76
|
+
playing: 'onPlaying';
|
|
77
|
+
pointercancel: 'onPointerCancel';
|
|
78
|
+
pointerdown: 'onPointerDown';
|
|
79
|
+
pointerenter: 'onPointerEnter';
|
|
80
|
+
pointerleave: 'onPointerLeave';
|
|
81
|
+
pointermove: 'onPointerMove';
|
|
82
|
+
pointerout: 'onPointerOut';
|
|
83
|
+
pointerover: 'onPointerOver';
|
|
84
|
+
pointerrawupdate: 'onPointerRawUpdate';
|
|
85
|
+
pointerup: 'onPointerUp';
|
|
86
|
+
progress: 'onProgress';
|
|
87
|
+
ratechange: 'onRateChange';
|
|
88
|
+
reset: 'onReset';
|
|
89
|
+
resize: 'onResize';
|
|
90
|
+
scroll: 'onScroll';
|
|
91
|
+
scrollend: 'onScrollEnd';
|
|
92
|
+
securitypolicyviolation: 'onSecurityPolicyViolation';
|
|
93
|
+
seeked: 'onSeeked';
|
|
94
|
+
seeking: 'onSeeking';
|
|
95
|
+
select: 'onSelect';
|
|
96
|
+
selectionchange: 'onSelectionChange';
|
|
97
|
+
selectstart: 'onSelectStart';
|
|
98
|
+
slotchange: 'onSlotChange';
|
|
99
|
+
stalled: 'onStalled';
|
|
100
|
+
submit: 'onSubmit';
|
|
101
|
+
suspend: 'onSuspend';
|
|
102
|
+
timeupdate: 'onTimeUpdate';
|
|
103
|
+
toggle: 'onToggle';
|
|
104
|
+
touchcancel: 'onTouchCancel';
|
|
105
|
+
touchend: 'onTouchEnd';
|
|
106
|
+
touchmove: 'onTouchMove';
|
|
107
|
+
touchstart: 'onTouchStart';
|
|
108
|
+
transitioncancel: 'onTransitionCancel';
|
|
109
|
+
transitionend: 'onTransitionEnd';
|
|
110
|
+
transitionrun: 'onTransitionRun';
|
|
111
|
+
transitionstart: 'onTransitionStart';
|
|
112
|
+
volumechange: 'onVolumeChange';
|
|
113
|
+
waiting: 'onWaiting';
|
|
114
|
+
webkitanimationend: 'onWebkitAnimationEnd';
|
|
115
|
+
webkitanimationiteration: 'onWebkitAnimationIteration';
|
|
116
|
+
webkitanimationstart: 'onWebkitAnimationStart';
|
|
117
|
+
webkittransitionend: 'onWebkitTransitionEnd';
|
|
118
|
+
wheel: 'onWheel';
|
|
119
|
+
}>;
|
|
120
|
+
//# sourceMappingURL=event-prop-names.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-prop-names.d.mts","sourceRoot":"","sources":["../../src/jsx/event-prop-names.mts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,eAAe,EAAE,mBAAmB,CAAC;IACrC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,kBAAkB,EAAE,sBAA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AAU,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,mBAAmB,CAAC;IACrC,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,aAAa,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,iBAAiB,CAAC;IACjC,eAAe,EAAE,mBAAmB,CAAC;IACrC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,kBAAkB,EAAE,sBAAsB,CAAC;IAC3C,wBAAwB,EAAE,4BAA4B,CAAC;IACvD,oBAAoB,EAAE,wBAAwB,CAAC;IAC/C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-prop-names.mjs","sourceRoot":"","sources":["../../src/jsx/event-prop-names.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/jsx/index.mts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/jsx/index.mts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GeneratedIntrinsicElements } from './element-props.mjs';
|
|
2
|
+
import type { Mountable } from './mountable.mjs';
|
|
3
|
+
/** The `JSX` namespace TypeScript reads through `jsxImportSource`. */
|
|
4
|
+
export declare namespace JSX {
|
|
5
|
+
type Element = Mountable;
|
|
6
|
+
type ElementChildrenAttribute = Readonly<{
|
|
7
|
+
children: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
type IntrinsicElements = GeneratedIntrinsicElements;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=jsx-namespace.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-namespace.d.mts","sourceRoot":"","sources":["../../src/jsx/jsx-namespace.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,sEAAsE;AACtE,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,KAAK,OAAO,GAAG,SAAS,CAAC;IAEzB,KAAK,wBAAwB,GAAG,QAAQ,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAEhE,KAAK,iBAAiB,GAAG,0BAA0B,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-namespace.mjs","sourceRoot":"","sources":["../../src/jsx/jsx-namespace.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Child } from './child.mjs';
|
|
2
|
+
import { type Mountable } from './mountable.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* The JSX factory (SPEC.md 6.2), exported from `synstate-dom/jsx-runtime` as
|
|
5
|
+
* `jsx` and `jsxs`. Returns a description and does nothing else:
|
|
6
|
+
* no DOM is created and no component is called until it is mounted.
|
|
7
|
+
*
|
|
8
|
+
* TypeScript checks a JSX expression against the `JSX` namespace, not against
|
|
9
|
+
* this signature, so the props of an intrinsic element arrive as `P` and are
|
|
10
|
+
* read with run-time checks.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const createMountable: <P>(type: string | ((componentProps: P) => Mountable), props: P, key?: unknown) => Mountable;
|
|
14
|
+
/** Mounts its children in order, with no element around them. */
|
|
15
|
+
export declare const Fragment: (props: Readonly<{
|
|
16
|
+
children?: Child;
|
|
17
|
+
}>) => Mountable;
|
|
18
|
+
//# sourceMappingURL=jsx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.d.mts","sourceRoot":"","sources":["../../src/jsx/jsx.mts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,QACzB,MAAM,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,KAAK,SAAS,CAAC,SAC1C,CAAC,QACF,OAAO,KACZ,SAQF,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,QAAQ,UAAW,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,KAAG,SACd,CAAC"}
|
package/dist/jsx/jsx.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { hasKey, isRecord } from 'ts-data-forge';
|
|
2
|
+
import { bindProps } from '../bind/index.mjs';
|
|
3
|
+
import { svgTagNames } from '../internal/index.mjs';
|
|
4
|
+
import { isChild, mountChild } from './child.mjs';
|
|
5
|
+
import { mountable } from './mountable.mjs';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const createMountable = (type, props, key) => {
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const propsWithKey = key === undefined ? props : { ...props, key };
|
|
20
|
+
return typeof type === 'string'
|
|
21
|
+
? mountable(() => mountElement(type, props))
|
|
22
|
+
: mountable(() => type(propsWithKey).mount());
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Fragment = (props) => mountable(() => mountChild(props.children ?? []));
|
|
26
|
+
const mountElement = (tag, props) => {
|
|
27
|
+
const element = svgTagNameSet.has(tag)
|
|
28
|
+
? document.createElementNS(svgNamespace, tag)
|
|
29
|
+
: document.createElement(tag);
|
|
30
|
+
if (!isRecord(props)) {
|
|
31
|
+
return element;
|
|
32
|
+
}
|
|
33
|
+
if (hasKey(props, 'ref') && isRefCallback(props.ref)) {
|
|
34
|
+
props.ref(element);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (hasKey(props, 'children') && isChild(props.children)) {
|
|
38
|
+
element.append(...mountChild(props.children));
|
|
39
|
+
}
|
|
40
|
+
bindProps(element, props);
|
|
41
|
+
return element;
|
|
42
|
+
};
|
|
43
|
+
const svgNamespace = 'http://www.w3.org/2000/svg';
|
|
44
|
+
const svgTagNameSet = new Set(svgTagNames);
|
|
45
|
+
const isRefCallback = (value) => typeof value === 'function';
|
|
46
|
+
//# sourceMappingURL=jsx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.mjs","sourceRoot":"","sources":["../../src/jsx/jsx.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA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;QACrB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,wEAAwE;IACxE,IAAI,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzD,OAAO,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAE1B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAElD,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,KAAc,EAAuC,EAAE,CAC5E,OAAO,KAAK,KAAK,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mountableTag } from '../internal/index.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* What a JSX expression evaluates to: a description that creates DOM nodes
|
|
4
|
+
* when mounted, not the nodes themselves (SPEC.md 6.1).
|
|
5
|
+
*
|
|
6
|
+
* The children of a JSX element are evaluated before the element, so a
|
|
7
|
+
* description that created its nodes at once would create both branches of
|
|
8
|
+
* `<If cond={c$} then={<A />} else={<B />} />` before either was chosen.
|
|
9
|
+
*
|
|
10
|
+
* It is an object rather than a function: a props object with a `then` prop
|
|
11
|
+
* holding a function would be taken for a thenable.
|
|
12
|
+
*
|
|
13
|
+
* The same description may be mounted any number of times; each mount
|
|
14
|
+
* creates new nodes.
|
|
15
|
+
*/
|
|
16
|
+
export type Mountable = Readonly<{
|
|
17
|
+
[mountableTag]: true;
|
|
18
|
+
/** Called inside the current scope; creates the nodes and returns them. */
|
|
19
|
+
mount: () => MountedNodes;
|
|
20
|
+
}>;
|
|
21
|
+
/** What one mount produced. */
|
|
22
|
+
export type MountedNodes = ChildNode | readonly ChildNode[];
|
|
23
|
+
/** Makes a {@link Mountable} from the function that mounts it. */
|
|
24
|
+
export declare const mountable: (mount: () => MountedNodes) => Mountable;
|
|
25
|
+
//# sourceMappingURL=mountable.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountable.d.mts","sourceRoot":"","sources":["../../src/jsx/mountable.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC/B,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;IACrB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,YAAY,CAAC;CAC3B,CAAC,CAAC;AAEH,+BAA+B;AAC/B,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,SAAS,EAAE,CAAC;AAE5D,kEAAkE;AAClE,eAAO,MAAM,SAAS,UAAW,MAAM,YAAY,KAAG,SAIzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountable.mjs","sourceRoot":"","sources":["../../src/jsx/mountable.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAyBrD,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAyB,EAAa,EAAE,CAChE,CAAC;IACC,CAAC,YAAY,CAAC,EAAE,IAAI;IACpB,KAAK;CACN,CAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The module `"jsxImportSource": "synstate-dom"` makes TypeScript import for
|
|
3
|
+
* `"jsx": "react-jsxdev"`. The extra arguments (`key`, source location) are
|
|
4
|
+
* not used.
|
|
5
|
+
*/
|
|
6
|
+
export { Fragment, createMountable as jsxDEV, type JSX } from './jsx/index.mjs';
|
|
7
|
+
//# sourceMappingURL=jsx-dev-runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.mts","sourceRoot":"","sources":["../src/jsx-dev-runtime.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,IAAI,MAAM,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.mjs","sourceRoot":"","sources":["../src/jsx-dev-runtime.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,IAAI,MAAM,EAAY,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The module `"jsxImportSource": "synstate-dom"` makes TypeScript import for
|
|
3
|
+
* `"jsx": "react-jsx"`. `jsxs` is the call for an element with several
|
|
4
|
+
* children; both are the same factory.
|
|
5
|
+
*/
|
|
6
|
+
export { Fragment, createMountable as jsx, createMountable as jsxs, type JSX, } from './jsx/index.mjs';
|
|
7
|
+
//# sourceMappingURL=jsx-runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.mts","sourceRoot":"","sources":["../src/jsx-runtime.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,QAAQ,EACR,eAAe,IAAI,GAAG,EACtB,eAAe,IAAI,IAAI,EACvB,KAAK,GAAG,GACT,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.mjs","sourceRoot":"","sources":["../src/jsx-runtime.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,QAAQ,EACR,eAAe,IAAI,GAAG,EACtB,eAAe,IAAI,IAAI,GAExB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type JSX } from './jsx/index.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Mounts `app` into `container` and returns the function that unmounts it
|
|
4
|
+
* (SPEC.md 6.5).
|
|
5
|
+
*
|
|
6
|
+
* `app` is called once, inside a new root scope; everything created while it
|
|
7
|
+
* and the description it returns are mounted belongs to that scope, and
|
|
8
|
+
* unmounting disposes it and removes the nodes.
|
|
9
|
+
*
|
|
10
|
+
* `render(App, el)` rather than `render(<App />, el)`: taking the component
|
|
11
|
+
* makes it plain that it is evaluated here.
|
|
12
|
+
*/
|
|
13
|
+
export declare const render: (app: () => JSX.Element, container: Element) => (() => void);
|
|
14
|
+
//# sourceMappingURL=render.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.mts","sourceRoot":"","sources":["../src/render.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,QACZ,MAAM,GAAG,CAAC,OAAO,aACX,OAAO,KACjB,CAAC,MAAM,IAAI,CAcb,CAAC"}
|
package/dist/render.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createScope } from 'synstate';
|
|
2
|
+
import { toNodes } from './jsx/index.mjs';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export const render = (app, container) => {
|
|
15
|
+
const root = createScope(undefined);
|
|
16
|
+
const nodes = root.run(() => toNodes(app().mount()));
|
|
17
|
+
container.append(...nodes);
|
|
18
|
+
return () => {
|
|
19
|
+
root.dispose();
|
|
20
|
+
for (const node of nodes) {
|
|
21
|
+
node.remove();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=render.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.mjs","sourceRoot":"","sources":["../src/render.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAY,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAAsB,EACtB,SAAkB,EACJ,EAAE;IAChB,MAAM,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAEpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAErD,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAE3B,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,100 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synstate-dom",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Compiler-free fine-grained UI library that binds synstate observables directly to the DOM",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/noshiro-pf/mono.git",
|
|
8
|
+
"directory": "libs/synstate-dom"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": "noshiro-pf <noshiro.pf@gmail.com>",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"default": "./dist/index.mjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./jsx-runtime": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/jsx-runtime.d.mts",
|
|
24
|
+
"default": "./dist/jsx-runtime.mjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./jsx-dev-runtime": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/jsx-dev-runtime.d.mts",
|
|
30
|
+
"default": "./dist/jsx-dev-runtime.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"module": "./dist/index.mjs",
|
|
35
|
+
"types": "./dist/index.d.mts",
|
|
36
|
+
"files": [
|
|
37
|
+
"src",
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"ts-type-forge": "^9.2.2"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
47
|
+
"eslint-config-typed": "5.19.2",
|
|
48
|
+
"eslint-plugin-ts-data-forge": "0.10.3",
|
|
49
|
+
"eslint-plugin-ts-fortress": "1.3.8",
|
|
50
|
+
"eslint-plugin-ts-type-forge": "0.8.13",
|
|
51
|
+
"playwright": "1.64.1",
|
|
52
|
+
"prettier": "3.9.10",
|
|
53
|
+
"prettier-plugin-organize-imports": "4.3.0",
|
|
54
|
+
"prettier-plugin-packagejson": "3.0.2",
|
|
55
|
+
"synstate": "5.0.1",
|
|
56
|
+
"ts-data-forge": "14.10.0",
|
|
57
|
+
"ts-repo-utils": "10.7.1"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"synstate": ">=5.0.1",
|
|
61
|
+
"ts-data-forge": ">=14.10.0"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=22.22.2",
|
|
65
|
+
"pnpm": ">=9.0.0"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public",
|
|
69
|
+
"provenance": true
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts",
|
|
73
|
+
"check:ext": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-ext.mts",
|
|
74
|
+
"check:lint": "node ../../tools/scripts/cmd/assert-deps-built.mts && oxlint . && eslint .",
|
|
75
|
+
"check:test": "node ../../tools/scripts/cmd/assert-deps-built.mts && pnpm run z:vitest:node run",
|
|
76
|
+
"check:test:browser": "node ../../tools/scripts/cmd/assert-deps-built.mts && pnpm run z:vitest --project='Browser' run",
|
|
77
|
+
"check:test:cov": "node ../../tools/scripts/cmd/assert-deps-built.mts && pnpm run z:vitest:node run --coverage",
|
|
78
|
+
"check:types": "node ../../tools/scripts/cmd/assert-deps-built.mts && node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
79
|
+
"check-all": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-all.mts",
|
|
80
|
+
"doc": "run-s gen:readme fix:fmt",
|
|
81
|
+
"fix:codemod": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --transformer convert-to-readonly '{src,samples,test}/**/*.{mts,tsx}'",
|
|
82
|
+
"fix:fmt": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-uncommitted.mts --cwd .",
|
|
83
|
+
"fix:fmt:diff": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-diff-from.mts origin/main --cwd .",
|
|
84
|
+
"fix:fmt:full": "pnpm run z:prettier .",
|
|
85
|
+
"fix:lint": "node ../../tools/scripts/cmd/assert-deps-built.mts && oxlint . --fix && eslint . --fix",
|
|
86
|
+
"fmt": "pnpm run fix:fmt",
|
|
87
|
+
"gen": "run-s gen:index gen:readme",
|
|
88
|
+
"gen:index": "run-s gen:index:src fix:fmt",
|
|
89
|
+
"gen:index:src": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/gen-index-ts.mts ./src --index-ext .mts --export-ext .mjs --target-ext .mts --target-ext .tsx --exclude jsx-runtime.mts --exclude jsx-dev-runtime.mts --exclude \"bind/**\" --exclude control/mount-switch.mts --exclude control/longest-increasing-subsequence.mts --exclude \"internal/**\"",
|
|
90
|
+
"gen:readme": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples.mts",
|
|
91
|
+
"test": "pnpm run check:test",
|
|
92
|
+
"test:cov:ui": "vite preview --outDir ./coverage",
|
|
93
|
+
"test:ui": "pnpm run z:vitest:node --ui",
|
|
94
|
+
"watch:test": "pnpm run z:vitest:node watch",
|
|
95
|
+
"watch:types": "node ../../node_modules/typescript-native/bin/tsc --noEmit --watch",
|
|
96
|
+
"z:prettier": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --ignore-path ../../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
|
|
97
|
+
"z:vitest": "vitest --config ./configs/vitest.config.mts",
|
|
98
|
+
"z:vitest:node": "pnpm run z:vitest --project='Node.js'"
|
|
99
|
+
}
|
|
6
100
|
}
|