@fictjs/runtime 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +9 -9
- package/dist/advanced.js +4 -4
- package/dist/{chunk-AR6NSCZM.js → chunk-4NUHM77Z.js} +3 -3
- package/dist/{chunk-RY5CY4CI.js → chunk-D2IWOO4X.js} +2 -2
- package/dist/{chunk-LFMXNQZC.cjs → chunk-KNGHYGK4.cjs} +17 -17
- package/dist/{chunk-LFMXNQZC.cjs.map → chunk-KNGHYGK4.cjs.map} +1 -1
- package/dist/{chunk-7BO6P2KP.js → chunk-LRFMCJY3.js} +84 -1
- package/dist/chunk-LRFMCJY3.js.map +1 -0
- package/dist/{chunk-4ZPZM5IG.cjs → chunk-QB2UD62G.cjs} +8 -8
- package/dist/{chunk-4ZPZM5IG.cjs.map → chunk-QB2UD62G.cjs.map} +1 -1
- package/dist/{chunk-5OYBRKE4.js → chunk-SLFAEVKJ.js} +3 -3
- package/dist/{chunk-WJHXPF7M.cjs → chunk-Z6M3HKLG.cjs} +156 -156
- package/dist/{chunk-WJHXPF7M.cjs.map → chunk-Z6M3HKLG.cjs.map} +1 -1
- package/dist/{chunk-6RCEIWZL.cjs → chunk-ZR435MDC.cjs} +85 -2
- package/dist/chunk-ZR435MDC.cjs.map +1 -0
- package/dist/index.cjs +95 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.js +87 -7
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +60 -10
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +51 -41
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +11 -2
- package/dist/internal.d.ts +11 -2
- package/dist/internal.js +13 -3
- package/dist/internal.js.map +1 -1
- package/dist/loader.cjs +60 -8
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +53 -1
- package/dist/loader.js.map +1 -1
- package/dist/{resume-Dx8_l72o.d.ts → resume-CqeQ3v_q.d.ts} +5 -1
- package/dist/{resume-BrAkmSTY.d.cts → resume-i-A3EFox.d.cts} +5 -1
- package/package.json +1 -1
- package/src/internal.ts +4 -0
- package/src/loader.ts +58 -0
- package/src/resume.ts +55 -0
- package/src/ssr-stream.ts +38 -0
- package/src/suspense.ts +62 -7
- package/dist/chunk-6RCEIWZL.cjs.map +0 -1
- package/dist/chunk-7BO6P2KP.js.map +0 -1
- /package/dist/{chunk-AR6NSCZM.js.map → chunk-4NUHM77Z.js.map} +0 -0
- /package/dist/{chunk-RY5CY4CI.js.map → chunk-D2IWOO4X.js.map} +0 -0
- /package/dist/{chunk-5OYBRKE4.js.map → chunk-SLFAEVKJ.js.map} +0 -0
package/dist/advanced.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkKNGHYGK4cjs = require('./chunk-KNGHYGK4.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQB2UD62Gcjs = require('./chunk-QB2UD62G.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ var _chunk4ZPZM5IGcjs = require('./chunk-4ZPZM5IG.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkZ6M3HKLGcjs = require('./chunk-Z6M3HKLG.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -26,13 +26,13 @@ var _chunkWJHXPF7Mcjs = require('./chunk-WJHXPF7M.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkZR435MDCcjs = require('./chunk-ZR435MDC.cjs');
|
|
30
30
|
|
|
31
31
|
// src/versioned-signal.ts
|
|
32
32
|
function createVersionedSignal(initialValue, options) {
|
|
33
33
|
const equals = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.equals]), () => ( Object.is));
|
|
34
|
-
const value =
|
|
35
|
-
const version =
|
|
34
|
+
const value = _chunkZR435MDCcjs.signal.call(void 0, initialValue);
|
|
35
|
+
const version = _chunkZR435MDCcjs.signal.call(void 0, 0);
|
|
36
36
|
const bumpVersion = () => {
|
|
37
37
|
const next = version() + 1;
|
|
38
38
|
version(next);
|
|
@@ -53,8 +53,8 @@ function createVersionedSignal(initialValue, options) {
|
|
|
53
53
|
force: () => {
|
|
54
54
|
bumpVersion();
|
|
55
55
|
},
|
|
56
|
-
peekVersion: () =>
|
|
57
|
-
peekValue: () =>
|
|
56
|
+
peekVersion: () => _chunkZR435MDCcjs.untrack.call(void 0, () => version()),
|
|
57
|
+
peekValue: () => _chunkZR435MDCcjs.untrack.call(void 0, () => value())
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -79,5 +79,5 @@ function createVersionedSignal(initialValue, options) {
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
exports.createAttributeBinding =
|
|
82
|
+
exports.createAttributeBinding = _chunkZ6M3HKLGcjs.createAttributeBinding; exports.createChildBinding = _chunkZ6M3HKLGcjs.createChildBinding; exports.createClassBinding = _chunkZ6M3HKLGcjs.createClassBinding; exports.createContext = _chunkKNGHYGK4cjs.createContext; exports.createRenderEffect = _chunkZR435MDCcjs.createRenderEffect; exports.createScope = _chunkQB2UD62Gcjs.createScope; exports.createSelector = _chunkZR435MDCcjs.createSelector; exports.createShow = _chunkZ6M3HKLGcjs.createShow; exports.createSignal = _chunkZR435MDCcjs.signal; exports.createStyleBinding = _chunkZ6M3HKLGcjs.createStyleBinding; exports.createTextBinding = _chunkZ6M3HKLGcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunkZR435MDCcjs.effectScope; exports.getDevtoolsHook = _chunkZR435MDCcjs.getDevtoolsHook; exports.hasContext = _chunkKNGHYGK4cjs.hasContext; exports.isReactive = _chunkZ6M3HKLGcjs.isReactive; exports.registerErrorHandler = _chunkZR435MDCcjs.registerErrorHandler; exports.runInScope = _chunkQB2UD62Gcjs.runInScope; exports.setCycleProtectionOptions = _chunkZR435MDCcjs.setCycleProtectionOptions; exports.unwrap = _chunkZ6M3HKLGcjs.unwrap; exports.useContext = _chunkKNGHYGK4cjs.useContext;
|
|
83
83
|
//# sourceMappingURL=advanced.cjs.map
|
package/dist/advanced.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
hasContext,
|
|
4
4
|
useContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SLFAEVKJ.js";
|
|
6
6
|
import {
|
|
7
7
|
createScope,
|
|
8
8
|
runInScope
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4NUHM77Z.js";
|
|
10
10
|
import {
|
|
11
11
|
createAttributeBinding,
|
|
12
12
|
createChildBinding,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
createTextBinding,
|
|
17
17
|
isReactive,
|
|
18
18
|
unwrap
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-D2IWOO4X.js";
|
|
20
20
|
import {
|
|
21
21
|
createRenderEffect,
|
|
22
22
|
createSelector,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
setCycleProtectionOptions,
|
|
27
27
|
signal,
|
|
28
28
|
untrack
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LRFMCJY3.js";
|
|
30
30
|
|
|
31
31
|
// src/versioned-signal.ts
|
|
32
32
|
function createVersionedSignal(initialValue, options) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isReactive
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D2IWOO4X.js";
|
|
4
4
|
import {
|
|
5
5
|
createEffect,
|
|
6
6
|
createRoot,
|
|
7
7
|
onCleanup,
|
|
8
8
|
registerRootCleanup
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LRFMCJY3.js";
|
|
10
10
|
|
|
11
11
|
// src/scope.ts
|
|
12
12
|
function createScope() {
|
|
@@ -44,4 +44,4 @@ export {
|
|
|
44
44
|
createScope,
|
|
45
45
|
runInScope
|
|
46
46
|
};
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
47
|
+
//# sourceMappingURL=chunk-4NUHM77Z.js.map
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
setTransitionContext,
|
|
41
41
|
signal,
|
|
42
42
|
untrack
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-LRFMCJY3.js";
|
|
44
44
|
|
|
45
45
|
// src/jsx.ts
|
|
46
46
|
var Fragment = Symbol("Fragment");
|
|
@@ -2256,4 +2256,4 @@ export {
|
|
|
2256
2256
|
createElement,
|
|
2257
2257
|
template
|
|
2258
2258
|
};
|
|
2259
|
-
//# sourceMappingURL=chunk-
|
|
2259
|
+
//# sourceMappingURL=chunk-D2IWOO4X.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZ6M3HKLGcjs = require('./chunk-Z6M3HKLG.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ var _chunkWJHXPF7Mcjs = require('./chunk-WJHXPF7M.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkZR435MDCcjs = require('./chunk-ZR435MDC.cjs');
|
|
16
16
|
|
|
17
17
|
// src/context.ts
|
|
18
18
|
var contextStorage = /* @__PURE__ */ new WeakMap();
|
|
@@ -32,8 +32,8 @@ function createContext(defaultValue) {
|
|
|
32
32
|
Provider: null
|
|
33
33
|
};
|
|
34
34
|
context.Provider = function Provider(props) {
|
|
35
|
-
const hostRoot =
|
|
36
|
-
const providerRoot =
|
|
35
|
+
const hostRoot = _chunkZR435MDCcjs.getCurrentRoot.call(void 0, );
|
|
36
|
+
const providerRoot = _chunkZR435MDCcjs.createRootContext.call(void 0, hostRoot);
|
|
37
37
|
const contextMap = getContextMap(providerRoot);
|
|
38
38
|
contextMap.set(id, props.value);
|
|
39
39
|
const fragment = document.createDocumentFragment();
|
|
@@ -47,32 +47,32 @@ function createContext(defaultValue) {
|
|
|
47
47
|
cleanup = void 0;
|
|
48
48
|
}
|
|
49
49
|
if (activeNodes.length) {
|
|
50
|
-
|
|
50
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, activeNodes);
|
|
51
51
|
activeNodes = [];
|
|
52
52
|
}
|
|
53
53
|
if (children == null || children === false) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
const prev =
|
|
56
|
+
const prev = _chunkZR435MDCcjs.pushRoot.call(void 0, providerRoot);
|
|
57
57
|
let nodes = [];
|
|
58
58
|
try {
|
|
59
|
-
const output =
|
|
60
|
-
nodes =
|
|
59
|
+
const output = _chunkZ6M3HKLGcjs.createElement.call(void 0, children);
|
|
60
|
+
nodes = _chunkZ6M3HKLGcjs.toNodeArray.call(void 0, output);
|
|
61
61
|
const parentNode = marker.parentNode;
|
|
62
62
|
if (parentNode) {
|
|
63
|
-
|
|
63
|
+
_chunkZ6M3HKLGcjs.insertNodesBefore.call(void 0, parentNode, nodes, marker);
|
|
64
64
|
}
|
|
65
65
|
} finally {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
_chunkZR435MDCcjs.popRoot.call(void 0, prev);
|
|
67
|
+
_chunkZR435MDCcjs.flushOnMount.call(void 0, providerRoot);
|
|
68
68
|
}
|
|
69
69
|
cleanup = () => {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, providerRoot);
|
|
71
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, nodes);
|
|
72
72
|
};
|
|
73
73
|
activeNodes = nodes;
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
_chunkZR435MDCcjs.createRenderEffect.call(void 0, () => {
|
|
76
76
|
contextMap.set(id, props.value);
|
|
77
77
|
renderChildren(props.children);
|
|
78
78
|
});
|
|
@@ -81,7 +81,7 @@ function createContext(defaultValue) {
|
|
|
81
81
|
return context;
|
|
82
82
|
}
|
|
83
83
|
function useContext(context) {
|
|
84
|
-
let root =
|
|
84
|
+
let root = _chunkZR435MDCcjs.getCurrentRoot.call(void 0, );
|
|
85
85
|
while (root) {
|
|
86
86
|
const contextMap = contextStorage.get(root);
|
|
87
87
|
if (contextMap && contextMap.has(context.id)) {
|
|
@@ -92,7 +92,7 @@ function useContext(context) {
|
|
|
92
92
|
return context.defaultValue;
|
|
93
93
|
}
|
|
94
94
|
function hasContext(context) {
|
|
95
|
-
let root =
|
|
95
|
+
let root = _chunkZR435MDCcjs.getCurrentRoot.call(void 0, );
|
|
96
96
|
while (root) {
|
|
97
97
|
const contextMap = contextStorage.get(root);
|
|
98
98
|
if (contextMap && contextMap.has(context.id)) {
|
|
@@ -108,4 +108,4 @@ function hasContext(context) {
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
exports.createContext = createContext; exports.useContext = useContext; exports.hasContext = hasContext;
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-KNGHYGK4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-LFMXNQZC.cjs","../src/context.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACoFA,IAAM,eAAA,kBAAiB,IAAI,OAAA,CAA2C,CAAA;AAKtE,SAAS,aAAA,CAAc,IAAA,EAAyC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I,IAAI,CAAA;AAC1C,IAAA,GAAA,CAAI,WAAA,GAAc,UAAA,CAAW,GAAA,CAAI,OAAA,CAAQ,EAAE,CAAA,EAAG;AAC5C,MAAA,OAAO,UAAA,CAAW,GAAA,CAAI,OAAA,CAAQ,EAAE,CAAA;AAAA,IAClC;AACA,IAAA,KAAA,EAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAGA,EAAA,OAAO,OAAA,CAAQ,YAAA;AACjB;AAqBO,SAAS,UAAA,CAAc,OAAA,EAA8B;AAC1D,EAAA,IAAI,KAAA,EAAO,8CAAA,CAAe;AAE1B,EAAA,MAAA,CAAO,IAAA,EAAM;AACX,IAAA,MAAM,WAAA,EAAa,cAAA,CAAe,GAAA,CAAI,IAAI,CAAA;AAC1C,IAAA,GAAA,CAAI,WAAA,GAAc,UAAA,CAAW,GAAA,CAAI,OAAA,CAAQ,EAAE,CAAA,EAAG;AAC5C,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,KAAA,EAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAEA,EAAA,OAAO,KAAA;AACT;ADnMA;AACA;AACE;AACA;AACA;AACF,wGAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-LFMXNQZC.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 { createRenderEffect } from './effect'\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 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-KNGHYGK4.cjs","../src/context.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACoFA,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,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A,EAAG;AAC5C,MAAA,OAAO,UAAA,CAAW,GAAA,CAAI,OAAA,CAAQ,EAAE,CAAA;AAAA,IAClC;AACA,IAAA,KAAA,EAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAGA,EAAA,OAAO,OAAA,CAAQ,YAAA;AACjB;AAqBO,SAAS,UAAA,CAAc,OAAA,EAA8B;AAC1D,EAAA,IAAI,KAAA,EAAO,8CAAA,CAAe;AAE1B,EAAA,MAAA,CAAO,IAAA,EAAM;AACX,IAAA,MAAM,WAAA,EAAa,cAAA,CAAe,GAAA,CAAI,IAAI,CAAA;AAC1C,IAAA,GAAA,CAAI,WAAA,GAAc,UAAA,CAAW,GAAA,CAAI,OAAA,CAAQ,EAAE,CAAA,EAAG;AAC5C,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,KAAA,EAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAEA,EAAA,OAAO,KAAA;AACT;ADnMA;AACA;AACE;AACA;AACA;AACF,wGAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-KNGHYGK4.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 { createRenderEffect } from './effect'\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 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"]}
|
|
@@ -1797,6 +1797,34 @@ function createMemo(fn, options2) {
|
|
|
1797
1797
|
return computed(fn, options2);
|
|
1798
1798
|
}
|
|
1799
1799
|
|
|
1800
|
+
// src/ssr-stream.ts
|
|
1801
|
+
var ssrStreamHooks = null;
|
|
1802
|
+
var boundaryStack = [];
|
|
1803
|
+
function __fictSetSSRStreamHooks(hooks) {
|
|
1804
|
+
ssrStreamHooks = hooks;
|
|
1805
|
+
if (!hooks) {
|
|
1806
|
+
boundaryStack.length = 0;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
function __fictGetSSRStreamHooks() {
|
|
1810
|
+
return ssrStreamHooks;
|
|
1811
|
+
}
|
|
1812
|
+
function __fictPushSSRBoundary(id) {
|
|
1813
|
+
boundaryStack.push(id);
|
|
1814
|
+
}
|
|
1815
|
+
function __fictPopSSRBoundary(expected) {
|
|
1816
|
+
if (boundaryStack.length === 0) return;
|
|
1817
|
+
const top = boundaryStack[boundaryStack.length - 1];
|
|
1818
|
+
if (expected && top !== expected) {
|
|
1819
|
+
boundaryStack.pop();
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
boundaryStack.pop();
|
|
1823
|
+
}
|
|
1824
|
+
function __fictGetCurrentSSRBoundary() {
|
|
1825
|
+
return boundaryStack.length > 0 ? boundaryStack[boundaryStack.length - 1] : null;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1800
1828
|
// src/store.ts
|
|
1801
1829
|
var PROXY = Symbol("fict:store-proxy");
|
|
1802
1830
|
var TARGET = Symbol("fict:store-target");
|
|
@@ -1965,17 +1993,20 @@ var resumableEnabled = false;
|
|
|
1965
1993
|
var hydrating = false;
|
|
1966
1994
|
var scopeCounter = 0;
|
|
1967
1995
|
var scopeRegistry = /* @__PURE__ */ new Map();
|
|
1996
|
+
var boundaryScopes = /* @__PURE__ */ new Map();
|
|
1968
1997
|
var snapshotState = null;
|
|
1969
1998
|
var resumedScopes = /* @__PURE__ */ new Map();
|
|
1970
1999
|
function __fictEnableSSR() {
|
|
1971
2000
|
ssrEnabled = true;
|
|
1972
2001
|
scopeCounter = 0;
|
|
1973
2002
|
scopeRegistry = /* @__PURE__ */ new Map();
|
|
2003
|
+
boundaryScopes = /* @__PURE__ */ new Map();
|
|
1974
2004
|
resumedScopes.clear();
|
|
1975
2005
|
snapshotState = null;
|
|
1976
2006
|
}
|
|
1977
2007
|
function __fictDisableSSR() {
|
|
1978
2008
|
ssrEnabled = false;
|
|
2009
|
+
boundaryScopes = /* @__PURE__ */ new Map();
|
|
1979
2010
|
}
|
|
1980
2011
|
function __fictEnableResumable() {
|
|
1981
2012
|
resumableEnabled = true;
|
|
@@ -2017,12 +2048,27 @@ function __fictRegisterScope(ctx, host, type, props) {
|
|
|
2017
2048
|
if (props !== void 0) {
|
|
2018
2049
|
record.props = props;
|
|
2019
2050
|
}
|
|
2051
|
+
const boundaryId = __fictGetCurrentSSRBoundary();
|
|
2052
|
+
if (boundaryId) {
|
|
2053
|
+
record.boundaryId = boundaryId;
|
|
2054
|
+
let scopes = boundaryScopes.get(boundaryId);
|
|
2055
|
+
if (!scopes) {
|
|
2056
|
+
scopes = /* @__PURE__ */ new Set();
|
|
2057
|
+
boundaryScopes.set(boundaryId, scopes);
|
|
2058
|
+
}
|
|
2059
|
+
scopes.add(id);
|
|
2060
|
+
}
|
|
2020
2061
|
scopeRegistry.set(id, record);
|
|
2021
2062
|
return id;
|
|
2022
2063
|
}
|
|
2023
2064
|
function __fictGetScopeRegistry() {
|
|
2024
2065
|
return scopeRegistry;
|
|
2025
2066
|
}
|
|
2067
|
+
function __fictGetScopesForBoundary(boundaryId) {
|
|
2068
|
+
const scopes = boundaryScopes.get(boundaryId);
|
|
2069
|
+
if (!scopes) return [];
|
|
2070
|
+
return Array.from(scopes);
|
|
2071
|
+
}
|
|
2026
2072
|
function __fictSerializeSSRState() {
|
|
2027
2073
|
const scopes = {};
|
|
2028
2074
|
for (const [id, record] of scopeRegistry.entries()) {
|
|
@@ -2043,12 +2089,42 @@ function __fictSerializeSSRState() {
|
|
|
2043
2089
|
}
|
|
2044
2090
|
return { scopes };
|
|
2045
2091
|
}
|
|
2092
|
+
function __fictSerializeSSRStateForScopes(scopeIds) {
|
|
2093
|
+
const scopes = {};
|
|
2094
|
+
for (const id of scopeIds) {
|
|
2095
|
+
const record = scopeRegistry.get(id);
|
|
2096
|
+
if (!record) continue;
|
|
2097
|
+
const snapshot = {
|
|
2098
|
+
id,
|
|
2099
|
+
slots: serializeSlots(record.ctx)
|
|
2100
|
+
};
|
|
2101
|
+
if (record.type !== void 0) {
|
|
2102
|
+
snapshot.t = record.type;
|
|
2103
|
+
}
|
|
2104
|
+
if (record.props !== void 0) {
|
|
2105
|
+
snapshot.props = record.props;
|
|
2106
|
+
}
|
|
2107
|
+
if (record.ctx.slotMap !== void 0) {
|
|
2108
|
+
snapshot.vars = record.ctx.slotMap;
|
|
2109
|
+
}
|
|
2110
|
+
scopes[id] = snapshot;
|
|
2111
|
+
}
|
|
2112
|
+
return { scopes };
|
|
2113
|
+
}
|
|
2046
2114
|
function __fictSetSSRState(state) {
|
|
2047
2115
|
snapshotState = state;
|
|
2048
2116
|
if (!state) {
|
|
2049
2117
|
resumedScopes.clear();
|
|
2050
2118
|
}
|
|
2051
2119
|
}
|
|
2120
|
+
function __fictMergeSSRState(state) {
|
|
2121
|
+
if (!state) return;
|
|
2122
|
+
if (!snapshotState) {
|
|
2123
|
+
snapshotState = { scopes: { ...state.scopes } };
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
Object.assign(snapshotState.scopes, state.scopes);
|
|
2127
|
+
}
|
|
2052
2128
|
function __fictGetSSRScope(id) {
|
|
2053
2129
|
return snapshotState?.scopes[id];
|
|
2054
2130
|
}
|
|
@@ -2351,6 +2427,10 @@ export {
|
|
|
2351
2427
|
createSelector,
|
|
2352
2428
|
createEffect,
|
|
2353
2429
|
createRenderEffect,
|
|
2430
|
+
__fictSetSSRStreamHooks,
|
|
2431
|
+
__fictGetSSRStreamHooks,
|
|
2432
|
+
__fictPushSSRBoundary,
|
|
2433
|
+
__fictPopSSRBoundary,
|
|
2354
2434
|
createStore,
|
|
2355
2435
|
isStoreProxy,
|
|
2356
2436
|
unwrapStore,
|
|
@@ -2365,8 +2445,11 @@ export {
|
|
|
2365
2445
|
__fictIsHydrating,
|
|
2366
2446
|
__fictRegisterScope,
|
|
2367
2447
|
__fictGetScopeRegistry,
|
|
2448
|
+
__fictGetScopesForBoundary,
|
|
2368
2449
|
__fictSerializeSSRState,
|
|
2450
|
+
__fictSerializeSSRStateForScopes,
|
|
2369
2451
|
__fictSetSSRState,
|
|
2452
|
+
__fictMergeSSRState,
|
|
2370
2453
|
__fictGetSSRScope,
|
|
2371
2454
|
__fictEnsureScope,
|
|
2372
2455
|
__fictUseLexicalScope,
|
|
@@ -2377,4 +2460,4 @@ export {
|
|
|
2377
2460
|
serializeValue,
|
|
2378
2461
|
deserializeValue
|
|
2379
2462
|
};
|
|
2380
|
-
//# sourceMappingURL=chunk-
|
|
2463
|
+
//# sourceMappingURL=chunk-LRFMCJY3.js.map
|