@expressive/mvc 0.73.1 → 0.78.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 +137 -0
- package/dist/component.d.ts +87 -0
- package/dist/component.js +111 -0
- package/dist/component.js.map +1 -0
- package/dist/context.d.ts +56 -0
- package/dist/context.js +201 -0
- package/dist/context.js.map +1 -0
- package/dist/field/def.d.ts +17 -0
- package/dist/field/def.js +29 -0
- package/dist/field/def.js.map +1 -0
- package/dist/field/get.d.ts +57 -0
- package/dist/field/get.js +90 -0
- package/dist/field/get.js.map +1 -0
- package/dist/field/hot.d.ts +16 -0
- package/dist/field/hot.js +98 -0
- package/dist/field/hot.js.map +1 -0
- package/dist/field/ref.d.ts +78 -0
- package/dist/field/ref.js +85 -0
- package/dist/field/ref.js.map +1 -0
- package/dist/field/set.d.ts +59 -0
- package/dist/field/set.js +84 -0
- package/dist/field/set.js.map +1 -0
- package/dist/index.d.ts +10 -502
- package/dist/index.js +11 -872
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.js +3 -0
- package/dist/jsx-runtime.d.ts +90 -0
- package/dist/jsx-runtime.js +57 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/observable.d.ts +58 -0
- package/dist/observable.js +184 -0
- package/dist/observable.js.map +1 -0
- package/dist/state.d.ts +311 -0
- package/dist/state.js +424 -0
- package/dist/state.js.map +1 -0
- package/package.json +35 -18
- package/dist/esm/context.d.ts +0 -62
- package/dist/esm/context.js +0 -158
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.js +0 -9
- package/dist/esm/instruction/get.d.ts +0 -36
- package/dist/esm/instruction/get.js +0 -77
- package/dist/esm/instruction/ref.d.ts +0 -71
- package/dist/esm/instruction/ref.js +0 -68
- package/dist/esm/instruction/set.d.ts +0 -69
- package/dist/esm/instruction/set.js +0 -118
- package/dist/esm/instruction/use.d.ts +0 -23
- package/dist/esm/instruction/use.js +0 -56
- package/dist/esm/observable.d.ts +0 -42
- package/dist/esm/observable.js +0 -121
- package/dist/esm/state.d.ts +0 -234
- package/dist/esm/state.js +0 -293
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Component } from "./component.js";
|
|
2
|
+
|
|
3
|
+
//#region src/jsx-runtime.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-adapter interpretation manifest. Each adapter augments this interface to
|
|
6
|
+
* declare how it renders; the first member is `node` - the element type produced
|
|
7
|
+
* by `Component.render` (surfaced as `Component.Node`) - alongside `intrinsics`,
|
|
8
|
+
* the host's tag map (surfaced as `JSX.IntrinsicElements`).
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* declare module '@expressive/mvc/jsx-runtime' {
|
|
12
|
+
* interface Host {
|
|
13
|
+
* node: React.ReactNode;
|
|
14
|
+
* intrinsics: React.JSX.IntrinsicElements;
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Only one adapter is expected per compilation; two augmenting the same member
|
|
20
|
+
* with different types in the same build would conflict - by design.
|
|
21
|
+
*/
|
|
22
|
+
interface Host {}
|
|
23
|
+
/**
|
|
24
|
+
* Host JSX runtime, registered by an adapter (e.g. `@expressive/react`) as an
|
|
25
|
+
* import side effect. One host per build - a second registration with a
|
|
26
|
+
* different runtime throws.
|
|
27
|
+
*/
|
|
28
|
+
interface HostRuntime {
|
|
29
|
+
childrenOf(children: unknown): Component.Node[];
|
|
30
|
+
isElement(node: unknown): boolean;
|
|
31
|
+
jsx(type: unknown, props: object, key?: unknown): Component.Node;
|
|
32
|
+
jsxDEV?(type: unknown, props: object, key?: unknown, isStatic?: boolean, source?: object, self?: unknown): Component.Node;
|
|
33
|
+
jsxs(type: unknown, props: object, key?: unknown): Component.Node;
|
|
34
|
+
propsOf(node: unknown): Record<string, unknown>;
|
|
35
|
+
typeOf(node: unknown): unknown;
|
|
36
|
+
Fragment: unknown;
|
|
37
|
+
}
|
|
38
|
+
declare namespace JSX {
|
|
39
|
+
type Element = Component.Node;
|
|
40
|
+
type ElementType = keyof IntrinsicElements | ((props: any) => Component.Node) | (abstract new (...args: any[]) => ElementClass);
|
|
41
|
+
/**
|
|
42
|
+
* Gates class element types on the `render` contract alone - requiring full
|
|
43
|
+
* `Component` assignability trips contravariance on `props` members (e.g.
|
|
44
|
+
* the `is` callback narrows per subclass), rejecting every subclass.
|
|
45
|
+
*/
|
|
46
|
+
interface ElementClass {
|
|
47
|
+
render(props?: any): Component.Node;
|
|
48
|
+
}
|
|
49
|
+
interface ElementAttributesProperty {
|
|
50
|
+
props: {};
|
|
51
|
+
}
|
|
52
|
+
interface ElementChildrenAttribute {
|
|
53
|
+
children: {};
|
|
54
|
+
}
|
|
55
|
+
interface IntrinsicAttributes {
|
|
56
|
+
key?: string | number | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Host tag manifest, via the {@link Host} seam. Resolves to `{}` until an
|
|
60
|
+
* adapter augments `Host` with `intrinsics` - agnostic code is
|
|
61
|
+
* components-only by design, since it cannot know what tags a host renders.
|
|
62
|
+
*/
|
|
63
|
+
type IntrinsicElements = Host extends {
|
|
64
|
+
intrinsics: infer T extends object;
|
|
65
|
+
} ? T : {};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Agnostic Fragment sentinel. The runtime entries translate it to the host's
|
|
69
|
+
* Fragment on element creation; `typeOf` translates back, so identity checks
|
|
70
|
+
* against this value hold for fragments from either pragma.
|
|
71
|
+
*/
|
|
72
|
+
declare const Fragment: unique symbol;
|
|
73
|
+
/** Register the host JSX runtime. Idempotent for the same runtime. */
|
|
74
|
+
declare function host(runtime: HostRuntime): void;
|
|
75
|
+
declare function jsx(type: unknown, props: object, key?: unknown): Component.Node;
|
|
76
|
+
declare function jsxs(type: unknown, props: object, key?: unknown): Component.Node;
|
|
77
|
+
/** Dev-transpiled element creation. Falls back to the production runtime when
|
|
78
|
+
* the host registered no `jsxDEV` (prod-only host under a dev build). */
|
|
79
|
+
declare function jsxDEV(type: unknown, props: object, key?: unknown, isStatic?: boolean, source?: object, self?: unknown): Component.Node;
|
|
80
|
+
/** Flatten `children` to an array of nodes, per the host's semantics. */
|
|
81
|
+
declare function childrenOf(children: unknown): Component.Node[];
|
|
82
|
+
/** Is `node` a host element? */
|
|
83
|
+
declare function isElement(node: unknown): boolean;
|
|
84
|
+
/** Element type of `node`; host Fragments surface as the agnostic `Fragment`. */
|
|
85
|
+
declare function typeOf(node: unknown): unknown;
|
|
86
|
+
/** Props carried by element `node`. */
|
|
87
|
+
declare function propsOf(node: unknown): Record<string, unknown>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { Fragment, Host, HostRuntime, JSX, childrenOf, host, isElement, jsx, jsxDEV, jsxs, propsOf, typeOf };
|
|
90
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/jsx-runtime.ts
|
|
2
|
+
/**
|
|
3
|
+
* Agnostic Fragment sentinel. The runtime entries translate it to the host's
|
|
4
|
+
* Fragment on element creation; `typeOf` translates back, so identity checks
|
|
5
|
+
* against this value hold for fragments from either pragma.
|
|
6
|
+
*/
|
|
7
|
+
const Fragment = Symbol.for("@expressive/mvc.Fragment");
|
|
8
|
+
let HOST;
|
|
9
|
+
/** Register the host JSX runtime. Idempotent for the same runtime. */
|
|
10
|
+
function host(runtime) {
|
|
11
|
+
if (HOST && HOST !== runtime) throw new Error("A different JSX host is already registered for @expressive/mvc. Only one host adapter may be active per build.");
|
|
12
|
+
HOST = runtime;
|
|
13
|
+
}
|
|
14
|
+
/** Current host runtime; throws a setup-pointing error when none registered. */
|
|
15
|
+
function resolved() {
|
|
16
|
+
if (HOST) return HOST;
|
|
17
|
+
throw new Error("No JSX host is registered for @expressive/mvc. Import a host adapter (e.g. '@expressive/react') before anything renders - typically as the first import of your application entry module.");
|
|
18
|
+
}
|
|
19
|
+
/** Translate the agnostic Fragment sentinel to the host's Fragment. */
|
|
20
|
+
function hostType(type) {
|
|
21
|
+
return type === Fragment ? resolved().Fragment : type;
|
|
22
|
+
}
|
|
23
|
+
function jsx(type, props, key) {
|
|
24
|
+
return resolved().jsx(hostType(type), props, key);
|
|
25
|
+
}
|
|
26
|
+
function jsxs(type, props, key) {
|
|
27
|
+
return resolved().jsxs(hostType(type), props, key);
|
|
28
|
+
}
|
|
29
|
+
/** Dev-transpiled element creation. Falls back to the production runtime when
|
|
30
|
+
* the host registered no `jsxDEV` (prod-only host under a dev build). */
|
|
31
|
+
function jsxDEV(type, props, key, isStatic, source, self) {
|
|
32
|
+
const runtime = resolved();
|
|
33
|
+
const resolvedType = hostType(type);
|
|
34
|
+
return runtime.jsxDEV ? runtime.jsxDEV(resolvedType, props, key, isStatic, source, self) : isStatic ? runtime.jsxs(resolvedType, props, key) : runtime.jsx(resolvedType, props, key);
|
|
35
|
+
}
|
|
36
|
+
/** Flatten `children` to an array of nodes, per the host's semantics. */
|
|
37
|
+
function childrenOf(children) {
|
|
38
|
+
return resolved().childrenOf(children);
|
|
39
|
+
}
|
|
40
|
+
/** Is `node` a host element? */
|
|
41
|
+
function isElement(node) {
|
|
42
|
+
return resolved().isElement(node);
|
|
43
|
+
}
|
|
44
|
+
/** Element type of `node`; host Fragments surface as the agnostic `Fragment`. */
|
|
45
|
+
function typeOf(node) {
|
|
46
|
+
const { typeOf, Fragment: hosted } = resolved();
|
|
47
|
+
const type = typeOf(node);
|
|
48
|
+
return type === hosted ? Fragment : type;
|
|
49
|
+
}
|
|
50
|
+
/** Props carried by element `node`. */
|
|
51
|
+
function propsOf(node) {
|
|
52
|
+
return resolved().propsOf(node);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Fragment, childrenOf, host, isElement, jsx, jsxDEV, jsxs, propsOf, typeOf };
|
|
57
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["import type { Component } from './component';\n\n/**\n * Per-adapter interpretation manifest. Each adapter augments this interface to\n * declare how it renders; the first member is `node` - the element type produced\n * by `Component.render` (surfaced as `Component.Node`) - alongside `intrinsics`,\n * the host's tag map (surfaced as `JSX.IntrinsicElements`).\n *\n * ```ts\n * declare module '@expressive/mvc/jsx-runtime' {\n * interface Host {\n * node: React.ReactNode;\n * intrinsics: React.JSX.IntrinsicElements;\n * }\n * }\n * ```\n *\n * Only one adapter is expected per compilation; two augmenting the same member\n * with different types in the same build would conflict - by design.\n */\nexport interface Host { }\n\n/**\n * Host JSX runtime, registered by an adapter (e.g. `@expressive/react`) as an\n * import side effect. One host per build - a second registration with a\n * different runtime throws.\n */\nexport interface HostRuntime {\n childrenOf(children: unknown): Component.Node[];\n isElement(node: unknown): boolean;\n jsx(type: unknown, props: object, key?: unknown): Component.Node;\n jsxDEV?(type: unknown, props: object, key?: unknown, isStatic?: boolean, source?: object, self?: unknown): Component.Node;\n jsxs(type: unknown, props: object, key?: unknown): Component.Node;\n propsOf(node: unknown): Record<string, unknown>;\n typeOf(node: unknown): unknown;\n Fragment: unknown;\n}\n\nexport declare namespace JSX {\n type Element = Component.Node;\n type ElementType =\n | keyof IntrinsicElements\n | ((props: any) => Component.Node)\n | (abstract new (...args: any[]) => ElementClass);\n /**\n * Gates class element types on the `render` contract alone - requiring full\n * `Component` assignability trips contravariance on `props` members (e.g.\n * the `is` callback narrows per subclass), rejecting every subclass.\n */\n interface ElementClass { render(props?: any): Component.Node }\n interface ElementAttributesProperty { props: {} }\n interface ElementChildrenAttribute { children: {} }\n interface IntrinsicAttributes { key?: string | number | null }\n /**\n * Host tag manifest, via the {@link Host} seam. Resolves to `{}` until an\n * adapter augments `Host` with `intrinsics` - agnostic code is\n * components-only by design, since it cannot know what tags a host renders.\n */\n type IntrinsicElements =\n Host extends { intrinsics: infer T extends object } ? T : {};\n}\n\n\n/**\n * Agnostic Fragment sentinel. The runtime entries translate it to the host's\n * Fragment on element creation; `typeOf` translates back, so identity checks\n * against this value hold for fragments from either pragma.\n */\nexport const Fragment = Symbol.for('@expressive/mvc.Fragment');\n\nlet HOST: HostRuntime | undefined;\n\n/** Register the host JSX runtime. Idempotent for the same runtime. */\nexport function host(runtime: HostRuntime) {\n if (HOST && HOST !== runtime)\n throw new Error(\n 'A different JSX host is already registered for @expressive/mvc. ' +\n 'Only one host adapter may be active per build.'\n );\n\n HOST = runtime;\n}\n\n/** Current host runtime; throws a setup-pointing error when none registered. */\nfunction resolved(): HostRuntime {\n if (HOST) return HOST;\n\n throw new Error(\n 'No JSX host is registered for @expressive/mvc. ' +\n \"Import a host adapter (e.g. '@expressive/react') before anything renders - \" +\n 'typically as the first import of your application entry module.'\n );\n}\n\n/** Translate the agnostic Fragment sentinel to the host's Fragment. */\nfunction hostType(type: unknown): unknown {\n return type === Fragment ? resolved().Fragment : type;\n}\n\nexport function jsx(type: unknown, props: object, key?: unknown): Component.Node {\n return resolved().jsx(hostType(type), props, key);\n}\n\nexport function jsxs(type: unknown, props: object, key?: unknown): Component.Node {\n return resolved().jsxs(hostType(type), props, key);\n}\n\n/** Dev-transpiled element creation. Falls back to the production runtime when\n * the host registered no `jsxDEV` (prod-only host under a dev build). */\nexport function jsxDEV(\n type: unknown,\n props: object,\n key?: unknown,\n isStatic?: boolean,\n source?: object,\n self?: unknown\n): Component.Node {\n const runtime = resolved();\n const resolvedType = hostType(type);\n\n return runtime.jsxDEV\n ? runtime.jsxDEV(resolvedType, props, key, isStatic, source, self)\n : isStatic\n ? runtime.jsxs(resolvedType, props, key)\n : runtime.jsx(resolvedType, props, key);\n}\n\n/** Flatten `children` to an array of nodes, per the host's semantics. */\nexport function childrenOf(children: unknown): Component.Node[] {\n return resolved().childrenOf(children);\n}\n\n/** Is `node` a host element? */\nexport function isElement(node: unknown): boolean {\n return resolved().isElement(node);\n}\n\n/** Element type of `node`; host Fragments surface as the agnostic `Fragment`. */\nexport function typeOf(node: unknown): unknown {\n const { typeOf, Fragment: hosted } = resolved();\n const type = typeOf(node);\n return type === hosted ? Fragment : type;\n}\n\n/** Props carried by element `node`. */\nexport function propsOf(node: unknown): Record<string, unknown> {\n return resolved().propsOf(node);\n}"],"mappings":";;;;;;AAoEA,MAAa,WAAW,OAAO,IAAI,2BAA2B;AAE9D,IAAI;;AAGJ,SAAgB,KAAK,SAAsB;AACzC,KAAI,QAAQ,SAAS,QACnB,OAAM,IAAI,MACR,iHAED;AAEH,QAAO;;;AAIT,SAAS,WAAwB;AAC/B,KAAI,KAAM,QAAO;AAEjB,OAAM,IAAI,MACR,4LAGD;;;AAIH,SAAS,SAAS,MAAwB;AACxC,QAAO,SAAS,WAAW,UAAU,CAAC,WAAW;;AAGnD,SAAgB,IAAI,MAAe,OAAe,KAA+B;AAC/E,QAAO,UAAU,CAAC,IAAI,SAAS,KAAK,EAAE,OAAO,IAAI;;AAGnD,SAAgB,KAAK,MAAe,OAAe,KAA+B;AAChF,QAAO,UAAU,CAAC,KAAK,SAAS,KAAK,EAAE,OAAO,IAAI;;;;AAKpD,SAAgB,OACd,MACA,OACA,KACA,UACA,QACA,MACgB;CAChB,MAAM,UAAU,UAAU;CAC1B,MAAM,eAAe,SAAS,KAAK;AAEnC,QAAO,QAAQ,SACX,QAAQ,OAAO,cAAc,OAAO,KAAK,UAAU,QAAQ,KAAK,GAChE,WACE,QAAQ,KAAK,cAAc,OAAO,IAAI,GACtC,QAAQ,IAAI,cAAc,OAAO,IAAI;;;AAI7C,SAAgB,WAAW,UAAqC;AAC9D,QAAO,UAAU,CAAC,WAAW,SAAS;;;AAIxC,SAAgB,UAAU,MAAwB;AAChD,QAAO,UAAU,CAAC,UAAU,KAAK;;;AAInC,SAAgB,OAAO,MAAwB;CAC7C,MAAM,EAAE,QAAQ,UAAU,WAAW,UAAU;CAC/C,MAAM,OAAO,OAAO,KAAK;AACzB,QAAO,SAAS,SAAS,WAAW;;;AAItC,SAAgB,QAAQ,MAAwC;AAC9D,QAAO,UAAU,CAAC,QAAQ,KAAK"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/observable.d.ts
|
|
2
|
+
declare namespace Observer {
|
|
3
|
+
/**
|
|
4
|
+
* Update callback function.
|
|
5
|
+
*
|
|
6
|
+
* @param key -
|
|
7
|
+
* - `string` - property which has updated.
|
|
8
|
+
* - `false` - a normal update has completed.
|
|
9
|
+
* - `true` - initial event; instance is ready.
|
|
10
|
+
* - `null` - terminal event; instance is expired.
|
|
11
|
+
*/
|
|
12
|
+
type Notify = (key: Signal) => (() => void) | null | void;
|
|
13
|
+
type EffectCleanup = (update: boolean | null) => void;
|
|
14
|
+
type Effect<T extends object> = (this: T, proxy: T, changed: readonly Event[]) => EffectCleanup | Promise<void> | null | void;
|
|
15
|
+
type Event = number | string | symbol;
|
|
16
|
+
type Signal = Event | true | false | null;
|
|
17
|
+
type Callback = () => void | null;
|
|
18
|
+
}
|
|
19
|
+
interface Observer {
|
|
20
|
+
/** Becomes `true` once the subject has emitted its initial event. */
|
|
21
|
+
ready?: true;
|
|
22
|
+
listeners: Map<Observer.Notify, Set<Observer.Signal> | undefined>;
|
|
23
|
+
/** Recursion guard for an in-progress emit pass. */
|
|
24
|
+
pending: Set<Observer.Signal>;
|
|
25
|
+
/** Accumulator drained by the next microtask. */
|
|
26
|
+
events: Set<Observer.Event>;
|
|
27
|
+
}
|
|
28
|
+
declare const Observer: unique symbol;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch the dispatch bundle attached to an object.
|
|
31
|
+
* - returns the bundle if active
|
|
32
|
+
* - returns `null` if the subject has been terminated
|
|
33
|
+
* - returns `undefined` if the subject was never observable
|
|
34
|
+
*
|
|
35
|
+
* With `create: true`, attaches a fresh bundle iff the slot is undefined.
|
|
36
|
+
* A terminated (null) slot is not resurrected.
|
|
37
|
+
*/
|
|
38
|
+
declare function observer(state: object, create: true): Observer;
|
|
39
|
+
declare function observer(state: object, create?: boolean): Observer | undefined | null;
|
|
40
|
+
declare function touch(from: object, key: any): void;
|
|
41
|
+
declare function touch<T>(from: object, key: any, value?: T): T;
|
|
42
|
+
declare function listener<T extends object>(subject: T, callback: Observer.Notify, select?: Observer.Signal | Set<Observer.Signal>): () => boolean;
|
|
43
|
+
declare function pending<K extends Observer.Event>(state: object): K[] & PromiseLike<K[]>;
|
|
44
|
+
declare function event(state: object, key?: Observer.Event | null, silent?: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Create a side-effect which will update whenever values accessed change.
|
|
47
|
+
* Callback is called immediately and whenever values are stale.
|
|
48
|
+
*
|
|
49
|
+
* @param target - Instance of State to observe.
|
|
50
|
+
* @param callback - Function to invoke when values change.
|
|
51
|
+
* @param requireValues - If `true` will throw if accessing a value which is `undefined`.
|
|
52
|
+
*/
|
|
53
|
+
declare function watch<T extends object>(target: T, callback: Observer.Effect<Required<T>>, requireValues: true): () => void;
|
|
54
|
+
declare function watch<T extends object>(target: T, callback: Observer.Effect<T>, recursive?: boolean): () => void;
|
|
55
|
+
declare function capture(scope: (release: (update?: boolean | null) => void) => void): void;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Observer, capture, event, listener, observer, pending, touch, watch };
|
|
58
|
+
//# sourceMappingURL=observable.d.ts.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
//#region src/observable.ts
|
|
2
|
+
const Observer = Symbol("Observer");
|
|
3
|
+
const Observing = Symbol("Observing");
|
|
4
|
+
/** Central event dispatch. Bunches all updates to occur at same time. */
|
|
5
|
+
const DISPATCH = /* @__PURE__ */ new Set();
|
|
6
|
+
function observer(state, create) {
|
|
7
|
+
const o = state[Observer];
|
|
8
|
+
if (!o && create) {
|
|
9
|
+
if (o === null) throw new Error("Object is not observable (terminated).");
|
|
10
|
+
const value = {
|
|
11
|
+
listeners: /* @__PURE__ */ new Map(),
|
|
12
|
+
pending: /* @__PURE__ */ new Set(),
|
|
13
|
+
events: /* @__PURE__ */ new Set()
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(state, Observer, {
|
|
16
|
+
value,
|
|
17
|
+
writable: true
|
|
18
|
+
});
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
return o;
|
|
22
|
+
}
|
|
23
|
+
function observe(object, callback, required) {
|
|
24
|
+
const watching = /* @__PURE__ */ new Set();
|
|
25
|
+
const release = listener(object, (key) => {
|
|
26
|
+
if (watching.has(key)) return callback();
|
|
27
|
+
});
|
|
28
|
+
if (EffectContext) EffectContext.add((update) => {
|
|
29
|
+
if (update !== true) release();
|
|
30
|
+
});
|
|
31
|
+
const proxy = Object.create(object);
|
|
32
|
+
return Object.defineProperty(proxy, Observing, { value: {
|
|
33
|
+
callback,
|
|
34
|
+
watching,
|
|
35
|
+
required
|
|
36
|
+
} });
|
|
37
|
+
}
|
|
38
|
+
function touch(from, key, value) {
|
|
39
|
+
const active = from[Observing];
|
|
40
|
+
if (active) {
|
|
41
|
+
if (value === void 0 && arguments.length === 3 && active.required) throw new Error(`${Object.getPrototypeOf(from)}.${String(key)} is required in this context.`);
|
|
42
|
+
active.watching.add(key);
|
|
43
|
+
if (value instanceof Object && observer(value)) return observe(value, active.callback, active.required);
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function listener(subject, callback, select) {
|
|
48
|
+
const o = observer(subject, true);
|
|
49
|
+
if (select !== void 0 && !(select instanceof Set)) select = new Set([select]);
|
|
50
|
+
if (o.ready && !select) callback(true);
|
|
51
|
+
o.listeners.set(callback, select);
|
|
52
|
+
return () => o.listeners.delete(callback);
|
|
53
|
+
}
|
|
54
|
+
const EMPTY = Object.assign([], { then: Promise.prototype.then.bind(Promise.resolve([])) });
|
|
55
|
+
function pending(state) {
|
|
56
|
+
const o = observer(state);
|
|
57
|
+
if (!o?.events.size) return EMPTY;
|
|
58
|
+
const current = o.events;
|
|
59
|
+
const promise = new Promise((res) => {
|
|
60
|
+
const callback = () => {
|
|
61
|
+
o.listeners.delete(callback);
|
|
62
|
+
return () => res([...current]);
|
|
63
|
+
};
|
|
64
|
+
o.listeners.set(callback, void 0);
|
|
65
|
+
});
|
|
66
|
+
return Object.assign([...current], { then: promise.then.bind(promise) });
|
|
67
|
+
}
|
|
68
|
+
function event(state, key, silent) {
|
|
69
|
+
const o = observer(state, key === void 0);
|
|
70
|
+
if (!o) return;
|
|
71
|
+
if (key === null) {
|
|
72
|
+
state[Observer] = null;
|
|
73
|
+
return emit(o, key);
|
|
74
|
+
}
|
|
75
|
+
if (key === void 0) return emit(o, true);
|
|
76
|
+
if (!o.events.size && !silent) enqueue(() => {
|
|
77
|
+
emit(o, false);
|
|
78
|
+
o.events = /* @__PURE__ */ new Set();
|
|
79
|
+
});
|
|
80
|
+
o.events.add(key);
|
|
81
|
+
if (!silent) emit(o, key);
|
|
82
|
+
}
|
|
83
|
+
function emit(o, key) {
|
|
84
|
+
const { listeners, pending, ready } = o;
|
|
85
|
+
if (key === ready) return;
|
|
86
|
+
if (pending.size) {
|
|
87
|
+
pending.add(key);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!ready) pending.add(true);
|
|
91
|
+
pending.add(key);
|
|
92
|
+
for (const k of pending) for (const [callback, filter] of listeners) if (!filter || filter.has(k)) {
|
|
93
|
+
const after = callback(k);
|
|
94
|
+
if (after === null) listeners.delete(callback);
|
|
95
|
+
else if (after) enqueue(after);
|
|
96
|
+
}
|
|
97
|
+
if (key === null) listeners.clear();
|
|
98
|
+
else if (key === true) o.ready = true;
|
|
99
|
+
pending.clear();
|
|
100
|
+
}
|
|
101
|
+
function enqueue(eventHandler) {
|
|
102
|
+
if (!DISPATCH.size) queueMicrotask(() => {
|
|
103
|
+
DISPATCH.forEach((event) => {
|
|
104
|
+
try {
|
|
105
|
+
event();
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.error(err);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
DISPATCH.clear();
|
|
111
|
+
});
|
|
112
|
+
DISPATCH.add(eventHandler);
|
|
113
|
+
}
|
|
114
|
+
function watch(target, callback, argument) {
|
|
115
|
+
const o = observer(target, true);
|
|
116
|
+
let events = [];
|
|
117
|
+
let unset;
|
|
118
|
+
let reset;
|
|
119
|
+
let previous;
|
|
120
|
+
function invoke() {
|
|
121
|
+
if (observer(target) === null) return;
|
|
122
|
+
let ignore = true;
|
|
123
|
+
function onUpdate() {
|
|
124
|
+
events = [...o.events];
|
|
125
|
+
if (reset === null) return null;
|
|
126
|
+
if (ignore) return;
|
|
127
|
+
ignore = true;
|
|
128
|
+
unset(true);
|
|
129
|
+
unset = void 0;
|
|
130
|
+
enqueue(invoke);
|
|
131
|
+
}
|
|
132
|
+
function run(release) {
|
|
133
|
+
const proxy = observe(target, onUpdate, argument === true);
|
|
134
|
+
const output = callback.call(proxy, proxy, events);
|
|
135
|
+
if (previous && argument === false) {
|
|
136
|
+
const { watching } = proxy[Observing];
|
|
137
|
+
if (!watching.size) previous[Observing].watching.forEach((k) => watching.add(k));
|
|
138
|
+
}
|
|
139
|
+
previous = proxy;
|
|
140
|
+
ignore = false;
|
|
141
|
+
reset = output === null ? null : invoke;
|
|
142
|
+
unset = (key) => {
|
|
143
|
+
if (typeof output == "function") output(key);
|
|
144
|
+
if (release) release(key);
|
|
145
|
+
};
|
|
146
|
+
events = [];
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
if (argument !== false) capture(run);
|
|
150
|
+
else run();
|
|
151
|
+
} catch (err) {
|
|
152
|
+
if (err instanceof Promise) {
|
|
153
|
+
reset = void 0;
|
|
154
|
+
err.then(invoke);
|
|
155
|
+
} else throw err;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const unlisten = listener(target, (key) => {
|
|
159
|
+
if (key === true) invoke();
|
|
160
|
+
else if (!reset) return reset;
|
|
161
|
+
if (key === null && unset) unset(null);
|
|
162
|
+
});
|
|
163
|
+
function cleanup() {
|
|
164
|
+
if (unset) unset(false);
|
|
165
|
+
reset = null;
|
|
166
|
+
unlisten();
|
|
167
|
+
}
|
|
168
|
+
if (EffectContext && argument !== false) EffectContext.add(cleanup);
|
|
169
|
+
return cleanup;
|
|
170
|
+
}
|
|
171
|
+
let EffectContext;
|
|
172
|
+
function capture(scope) {
|
|
173
|
+
const parent = EffectContext;
|
|
174
|
+
const context = EffectContext = /* @__PURE__ */ new Set();
|
|
175
|
+
try {
|
|
176
|
+
scope((update) => context.forEach((fn) => fn(update)));
|
|
177
|
+
} finally {
|
|
178
|
+
EffectContext = parent;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
export { Observer, capture, event, listener, observer, pending, touch, watch };
|
|
184
|
+
//# sourceMappingURL=observable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observable.js","names":[],"sources":["../src/observable.ts"],"sourcesContent":["declare namespace Observer {\n /**\n * Update callback function.\n *\n * @param key -\n * - `string` - property which has updated.\n * - `false` - a normal update has completed.\n * - `true` - initial event; instance is ready.\n * - `null` - terminal event; instance is expired.\n */\n type Notify = (key: Signal) => (() => void) | null | void;\n\n type EffectCleanup = (update: boolean | null) => void;\n\n type Effect<T extends object> = (\n this: T,\n proxy: T,\n changed: readonly Event[]\n ) => EffectCleanup | Promise<void> | null | void;\n\n type Event = number | string | symbol;\n\n type Signal = Event | true | false | null;\n\n type Callback = () => void | null;\n}\n\ninterface Observer {\n /** Becomes `true` once the subject has emitted its initial event. */\n ready?: true;\n listeners: Map<Observer.Notify, Set<Observer.Signal> | undefined>;\n /** Recursion guard for an in-progress emit pass. */\n pending: Set<Observer.Signal>;\n /** Accumulator drained by the next microtask. */\n events: Set<Observer.Event>;\n}\n\ninterface Observing {\n callback: Observer.Callback;\n watching: Set<Observer.Signal>;\n required?: boolean;\n}\n\nconst Observer: unique symbol = Symbol('Observer');\nconst Observing: unique symbol = Symbol('Observing');\n\n/** Central event dispatch. Bunches all updates to occur at same time. */\nconst DISPATCH = new Set<() => void>();\n\ninterface Observable { [Observer]?: Observer | null }\ninterface Observed { [Observing]?: Observing }\n\n/**\n * Fetch the dispatch bundle attached to an object.\n * - returns the bundle if active\n * - returns `null` if the subject has been terminated\n * - returns `undefined` if the subject was never observable\n *\n * With `create: true`, attaches a fresh bundle iff the slot is undefined.\n * A terminated (null) slot is not resurrected.\n */\nfunction observer(state: object, create: true): Observer;\nfunction observer(state: object, create?: boolean): Observer | undefined | null;\nfunction observer(state: object, create?: boolean) {\n const o = (state as Observable)[Observer];\n\n if (!o && create) {\n if (o === null)\n throw new Error('Object is not observable (terminated).');\n\n const value: Observer = {\n listeners: new Map(),\n pending: new Set(),\n events: new Set()\n };\n Object.defineProperty(state, Observer, { value, writable: true });\n return value;\n }\n\n return o;\n}\n\nfunction observe<T extends object>(\n object: T,\n callback: Observer.Callback,\n required?: boolean\n): T {\n const watching = new Set<Observer.Signal>();\n\n const release = listener(object, (key) => {\n if (watching.has(key)) return callback();\n });\n\n if (EffectContext)\n EffectContext.add((update) => {\n if (update !== true) release();\n });\n\n const proxy = Object.create(object) as T;\n\n return Object.defineProperty(proxy, Observing, {\n value: { callback, watching, required } as Observing\n });\n}\n\nfunction touch(from: object, key: any): void;\nfunction touch<T>(from: object, key: any, value?: T): T;\nfunction touch(from: object, key: any, value?: any) {\n const active = (from as Observed)[Observing];\n\n if (active) {\n if (value === undefined && arguments.length === 3 && active.required)\n throw new Error(\n `${Object.getPrototypeOf(from)}.${String(key)} is required in this context.`\n );\n\n active.watching.add(key);\n\n if (value instanceof Object && observer(value))\n return observe(value, active.callback, active.required);\n }\n\n return value;\n}\n\nfunction listener<T extends object>(\n subject: T,\n callback: Observer.Notify,\n select?: Observer.Signal | Set<Observer.Signal>\n) {\n const o = observer(subject, true);\n\n if (select !== undefined && !(select instanceof Set))\n select = new Set([select]);\n\n if (o.ready && !select) callback(true);\n\n o.listeners.set(callback, select);\n\n return () => o.listeners.delete(callback);\n}\n\nconst EMPTY = Object.assign([], {\n then: Promise.prototype.then.bind(Promise.resolve([]))\n} as PromiseLike<never[]>);\n\nfunction pending<K extends Observer.Event>(\n state: object\n): K[] & PromiseLike<K[]> {\n const o = observer(state);\n if (!o?.events.size) return EMPTY;\n\n const current = o.events as Set<K>;\n const promise = new Promise<K[]>((res) => {\n const callback: Observer.Notify = () => {\n o.listeners.delete(callback);\n return () => res([...current]);\n };\n o.listeners.set(callback, undefined);\n });\n\n return Object.assign([...current], {\n then: promise.then.bind(promise)\n });\n}\n\nfunction event(state: object, key?: Observer.Event | null, silent?: boolean) {\n const o = observer(state, key === undefined);\n\n if (!o) return;\n\n if (key === null) {\n (state as Observable)[Observer] = null;\n return emit(o, key);\n }\n\n if (key === undefined) return emit(o, true);\n\n if (!o.events.size && !silent)\n enqueue(() => {\n emit(o, false);\n o.events = new Set();\n });\n\n o.events.add(key);\n\n if (!silent) emit(o, key);\n}\n\nfunction emit(o: Observer, key: Observer.Signal): void {\n const { listeners, pending, ready } = o;\n\n if (key === ready) return;\n\n if (pending.size) {\n pending.add(key);\n return;\n }\n\n if (!ready) pending.add(true);\n\n pending.add(key);\n\n for (const k of pending)\n for (const [callback, filter] of listeners)\n if (!filter || filter.has(k)) {\n const after = callback(k);\n if (after === null) listeners.delete(callback);\n else if (after) enqueue(after);\n }\n\n if (key === null) listeners.clear();\n else if (key === true) o.ready = true;\n\n pending.clear();\n}\n\nfunction enqueue(eventHandler: () => void) {\n if (!DISPATCH.size)\n queueMicrotask(() => {\n DISPATCH.forEach((event) => {\n try {\n event();\n } catch (err) {\n console.error(err);\n }\n });\n DISPATCH.clear();\n });\n\n DISPATCH.add(eventHandler);\n}\n\n/**\n * Create a side-effect which will update whenever values accessed change.\n * Callback is called immediately and whenever values are stale.\n *\n * @param target - Instance of State to observe.\n * @param callback - Function to invoke when values change.\n * @param requireValues - If `true` will throw if accessing a value which is `undefined`.\n */\nfunction watch<T extends object>(\n target: T,\n callback: Observer.Effect<Required<T>>,\n requireValues: true\n): () => void;\n\nfunction watch<T extends object>(\n target: T,\n callback: Observer.Effect<T>,\n recursive?: boolean\n): () => void;\n\nfunction watch<T extends object>(\n target: T,\n callback: Observer.Effect<T>,\n argument?: boolean\n) {\n const o = observer(target, true);\n let events: readonly Observer.Event[] = [];\n let unset: ((update: boolean | null) => void) | undefined;\n let reset: (() => void) | null | undefined;\n let previous: T | undefined;\n\n function invoke() {\n if (observer(target) === null) return;\n\n let ignore: boolean = true;\n\n function onUpdate() {\n events = [...o.events];\n\n if (reset === null) return null;\n if (ignore) return;\n\n ignore = true;\n\n unset!(true);\n unset = undefined;\n\n enqueue(invoke);\n }\n\n function run(release?: (update?: boolean | null) => void) {\n const proxy = observe(target, onUpdate, argument === true);\n const output = callback.call(proxy, proxy, events);\n\n if (previous && argument === false) {\n const { watching } = (proxy as Observed)[Observing]!;\n if (!watching.size)\n (previous as Observed)[Observing]!.watching.forEach((k) => watching.add(k));\n }\n \n previous = proxy;\n ignore = false;\n reset = output === null ? null : invoke;\n unset = (key) => {\n if (typeof output == 'function') output(key);\n if (release) release(key);\n };\n\n events = [];\n }\n\n try {\n if (argument !== false) capture(run);\n else run();\n } catch (err) {\n if (err instanceof Promise) {\n reset = undefined;\n err.then(invoke);\n } else {\n throw err;\n }\n }\n }\n\n const unlisten = listener(target, (key) => {\n if (key === true) invoke();\n else if (!reset) return reset;\n\n if (key === null && unset) unset(null);\n });\n\n function cleanup() {\n if (unset) unset(false);\n\n reset = null;\n unlisten();\n }\n\n if (EffectContext && argument !== false) EffectContext.add(cleanup);\n\n return cleanup;\n}\n\nlet EffectContext: Set<(update?: boolean | null) => void> | undefined;\n\nfunction capture(scope: (release: (update?: boolean | null) => void) => void) {\n const parent = EffectContext;\n const context = (EffectContext = new Set());\n\n try {\n scope((update) => context.forEach((fn) => fn(update)));\n } finally {\n EffectContext = parent;\n }\n}\n\nexport {\n listener,\n event,\n Observer,\n touch,\n pending,\n observer,\n watch,\n capture\n};\n"],"mappings":";AA2CA,MAAM,WAA0B,OAAO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