@expressive/react 0.90.0 → 0.91.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/dist/adapter.d.ts +1 -1
- package/dist/adapter.js +1 -1
- package/dist/{chunk-component-BZoZVrRW.js → chunk-component-CDyGpHpR.js} +4 -5
- package/dist/chunk-component-CDyGpHpR.js.map +1 -0
- package/dist/{chunk-element-CrZVk-LG.js → chunk-element-Djiw1P1m.js} +2 -2
- package/dist/{chunk-element-CrZVk-LG.js.map → chunk-element-Djiw1P1m.js.map} +1 -1
- package/dist/{chunk-runtime-Cp1W-hQO.d.ts → chunk-runtime-BhgBTX_F.d.ts} +3 -2
- package/dist/has.js +2 -2
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/map.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-component-BZoZVrRW.js.map +0 -1
package/dist/adapter.d.ts
CHANGED
package/dist/adapter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as useSettle, c as useWeak, i as useFactory, o as useSetup, r as Runtime, s as useWatch } from "./chunk-component-
|
|
1
|
+
import { a as useSettle, c as useWeak, i as useFactory, o as useSetup, r as Runtime, s as useWatch } from "./chunk-component-CDyGpHpR.js";
|
|
2
2
|
import { Context, Model, Model as Model$1, State } from "@expressive/mvc";
|
|
3
3
|
import { observer, watch } from "@expressive/mvc/observable";
|
|
4
4
|
|
|
@@ -180,7 +180,7 @@ Object.defineProperty(Component, "contextType", {
|
|
|
180
180
|
});
|
|
181
181
|
const _get = Context$1.get;
|
|
182
182
|
Context$1.get = (state) => {
|
|
183
|
-
if (!state) try {
|
|
183
|
+
if (!state && !Runtime.idle()) try {
|
|
184
184
|
return useAmbient();
|
|
185
185
|
} catch {}
|
|
186
186
|
return _get(state);
|
|
@@ -224,9 +224,8 @@ Component.on({
|
|
|
224
224
|
subcomponents(self);
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
|
-
function bootstrap(
|
|
228
|
-
context =
|
|
229
|
-
context.set(this, () => () => this.set(null));
|
|
227
|
+
function bootstrap(parent) {
|
|
228
|
+
const context = parent.push(this, () => this.set(null));
|
|
230
229
|
Object.defineProperties(this, {
|
|
231
230
|
context: {
|
|
232
231
|
get: () => context,
|
|
@@ -319,4 +318,4 @@ function subcomponents(target) {
|
|
|
319
318
|
|
|
320
319
|
//#endregion
|
|
321
320
|
export { useSettle as a, useWeak as c, useFactory as i, weak as l, Context$1 as n, useSetup as o, Runtime as r, useWatch as s, createFrame as t };
|
|
322
|
-
//# sourceMappingURL=chunk-component-
|
|
321
|
+
//# sourceMappingURL=chunk-component-CDyGpHpR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-component-CDyGpHpR.js","names":["Context"],"sources":["../src/runtime.ts","../src/context.ts","../src/component.ts"],"sourcesContent":["import type { Component } from '@expressive/mvc';\nimport { watch } from '@expressive/mvc/observable';\nimport { pending } from '@expressive/mvc';\nimport type { Context } from './context';\n\ninterface Settle {\n waiting?: (() => void)[];\n claim(): void;\n release(): void;\n}\n\ninterface Setup {\n rendered: number;\n revision: number;\n mounted?: boolean;\n fresh?: boolean;\n getRevision?: () => number;\n lapsed?: boolean;\n commit?: () => (() => void) | void;\n release?: (() => void) | void;\n teardown?: () => void;\n}\n\ninterface Hook<T> extends Setup {\n queued?: boolean;\n update?: Weak<(next: (previous: number) => number) => void>;\n output: T;\n}\n\ninterface Weak<T> {\n deref(): T | undefined;\n}\n\nexport const Runtime = {} as {\n /** Host own-property keys to trap out of observed state; assigned by each adapter. */\n ignore: string[];\n createElement(type: any, props?: any, ...children: any[]): any;\n createContext<T>(value: T): any;\n useContext(context: any): any;\n useState<S>(initial: S | (() => S)): [S, (next: (previous: S) => S) => void];\n useEffect(effect: () => (() => void) | void, deps?: any[]): void;\n useRef<T>(initial: T): { current: T };\n /** Non-urgent bracket a subscriber replays through; absent where the host\n * cannot defer, which keeps normal timing. */\n startTransition?(work: () => void): void;\n /** Consumed for pre-commit revision validation; absent where commits\n * cannot interleave with writes. */\n useSyncExternalStore?(\n subscribe: (notify: () => void) => () => void,\n getSnapshot: () => number,\n getServerSnapshot?: () => number\n ): number;\n /** Per-render-attempt lifecycle; absent where render attempts do not stack. */\n dedupe?(from: Component, context: Context): { commit(): void; remove(): void };\n /** Whether the host is certainly not rendering, so a hook probe would only throw - and may log. `undefined` when the host cannot tell. */\n idle(): boolean | undefined;\n /** Host error-boundary component, wrapping a Component whose `catch` is set. */\n ErrorBoundary: unknown;\n Suspense: any;\n};\n\nconst noop = () => () => {};\n\nexport function useFactory<T extends object>(factory: () => T) {\n const ref = Runtime.useRef<T | null>(null);\n return ref.current || (ref.current = factory());\n}\n\n/**\n * Returns a claim on the update being replayed, held until this hook commits\n * carrying it - or until unmount, where it never will. Keyed on `tick` so an\n * urgent commit in the meantime, which leaves the deferred update queued, does\n * not release it.\n */\nexport function useSettle(tick: number) {\n const ref = Runtime.useRef<Settle | null>(null);\n const settle = ref.current || (ref.current = {\n claim() {\n const held = pending();\n\n if (held) (settle.waiting ||= []).push(held);\n },\n release() {\n const { waiting } = settle;\n\n if (!waiting) return;\n settle.waiting = undefined;\n\n for (const held of waiting) held();\n }\n });\n\n Runtime.useEffect(() => {\n settle.release();\n return settle.release;\n }, [tick]);\n\n return settle.claim;\n}\n\n/**\n * Run `init` once for the life of a hook and clean up when it unmounts, safe\n * under React StrictMode - a remount shares the render counter, so neither the\n * setup nor its cleanup repeats. A cleanup following a render not yet committed\n * - Fast Refresh re-running effects - defers a microtask, and is dropped if the\n * effect runs again. `reset` invalidates the rendered value so in-flight render\n * attempts revalidate.\n *\n * @returns The hook's own record, plus the render counter and its setter.\n */\nexport function useSetup<T extends Setup>(\n init: (self: T, reset: () => void) => () => (() => void) | void,\n teardown?: () => void\n) {\n const { current } = Runtime.useRef({ rendered: 0, revision: 0 } as T);\n\n const [tick, update] = Runtime.useState(() => {\n if (!current.rendered)\n current.commit = init(current, () => {\n current.revision++;\n });\n\n return current.rendered++;\n });\n\n useReap(current, teardown);\n\n const getRevision = (current.getRevision ||= () => current.revision);\n\n current.fresh = true;\n\n Runtime.useSyncExternalStore?.(noop, getRevision, getRevision);\n\n Runtime.useEffect(() => {\n current.fresh = false;\n });\n\n Runtime.useEffect(() => {\n current.mounted = true;\n current.lapsed = false;\n\n if (current.commit) {\n current.release = current.commit();\n current.commit = undefined;\n }\n\n return () => {\n if (!current.fresh) {\n if (--current.rendered <= 0) release(current);\n return;\n }\n\n current.lapsed = true;\n\n queueMicrotask(() => {\n if (current.lapsed) release(current);\n });\n }\n }, []);\n\n return [current, tick, update] as const;\n}\n\nfunction release(setup: Setup) {\n setup.release?.();\n setup.teardown?.();\n}\n\nlet reaper: FinalizationRegistry<Setup> | null | undefined;\n\nfunction useReap(setup: Setup, teardown?: () => void) {\n const token = Runtime.useRef<object | null>(null);\n\n if (!teardown || setup.teardown) return;\n\n setup.teardown = teardown;\n\n if (reaper === undefined)\n reaper = typeof FinalizationRegistry == 'function'\n ? new FinalizationRegistry((setup) => setup.mounted || setup.teardown!())\n : null;\n\n reaper?.register((token.current = {}), setup);\n}\n\nexport function weak<T extends object>(value: T): Weak<T> {\n return typeof WeakRef == 'function' ? new WeakRef(value) : { deref: () => value };\n}\n\nexport function useWeak<T extends object>(value: T) {\n const ref = Runtime.useRef<Weak<T> | null>(null);\n return (ref.current ||= weak(value));\n}\n\n/**\n * Mount-effect with a refreshable return value. Publishing a value before mount\n * defers the update to it, and one published after claims the update being\n * replayed until this hook commits carrying it.\n *\n * @returns Latest value published via the setter (`undefined` until set).\n */\nexport function useHook<T = void>(\n callback: (\n refresh: (next: T) => void,\n reset: () => void\n ) => () => (() => void) | void,\n teardown?: () => void\n) {\n const [current, tick, update] = useSetup<Hook<T>>((self, reset) => {\n const mount = callback((next) => {\n self.output = next;\n\n if (self.mounted) {\n claim();\n self.update?.deref()!((x) => x + 1);\n }\n else if (self.update) self.queued = true;\n }, reset);\n\n return () => {\n const cleanup = mount();\n\n if (self.queued) {\n self.queued = false;\n self.update!.deref()!((x) => x + 1);\n }\n\n return cleanup;\n };\n }, teardown);\n\n const claim = useSettle(tick);\n\n current.update ||= weak(update);\n\n return current.output;\n}\n\nexport function useWatch<T extends object>(\n from: T,\n mount?: () => (() => void) | void,\n teardown?: () => void\n) {\n return useHook<T>((refresh, reset) => {\n const release = watch(from, (current) => {\n refresh(current);\n\n return (update) => {\n if (update === true) reset();\n };\n }, undefined, Runtime.startTransition);\n\n return () => {\n const cleanup = mount?.();\n\n return () => {\n release();\n if (typeof cleanup == 'function') cleanup();\n };\n };\n }, teardown) ?? from;\n}\n","import { Model, Context, Component } from '@expressive/mvc';\nimport { Runtime } from './runtime';\n\nlet shared: any;\n\n/**\n * Lazily-created context carrying the active {@link Context} down the tree.\n * Lazy because the framework's `createContext` arrives via {@link Runtime},\n * which an adapter's entry populates at load - after this module evaluates.\n */\nfunction Layers() {\n return shared || (shared = Runtime.createContext(Context.root));\n}\n\n/** Read the ambient {@link Context} from the nearest Layers provider. */\nfunction useAmbient() {\n return Runtime.useContext(Layers());\n}\n\n/** Wrap `children` in a {@link Layers} provider carrying `context` down the tree. */\nfunction createProvider(context: Context, children: any) {\n return Runtime.createElement(Layers().Provider, { value: context, children });\n}\n\n// Class components consume the active Context through the host's `contextType`\nObject.defineProperty(Component, 'contextType', { configurable: true, get: Layers });\n\nconst _get = Context.get;\n\nContext.get = (state?: Model) => {\n if (!state && !Runtime.idle())\n try {\n return useAmbient();\n } catch { }\n\n return _get(state);\n};\n\nexport { Context, createProvider };\n","import { Component, unbind } from '@expressive/mvc';\nimport { createProvider, type Context } from './context';\nimport { Runtime, useWatch } from './runtime';\n\ndeclare module '@expressive/mvc' {\n namespace Component {\n /**\n * Not available - a Component is rendered, not a hook.\n * Render it with `<Component />` or `{component}`.\n * For a bare instance use `Component.new()`.\n */\n const use: never;\n }\n\n interface Component {\n /**\n * Optional hook called once this Component commits. Return a function to\n * run when it unmounts.\n *\n * Not called during server render, nor for an instance placed as\n * `{component}` - a placement does not own what it renders. Client-only\n * effects belong here; setup which must accompany the instance itself\n * belongs in `new()`.\n */\n mount?(): (() => void) | void;\n\n /** @deprecated Only to satisfy host JSX. Use `this.get(Model)` instead. */\n readonly context: Context;\n /** @deprecated Only to satisfy host JSX. Use `this.get()` instead. */\n readonly state: {};\n /** @deprecated Only to satisfy host JSX. Use `this.set({})` instead. */\n setState: (state: any, callback?: () => void) => void;\n /** @deprecated Only to satisfy host JSX. Use `this.set(key)` instead. */\n forceUpdate: (callback?: () => void) => void;\n }\n}\n\n// Host-agnostic seams: `state` is a read-only values bag; `context`'s setter\n// pushes a child context, registers the instance for teardown, and installs its\n// per-instance render host. Host-specific descriptors stay in each adapter.\nObject.defineProperties(Component.prototype, {\n state: {\n set() {},\n get: Component.prototype.get\n },\n context: {\n set: bootstrap\n }\n});\n\nObject.defineProperty(Component, 'use', {\n configurable: true,\n value() {\n throw new Error(\n `${this} is a Component - render as an element instead of calling use().`\n );\n }\n});\n\n/**\n * On the root Component, host own-property keys are trapped so each lands as a\n * plain own property (out of observed state); each adapter assigns its own set.\n */\nComponent.on({\n type(type) {\n const render = Object.getOwnPropertyDescriptor(type.prototype, 'render');\n\n if (typeof render?.value == 'function')\n Object.defineProperty(type.prototype, 'render', { ...render, configurable: false });\n\n if (type === Component)\n for (const key of Runtime.ignore)\n Object.defineProperty(Component.prototype, key, {\n set(value) {\n Object.defineProperty(this, key, { value, writable: true });\n }\n });\n\n subcomponents(type.prototype);\n },\n setup(self) {\n subcomponents(self);\n }\n});\n\nfunction bootstrap(this: Component, parent: Context){\n const context = parent.push(this, () => this.set(null));\n\n Object.defineProperties(this, {\n context: {\n get: () => context,\n set() {}\n },\n render: {\n value: render(this, context)\n }\n });\n\n this.set(null, () => {\n Object.defineProperty(this, 'props', {\n value: this.props,\n writable: true\n });\n })\n}\n\n/**\n * Wrap a content element in its context provider, a Suspense boundary (unless\n * `fallback` is `false`) and, when `catch` is set, the host error boundary.\n */\nfunction createFrame(from: Component, context: Context, children: unknown) {\n const { createElement } = Runtime;\n\n if(from.fallback !== false)\n children = createElement(\n Runtime.Suspense,\n { fallback: from.fallback, name: String(from) },\n children\n )\n\n children = createProvider(context, children);\n\n return from.props.catch || from.catch\n ? createElement(Runtime.ErrorBoundary, { self: from, children })\n : children;\n}\n\n/**\n * Ownership host for `<Component/>`: React owns the instance, so its render\n * threads the bootstrap-pushed context through `Runtime.dedupe` (React stacks\n * render attempts) and tears that context down - destroying the instance - on\n * unmount.\n */\nfunction render(from: Component, context: Context) {\n const { createElement, dedupe } = Runtime;\n const attempt = dedupe?.(from, context);\n const { is: owner } = from;\n // Read before bootstrap shadows an instance `render` with this host.\n const own = Object.prototype.hasOwnProperty.call(owner, 'render') && owner.render;\n const teardown = () => {\n attempt?.remove();\n context.pop();\n };\n\n const Render = () => (own || Object.getPrototypeOf(owner).render).call(from, from.props);\n const Component = () => {\n from = useWatch(from, () => {\n const release = owner.mount?.();\n\n attempt?.commit();\n\n return release;\n }, teardown);\n\n return createFrame(from, context, createElement(Render));\n };\n\n return () => createElement(Component);\n}\n\n/** Rewrite each own capitalized function on `target` into a subcomponent. */\nfunction subcomponents(target: object) {\n for (const key of Object.getOwnPropertyNames(target)) {\n if (!/^[A-Z]/.test(key)) continue;\n const { value } = Object.getOwnPropertyDescriptor(target, key)!;\n if (typeof value != 'function') continue;\n Object.defineProperty(target, key, {\n configurable: true,\n get(this: Component) {\n const owner = this.is;\n let render = unbind(value);\n const Component = (props: unknown) =>\n render.call(useWatch(owner), props);\n\n Object.defineProperty(owner, key, {\n configurable: true,\n get: () => Component,\n set(fn: Function) {\n render = fn;\n }\n });\n\n return Component;\n },\n set(this: Component, value: unknown) {\n Object.defineProperty(this, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n\n subcomponents(this);\n }\n });\n }\n}\n\nexport { createFrame };\n"],"mappings":";;;;AAiCA,MAAa,UAAU,EAAE;AA4BzB,MAAM,mBAAmB;AAEzB,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,MAAM,kBAAkB;AACtB,SAAO,SAAS,YAAY;GAC1B,MAAM,UAAU,MAAM,SAAS;AAE/B,YAAS,QAAQ;AAEjB,UAAO;KACN,SAAS;AAEZ,SAAO,YAAY,MAAM,SAAS,cAAc,OAAO,CAAC;;AAG1D,cAAa,cAAc,UAAU;;;AAIvC,SAAS,cAAc,QAAgB;AACrC,MAAK,MAAM,OAAO,OAAO,oBAAoB,OAAO,EAAE;AACpD,MAAI,CAAC,SAAS,KAAK,IAAI,CAAE;EACzB,MAAM,EAAE,UAAU,OAAO,yBAAyB,QAAQ,IAAI;AAC9D,MAAI,OAAO,SAAS,WAAY;AAChC,SAAO,eAAe,QAAQ,KAAK;GACjC,cAAc;GACd,MAAqB;IACnB,MAAM,QAAQ,KAAK;IACnB,IAAI,SAAS,OAAO,MAAM;IAC1B,MAAM,aAAa,UACjB,OAAO,KAAK,SAAS,MAAM,EAAE,MAAM;AAErC,WAAO,eAAe,OAAO,KAAK;KAChC,cAAc;KACd,WAAW;KACX,IAAI,IAAc;AAChB,eAAS;;KAEZ,CAAC;AAEF,WAAO;;GAET,IAAqB,OAAgB;AACnC,WAAO,eAAe,MAAM,KAAK;KAC/B;KACA,UAAU;KACV,YAAY;KACZ,cAAc;KACf,CAAC;AAEF,kBAAc,KAAK;;GAEtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as useFactory, n as Context$1, r as Runtime, s as useWatch, t as createFrame } from "./chunk-component-
|
|
1
|
+
import { i as useFactory, n as Context$1, r as Runtime, s as useWatch, t as createFrame } from "./chunk-component-CDyGpHpR.js";
|
|
2
2
|
import { Component } from "@expressive/mvc";
|
|
3
3
|
|
|
4
4
|
//#region src/element.ts
|
|
@@ -42,4 +42,4 @@ function Element() {
|
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
export { seam as t };
|
|
45
|
-
//# sourceMappingURL=chunk-element-
|
|
45
|
+
//# sourceMappingURL=chunk-element-Djiw1P1m.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk-element-
|
|
1
|
+
{"version":3,"file":"chunk-element-Djiw1P1m.js","names":["Context"],"sources":["../src/element.ts"],"sourcesContent":["import { Component } from '@expressive/mvc';\nimport { Context } from './context';\nimport { Runtime, useFactory, useWatch } from './runtime';\nimport { createFrame } from './component';\n\ndeclare module '@expressive/mvc' {\n interface Component {\n /** @deprecated Only to satisfy host JSX. */\n readonly type: typeof Component;\n }\n}\n\nlet template: any;\n\n/**\n * Borrow a host element's descriptors so `self` passes as a React element.\n * `props` false keeps the target's own `props` (Component supplies its own);\n * an object installs it as the element's props (collections have none).\n */\nexport function seam(\n self: object,\n props: object | false,\n type: Function,\n key: unknown\n) {\n if (!template) template = Runtime.createElement('template');\n\n const descriptors = Object.getOwnPropertyDescriptors(template);\n const store = descriptors._store?.value;\n\n if (props === false) delete (descriptors as any).props;\n\n if (store)\n descriptors._store.value = Object.create(\n Object.getPrototypeOf(store),\n Object.getOwnPropertyDescriptors(store)\n );\n\n Object.defineProperties(self, {\n ...descriptors,\n $$typeof: { value: template.$$typeof },\n ...(props ? { props: { value: props } } : undefined),\n key: { value: key },\n type: { value: type }\n });\n\n return template.$$typeof;\n}\n\nObject.defineProperty(Component.prototype, '$$typeof', {\n get(this: Component) {\n const self = this.is;\n return seam(self, false, Element.bind(self), self.key);\n }\n});\n\nfunction Element(this: Component){\n const outer = Context.get();\n const render = useFactory(() => {\n let from = this;\n const context = outer.push(this);\n const Content = () => from.render(from.props);\n\n return () => {\n from = useWatch(this, () => () => context.pop());\n\n return createFrame(from, context, Runtime.createElement(Content));\n };\n });\n\n return render();\n}\n"],"mappings":";;;;AAYA,IAAI;;;;;;AAOJ,SAAgB,KACd,MACA,OACA,MACA,KACA;AACA,KAAI,CAAC,SAAU,YAAW,QAAQ,cAAc,WAAW;CAE3D,MAAM,cAAc,OAAO,0BAA0B,SAAS;CAC9D,MAAM,QAAQ,YAAY,QAAQ;AAElC,KAAI,UAAU,MAAO,QAAQ,YAAoB;AAEjD,KAAI,MACF,aAAY,OAAO,QAAQ,OAAO,OAChC,OAAO,eAAe,MAAM,EAC5B,OAAO,0BAA0B,MAAM,CACxC;AAEH,QAAO,iBAAiB,MAAM;EAC5B,GAAG;EACH,UAAU,EAAE,OAAO,SAAS,UAAU;EACtC,GAAI,QAAQ,EAAE,OAAO,EAAE,OAAO,OAAO,EAAE,GAAG;EAC1C,KAAK,EAAE,OAAO,KAAK;EACnB,MAAM,EAAE,OAAO,MAAM;EACtB,CAAC;AAEF,QAAO,SAAS;;AAGlB,OAAO,eAAe,UAAU,WAAW,YAAY,EACrD,MAAqB;CACnB,MAAM,OAAO,KAAK;AAClB,QAAO,KAAK,MAAM,OAAO,QAAQ,KAAK,KAAK,EAAE,KAAK,IAAI;GAEzD,CAAC;AAEF,SAAS,UAAwB;CAC/B,MAAM,QAAQA,UAAQ,KAAK;AAa3B,QAZe,iBAAiB;EAC9B,IAAI,OAAO;EACX,MAAM,UAAU,MAAM,KAAK,KAAK;EAChC,MAAM,gBAAgB,KAAK,OAAO,KAAK,MAAM;AAE7C,eAAa;AACX,UAAO,SAAS,kBAAkB,QAAQ,KAAK,CAAC;AAEhD,UAAO,YAAY,MAAM,SAAS,QAAQ,cAAc,QAAQ,CAAC;;GAEnE,EAEa"}
|
|
@@ -133,10 +133,11 @@ declare const Runtime: {
|
|
|
133
133
|
dedupe?(from: Component, context: Context$1): {
|
|
134
134
|
commit(): void;
|
|
135
135
|
remove(): void;
|
|
136
|
-
}; /**
|
|
136
|
+
}; /** Whether the host is certainly not rendering, so a hook probe would only throw - and may log. `undefined` when the host cannot tell. */
|
|
137
|
+
idle(): boolean | undefined; /** Host error-boundary component, wrapping a Component whose `catch` is set. */
|
|
137
138
|
ErrorBoundary: unknown;
|
|
138
139
|
Suspense: any;
|
|
139
140
|
};
|
|
140
141
|
//#endregion
|
|
141
142
|
export { Runtime as t };
|
|
142
|
-
//# sourceMappingURL=chunk-runtime-
|
|
143
|
+
//# sourceMappingURL=chunk-runtime-BhgBTX_F.d.ts.map
|
package/dist/has.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as useWatch } from "./chunk-component-
|
|
2
|
-
import { t as seam } from "./chunk-element-
|
|
1
|
+
import { s as useWatch } from "./chunk-component-CDyGpHpR.js";
|
|
2
|
+
import { t as seam } from "./chunk-element-Djiw1P1m.js";
|
|
3
3
|
import { has } from "@expressive/mvc";
|
|
4
4
|
|
|
5
5
|
//#region src/has.ts
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as weak, r as Runtime } from "./chunk-component-
|
|
1
|
+
import { l as weak, r as Runtime } from "./chunk-component-CDyGpHpR.js";
|
|
2
2
|
import { Model as Model$1, State } from "./adapter.js";
|
|
3
|
-
import "./chunk-element-
|
|
3
|
+
import "./chunk-element-Djiw1P1m.js";
|
|
4
4
|
import { has } from "./has.js";
|
|
5
5
|
import { map } from "./map.js";
|
|
6
6
|
import { Component, Component as Component$1, Context, def, get, pending, ref, set } from "@expressive/mvc";
|
|
@@ -86,6 +86,19 @@ var ErrorBoundary = class extends React.Component {
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/idle.ts
|
|
91
|
+
function idle(React) {
|
|
92
|
+
const modern = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
93
|
+
const legacy = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher;
|
|
94
|
+
const current = modern && "H" in modern ? () => modern.H : legacy && "current" in legacy ? () => legacy.current : void 0;
|
|
95
|
+
if (!current) return () => void 0;
|
|
96
|
+
return () => {
|
|
97
|
+
const dispatcher = current();
|
|
98
|
+
return !dispatcher || dispatcher.useContext === dispatcher.useState;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
89
102
|
//#endregion
|
|
90
103
|
//#region src/index.ts
|
|
91
104
|
Object.defineProperty(Component$1.prototype, "isReactComponent", { value: true });
|
|
@@ -99,6 +112,7 @@ Object.defineProperty(Component$1.prototype, "_reactInternals", {
|
|
|
99
112
|
}
|
|
100
113
|
});
|
|
101
114
|
Object.assign(Runtime, {
|
|
115
|
+
idle: idle(React$1),
|
|
102
116
|
dedupe,
|
|
103
117
|
ErrorBoundary,
|
|
104
118
|
createElement: React$1.createElement,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Component","React","Model"],"sources":["../src/jsx-runtime.ts","../src/boundary.ts","../src/index.ts"],"sourcesContent":["import { Children, isValidElement } from 'react';\nimport { Fragment, jsx, jsxs } from 'react/jsx-runtime';\nimport { host } from '@expressive/mvc/jsx-runtime';\n\nimport type { Component as ReactComponent, JSX as ReactJSX, ReactNode } from 'react';\n\ndeclare module '@expressive/mvc/jsx-runtime' {\n interface Host {\n node: ReactNode;\n intrinsics: ReactJSX.IntrinsicElements;\n elementClass: ReactComponent<any, any>;\n }\n}\n\nhost({\n jsx,\n jsxs,\n Fragment,\n isElement: isValidElement,\n childrenOf: Children.toArray,\n typeOf(node){\n return isValidElement(node) ? node.type : undefined;\n },\n propsOf(node){\n return isValidElement(node) ? node.props as Record<string, unknown> : {};\n }\n});\n","import { Component } from '@expressive/mvc';\nimport React from 'react';\nimport { Context } from './context';\n\ninterface Entry {\n committed?: boolean;\n context: Context;\n commit: () => void;\n remove: () => void;\n};\n\n/** In-flight render attempts by tree position, per ambient context.\n * When one commits, older uncommitted attempts at its slot are provably dead. */\nconst SLOTS = new WeakMap<Context, Map<string, Set<Entry>>>();\n\n/**\n * React's attempt lifecycle: fiber-keyed stacking so a superseded (uncommitted)\n * render attempt at a tree position is discarded when a later one commits.\n */\nexport function dedupe(on: Component, context: Context) {\n let slots = SLOTS.get(context.parent!);\n if (!slots) SLOTS.set(context.parent!, (slots = new Map()));\n\n // key/index path to root: stable across render attempts of this element\n let slot = '';\n for (let f = (on as any)._reactInternals; f; f = f.return)\n slot += (f.key ?? f.index) + '.';\n\n let list = slots.get(slot);\n if (!list) slots.set(slot, (list = new Set()));\n\n const entry: Entry = {\n context,\n commit() {\n entry.committed = true;\n\n for (const e of list) {\n if (e === entry) break;\n if (e.committed) continue;\n e.context.pop();\n list.delete(e);\n }\n },\n remove() {\n list.delete(entry);\n }\n };\n\n list.add(entry);\n return entry;\n};\n\nexport class ErrorBoundary extends React.Component<{\n self: Component;\n children: React.ReactNode;\n}> {\n state = {} as { error?: Error };\n recovering = false;\n\n constructor(props: ErrorBoundary['props']) {\n super(props);\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n const { self } = this.props;\n const { fallback } = self;\n const reset = (error?: Error) => {\n this.recovering = true;\n this.setState({ error });\n };\n\n Promise.resolve((self.props.catch || self.catch)!.call(self, error, self.is))\n .then(() => reset(), reset)\n .finally(() => self.set({ fallback }, true));\n }\n\n componentDidUpdate() {\n this.recovering = false;\n }\n\n render() {\n if (!this.state.error) return this.props.children;\n if (this.recovering) throw this.state.error;\n return this.props.self.fallback;\n }\n};\n","import { Component } from '@expressive/mvc';\nimport { Model } from './adapter';\nimport * as React from 'react';\n\nimport './element';\nimport './jsx-runtime';\n\nimport { Runtime } from './adapter';\nimport { weak } from './runtime';\nimport { ErrorBoundary, dedupe } from './boundary';\n\n// React detects class components by this brand (preact reads `prototype.render`).\nObject.defineProperty(Component.prototype, 'isReactComponent', {\n value: true\n});\n\nconst FIBER = new WeakMap<Component, { deref(): unknown }>();\n\nObject.defineProperty(Component.prototype, '_reactInternals', {\n get(this: Component) {\n return FIBER.get(this)?.deref();\n },\n set(this: Component, fiber: object) {\n FIBER.set(this, weak(fiber));\n }\n});\n\nObject.assign(Runtime, {\n dedupe,\n ErrorBoundary,\n createElement: React.createElement,\n createContext: React.createContext,\n useContext: React.useContext,\n useEffect: React.useEffect,\n useState: React.useState,\n useRef: React.useRef,\n useSyncExternalStore: React.useSyncExternalStore,\n startTransition: React.startTransition,\n Suspense: React.Suspense,\n ignore: [\n 'updater',\n 'refs',\n '_reactInternalInstance'\n ]\n});\n\n/** @deprecated Import `{ Model }` from `@expressive/mvc`. This re-export will be removed. */\nexport { State } from './adapter';\n\n/** @deprecated Import `{ Model }` from `@expressive/mvc`. The default export will be removed. */\nexport default Model;\n\n/** @deprecated Import from `@expressive/mvc`. These re-exports will be removed. */\nexport { Component, Context, def, get, ref, set, pending } from '@expressive/mvc';\n\n/** @deprecated Import `has` from `@expressive/mvc`. This re-export will be removed. */\nexport { has } from './has';\n\n/** @deprecated Import `map` from `@expressive/mvc`. This re-export will be removed. */\nexport { map } from './map';\n"],"mappings":";;;;;;;;;;;;AAcA,KAAK;CACH;CACA;CACA;CACA,WAAW;CACX,YAAY,SAAS;CACrB,OAAO,MAAK;AACV,SAAO,eAAe,KAAK,GAAG,KAAK,OAAO;;CAE5C,QAAQ,MAAK;AACX,SAAO,eAAe,KAAK,GAAG,KAAK,QAAmC,EAAE;;CAE3E,CAAC;;;;;;ACbF,MAAM,wBAAQ,IAAI,SAA2C;;;;;AAM7D,SAAgB,OAAO,IAAe,SAAkB;CACtD,IAAI,QAAQ,MAAM,IAAI,QAAQ,OAAQ;AACtC,KAAI,CAAC,MAAO,OAAM,IAAI,QAAQ,QAAU,wBAAQ,IAAI,KAAK,CAAE;CAG3D,IAAI,OAAO;AACX,MAAK,IAAI,IAAK,GAAW,iBAAiB,GAAG,IAAI,EAAE,OACjD,UAAS,EAAE,OAAO,EAAE,SAAS;CAE/B,IAAI,OAAO,MAAM,IAAI,KAAK;AAC1B,KAAI,CAAC,KAAM,OAAM,IAAI,MAAO,uBAAO,IAAI,KAAK,CAAE;CAE9C,MAAM,QAAe;EACnB;EACA,SAAS;AACP,SAAM,YAAY;AAElB,QAAK,MAAM,KAAK,MAAM;AACpB,QAAI,MAAM,MAAO;AACjB,QAAI,EAAE,UAAW;AACjB,MAAE,QAAQ,KAAK;AACf,SAAK,OAAO,EAAE;;;EAGlB,SAAS;AACP,QAAK,OAAO,MAAM;;EAErB;AAED,MAAK,IAAI,MAAM;AACf,QAAO;;AAGT,IAAa,gBAAb,cAAmC,MAAM,UAGtC;CACD,QAAQ,EAAE;CACV,aAAa;CAEb,YAAY,OAA+B;AACzC,QAAM,MAAM;;CAGd,OAAO,yBAAyB,OAAc;AAC5C,SAAO,EAAE,OAAO;;CAGlB,kBAAkB,OAAc;EAC9B,MAAM,EAAE,SAAS,KAAK;EACtB,MAAM,EAAE,aAAa;EACrB,MAAM,SAAS,UAAkB;AAC/B,QAAK,aAAa;AAClB,QAAK,SAAS,EAAE,OAAO,CAAC;;AAG1B,UAAQ,SAAS,KAAK,MAAM,SAAS,KAAK,OAAQ,KAAK,MAAM,OAAO,KAAK,GAAG,CAAC,CAC1E,WAAW,OAAO,EAAE,MAAM,CAC1B,cAAc,KAAK,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC;;CAGhD,qBAAqB;AACnB,OAAK,aAAa;;CAGpB,SAAS;AACP,MAAI,CAAC,KAAK,MAAM,MAAO,QAAO,KAAK,MAAM;AACzC,MAAI,KAAK,WAAY,OAAM,KAAK,MAAM;AACtC,SAAO,KAAK,MAAM,KAAK;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["Component","React","Model"],"sources":["../src/jsx-runtime.ts","../src/boundary.ts","../src/idle.ts","../src/index.ts"],"sourcesContent":["import { Children, isValidElement } from 'react';\nimport { Fragment, jsx, jsxs } from 'react/jsx-runtime';\nimport { host } from '@expressive/mvc/jsx-runtime';\n\nimport type { Component as ReactComponent, JSX as ReactJSX, ReactNode } from 'react';\n\ndeclare module '@expressive/mvc/jsx-runtime' {\n interface Host {\n node: ReactNode;\n intrinsics: ReactJSX.IntrinsicElements;\n elementClass: ReactComponent<any, any>;\n }\n}\n\nhost({\n jsx,\n jsxs,\n Fragment,\n isElement: isValidElement,\n childrenOf: Children.toArray,\n typeOf(node){\n return isValidElement(node) ? node.type : undefined;\n },\n propsOf(node){\n return isValidElement(node) ? node.props as Record<string, unknown> : {};\n }\n});\n","import { Component } from '@expressive/mvc';\nimport React from 'react';\nimport { Context } from './context';\n\ninterface Entry {\n committed?: boolean;\n context: Context;\n commit: () => void;\n remove: () => void;\n};\n\n/** In-flight render attempts by tree position, per ambient context.\n * When one commits, older uncommitted attempts at its slot are provably dead. */\nconst SLOTS = new WeakMap<Context, Map<string, Set<Entry>>>();\n\n/**\n * React's attempt lifecycle: fiber-keyed stacking so a superseded (uncommitted)\n * render attempt at a tree position is discarded when a later one commits.\n */\nexport function dedupe(on: Component, context: Context) {\n let slots = SLOTS.get(context.parent!);\n if (!slots) SLOTS.set(context.parent!, (slots = new Map()));\n\n // key/index path to root: stable across render attempts of this element\n let slot = '';\n for (let f = (on as any)._reactInternals; f; f = f.return)\n slot += (f.key ?? f.index) + '.';\n\n let list = slots.get(slot);\n if (!list) slots.set(slot, (list = new Set()));\n\n const entry: Entry = {\n context,\n commit() {\n entry.committed = true;\n\n for (const e of list) {\n if (e === entry) break;\n if (e.committed) continue;\n e.context.pop();\n list.delete(e);\n }\n },\n remove() {\n list.delete(entry);\n }\n };\n\n list.add(entry);\n return entry;\n};\n\nexport class ErrorBoundary extends React.Component<{\n self: Component;\n children: React.ReactNode;\n}> {\n state = {} as { error?: Error };\n recovering = false;\n\n constructor(props: ErrorBoundary['props']) {\n super(props);\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n const { self } = this.props;\n const { fallback } = self;\n const reset = (error?: Error) => {\n this.recovering = true;\n this.setState({ error });\n };\n\n Promise.resolve((self.props.catch || self.catch)!.call(self, error, self.is))\n .then(() => reset(), reset)\n .finally(() => self.set({ fallback }, true));\n }\n\n componentDidUpdate() {\n this.recovering = false;\n }\n\n render() {\n if (!this.state.error) return this.props.children;\n if (this.recovering) throw this.state.error;\n return this.props.self.fallback;\n }\n};\n","interface Dispatcher {\n useContext: unknown;\n useState: unknown;\n}\n\nexport function idle(React: any): () => boolean | undefined {\n const modern = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;\n const legacy = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher;\n\n const current: (() => Dispatcher | null) | undefined =\n modern && 'H' in modern ? () => modern.H :\n legacy && 'current' in legacy ? () => legacy.current :\n undefined;\n\n if (!current) return () => undefined;\n\n return () => {\n const dispatcher = current();\n\n return !dispatcher || dispatcher.useContext === dispatcher.useState;\n };\n}\n","import { Component } from '@expressive/mvc';\nimport { Model } from './adapter';\nimport * as React from 'react';\n\nimport './element';\nimport './jsx-runtime';\n\nimport { Runtime } from './adapter';\nimport { weak } from './runtime';\nimport { ErrorBoundary, dedupe } from './boundary';\nimport { idle } from './idle';\n\n// React detects class components by this brand (preact reads `prototype.render`).\nObject.defineProperty(Component.prototype, 'isReactComponent', {\n value: true\n});\n\nconst FIBER = new WeakMap<Component, { deref(): unknown }>();\n\nObject.defineProperty(Component.prototype, '_reactInternals', {\n get(this: Component) {\n return FIBER.get(this)?.deref();\n },\n set(this: Component, fiber: object) {\n FIBER.set(this, weak(fiber));\n }\n});\n\nObject.assign(Runtime, {\n idle: idle(React),\n dedupe,\n ErrorBoundary,\n createElement: React.createElement,\n createContext: React.createContext,\n useContext: React.useContext,\n useEffect: React.useEffect,\n useState: React.useState,\n useRef: React.useRef,\n useSyncExternalStore: React.useSyncExternalStore,\n startTransition: React.startTransition,\n Suspense: React.Suspense,\n ignore: [\n 'updater',\n 'refs',\n '_reactInternalInstance'\n ]\n});\n\n/** @deprecated Import `{ Model }` from `@expressive/mvc`. This re-export will be removed. */\nexport { State } from './adapter';\n\n/** @deprecated Import `{ Model }` from `@expressive/mvc`. The default export will be removed. */\nexport default Model;\n\n/** @deprecated Import from `@expressive/mvc`. These re-exports will be removed. */\nexport { Component, Context, def, get, ref, set, pending } from '@expressive/mvc';\n\n/** @deprecated Import `has` from `@expressive/mvc`. This re-export will be removed. */\nexport { has } from './has';\n\n/** @deprecated Import `map` from `@expressive/mvc`. This re-export will be removed. */\nexport { map } from './map';\n"],"mappings":";;;;;;;;;;;;AAcA,KAAK;CACH;CACA;CACA;CACA,WAAW;CACX,YAAY,SAAS;CACrB,OAAO,MAAK;AACV,SAAO,eAAe,KAAK,GAAG,KAAK,OAAO;;CAE5C,QAAQ,MAAK;AACX,SAAO,eAAe,KAAK,GAAG,KAAK,QAAmC,EAAE;;CAE3E,CAAC;;;;;;ACbF,MAAM,wBAAQ,IAAI,SAA2C;;;;;AAM7D,SAAgB,OAAO,IAAe,SAAkB;CACtD,IAAI,QAAQ,MAAM,IAAI,QAAQ,OAAQ;AACtC,KAAI,CAAC,MAAO,OAAM,IAAI,QAAQ,QAAU,wBAAQ,IAAI,KAAK,CAAE;CAG3D,IAAI,OAAO;AACX,MAAK,IAAI,IAAK,GAAW,iBAAiB,GAAG,IAAI,EAAE,OACjD,UAAS,EAAE,OAAO,EAAE,SAAS;CAE/B,IAAI,OAAO,MAAM,IAAI,KAAK;AAC1B,KAAI,CAAC,KAAM,OAAM,IAAI,MAAO,uBAAO,IAAI,KAAK,CAAE;CAE9C,MAAM,QAAe;EACnB;EACA,SAAS;AACP,SAAM,YAAY;AAElB,QAAK,MAAM,KAAK,MAAM;AACpB,QAAI,MAAM,MAAO;AACjB,QAAI,EAAE,UAAW;AACjB,MAAE,QAAQ,KAAK;AACf,SAAK,OAAO,EAAE;;;EAGlB,SAAS;AACP,QAAK,OAAO,MAAM;;EAErB;AAED,MAAK,IAAI,MAAM;AACf,QAAO;;AAGT,IAAa,gBAAb,cAAmC,MAAM,UAGtC;CACD,QAAQ,EAAE;CACV,aAAa;CAEb,YAAY,OAA+B;AACzC,QAAM,MAAM;;CAGd,OAAO,yBAAyB,OAAc;AAC5C,SAAO,EAAE,OAAO;;CAGlB,kBAAkB,OAAc;EAC9B,MAAM,EAAE,SAA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iBA,QAAM;CACvB,UAAUA,QAAM;CAChB,QAAQ;EACN;EACA;EACA;EACD;CACF,CAAC;;AAMF,kBAAeC"}
|
package/dist/map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as useWatch } from "./chunk-component-
|
|
2
|
-
import { t as seam } from "./chunk-element-
|
|
1
|
+
import { s as useWatch } from "./chunk-component-CDyGpHpR.js";
|
|
2
|
+
import { t as seam } from "./chunk-element-Djiw1P1m.js";
|
|
3
3
|
import { map } from "@expressive/mvc";
|
|
4
4
|
|
|
5
5
|
//#region src/map.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressive/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"description": "Class-based reactive state for React. Define state and logic as plain classes; components update when the values they read change.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expressive",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"test": "bun run typecheck && bun run coverage"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@expressive/mvc": "^0.
|
|
66
|
+
"@expressive/mvc": "^0.90.0",
|
|
67
67
|
"@testing-library/react": "^16.3.0",
|
|
68
68
|
"@types/react": "^19",
|
|
69
69
|
"@types/react-dom": "^19",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"vite": "^7.3.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@expressive/mvc": "^0.
|
|
78
|
+
"@expressive/mvc": "^0.90.0",
|
|
79
79
|
"react": ">=16.14.0 <20.0.0",
|
|
80
80
|
"vite": ">=5"
|
|
81
81
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk-component-BZoZVrRW.js","names":["Context"],"sources":["../src/runtime.ts","../src/context.ts","../src/component.ts"],"sourcesContent":["import type { Component } from '@expressive/mvc';\nimport { watch } from '@expressive/mvc/observable';\nimport { pending } from '@expressive/mvc';\nimport type { Context } from './context';\n\ninterface Settle {\n waiting?: (() => void)[];\n claim(): void;\n release(): void;\n}\n\ninterface Setup {\n rendered: number;\n revision: number;\n mounted?: boolean;\n fresh?: boolean;\n getRevision?: () => number;\n lapsed?: boolean;\n commit?: () => (() => void) | void;\n release?: (() => void) | void;\n teardown?: () => void;\n}\n\ninterface Hook<T> extends Setup {\n queued?: boolean;\n update?: Weak<(next: (previous: number) => number) => void>;\n output: T;\n}\n\ninterface Weak<T> {\n deref(): T | undefined;\n}\n\nexport const Runtime = {} as {\n /** Host own-property keys to trap out of observed state; assigned by each adapter. */\n ignore: string[];\n createElement(type: any, props?: any, ...children: any[]): any;\n createContext<T>(value: T): any;\n useContext(context: any): any;\n useState<S>(initial: S | (() => S)): [S, (next: (previous: S) => S) => void];\n useEffect(effect: () => (() => void) | void, deps?: any[]): void;\n useRef<T>(initial: T): { current: T };\n /** Non-urgent bracket a subscriber replays through; absent where the host\n * cannot defer, which keeps normal timing. */\n startTransition?(work: () => void): void;\n /** Consumed for pre-commit revision validation; absent where commits\n * cannot interleave with writes. */\n useSyncExternalStore?(\n subscribe: (notify: () => void) => () => void,\n getSnapshot: () => number,\n getServerSnapshot?: () => number\n ): number;\n /** Per-render-attempt lifecycle; absent where render attempts do not stack. */\n dedupe?(from: Component, context: Context): { commit(): void; remove(): void };\n /** Host error-boundary component, wrapping a Component whose `catch` is set. */\n ErrorBoundary: unknown;\n Suspense: any;\n};\n\nconst noop = () => () => {};\n\nexport function useFactory<T extends object>(factory: () => T) {\n const ref = Runtime.useRef<T | null>(null);\n return ref.current || (ref.current = factory());\n}\n\n/**\n * Returns a claim on the update being replayed, held until this hook commits\n * carrying it - or until unmount, where it never will. Keyed on `tick` so an\n * urgent commit in the meantime, which leaves the deferred update queued, does\n * not release it.\n */\nexport function useSettle(tick: number) {\n const ref = Runtime.useRef<Settle | null>(null);\n const settle = ref.current || (ref.current = {\n claim() {\n const held = pending();\n\n if (held) (settle.waiting ||= []).push(held);\n },\n release() {\n const { waiting } = settle;\n\n if (!waiting) return;\n settle.waiting = undefined;\n\n for (const held of waiting) held();\n }\n });\n\n Runtime.useEffect(() => {\n settle.release();\n return settle.release;\n }, [tick]);\n\n return settle.claim;\n}\n\n/**\n * Run `init` once for the life of a hook and clean up when it unmounts, safe\n * under React StrictMode - a remount shares the render counter, so neither the\n * setup nor its cleanup repeats. A cleanup following a render not yet committed\n * - Fast Refresh re-running effects - defers a microtask, and is dropped if the\n * effect runs again. `reset` invalidates the rendered value so in-flight render\n * attempts revalidate.\n *\n * @returns The hook's own record, plus the render counter and its setter.\n */\nexport function useSetup<T extends Setup>(\n init: (self: T, reset: () => void) => () => (() => void) | void,\n teardown?: () => void\n) {\n const { current } = Runtime.useRef({ rendered: 0, revision: 0 } as T);\n\n const [tick, update] = Runtime.useState(() => {\n if (!current.rendered)\n current.commit = init(current, () => {\n current.revision++;\n });\n\n return current.rendered++;\n });\n\n useReap(current, teardown);\n\n const getRevision = (current.getRevision ||= () => current.revision);\n\n current.fresh = true;\n\n Runtime.useSyncExternalStore?.(noop, getRevision, getRevision);\n\n Runtime.useEffect(() => {\n current.fresh = false;\n });\n\n Runtime.useEffect(() => {\n current.mounted = true;\n current.lapsed = false;\n\n if (current.commit) {\n current.release = current.commit();\n current.commit = undefined;\n }\n\n return () => {\n if (!current.fresh) {\n if (--current.rendered <= 0) release(current);\n return;\n }\n\n current.lapsed = true;\n\n queueMicrotask(() => {\n if (current.lapsed) release(current);\n });\n }\n }, []);\n\n return [current, tick, update] as const;\n}\n\nfunction release(setup: Setup) {\n setup.release?.();\n setup.teardown?.();\n}\n\nlet reaper: FinalizationRegistry<Setup> | null | undefined;\n\nfunction useReap(setup: Setup, teardown?: () => void) {\n const token = Runtime.useRef<object | null>(null);\n\n if (!teardown || setup.teardown) return;\n\n setup.teardown = teardown;\n\n if (reaper === undefined)\n reaper = typeof FinalizationRegistry == 'function'\n ? new FinalizationRegistry((setup) => setup.mounted || setup.teardown!())\n : null;\n\n reaper?.register((token.current = {}), setup);\n}\n\nexport function weak<T extends object>(value: T): Weak<T> {\n return typeof WeakRef == 'function' ? new WeakRef(value) : { deref: () => value };\n}\n\nexport function useWeak<T extends object>(value: T) {\n const ref = Runtime.useRef<Weak<T> | null>(null);\n return (ref.current ||= weak(value));\n}\n\n/**\n * Mount-effect with a refreshable return value. Publishing a value before mount\n * defers the update to it, and one published after claims the update being\n * replayed until this hook commits carrying it.\n *\n * @returns Latest value published via the setter (`undefined` until set).\n */\nexport function useHook<T = void>(\n callback: (\n refresh: (next: T) => void,\n reset: () => void\n ) => () => (() => void) | void,\n teardown?: () => void\n) {\n const [current, tick, update] = useSetup<Hook<T>>((self, reset) => {\n const mount = callback((next) => {\n self.output = next;\n\n if (self.mounted) {\n claim();\n self.update?.deref()!((x) => x + 1);\n }\n else if (self.update) self.queued = true;\n }, reset);\n\n return () => {\n const cleanup = mount();\n\n if (self.queued) {\n self.queued = false;\n self.update!.deref()!((x) => x + 1);\n }\n\n return cleanup;\n };\n }, teardown);\n\n const claim = useSettle(tick);\n\n current.update ||= weak(update);\n\n return current.output;\n}\n\nexport function useWatch<T extends object>(\n from: T,\n mount?: () => (() => void) | void,\n teardown?: () => void\n) {\n return useHook<T>((refresh, reset) => {\n const release = watch(from, (current) => {\n refresh(current);\n\n return (update) => {\n if (update === true) reset();\n };\n }, undefined, Runtime.startTransition);\n\n return () => {\n const cleanup = mount?.();\n\n return () => {\n release();\n if (typeof cleanup == 'function') cleanup();\n };\n };\n }, teardown) ?? from;\n}\n","import { Model, Context, Component } from '@expressive/mvc';\nimport { Runtime } from './runtime';\n\nlet shared: any;\n\n/**\n * Lazily-created context carrying the active {@link Context} down the tree.\n * Lazy because the framework's `createContext` arrives via {@link Runtime},\n * which an adapter's entry populates at load - after this module evaluates.\n */\nfunction Layers() {\n return shared || (shared = Runtime.createContext(Context.root));\n}\n\n/** Read the ambient {@link Context} from the nearest Layers provider. */\nfunction useAmbient() {\n return Runtime.useContext(Layers());\n}\n\n/** Wrap `children` in a {@link Layers} provider carrying `context` down the tree. */\nfunction createProvider(context: Context, children: any) {\n return Runtime.createElement(Layers().Provider, { value: context, children });\n}\n\n// Class components consume the active Context through the host's `contextType`\nObject.defineProperty(Component, 'contextType', { configurable: true, get: Layers });\n\nconst _get = Context.get;\n\nContext.get = (state?: Model) => {\n if (!state)\n try {\n return useAmbient();\n } catch { }\n\n return _get(state);\n};\n\nexport { Context, createProvider };\n","import { Component, unbind } from '@expressive/mvc';\nimport { createProvider, type Context } from './context';\nimport { Runtime, useWatch } from './runtime';\n\ndeclare module '@expressive/mvc' {\n namespace Component {\n /**\n * Not available - a Component is rendered, not a hook.\n * Render it with `<Component />` or `{component}`.\n * For a bare instance use `Component.new()`.\n */\n const use: never;\n }\n\n interface Component {\n /**\n * Optional hook called once this Component commits. Return a function to\n * run when it unmounts.\n *\n * Not called during server render, nor for an instance placed as\n * `{component}` - a placement does not own what it renders. Client-only\n * effects belong here; setup which must accompany the instance itself\n * belongs in `new()`.\n */\n mount?(): (() => void) | void;\n\n /** @deprecated Only to satisfy host JSX. Use `this.get(Model)` instead. */\n readonly context: Context;\n /** @deprecated Only to satisfy host JSX. Use `this.get()` instead. */\n readonly state: {};\n /** @deprecated Only to satisfy host JSX. Use `this.set({})` instead. */\n setState: (state: any, callback?: () => void) => void;\n /** @deprecated Only to satisfy host JSX. Use `this.set(key)` instead. */\n forceUpdate: (callback?: () => void) => void;\n }\n}\n\n// Host-agnostic seams: `state` is a read-only values bag; `context`'s setter\n// pushes a child context, registers the instance for teardown, and installs its\n// per-instance render host. Host-specific descriptors stay in each adapter.\nObject.defineProperties(Component.prototype, {\n state: {\n set() {},\n get: Component.prototype.get\n },\n context: {\n set: bootstrap\n }\n});\n\nObject.defineProperty(Component, 'use', {\n configurable: true,\n value() {\n throw new Error(\n `${this} is a Component - render as an element instead of calling use().`\n );\n }\n});\n\n/**\n * On the root Component, host own-property keys are trapped so each lands as a\n * plain own property (out of observed state); each adapter assigns its own set.\n */\nComponent.on({\n type(type) {\n const render = Object.getOwnPropertyDescriptor(type.prototype, 'render');\n\n if (typeof render?.value == 'function')\n Object.defineProperty(type.prototype, 'render', { ...render, configurable: false });\n\n if (type === Component)\n for (const key of Runtime.ignore)\n Object.defineProperty(Component.prototype, key, {\n set(value) {\n Object.defineProperty(this, key, { value, writable: true });\n }\n });\n\n subcomponents(type.prototype);\n },\n setup(self) {\n subcomponents(self);\n }\n});\n\nfunction bootstrap(this: Component, context: Context){\n context = context.push();\n context.set(this, () => () => this.set(null));\n\n Object.defineProperties(this, {\n context: {\n get: () => context,\n set() {}\n },\n render: {\n value: render(this, context)\n }\n });\n\n this.set(null, () => {\n Object.defineProperty(this, 'props', {\n value: this.props,\n writable: true\n });\n })\n}\n\n/**\n * Wrap a content element in its context provider, a Suspense boundary (unless\n * `fallback` is `false`) and, when `catch` is set, the host error boundary.\n */\nfunction createFrame(from: Component, context: Context, children: unknown) {\n const { createElement } = Runtime;\n\n if(from.fallback !== false)\n children = createElement(\n Runtime.Suspense,\n { fallback: from.fallback, name: String(from) },\n children\n )\n\n children = createProvider(context, children);\n\n return from.props.catch || from.catch\n ? createElement(Runtime.ErrorBoundary, { self: from, children })\n : children;\n}\n\n/**\n * Ownership host for `<Component/>`: React owns the instance, so its render\n * threads the bootstrap-pushed context through `Runtime.dedupe` (React stacks\n * render attempts) and tears that context down - destroying the instance - on\n * unmount.\n */\nfunction render(from: Component, context: Context) {\n const { createElement, dedupe } = Runtime;\n const attempt = dedupe?.(from, context);\n const { is: owner } = from;\n // Read before bootstrap shadows an instance `render` with this host.\n const own = Object.prototype.hasOwnProperty.call(owner, 'render') && owner.render;\n const teardown = () => {\n attempt?.remove();\n context.pop();\n };\n\n const Render = () => (own || Object.getPrototypeOf(owner).render).call(from, from.props);\n const Component = () => {\n from = useWatch(from, () => {\n const release = owner.mount?.();\n\n attempt?.commit();\n\n return release;\n }, teardown);\n\n return createFrame(from, context, createElement(Render));\n };\n\n return () => createElement(Component);\n}\n\n/** Rewrite each own capitalized function on `target` into a subcomponent. */\nfunction subcomponents(target: object) {\n for (const key of Object.getOwnPropertyNames(target)) {\n if (!/^[A-Z]/.test(key)) continue;\n const { value } = Object.getOwnPropertyDescriptor(target, key)!;\n if (typeof value != 'function') continue;\n Object.defineProperty(target, key, {\n configurable: true,\n get(this: Component) {\n const owner = this.is;\n let render = unbind(value);\n const Component = (props: unknown) =>\n render.call(useWatch(owner), props);\n\n Object.defineProperty(owner, key, {\n configurable: true,\n get: () => Component,\n set(fn: Function) {\n render = fn;\n }\n });\n\n return Component;\n },\n set(this: Component, value: unknown) {\n Object.defineProperty(this, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n\n subcomponents(this);\n }\n });\n }\n}\n\nexport { createFrame };\n"],"mappings":";;;;AAiCA,MAAa,UAAU,EAAE;AA0BzB,MAAM,mBAAmB;AAEzB,SAAgB,WAA6B,SAAkB;CAC7D,MAAM,MAAM,QAAQ,OAAiB,KAAK;AAC1C,QAAO,IAAI,YAAY,IAAI,UAAU,SAAS;;;;;;;;AAShD,SAAgB,UAAU,MAAc;CACtC,MAAM,MAAM,QAAQ,OAAsB,KAAK;CAC/C,MAAM,SAAS,IAAI,YAAY,IAAI,UAAU;EAC3C,QAAQ;GACN,MAAM,OAAO,SAAS;AAEtB,OAAI,KAAM,EAAC,OAAO,YAAY,EAAE,EAAE,KAAK,KAAK;;EAE9C,UAAU;GACR,MAAM,EAAE,YAAY;AAEpB,OAAI,CAAC,QAAS;AACd,UAAO,UAAU;AAEjB,QAAK,MAAM,QAAQ,QAAS,OAAM;;EAErC;AAED,SAAQ,gBAAgB;AACtB,SAAO,SAAS;AAChB,SAAO,OAAO;IACb,CAAC,KAAK,CAAC;AAEV,QAAO,OAAO;;;;;;;;;;;;AAahB,SAAgB,SACd,MACA,UACA;CACA,MAAM,EAAE,YAAY,QAAQ,OAAO;EAAE,UAAU;EAAG,UAAU;EAAG,CAAM;CAEr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