@fictjs/runtime 0.0.15 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/advanced.cjs +8 -8
  2. package/dist/advanced.d.cts +3 -3
  3. package/dist/advanced.d.ts +3 -3
  4. package/dist/advanced.js +3 -3
  5. package/dist/{chunk-GJTYOFMO.cjs → chunk-527QSKFM.cjs} +16 -16
  6. package/dist/{chunk-GJTYOFMO.cjs.map → chunk-527QSKFM.cjs.map} +1 -1
  7. package/dist/{chunk-RY4WDS6R.js → chunk-5KXEEQUO.js} +115 -20
  8. package/dist/chunk-5KXEEQUO.js.map +1 -0
  9. package/dist/{chunk-624QY53A.cjs → chunk-BSUMPMKX.cjs} +7 -7
  10. package/dist/chunk-BSUMPMKX.cjs.map +1 -0
  11. package/dist/{chunk-IUZXKAAY.js → chunk-FG3M7EBL.js} +2 -2
  12. package/dist/{chunk-PMF6MWEV.cjs → chunk-J74L7UYP.cjs} +128 -33
  13. package/dist/chunk-J74L7UYP.cjs.map +1 -0
  14. package/dist/{chunk-F3AIYQB7.js → chunk-QV5GOCR5.js} +3 -3
  15. package/dist/chunk-QV5GOCR5.js.map +1 -0
  16. package/dist/{context-B7UYnfzM.d.ts → context-4woHo7-L.d.ts} +1 -1
  17. package/dist/{context-UXySaqI_.d.cts → context-9gFXOdJl.d.cts} +1 -1
  18. package/dist/{effect-Auji1rz9.d.cts → effect-ClARNUCc.d.cts} +23 -2
  19. package/dist/{effect-Auji1rz9.d.ts → effect-ClARNUCc.d.ts} +23 -2
  20. package/dist/index.cjs +51 -54
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +4 -4
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.dev.js +96 -28
  25. package/dist/index.dev.js.map +1 -1
  26. package/dist/index.js +10 -13
  27. package/dist/index.js.map +1 -1
  28. package/dist/internal.cjs +44 -35
  29. package/dist/internal.cjs.map +1 -1
  30. package/dist/internal.d.cts +9 -4
  31. package/dist/internal.d.ts +9 -4
  32. package/dist/internal.js +12 -3
  33. package/dist/internal.js.map +1 -1
  34. package/dist/jsx-runtime.d.cts +671 -0
  35. package/dist/jsx-runtime.d.ts +671 -0
  36. package/dist/{props-ES0Ag_Wd.d.ts → props-CBwuh35e.d.cts} +13 -6
  37. package/dist/{props-CrOMYbLv.d.cts → props-DAyeRPwH.d.ts} +13 -6
  38. package/dist/{scope-S6eAzBJZ.d.ts → scope-DvgMquEy.d.ts} +1 -1
  39. package/dist/{scope-DKYzWfTn.d.cts → scope-xmdo6lVU.d.cts} +1 -1
  40. package/package.json +1 -1
  41. package/src/binding.ts +62 -8
  42. package/src/constants.ts +2 -3
  43. package/src/dev-entry.ts +22 -0
  44. package/src/effect.ts +9 -2
  45. package/src/lifecycle.ts +24 -6
  46. package/src/list-helpers.ts +14 -3
  47. package/src/props.ts +29 -3
  48. package/src/scope.ts +1 -1
  49. package/src/signal.ts +43 -4
  50. package/src/suspense.ts +17 -13
  51. package/dist/chunk-624QY53A.cjs.map +0 -1
  52. package/dist/chunk-F3AIYQB7.js.map +0 -1
  53. package/dist/chunk-PMF6MWEV.cjs.map +0 -1
  54. package/dist/chunk-RY4WDS6R.js.map +0 -1
  55. /package/dist/{chunk-IUZXKAAY.js.map → chunk-FG3M7EBL.js.map} +0 -0
package/dist/advanced.cjs CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkGJTYOFMOcjs = require('./chunk-GJTYOFMO.cjs');
5
+ var _chunk527QSKFMcjs = require('./chunk-527QSKFM.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunk624QY53Acjs = require('./chunk-624QY53A.cjs');
9
+ var _chunkBSUMPMKXcjs = require('./chunk-BSUMPMKX.cjs');
10
10
 
11
11
 
12
12
 
@@ -23,13 +23,13 @@ var _chunk624QY53Acjs = require('./chunk-624QY53A.cjs');
23
23
 
24
24
 
25
25
 
26
- var _chunkPMF6MWEVcjs = require('./chunk-PMF6MWEV.cjs');
26
+ var _chunkJ74L7UYPcjs = require('./chunk-J74L7UYP.cjs');
27
27
 
28
28
  // src/versioned-signal.ts
29
29
  function createVersionedSignal(initialValue, options) {
30
30
  const equals = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.equals]), () => ( Object.is));
31
- const value = _chunkPMF6MWEVcjs.signal.call(void 0, initialValue);
32
- const version = _chunkPMF6MWEVcjs.signal.call(void 0, 0);
31
+ const value = _chunkJ74L7UYPcjs.signal.call(void 0, initialValue);
32
+ const version = _chunkJ74L7UYPcjs.signal.call(void 0, 0);
33
33
  const bumpVersion = () => {
34
34
  const next = version() + 1;
35
35
  version(next);
@@ -50,8 +50,8 @@ function createVersionedSignal(initialValue, options) {
50
50
  force: () => {
51
51
  bumpVersion();
52
52
  },
53
- peekVersion: () => _chunkPMF6MWEVcjs.untrack.call(void 0, () => version()),
54
- peekValue: () => _chunkPMF6MWEVcjs.untrack.call(void 0, () => value())
53
+ peekVersion: () => _chunkJ74L7UYPcjs.untrack.call(void 0, () => version()),
54
+ peekValue: () => _chunkJ74L7UYPcjs.untrack.call(void 0, () => value())
55
55
  };
56
56
  }
57
57
 
@@ -75,5 +75,5 @@ function createVersionedSignal(initialValue, options) {
75
75
 
76
76
 
77
77
 
78
- exports.createAttributeBinding = _chunkPMF6MWEVcjs.createAttributeBinding; exports.createChildBinding = _chunkPMF6MWEVcjs.createChildBinding; exports.createClassBinding = _chunkPMF6MWEVcjs.createClassBinding; exports.createContext = _chunkGJTYOFMOcjs.createContext; exports.createRenderEffect = _chunkPMF6MWEVcjs.createRenderEffect; exports.createScope = _chunk624QY53Acjs.createScope; exports.createSelector = _chunkPMF6MWEVcjs.createSelector; exports.createShow = _chunkPMF6MWEVcjs.createShow; exports.createSignal = _chunkPMF6MWEVcjs.signal; exports.createStyleBinding = _chunkPMF6MWEVcjs.createStyleBinding; exports.createTextBinding = _chunkPMF6MWEVcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunkPMF6MWEVcjs.effectScope; exports.getDevtoolsHook = _chunkPMF6MWEVcjs.getDevtoolsHook; exports.hasContext = _chunkGJTYOFMOcjs.hasContext; exports.isReactive = _chunkPMF6MWEVcjs.isReactive; exports.runInScope = _chunk624QY53Acjs.runInScope; exports.setCycleProtectionOptions = _chunkPMF6MWEVcjs.setCycleProtectionOptions; exports.unwrap = _chunkPMF6MWEVcjs.unwrap; exports.useContext = _chunkGJTYOFMOcjs.useContext;
78
+ exports.createAttributeBinding = _chunkJ74L7UYPcjs.createAttributeBinding; exports.createChildBinding = _chunkJ74L7UYPcjs.createChildBinding; exports.createClassBinding = _chunkJ74L7UYPcjs.createClassBinding; exports.createContext = _chunk527QSKFMcjs.createContext; exports.createRenderEffect = _chunkJ74L7UYPcjs.createRenderEffect; exports.createScope = _chunkBSUMPMKXcjs.createScope; exports.createSelector = _chunkJ74L7UYPcjs.createSelector; exports.createShow = _chunkJ74L7UYPcjs.createShow; exports.createSignal = _chunkJ74L7UYPcjs.signal; exports.createStyleBinding = _chunkJ74L7UYPcjs.createStyleBinding; exports.createTextBinding = _chunkJ74L7UYPcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunkJ74L7UYPcjs.effectScope; exports.getDevtoolsHook = _chunkJ74L7UYPcjs.getDevtoolsHook; exports.hasContext = _chunk527QSKFMcjs.hasContext; exports.isReactive = _chunkJ74L7UYPcjs.isReactive; exports.runInScope = _chunkBSUMPMKXcjs.runInScope; exports.setCycleProtectionOptions = _chunkJ74L7UYPcjs.setCycleProtectionOptions; exports.unwrap = _chunkJ74L7UYPcjs.unwrap; exports.useContext = _chunk527QSKFMcjs.useContext;
79
79
  //# sourceMappingURL=advanced.cjs.map
@@ -1,6 +1,6 @@
1
- export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-DKYzWfTn.cjs';
2
- export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-Auji1rz9.cjs';
3
- export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-UXySaqI_.cjs';
1
+ export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-xmdo6lVU.cjs';
2
+ export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-ClARNUCc.cjs';
3
+ export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-9gFXOdJl.cjs';
4
4
 
5
5
  interface VersionedSignalOptions<T> {
6
6
  equals?: (prev: T, next: T) => boolean;
@@ -1,6 +1,6 @@
1
- export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-S6eAzBJZ.js';
2
- export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-Auji1rz9.js';
3
- export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-B7UYnfzM.js';
1
+ export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-DvgMquEy.js';
2
+ export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-ClARNUCc.js';
3
+ export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-4woHo7-L.js';
4
4
 
5
5
  interface VersionedSignalOptions<T> {
6
6
  equals?: (prev: T, next: T) => boolean;
package/dist/advanced.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  createContext,
3
3
  hasContext,
4
4
  useContext
5
- } from "./chunk-IUZXKAAY.js";
5
+ } from "./chunk-FG3M7EBL.js";
6
6
  import {
7
7
  createScope,
8
8
  runInScope
9
- } from "./chunk-F3AIYQB7.js";
9
+ } from "./chunk-QV5GOCR5.js";
10
10
  import {
11
11
  createAttributeBinding,
12
12
  createChildBinding,
@@ -23,7 +23,7 @@ import {
23
23
  signal,
24
24
  untrack,
25
25
  unwrap
26
- } from "./chunk-RY4WDS6R.js";
26
+ } from "./chunk-5KXEEQUO.js";
27
27
 
28
28
  // src/versioned-signal.ts
29
29
  function createVersionedSignal(initialValue, options) {
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkPMF6MWEVcjs = require('./chunk-PMF6MWEV.cjs');
13
+ var _chunkJ74L7UYPcjs = require('./chunk-J74L7UYP.cjs');
14
14
 
15
15
  // src/context.ts
16
16
  var contextStorage = /* @__PURE__ */ new WeakMap();
@@ -30,8 +30,8 @@ function createContext(defaultValue) {
30
30
  Provider: null
31
31
  };
32
32
  context.Provider = function Provider(props) {
33
- const hostRoot = _chunkPMF6MWEVcjs.getCurrentRoot.call(void 0, );
34
- const providerRoot = _chunkPMF6MWEVcjs.createRootContext.call(void 0, hostRoot);
33
+ const hostRoot = _chunkJ74L7UYPcjs.getCurrentRoot.call(void 0, );
34
+ const providerRoot = _chunkJ74L7UYPcjs.createRootContext.call(void 0, hostRoot);
35
35
  const contextMap = getContextMap(providerRoot);
36
36
  contextMap.set(id, props.value);
37
37
  const fragment = document.createDocumentFragment();
@@ -45,32 +45,32 @@ function createContext(defaultValue) {
45
45
  cleanup = void 0;
46
46
  }
47
47
  if (activeNodes.length) {
48
- _chunkPMF6MWEVcjs.removeNodes.call(void 0, activeNodes);
48
+ _chunkJ74L7UYPcjs.removeNodes.call(void 0, activeNodes);
49
49
  activeNodes = [];
50
50
  }
51
51
  if (children == null || children === false) {
52
52
  return;
53
53
  }
54
- const prev = _chunkPMF6MWEVcjs.pushRoot.call(void 0, providerRoot);
54
+ const prev = _chunkJ74L7UYPcjs.pushRoot.call(void 0, providerRoot);
55
55
  let nodes = [];
56
56
  try {
57
- const output = _chunkPMF6MWEVcjs.createElement.call(void 0, children);
58
- nodes = _chunkPMF6MWEVcjs.toNodeArray.call(void 0, output);
57
+ const output = _chunkJ74L7UYPcjs.createElement.call(void 0, children);
58
+ nodes = _chunkJ74L7UYPcjs.toNodeArray.call(void 0, output);
59
59
  const parentNode = marker.parentNode;
60
60
  if (parentNode) {
61
- _chunkPMF6MWEVcjs.insertNodesBefore.call(void 0, parentNode, nodes, marker);
61
+ _chunkJ74L7UYPcjs.insertNodesBefore.call(void 0, parentNode, nodes, marker);
62
62
  }
63
63
  } finally {
64
- _chunkPMF6MWEVcjs.popRoot.call(void 0, prev);
65
- _chunkPMF6MWEVcjs.flushOnMount.call(void 0, providerRoot);
64
+ _chunkJ74L7UYPcjs.popRoot.call(void 0, prev);
65
+ _chunkJ74L7UYPcjs.flushOnMount.call(void 0, providerRoot);
66
66
  }
67
67
  cleanup = () => {
68
- _chunkPMF6MWEVcjs.destroyRoot.call(void 0, providerRoot);
69
- _chunkPMF6MWEVcjs.removeNodes.call(void 0, nodes);
68
+ _chunkJ74L7UYPcjs.destroyRoot.call(void 0, providerRoot);
69
+ _chunkJ74L7UYPcjs.removeNodes.call(void 0, nodes);
70
70
  };
71
71
  activeNodes = nodes;
72
72
  };
73
- _chunkPMF6MWEVcjs.createRenderEffect.call(void 0, () => {
73
+ _chunkJ74L7UYPcjs.createRenderEffect.call(void 0, () => {
74
74
  contextMap.set(id, props.value);
75
75
  renderChildren(props.children);
76
76
  });
@@ -79,7 +79,7 @@ function createContext(defaultValue) {
79
79
  return context;
80
80
  }
81
81
  function useContext(context) {
82
- let root = _chunkPMF6MWEVcjs.getCurrentRoot.call(void 0, );
82
+ let root = _chunkJ74L7UYPcjs.getCurrentRoot.call(void 0, );
83
83
  while (root) {
84
84
  const contextMap = contextStorage.get(root);
85
85
  if (contextMap && contextMap.has(context.id)) {
@@ -90,7 +90,7 @@ function useContext(context) {
90
90
  return context.defaultValue;
91
91
  }
92
92
  function hasContext(context) {
93
- let root = _chunkPMF6MWEVcjs.getCurrentRoot.call(void 0, );
93
+ let root = _chunkJ74L7UYPcjs.getCurrentRoot.call(void 0, );
94
94
  while (root) {
95
95
  const contextMap = contextStorage.get(root);
96
96
  if (contextMap && contextMap.has(context.id)) {
@@ -106,4 +106,4 @@ function hasContext(context) {
106
106
 
107
107
 
108
108
  exports.createContext = createContext; exports.useContext = useContext; exports.hasContext = hasContext;
109
- //# sourceMappingURL=chunk-GJTYOFMO.cjs.map
109
+ //# sourceMappingURL=chunk-527QSKFM.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-GJTYOFMO.cjs","../src/context.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACsFA,IAAM,eAAA,kBAAiB,IAAI,OAAA,CAA2C,CAAA;AAKtE,SAAS,aAAA,CAAc,IAAA,EAAyC;AAC9D,EAAA,IAAI,IAAA,EAAM,cAAA,CAAe,GAAA,CAAI,IAAI,CAAA;AACjC,EAAA,GAAA,CAAI,CAAC,GAAA,EAAK;AACR,IAAA,IAAA,kBAAM,IAAI,GAAA,CAAI,CAAA;AACd,IAAA,cAAA,CAAe,GAAA,CAAI,IAAA,EAAM,GAAG,CAAA;AAAA,EAC9B;AACA,EAAA,OAAO,GAAA;AACT;AA0CO,SAAS,aAAA,CAAiB,YAAA,EAA6B;AAC5D,EAAA,MAAM,GAAA,EAAK,MAAA,CAAO,cAAc,CAAA;AAEhC,EAAA,MAAM,QAAA,EAAsB;AAAA,IAC1B,EAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA,EAAU;AAAA,EACZ,CAAA;AAGA,EAAA,OAAA,CAAQ,SAAA,EAAW,SAAS,QAAA,CAAS,KAAA,EAAmC;AACtE,IAAA,MAAM,SAAA,EAAW,8CAAA,CAAe;AA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O,IAAA;AAAA,IACT;AACA,IAAA,KAAA,EAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAEA,EAAA,OAAO,KAAA;AACT;ADrMA;AACA;AACE;AACA;AACA;AACF,wGAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-GJTYOFMO.cjs","sourcesContent":[null,"/**\n * @fileoverview Context API for Fict\n *\n * Provides a way to pass data through the component tree without having to pass\n * props down manually at every level. Context is designed for:\n *\n * - SSR isolation (different request = different context values)\n * - Multi-instance support (multiple app roots with different values)\n * - Subtree scoping (override values in specific parts of the tree)\n *\n * ## Design Principles\n *\n * 1. **Reuses existing RootContext hierarchy** - Uses parent chain for value lookup,\n * consistent with handleError/handleSuspend mechanisms.\n *\n * 2. **Zero extra root creation overhead** - Provider doesn't create new root,\n * only mounts value on current root.\n *\n * 3. **Auto-aligned with insert/suspense boundaries** - Because they create child\n * roots that inherit parent, context values propagate correctly.\n *\n * ## Usage\n *\n * ```tsx\n * // Create context with default value\n * const ThemeContext = createContext<'light' | 'dark'>('light')\n *\n * // Provide value to subtree\n * function App() {\n * return (\n * <ThemeContext.Provider value=\"dark\">\n * <ThemedComponent />\n * </ThemeContext.Provider>\n * )\n * }\n *\n * // Consume value\n * function ThemedComponent() {\n * const theme = useContext(ThemeContext)\n * return <div class={theme}>...</div>\n * }\n * ```\n *\n * @module\n */\n\nimport { createElement } from './dom'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n popRoot,\n pushRoot,\n type RootContext,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport { createRenderEffect } from './effect'\nimport type { BaseProps, FictNode } from './types'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Context object created by createContext.\n * Contains the Provider component and serves as a key for context lookup.\n */\nexport interface Context<T> {\n /** Unique identifier for this context */\n readonly id: symbol\n /** Default value when no provider is found */\n readonly defaultValue: T\n /** Provider component for supplying context values */\n Provider: ContextProvider<T>\n /** Display name for debugging */\n displayName?: string\n}\n\n/**\n * Props for the Context Provider component\n */\nexport interface ProviderProps<T> extends BaseProps {\n /** The value to provide to the subtree */\n value: T\n}\n\n/**\n * Provider component type\n */\nexport type ContextProvider<T> = (props: ProviderProps<T>) => FictNode\n\n// ============================================================================\n// Internal Context Storage\n// ============================================================================\n\n/**\n * WeakMap to store context values per RootContext.\n * Using WeakMap ensures proper garbage collection when roots are destroyed.\n */\nconst contextStorage = new WeakMap<RootContext, Map<symbol, unknown>>()\n\n/**\n * Get the context map for a root, creating it if needed\n */\nfunction getContextMap(root: RootContext): Map<symbol, unknown> {\n let map = contextStorage.get(root)\n if (!map) {\n map = new Map()\n contextStorage.set(root, map)\n }\n return map\n}\n\n// ============================================================================\n// Context API\n// ============================================================================\n\n/**\n * Creates a new context with the given default value.\n *\n * Context provides a way to pass values through the component tree without\n * explicit props drilling. It's especially useful for:\n *\n * - Theme data\n * - Locale/i18n settings\n * - Authentication state\n * - Feature flags\n * - Any data that many components at different nesting levels need\n *\n * @param defaultValue - The value to use when no Provider is found above in the tree\n * @returns A context object with a Provider component\n *\n * @example\n * ```tsx\n * // Create a theme context\n * const ThemeContext = createContext<'light' | 'dark'>('light')\n *\n * // Use the provider\n * function App() {\n * return (\n * <ThemeContext.Provider value=\"dark\">\n * <Content />\n * </ThemeContext.Provider>\n * )\n * }\n *\n * // Consume the context\n * function Content() {\n * const theme = useContext(ThemeContext)\n * return <div class={`theme-${theme}`}>Hello</div>\n * }\n * ```\n */\nexport function createContext<T>(defaultValue: T): Context<T> {\n const id = Symbol('fict.context')\n\n const context: Context<T> = {\n id,\n defaultValue,\n Provider: null as unknown as ContextProvider<T>,\n }\n\n // Create the Provider component\n context.Provider = function Provider(props: ProviderProps<T>): FictNode {\n const hostRoot = getCurrentRoot()\n\n // Create a child root for the provider's subtree\n // This establishes the provider boundary - children will look up from here\n const providerRoot = createRootContext(hostRoot)\n\n // Store the context value on this root\n const contextMap = getContextMap(providerRoot)\n contextMap.set(id, props.value)\n\n // Create DOM structure\n const fragment = document.createDocumentFragment()\n const marker = document.createComment('fict:ctx')\n fragment.appendChild(marker)\n\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n\n const renderChildren = (children: FictNode) => {\n // Cleanup previous render\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (children == null || children === false) {\n return\n }\n\n const prev = pushRoot(providerRoot)\n let nodes: Node[] = []\n try {\n const output = createElement(children)\n nodes = toNodeArray(output)\n const parentNode = marker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, marker)\n }\n } finally {\n popRoot(prev)\n flushOnMount(providerRoot)\n }\n\n cleanup = () => {\n destroyRoot(providerRoot)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n // Initial render\n createRenderEffect(() => {\n // Update context value on re-render (if value prop changes reactively)\n contextMap.set(id, props.value)\n renderChildren(props.children)\n })\n\n return fragment\n }\n\n return context\n}\n\n/**\n * Reads the current value of a context.\n *\n * useContext looks up through the RootContext parent chain to find the\n * nearest Provider for this context. If no Provider is found, returns\n * the context's default value.\n *\n * @param context - The context object created by createContext\n * @returns The current context value\n *\n * @example\n * ```tsx\n * const ThemeContext = createContext('light')\n *\n * function ThemedButton() {\n * const theme = useContext(ThemeContext)\n * return <button class={theme === 'dark' ? 'btn-dark' : 'btn-light'}>Click</button>\n * }\n * ```\n */\nexport function useContext<T>(context: Context<T>): T {\n let root = getCurrentRoot()\n\n // Walk up the parent chain looking for the context value\n while (root) {\n const contextMap = contextStorage.get(root)\n if (contextMap && contextMap.has(context.id)) {\n return contextMap.get(context.id) as T\n }\n root = root.parent\n }\n\n // No provider found, return default value\n return context.defaultValue\n}\n\n/**\n * Checks if a context value is currently provided in the tree.\n *\n * Useful for conditional behavior when a provider may or may not exist.\n *\n * @param context - The context object to check\n * @returns true if a Provider exists above in the tree\n *\n * @example\n * ```tsx\n * function OptionalTheme() {\n * if (hasContext(ThemeContext)) {\n * const theme = useContext(ThemeContext)\n * return <div class={theme}>Themed content</div>\n * }\n * return <div>Default content</div>\n * }\n * ```\n */\nexport function hasContext<T>(context: Context<T>): boolean {\n let root = getCurrentRoot()\n\n while (root) {\n const contextMap = contextStorage.get(root)\n if (contextMap && contextMap.has(context.id)) {\n return true\n }\n root = root.parent\n }\n\n return false\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-527QSKFM.cjs","../src/context.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACsFA,IAAM,eAAA,kBAAiB,IAAI,OAAA,CAA2C,CAAA;AAKtE,SAAS,aAAA,CAAc,IAAA,EAAyC;AAC9D,EAAA,IAAI,IAAA,EAAM,cAAA,CAAe,GAAA,CAAI,IAAI,CAAA;AACjC,EAAA,GAAA,CAAI,CAAC,GAAA,EAAK;AACR,IAAA,IAAA,kBAAM,IAAI,GAAA,CAAI,CAAA;AACd,IAAA,cAAA,CAAe,GAAA,CAAI,IAAA,EAAM,GAAG,CAAA;AAAA,EAC9B;AACA,EAAA,OAAO,GAAA;AACT;AA0CO,SAAS,aAAA,CAAiB,YAAA,EAA6B;AAC5D,EAAA,MAAM,GAAA,EAAK,MAAA,CAAO,cAAc,CAAA;AAEhC,EAAA,MAAM,QAAA,EAAsB;AAAA,IAC1B,EAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA,EAAU;AAAA,EACZ,CAAA;AAGA,EAAA,OAAA,CAAQ,SAAA,EAAW,SAAS,QAAA,CAAS,KAAA,EAAmC;AACtE,IAAA,MAAM,SAAA,EAAW,8CAAA,CAAe;AAIhC,IAAA,MAAM,aAAA,EAAe,iDAAA,QAA0B,CAAA;AAG/C,IAAA,MAAM,WAAA,EAAa,aAAA,CAAc,YAAY,CAAA;AAC7C,IAAA,UAAA,CAAW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F,wGAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-527QSKFM.cjs","sourcesContent":[null,"/**\n * @fileoverview Context API for Fict\n *\n * Provides a way to pass data through the component tree without having to pass\n * props down manually at every level. Context is designed for:\n *\n * - SSR isolation (different request = different context values)\n * - Multi-instance support (multiple app roots with different values)\n * - Subtree scoping (override values in specific parts of the tree)\n *\n * ## Design Principles\n *\n * 1. **Reuses existing RootContext hierarchy** - Uses parent chain for value lookup,\n * consistent with handleError/handleSuspend mechanisms.\n *\n * 2. **Zero extra root creation overhead** - Provider doesn't create new root,\n * only mounts value on current root.\n *\n * 3. **Auto-aligned with insert/suspense boundaries** - Because they create child\n * roots that inherit parent, context values propagate correctly.\n *\n * ## Usage\n *\n * ```tsx\n * // Create context with default value\n * const ThemeContext = createContext<'light' | 'dark'>('light')\n *\n * // Provide value to subtree\n * function App() {\n * return (\n * <ThemeContext.Provider value=\"dark\">\n * <ThemedComponent />\n * </ThemeContext.Provider>\n * )\n * }\n *\n * // Consume value\n * function ThemedComponent() {\n * const theme = useContext(ThemeContext)\n * return <div class={theme}>...</div>\n * }\n * ```\n *\n * @module\n */\n\nimport { createElement } from './dom'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n popRoot,\n pushRoot,\n type RootContext,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport { createRenderEffect } from './effect'\nimport type { BaseProps, FictNode } from './types'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Context object created by createContext.\n * Contains the Provider component and serves as a key for context lookup.\n */\nexport interface Context<T> {\n /** Unique identifier for this context */\n readonly id: symbol\n /** Default value when no provider is found */\n readonly defaultValue: T\n /** Provider component for supplying context values */\n Provider: ContextProvider<T>\n /** Display name for debugging */\n displayName?: string\n}\n\n/**\n * Props for the Context Provider component\n */\nexport interface ProviderProps<T> extends BaseProps {\n /** The value to provide to the subtree */\n value: T\n}\n\n/**\n * Provider component type\n */\nexport type ContextProvider<T> = (props: ProviderProps<T>) => FictNode\n\n// ============================================================================\n// Internal Context Storage\n// ============================================================================\n\n/**\n * WeakMap to store context values per RootContext.\n * Using WeakMap ensures proper garbage collection when roots are destroyed.\n */\nconst contextStorage = new WeakMap<RootContext, Map<symbol, unknown>>()\n\n/**\n * Get the context map for a root, creating it if needed\n */\nfunction getContextMap(root: RootContext): Map<symbol, unknown> {\n let map = contextStorage.get(root)\n if (!map) {\n map = new Map()\n contextStorage.set(root, map)\n }\n return map\n}\n\n// ============================================================================\n// Context API\n// ============================================================================\n\n/**\n * Creates a new context with the given default value.\n *\n * Context provides a way to pass values through the component tree without\n * explicit props drilling. It's especially useful for:\n *\n * - Theme data\n * - Locale/i18n settings\n * - Authentication state\n * - Feature flags\n * - Any data that many components at different nesting levels need\n *\n * @param defaultValue - The value to use when no Provider is found above in the tree\n * @returns A context object with a Provider component\n *\n * @example\n * ```tsx\n * // Create a theme context\n * const ThemeContext = createContext<'light' | 'dark'>('light')\n *\n * // Use the provider\n * function App() {\n * return (\n * <ThemeContext.Provider value=\"dark\">\n * <Content />\n * </ThemeContext.Provider>\n * )\n * }\n *\n * // Consume the context\n * function Content() {\n * const theme = useContext(ThemeContext)\n * return <div class={`theme-${theme}`}>Hello</div>\n * }\n * ```\n */\nexport function createContext<T>(defaultValue: T): Context<T> {\n const id = Symbol('fict.context')\n\n const context: Context<T> = {\n id,\n defaultValue,\n Provider: null as unknown as ContextProvider<T>,\n }\n\n // Create the Provider component\n context.Provider = function Provider(props: ProviderProps<T>): FictNode {\n const hostRoot = getCurrentRoot()\n\n // Create a child root for the provider's subtree\n // This establishes the provider boundary - children will look up from here\n const providerRoot = createRootContext(hostRoot)\n\n // Store the context value on this root\n const contextMap = getContextMap(providerRoot)\n contextMap.set(id, props.value)\n\n // Create DOM structure\n const fragment = document.createDocumentFragment()\n const marker = document.createComment('fict:ctx')\n fragment.appendChild(marker)\n\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n\n const renderChildren = (children: FictNode) => {\n // Cleanup previous render\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (children == null || children === false) {\n return\n }\n\n const prev = pushRoot(providerRoot)\n let nodes: Node[] = []\n try {\n const output = createElement(children)\n nodes = toNodeArray(output)\n const parentNode = marker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, marker)\n }\n } finally {\n popRoot(prev)\n flushOnMount(providerRoot)\n }\n\n cleanup = () => {\n destroyRoot(providerRoot)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n // Initial render\n createRenderEffect(() => {\n // Update context value on re-render (if value prop changes reactively)\n contextMap.set(id, props.value)\n renderChildren(props.children)\n })\n\n return fragment\n }\n\n return context\n}\n\n/**\n * Reads the current value of a context.\n *\n * useContext looks up through the RootContext parent chain to find the\n * nearest Provider for this context. If no Provider is found, returns\n * the context's default value.\n *\n * @param context - The context object created by createContext\n * @returns The current context value\n *\n * @example\n * ```tsx\n * const ThemeContext = createContext('light')\n *\n * function ThemedButton() {\n * const theme = useContext(ThemeContext)\n * return <button class={theme === 'dark' ? 'btn-dark' : 'btn-light'}>Click</button>\n * }\n * ```\n */\nexport function useContext<T>(context: Context<T>): T {\n let root = getCurrentRoot()\n\n // Walk up the parent chain looking for the context value\n while (root) {\n const contextMap = contextStorage.get(root)\n if (contextMap && contextMap.has(context.id)) {\n return contextMap.get(context.id) as T\n }\n root = root.parent\n }\n\n // No provider found, return default value\n return context.defaultValue\n}\n\n/**\n * Checks if a context value is currently provided in the tree.\n *\n * Useful for conditional behavior when a provider may or may not exist.\n *\n * @param context - The context object to check\n * @returns true if a Provider exists above in the tree\n *\n * @example\n * ```tsx\n * function OptionalTheme() {\n * if (hasContext(ThemeContext)) {\n * const theme = useContext(ThemeContext)\n * return <div class={theme}>Themed content</div>\n * }\n * return <div>Default content</div>\n * }\n * ```\n */\nexport function hasContext<T>(context: Context<T>): boolean {\n let root = getCurrentRoot()\n\n while (root) {\n const contextMap = contextStorage.get(root)\n if (contextMap && contextMap.has(context.id)) {\n return true\n }\n root = root.parent\n }\n\n return false\n}\n"]}
@@ -213,8 +213,7 @@ function getPropAlias(prop2, tagName) {
213
213
  return a;
214
214
  }
215
215
  var $$EVENTS = "_$FICT_DELEGATE";
216
- var delegatedEvents = isDev ? DelegatedEventNames : [];
217
- var DelegatedEvents = new Set(delegatedEvents);
216
+ var DelegatedEvents = new Set(DelegatedEventNames);
218
217
  var svgElements = isDev ? [
219
218
  "altGlyph",
220
219
  "altGlyphDef",
@@ -512,8 +511,8 @@ var currentRoot;
512
511
  var currentEffectCleanups;
513
512
  var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
514
513
  var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
515
- function createRootContext(parent = currentRoot) {
516
- return { parent, cleanups: [], destroyCallbacks: [] };
514
+ function createRootContext(parent) {
515
+ return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
517
516
  }
518
517
  function pushRoot(root) {
519
518
  if (!enterRootGuard(root)) {
@@ -588,8 +587,9 @@ function destroyRoot(root) {
588
587
  globalSuspenseHandlers.delete(root);
589
588
  }
590
589
  }
591
- function createRoot(fn) {
592
- const root = createRootContext();
590
+ function createRoot(fn, options) {
591
+ const parent = options?.inherit ? currentRoot : void 0;
592
+ const root = createRootContext(parent);
593
593
  const prev = pushRoot(root);
594
594
  let value;
595
595
  try {
@@ -714,13 +714,17 @@ function handleError(err, info, startRoot) {
714
714
  }
715
715
  function handleSuspend(token, startRoot) {
716
716
  let root = startRoot ?? currentRoot;
717
+ const originRoot = root;
717
718
  while (root) {
718
719
  const handlers = root.suspenseHandlers;
719
720
  if (handlers && handlers.length) {
720
721
  for (let i = handlers.length - 1; i >= 0; i--) {
721
722
  const handler = handlers[i];
722
723
  const handled = handler(token);
723
- if (handled !== false) return true;
724
+ if (handled !== false) {
725
+ if (originRoot) originRoot.suspended = true;
726
+ return true;
727
+ }
724
728
  }
725
729
  }
726
730
  root = root.parent;
@@ -730,7 +734,10 @@ function handleSuspend(token, startRoot) {
730
734
  for (let i = globalForRoot.length - 1; i >= 0; i--) {
731
735
  const handler = globalForRoot[i];
732
736
  const handled = handler(token);
733
- if (handled !== false) return true;
737
+ if (handled !== false) {
738
+ if (originRoot) originRoot.suspended = true;
739
+ return true;
740
+ }
734
741
  }
735
742
  }
736
743
  return false;
@@ -1054,7 +1061,25 @@ function runEffect(e) {
1054
1061
  inCleanup = false;
1055
1062
  }
1056
1063
  }
1057
- if (checkDirty(e.deps, e)) {
1064
+ let isDirty = false;
1065
+ try {
1066
+ isDirty = checkDirty(e.deps, e);
1067
+ } catch (err) {
1068
+ if (handleSuspend(err, e.root)) {
1069
+ if (e.flags !== 0) {
1070
+ e.flags = Watching;
1071
+ }
1072
+ return;
1073
+ }
1074
+ if (handleError(err, { source: "effect" }, e.root)) {
1075
+ if (e.flags !== 0) {
1076
+ e.flags = Watching;
1077
+ }
1078
+ return;
1079
+ }
1080
+ throw err;
1081
+ }
1082
+ if (isDirty) {
1058
1083
  ++cycle;
1059
1084
  effectRunDevtools(e);
1060
1085
  e.depsTail = void 0;
@@ -1241,6 +1266,10 @@ function effect(fn) {
1241
1266
  flags: WatchingRunning,
1242
1267
  __id: void 0
1243
1268
  };
1269
+ const root = getCurrentRoot();
1270
+ if (root) {
1271
+ e.root = root;
1272
+ }
1244
1273
  registerEffectDevtools(e);
1245
1274
  const prevSub = activeSub;
1246
1275
  if (prevSub !== void 0) link(e, prevSub, 0);
@@ -1256,7 +1285,7 @@ function effect(fn) {
1256
1285
  disposer[EFFECT_MARKER] = true;
1257
1286
  return disposer;
1258
1287
  }
1259
- function effectWithCleanup(fn, cleanupRunner) {
1288
+ function effectWithCleanup(fn, cleanupRunner, root) {
1260
1289
  const e = {
1261
1290
  fn,
1262
1291
  subs: void 0,
@@ -1267,6 +1296,10 @@ function effectWithCleanup(fn, cleanupRunner) {
1267
1296
  runCleanup: cleanupRunner,
1268
1297
  __id: void 0
1269
1298
  };
1299
+ const resolvedRoot = root ?? getCurrentRoot();
1300
+ if (resolvedRoot) {
1301
+ e.root = resolvedRoot;
1302
+ }
1270
1303
  registerEffectDevtools(e);
1271
1304
  const prevSub = activeSub;
1272
1305
  if (prevSub !== void 0) link(e, prevSub, 0);
@@ -1341,6 +1374,18 @@ function untrack(fn) {
1341
1374
  activeSub = prev;
1342
1375
  }
1343
1376
  }
1377
+ function isSignal(fn) {
1378
+ return typeof fn === "function" && fn[SIGNAL_MARKER] === true;
1379
+ }
1380
+ function isComputed(fn) {
1381
+ return typeof fn === "function" && fn[COMPUTED_MARKER] === true;
1382
+ }
1383
+ function isEffect(fn) {
1384
+ return typeof fn === "function" && fn[EFFECT_MARKER] === true;
1385
+ }
1386
+ function isEffectScope(fn) {
1387
+ return typeof fn === "function" && fn[EFFECT_SCOPE_MARKER] === true;
1388
+ }
1344
1389
  function setTransitionContext(value) {
1345
1390
  const prev = isInTransition;
1346
1391
  isInTransition = value;
@@ -1428,6 +1473,9 @@ function createEffect(fn) {
1428
1473
  bucket.push(maybeCleanup);
1429
1474
  }
1430
1475
  } catch (err) {
1476
+ if (handleSuspend(err, rootForError)) {
1477
+ return;
1478
+ }
1431
1479
  if (handleError(err, { source: "effect" }, rootForError)) {
1432
1480
  return;
1433
1481
  }
@@ -1436,7 +1484,7 @@ function createEffect(fn) {
1436
1484
  });
1437
1485
  cleanups = bucket;
1438
1486
  };
1439
- const disposeEffect = effectWithCleanup(run, doCleanup);
1487
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
1440
1488
  const teardown = () => {
1441
1489
  runCleanupList(cleanups);
1442
1490
  disposeEffect();
@@ -1460,6 +1508,9 @@ function createRenderEffect(fn) {
1460
1508
  cleanup = maybeCleanup;
1461
1509
  }
1462
1510
  } catch (err) {
1511
+ if (handleSuspend(err, rootForError)) {
1512
+ return;
1513
+ }
1463
1514
  const handled = handleError(err, { source: "effect" }, rootForError);
1464
1515
  if (handled) {
1465
1516
  return;
@@ -1467,7 +1518,7 @@ function createRenderEffect(fn) {
1467
1518
  throw err;
1468
1519
  }
1469
1520
  };
1470
- const disposeEffect = effectWithCleanup(run, doCleanup);
1521
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
1471
1522
  const teardown = () => {
1472
1523
  if (cleanup) {
1473
1524
  cleanup();
@@ -1674,7 +1725,10 @@ function untrack2(fn) {
1674
1725
  // src/binding.ts
1675
1726
  var isDev5 = true ? false : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
1676
1727
  function isReactive(value) {
1677
- return typeof value === "function" && value.length === 0;
1728
+ if (typeof value !== "function") return false;
1729
+ if (isSignal(value) || isComputed(value)) return true;
1730
+ if (isEffect(value) || isEffectScope(value)) return false;
1731
+ return value.length === 0;
1678
1732
  }
1679
1733
  function unwrap(value) {
1680
1734
  return isReactive(value) ? value() : value;
@@ -1980,6 +2034,7 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
1980
2034
  const root = createRootContext(hostRoot);
1981
2035
  const prev = pushRoot(root);
1982
2036
  let nodes = [];
2037
+ let handledError = false;
1983
2038
  try {
1984
2039
  let newNode;
1985
2040
  if (value instanceof Node) {
@@ -2002,12 +2057,31 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
2002
2057
  newNode = createFn ? createFn(value) : document.createTextNode(String(value));
2003
2058
  }
2004
2059
  nodes = toNodeArray(newNode);
2060
+ if (root.suspended) {
2061
+ handledError = true;
2062
+ destroyRoot(root);
2063
+ return;
2064
+ }
2005
2065
  if (parentNode) {
2006
2066
  insertNodesBefore(parentNode, nodes, marker);
2007
2067
  }
2068
+ } catch (err) {
2069
+ if (handleSuspend(err, root)) {
2070
+ handledError = true;
2071
+ destroyRoot(root);
2072
+ return;
2073
+ }
2074
+ if (handleError(err, { source: "renderChild" }, root)) {
2075
+ handledError = true;
2076
+ destroyRoot(root);
2077
+ return;
2078
+ }
2079
+ throw err;
2008
2080
  } finally {
2009
2081
  popRoot(prev);
2010
- flushOnMount(root);
2082
+ if (!handledError) {
2083
+ flushOnMount(root);
2084
+ }
2011
2085
  }
2012
2086
  currentRoot2 = root;
2013
2087
  currentNodes = nodes;
@@ -2205,7 +2279,8 @@ function bindEvent(el, eventName, handler, options) {
2205
2279
  if (handler == null) return () => {
2206
2280
  };
2207
2281
  const rootRef = getCurrentRoot();
2208
- if (isDev5 && DelegatedEvents.has(eventName) && !options) {
2282
+ const shouldDelegate = options == null && DelegatedEvents.has(eventName);
2283
+ if (shouldDelegate) {
2209
2284
  const key = `$$${eventName}`;
2210
2285
  delegateEvents([eventName]);
2211
2286
  const resolveHandler = isReactive(handler) ? handler : () => handler;
@@ -2352,7 +2427,7 @@ function assignProp(node, prop2, value, prev, isSVG, skipRef, props) {
2352
2427
  }
2353
2428
  if (prop2.slice(0, 2) === "on") {
2354
2429
  const eventName = prop2.slice(2).toLowerCase();
2355
- const shouldDelegate = isDev5 && DelegatedEvents.has(eventName);
2430
+ const shouldDelegate = DelegatedEvents.has(eventName);
2356
2431
  if (!shouldDelegate && prev) {
2357
2432
  const handler = Array.isArray(prev) ? prev[0] : prev;
2358
2433
  node.removeEventListener(eventName, handler);
@@ -2656,17 +2731,27 @@ function __fictRender(ctx, fn) {
2656
2731
  }
2657
2732
 
2658
2733
  // src/props.ts
2734
+ var PROP_GETTER_MARKER = Symbol.for("fict:prop-getter");
2659
2735
  var propGetters = /* @__PURE__ */ new WeakSet();
2660
2736
  var rawToProxy = /* @__PURE__ */ new WeakMap();
2661
2737
  var proxyToRaw = /* @__PURE__ */ new WeakMap();
2662
2738
  function __fictProp(getter) {
2663
2739
  if (typeof getter === "function" && getter.length === 0) {
2664
2740
  propGetters.add(getter);
2741
+ if (Object.isExtensible(getter)) {
2742
+ try {
2743
+ ;
2744
+ getter[PROP_GETTER_MARKER] = true;
2745
+ } catch {
2746
+ }
2747
+ }
2665
2748
  }
2666
2749
  return getter;
2667
2750
  }
2668
2751
  function isPropGetter(value) {
2669
- return typeof value === "function" && propGetters.has(value);
2752
+ if (typeof value !== "function") return false;
2753
+ const fn = value;
2754
+ return propGetters.has(fn) || fn[PROP_GETTER_MARKER] === true;
2670
2755
  }
2671
2756
  function createPropsProxy(props) {
2672
2757
  if (!props || typeof props !== "object") {
@@ -2790,11 +2875,21 @@ function mergeProps(...sources) {
2790
2875
  }
2791
2876
  });
2792
2877
  }
2793
- function prop(getter) {
2878
+ function prop(getter, options) {
2794
2879
  if (isPropGetter(getter)) {
2795
2880
  return getter;
2796
2881
  }
2797
- return __fictProp(createMemo(getter));
2882
+ const fn = getter;
2883
+ const unwrap2 = options?.unwrap !== false;
2884
+ return __fictProp(
2885
+ createMemo(() => {
2886
+ const value = fn();
2887
+ if (unwrap2 && isPropGetter(value)) {
2888
+ return value();
2889
+ }
2890
+ return value;
2891
+ })
2892
+ );
2798
2893
  }
2799
2894
 
2800
2895
  // src/dom.ts
@@ -3298,4 +3393,4 @@ export {
3298
3393
  createElement,
3299
3394
  template
3300
3395
  };
3301
- //# sourceMappingURL=chunk-RY4WDS6R.js.map
3396
+ //# sourceMappingURL=chunk-5KXEEQUO.js.map