octane 0.6.2 → 0.6.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/dom-binding-handoff.cjs +2 -1
- package/dist/cjs/dom-binding-protocol.cjs +4 -3
- package/dist/cjs/dom-binding-styles.cjs +3 -2
- package/dist/cjs/dom-bindings.cjs +24 -23
- package/dist/cjs/error-codes.client.generated.cjs +2 -1
- package/dist/cjs/error-codes.server.generated.cjs +2 -1
- package/dist/cjs/hydration/event-capture.cjs +2 -1
- package/dist/cjs/independent-hydration-protocol.cjs +3 -2
- package/dist/cjs/runtime.cjs +169 -155
- package/dist/cjs/runtime.server.cjs +40 -34
- package/dist/cjs/signals/control-binding.cjs +7 -6
- package/dist/cjs/signals/derived-facade.cjs +2 -1
- package/dist/cjs/signals/document-owner.cjs +4 -3
- package/dist/cjs/signals/facade.cjs +10 -9
- package/dist/cjs/signals/graph.cjs +5 -4
- package/dist/cjs/signals/native-read-client.cjs +4 -3
- package/dist/cjs/signals/owner-context.cjs +4 -3
- package/dist/cjs/signals/query-attempt-observer.cjs +2 -1
- package/dist/cjs/signals/query-facade.cjs +2 -1
- package/dist/cjs/signals/scalar-computations.cjs +2 -1
- package/dist/cjs/signals/transition-action.cjs +10 -9
- package/dist/cjs/signals/transition-candidate.cjs +2 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/compile.js +380 -12
- package/dist/node/aria-diagnostics.js +92 -0
- package/dist/node/behavior-form-submissions.js +228 -0
- package/dist/node/behavior-root-types.js +0 -0
- package/dist/node/behavior-root.js +746 -0
- package/dist/node/class-names.js +25 -0
- package/dist/node/compatibility.js +10 -0
- package/dist/node/component-flags.js +23 -0
- package/dist/node/constants.js +113 -0
- package/dist/node/context-epoch.js +13 -0
- package/dist/node/context-identity.js +46 -0
- package/dist/node/css.js +80 -0
- package/dist/node/data-encoding.js +134 -0
- package/dist/node/devtools-hook.js +229 -0
- package/dist/node/dom-binding-claims.js +4 -0
- package/dist/node/dom-binding-classes.js +152 -0
- package/dist/node/dom-binding-controls.js +6 -0
- package/dist/node/dom-binding-handoff.js +77 -0
- package/dist/node/dom-binding-program.js +1617 -0
- package/dist/node/dom-binding-projections.js +204 -0
- package/dist/node/dom-binding-protocol.js +130 -0
- package/dist/node/dom-binding-signals.js +135 -0
- package/dist/node/dom-binding-styles.js +280 -0
- package/dist/node/dom-bindings.js +1087 -0
- package/dist/node/dom-focused-move.js +46 -0
- package/dist/node/dom-stage.js +878 -0
- package/dist/node/dom-tables.js +382 -0
- package/dist/node/error-codes.client.generated.js +1066 -0
- package/dist/node/error-codes.server.generated.js +736 -0
- package/dist/node/error-message.js +27 -0
- package/dist/node/event-names.js +15 -0
- package/dist/node/form-diagnostics.js +96 -0
- package/dist/node/form-submission.js +43 -0
- package/dist/node/has-own.js +4 -0
- package/dist/node/head-ownership.js +31 -0
- package/dist/node/hook-slot-cache.js +91 -0
- package/dist/node/host-property-diagnostics.js +189 -0
- package/dist/node/html-tree-validation.js +193 -0
- package/dist/node/hydration/condition.js +15 -0
- package/dist/node/hydration/control-capture.js +237 -0
- package/dist/node/hydration/document-lifecycle.js +89 -0
- package/dist/node/hydration/event-capture.js +362 -0
- package/dist/node/hydration/idle.js +23 -0
- package/dist/node/hydration/independent-island.js +317 -0
- package/dist/node/hydration/index.js +74 -0
- package/dist/node/hydration/interaction-config.js +61 -0
- package/dist/node/hydration/interaction.js +35 -0
- package/dist/node/hydration/load.js +15 -0
- package/dist/node/hydration/media.js +33 -0
- package/dist/node/hydration/native-intent.js +68 -0
- package/dist/node/hydration/never.js +12 -0
- package/dist/node/hydration/stream-delivery.js +345 -0
- package/dist/node/hydration/stream-receiver.js +190 -0
- package/dist/node/hydration/stream-result-receiver.js +276 -0
- package/dist/node/hydration/streamed-signals.js +186 -0
- package/dist/node/hydration/types.js +0 -0
- package/dist/node/hydration/visible.js +69 -0
- package/dist/node/hydration-markers.js +44 -0
- package/dist/node/independent-hydration-protocol.js +91 -0
- package/dist/node/index.js +461 -0
- package/dist/node/internal/client.js +7 -0
- package/dist/node/internal/context.js +5 -0
- package/dist/node/internal/server.js +5 -0
- package/dist/node/internal/signal-read.js +4 -0
- package/dist/node/method-dep.js +25 -0
- package/dist/node/profiling.js +432 -0
- package/dist/node/public-types.js +0 -0
- package/dist/node/react/fiber-adapter.js +57 -0
- package/dist/node/react/index.js +397 -0
- package/dist/node/react/react-compat-envelope.js +78 -0
- package/dist/node/react/react-compat-server.js +129 -0
- package/dist/node/react/react-compat-shared.js +104 -0
- package/dist/node/react/react-compat.js +223 -0
- package/dist/node/react/server.js +81 -0
- package/dist/node/react/shared.js +75 -0
- package/dist/node/renderer-bridge.js +35 -0
- package/dist/node/resize-observer.js +105 -0
- package/dist/node/resource-hint-diagnostics.js +67 -0
- package/dist/node/runtime-tags.js +22 -0
- package/dist/node/runtime.js +28881 -0
- package/dist/node/runtime.server.js +8016 -0
- package/dist/node/sanitize-url.js +34 -0
- package/dist/node/server/early-signals.js +54 -0
- package/dist/node/server/index.js +336 -0
- package/dist/node/server/rpc-batch.js +129 -0
- package/dist/node/server/rpc-stream.js +125 -0
- package/dist/node/server/rpc.js +48 -0
- package/dist/node/server/signal-query-observation.js +134 -0
- package/dist/node/server/streamed-region.js +31 -0
- package/dist/node/server/streamed-signals.js +557 -0
- package/dist/node/server-call.js +75 -0
- package/dist/node/server-rpc-batch-client.js +119 -0
- package/dist/node/server-rpc-client.js +108 -0
- package/dist/node/server-rpc-protocol.js +109 -0
- package/dist/node/server-rpc-stream-client.js +98 -0
- package/dist/node/shared-value-helpers.js +40 -0
- package/dist/node/signals/actions.js +463 -0
- package/dist/node/signals/client.js +22 -0
- package/dist/node/signals/computations.js +452 -0
- package/dist/node/signals/control-binding.js +388 -0
- package/dist/node/signals/control-handoff.js +12 -0
- package/dist/node/signals/derived-facade.js +25 -0
- package/dist/node/signals/document-owner.js +48 -0
- package/dist/node/signals/early-values.js +124 -0
- package/dist/node/signals/encoding.js +6 -0
- package/dist/node/signals/engine.js +668 -0
- package/dist/node/signals/errors.js +54 -0
- package/dist/node/signals/facade.js +441 -0
- package/dist/node/signals/graph.js +817 -0
- package/dist/node/signals/handle-protocol.js +11 -0
- package/dist/node/signals/index.js +87 -0
- package/dist/node/signals/native-read-client.js +319 -0
- package/dist/node/signals/native-read-collector.js +132 -0
- package/dist/node/signals/native-read-events.js +45 -0
- package/dist/node/signals/native-read-inspection.js +20 -0
- package/dist/node/signals/native-read-retry.js +30 -0
- package/dist/node/signals/native-read-seeds.js +243 -0
- package/dist/node/signals/native-read-server.js +99 -0
- package/dist/node/signals/owner-context.js +88 -0
- package/dist/node/signals/query-attempt-observer.js +42 -0
- package/dist/node/signals/query-facade.js +41 -0
- package/dist/node/signals/read-protocol.js +125 -0
- package/dist/node/signals/requests.js +716 -0
- package/dist/node/signals/scalar-computations.js +57 -0
- package/dist/node/signals/scope-streams.js +147 -0
- package/dist/node/signals/server.js +22 -0
- package/dist/node/signals/transition-action.js +555 -0
- package/dist/node/signals/transition-candidate.js +101 -0
- package/dist/node/signals/transition-coordinator.js +255 -0
- package/dist/node/signals/transition-state.js +82 -0
- package/dist/node/signals/types.js +20 -0
- package/dist/node/static/index.js +10 -0
- package/dist/node/stream-protocol.js +114 -0
- package/dist/node/streamed-signals-protocol.js +130 -0
- package/dist/node/style-values.js +96 -0
- package/dist/node/sub-slot.js +35 -0
- package/dist/node/testing.js +14 -0
- package/dist/node/trusted-html.js +6 -0
- package/dist/node/tsrx-iterable.js +5 -0
- package/dist/node/tsrx-spread.js +10 -0
- package/dist/node/universal-core.js +10010 -0
- package/dist/node/universal-dom-boundary.js +237 -0
- package/dist/node/universal-native.js +28 -0
- package/dist/node/universal.js +17 -0
- package/dist/node/version.js +4 -0
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.js +13 -2
- package/dist/runtime.server.d.ts +7 -0
- package/dist/runtime.server.js +4 -0
- package/dist/version.js +1 -1
- package/package.json +62 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const VALID_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
2
|
+
"aria-activedescendant",
|
|
3
|
+
"aria-atomic",
|
|
4
|
+
"aria-autocomplete",
|
|
5
|
+
"aria-braillelabel",
|
|
6
|
+
"aria-brailleroledescription",
|
|
7
|
+
"aria-busy",
|
|
8
|
+
"aria-checked",
|
|
9
|
+
"aria-colcount",
|
|
10
|
+
"aria-colindex",
|
|
11
|
+
"aria-colindextext",
|
|
12
|
+
"aria-colspan",
|
|
13
|
+
"aria-controls",
|
|
14
|
+
"aria-current",
|
|
15
|
+
"aria-describedby",
|
|
16
|
+
"aria-description",
|
|
17
|
+
"aria-details",
|
|
18
|
+
"aria-disabled",
|
|
19
|
+
"aria-dropeffect",
|
|
20
|
+
"aria-errormessage",
|
|
21
|
+
"aria-expanded",
|
|
22
|
+
"aria-flowto",
|
|
23
|
+
"aria-grabbed",
|
|
24
|
+
"aria-haspopup",
|
|
25
|
+
"aria-hidden",
|
|
26
|
+
"aria-invalid",
|
|
27
|
+
"aria-keyshortcuts",
|
|
28
|
+
"aria-label",
|
|
29
|
+
"aria-labelledby",
|
|
30
|
+
"aria-level",
|
|
31
|
+
"aria-live",
|
|
32
|
+
"aria-modal",
|
|
33
|
+
"aria-multiline",
|
|
34
|
+
"aria-multiselectable",
|
|
35
|
+
"aria-orientation",
|
|
36
|
+
"aria-owns",
|
|
37
|
+
"aria-placeholder",
|
|
38
|
+
"aria-posinset",
|
|
39
|
+
"aria-pressed",
|
|
40
|
+
"aria-readonly",
|
|
41
|
+
"aria-relevant",
|
|
42
|
+
"aria-required",
|
|
43
|
+
"aria-roledescription",
|
|
44
|
+
"aria-rowcount",
|
|
45
|
+
"aria-rowindex",
|
|
46
|
+
"aria-rowindextext",
|
|
47
|
+
"aria-rowspan",
|
|
48
|
+
"aria-selected",
|
|
49
|
+
"aria-setsize",
|
|
50
|
+
"aria-sort",
|
|
51
|
+
"aria-valuemax",
|
|
52
|
+
"aria-valuemin",
|
|
53
|
+
"aria-valuenow",
|
|
54
|
+
"aria-valuetext"
|
|
55
|
+
]);
|
|
56
|
+
function isAriaAttributeName(name) {
|
|
57
|
+
if (name === "aria") return true;
|
|
58
|
+
if (name.length < 5 || name.slice(0, 4) !== "aria") return false;
|
|
59
|
+
const next = name.charCodeAt(4);
|
|
60
|
+
return next === 45 || next >= 65 && next <= 90;
|
|
61
|
+
}
|
|
62
|
+
function isUnknownAriaAttribute(name) {
|
|
63
|
+
return name.startsWith("aria-") && !VALID_ARIA_ATTRIBUTES.has(name.toLowerCase());
|
|
64
|
+
}
|
|
65
|
+
function ariaAttributeWarning(name, tag) {
|
|
66
|
+
if (name === "aria") {
|
|
67
|
+
return "The `aria` attribute is reserved for future use. Pass individual `aria-*` attributes instead.";
|
|
68
|
+
}
|
|
69
|
+
if (name.length < 5 || name.slice(0, 4) !== "aria") return null;
|
|
70
|
+
if (name.charCodeAt(4) === 45) {
|
|
71
|
+
const lowercase = name.toLowerCase();
|
|
72
|
+
if (VALID_ARIA_ATTRIBUTES.has(lowercase)) {
|
|
73
|
+
return name === lowercase ? null : `Unknown ARIA attribute \`${name}\`. Did you mean \`${lowercase}\`?`;
|
|
74
|
+
}
|
|
75
|
+
return `Invalid aria prop \`${name}\` on <${tag}> tag. ARIA attributes must use valid, lowercase aria-* names.`;
|
|
76
|
+
}
|
|
77
|
+
const next = name.charCodeAt(4);
|
|
78
|
+
if (next < 65 || next > 90) return null;
|
|
79
|
+
const correctName = "aria-" + name.slice(4).toLowerCase();
|
|
80
|
+
return VALID_ARIA_ATTRIBUTES.has(correctName) ? `Invalid ARIA attribute \`${name}\`. Did you mean \`${correctName}\`?` : `Invalid ARIA attribute \`${name}\`. ARIA attributes follow the pattern aria-* and must be lowercase.`;
|
|
81
|
+
}
|
|
82
|
+
function unknownAriaAttributeWarning(names, tag) {
|
|
83
|
+
const noun = names.length === 1 ? "prop" : "props";
|
|
84
|
+
const quoted = names.map((name) => `\`${name}\``).join(", ");
|
|
85
|
+
return `Invalid aria ${noun} ${quoted} on <${tag}> tag. ARIA attributes must use valid, lowercase aria-* names.`;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
ariaAttributeWarning,
|
|
89
|
+
isAriaAttributeName,
|
|
90
|
+
isUnknownAriaAttribute,
|
|
91
|
+
unknownAriaAttributeWarning
|
|
92
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FORM_SUBMISSION_ATTR,
|
|
3
|
+
getEarlyFormSubmissionMailbox,
|
|
4
|
+
isEarlyFormSubmissionCurrent,
|
|
5
|
+
isEarlyFormSubmitActivation
|
|
6
|
+
} from "./form-submission.js";
|
|
7
|
+
import {
|
|
8
|
+
HYDRATE_ID_ATTR,
|
|
9
|
+
HYDRATE_INDEPENDENT_ATTR,
|
|
10
|
+
HYDRATE_WHEN_ATTR
|
|
11
|
+
} from "./hydration-markers.js";
|
|
12
|
+
import {
|
|
13
|
+
EARLY_HYDRATION_INTENTS_KEY,
|
|
14
|
+
HYDRATE_INTERACTION_EVENTS_ATTR
|
|
15
|
+
} from "./hydration/interaction-config.js";
|
|
16
|
+
import {
|
|
17
|
+
captureNativeHydrationIntent,
|
|
18
|
+
initializeHydrationEventCapture
|
|
19
|
+
} from "./hydration/event-capture.js";
|
|
20
|
+
import {
|
|
21
|
+
getNativeHydrationCapture,
|
|
22
|
+
getNativeHydrationDocument,
|
|
23
|
+
getNativeHydrationDOM,
|
|
24
|
+
NATIVE_HYDRATION_CAPTURE_KEY
|
|
25
|
+
} from "./hydration/native-intent.js";
|
|
26
|
+
let earlySubmissionRanges;
|
|
27
|
+
let earlySubmissionRoots;
|
|
28
|
+
let controllers;
|
|
29
|
+
function captureFormSubmissions() {
|
|
30
|
+
const capture = (root, flush, fail, range, matches, canceled) => {
|
|
31
|
+
root.dom = getNativeHydrationDOM(root.document);
|
|
32
|
+
const mailbox = getEarlyFormSubmissionMailbox(root.document);
|
|
33
|
+
if (mailbox === void 0) return;
|
|
34
|
+
const services = { flush, fail, range, matches, canceled };
|
|
35
|
+
installFormSubmissionActivation(root.document, mailbox);
|
|
36
|
+
let controller = controllers?.get(root.registry);
|
|
37
|
+
if (controller === void 0) {
|
|
38
|
+
controller = createSubmissionController(root, mailbox, services);
|
|
39
|
+
(controllers ??= /* @__PURE__ */ new WeakMap()).set(root.registry, controller);
|
|
40
|
+
root.registry.capture = controller;
|
|
41
|
+
}
|
|
42
|
+
controller.enabledRoots.add(root);
|
|
43
|
+
controller.flush();
|
|
44
|
+
};
|
|
45
|
+
capture.document = getNativeHydrationDocument;
|
|
46
|
+
return capture;
|
|
47
|
+
}
|
|
48
|
+
function installFormSubmissionActivation(document, mailbox) {
|
|
49
|
+
let feature = getNativeHydrationCapture(document);
|
|
50
|
+
if (feature?.push !== void 0) return;
|
|
51
|
+
if (feature === void 0) {
|
|
52
|
+
feature = { skip: isEarlyFormSubmitActivation };
|
|
53
|
+
document[NATIVE_HYDRATION_CAPTURE_KEY] = feature;
|
|
54
|
+
}
|
|
55
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
56
|
+
const elementPrototype = formSubmissionElementPrototype(document);
|
|
57
|
+
const dom = getNativeHydrationDOM(document);
|
|
58
|
+
const queued = (packet) => {
|
|
59
|
+
const [event, form, boundary, id, when, events] = packet;
|
|
60
|
+
if (!packet[8] || seen.has(event)) return;
|
|
61
|
+
seen.add(event);
|
|
62
|
+
const record = mailbox.q.find((submission) => submission.event === event);
|
|
63
|
+
const parent = record === void 0 ? dom.parent(form) : record.parent;
|
|
64
|
+
const key = record?.key ?? elementPrototype.getAttribute.call(form, FORM_SUBMISSION_ATTR);
|
|
65
|
+
const current = () => !record?.discarded && (record?.valid?.() ?? true) && mailbox.captures(form) && event.target === form && dom.connected(form) && dom.connected(boundary) && dom.owner(form) === document && dom.owner(boundary) === document && dom.parent(form) === parent && elementPrototype.getAttribute.call(form, FORM_SUBMISSION_ATTR) === key && elementPrototype.closest.call(form, `[${HYDRATE_INDEPENDENT_ATTR}]`) === boundary && elementPrototype.getAttribute.call(boundary, HYDRATE_ID_ATTR) === id && (when === "interaction" || when === "dynamic") && elementPrototype.getAttribute.call(boundary, HYDRATE_WHEN_ATTR) === when && elementPrototype.getAttribute.call(boundary, HYDRATE_INTERACTION_EVENTS_ATTR) === events;
|
|
66
|
+
captureNativeHydrationIntent(boundary, event, current);
|
|
67
|
+
};
|
|
68
|
+
feature.push = queued;
|
|
69
|
+
initializeHydrationEventCapture(document);
|
|
70
|
+
const host = document;
|
|
71
|
+
const intents = host[EARLY_HYDRATION_INTENTS_KEY];
|
|
72
|
+
for (const packet of intents?.q.splice(0) ?? []) queued(packet);
|
|
73
|
+
for (const submission of mailbox.q) {
|
|
74
|
+
if (seen.has(submission.event) || submission.boundary === null || submission.boundaryId === null)
|
|
75
|
+
continue;
|
|
76
|
+
intents?.capture?.([
|
|
77
|
+
submission.event,
|
|
78
|
+
submission.form,
|
|
79
|
+
submission.boundary,
|
|
80
|
+
submission.boundaryId,
|
|
81
|
+
submission.boundaryWhen,
|
|
82
|
+
submission.boundaryEvents,
|
|
83
|
+
void 0,
|
|
84
|
+
void 0,
|
|
85
|
+
true,
|
|
86
|
+
submission.sequence
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function createSubmissionController(root, mailbox, services) {
|
|
91
|
+
const registry = root.registry;
|
|
92
|
+
const document = root.document;
|
|
93
|
+
const enabledRoots = /* @__PURE__ */ new Set();
|
|
94
|
+
const receive = (submission) => receiveEarlyFormSubmission(document, registry, mailbox, submission, enabledRoots, services);
|
|
95
|
+
const controller = {
|
|
96
|
+
enabledRoots,
|
|
97
|
+
flush: () => mailbox.flush(),
|
|
98
|
+
skip: (owner, event) => enabledRoots.has(owner) && mailbox.has(event),
|
|
99
|
+
release: (entry) => {
|
|
100
|
+
if (enabledRoots.has(entry.root)) releaseBehaviorSubmissions(entry, services);
|
|
101
|
+
},
|
|
102
|
+
dispose: (owner) => {
|
|
103
|
+
if (registry.roots.get(owner.container) !== owner) return;
|
|
104
|
+
if (enabledRoots.has(owner)) {
|
|
105
|
+
for (const entry of owner.behaviors) releaseBehaviorSubmissions(entry, services);
|
|
106
|
+
}
|
|
107
|
+
for (const submission of [...mailbox.q]) {
|
|
108
|
+
if (containsFormSubmission(owner, submission.form) && !hasNestedSubmissionOwner(owner, submission.form))
|
|
109
|
+
mailbox.release(submission.form);
|
|
110
|
+
}
|
|
111
|
+
enabledRoots.delete(owner);
|
|
112
|
+
if (enabledRoots.size === 0) {
|
|
113
|
+
if (mailbox.receive === receive) mailbox.receive = void 0;
|
|
114
|
+
if (registry.capture === controller) registry.capture = void 0;
|
|
115
|
+
controllers?.delete(registry);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
mailbox.receive = receive;
|
|
120
|
+
return controller;
|
|
121
|
+
}
|
|
122
|
+
function formSubmissionElementPrototype(document) {
|
|
123
|
+
return (document.defaultView?.Element ?? globalThis.Element).prototype;
|
|
124
|
+
}
|
|
125
|
+
function containsFormSubmission(root, form) {
|
|
126
|
+
return getNativeHydrationDOM(root.document).contains(root.container, form);
|
|
127
|
+
}
|
|
128
|
+
function matchesFormSubmissionTarget(record, form) {
|
|
129
|
+
return typeof record.entry.target === "string" ? formSubmissionElementPrototype(record.root.document).matches.call(form, record.entry.target) : record.entry.target === form;
|
|
130
|
+
}
|
|
131
|
+
function receiveEarlyFormSubmission(document, registry, mailbox, submission, enabledRoots, services) {
|
|
132
|
+
if (submission.snapshot === void 0) return false;
|
|
133
|
+
if (!isEarlyFormSubmissionCurrent(submission, document)) return true;
|
|
134
|
+
const previousRoot = earlySubmissionRoots?.get(submission);
|
|
135
|
+
if (previousRoot !== void 0 && (previousRoot.disposed || previousRoot.controller.signal.aborted || !containsFormSubmission(previousRoot, submission.form))) {
|
|
136
|
+
submission.discarded = true;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
let rangeElement = submission.form;
|
|
140
|
+
let acceptedRange;
|
|
141
|
+
while (rangeElement !== null) {
|
|
142
|
+
acceptedRange = registry.ranges.get(rangeElement);
|
|
143
|
+
if (acceptedRange !== void 0) break;
|
|
144
|
+
rangeElement = getNativeHydrationDOM(document).parent(rangeElement);
|
|
145
|
+
}
|
|
146
|
+
const previousRange = earlySubmissionRanges?.get(submission);
|
|
147
|
+
if (previousRange !== void 0 && previousRange !== acceptedRange) {
|
|
148
|
+
submission.discarded = true;
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (acceptedRange !== void 0 && previousRange === void 0)
|
|
152
|
+
(earlySubmissionRanges ??= /* @__PURE__ */ new WeakMap()).set(submission, acceptedRange);
|
|
153
|
+
let ownerRoot;
|
|
154
|
+
for (const root of registry.roots.values()) {
|
|
155
|
+
if (root.disposed || !containsFormSubmission(root, submission.form)) continue;
|
|
156
|
+
if (ownerRoot === void 0 || formSubmissionElementPrototype(document).contains.call(ownerRoot.container, root.container))
|
|
157
|
+
ownerRoot = root;
|
|
158
|
+
}
|
|
159
|
+
if (ownerRoot !== void 0 && previousRoot === void 0)
|
|
160
|
+
(earlySubmissionRoots ??= /* @__PURE__ */ new WeakMap()).set(submission, ownerRoot);
|
|
161
|
+
const record = ownerRoot !== void 0 && enabledRoots.has(ownerRoot) ? ownerRoot.byId.get(submission.key) : void 0;
|
|
162
|
+
if (record === void 0 || record.controller.signal.aborted || !record.entry.events?.includes("submit") || record.entry.captureEvent === void 0 || !matchesFormSubmissionTarget(record, submission.form) || !services.matches(record, services.range(record.root, submission.form)))
|
|
163
|
+
return false;
|
|
164
|
+
const range = services.range(record.root, submission.form);
|
|
165
|
+
const queued = {
|
|
166
|
+
event: submission.event,
|
|
167
|
+
element: submission.form,
|
|
168
|
+
range,
|
|
169
|
+
payload: services.canceled,
|
|
170
|
+
valid: () => {
|
|
171
|
+
const valid = !submission.discarded && !record.controller.signal.aborted && !record.root.controller.signal.aborted && mailbox.captures(submission.form) && containsFormSubmission(record.root, submission.form) && isEarlyFormSubmissionCurrent(submission, document) && services.range(record.root, submission.form) === range;
|
|
172
|
+
if (!valid) submission.discarded = true;
|
|
173
|
+
return valid;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
submission.valid = queued.valid;
|
|
177
|
+
record.queue.push(queued);
|
|
178
|
+
if (range?.status === "pending") record.waiting.add(range);
|
|
179
|
+
record.captureDepth = (record.captureDepth ?? 0) + 1;
|
|
180
|
+
try {
|
|
181
|
+
const payload = record.entry.captureEvent(
|
|
182
|
+
submission.event,
|
|
183
|
+
submission.form,
|
|
184
|
+
submission.snapshot
|
|
185
|
+
);
|
|
186
|
+
if (!record.controller.signal.aborted && containsFormSubmission(record.root, submission.form) && matchesFormSubmissionTarget(record, submission.form) && services.range(record.root, submission.form) === range && isEarlyFormSubmissionCurrent(submission, document))
|
|
187
|
+
queued.payload = payload;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
services.fail(record, error);
|
|
190
|
+
throw error;
|
|
191
|
+
} finally {
|
|
192
|
+
record.captureDepth--;
|
|
193
|
+
}
|
|
194
|
+
submission.snapshot = void 0;
|
|
195
|
+
if (queued.payload === services.canceled) submission.discarded = true;
|
|
196
|
+
services.flush(record);
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
function hasNestedSubmissionOwner(root, form) {
|
|
200
|
+
for (const nested of root.registry.roots.values()) {
|
|
201
|
+
if (nested === root || nested.disposed || !formSubmissionElementPrototype(root.document).contains.call(
|
|
202
|
+
root.container,
|
|
203
|
+
nested.container
|
|
204
|
+
) || !containsFormSubmission(nested, form))
|
|
205
|
+
continue;
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
function releaseBehaviorSubmissions(record, services) {
|
|
211
|
+
if (record.entry.id === void 0 || !record.entry.events?.includes("submit") || record.entry.captureEvent === void 0)
|
|
212
|
+
return;
|
|
213
|
+
const mailbox = getEarlyFormSubmissionMailbox(record.root.document);
|
|
214
|
+
if (mailbox === void 0) return;
|
|
215
|
+
const elementPrototype = formSubmissionElementPrototype(record.root.document);
|
|
216
|
+
for (const form of elementPrototype.querySelectorAll.call(
|
|
217
|
+
record.root.container,
|
|
218
|
+
`form[${FORM_SUBMISSION_ATTR}]`
|
|
219
|
+
)) {
|
|
220
|
+
if (elementPrototype.getAttribute.call(form, FORM_SUBMISSION_ATTR) === record.entry.id && matchesFormSubmissionTarget(record, form) && services.matches(record, services.range(record.root, form)) && !hasNestedSubmissionOwner(record.root, form))
|
|
221
|
+
mailbox.release(form);
|
|
222
|
+
}
|
|
223
|
+
if (elementPrototype.matches.call(record.root.container, "form") && elementPrototype.getAttribute.call(record.root.container, FORM_SUBMISSION_ATTR) === record.entry.id && matchesFormSubmissionTarget(record, record.root.container) && services.matches(record, services.range(record.root, record.root.container)) && !hasNestedSubmissionOwner(record.root, record.root.container))
|
|
224
|
+
mailbox.release(record.root.container);
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
captureFormSubmissions
|
|
228
|
+
};
|
|
File without changes
|