octane 0.2.12 → 0.2.13
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/README.md +5 -0
- package/dist/behavior-root.d.ts +13 -3
- package/dist/behavior-root.js +28 -5
- package/dist/cjs/behavior-root.cjs +32 -6
- package/dist/cjs/class-names.cjs +49 -0
- package/dist/cjs/constants.cjs +9 -0
- package/dist/cjs/css.cjs +6 -27
- package/dist/cjs/data-encoding.cjs +160 -0
- package/dist/cjs/dom-binding-handoff.cjs +93 -0
- package/dist/cjs/dom-binding-protocol.cjs +115 -0
- package/dist/cjs/dom-binding-styles.cjs +292 -0
- package/dist/cjs/dom-bindings.cjs +700 -0
- package/dist/cjs/dom-focused-move.cjs +66 -0
- package/dist/cjs/dom-tables.cjs +4 -94
- package/dist/cjs/error-codes.client.generated.cjs +33 -0
- package/dist/cjs/error-codes.server.generated.cjs +19 -0
- package/dist/cjs/hydration/control-capture.cjs +244 -0
- package/dist/cjs/hydration/event-capture.cjs +125 -43
- package/dist/cjs/hydration/interaction-config.cjs +50 -2
- package/dist/cjs/hydration-markers.cjs +37 -0
- package/dist/cjs/independent-hydration-protocol.cjs +106 -0
- package/dist/cjs/index.cjs +6 -0
- package/dist/cjs/runtime.cjs +2791 -215
- package/dist/cjs/runtime.server.cjs +716 -76
- package/dist/cjs/server/early-signals.cjs +45 -0
- package/dist/cjs/server/index.cjs +44 -0
- package/dist/cjs/server/rpc-batch.cjs +149 -0
- package/dist/cjs/server/rpc-stream.cjs +146 -0
- package/dist/cjs/server/rpc.cjs +34 -15
- package/dist/cjs/server/signal-query-observation.cjs +158 -0
- package/dist/cjs/server/streamed-region.cjs +52 -0
- package/dist/cjs/server/streamed-signals.cjs +512 -0
- package/dist/cjs/server-call.cjs +103 -0
- package/dist/cjs/server-rpc-batch-client.cjs +141 -0
- package/dist/cjs/server-rpc-client.cjs +94 -27
- package/dist/cjs/server-rpc-protocol.cjs +141 -0
- package/dist/cjs/server-rpc-stream-client.cjs +118 -0
- package/dist/cjs/signals/actions.cjs +474 -0
- package/dist/cjs/signals/client.cjs +4 -1
- package/dist/cjs/signals/computations.cjs +460 -0
- package/dist/cjs/signals/control-binding.cjs +368 -0
- package/dist/cjs/signals/derived-facade.cjs +50 -0
- package/dist/cjs/signals/document-owner.cjs +71 -0
- package/dist/cjs/signals/early-values.cjs +155 -0
- package/dist/cjs/signals/encoding.cjs +6 -95
- package/dist/cjs/signals/engine.cjs +276 -12
- package/dist/cjs/signals/errors.cjs +18 -0
- package/dist/cjs/signals/facade.cjs +477 -0
- package/dist/cjs/signals/graph.cjs +163 -20
- package/dist/cjs/signals/handle-protocol.cjs +36 -0
- package/dist/cjs/signals/index.cjs +81 -2
- package/dist/cjs/signals/native-read-client.cjs +10 -0
- package/dist/cjs/signals/owner-context.cjs +112 -0
- package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
- package/dist/cjs/signals/query-facade.cjs +72 -0
- package/dist/cjs/signals/read-protocol.cjs +32 -0
- package/dist/cjs/signals/requests.cjs +287 -14
- package/dist/cjs/signals/scalar-computations.cjs +76 -0
- package/dist/cjs/signals/server.cjs +4 -1
- package/dist/cjs/signals/transition-candidate.cjs +567 -0
- package/dist/cjs/signals/transition-state.cjs +106 -0
- package/dist/cjs/signals/types.cjs +50 -0
- package/dist/cjs/stream-protocol.cjs +3 -0
- package/dist/cjs/streamed-signals-protocol.cjs +159 -0
- package/dist/cjs/style-values.cjs +122 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/class-names.d.ts +5 -0
- package/dist/class-names.js +25 -0
- package/dist/compiler/bundler.js +34 -6
- package/dist/compiler/compile.js +2234 -559
- package/dist/compiler/dom-binding-program.js +935 -0
- package/dist/compiler/dom-binding-request.js +57 -0
- package/dist/compiler/dom-bindings.js +2245 -0
- package/dist/compiler/hook-deps.js +26 -0
- package/dist/compiler/hydrate-boundaries.js +358 -15
- package/dist/compiler/index.d.ts +38 -1
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/native-attribute-reads.js +127 -0
- package/dist/compiler/native-read-diagnostics.js +48 -9
- package/dist/compiler/native-read-types.js +55 -32
- package/dist/compiler/server-context.js +118 -0
- package/dist/compiler/signal-attempt-reads.js +479 -0
- package/dist/compiler/signal-declarations.js +557 -0
- package/dist/compiler/signal-start-reads.js +413 -0
- package/dist/compiler/slot-hooks.js +57 -10
- package/dist/compiler/template-ir.js +200 -0
- package/dist/compiler/typescript.d.ts +2 -0
- package/dist/compiler/typescript.js +2 -0
- package/dist/compiler/vite.d.ts +3 -1
- package/dist/compiler/vite.js +122 -4
- package/dist/compiler/volar.d.ts +6 -1
- package/dist/compiler/volar.js +674 -143
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +10 -0
- package/dist/css.d.ts +2 -5
- package/dist/css.js +2 -23
- package/dist/data-encoding.d.ts +9 -0
- package/dist/data-encoding.js +134 -0
- package/dist/dom-binding-classes.d.ts +15 -0
- package/dist/dom-binding-classes.js +129 -0
- package/dist/dom-binding-controls.d.ts +2 -0
- package/dist/dom-binding-controls.js +6 -0
- package/dist/dom-binding-handoff.d.ts +55 -0
- package/dist/dom-binding-handoff.js +62 -0
- package/dist/dom-binding-program.d.ts +300 -0
- package/dist/dom-binding-program.js +1625 -0
- package/dist/dom-binding-projections.d.ts +15 -0
- package/dist/dom-binding-projections.js +187 -0
- package/dist/dom-binding-protocol.d.ts +13 -0
- package/dist/dom-binding-protocol.js +88 -0
- package/dist/dom-binding-signals.d.ts +21 -0
- package/dist/dom-binding-signals.js +109 -0
- package/dist/dom-binding-styles.d.ts +17 -0
- package/dist/dom-binding-styles.js +272 -0
- package/dist/dom-bindings.d.ts +89 -0
- package/dist/dom-bindings.js +670 -0
- package/dist/dom-focused-move.d.ts +6 -0
- package/dist/dom-focused-move.js +42 -0
- package/dist/dom-tables.d.ts +1 -3
- package/dist/dom-tables.js +1 -91
- package/dist/error-codes.client.generated.d.ts +9 -0
- package/dist/error-codes.client.generated.js +33 -0
- package/dist/error-codes.server.generated.d.ts +5 -0
- package/dist/error-codes.server.generated.js +19 -0
- package/dist/hydration/control-capture.d.ts +62 -0
- package/dist/hydration/control-capture.js +223 -0
- package/dist/hydration/document-lifecycle.d.ts +23 -0
- package/dist/hydration/document-lifecycle.js +80 -0
- package/dist/hydration/event-capture.d.ts +20 -1
- package/dist/hydration/event-capture.js +128 -42
- package/dist/hydration/independent-island.d.ts +45 -0
- package/dist/hydration/independent-island.js +233 -0
- package/dist/hydration/index.d.ts +8 -1
- package/dist/hydration/index.js +55 -1
- package/dist/hydration/interaction-config.d.ts +5 -0
- package/dist/hydration/interaction-config.js +44 -1
- package/dist/hydration/stream-delivery.d.ts +32 -0
- package/dist/hydration/stream-delivery.js +333 -0
- package/dist/hydration/stream-receiver.d.ts +26 -0
- package/dist/hydration/stream-receiver.js +204 -0
- package/dist/hydration/stream-result-receiver.d.ts +70 -0
- package/dist/hydration/stream-result-receiver.js +246 -0
- package/dist/hydration/streamed-signals.d.ts +44 -0
- package/dist/hydration/streamed-signals.js +186 -0
- package/dist/hydration/types.d.ts +6 -0
- package/dist/hydration-markers.d.ts +7 -0
- package/dist/hydration-markers.js +10 -0
- package/dist/independent-hydration-protocol.d.ts +31 -0
- package/dist/independent-hydration-protocol.js +80 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/internal/signal-read.d.ts +1 -0
- package/dist/internal/signal-read.js +4 -0
- package/dist/jsx-runtime.d.ts +45 -6
- package/dist/public-types.d.ts +15 -1
- package/dist/runtime.d.ts +259 -21
- package/dist/runtime.js +2812 -220
- package/dist/runtime.server.d.ts +86 -6
- package/dist/runtime.server.js +712 -76
- package/dist/server/early-signals.d.ts +14 -0
- package/dist/server/early-signals.js +34 -0
- package/dist/server/index.d.ts +10 -2
- package/dist/server/index.js +48 -1
- package/dist/server/rpc-batch.d.ts +17 -0
- package/dist/server/rpc-batch.js +129 -0
- package/dist/server/rpc-stream.d.ts +9 -0
- package/dist/server/rpc-stream.js +125 -0
- package/dist/server/rpc.d.ts +5 -1
- package/dist/server/rpc.js +37 -13
- package/dist/server/signal-query-observation.d.ts +3 -0
- package/dist/server/signal-query-observation.js +134 -0
- package/dist/server/streamed-region.d.ts +15 -0
- package/dist/server/streamed-region.js +30 -0
- package/dist/server/streamed-signals.d.ts +45 -0
- package/dist/server/streamed-signals.js +488 -0
- package/dist/server-call.d.ts +41 -0
- package/dist/server-call.js +75 -0
- package/dist/server-rpc-batch-client.d.ts +7 -0
- package/dist/server-rpc-batch-client.js +119 -0
- package/dist/server-rpc-client.d.ts +3 -1
- package/dist/server-rpc-client.js +99 -27
- package/dist/server-rpc-protocol.d.ts +47 -0
- package/dist/server-rpc-protocol.js +109 -0
- package/dist/server-rpc-stream-client.d.ts +5 -0
- package/dist/server-rpc-stream-client.js +98 -0
- package/dist/signals/actions.d.ts +12 -0
- package/dist/signals/actions.js +466 -0
- package/dist/signals/client.d.ts +2 -0
- package/dist/signals/client.js +1 -0
- package/dist/signals/computations.d.ts +37 -0
- package/dist/signals/computations.js +455 -0
- package/dist/signals/control-binding.d.ts +31 -0
- package/dist/signals/control-binding.js +353 -0
- package/dist/signals/derived-facade.d.ts +3 -0
- package/dist/signals/derived-facade.js +25 -0
- package/dist/signals/document-owner.d.ts +10 -0
- package/dist/signals/document-owner.js +43 -0
- package/dist/signals/early-values.d.ts +24 -0
- package/dist/signals/early-values.js +124 -0
- package/dist/signals/encoding.d.ts +1 -3
- package/dist/signals/encoding.js +3 -93
- package/dist/signals/engine.d.ts +53 -4
- package/dist/signals/engine.js +275 -16
- package/dist/signals/errors.d.ts +7 -0
- package/dist/signals/errors.js +16 -0
- package/dist/signals/facade.d.ts +74 -0
- package/dist/signals/facade.js +452 -0
- package/dist/signals/graph.d.ts +50 -5
- package/dist/signals/graph.js +170 -19
- package/dist/signals/handle-protocol.d.ts +4 -0
- package/dist/signals/handle-protocol.js +11 -0
- package/dist/signals/index.d.ts +12 -3
- package/dist/signals/index.js +71 -2
- package/dist/signals/native-read-client.d.ts +3 -0
- package/dist/signals/native-read-client.js +10 -0
- package/dist/signals/owner-context.d.ts +22 -0
- package/dist/signals/owner-context.js +77 -0
- package/dist/signals/query-attempt-observer.d.ts +49 -0
- package/dist/signals/query-attempt-observer.js +41 -0
- package/dist/signals/query-facade.d.ts +3 -0
- package/dist/signals/query-facade.js +49 -0
- package/dist/signals/read-protocol.d.ts +32 -3
- package/dist/signals/read-protocol.js +26 -0
- package/dist/signals/requests.d.ts +38 -5
- package/dist/signals/requests.js +298 -15
- package/dist/signals/scalar-computations.d.ts +2 -0
- package/dist/signals/scalar-computations.js +60 -0
- package/dist/signals/server.d.ts +2 -0
- package/dist/signals/server.js +1 -0
- package/dist/signals/transition-candidate.d.ts +71 -0
- package/dist/signals/transition-candidate.js +557 -0
- package/dist/signals/transition-state.d.ts +51 -0
- package/dist/signals/transition-state.js +70 -0
- package/dist/signals/types.d.ts +95 -5
- package/dist/signals/types.js +20 -0
- package/dist/stream-protocol.d.ts +0 -5
- package/dist/stream-protocol.js +3 -0
- package/dist/streamed-signals-protocol.d.ts +60 -0
- package/dist/streamed-signals-protocol.js +130 -0
- package/dist/style-values.d.ts +3 -0
- package/dist/style-values.js +96 -0
- package/dist/version.js +1 -1
- package/package.json +37 -1
package/README.md
CHANGED
|
@@ -45,6 +45,11 @@ interactions and disposable behavior without creating a component root or
|
|
|
45
45
|
taking ownership of the existing markup. See the
|
|
46
46
|
[external ownership guide](https://github.com/octanejs/octane/blob/main/docs/deferred-hydration.md#behavior-only-roots-and-external-ownership).
|
|
47
47
|
|
|
48
|
+
For fixed native presentation, the experimental compiler-backed `adoptBindings`
|
|
49
|
+
API updates declared properties on existing SSR nodes without importing the
|
|
50
|
+
renderer. See [compiled DOM bindings](https://github.com/octanejs/octane/blob/main/docs/deferred-hydration.md#compiled-presentation-on-existing-dom)
|
|
51
|
+
for explicit template eligibility, typed activation and lifetime ownership.
|
|
52
|
+
|
|
48
53
|
For the full story, see the
|
|
49
54
|
[main README](https://github.com/octanejs/octane#readme).
|
|
50
55
|
|
package/dist/behavior-root.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { adoptBindings, mountBindings, unbound } from './dom-bindings.js';
|
|
2
|
+
export type { BindingSource, BindingOptions, BindingHandle } from './dom-bindings.js';
|
|
3
|
+
export type { BindingRange, BindingMountTarget } from './dom-binding-program.js';
|
|
1
4
|
/** A behavior-only root observes existing DOM without taking reconciliation ownership. */
|
|
2
5
|
export interface BehaviorRootOptions {
|
|
3
6
|
/** Dispose this root when the enclosing page or document lifetime ends. */
|
|
@@ -34,18 +37,25 @@ export interface BehaviorContext {
|
|
|
34
37
|
readonly range?: ExternalRange;
|
|
35
38
|
}
|
|
36
39
|
export type BehaviorCleanup = () => void;
|
|
37
|
-
export interface BehaviorEntry {
|
|
40
|
+
export interface BehaviorEntry<Payload = unknown> {
|
|
38
41
|
id?: string;
|
|
39
42
|
target: string | Element;
|
|
40
43
|
/** Restrict adoption to the closest range belonging to this exact owner. */
|
|
41
44
|
owner?: unknown;
|
|
42
45
|
events?: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* Synchronously capture detached, immutable command arguments on the original
|
|
48
|
+
* native event, before readiness or adoption. Register eagerly; this cannot
|
|
49
|
+
* recover values from interactions that happened before registration.
|
|
50
|
+
* May preventDefault(), but must not return live DOM/state or a promise.
|
|
51
|
+
*/
|
|
52
|
+
captureEvent?(event: Event, element: Element): Payload;
|
|
43
53
|
ready?: PromiseLike<unknown>;
|
|
44
54
|
dependencies?: readonly string[];
|
|
45
55
|
conflicts?: readonly string[];
|
|
46
56
|
signal?: AbortSignal;
|
|
47
57
|
adopt(element: Element, context: BehaviorContext): void | BehaviorCleanup | PromiseLike<void | BehaviorCleanup>;
|
|
48
|
-
handleEvent?(event: Event, element: Element, context: BehaviorContext): void;
|
|
58
|
+
handleEvent?(event: Event, element: Element, context: BehaviorContext, payload: Payload): void;
|
|
49
59
|
}
|
|
50
60
|
export interface BehaviorRegistration {
|
|
51
61
|
readonly id?: string;
|
|
@@ -59,7 +69,7 @@ export interface BehaviorRoot {
|
|
|
59
69
|
/** A snapshot of currently active ranges, registrations, and asynchronous adoptions. */
|
|
60
70
|
readonly ready: Promise<void>;
|
|
61
71
|
registerExternalRange(element: Element, options: ExternalRangeOptions): ExternalRange;
|
|
62
|
-
registerBehavior(entry: BehaviorEntry): BehaviorRegistration;
|
|
72
|
+
registerBehavior<Payload = unknown>(entry: BehaviorEntry<Payload>): BehaviorRegistration;
|
|
63
73
|
dispose(options?: BehaviorDisposeOptions): void;
|
|
64
74
|
}
|
|
65
75
|
/**
|
package/dist/behavior-root.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { adoptBindings, mountBindings, unbound } from "./dom-bindings.js";
|
|
1
2
|
const documentRegistries = /* @__PURE__ */ new WeakMap();
|
|
2
3
|
const CANCELED = /* @__PURE__ */ Symbol("octane.behavior.canceled");
|
|
3
4
|
function createReadiness() {
|
|
@@ -149,14 +150,14 @@ function disposeAdoption(adoption) {
|
|
|
149
150
|
cleanup?.();
|
|
150
151
|
}
|
|
151
152
|
function flushQueuedEvents(record) {
|
|
152
|
-
if (record.status !== "active") return;
|
|
153
|
+
if (record.status !== "active" || record.captureDepth) return;
|
|
153
154
|
const queue = record.queuedEvents;
|
|
154
155
|
record.queuedEventFlushDepth++;
|
|
155
156
|
try {
|
|
156
157
|
while (record.queuedEventHead < queue.length) {
|
|
157
158
|
const index = record.queuedEventHead;
|
|
158
159
|
const queued = queue[index];
|
|
159
|
-
if (!contains(record.root, queued.element)) {
|
|
160
|
+
if (queued.payload === CANCELED || !contains(record.root, queued.element)) {
|
|
160
161
|
record.queuedEventHead = index + 1;
|
|
161
162
|
continue;
|
|
162
163
|
}
|
|
@@ -176,7 +177,8 @@ function flushQueuedEvents(record) {
|
|
|
176
177
|
record.entry.handleEvent?.(
|
|
177
178
|
queued.event,
|
|
178
179
|
queued.element,
|
|
179
|
-
adoptionContext(adoption, queued.event)
|
|
180
|
+
adoptionContext(adoption, queued.event),
|
|
181
|
+
queued.payload
|
|
180
182
|
);
|
|
181
183
|
}
|
|
182
184
|
} finally {
|
|
@@ -342,6 +344,24 @@ function handleDelegatedEvent(root, event) {
|
|
|
342
344
|
if (matched === null || !contains(root, matched)) continue;
|
|
343
345
|
const range = nearestRange(root, matched);
|
|
344
346
|
if (!rangeMatches(record, range)) continue;
|
|
347
|
+
if (record.entry.captureEvent !== void 0) {
|
|
348
|
+
const queued = { event, element: matched, range, payload: CANCELED };
|
|
349
|
+
record.queuedEvents.push(queued);
|
|
350
|
+
if (range?.status === "pending") record.waitingRanges.add(range);
|
|
351
|
+
record.captureDepth = (record.captureDepth ?? 0) + 1;
|
|
352
|
+
try {
|
|
353
|
+
const payload = record.entry.captureEvent(event, matched);
|
|
354
|
+
if (!record.controller.signal.aborted && contains(root, matched) && matchesTarget(record, matched) && nearestRange(root, matched) === range)
|
|
355
|
+
queued.payload = payload;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
failBehavior(record, error);
|
|
358
|
+
throw error;
|
|
359
|
+
} finally {
|
|
360
|
+
record.captureDepth--;
|
|
361
|
+
}
|
|
362
|
+
flushQueuedEvents(record);
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
345
365
|
if (record.status !== "active" || range?.status === "pending") {
|
|
346
366
|
record.queuedEvents.push({ event, element: matched, range });
|
|
347
367
|
if (range?.status === "pending") record.waitingRanges.add(range);
|
|
@@ -353,7 +373,7 @@ function handleDelegatedEvent(root, event) {
|
|
|
353
373
|
flushQueuedEvents(record);
|
|
354
374
|
continue;
|
|
355
375
|
}
|
|
356
|
-
record.entry.handleEvent?.(event, matched, adoptionContext(adoption, event));
|
|
376
|
+
record.entry.handleEvent?.(event, matched, adoptionContext(adoption, event), void 0);
|
|
357
377
|
}
|
|
358
378
|
}
|
|
359
379
|
function installListeners(root, events) {
|
|
@@ -710,5 +730,8 @@ function attachBehaviorRoot(container, options = {}) {
|
|
|
710
730
|
return root;
|
|
711
731
|
}
|
|
712
732
|
export {
|
|
713
|
-
|
|
733
|
+
adoptBindings,
|
|
734
|
+
attachBehaviorRoot,
|
|
735
|
+
mountBindings,
|
|
736
|
+
unbound
|
|
714
737
|
};
|
|
@@ -18,9 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var behavior_root_exports = {};
|
|
20
20
|
__export(behavior_root_exports, {
|
|
21
|
-
|
|
21
|
+
adoptBindings: () => import_dom_bindings.adoptBindings,
|
|
22
|
+
attachBehaviorRoot: () => attachBehaviorRoot,
|
|
23
|
+
mountBindings: () => import_dom_bindings.mountBindings,
|
|
24
|
+
unbound: () => import_dom_bindings.unbound
|
|
22
25
|
});
|
|
23
26
|
module.exports = __toCommonJS(behavior_root_exports);
|
|
27
|
+
var import_dom_bindings = require("./dom-bindings.cjs");
|
|
24
28
|
const documentRegistries = /* @__PURE__ */ new WeakMap();
|
|
25
29
|
const CANCELED = /* @__PURE__ */ Symbol("octane.behavior.canceled");
|
|
26
30
|
function createReadiness() {
|
|
@@ -172,14 +176,14 @@ function disposeAdoption(adoption) {
|
|
|
172
176
|
cleanup?.();
|
|
173
177
|
}
|
|
174
178
|
function flushQueuedEvents(record) {
|
|
175
|
-
if (record.status !== "active") return;
|
|
179
|
+
if (record.status !== "active" || record.captureDepth) return;
|
|
176
180
|
const queue = record.queuedEvents;
|
|
177
181
|
record.queuedEventFlushDepth++;
|
|
178
182
|
try {
|
|
179
183
|
while (record.queuedEventHead < queue.length) {
|
|
180
184
|
const index = record.queuedEventHead;
|
|
181
185
|
const queued = queue[index];
|
|
182
|
-
if (!contains(record.root, queued.element)) {
|
|
186
|
+
if (queued.payload === CANCELED || !contains(record.root, queued.element)) {
|
|
183
187
|
record.queuedEventHead = index + 1;
|
|
184
188
|
continue;
|
|
185
189
|
}
|
|
@@ -199,7 +203,8 @@ function flushQueuedEvents(record) {
|
|
|
199
203
|
record.entry.handleEvent?.(
|
|
200
204
|
queued.event,
|
|
201
205
|
queued.element,
|
|
202
|
-
adoptionContext(adoption, queued.event)
|
|
206
|
+
adoptionContext(adoption, queued.event),
|
|
207
|
+
queued.payload
|
|
203
208
|
);
|
|
204
209
|
}
|
|
205
210
|
} finally {
|
|
@@ -365,6 +370,24 @@ function handleDelegatedEvent(root, event) {
|
|
|
365
370
|
if (matched === null || !contains(root, matched)) continue;
|
|
366
371
|
const range = nearestRange(root, matched);
|
|
367
372
|
if (!rangeMatches(record, range)) continue;
|
|
373
|
+
if (record.entry.captureEvent !== void 0) {
|
|
374
|
+
const queued = { event, element: matched, range, payload: CANCELED };
|
|
375
|
+
record.queuedEvents.push(queued);
|
|
376
|
+
if (range?.status === "pending") record.waitingRanges.add(range);
|
|
377
|
+
record.captureDepth = (record.captureDepth ?? 0) + 1;
|
|
378
|
+
try {
|
|
379
|
+
const payload = record.entry.captureEvent(event, matched);
|
|
380
|
+
if (!record.controller.signal.aborted && contains(root, matched) && matchesTarget(record, matched) && nearestRange(root, matched) === range)
|
|
381
|
+
queued.payload = payload;
|
|
382
|
+
} catch (error) {
|
|
383
|
+
failBehavior(record, error);
|
|
384
|
+
throw error;
|
|
385
|
+
} finally {
|
|
386
|
+
record.captureDepth--;
|
|
387
|
+
}
|
|
388
|
+
flushQueuedEvents(record);
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
368
391
|
if (record.status !== "active" || range?.status === "pending") {
|
|
369
392
|
record.queuedEvents.push({ event, element: matched, range });
|
|
370
393
|
if (range?.status === "pending") record.waitingRanges.add(range);
|
|
@@ -376,7 +399,7 @@ function handleDelegatedEvent(root, event) {
|
|
|
376
399
|
flushQueuedEvents(record);
|
|
377
400
|
continue;
|
|
378
401
|
}
|
|
379
|
-
record.entry.handleEvent?.(event, matched, adoptionContext(adoption, event));
|
|
402
|
+
record.entry.handleEvent?.(event, matched, adoptionContext(adoption, event), void 0);
|
|
380
403
|
}
|
|
381
404
|
}
|
|
382
405
|
function installListeners(root, events) {
|
|
@@ -734,5 +757,8 @@ function attachBehaviorRoot(container, options = {}) {
|
|
|
734
757
|
}
|
|
735
758
|
// Annotate the CommonJS export names for ESM import in node:
|
|
736
759
|
0 && (module.exports = {
|
|
737
|
-
|
|
760
|
+
adoptBindings,
|
|
761
|
+
attachBehaviorRoot,
|
|
762
|
+
mountBindings,
|
|
763
|
+
unbound
|
|
738
764
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var class_names_exports = {};
|
|
20
|
+
__export(class_names_exports, {
|
|
21
|
+
normalizeClass: () => normalizeClass
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(class_names_exports);
|
|
24
|
+
function normalizeClass(value) {
|
|
25
|
+
if (typeof value === "string") return value;
|
|
26
|
+
if (typeof value !== "object") {
|
|
27
|
+
return typeof value === "number" && value ? "" + value : "";
|
|
28
|
+
}
|
|
29
|
+
if (value === null) return "";
|
|
30
|
+
let str = "";
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
for (let i = 0; i < value.length; i++) {
|
|
33
|
+
const item = value[i];
|
|
34
|
+
if (item) {
|
|
35
|
+
const inner = normalizeClass(item);
|
|
36
|
+
if (inner) str = str ? str + " " + inner : inner;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
for (const k in value) {
|
|
41
|
+
if (value[k]) str = str ? str + " " + k : k;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return str;
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
normalizeClass
|
|
49
|
+
});
|
package/dist/cjs/constants.cjs
CHANGED
|
@@ -28,6 +28,8 @@ __export(constants_exports, {
|
|
|
28
28
|
FOR_BLOCK_OPEN_ITEMS: () => FOR_BLOCK_OPEN_ITEMS,
|
|
29
29
|
HYDRATE_ID_ATTR: () => HYDRATE_ID_ATTR,
|
|
30
30
|
HYDRATE_ID_COUNT_ATTR: () => HYDRATE_ID_COUNT_ATTR,
|
|
31
|
+
HYDRATE_INDEPENDENT_ATTR: () => import_hydration_markers.HYDRATE_INDEPENDENT_ATTR,
|
|
32
|
+
HYDRATE_INPUT_ATTR: () => import_hydration_markers.HYDRATE_INPUT_ATTR,
|
|
31
33
|
HYDRATE_SEED_ATTR: () => HYDRATE_SEED_ATTR,
|
|
32
34
|
HYDRATE_STATIC_END: () => HYDRATE_STATIC_END,
|
|
33
35
|
HYDRATE_STATIC_ID_COUNT_PREFIX: () => HYDRATE_STATIC_ID_COUNT_PREFIX,
|
|
@@ -39,9 +41,11 @@ __export(constants_exports, {
|
|
|
39
41
|
HYDRATION_RANGE_BOUNDARY: () => HYDRATION_RANGE_BOUNDARY,
|
|
40
42
|
HYDRATION_START: () => HYDRATION_START,
|
|
41
43
|
HYDRATION_TEXT_SEP: () => HYDRATION_TEXT_SEP,
|
|
44
|
+
INDEPENDENT_HYDRATE_MANIFEST_ATTR: () => import_hydration_markers.INDEPENDENT_HYDRATE_MANIFEST_ATTR,
|
|
42
45
|
MUST_USE_PROPERTY_PROPS: () => MUST_USE_PROPERTY_PROPS,
|
|
43
46
|
POSITIVE_NUMERIC_ATTR_PROPS: () => POSITIVE_NUMERIC_ATTR_PROPS,
|
|
44
47
|
REJECTION_SENTINEL_KEY: () => REJECTION_SENTINEL_KEY,
|
|
48
|
+
SIGNAL_CONTROL_ATTR: () => import_hydration_markers.SIGNAL_CONTROL_ATTR,
|
|
45
49
|
STREAM_BOUNDARY_ATTR: () => import_stream_protocol2.STREAM_BOUNDARY_ATTR,
|
|
46
50
|
STREAM_RESOURCE_ATTR: () => STREAM_RESOURCE_ATTR,
|
|
47
51
|
STREAM_SCRIPT_ATTR: () => STREAM_SCRIPT_ATTR,
|
|
@@ -63,6 +67,7 @@ __export(constants_exports, {
|
|
|
63
67
|
});
|
|
64
68
|
module.exports = __toCommonJS(constants_exports);
|
|
65
69
|
var import_stream_protocol = require("./stream-protocol.cjs");
|
|
70
|
+
var import_hydration_markers = require("./hydration-markers.cjs");
|
|
66
71
|
var import_stream_protocol2 = require("./stream-protocol.cjs");
|
|
67
72
|
var import_dom_tables = require("./dom-tables.cjs");
|
|
68
73
|
const HYDRATION_START = "[";
|
|
@@ -121,6 +126,8 @@ const cssStyleValue = import_dom_tables.cssStyleValue;
|
|
|
121
126
|
FOR_BLOCK_OPEN_ITEMS,
|
|
122
127
|
HYDRATE_ID_ATTR,
|
|
123
128
|
HYDRATE_ID_COUNT_ATTR,
|
|
129
|
+
HYDRATE_INDEPENDENT_ATTR,
|
|
130
|
+
HYDRATE_INPUT_ATTR,
|
|
124
131
|
HYDRATE_SEED_ATTR,
|
|
125
132
|
HYDRATE_STATIC_END,
|
|
126
133
|
HYDRATE_STATIC_ID_COUNT_PREFIX,
|
|
@@ -132,9 +139,11 @@ const cssStyleValue = import_dom_tables.cssStyleValue;
|
|
|
132
139
|
HYDRATION_RANGE_BOUNDARY,
|
|
133
140
|
HYDRATION_START,
|
|
134
141
|
HYDRATION_TEXT_SEP,
|
|
142
|
+
INDEPENDENT_HYDRATE_MANIFEST_ATTR,
|
|
135
143
|
MUST_USE_PROPERTY_PROPS,
|
|
136
144
|
POSITIVE_NUMERIC_ATTR_PROPS,
|
|
137
145
|
REJECTION_SENTINEL_KEY,
|
|
146
|
+
SIGNAL_CONTROL_ATTR,
|
|
138
147
|
STREAM_BOUNDARY_ATTR,
|
|
139
148
|
STREAM_RESOURCE_ATTR,
|
|
140
149
|
STREAM_SCRIPT_ATTR,
|
package/dist/cjs/css.cjs
CHANGED
|
@@ -21,36 +21,15 @@ __export(css_exports, {
|
|
|
21
21
|
devWarnStyleCoercion: () => devWarnStyleCoercion,
|
|
22
22
|
devWarnStyleProperty: () => devWarnStyleProperty,
|
|
23
23
|
mergeClass: () => mergeClass,
|
|
24
|
-
normalizeClass: () => normalizeClass,
|
|
24
|
+
normalizeClass: () => import_class_names.normalizeClass,
|
|
25
25
|
styleName: () => styleName
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(css_exports);
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
if (typeof value === "string") return value;
|
|
31
|
-
if (typeof value !== "object") {
|
|
32
|
-
return typeof value === "number" && value ? "" + value : "";
|
|
33
|
-
}
|
|
34
|
-
if (value === null) return "";
|
|
35
|
-
let str = "";
|
|
36
|
-
if (Array.isArray(value)) {
|
|
37
|
-
for (let i = 0; i < value.length; i++) {
|
|
38
|
-
const item = value[i];
|
|
39
|
-
if (item) {
|
|
40
|
-
const inner = normalizeClass(item);
|
|
41
|
-
if (inner) str = str ? str + " " + inner : inner;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
for (const k in value) {
|
|
46
|
-
if (value[k]) str = str ? str + " " + k : k;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return str;
|
|
50
|
-
}
|
|
28
|
+
var import_class_names = require("./class-names.cjs");
|
|
29
|
+
var import_style_values = require("./style-values.cjs");
|
|
51
30
|
function mergeClass(left, right) {
|
|
52
|
-
const a = normalizeClass(left);
|
|
53
|
-
const b = normalizeClass(right);
|
|
31
|
+
const a = (0, import_class_names.normalizeClass)(left);
|
|
32
|
+
const b = (0, import_class_names.normalizeClass)(right);
|
|
54
33
|
if (!a) return b;
|
|
55
34
|
if (!b) return a;
|
|
56
35
|
return a + " " + b;
|
|
@@ -59,7 +38,7 @@ const styleNameCache = /* @__PURE__ */ new Map();
|
|
|
59
38
|
function styleName(name) {
|
|
60
39
|
const cached = styleNameCache.get(name);
|
|
61
40
|
if (cached !== void 0) return cached;
|
|
62
|
-
const result = (0,
|
|
41
|
+
const result = (0, import_style_values.hyphenateStyleName)(name);
|
|
63
42
|
styleNameCache.set(name, result);
|
|
64
43
|
return result;
|
|
65
44
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var data_encoding_exports = {};
|
|
20
|
+
__export(data_encoding_exports, {
|
|
21
|
+
decodeSignalValue: () => decodeSignalValue,
|
|
22
|
+
encodeSignalValue: () => encodeSignalValue,
|
|
23
|
+
snapshotSignalValue: () => snapshotSignalValue
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(data_encoding_exports);
|
|
26
|
+
var import_errors = require("./signals/errors.cjs");
|
|
27
|
+
function unsupported() {
|
|
28
|
+
throw new import_errors.SignalSerializationError(
|
|
29
|
+
"Signal request arguments and seeds require acyclic plain data: undefined, null, booleans, finite numbers, strings, dense arrays, and plain objects with enumerable string data properties."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function encodeSignalValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
33
|
+
if (value === void 0) return ["undefined"];
|
|
34
|
+
if (value === null) return ["null"];
|
|
35
|
+
if (typeof value === "boolean") return ["boolean", value];
|
|
36
|
+
if (typeof value === "string") return ["string", value];
|
|
37
|
+
if (typeof value === "number") {
|
|
38
|
+
if (!Number.isFinite(value)) return unsupported();
|
|
39
|
+
return ["number", Object.is(value, -0) ? "-0" : value];
|
|
40
|
+
}
|
|
41
|
+
if (typeof value !== "object" || ancestors.has(value)) return unsupported();
|
|
42
|
+
const prototype = Object.getPrototypeOf(value);
|
|
43
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) {
|
|
44
|
+
return unsupported();
|
|
45
|
+
}
|
|
46
|
+
ancestors.add(value);
|
|
47
|
+
try {
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
const keys2 = Reflect.ownKeys(value);
|
|
50
|
+
if (keys2.length !== value.length + 1) return unsupported();
|
|
51
|
+
const items = [];
|
|
52
|
+
for (let i = 0; i < value.length; i++) {
|
|
53
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(i));
|
|
54
|
+
if (!descriptor || !descriptor.enumerable || !("value" in descriptor)) return unsupported();
|
|
55
|
+
items.push(encodeSignalValue(descriptor.value, ancestors));
|
|
56
|
+
}
|
|
57
|
+
return ["array", items];
|
|
58
|
+
}
|
|
59
|
+
const keys = Reflect.ownKeys(value);
|
|
60
|
+
if (keys.some((key) => typeof key !== "string")) return unsupported();
|
|
61
|
+
const entries = [];
|
|
62
|
+
for (const key of keys.sort()) {
|
|
63
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
64
|
+
if (!descriptor.enumerable || !("value" in descriptor)) return unsupported();
|
|
65
|
+
entries.push([key, encodeSignalValue(descriptor.value, ancestors)]);
|
|
66
|
+
}
|
|
67
|
+
return ["object", entries];
|
|
68
|
+
} finally {
|
|
69
|
+
ancestors.delete(value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function snapshotSignalValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
73
|
+
if (value === void 0 || value === null || typeof value === "boolean" || typeof value === "string")
|
|
74
|
+
return value;
|
|
75
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : unsupported();
|
|
76
|
+
if (typeof value !== "object" || ancestors.has(value)) return unsupported();
|
|
77
|
+
const prototype = Object.getPrototypeOf(value);
|
|
78
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) {
|
|
79
|
+
return unsupported();
|
|
80
|
+
}
|
|
81
|
+
ancestors.add(value);
|
|
82
|
+
try {
|
|
83
|
+
const keys = Reflect.ownKeys(value);
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
if (keys.length !== value.length + 1) return unsupported();
|
|
86
|
+
const items = [];
|
|
87
|
+
for (let i = 0; i < value.length; i++) {
|
|
88
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(i));
|
|
89
|
+
if (!descriptor || !descriptor.enumerable || !("value" in descriptor)) return unsupported();
|
|
90
|
+
items.push(snapshotSignalValue(descriptor.value, ancestors));
|
|
91
|
+
}
|
|
92
|
+
return Object.freeze(items);
|
|
93
|
+
}
|
|
94
|
+
if (keys.some((key) => typeof key !== "string")) return unsupported();
|
|
95
|
+
const object = {};
|
|
96
|
+
for (const key of keys.sort()) {
|
|
97
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
98
|
+
if (!descriptor.enumerable || !("value" in descriptor)) return unsupported();
|
|
99
|
+
Object.defineProperty(object, key, {
|
|
100
|
+
value: snapshotSignalValue(descriptor.value, ancestors),
|
|
101
|
+
enumerable: true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return Object.freeze(object);
|
|
105
|
+
} finally {
|
|
106
|
+
ancestors.delete(value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function decodeSignalValue(encoded) {
|
|
110
|
+
if (!Array.isArray(encoded)) return unsupported();
|
|
111
|
+
const [tag, value] = encoded;
|
|
112
|
+
switch (tag) {
|
|
113
|
+
case "undefined":
|
|
114
|
+
if (encoded.length !== 1) return unsupported();
|
|
115
|
+
return void 0;
|
|
116
|
+
case "null":
|
|
117
|
+
if (encoded.length !== 1) return unsupported();
|
|
118
|
+
return null;
|
|
119
|
+
case "boolean":
|
|
120
|
+
if (encoded.length !== 2 || typeof value !== "boolean") return unsupported();
|
|
121
|
+
return value;
|
|
122
|
+
case "number":
|
|
123
|
+
if (encoded.length !== 2) return unsupported();
|
|
124
|
+
if (value === "-0") return -0;
|
|
125
|
+
if (typeof value !== "number" || !Number.isFinite(value) || Object.is(value, -0)) {
|
|
126
|
+
return unsupported();
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
case "string":
|
|
130
|
+
if (encoded.length !== 2 || typeof value !== "string") return unsupported();
|
|
131
|
+
return value;
|
|
132
|
+
case "array":
|
|
133
|
+
if (encoded.length !== 2 || !Array.isArray(value)) return unsupported();
|
|
134
|
+
return Object.freeze(value.map((item) => decodeSignalValue(item)));
|
|
135
|
+
case "object": {
|
|
136
|
+
if (encoded.length !== 2 || !Array.isArray(value)) return unsupported();
|
|
137
|
+
const object = {};
|
|
138
|
+
let previous;
|
|
139
|
+
for (const entry of value) {
|
|
140
|
+
if (!Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== "string" || previous !== void 0 && entry[0] <= previous) {
|
|
141
|
+
return unsupported();
|
|
142
|
+
}
|
|
143
|
+
previous = entry[0];
|
|
144
|
+
Object.defineProperty(object, entry[0], {
|
|
145
|
+
value: decodeSignalValue(entry[1]),
|
|
146
|
+
enumerable: true
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return Object.freeze(object);
|
|
150
|
+
}
|
|
151
|
+
default:
|
|
152
|
+
return unsupported();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
decodeSignalValue,
|
|
158
|
+
encodeSignalValue,
|
|
159
|
+
snapshotSignalValue
|
|
160
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dom_binding_handoff_exports = {};
|
|
20
|
+
__export(dom_binding_handoff_exports, {
|
|
21
|
+
BINDING_HANDOFF: () => BINDING_HANDOFF,
|
|
22
|
+
beginBindingEvent: () => beginBindingEvent,
|
|
23
|
+
claimBindingHandoff: () => claimBindingHandoff,
|
|
24
|
+
consumeBindingEvent: () => consumeBindingEvent,
|
|
25
|
+
hasBindingHandoffEvent: () => hasBindingHandoffEvent,
|
|
26
|
+
markBindingEvent: () => markBindingEvent,
|
|
27
|
+
registerBindingEvent: () => registerBindingEvent,
|
|
28
|
+
releaseBindingHandoff: () => releaseBindingHandoff
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(dom_binding_handoff_exports);
|
|
31
|
+
const BINDING_HANDOFF = /* @__PURE__ */ Symbol.for("octane.binding-handoff");
|
|
32
|
+
const events = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
const delivered = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
function registerBindingEvent(node, type) {
|
|
35
|
+
let counts = events.get(node);
|
|
36
|
+
if (counts === void 0) events.set(node, counts = /* @__PURE__ */ new Map());
|
|
37
|
+
counts.set(type, (counts.get(type) ?? 0) + 1);
|
|
38
|
+
return () => {
|
|
39
|
+
const count = counts.get(type) - 1;
|
|
40
|
+
if (count === 0) counts.delete(type);
|
|
41
|
+
else counts.set(type, count);
|
|
42
|
+
if (counts.size === 0) events.delete(node);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function claimBindingHandoff(lease, owner) {
|
|
46
|
+
if (!lease.active() || lease.owner !== void 0)
|
|
47
|
+
throw new Error("A DOM binding hydration lease must be active and have only one root owner.");
|
|
48
|
+
lease.owner = owner;
|
|
49
|
+
}
|
|
50
|
+
function releaseBindingHandoff(lease) {
|
|
51
|
+
lease.owner = void 0;
|
|
52
|
+
}
|
|
53
|
+
function hasBindingHandoffEvent(event) {
|
|
54
|
+
for (const node of event.composedPath()) {
|
|
55
|
+
if (events.get(node)?.has(event.type)) return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function markBindingEvent(event, node, capture) {
|
|
60
|
+
let nodes = delivered.get(event);
|
|
61
|
+
if (nodes === void 0) {
|
|
62
|
+
delivered.set(event, nodes = /* @__PURE__ */ new Map());
|
|
63
|
+
const cleanup = () => {
|
|
64
|
+
if (delivered.get(event) === nodes) delivered.delete(event);
|
|
65
|
+
};
|
|
66
|
+
if (event.isTrusted) setTimeout(cleanup, 0);
|
|
67
|
+
else queueMicrotask(cleanup);
|
|
68
|
+
}
|
|
69
|
+
nodes.set(node, (nodes.get(node) ?? 0) | (capture ? 2 : 1));
|
|
70
|
+
}
|
|
71
|
+
function consumeBindingEvent(event, node, capture) {
|
|
72
|
+
const nodes = delivered.get(event);
|
|
73
|
+
const flags = nodes?.get(node) ?? 0;
|
|
74
|
+
const bit = capture ? 2 : 1;
|
|
75
|
+
if ((flags & bit) === 0) return false;
|
|
76
|
+
if ((flags & ~bit) === 0) nodes.delete(node);
|
|
77
|
+
else nodes.set(node, flags & ~bit);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
function beginBindingEvent(event) {
|
|
81
|
+
delivered.delete(event);
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
BINDING_HANDOFF,
|
|
86
|
+
beginBindingEvent,
|
|
87
|
+
claimBindingHandoff,
|
|
88
|
+
consumeBindingEvent,
|
|
89
|
+
hasBindingHandoffEvent,
|
|
90
|
+
markBindingEvent,
|
|
91
|
+
registerBindingEvent,
|
|
92
|
+
releaseBindingHandoff
|
|
93
|
+
});
|