octane 0.4.2 → 0.4.3
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/cjs/context-identity.cjs +29 -0
- package/dist/cjs/dom-stage.cjs +24 -18
- package/dist/cjs/error-codes.server.generated.cjs +5 -0
- package/dist/cjs/hydration-markers.cjs +12 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/runtime.cjs +253 -393
- package/dist/cjs/runtime.server.cjs +137 -35
- package/dist/cjs/server/index.cjs +2 -0
- package/dist/cjs/server/streamed-signals.cjs +41 -9
- package/dist/cjs/signals/client.cjs +1 -6
- package/dist/cjs/signals/engine.cjs +1 -12
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/client-only-server.js +1 -28
- package/dist/compiler/compile-renderer-boundaries.js +1 -22
- package/dist/compiler/compile-universal.js +1 -22
- package/dist/compiler/compile.js +782 -359
- package/dist/compiler/dom-binding-fixed-props.js +11 -1
- package/dist/compiler/generated-origin.js +46 -0
- package/dist/compiler/hydrate-boundaries.js +88 -52
- package/dist/compiler/plain-hook-memo.js +5 -1
- package/dist/compiler/pure-factories.js +66 -0
- package/dist/compiler/register.js +4 -1
- package/dist/compiler/slot-hooks.js +113 -186
- package/dist/compiler/typescript-lowering.js +763 -0
- package/dist/compiler/void-roots.js +239 -0
- package/dist/compiler/volar.js +91 -38
- package/dist/context-identity.d.ts +14 -0
- package/dist/context-identity.js +28 -0
- package/dist/dom-stage.js +24 -18
- package/dist/error-codes.server.generated.d.ts +1 -0
- package/dist/error-codes.server.generated.js +5 -0
- package/dist/hydration/idle.js +1 -0
- package/dist/hydration/independent-island.js +53 -2
- package/dist/hydration/media.js +1 -0
- package/dist/hydration/types.d.ts +5 -0
- package/dist/hydration/visible.js +1 -0
- package/dist/hydration-markers.d.ts +8 -0
- package/dist/hydration-markers.js +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/runtime.d.ts +25 -40
- package/dist/runtime.js +254 -398
- package/dist/runtime.server.d.ts +23 -2
- package/dist/runtime.server.js +142 -36
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/streamed-signals.js +41 -9
- package/dist/signals/client.js +3 -8
- package/dist/signals/engine.d.ts +0 -2
- package/dist/signals/engine.js +1 -13
- package/dist/universal-core.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/signals/diagnostic-local-hook.cjs +0 -37
- package/dist/compiler/local-void-roots.js +0 -154
- package/dist/signals/diagnostic-local-hook.d.ts +0 -8
- package/dist/signals/diagnostic-local-hook.js +0 -12
package/dist/context-identity.js
CHANGED
|
@@ -12,7 +12,35 @@ function isContext(value) {
|
|
|
12
12
|
const identities = globalThis[CONTEXT_IDENTITIES];
|
|
13
13
|
return identities != null && identities.has(value) === true;
|
|
14
14
|
}
|
|
15
|
+
function defineRemovedContextMembers(context) {
|
|
16
|
+
let consumerWarned = false;
|
|
17
|
+
Object.defineProperties(context, {
|
|
18
|
+
Consumer: {
|
|
19
|
+
configurable: true,
|
|
20
|
+
get() {
|
|
21
|
+
if (!consumerWarned) {
|
|
22
|
+
consumerWarned = true;
|
|
23
|
+
console.error(
|
|
24
|
+
"Octane has no Context.Consumer. Read the context directly with use(Context) or useContext(Context) in the child component \u2014 Octane hooks are call-site keyed, so the read is legal behind any condition the render-prop form was working around."
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
Provider: {
|
|
31
|
+
configurable: true,
|
|
32
|
+
get() {
|
|
33
|
+
const error = new Error(
|
|
34
|
+
"[OCTANE_CONTEXT_PROVIDER] Context.Provider was removed. Render the context itself as the provider: <Context value={...}>...</Context>."
|
|
35
|
+
);
|
|
36
|
+
error.code = "OCTANE_CONTEXT_PROVIDER";
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
15
42
|
export {
|
|
43
|
+
defineRemovedContextMembers,
|
|
16
44
|
isContext,
|
|
17
45
|
registerContext
|
|
18
46
|
};
|
package/dist/dom-stage.js
CHANGED
|
@@ -485,19 +485,19 @@ class DOMStage {
|
|
|
485
485
|
}
|
|
486
486
|
setFormProperty(node, key, value) {
|
|
487
487
|
if (node.localName === "input" && (key === "checked" || key === "defaultChecked") && this.state(node).type === "radio") {
|
|
488
|
-
const
|
|
489
|
-
const
|
|
490
|
-
Reflect.set(
|
|
491
|
-
for (const [copy, original] of
|
|
488
|
+
const projected = this.projection(node, true);
|
|
489
|
+
const target = projected.node;
|
|
490
|
+
Reflect.set(target, key, value);
|
|
491
|
+
for (const [copy, original] of projected.originals) {
|
|
492
492
|
if (copy.nodeType !== 1 || copy.localName !== "input") continue;
|
|
493
493
|
const input = copy;
|
|
494
|
-
if (input !==
|
|
494
|
+
if (input !== target && (input.type !== "radio" || input.name !== target.name || input.form !== target.form))
|
|
495
495
|
continue;
|
|
496
496
|
this.states.set(original, this.inertDocument(original).importNode(input, false));
|
|
497
497
|
this.values.get(original)?.delete("checked");
|
|
498
498
|
}
|
|
499
499
|
this.projections.clear();
|
|
500
|
-
this.projections.set(
|
|
500
|
+
this.projections.set(projected.root, projected);
|
|
501
501
|
this.enqueue(() => {
|
|
502
502
|
Reflect.set(node, key, value, node);
|
|
503
503
|
});
|
|
@@ -519,20 +519,26 @@ class DOMStage {
|
|
|
519
519
|
} else if (node.localName !== "select" || key !== "value" && key !== "selectedIndex")
|
|
520
520
|
return false;
|
|
521
521
|
if (select === null) return false;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
522
|
+
if (node !== select && this.get(select, "multiple")) {
|
|
523
|
+
const state = this.state(node);
|
|
524
|
+
state.selected = value;
|
|
525
|
+
this.value(node, "selected", state.selected);
|
|
526
|
+
} else {
|
|
527
|
+
const projected = this.projection(select);
|
|
528
|
+
let target = projected.node;
|
|
529
|
+
if (node !== select)
|
|
530
|
+
for (const [copy, original] of projected.originals) {
|
|
531
|
+
if (original === node) {
|
|
532
|
+
target = copy;
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
529
535
|
}
|
|
536
|
+
Reflect.set(target, key, value);
|
|
537
|
+
for (const option of Array.from(projected.node.options)) {
|
|
538
|
+
const original = projected.originals.get(option);
|
|
539
|
+
this.state(original).selected = option.selected;
|
|
540
|
+
this.value(original, "selected", option.selected);
|
|
530
541
|
}
|
|
531
|
-
Reflect.set(target, key, value);
|
|
532
|
-
for (const option of Array.from(projected.node.options)) {
|
|
533
|
-
const original = projected.originals.get(option);
|
|
534
|
-
this.state(original).selected = option.selected;
|
|
535
|
-
this.value(original, "selected", option.selected);
|
|
536
542
|
}
|
|
537
543
|
this.enqueue(() => {
|
|
538
544
|
Reflect.set(node, key, value, node);
|
|
@@ -154,6 +154,11 @@ function formatServerError(code, ...args) {
|
|
|
154
154
|
return formatDevErrorMessage("Unsupported Octane server signal binding ABI.", args);
|
|
155
155
|
case 73:
|
|
156
156
|
return formatDevErrorMessage("Octane DOM bindings require unique list keys.", args);
|
|
157
|
+
case 80:
|
|
158
|
+
return formatDevErrorMessage(
|
|
159
|
+
"Independent Hydrate cannot activate a `%s` strategy because its lexical parent never runs on the client. Use load(), idle(), visible(), media(), interaction(), or never(), or remove `independent`.",
|
|
160
|
+
args
|
|
161
|
+
);
|
|
157
162
|
default:
|
|
158
163
|
return formatUnknownDevErrorMessage(code);
|
|
159
164
|
}
|
package/dist/hydration/idle.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { decodeSignalValue } from "../data-encoding.js";
|
|
2
2
|
import {
|
|
3
3
|
HYDRATE_ID_ATTR,
|
|
4
|
+
HYDRATE_IDLE_TIMEOUT_ATTR,
|
|
5
|
+
HYDRATE_MEDIA_ATTR,
|
|
6
|
+
HYDRATE_VISIBLE_MARGIN_ATTR,
|
|
7
|
+
HYDRATE_VISIBLE_THRESHOLD_ATTR,
|
|
4
8
|
HYDRATE_WHEN_ATTR,
|
|
5
9
|
HYDRATE_INDEPENDENT_ATTR,
|
|
6
10
|
INDEPENDENT_HYDRATE_MANIFEST_ATTR
|
|
@@ -17,6 +21,25 @@ import {
|
|
|
17
21
|
takePendingHydrationIntents,
|
|
18
22
|
unregisterHydrationIntentBoundary
|
|
19
23
|
} from "./event-capture.js";
|
|
24
|
+
import { idle } from "./idle.js";
|
|
25
|
+
import { media } from "./media.js";
|
|
26
|
+
import { visible } from "./visible.js";
|
|
27
|
+
function automaticStrategy(element, when) {
|
|
28
|
+
if (when === "idle") {
|
|
29
|
+
const timeout = element.getAttribute(HYDRATE_IDLE_TIMEOUT_ATTR);
|
|
30
|
+
return idle(timeout === null ? {} : { timeout: Number(timeout) });
|
|
31
|
+
}
|
|
32
|
+
if (when === "visible") {
|
|
33
|
+
const rootMargin = element.getAttribute(HYDRATE_VISIBLE_MARGIN_ATTR);
|
|
34
|
+
const threshold = element.getAttribute(HYDRATE_VISIBLE_THRESHOLD_ATTR);
|
|
35
|
+
return visible({
|
|
36
|
+
...rootMargin === null ? {} : { rootMargin },
|
|
37
|
+
...threshold === null ? {} : { threshold: threshold.split(",").map(Number) }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (when === "media") return media(element.getAttribute(HYDRATE_MEDIA_ATTR) ?? "");
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
20
43
|
function registerIndependentHydrationIsland(element, manifest, registration) {
|
|
21
44
|
if (!isIndependentHydrateManifest(manifest)) {
|
|
22
45
|
throw new TypeError("Invalid independent Hydrate manifest.");
|
|
@@ -34,6 +57,30 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
|
|
|
34
57
|
let paused = false;
|
|
35
58
|
let root;
|
|
36
59
|
const intents = takePendingHydrationIntents(element) ?? [];
|
|
60
|
+
const when = element.getAttribute(HYDRATE_WHEN_ATTR);
|
|
61
|
+
const strategy = automaticStrategy(element, when);
|
|
62
|
+
let triggered = when === "load";
|
|
63
|
+
let disarm;
|
|
64
|
+
const fire = () => {
|
|
65
|
+
triggered = true;
|
|
66
|
+
disarm?.();
|
|
67
|
+
disarm = void 0;
|
|
68
|
+
activate();
|
|
69
|
+
};
|
|
70
|
+
const arm = () => {
|
|
71
|
+
if (triggered || disarm !== void 0 || strategy?._s === void 0) return;
|
|
72
|
+
const cleanup = strategy._s({
|
|
73
|
+
element,
|
|
74
|
+
gate: { resolved: false, resolve: fire }
|
|
75
|
+
});
|
|
76
|
+
if (triggered) cleanup?.();
|
|
77
|
+
else disarm = cleanup ?? (() => {
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const unarm = () => {
|
|
81
|
+
disarm?.();
|
|
82
|
+
disarm = void 0;
|
|
83
|
+
};
|
|
37
84
|
const activate = () => {
|
|
38
85
|
if (disposed || paused || active || hydrated) return;
|
|
39
86
|
active = true;
|
|
@@ -87,12 +134,14 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
|
|
|
87
134
|
return status;
|
|
88
135
|
};
|
|
89
136
|
registerHydrationIntentBoundary(element, boundary);
|
|
90
|
-
|
|
137
|
+
arm();
|
|
138
|
+
if (intents.length !== 0 || triggered) activate();
|
|
91
139
|
return Object.assign(
|
|
92
140
|
() => {
|
|
93
141
|
if (disposed) return;
|
|
94
142
|
disposed = true;
|
|
95
143
|
generation++;
|
|
144
|
+
unarm();
|
|
96
145
|
unregisterHydrationIntentBoundary(element, boundary);
|
|
97
146
|
root?.unmount();
|
|
98
147
|
},
|
|
@@ -100,6 +149,7 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
|
|
|
100
149
|
pause() {
|
|
101
150
|
if (disposed || paused) return;
|
|
102
151
|
paused = true;
|
|
152
|
+
unarm();
|
|
103
153
|
if (!replayReady) {
|
|
104
154
|
generation++;
|
|
105
155
|
active = false;
|
|
@@ -108,7 +158,8 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
|
|
|
108
158
|
resume() {
|
|
109
159
|
if (disposed || !paused) return;
|
|
110
160
|
paused = false;
|
|
111
|
-
|
|
161
|
+
arm();
|
|
162
|
+
if (intents.length || triggered) activate();
|
|
112
163
|
}
|
|
113
164
|
}
|
|
114
165
|
);
|
package/dist/hydration/media.js
CHANGED
|
@@ -35,6 +35,11 @@ export type HydrationStrategy<TWhen extends HydrationWhen = HydrationWhen, TCanP
|
|
|
35
35
|
_s?: (context: HydrationRuntimeContext) => void | (() => void);
|
|
36
36
|
_o?: (id: string) => void;
|
|
37
37
|
_a?: () => HydrationMarkerAttributes | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Authored parameters of a built-in automatic strategy. The server encodes
|
|
40
|
+
* them for an independent boundary, whose parent never re-evaluates `when`.
|
|
41
|
+
*/
|
|
42
|
+
_p?: unknown;
|
|
38
43
|
};
|
|
39
44
|
export type HydrationPrefetchWhen = Exclude<HydrationWhen, 'condition' | 'never' | 'dynamic'>;
|
|
40
45
|
export type HydrationPrefetchStrategy<TWhen extends HydrationPrefetchWhen = HydrationPrefetchWhen> = HydrationStrategy<TWhen, true>;
|
|
@@ -9,6 +9,14 @@ export declare const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
|
|
|
9
9
|
export declare const HYDRATE_ID_ATTR = "data-octane-hydrate-id";
|
|
10
10
|
/** Serialized strategy kind (`visible`, `idle`, `dynamic`, …). */
|
|
11
11
|
export declare const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
|
|
12
|
+
/**
|
|
13
|
+
* Serialized built-in strategy parameters. An independent island reads these
|
|
14
|
+
* because its lexical parent (which evaluated `when`) never runs on the client.
|
|
15
|
+
*/
|
|
16
|
+
export declare const HYDRATE_IDLE_TIMEOUT_ATTR = "data-octane-hydrate-timeout";
|
|
17
|
+
export declare const HYDRATE_VISIBLE_MARGIN_ATTR = "data-octane-hydrate-root-margin";
|
|
18
|
+
export declare const HYDRATE_VISIBLE_THRESHOLD_ATTR = "data-octane-hydrate-threshold";
|
|
19
|
+
export declare const HYDRATE_MEDIA_ATTR = "data-octane-hydrate-media";
|
|
12
20
|
/** Number of `useId()` slots consumed while rendering the deferred child. */
|
|
13
21
|
export declare const HYDRATE_ID_COUNT_ATTR = "data-octane-hydrate-id-count";
|
|
14
22
|
/** Direct-child JSON script carrying this boundary's `use()` seed slice. */
|
|
@@ -4,6 +4,10 @@ const HYDRATE_INPUT_ATTR = "data-octane-input";
|
|
|
4
4
|
const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
|
|
5
5
|
const HYDRATE_ID_ATTR = "data-octane-hydrate-id";
|
|
6
6
|
const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
|
|
7
|
+
const HYDRATE_IDLE_TIMEOUT_ATTR = "data-octane-hydrate-timeout";
|
|
8
|
+
const HYDRATE_VISIBLE_MARGIN_ATTR = "data-octane-hydrate-root-margin";
|
|
9
|
+
const HYDRATE_VISIBLE_THRESHOLD_ATTR = "data-octane-hydrate-threshold";
|
|
10
|
+
const HYDRATE_MEDIA_ATTR = "data-octane-hydrate-media";
|
|
7
11
|
const HYDRATE_ID_COUNT_ATTR = "data-octane-hydrate-id-count";
|
|
8
12
|
const HYDRATE_SEED_ATTR = "data-octane-hydrate-seed";
|
|
9
13
|
const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
|
|
@@ -17,12 +21,16 @@ function formatUseId(prefix, ordinal) {
|
|
|
17
21
|
return ":" + prefix + "in-" + ordinal.toString(36) + ":";
|
|
18
22
|
}
|
|
19
23
|
export {
|
|
24
|
+
HYDRATE_IDLE_TIMEOUT_ATTR,
|
|
20
25
|
HYDRATE_ID_ATTR,
|
|
21
26
|
HYDRATE_ID_COUNT_ATTR,
|
|
22
27
|
HYDRATE_INDEPENDENT_ATTR,
|
|
23
28
|
HYDRATE_INPUT_ATTR,
|
|
24
29
|
HYDRATE_MARKER_SELECTOR,
|
|
30
|
+
HYDRATE_MEDIA_ATTR,
|
|
25
31
|
HYDRATE_SEED_ATTR,
|
|
32
|
+
HYDRATE_VISIBLE_MARGIN_ATTR,
|
|
33
|
+
HYDRATE_VISIBLE_THRESHOLD_ATTR,
|
|
26
34
|
HYDRATE_WHEN_ATTR,
|
|
27
35
|
HYDRATION_END,
|
|
28
36
|
HYDRATION_FOR_ARM_INDEX,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { initializeHydrationEventCapture } from './hydration/event-capture.js';
|
|
|
7
7
|
export { attachBehaviorRoot } from './behavior-root.js';
|
|
8
8
|
export type * from './behavior-root.js';
|
|
9
9
|
export { createSubSlot, subSlot, type SubSlot, type SlotlessSubSlot, type SubSlotOptions, } from './sub-slot.js';
|
|
10
|
-
export { createRoot, hydrateRoot, flushSync, act, isInActScope, type Root, type RootContainer, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, __HydrateCompiled, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, descriptorChildren, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, __hydrateVoidRoot, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evt1e, evt2e, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, isHydratingStyle, setStyle, setStyleProperty, setStyleProperties, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markWarm, markSingleRoot as __s, markChildrenBlock, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, manualHook, invokeManualHook, useBatch, registerWarmPlan, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
|
|
10
|
+
export { createRoot, hydrateRoot, flushSync, act, isInActScope, type Root, type RootContainer, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, __HydrateCompiled, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, descriptorChildren, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, __hydrateVoidRoot, __voidRootProps, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evt1e, evt2e, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, isHydratingStyle, setStyle, setStyleProperty, setStyleProperties, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markWarm, markSingleRoot as __s, markChildrenBlock, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, manualHook, invokeManualHook, useBatch, registerWarmPlan, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
|
|
11
11
|
export type { HydrateOptions, HydrateProps, HydrateWhen, HydrationInteractionEvent, HydrationInteractionEvents, HydrationPrefetchContext, HydrationPrefetchFunction, HydrationPrefetchStrategy, HydrationPrefetchWaitReason, HydrationStrategy, HydrationWhen, } from './hydration/types.js';
|
|
12
12
|
export { __serverRpc } from './server-rpc-client.js';
|
|
13
13
|
export { ServerCallUncertainError } from './server-rpc-protocol.js';
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
__useReducerWithGetter,
|
|
73
73
|
__createVoidRoot,
|
|
74
74
|
__hydrateVoidRoot,
|
|
75
|
+
__voidRootProps,
|
|
75
76
|
bindRendererRegionOwner,
|
|
76
77
|
EXTERNAL_HYDRATION_PROMISE,
|
|
77
78
|
HYDRATION_RANGE_BOUNDARY,
|
|
@@ -252,6 +253,7 @@ export {
|
|
|
252
253
|
__useLinkedStateWithGetter,
|
|
253
254
|
__useReducerWithGetter,
|
|
254
255
|
__useStateWithGetter,
|
|
256
|
+
__voidRootProps,
|
|
255
257
|
__vtSeen,
|
|
256
258
|
act,
|
|
257
259
|
activityBlock,
|
package/dist/runtime.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ import { validateNativeReadWitness, type NativeReadWitness } from './signals/nat
|
|
|
24
24
|
import { type NativeReadRetry } from './signals/native-read-retry.js';
|
|
25
25
|
import type { SignalActionFrame } from './signals/transition-action.js';
|
|
26
26
|
import { setNativeAdoptionResolver } from './signals/read-protocol.js';
|
|
27
|
-
import { type DiagnosticSignalInitializer } from './signals/diagnostic-local-hook.js';
|
|
28
27
|
import { type NativeAdoptionState } from './signals/native-read-seeds.js';
|
|
29
28
|
export { documentSignalOwner, installStreamedSignalOwnerActivator, } from './signals/document-owner.js';
|
|
30
29
|
import { type SignalHandle, type SignalOwner, type SignalRendererOwnerIdentity } from './signals/types.js';
|
|
@@ -195,6 +194,12 @@ interface SignalRetryOwners {
|
|
|
195
194
|
}
|
|
196
195
|
/** @internal Compiler/runtime module-signal capability version 1. */
|
|
197
196
|
export declare function enableSignalBindings(abi?: number, potentialOnly?: boolean): void;
|
|
197
|
+
interface OpaqueSignalKeys {
|
|
198
|
+
objects: WeakMap<object, number>;
|
|
199
|
+
symbols: Map<symbol, number>;
|
|
200
|
+
used: Set<number>;
|
|
201
|
+
next: number;
|
|
202
|
+
}
|
|
198
203
|
export { readNativeDomStyle, readNativeDomProps } from './signals/read-protocol.js';
|
|
199
204
|
/**
|
|
200
205
|
* A style binding owns reads in a normal scheduled Block, but owns no DOM range.
|
|
@@ -202,7 +207,7 @@ export { readNativeDomStyle, readNativeDomProps } from './signals/read-protocol.
|
|
|
202
207
|
* read driver keeps speculative subscriptions, errors, and adoption transactional.
|
|
203
208
|
* @internal
|
|
204
209
|
*/
|
|
205
|
-
export declare function nativeStyleBinding(owner: Scope, slotIndex: number, el: HTMLElement | SVGElement, value: any): void;
|
|
210
|
+
export declare function nativeStyleBinding(owner: Scope, slotIndex: number, el: HTMLElement | SVGElement, value: any, literal?: 1): void;
|
|
206
211
|
interface NativeProjectionProps {
|
|
207
212
|
el: HTMLElement | SVGElement;
|
|
208
213
|
compute: () => Record<string, unknown> | null | undefined;
|
|
@@ -232,6 +237,7 @@ interface RootIdState {
|
|
|
232
237
|
signalState?: {
|
|
233
238
|
prefix: string;
|
|
234
239
|
next: number;
|
|
240
|
+
opaqueKeys?: Map<string, OpaqueSignalKeys>;
|
|
235
241
|
};
|
|
236
242
|
/** Shared render ownership; descendants already carry this root-local record. */
|
|
237
243
|
renderOwner?: RootRenderOwner;
|
|
@@ -825,10 +831,8 @@ export declare function manualHook<F extends (...args: any[]) => any>(fn: F, nam
|
|
|
825
831
|
/** Invoke a cached optional-chain method without consulting its call/bind properties. */
|
|
826
832
|
export declare function callWithReceiver<T>(fn: (...args: any[]) => T, receiver: unknown, ...args: any[]): T;
|
|
827
833
|
export declare function withSlot<T>(sym: symbol, fn: (...a: any[]) => T, ...args: any[]): T;
|
|
828
|
-
/** @internal Built-in adapters are allocated only during historical comparison. */
|
|
829
|
-
export declare function isNativeSignalDiagnosticProbe(): boolean;
|
|
830
834
|
/** @internal Optional native hooks use the existing compiler slot and Scope lifetime. */
|
|
831
|
-
export declare function nativeLocalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: HookSlot
|
|
835
|
+
export declare function nativeLocalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: HookSlot): T;
|
|
832
836
|
interface StateSlot<T> {
|
|
833
837
|
value: T;
|
|
834
838
|
setter: (next: T | ((prev: T) => T)) => void;
|
|
@@ -1025,36 +1029,6 @@ export declare function descriptorChildren<T>(component: T): T;
|
|
|
1025
1029
|
* `<C><D/></C>` (render it): `typeof children === 'function' && !isChildrenBlock(children)`.
|
|
1026
1030
|
*/
|
|
1027
1031
|
export declare function isChildrenBlock(value: unknown): boolean;
|
|
1028
|
-
type HydrateLoadResult = ComponentBody | {
|
|
1029
|
-
default: ComponentBody;
|
|
1030
|
-
};
|
|
1031
|
-
type InternalHydrateProps = HydrateProps & {
|
|
1032
|
-
/** Compiler-injected split-child loader. */
|
|
1033
|
-
__load?: () => Promise<HydrateLoadResult>;
|
|
1034
|
-
/** Latest lexical values consumed by the compiler-generated split child. */
|
|
1035
|
-
__data?: unknown[];
|
|
1036
|
-
/** Compiler-owned independent island descriptor; the document bootstrap owns activation. */
|
|
1037
|
-
__independent?: unknown;
|
|
1038
|
-
/** Bundler graph edge only. Runtime must never evaluate the lexical parent through it. */
|
|
1039
|
-
__independentLoad?: () => Promise<unknown>;
|
|
1040
|
-
};
|
|
1041
|
-
interface HydrateAttributeSnapshot {
|
|
1042
|
-
props: InternalHydrateProps;
|
|
1043
|
-
ids: RootIdState;
|
|
1044
|
-
contexts: Map<Context<any>, any> | null;
|
|
1045
|
-
}
|
|
1046
|
-
interface InitialHydrateAttribute {
|
|
1047
|
-
server: string | null;
|
|
1048
|
-
next: string | null;
|
|
1049
|
-
suppressed: boolean;
|
|
1050
|
-
checked: boolean;
|
|
1051
|
-
}
|
|
1052
|
-
interface HydrateAttributeProbe {
|
|
1053
|
-
document: Document;
|
|
1054
|
-
originals: WeakMap<Element, Element>;
|
|
1055
|
-
attributes: WeakMap<Element, Map<string, InitialHydrateAttribute>>;
|
|
1056
|
-
boundaries: WeakMap<Element, HydrateAttributeSnapshot>;
|
|
1057
|
-
}
|
|
1058
1032
|
export declare const Hydrate: ComponentBody<HydrateProps>;
|
|
1059
1033
|
/** Compiler-owned template children with no authored fallback; never a descriptor entry point. */
|
|
1060
1034
|
export declare const __HydrateCompiled: ComponentBody<HydrateProps>;
|
|
@@ -1335,7 +1309,8 @@ declare class HydrationCapability {
|
|
|
1335
1309
|
rootBlock: Block;
|
|
1336
1310
|
node: Node | null;
|
|
1337
1311
|
seeds: unknown[] | null;
|
|
1338
|
-
|
|
1312
|
+
/** Parent captures changed before this dormant boundary activated. */
|
|
1313
|
+
staleServerValues: boolean;
|
|
1339
1314
|
depth: number;
|
|
1340
1315
|
seedCursor: number;
|
|
1341
1316
|
hasAdjacentRangePair: boolean;
|
|
@@ -1527,7 +1502,8 @@ declare const DIRECT_SIGNAL_BINDING: unique symbol;
|
|
|
1527
1502
|
/** @internal Invalidate scalar-view caches when hydration retained a claimed publication. */
|
|
1528
1503
|
export declare function hydrateClaimedBindingCaches(scope: Scope, fields: readonly (string | number)[]): void;
|
|
1529
1504
|
type DirectSignalBindingKind = 'text' | 'textOnlyChild' | 'attribute' | 'value' | 'checked';
|
|
1530
|
-
type
|
|
1505
|
+
type DirectSignalAttributeWriter = (el: Element, name: string, value: unknown) => void;
|
|
1506
|
+
type DirectSignalAttributeKind = 'class' | DirectSignalAttributeWriter;
|
|
1531
1507
|
interface DirectSignalBindingPolicy {
|
|
1532
1508
|
readonly kind: DirectSignalBindingKind;
|
|
1533
1509
|
readonly writeBinding: (binding: DirectSignalBinding, value: unknown) => void;
|
|
@@ -1535,6 +1511,7 @@ interface DirectSignalBindingPolicy {
|
|
|
1535
1511
|
readonly control?: {
|
|
1536
1512
|
validateNew: (scope: Scope, target: Node, kind: DirectSignalBindingKind) => void;
|
|
1537
1513
|
snapshot: (target: Node, site: string) => ReturnType<typeof snapshotHydrationControl>;
|
|
1514
|
+
restored: (target: Node, value: unknown) => boolean;
|
|
1538
1515
|
activate: (binding: DirectSignalBinding, revision: number) => void;
|
|
1539
1516
|
adopt: (binding: DirectSignalBinding) => void;
|
|
1540
1517
|
};
|
|
@@ -1559,7 +1536,7 @@ interface DirectSignalBinding {
|
|
|
1559
1536
|
/** @internal Compiler target for a direct signal/scalar text binding. */
|
|
1560
1537
|
export declare function bindSignalText(scope: Scope, previous: unknown, position: Node, value: unknown, site: string, onlyChild?: boolean, seededText?: 1 | undefined, bindingMarker?: string, previousValue?: unknown): unknown;
|
|
1561
1538
|
/** @internal Compiler target for a direct signal/scalar attribute binding. */
|
|
1562
|
-
export declare function bindSignalAttribute(scope: Scope, previous: unknown, element: Element, name: string, value: unknown, site: string, attributeKind
|
|
1539
|
+
export declare function bindSignalAttribute(scope: Scope, previous: unknown, element: Element, name: string, value: unknown, site: string, attributeKind: DirectSignalAttributeKind): unknown;
|
|
1563
1540
|
/** @internal Compiler target for a direct signal/scalar value binding. */
|
|
1564
1541
|
export declare function bindSignalValue(scope: Scope, previous: unknown, element: Element, value: unknown, site: string): unknown;
|
|
1565
1542
|
/** @internal Compiler target for a direct signal/scalar checked binding. */
|
|
@@ -2318,6 +2295,7 @@ export declare function activityBlock(parentScope: Scope, slotKey: number, domPa
|
|
|
2318
2295
|
export declare function switchBlock(parentScope: Scope, slotKey: number, domParent: Node, discriminant: any, cases: ReadonlyArray<readonly [test: any, body: ComponentBody]>, defaultBody: ComponentBody | null, anchor?: Node | null, env?: any[]): void;
|
|
2319
2296
|
interface ForSlot {
|
|
2320
2297
|
__kind: 'forBlockSlot';
|
|
2298
|
+
signalSite: string | undefined;
|
|
2321
2299
|
start: Comment;
|
|
2322
2300
|
end: Comment;
|
|
2323
2301
|
items: Map<any, Block>;
|
|
@@ -2335,13 +2313,13 @@ interface ForSlot {
|
|
|
2335
2313
|
plainDeopt: boolean;
|
|
2336
2314
|
selectionItems: ArrayLike<any> | undefined;
|
|
2337
2315
|
}
|
|
2338
|
-
export declare function forBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, inputItems: ArrayLike<T> | Iterable<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags?: number, deps?: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean): void;
|
|
2316
|
+
export declare function forBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, inputItems: ArrayLike<T> | Iterable<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags?: number, deps?: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean, signalSite?: string): void;
|
|
2339
2317
|
/**
|
|
2340
2318
|
* Compiler-only keyed-selection entry. Keeping the specialization outside
|
|
2341
2319
|
* forBlock lets applications without a proven selection tree-shake its cost.
|
|
2342
2320
|
* This entry point identifies the proof; bits 6+ hold its dependency index.
|
|
2343
2321
|
*/
|
|
2344
|
-
export declare function keyedForBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, items: ArrayLike<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags: number, deps: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean, selectionBody?: ComponentBody<T, any[]
|
|
2322
|
+
export declare function keyedForBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, items: ArrayLike<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags: number, deps: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean, selectionBody?: ComponentBody<T, any[]>, signalSite?: string): void;
|
|
2345
2323
|
/** Compiler-only direct host-row entry; ordinary list bundles do not retain it. */
|
|
2346
2324
|
export declare function fastForBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, items: ArrayLike<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags?: number, deps?: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean): void;
|
|
2347
2325
|
/** Direct host-row mounts composed with the independent keyed-selection proof. */
|
|
@@ -2425,6 +2403,13 @@ export declare function devHtmlNesting(childTag: string, ancestors: string[], ch
|
|
|
2425
2403
|
export declare function createRoot(container: RootContainer, options?: RootOptions): Root;
|
|
2426
2404
|
/** Compiler-only root for a statically proven void `@{}` entry component. */
|
|
2427
2405
|
export declare function __createVoidRoot(container: RootContainer, options?: RootOptions): Root;
|
|
2406
|
+
/**
|
|
2407
|
+
* Compiler-only props for a proven void root's keyless, childless
|
|
2408
|
+
* `<Component ... />` target. `root.render(Component, props)` then matches the
|
|
2409
|
+
* descriptor the element would build, including live `defaultProps`, without
|
|
2410
|
+
* the general element constructor's renderer-context graph.
|
|
2411
|
+
*/
|
|
2412
|
+
export declare function __voidRootProps(type: ComponentBody, props: any): any;
|
|
2428
2413
|
/**
|
|
2429
2414
|
* Hydrate a server-rendered container and return a live {@link Root} — the
|
|
2430
2415
|
* React-18 `hydrateRoot(container, element)` shape (container FIRST). Instead of
|