@askrjs/askr 0.0.49 → 0.0.51
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/bench/components/benchmark-table.js.map +1 -1
- package/dist/benchmark.js +5 -4
- package/dist/benchmark.js.map +1 -1
- package/dist/bin/askr-ssg.d.ts.map +1 -1
- package/dist/bin/askr-ssg.js.map +1 -1
- package/dist/boot/hydration.js.map +1 -1
- package/dist/boot/index.js +2 -1
- package/dist/boot/index.js.map +1 -1
- package/dist/boot/root-lifecycle.d.ts.map +1 -1
- package/dist/boot/root-lifecycle.js +4 -4
- package/dist/boot/root-lifecycle.js.map +1 -1
- package/dist/boot/route-startup.js.map +1 -1
- package/dist/common/error-boundary.d.ts +16 -0
- package/dist/common/error-boundary.d.ts.map +1 -0
- package/dist/common/invariant.js +17 -0
- package/dist/common/invariant.js.map +1 -0
- package/dist/common/jsx.d.ts +6 -2
- package/dist/common/jsx.d.ts.map +1 -1
- package/dist/common/jsx.js.map +1 -1
- package/dist/{dev → common}/logger.js +5 -6
- package/dist/common/logger.js.map +1 -0
- package/dist/common/vnode.d.ts +2 -2
- package/dist/common/vnode.d.ts.map +1 -1
- package/dist/common/vnode.js.map +1 -1
- package/dist/components/error-boundary.d.ts +2 -15
- package/dist/components/error-boundary.d.ts.map +1 -1
- package/dist/components/error-boundary.js +2 -74
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/link.js +2 -0
- package/dist/components/link.js.map +1 -1
- package/dist/control/case.d.ts.map +1 -1
- package/dist/control/case.js +1 -0
- package/dist/control/case.js.map +1 -1
- package/dist/control/for.d.ts +3 -3
- package/dist/control/for.d.ts.map +1 -1
- package/dist/control/for.js +2 -2
- package/dist/control/for.js.map +1 -1
- package/dist/control/show.js +1 -0
- package/dist/control/show.js.map +1 -1
- package/dist/data/data-runtime.js.map +1 -1
- package/dist/data/invalidation.js +2 -2
- package/dist/data/invalidation.js.map +1 -1
- package/dist/data/mutation-cell.d.ts.map +1 -1
- package/dist/data/mutation-cell.js +1 -1
- package/dist/data/mutation-cell.js.map +1 -1
- package/dist/data/query-cell.js +2 -2
- package/dist/data/query-cell.js.map +1 -1
- package/dist/data/shared.js +1 -0
- package/dist/data/shared.js.map +1 -1
- package/dist/data/testing.js +2 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/state/controllable.d.ts +0 -1
- package/dist/foundations/state/controllable.d.ts.map +1 -1
- package/dist/foundations/state/controllable.js +1 -0
- package/dist/foundations/state/controllable.js.map +1 -1
- package/dist/foundations/structures/index.d.ts +1 -1
- package/dist/foundations/structures/index.js +2 -1
- package/dist/foundations/structures/portal.d.ts +2 -24
- package/dist/foundations/structures/portal.js +3 -187
- package/dist/fx/fx.js +2 -2
- package/dist/fx/fx.js.map +1 -1
- package/dist/fx/index.js +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/jsx/index.d.ts +1 -1
- package/dist/jsx/types.d.ts +2 -2
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.d.ts.map +1 -1
- package/dist/jsx-dev-runtime.js +1 -0
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +1 -0
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/jsx-runtime2.d.ts +1 -1
- package/dist/renderer/attributes.js +1 -0
- package/dist/renderer/attributes.js.map +1 -1
- package/dist/renderer/boundaries.js +5 -5
- package/dist/renderer/boundaries.js.map +1 -1
- package/dist/renderer/child-shape.js +2 -2
- package/dist/renderer/child-shape.js.map +1 -1
- package/dist/renderer/children-fastpath.js +149 -0
- package/dist/renderer/children-fastpath.js.map +1 -0
- package/dist/renderer/children.js +3 -138
- package/dist/renderer/children.js.map +1 -1
- package/dist/renderer/cleanup.js +2 -2
- package/dist/renderer/cleanup.js.map +1 -1
- package/dist/renderer/component-host-cleanup.js +1 -1
- package/dist/renderer/component-host-cleanup.js.map +1 -1
- package/dist/renderer/component-host-instances.js +1 -1
- package/dist/renderer/component-host-instances.js.map +1 -1
- package/dist/renderer/component-host.js +1 -1
- package/dist/renderer/component-host.js.map +1 -1
- package/dist/renderer/dom-host.js.map +1 -1
- package/dist/renderer/dom-internal.js +5 -4
- package/dist/renderer/dom-internal.js.map +1 -1
- package/dist/renderer/dom.js +2 -1
- package/dist/renderer/element-children.js.map +1 -1
- package/dist/renderer/error-boundary-dom.js +51 -2
- package/dist/renderer/error-boundary-dom.js.map +1 -1
- package/dist/renderer/evaluate-reconcile.js +6 -5
- package/dist/renderer/evaluate-reconcile.js.map +1 -1
- package/dist/renderer/evaluate.js.map +1 -1
- package/dist/renderer/fastpath.js +3 -2
- package/dist/renderer/fastpath.js.map +1 -1
- package/dist/renderer/for-commit-dom-map.js.map +1 -1
- package/dist/renderer/for-commit-removal.js +2 -2
- package/dist/renderer/for-commit-removal.js.map +1 -1
- package/dist/renderer/for-commit-reorder.js +2 -2
- package/dist/renderer/for-commit-reorder.js.map +1 -1
- package/dist/renderer/for-commit.js +3 -3
- package/dist/renderer/for-commit.js.map +1 -1
- package/dist/renderer/index.js +3 -1
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/prop-bindings.js +4 -4
- package/dist/renderer/prop-bindings.js.map +1 -1
- package/dist/renderer/reactive-child-dom.js.map +1 -1
- package/dist/renderer/reactive-children.js +4 -4
- package/dist/renderer/reactive-children.js.map +1 -1
- package/dist/renderer/reconcile-fastpaths.js +2 -1
- package/dist/renderer/reconcile-fastpaths.js.map +1 -1
- package/dist/renderer/reconcile-resolution.js +3 -3
- package/dist/renderer/reconcile-resolution.js.map +1 -1
- package/dist/renderer/retained-element-rollback.js +2 -1
- package/dist/renderer/retained-element-rollback.js.map +1 -1
- package/dist/renderer/stable-patch.js +2 -3
- package/dist/renderer/stable-patch.js.map +1 -1
- package/dist/renderer/utils.js +2 -1
- package/dist/renderer/utils.js.map +1 -1
- package/dist/resources/index.js +1 -2
- package/dist/router/activity.d.ts.map +1 -1
- package/dist/router/activity.js +20 -22
- package/dist/router/activity.js.map +1 -1
- package/dist/router/authoring.js +1 -1
- package/dist/router/authoring.js.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/navigate.js +1 -1
- package/dist/router/navigate.js.map +1 -1
- package/dist/router/navigation-registry.js +1 -1
- package/dist/router/navigation-registry.js.map +1 -1
- package/dist/router/navigation-targets.d.ts.map +1 -1
- package/dist/router/navigation-targets.js +7 -5
- package/dist/router/navigation-targets.js.map +1 -1
- package/dist/router/rendering.js +1 -0
- package/dist/router/rendering.js.map +1 -1
- package/dist/router/resolution.d.ts +1 -14
- package/dist/router/resolution.d.ts.map +1 -1
- package/dist/router/resolution.js +6 -173
- package/dist/router/resolution.js.map +1 -1
- package/dist/router/route-matching.d.ts +20 -0
- package/dist/router/route-matching.d.ts.map +1 -0
- package/dist/router/route-matching.js +175 -0
- package/dist/router/route-matching.js.map +1 -0
- package/dist/router/route.js +4 -2
- package/dist/router/testing.js +4 -0
- package/dist/runtime/access.d.ts +20 -0
- package/dist/runtime/access.d.ts.map +1 -0
- package/dist/runtime/component-cleanup.js +1 -1
- package/dist/runtime/component-cleanup.js.map +1 -1
- package/dist/runtime/component-commit.js +1 -1
- package/dist/runtime/component-commit.js.map +1 -1
- package/dist/runtime/component-internal.d.ts +1 -1
- package/dist/runtime/component-internal.js +1 -1
- package/dist/runtime/component-internal.js.map +1 -1
- package/dist/runtime/component-lifecycle.d.ts +1 -1
- package/dist/runtime/component-lifecycle.js +1 -1
- package/dist/runtime/component-lifecycle.js.map +1 -1
- package/dist/runtime/component-scope.d.ts +1 -1
- package/dist/runtime/dev-namespace.d.ts +31 -0
- package/dist/runtime/dev-namespace.d.ts.map +1 -0
- package/dist/runtime/error-boundary.d.ts +5 -0
- package/dist/runtime/error-boundary.d.ts.map +1 -0
- package/dist/runtime/error-boundary.js +31 -0
- package/dist/runtime/error-boundary.js.map +1 -0
- package/dist/runtime/events.d.ts +58 -0
- package/dist/runtime/events.d.ts.map +1 -0
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/events.js.map +1 -1
- package/dist/runtime/execution-model.d.ts +7 -0
- package/dist/runtime/execution-model.d.ts.map +1 -0
- package/dist/runtime/fastlane.d.ts +34 -0
- package/dist/runtime/fastlane.d.ts.map +1 -0
- package/dist/runtime/for-internal.d.ts +5 -5
- package/dist/runtime/for-internal.d.ts.map +1 -1
- package/dist/runtime/for-internal.js.map +1 -1
- package/dist/runtime/for-signals.d.ts +1 -1
- package/dist/runtime/for-signals.d.ts.map +1 -1
- package/dist/runtime/for-signals.js +1 -1
- package/dist/runtime/for-signals.js.map +1 -1
- package/dist/runtime/for-types.d.ts +9 -0
- package/dist/runtime/for-types.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +24 -0
- package/dist/runtime/index.js +31 -0
- package/dist/runtime/perf-metrics.d.ts +26 -0
- package/dist/runtime/perf-metrics.d.ts.map +1 -0
- package/dist/runtime/portal.d.ts +22 -0
- package/dist/runtime/portal.d.ts.map +1 -0
- package/dist/runtime/portal.js +213 -0
- package/dist/runtime/portal.js.map +1 -0
- package/dist/runtime/resource-cell.js +1 -1
- package/dist/runtime/resource-cell.js.map +1 -1
- package/dist/runtime/resource-operation.js +1 -1
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/scheduler.js +2 -2
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/selector-store.js +24 -0
- package/dist/runtime/selector-store.js.map +1 -0
- package/dist/runtime/selector.d.ts.map +1 -1
- package/dist/runtime/selector.js +3 -18
- package/dist/runtime/selector.js.map +1 -1
- package/dist/ssg/create-static-gen.js +1 -0
- package/dist/ssg/create-static-gen.js.map +1 -1
- package/dist/ssg/static-routes.js +1 -0
- package/dist/ssg/static-routes.js.map +1 -1
- package/dist/ssr/boundaries.js +2 -2
- package/dist/ssr/boundaries.js.map +1 -1
- package/dist/ssr/component-runtime.js +3 -3
- package/dist/ssr/component-runtime.js.map +1 -1
- package/dist/ssr/render-resolved.js +1 -1
- package/dist/ssr/render-sync.js +1 -1
- package/dist/ssr/render-sync.js.map +1 -1
- package/dist/ssr/route-policy-resolution.js +2 -1
- package/dist/ssr/route-policy-resolution.js.map +1 -1
- package/dist/ssr/route-render.js +2 -1
- package/dist/ssr/route-render.js.map +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3 -2
- package/dist/testing/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/dev/invariant.js +0 -29
- package/dist/dev/invariant.js.map +0 -1
- package/dist/dev/logger.js.map +0 -1
- package/dist/foundations/structures/portal.d.ts.map +0 -1
- package/dist/foundations/structures/portal.js.map +0 -1
- package/dist/runtime/component-contracts.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllable.js","names":[],"sources":["../../../src/foundations/state/controllable.ts"],"sourcesContent":["/**\n * controllable\n *\n * Small utilities for controlled vs uncontrolled components. These helpers are\n * intentionally minimal and do not manage state themselves; they help component\n * implementations make correct decisions about when to call `onChange` vs\n * update internal state.\n *\n * POLICY DECISIONS (LOCKED):\n *\n * 1. Controlled Detection\n * A value is \"controlled\" if it is not `undefined`.\n * This matches React conventions and is SSR-safe.\n *\n * 2. onChange Timing\n * - Controlled mode: onChange called immediately, no internal update\n * - Uncontrolled mode: internal state updated first, then onChange called\n * This ensures onChange sees the new value in both modes.\n *\n * 3. Value Equality\n * controllableState uses Object.is() to prevent unnecessary onChange calls.\n * This is intentional — strict equality, no deep comparison.\n */\n\nimport { state, type State } from '../../runtime
|
|
1
|
+
{"version":3,"file":"controllable.js","names":[],"sources":["../../../src/foundations/state/controllable.ts"],"sourcesContent":["/**\n * controllable\n *\n * Small utilities for controlled vs uncontrolled components. These helpers are\n * intentionally minimal and do not manage state themselves; they help component\n * implementations make correct decisions about when to call `onChange` vs\n * update internal state.\n *\n * POLICY DECISIONS (LOCKED):\n *\n * 1. Controlled Detection\n * A value is \"controlled\" if it is not `undefined`.\n * This matches React conventions and is SSR-safe.\n *\n * 2. onChange Timing\n * - Controlled mode: onChange called immediately, no internal update\n * - Uncontrolled mode: internal state updated first, then onChange called\n * This ensures onChange sees the new value in both modes.\n *\n * 3. Value Equality\n * controllableState uses Object.is() to prevent unnecessary onChange calls.\n * This is intentional — strict equality, no deep comparison.\n */\n\nimport { state, type State } from '../../runtime';\n\nexport function isControlled<T>(value: T | undefined): value is T {\n return value !== undefined;\n}\n\nexport function resolveControllable<T>(\n value: T | undefined,\n defaultValue: T\n): { value: T; isControlled: boolean } {\n const controlled = isControlled(value);\n return {\n value: controlled ? (value as T) : defaultValue,\n isControlled: controlled,\n };\n}\n\nexport function makeControllable<T>(options: {\n value: T | undefined;\n defaultValue: T;\n onChange?: (next: T) => void;\n setInternal?: (next: T) => void;\n}) {\n const { value, defaultValue, onChange, setInternal } = options;\n const { isControlled } = resolveControllable(value, defaultValue);\n\n function set(next: T) {\n if (isControlled) {\n onChange?.(next);\n } else {\n setInternal?.(next);\n onChange?.(next);\n }\n }\n\n return { set, isControlled };\n}\n\nexport type ControllableState<T> = State<T> & { isControlled: boolean };\n\n/**\n * controllableState\n *\n * Hook-like primitive that mirrors `state()` semantics while supporting\n * controlled/uncontrolled behavior.\n */\nexport function controllableState<T>(options: {\n value: T | undefined;\n defaultValue: T;\n onChange?: (next: T) => void;\n}): ControllableState<T> {\n const isControlled = options.value !== undefined;\n const internal = isControlled ? null : state<T>(options.defaultValue);\n\n function read(): T {\n if (isControlled) {\n return options.value as T;\n }\n\n return internal!();\n }\n\n read.set = (nextOrUpdater: T | ((prev: T) => T)) => {\n const prev = read();\n const next =\n typeof nextOrUpdater === 'function'\n ? (nextOrUpdater as (p: T) => T)(prev)\n : (nextOrUpdater as T);\n\n if (Object.is(prev, next)) return;\n\n if (isControlled) {\n options.onChange?.(next);\n return;\n }\n\n internal!.set(nextOrUpdater as never);\n options.onChange?.(next);\n };\n\n (read as ControllableState<T>).isControlled = isControlled;\n return read as ControllableState<T>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,aAAgB,OAAkC;CAChE,OAAO,UAAU;AACnB;AAEA,SAAgB,oBACd,OACA,cACqC;CACrC,MAAM,aAAa,aAAa,KAAK;CACrC,OAAO;EACL,OAAO,aAAc,QAAc;EACnC,cAAc;CAChB;AACF;AAEA,SAAgB,iBAAoB,SAKjC;CACD,MAAM,EAAE,OAAO,cAAc,UAAU,gBAAgB;CACvD,MAAM,EAAE,iBAAiB,oBAAoB,OAAO,YAAY;CAEhE,SAAS,IAAI,MAAS;EACpB,IAAI,cACF,WAAW,IAAI;OACV;GACL,cAAc,IAAI;GAClB,WAAW,IAAI;EACjB;CACF;CAEA,OAAO;EAAE;EAAK;CAAa;AAC7B;;;;;;;AAUA,SAAgB,kBAAqB,SAIZ;CACvB,MAAM,eAAe,QAAQ,UAAU;CACvC,MAAM,WAAW,eAAe,OAAO,MAAS,QAAQ,YAAY;CAEpE,SAAS,OAAU;EACjB,IAAI,cACF,OAAO,QAAQ;EAGjB,OAAO,SAAU;CACnB;CAEA,KAAK,OAAO,kBAAwC;EAClD,MAAM,OAAO,KAAK;EAClB,MAAM,OACJ,OAAO,kBAAkB,aACpB,cAA8B,IAAI,IAClC;EAEP,IAAI,OAAO,GAAG,MAAM,IAAI,GAAG;EAE3B,IAAI,cAAc;GAChB,QAAQ,WAAW,IAAI;GACvB;EACF;EAEA,SAAU,IAAI,aAAsB;EACpC,QAAQ,WAAW,IAAI;CACzB;CAEA,KAA+B,eAAe;CAC9C,OAAO;AACT"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSXElement } from "../../common/jsx.js";
|
|
2
|
+
import { DefaultPortal, Portal, PortalProps, definePortal } from "../../runtime/portal.js";
|
|
2
3
|
import { LayoutComponent, layout } from "./layout.js";
|
|
3
4
|
import { Slot, SlotProps } from "./slot.js";
|
|
4
5
|
import { Presence, PresenceProps } from "./presence.js";
|
|
5
|
-
import { DefaultPortal, Portal, PortalProps, definePortal } from "./portal.js";
|
|
6
6
|
import { Collection, CollectionItem, createCollection } from "./collection.js";
|
|
7
7
|
import { Layer, LayerManager, LayerOptions, createLayer } from "./layer.js";
|
|
8
8
|
export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, createCollection, createLayer, definePortal, layout };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DefaultPortal, Portal, definePortal } from "
|
|
1
|
+
import { DefaultPortal, Portal, definePortal } from "../../runtime/portal.js";
|
|
2
2
|
import { layout } from "./layout.js";
|
|
3
3
|
import { Slot } from "./slot.js";
|
|
4
4
|
import { Presence } from "./presence.js";
|
|
5
|
+
import "./portal.js";
|
|
5
6
|
import { createCollection } from "./collection.js";
|
|
6
7
|
import { createLayer } from "./layer.js";
|
|
7
8
|
export { DefaultPortal, Portal, Presence, Slot, createCollection, createLayer, definePortal, layout };
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/foundations/structures/portal.d.ts
|
|
5
|
-
interface Portal<T extends RenderableChild = RenderableChild> {
|
|
6
|
-
/** Mount point — rendered exactly once */
|
|
7
|
-
(): unknown;
|
|
8
|
-
/** Render content into the portal */
|
|
9
|
-
render(props: {
|
|
10
|
-
children?: T;
|
|
11
|
-
}): unknown;
|
|
12
|
-
}
|
|
13
|
-
interface PortalProps {
|
|
14
|
-
children?: RenderableChild;
|
|
15
|
-
}
|
|
16
|
-
declare function definePortal<T extends RenderableChild = RenderableChild>(): Portal<T>;
|
|
17
|
-
declare function _resetDefaultPortal(): void;
|
|
18
|
-
declare function disposeDefaultPortalScope(scope: object | null): void;
|
|
19
|
-
declare function clearDefaultPortalForInstance(instance: ComponentInstance): void;
|
|
20
|
-
declare const DefaultPortal: Portal<RenderableChild>;
|
|
21
|
-
declare function Portal(props: PortalProps): null;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { DefaultPortal, Portal, PortalProps, definePortal };
|
|
24
|
-
//# sourceMappingURL=portal.d.ts.map
|
|
1
|
+
import { DefaultPortal, Portal, PortalProps, definePortal } from "../../runtime/portal.js";
|
|
2
|
+
export { DefaultPortal, Portal, type PortalProps, definePortal };
|
|
@@ -1,187 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/foundations/structures/portal.tsx
|
|
5
|
-
/**
|
|
6
|
-
* Portal / Host primitive.
|
|
7
|
-
*
|
|
8
|
-
* Foundations remain runtime-agnostic: a portal is an explicit read/write slot.
|
|
9
|
-
* Scheduling and attachment are owned by the runtime when `createPortalSlot`
|
|
10
|
-
* exists; otherwise this falls back to a local slot (deterministic, but does
|
|
11
|
-
* not schedule updates).
|
|
12
|
-
*
|
|
13
|
-
* POLICY DECISIONS (LOCKED):
|
|
14
|
-
*
|
|
15
|
-
* 1. Local Mutable State
|
|
16
|
-
* Foundations may use local mutable state ONLY to model deterministic slots,
|
|
17
|
-
* never to coordinate timing, effects, or ordering. The fallback mode uses
|
|
18
|
-
* closure-local `mounted` and `value` variables which are non-escaping and
|
|
19
|
-
* deterministic.
|
|
20
|
-
*
|
|
21
|
-
* 2. Return Type Philosophy
|
|
22
|
-
* Portal call signatures return `unknown` (intentionally opaque). The runtime
|
|
23
|
-
* owns the concrete type. This prevents foundations from assuming JSX.Element
|
|
24
|
-
* or DOM node types, maintaining runtime-agnostic portability.
|
|
25
|
-
*/
|
|
26
|
-
function createPortalSlot() {
|
|
27
|
-
let currentValue;
|
|
28
|
-
const source = (() => {
|
|
29
|
-
recordReadableRead(source);
|
|
30
|
-
return currentValue;
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
read() {
|
|
34
|
-
return source();
|
|
35
|
-
},
|
|
36
|
-
write(value) {
|
|
37
|
-
if (Object.is(currentValue, value)) return;
|
|
38
|
-
currentValue = value;
|
|
39
|
-
markReadableDerivedSubscribersDirty(source);
|
|
40
|
-
markReactivePropsDirtySource(source);
|
|
41
|
-
notifyReadableReaders(source);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function definePortal() {
|
|
46
|
-
if (typeof createPortalSlot === "function") {
|
|
47
|
-
const slot = createPortalSlot();
|
|
48
|
-
function PortalHost() {
|
|
49
|
-
return slot.read();
|
|
50
|
-
}
|
|
51
|
-
PortalHost.render = function PortalRender(props) {
|
|
52
|
-
slot.write(props.children);
|
|
53
|
-
return null;
|
|
54
|
-
};
|
|
55
|
-
return PortalHost;
|
|
56
|
-
}
|
|
57
|
-
let mounted = false;
|
|
58
|
-
let value;
|
|
59
|
-
function PortalHostFallback() {
|
|
60
|
-
mounted = true;
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
PortalHostFallback.render = function PortalRenderFallback(props) {
|
|
64
|
-
if (!mounted) return null;
|
|
65
|
-
value = props.children;
|
|
66
|
-
return null;
|
|
67
|
-
};
|
|
68
|
-
return PortalHostFallback;
|
|
69
|
-
}
|
|
70
|
-
let _defaultPortalStates = /* @__PURE__ */ new Map();
|
|
71
|
-
let _hasPendingDefaultPortalValue = false;
|
|
72
|
-
let _pendingDefaultPortalValue = void 0;
|
|
73
|
-
function disposeDefaultPortalScope(scope) {
|
|
74
|
-
if (!scope) return;
|
|
75
|
-
const state = _defaultPortalStates.get(scope);
|
|
76
|
-
if (state) state.portal.render({ children: void 0 });
|
|
77
|
-
_defaultPortalStates.delete(scope);
|
|
78
|
-
}
|
|
79
|
-
function isComponentPortalScope(scope) {
|
|
80
|
-
return Array.isArray(scope.cleanupFns);
|
|
81
|
-
}
|
|
82
|
-
function isStaleDefaultPortalScope(scope) {
|
|
83
|
-
if (!isComponentPortalScope(scope)) return false;
|
|
84
|
-
if (scope.target && scope.target.isConnected === false) return true;
|
|
85
|
-
return scope.mounted === false;
|
|
86
|
-
}
|
|
87
|
-
function pruneStaleDefaultPortalScopes() {
|
|
88
|
-
if (_defaultPortalStates.size === 0) return;
|
|
89
|
-
for (const scope of Array.from(_defaultPortalStates.keys())) if (isStaleDefaultPortalScope(scope)) disposeDefaultPortalScope(scope);
|
|
90
|
-
}
|
|
91
|
-
function getSingleDefaultPortalScope() {
|
|
92
|
-
pruneStaleDefaultPortalScopes();
|
|
93
|
-
if (_defaultPortalStates.size !== 1) return null;
|
|
94
|
-
return _defaultPortalStates.keys().next().value ?? null;
|
|
95
|
-
}
|
|
96
|
-
function getDefaultPortalState(scope) {
|
|
97
|
-
let state = _defaultPortalStates.get(scope);
|
|
98
|
-
if (!state) {
|
|
99
|
-
state = {
|
|
100
|
-
portal: definePortal(),
|
|
101
|
-
owner: null,
|
|
102
|
-
cleanupOwners: /* @__PURE__ */ new WeakSet()
|
|
103
|
-
};
|
|
104
|
-
_defaultPortalStates.set(scope, state);
|
|
105
|
-
}
|
|
106
|
-
return state;
|
|
107
|
-
}
|
|
108
|
-
function resolveDefaultPortalScope(owner) {
|
|
109
|
-
return owner?.portalScope ?? getCurrentPortalScope() ?? getSingleDefaultPortalScope();
|
|
110
|
-
}
|
|
111
|
-
function writeDefaultPortal(props, owner) {
|
|
112
|
-
const scope = resolveDefaultPortalScope(owner);
|
|
113
|
-
if (!scope) {
|
|
114
|
-
if (_defaultPortalStates.size !== 0) return;
|
|
115
|
-
_hasPendingDefaultPortalValue = true;
|
|
116
|
-
_pendingDefaultPortalValue = props.children;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const state = getDefaultPortalState(scope);
|
|
120
|
-
_hasPendingDefaultPortalValue = false;
|
|
121
|
-
_pendingDefaultPortalValue = void 0;
|
|
122
|
-
state.portal.render(props);
|
|
123
|
-
state.owner = owner;
|
|
124
|
-
}
|
|
125
|
-
function applyPendingDefaultPortalValue(scope) {
|
|
126
|
-
if (!_hasPendingDefaultPortalValue) return;
|
|
127
|
-
const state = getDefaultPortalState(scope);
|
|
128
|
-
state.portal.render({ children: _pendingDefaultPortalValue });
|
|
129
|
-
state.owner = null;
|
|
130
|
-
_hasPendingDefaultPortalValue = false;
|
|
131
|
-
_pendingDefaultPortalValue = void 0;
|
|
132
|
-
}
|
|
133
|
-
function registerDefaultPortalOwner(owner) {
|
|
134
|
-
const scope = resolveDefaultPortalScope(owner);
|
|
135
|
-
if (!scope) return;
|
|
136
|
-
const state = getDefaultPortalState(scope);
|
|
137
|
-
if (state.cleanupOwners.has(owner)) return;
|
|
138
|
-
state.cleanupOwners.add(owner);
|
|
139
|
-
owner.cleanupFns.push(() => {
|
|
140
|
-
const currentState = _defaultPortalStates.get(scope);
|
|
141
|
-
if (!currentState) return;
|
|
142
|
-
if (currentState.owner === owner) {
|
|
143
|
-
currentState.portal.render({ children: void 0 });
|
|
144
|
-
currentState.owner = null;
|
|
145
|
-
}
|
|
146
|
-
currentState.cleanupOwners.delete(owner);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function clearDefaultPortalForInstance(instance) {
|
|
150
|
-
const scope = instance.portalScope;
|
|
151
|
-
if (!scope) return;
|
|
152
|
-
const state = _defaultPortalStates.get(scope);
|
|
153
|
-
if (!state) return;
|
|
154
|
-
_hasPendingDefaultPortalValue = false;
|
|
155
|
-
_pendingDefaultPortalValue = void 0;
|
|
156
|
-
state.portal.render({ children: void 0 });
|
|
157
|
-
state.owner = null;
|
|
158
|
-
}
|
|
159
|
-
const DefaultPortal = (() => {
|
|
160
|
-
function Host() {
|
|
161
|
-
const scope = resolveDefaultPortalScope(getCurrentComponentInstance());
|
|
162
|
-
if (!scope) return null;
|
|
163
|
-
applyPendingDefaultPortalValue(scope);
|
|
164
|
-
const v = getDefaultPortalState(scope).portal();
|
|
165
|
-
return v === void 0 ? null : v;
|
|
166
|
-
}
|
|
167
|
-
Host.render = function Render(props) {
|
|
168
|
-
writeDefaultPortal(props, getCurrentComponentInstance());
|
|
169
|
-
return null;
|
|
170
|
-
};
|
|
171
|
-
return Host;
|
|
172
|
-
})();
|
|
173
|
-
function Portal(props) {
|
|
174
|
-
const owner = getCurrentComponentInstance();
|
|
175
|
-
if (owner) registerDefaultPortalOwner(owner);
|
|
176
|
-
writeDefaultPortal(props, owner);
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* NOTE:
|
|
181
|
-
* createPortalSlot is a runtime primitive.
|
|
182
|
-
* It owns scheduling, consistency, and SSR behavior.
|
|
183
|
-
*/
|
|
184
|
-
//#endregion
|
|
185
|
-
export { DefaultPortal, Portal, clearDefaultPortalForInstance, definePortal, disposeDefaultPortalScope };
|
|
186
|
-
|
|
187
|
-
//# sourceMappingURL=portal.js.map
|
|
1
|
+
import { DefaultPortal, Portal, definePortal } from "../../runtime/portal.js";
|
|
2
|
+
import "../../runtime/index.js";
|
|
3
|
+
export { DefaultPortal, Portal, definePortal };
|
package/dist/fx/fx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logger } from "../
|
|
1
|
+
import { logger } from "../common/logger.js";
|
|
2
2
|
import { enqueueRuntimeTask } from "../runtime/access.js";
|
|
3
3
|
import { getCurrentComponentInstance } from "../runtime/component-scope.js";
|
|
4
|
-
import "../runtime/
|
|
4
|
+
import "../runtime/index.js";
|
|
5
5
|
import { noopEventListener, noopEventListenerWithFlush } from "./noop.js";
|
|
6
6
|
//#region src/fx/fx.ts
|
|
7
7
|
function throwIfDuringRender() {
|
package/dist/fx/fx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fx.js","names":[],"sources":["../../src/fx/fx.ts"],"sourcesContent":["import { enqueueRuntimeTask } from '../runtime/access';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport { logger } from '../dev/logger';\nimport { noopEventListener, noopEventListenerWithFlush } from './noop';\n\nexport type CancelFn = () => void;\n\n// Platform-specific timer handle types\ntype TimeoutHandle = ReturnType<typeof setTimeout> | null;\n// rAF may fall back to setTimeout in some environments/tests, include both\ntype RafHandle =\n | ReturnType<typeof requestAnimationFrame>\n | ReturnType<typeof setTimeout>\n | null;\n// requestIdleCallback may be unavailable; allow setTimeout fallback handle\ntype IdleHandle =\n | ReturnType<typeof requestIdleCallback>\n | ReturnType<typeof setTimeout>\n | null;\n\nfunction throwIfDuringRender(): void {\n const inst = getCurrentComponentInstance();\n if (inst !== null) {\n throw new Error(\n '[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.'\n );\n }\n}\n\n/**\n * Helper: schedule a user callback through the global scheduler\n */\nfunction enqueueUserCallback(fn: () => void) {\n enqueueRuntimeTask(() => {\n try {\n fn();\n } catch (err) {\n // Keep behavior consistent with other scheduler-queued work\n logger.error('[Askr] FX handler error:', err);\n }\n });\n}\n\n// ---------- Event handlers ----------\n\nexport function debounceEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void; flush(): void } {\n const { leading = false, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n // On SSR, event handlers are inert\n if (inst && inst.ssr) {\n return noopEventListenerWithFlush;\n }\n\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ev: Event) {\n // Disallow using returned handler during render\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n // Schedule through scheduler\n if (lastEvent) {\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n }\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n } as EventListener & { cancel(): void; flush(): void };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n debounced.flush = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n const ev = lastEvent;\n lastEvent = null;\n timeoutId = null;\n if (ev) enqueueUserCallback(() => handler.call(null, ev));\n }\n };\n\n // Auto-cleanup on component unmount\n if (inst) {\n (inst.cleanupFns ??= []).push(() => {\n debounced.cancel();\n });\n }\n\n return debounced;\n}\n\nexport function throttleEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void } {\n const { leading = true, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let lastCallTime = 0;\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n\n const throttled = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n } else if (!leading && lastCallTime === 0) {\n lastCallTime = now;\n }\n\n if (trailing && timeoutId === null) {\n const wait = ms - (now - lastCallTime);\n timeoutId = setTimeout(\n () => {\n if (lastEvent)\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n lastCallTime = Date.now();\n timeoutId = null;\n },\n Math.max(0, wait)\n );\n }\n } as EventListener & { cancel(): void };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n if (inst) {\n (inst.cleanupFns ??= []).push(() => throttled.cancel());\n }\n\n return throttled;\n}\n\nexport function rafEvent(\n handler: EventListener\n): EventListener & { cancel(): void } {\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let frameId: RafHandle = null;\n let lastEvent: Event | null = null;\n\n const scheduleFrame = () => {\n const rAF =\n typeof requestAnimationFrame !== 'undefined'\n ? requestAnimationFrame\n : (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 16);\n\n frameId = rAF(() => {\n frameId = null;\n if (lastEvent) {\n const ev = lastEvent;\n lastEvent = null;\n enqueueUserCallback(() => handler.call(null, ev));\n }\n });\n };\n\n const fn = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n lastEvent = ev;\n if (frameId === null) scheduleFrame();\n } as EventListener & { cancel(): void };\n\n fn.cancel = () => {\n if (frameId !== null) {\n // If frameId is numeric and cancelAnimationFrame is available, use it;\n // otherwise fall back to clearTimeout for the setTimeout fallback.\n if (\n typeof cancelAnimationFrame !== 'undefined' &&\n typeof frameId === 'number'\n ) {\n cancelAnimationFrame(frameId);\n } else {\n clearTimeout(frameId as ReturnType<typeof setTimeout>);\n }\n frameId = null;\n }\n lastEvent = null;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(() => fn.cancel());\n\n return fn;\n}\n\n// ---------- Scheduled work ----------\n\nexport function scheduleTimeout(ms: number, fn: () => void): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return () => {};\n }\n\n let id: TimeoutHandle = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, ms);\n\n const cancel = () => {\n if (id !== null) {\n clearTimeout(id);\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport function scheduleIdle(\n fn: () => void,\n options?: { timeout?: number }\n): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return () => {};\n\n let id: IdleHandle = null;\n let usingRIC = false;\n\n if (typeof requestIdleCallback !== 'undefined') {\n usingRIC = true;\n id = requestIdleCallback(() => {\n id = null;\n enqueueUserCallback(fn);\n }, options);\n } else {\n // Fallback: schedule on next macrotask\n id = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, 0);\n }\n\n const cancel = () => {\n if (id !== null) {\n // If using requestIdleCallback and available, call cancelIdleCallback for numeric ids.\n if (\n usingRIC &&\n typeof cancelIdleCallback !== 'undefined' &&\n typeof id === 'number'\n ) {\n cancelIdleCallback(id);\n } else {\n clearTimeout(id as ReturnType<typeof setTimeout>);\n }\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\nexport function scheduleRetry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): { cancel(): void } {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return { cancel: () => {} };\n\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let cancelled = false;\n\n const attempt = (index: number) => {\n if (cancelled) return;\n // Run user fn inside scheduler\n enqueueRuntimeTask(() => {\n if (cancelled) return;\n // Call fn (it may be async)\n const p = fn();\n p.then(\n () => {\n // Completed successfully\n },\n () => {\n if (cancelled) return;\n if (index + 1 < maxAttempts) {\n const delay = backoff(index);\n // Schedule next attempt via setTimeout so it gets enqueued through scheduleTimeout\n setTimeout(() => {\n attempt(index + 1);\n }, delay);\n }\n }\n ).catch((e) => {\n logger.error('[Askr] scheduleRetry error:', e);\n });\n });\n };\n\n // Start first attempt\n attempt(0);\n\n const cancel = () => {\n cancelled = true;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return { cancel };\n}\n"],"mappings":";;;;;;AAoBA,SAAS,sBAA4B;CAEnC,IADa,4BACT,MAAS,MACX,MAAM,IAAI,MACR,kGACF;AAEJ;;;;AAKA,SAAS,oBAAoB,IAAgB;CAC3C,yBAAyB;EACvB,IAAI;GACF,GAAG;EACL,SAAS,KAAK;GAEZ,OAAO,MAAM,4BAA4B,GAAG;EAC9C;CACF,CAAC;AACH;AAIA,SAAgB,cACd,IACA,SACA,SACmD;CACnD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,KACV,WAAW,MAAc,UAAU,KAAK,IAAI,GAAG,CAAC,MAC9C,WAAW,CAAC;CAEhB,IAAI,YAAY;CAEhB,MAAM,WAAW,UAAkB;EACjC,IAAI,WAAW;EAEf,yBAAyB;GACvB,IAAI,WAAW;GAGf,AADU,GACV,CAAA,CAAE,WACM,CAEN,SACM;IACJ,IAAI,WAAW;IACf,IAAI,QAAQ,IAAI,aAAa;KAC3B,MAAM,QAAQ,QAAQ,KAAK;KAE3B,iBAAiB;MACf,QAAQ,QAAQ,CAAC;KACnB,GAAG,KAAK;IACV;GACF,CACF,CAAC,CAAC,OAAO,MAAM;IACb,OAAO,MAAM,+BAA+B,CAAC;GAC/C,CAAC;EACH,CAAC;CACH;CAGA,QAAQ,CAAC;CAET,MAAM,eAAe;EACnB,YAAY;CACd;CAEA,IAAI,MAAM,CAAC,KAAK,eAAe,CAAC,EAAA,CAAG,KAAK,MAAM;CAC9C,OAAO,EAAE,OAAO;AAClB"}
|
|
1
|
+
{"version":3,"file":"fx.js","names":[],"sources":["../../src/fx/fx.ts"],"sourcesContent":["import { enqueueRuntimeTask } from '../runtime';\nimport { getCurrentComponentInstance } from '../runtime';\nimport { logger } from '../common/logger';\nimport { noopEventListener, noopEventListenerWithFlush } from './noop';\n\nexport type CancelFn = () => void;\n\n// Platform-specific timer handle types\ntype TimeoutHandle = ReturnType<typeof setTimeout> | null;\n// rAF may fall back to setTimeout in some environments/tests, include both\ntype RafHandle =\n | ReturnType<typeof requestAnimationFrame>\n | ReturnType<typeof setTimeout>\n | null;\n// requestIdleCallback may be unavailable; allow setTimeout fallback handle\ntype IdleHandle =\n | ReturnType<typeof requestIdleCallback>\n | ReturnType<typeof setTimeout>\n | null;\n\nfunction throwIfDuringRender(): void {\n const inst = getCurrentComponentInstance();\n if (inst !== null) {\n throw new Error(\n '[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.'\n );\n }\n}\n\n/**\n * Helper: schedule a user callback through the global scheduler\n */\nfunction enqueueUserCallback(fn: () => void) {\n enqueueRuntimeTask(() => {\n try {\n fn();\n } catch (err) {\n // Keep behavior consistent with other scheduler-queued work\n logger.error('[Askr] FX handler error:', err);\n }\n });\n}\n\n// ---------- Event handlers ----------\n\nexport function debounceEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void; flush(): void } {\n const { leading = false, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n // On SSR, event handlers are inert\n if (inst && inst.ssr) {\n return noopEventListenerWithFlush;\n }\n\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n let lastCallTime = 0;\n\n const debounced = function (this: unknown, ev: Event) {\n // Disallow using returned handler during render\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n }\n\n if (trailing) {\n timeoutId = setTimeout(() => {\n // Schedule through scheduler\n if (lastEvent) {\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n }\n timeoutId = null;\n lastCallTime = Date.now();\n }, ms);\n }\n } as EventListener & { cancel(): void; flush(): void };\n\n debounced.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n debounced.flush = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n const ev = lastEvent;\n lastEvent = null;\n timeoutId = null;\n if (ev) enqueueUserCallback(() => handler.call(null, ev));\n }\n };\n\n // Auto-cleanup on component unmount\n if (inst) {\n (inst.cleanupFns ??= []).push(() => {\n debounced.cancel();\n });\n }\n\n return debounced;\n}\n\nexport function throttleEvent(\n ms: number,\n handler: EventListener,\n options?: { leading?: boolean; trailing?: boolean }\n): EventListener & { cancel(): void } {\n const { leading = true, trailing = true } = options || {};\n\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let lastCallTime = 0;\n let timeoutId: TimeoutHandle = null;\n let lastEvent: Event | null = null;\n\n const throttled = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n\n const now = Date.now();\n lastEvent = ev;\n\n if (leading && now - lastCallTime >= ms) {\n enqueueUserCallback(() => handler.call(null, ev));\n lastCallTime = now;\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n } else if (!leading && lastCallTime === 0) {\n lastCallTime = now;\n }\n\n if (trailing && timeoutId === null) {\n const wait = ms - (now - lastCallTime);\n timeoutId = setTimeout(\n () => {\n if (lastEvent)\n enqueueUserCallback(() => handler.call(null, lastEvent!));\n lastCallTime = Date.now();\n timeoutId = null;\n },\n Math.max(0, wait)\n );\n }\n } as EventListener & { cancel(): void };\n\n throttled.cancel = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n lastEvent = null;\n };\n\n if (inst) {\n (inst.cleanupFns ??= []).push(() => throttled.cancel());\n }\n\n return throttled;\n}\n\nexport function rafEvent(\n handler: EventListener\n): EventListener & { cancel(): void } {\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return noopEventListener;\n }\n\n let frameId: RafHandle = null;\n let lastEvent: Event | null = null;\n\n const scheduleFrame = () => {\n const rAF =\n typeof requestAnimationFrame !== 'undefined'\n ? requestAnimationFrame\n : (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 16);\n\n frameId = rAF(() => {\n frameId = null;\n if (lastEvent) {\n const ev = lastEvent;\n lastEvent = null;\n enqueueUserCallback(() => handler.call(null, ev));\n }\n });\n };\n\n const fn = function (this: unknown, ev: Event) {\n throwIfDuringRender();\n lastEvent = ev;\n if (frameId === null) scheduleFrame();\n } as EventListener & { cancel(): void };\n\n fn.cancel = () => {\n if (frameId !== null) {\n // If frameId is numeric and cancelAnimationFrame is available, use it;\n // otherwise fall back to clearTimeout for the setTimeout fallback.\n if (\n typeof cancelAnimationFrame !== 'undefined' &&\n typeof frameId === 'number'\n ) {\n cancelAnimationFrame(frameId);\n } else {\n clearTimeout(frameId as ReturnType<typeof setTimeout>);\n }\n frameId = null;\n }\n lastEvent = null;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(() => fn.cancel());\n\n return fn;\n}\n\n// ---------- Scheduled work ----------\n\nexport function scheduleTimeout(ms: number, fn: () => void): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) {\n return () => {};\n }\n\n let id: TimeoutHandle = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, ms);\n\n const cancel = () => {\n if (id !== null) {\n clearTimeout(id);\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport function scheduleIdle(\n fn: () => void,\n options?: { timeout?: number }\n): CancelFn {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return () => {};\n\n let id: IdleHandle = null;\n let usingRIC = false;\n\n if (typeof requestIdleCallback !== 'undefined') {\n usingRIC = true;\n id = requestIdleCallback(() => {\n id = null;\n enqueueUserCallback(fn);\n }, options);\n } else {\n // Fallback: schedule on next macrotask\n id = setTimeout(() => {\n id = null;\n enqueueUserCallback(fn);\n }, 0);\n }\n\n const cancel = () => {\n if (id !== null) {\n // If using requestIdleCallback and available, call cancelIdleCallback for numeric ids.\n if (\n usingRIC &&\n typeof cancelIdleCallback !== 'undefined' &&\n typeof id === 'number'\n ) {\n cancelIdleCallback(id);\n } else {\n clearTimeout(id as ReturnType<typeof setTimeout>);\n }\n id = null;\n }\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return cancel;\n}\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoff?: (attemptIndex: number) => number;\n}\n\nexport function scheduleRetry<T>(\n fn: () => Promise<T>,\n options?: RetryOptions\n): { cancel(): void } {\n throwIfDuringRender();\n const inst = getCurrentComponentInstance();\n if (inst && inst.ssr) return { cancel: () => {} };\n\n const {\n maxAttempts = 3,\n delayMs = 100,\n backoff = (i: number) => delayMs * Math.pow(2, i),\n } = options || {};\n\n let cancelled = false;\n\n const attempt = (index: number) => {\n if (cancelled) return;\n // Run user fn inside scheduler\n enqueueRuntimeTask(() => {\n if (cancelled) return;\n // Call fn (it may be async)\n const p = fn();\n p.then(\n () => {\n // Completed successfully\n },\n () => {\n if (cancelled) return;\n if (index + 1 < maxAttempts) {\n const delay = backoff(index);\n // Schedule next attempt via setTimeout so it gets enqueued through scheduleTimeout\n setTimeout(() => {\n attempt(index + 1);\n }, delay);\n }\n }\n ).catch((e) => {\n logger.error('[Askr] scheduleRetry error:', e);\n });\n });\n };\n\n // Start first attempt\n attempt(0);\n\n const cancel = () => {\n cancelled = true;\n };\n\n if (inst) (inst.cleanupFns ??= []).push(cancel);\n return { cancel };\n}\n"],"mappings":";;;;;;AAoBA,SAAS,sBAA4B;CAEnC,IADa,4BACT,MAAS,MACX,MAAM,IAAI,MACR,kGACF;AAEJ;;;;AAKA,SAAS,oBAAoB,IAAgB;CAC3C,yBAAyB;EACvB,IAAI;GACF,GAAG;EACL,SAAS,KAAK;GAEZ,OAAO,MAAM,4BAA4B,GAAG;EAC9C;CACF,CAAC;AACH;AAIA,SAAgB,cACd,IACA,SACA,SACmD;CACnD,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,WAAW,CAAC;CAEzD,MAAM,OAAO,4BAA4B;CAEzC,IAAI,QAAQ,KAAK,KACf,OAAO;CAGT,IAAI,YAA2B;CAC/B,IAAI,YAA0B;CAC9B,IAAI,eAAe;CAEnB,MAAM,YAAY,SAAyB,IAAW;EAEpD,oBAAoB;EAEpB,MAAM,MAAM,KAAK,IAAI;EACrB,YAAY;EAEZ,IAAI,cAAc,MAAM;GACtB,aAAa,SAAS;GACtB,YAAY;EACd;EAEA,IAAI,WAAW,MAAM,gBAAgB,IAAI;GACvC,0BAA0B,QAAQ,KAAK,MAAM,EAAE,CAA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A+B,CAAC;GAC/C,CAAC;EACH,CAAC;CACH;CAGA,QAAQ,CAAC;CAET,MAAM,eAAe;EACnB,YAAY;CACd;CAEA,IAAI,MAAM,CAAC,KAAK,eAAe,CAAC,EAAA,CAAG,KAAK,MAAM;CAC9C,OAAO,EAAE,OAAO;AAClB"}
|
package/dist/fx/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { scheduleEventHandler } from "../runtime/scheduler.js";
|
|
2
|
+
import "../runtime/index.js";
|
|
2
3
|
import { debounce, defer, idle, once, raf, retry, throttle, timeout } from "./timing.js";
|
|
3
4
|
import { debounceEvent, rafEvent, scheduleIdle, scheduleRetry, scheduleTimeout, throttleEvent } from "./fx.js";
|
|
4
5
|
export { debounce, debounceEvent, defer, idle, once, raf, rafEvent, retry, scheduleEventHandler, scheduleIdle, scheduleRetry, scheduleTimeout, throttle, throttleEvent, timeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { Fragment } from "./common/jsx.js";
|
|
|
3
3
|
import { State, StateSetter, StateTuple, state } from "./runtime/state.js";
|
|
4
4
|
import { Context, defineContext, readContext } from "./runtime/context.js";
|
|
5
5
|
import { getSignal } from "./runtime/component-scope.js";
|
|
6
|
-
import { For, ForProps } from "./control/for.js";
|
|
7
|
-
import { Show, ShowProps } from "./control/show.js";
|
|
8
|
-
import { Case, CaseProps, Match, MatchProps } from "./control/case.js";
|
|
9
6
|
import { AskrRuntime, AskrRuntimeOptions, RuntimeKeyedReorderDecision, RuntimeRendererHost, createRuntime, getDefaultRuntime } from "./runtime/runtime.js";
|
|
10
7
|
import { Derived, derive } from "./runtime/derive.js";
|
|
11
8
|
import { Selector, selector } from "./runtime/selector.js";
|
|
9
|
+
import { For, ForProps } from "./control/for.js";
|
|
10
|
+
import { Show, ShowProps } from "./control/show.js";
|
|
11
|
+
import { Case, CaseProps, Match, MatchProps } from "./control/case.js";
|
|
12
12
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
13
13
|
export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, type Context, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Selector, Show, type ShowProps, type State, type StateSetter, type StateTuple, createRuntime, defineContext, derive, getDefaultRuntime, getSignal, jsx, jsxs, readContext, selector, state };
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { AskrRuntime, createRuntime, getDefaultRuntime } from "./runtime/runtime
|
|
|
2
2
|
import { Fragment } from "./common/jsx.js";
|
|
3
3
|
import { defineContext, readContext } from "./runtime/context.js";
|
|
4
4
|
import { getSignal } from "./runtime/component-scope.js";
|
|
5
|
-
import "./runtime/component.js";
|
|
6
|
-
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
7
|
-
import { installRendererBridge } from "./renderer/index.js";
|
|
8
|
-
import { state } from "./runtime/state.js";
|
|
9
5
|
import { derive } from "./runtime/derive.js";
|
|
6
|
+
import { state } from "./runtime/state.js";
|
|
10
7
|
import { selector } from "./runtime/selector.js";
|
|
8
|
+
import "./runtime/index.js";
|
|
9
|
+
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
10
|
+
import { installRendererBridge } from "./renderer/index.js";
|
|
11
11
|
import { For } from "./control/for.js";
|
|
12
12
|
import { Show } from "./control/show.js";
|
|
13
13
|
import { Case, Match } from "./control/case.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\nexport { createRuntime, getDefaultRuntime } from './runtime
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Askr: Actor-backed deterministic UI framework\n *\n * Public API surface — only users should import from here\n */\n\nimport { installRendererBridge } from './renderer';\n\ninstallRendererBridge();\n\nexport { createRuntime, getDefaultRuntime } from './runtime';\nexport type {\n AskrRuntimeOptions,\n RuntimeRendererHost,\n RuntimeKeyedReorderDecision,\n} from './runtime';\nexport { AskrRuntime } from './runtime';\n\n// Runtime primitives\nexport { derive, getSignal, selector, state } from './runtime';\nexport type {\n Derived,\n Selector,\n State,\n StateSetter,\n StateTuple,\n} from './runtime';\n\n// Control flow\nexport { Case, For, Match, Show } from './control';\nexport type { CaseProps, ForProps, MatchProps, ShowProps } from './control';\n\n// Context\nexport { defineContext, readContext } from './runtime';\nexport type { Context } from './runtime';\n\n// Re-export JSX runtime for tsconfig jsxImportSource\nexport { jsx, jsxs, Fragment } from './jsx-runtime';\n\n// Public types\nexport type { Props } from './common/props';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,sBAAsB"}
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Fragment, JSXElement } from "../common/jsx.js";
|
|
1
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "../common/jsx.js";
|
|
2
2
|
export type { JSXElement };
|
package/dist/jsx/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "../common/props.js";
|
|
2
|
-
import { Fragment, JSXElement } from "../common/jsx.js";
|
|
2
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "../common/jsx.js";
|
|
3
3
|
|
|
4
4
|
//#region src/jsx/types.d.ts
|
|
5
5
|
declare global {
|
|
@@ -19,5 +19,5 @@ declare global {
|
|
|
19
19
|
}
|
|
20
20
|
} //# sourceMappingURL=types.d.ts.map
|
|
21
21
|
//#endregion
|
|
22
|
-
export { Fragment, type JSXElement };
|
|
22
|
+
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType };
|
|
23
23
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
|
-
import { Fragment, JSXElement } from "./common/jsx.js";
|
|
2
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
4
|
//#region src/jsx/jsx-dev-runtime.d.ts
|
|
5
5
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
@@ -8,5 +8,5 @@ declare function jsxDEV<TTag extends string>(type: Exclude<TTag, keyof KnownIntr
|
|
|
8
8
|
declare function jsxDEV<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
9
9
|
declare function jsxDEV(type: symbol, props: Props | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { Fragment, type JSXElement, jsxDEV };
|
|
11
|
+
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsxDEV };
|
|
12
12
|
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"mappings":";;;;iBA2CgB,MAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA,oBACA,gBAAA;AAAA,iBAEc,MAAA,oBAA0B,0BAAA,EACxC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAAA,CAA2B,IAAA,UAClC,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,sBACd,IAAA,EAAM,OAAA,CAAQ,IAAA,QAAY,0BAAA,GAC1B,KAAA,EAAO,sBAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,wBACd,IAAA,GAAO,KAAA,EAAO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAU"}
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isEagerControlPrimitive } from "./common/control.js";
|
|
2
2
|
import { ELEMENT_TYPE, Fragment, STATIC_CHILDREN } from "./common/jsx.js";
|
|
3
3
|
import { markReadableUsage } from "./runtime/readable.js";
|
|
4
|
+
import "./runtime/index.js";
|
|
4
5
|
import "./jsx/types.js";
|
|
5
6
|
//#region src/jsx/jsx-dev-runtime.ts
|
|
6
7
|
function annotatePropsUsage(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElementType,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Re-export Fragment for JSX\nexport { Fragment };\nexport type { JSXComponent, JSXElement, JSXElementType } from './types';\n"],"mappings":";;;;;;AAsBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,CAAC;CAEnC,KAAK,MAAM,SAAS,OAAO,OAAO,eAAe,GAC/C,kBAAkB,KAAK;CAGzB,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,QAAQ,GAC9B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;CAChB,CAAC;CAGH,OAAO;AACT;AAgCA,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,gBAAgB,mBAClB,mBAAmB,eAAe,IAClC;CAEJ,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,aAAa;CAG3B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
|
-
import { Fragment, JSXElement } from "./common/jsx.js";
|
|
2
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
4
|
//#region src/jsx/jsx-runtime.d.ts
|
|
5
5
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
@@ -18,5 +18,5 @@ declare function jsxs<TTag extends string>(type: Exclude<TTag, keyof KnownIntrin
|
|
|
18
18
|
declare function jsxs<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement;
|
|
19
19
|
declare function jsxs(type: symbol, props: Props | null, key?: string | number): JSXElement;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { Fragment, type JSXElement, jsx, jsxDEV, jsxs };
|
|
21
|
+
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
|
|
22
22
|
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"mappings":";;;;iBA4CgB,MAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA,oBACA,gBAAA;AAAA,iBAEc,MAAA,oBAA0B,0BAAA,EACxC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAAA,CAA2B,IAAA,UAClC,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,sBACd,IAAA,EAAM,OAAA,CAAQ,IAAA,QAAY,0BAAA,GAC1B,KAAA,EAAO,sBAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,wBACd,IAAA,GAAO,KAAA,EAAO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAU;AAAA,iBAyBG,GAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA;AAAA,iBAEc,GAAA,oBAAuB,0BAAA,EACrC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAAA,CAA2B,IAAA,UAClC,GAAA,qBACC,UAAA;AAAA,iBACa,GAAA,sBACd,IAAA,EAAM,OAAA,CAAQ,IAAA,QAAY,0BAAA,GAC1B,KAAA,EAAO,sBAAA,SACP,GAAA,qBACC,UAAA;AAAA,iBACa,GAAA,wBACd,IAAA,GAAO,KAAA,EAAO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,qBACC,UAAA;AAAA,iBACa,GAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,qBACC,UAAU;AAAA,iBASG,IAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA;AAAA,iBAEc,IAAA,oBAAwB,0BAAA,EACtC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAAA,CAA2B,IAAA,UAClC,GAAA,qBACC,UAAA;AAAA,iBACa,IAAA,sBACd,IAAA,EAAM,OAAA,CAAQ,IAAA,QAAY,0BAAA,GAC1B,KAAA,EAAO,sBAAA,SACP,GAAA,qBACC,UAAA;AAAA,iBACa,IAAA,wBACd,IAAA,GAAO,KAAA,EAAO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,qBACC,UAAA;AAAA,iBACa,IAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,qBACC,UAAU"}
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isEagerControlPrimitive } from "./common/control.js";
|
|
2
2
|
import { ELEMENT_TYPE, Fragment, STATIC_CHILDREN } from "./common/jsx.js";
|
|
3
3
|
import { markReadableUsage } from "./runtime/readable.js";
|
|
4
|
+
import "./runtime/index.js";
|
|
4
5
|
import "./jsx/types.js";
|
|
5
6
|
//#region src/jsx/jsx-runtime.ts
|
|
6
7
|
function annotatePropsUsage(props) {
|
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElementType,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Production-style helpers: alias to the DEV factory for now\nexport function jsx(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number\n): unknown;\nexport function jsx<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number\n): JSXElement;\nexport function jsx<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number\n): JSXElement;\nexport function jsx<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: symbol,\n props: Props | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n return jsxDEV(type as never, props, key);\n}\n\nexport function jsxs(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number\n): unknown;\nexport function jsxs<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number\n): JSXElement;\nexport function jsxs<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number\n): JSXElement;\nexport function jsxs<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: symbol,\n props: Props | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n const normalizedProps = markStaticChildren(annotatePropsUsage(props));\n\n if (isEagerControlPrimitive(type)) {\n return type(normalizedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: normalizedProps,\n key: key ?? null,\n } as JSXElement;\n}\n\n// Re-export Fragment for JSX.\nexport { Fragment };\nexport type { JSXComponent, JSXElement, JSXElementType } from './types';\n"],"mappings":";;;;;;AAuBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,CAAC;CAEnC,KAAK,MAAM,SAAS,OAAO,OAAO,eAAe,GAC/C,kBAAkB,KAAK;CAGzB,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,QAAQ,GAC9B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;CAChB,CAAC;CAGH,OAAO;AACT;AAgCA,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,gBAAgB,mBAClB,mBAAmB,eAAe,IAClC;CAEJ,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,aAAa;CAG3B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF;AA4BA,SAAgB,IACd,MACA,OACA,KACA;CACA,OAAO,OAAO,MAAe,OAAO,GAAG;AACzC;AA2BA,SAAgB,KACd,MACA,OACA,KACA;CACA,MAAM,kBAAkB,mBAAmB,mBAAmB,KAAK,CAAC;CAEpE,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,eAAe;CAG7B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF"}
|
package/dist/jsx-runtime2.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { incrementPerfMetric } from "../runtime/perf-metrics.js";
|
|
2
|
+
import "../runtime/index.js";
|
|
2
3
|
import { extractKey, getRenderedAttributeName, isSkippedProp, parseEventName, readElementClassName, removeRenderedAttribute, setRenderedAttribute, tagNamesEqualIgnoreCase, writeElementClassName } from "./utils.js";
|
|
3
4
|
function applyFormControlProp(el, key, value, tagName) {
|
|
4
5
|
if (key === "value") {
|