octane 0.2.3 → 0.2.4
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/css.cjs +9 -0
- package/dist/cjs/dom-tables.cjs +6 -1
- package/dist/cjs/runtime.cjs +122 -27
- package/dist/cjs/runtime.server.cjs +258 -63
- package/dist/cjs/server/index.cjs +4 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +7 -0
- package/dist/compiler/compile.js +258 -528
- package/dist/compiler/hydrate-boundaries.js +165 -15
- package/dist/compiler/parser.node.js +34 -8
- package/dist/compiler/strong-mode.js +836 -3
- package/dist/compiler/style-scopes.js +1134 -0
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.js +4543 -2839
- package/dist/css.d.ts +7 -0
- package/dist/css.js +8 -0
- package/dist/dom-tables.js +6 -1
- package/dist/runtime.d.ts +19 -3
- package/dist/runtime.js +129 -28
- package/dist/runtime.server.d.ts +28 -1
- package/dist/runtime.server.js +263 -64
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/css.d.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* falsy drops out). Octane's `class`/`className` semantics at every apply site.
|
|
4
4
|
*/
|
|
5
5
|
export declare function normalizeClass(value: unknown): string;
|
|
6
|
+
/**
|
|
7
|
+
* Append a later class source onto an earlier one. Used when a synthesized
|
|
8
|
+
* scope hash must share the element with a spread's class instead of replacing
|
|
9
|
+
* it. Both sides go through `normalizeClass` so arrays / objects compose the
|
|
10
|
+
* same way they would as a lone `class` value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mergeClass(left: unknown, right: unknown): string;
|
|
6
13
|
export declare function styleName(name: string): string;
|
|
7
14
|
/** @internal Development-only React-style inline CSS diagnostics. */
|
|
8
15
|
export declare function devWarnStyleProperty(name: string, value: unknown, server: boolean): void;
|
package/dist/css.js
CHANGED
|
@@ -20,6 +20,13 @@ function normalizeClass(value) {
|
|
|
20
20
|
}
|
|
21
21
|
return str;
|
|
22
22
|
}
|
|
23
|
+
function mergeClass(left, right) {
|
|
24
|
+
const a = normalizeClass(left);
|
|
25
|
+
const b = normalizeClass(right);
|
|
26
|
+
if (!a) return b;
|
|
27
|
+
if (!b) return a;
|
|
28
|
+
return a + " " + b;
|
|
29
|
+
}
|
|
23
30
|
import { hyphenateStyleName } from "./dom-tables.js";
|
|
24
31
|
const styleNameCache = /* @__PURE__ */ new Map();
|
|
25
32
|
function styleName(name) {
|
|
@@ -84,6 +91,7 @@ function devWarnStyleCoercion(name, value) {
|
|
|
84
91
|
export {
|
|
85
92
|
devWarnStyleCoercion,
|
|
86
93
|
devWarnStyleProperty,
|
|
94
|
+
mergeClass,
|
|
87
95
|
normalizeClass,
|
|
88
96
|
styleName
|
|
89
97
|
};
|
package/dist/dom-tables.js
CHANGED
|
@@ -419,8 +419,13 @@ for (const base of [
|
|
|
419
419
|
UNITLESS_STYLE_PROPS.add("moz" + c);
|
|
420
420
|
UNITLESS_STYLE_PROPS.add("o" + c);
|
|
421
421
|
}
|
|
422
|
+
const unitlessStylePropCache = /* @__PURE__ */ new Map();
|
|
422
423
|
function isUnitlessStyleProp(name) {
|
|
423
|
-
|
|
424
|
+
const cached = unitlessStylePropCache.get(name);
|
|
425
|
+
if (cached !== void 0) return cached;
|
|
426
|
+
const result = UNITLESS_STYLE_PROPS.has(name.replaceAll("-", "").toLowerCase());
|
|
427
|
+
unitlessStylePropCache.set(name, result);
|
|
428
|
+
return result;
|
|
424
429
|
}
|
|
425
430
|
function cssStyleValue(name, value) {
|
|
426
431
|
if (typeof value === "number" && value !== 0 && name.charCodeAt(0) !== 45 && !isUnitlessStyleProp(name)) {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1217,7 +1217,12 @@ export declare function setHTML(el: Element, value: any): void;
|
|
|
1217
1217
|
/** Complete validated write used by direct, spread, and html-only compiler paths. */
|
|
1218
1218
|
export declare function setDangerouslySetInnerHTML(el: Element, value: any): void;
|
|
1219
1219
|
/** Resolve source-ordered direct/spread raw-HTML writers and apply only the winner. */
|
|
1220
|
-
export declare function setDangerouslySetInnerHTMLSources(el: Element, sources: readonly (readonly [
|
|
1220
|
+
export declare function setDangerouslySetInnerHTMLSources(el: Element, sources: readonly (readonly [
|
|
1221
|
+
isSpread: boolean,
|
|
1222
|
+
sourceOrName: unknown,
|
|
1223
|
+
value?: unknown,
|
|
1224
|
+
merge?: boolean
|
|
1225
|
+
])[], ignoreSourceChildren?: boolean): void;
|
|
1221
1226
|
/** Stamp a compiler-proven non-nullish child onto a potential raw-HTML host. */
|
|
1222
1227
|
export declare function markDangerouslySetInnerHTMLChildren(el: Element): void;
|
|
1223
1228
|
export declare function attachRef(ref: any, el: Element | FragmentInstance | null, prevTarget?: Element | FragmentInstance | null): void;
|
|
@@ -1424,7 +1429,12 @@ export declare function setStyle(el: HTMLElement | SVGElement, value: any, prev:
|
|
|
1424
1429
|
export declare function setStyleProperty(el: HTMLElement | SVGElement, name: string, value: any, staticCss: string, previous: any): void;
|
|
1425
1430
|
/** Snapshot a JSX spread with own-enumerable Object.assign semantics. */
|
|
1426
1431
|
export declare function snapshotSpread(value: unknown): Record<string, unknown> | null;
|
|
1427
|
-
type HostPropSource = readonly [
|
|
1432
|
+
type HostPropSource = readonly [
|
|
1433
|
+
isSpread: boolean,
|
|
1434
|
+
sourceOrName: unknown,
|
|
1435
|
+
value?: unknown,
|
|
1436
|
+
merge?: boolean
|
|
1437
|
+
];
|
|
1428
1438
|
/**
|
|
1429
1439
|
* Resolve a spread-bearing compiled host's complete prop set before touching
|
|
1430
1440
|
* the DOM. JSX spread merging is last-writer-wins, but aliases such as
|
|
@@ -1432,6 +1442,12 @@ type HostPropSource = readonly [isSpread: boolean, sourceOrName: unknown, value?
|
|
|
1432
1442
|
* property. Canonical identities ensure a vanished earlier source cannot
|
|
1433
1443
|
* remove an unchanged later winner, and hydration compares only the final
|
|
1434
1444
|
* client value against the final server value.
|
|
1445
|
+
*
|
|
1446
|
+
* A synthesized scope-hash class (4th tuple flag) is not an authored later
|
|
1447
|
+
* writer: after identity last-writer-wins, it composes onto the winning class
|
|
1448
|
+
* instead of replacing a spread's class. An authored `class` beside a spread
|
|
1449
|
+
* stays last-writer-wins because its hash is baked into that authored value
|
|
1450
|
+
* and carries no merge flag.
|
|
1435
1451
|
*/
|
|
1436
1452
|
export declare function setHostPropSources(el: Element, sources: readonly HostPropSource[], prev: Record<string, unknown> | undefined, scope: Scope, hasNestedChildren?: boolean): Record<string, unknown>;
|
|
1437
1453
|
export declare function setSpread(el: Element, value: any, prev: any, mountScope?: Scope, skipDangerouslySetInnerHTML?: boolean, skipFormControls?: boolean): void;
|
|
@@ -1561,7 +1577,7 @@ export declare function setDefaultChecked(el: Element, value: unknown): void;
|
|
|
1561
1577
|
* controlled value before its default fallback) while the compiler-owned
|
|
1562
1578
|
* source bindings preserve authored evaluation order and single getter reads.
|
|
1563
1579
|
*/
|
|
1564
|
-
export declare function setFormControlSources(el: Element, sources: ReadonlyArray<readonly [boolean, unknown, unknown?]>): void;
|
|
1580
|
+
export declare function setFormControlSources(el: Element, sources: ReadonlyArray<readonly [boolean, unknown, unknown?, boolean?]>): void;
|
|
1565
1581
|
interface PortalSlot {
|
|
1566
1582
|
__kind: 'portalSlotSlot';
|
|
1567
1583
|
block: Block | null;
|
package/dist/runtime.js
CHANGED
|
@@ -1554,12 +1554,17 @@ function journalDefaultValue(input) {
|
|
|
1554
1554
|
journalAttr(input, "value");
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
+
function radioCousins(input) {
|
|
1558
|
+
if (input.form !== null) return input.form.elements;
|
|
1559
|
+
const root = input.getRootNode();
|
|
1560
|
+
return root.nodeType === 9 ? root.getElementsByName(input.name) : root.querySelectorAll('input[type="radio"]');
|
|
1561
|
+
}
|
|
1557
1562
|
function journalRadioCousins(input) {
|
|
1558
1563
|
const name = input.name;
|
|
1559
|
-
const group = input
|
|
1564
|
+
const group = radioCousins(input);
|
|
1560
1565
|
for (let i = 0; i < group.length; i++) {
|
|
1561
1566
|
const other = group[i];
|
|
1562
|
-
if (other === input || !other.checked || other.localName !== "input" || other.type !== "radio" || other.name !== name) {
|
|
1567
|
+
if (other === input || !other.checked || other.localName !== "input" || other.type !== "radio" || other.name !== name || other.form !== input.form) {
|
|
1563
1568
|
continue;
|
|
1564
1569
|
}
|
|
1565
1570
|
TRANSITION_JOURNAL.push(JOURNAL_PROP, other, "checked", true);
|
|
@@ -9688,7 +9693,13 @@ function coerceAttrValue(el, name, value) {
|
|
|
9688
9693
|
}
|
|
9689
9694
|
return v;
|
|
9690
9695
|
}
|
|
9691
|
-
import {
|
|
9696
|
+
import {
|
|
9697
|
+
devWarnStyleCoercion,
|
|
9698
|
+
devWarnStyleProperty,
|
|
9699
|
+
mergeClass,
|
|
9700
|
+
normalizeClass,
|
|
9701
|
+
styleName
|
|
9702
|
+
} from "./css.js";
|
|
9692
9703
|
function setClassName(el, value) {
|
|
9693
9704
|
const cls = normalizeClass(value);
|
|
9694
9705
|
const hydration = activeHydration();
|
|
@@ -9884,8 +9895,9 @@ function normalizedHostProp(el, rawName) {
|
|
|
9884
9895
|
}
|
|
9885
9896
|
function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false) {
|
|
9886
9897
|
const props = /* @__PURE__ */ new Map();
|
|
9898
|
+
let classMerges = null;
|
|
9887
9899
|
let sourceOrder = 0;
|
|
9888
|
-
|
|
9900
|
+
function record(rawName, value) {
|
|
9889
9901
|
if (typeof rawName !== "string") return;
|
|
9890
9902
|
const order = sourceOrder++;
|
|
9891
9903
|
const previous = props.get(rawName);
|
|
@@ -9895,10 +9907,15 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false)
|
|
|
9895
9907
|
firstOrder: previous?.firstOrder ?? order,
|
|
9896
9908
|
lastOrder: order
|
|
9897
9909
|
});
|
|
9898
|
-
}
|
|
9910
|
+
}
|
|
9899
9911
|
for (const source of sources) {
|
|
9900
9912
|
if (!source[0]) {
|
|
9901
|
-
|
|
9913
|
+
const rawName = source[1];
|
|
9914
|
+
if (source[3] === true && typeof rawName === "string" && (rawName === "class" || rawName === "className")) {
|
|
9915
|
+
(classMerges ??= []).push({ rawName, value: source[2], order: sourceOrder++ });
|
|
9916
|
+
continue;
|
|
9917
|
+
}
|
|
9918
|
+
record(rawName, source[2]);
|
|
9902
9919
|
continue;
|
|
9903
9920
|
}
|
|
9904
9921
|
const spread = source[1];
|
|
@@ -9924,6 +9941,22 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false)
|
|
|
9924
9941
|
writer.lastOrder
|
|
9925
9942
|
]);
|
|
9926
9943
|
}
|
|
9944
|
+
if (classMerges !== null) {
|
|
9945
|
+
for (const extra of classMerges) {
|
|
9946
|
+
const [identity, name] = normalizedHostProp(el, extra.rawName);
|
|
9947
|
+
const previous = values.get(identity);
|
|
9948
|
+
if (previous !== void 0) {
|
|
9949
|
+
values.set(identity, [
|
|
9950
|
+
previous[0],
|
|
9951
|
+
mergeClass(previous[1], extra.value),
|
|
9952
|
+
previous[2],
|
|
9953
|
+
extra.order
|
|
9954
|
+
]);
|
|
9955
|
+
continue;
|
|
9956
|
+
}
|
|
9957
|
+
values.set(identity, [name, extra.value, extra.order, extra.order]);
|
|
9958
|
+
}
|
|
9959
|
+
}
|
|
9927
9960
|
const resolved = /* @__PURE__ */ Object.create(null);
|
|
9928
9961
|
const ordered = [...values.values()];
|
|
9929
9962
|
if (needsWinningOrderSort) ordered.sort((a, b) => a[2] - b[2]);
|
|
@@ -10099,11 +10132,12 @@ function headBlock(scope, slot, key, tag, attrs, text) {
|
|
|
10099
10132
|
const ownerDocument = parent.nodeType === 9 ? parent : parent.ownerDocument;
|
|
10100
10133
|
const head = ownerDocument.head;
|
|
10101
10134
|
let el2 = adoptServerHeadEl(head, headOwnershipKey(key, rootIdentifierPrefix(scope.block)), tag);
|
|
10135
|
+
const adopted = el2 !== null;
|
|
10102
10136
|
if (el2 === null) {
|
|
10103
10137
|
el2 = ownerDocument.createElement(tag);
|
|
10104
10138
|
head.appendChild(el2);
|
|
10105
10139
|
}
|
|
10106
|
-
state = { el: el2 };
|
|
10140
|
+
state = { el: el2, attrNames: adopted ? el2.getAttributeNames() : void 0 };
|
|
10107
10141
|
scope.slots[slot] = state;
|
|
10108
10142
|
(scope.cleanups ??= []).push(() => {
|
|
10109
10143
|
removeHeadEventListeners(state, null);
|
|
@@ -10112,8 +10146,20 @@ function headBlock(scope, slot, key, tag, attrs, text) {
|
|
|
10112
10146
|
});
|
|
10113
10147
|
}
|
|
10114
10148
|
const el = state.el;
|
|
10149
|
+
if (TRANSITION_JOURNAL !== null) {
|
|
10150
|
+
journalObjectOnce(state);
|
|
10151
|
+
journalBag();
|
|
10152
|
+
}
|
|
10115
10153
|
if (state.handlers !== void 0) removeHeadEventListeners(state, attrs);
|
|
10154
|
+
const previousNames = state.attrNames;
|
|
10155
|
+
if (previousNames !== void 0) {
|
|
10156
|
+
for (let i = 0; i < previousNames.length; i++) {
|
|
10157
|
+
const name = previousNames[i];
|
|
10158
|
+
if (attrs === null || !(name in attrs)) setAttribute(el, name, null);
|
|
10159
|
+
}
|
|
10160
|
+
}
|
|
10116
10161
|
if (attrs !== null) {
|
|
10162
|
+
const names = [];
|
|
10117
10163
|
for (const k in attrs) {
|
|
10118
10164
|
const ev = k.length > 2 && k[0] === "o" && k[1] === "n" ? eventSlot(k) : null;
|
|
10119
10165
|
if (ev !== null) {
|
|
@@ -10134,12 +10180,19 @@ function headBlock(scope, slot, key, tag, attrs, text) {
|
|
|
10134
10180
|
}
|
|
10135
10181
|
continue;
|
|
10136
10182
|
}
|
|
10183
|
+
names.push(k);
|
|
10137
10184
|
setAttribute(el, k, attrs[k]);
|
|
10138
10185
|
}
|
|
10186
|
+
state.attrNames = names;
|
|
10187
|
+
} else {
|
|
10188
|
+
state.attrNames = void 0;
|
|
10139
10189
|
}
|
|
10140
|
-
if (text != null) {
|
|
10141
|
-
const t = String(text);
|
|
10142
|
-
if (el.textContent !== t)
|
|
10190
|
+
if (text != null || tag === "title") {
|
|
10191
|
+
const t = text == null ? "" : String(text);
|
|
10192
|
+
if (el.textContent !== t) {
|
|
10193
|
+
if (TRANSITION_JOURNAL !== null) journalRootRange(el, null, null);
|
|
10194
|
+
el.textContent = t;
|
|
10195
|
+
}
|
|
10143
10196
|
}
|
|
10144
10197
|
}
|
|
10145
10198
|
function namespaceHead(props, scope) {
|
|
@@ -10172,8 +10225,21 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
|
|
|
10172
10225
|
return createElement(namespaceHead, config);
|
|
10173
10226
|
}
|
|
10174
10227
|
function injectStyle(id, css, nonce) {
|
|
10228
|
+
if (typeof document === "undefined") {
|
|
10229
|
+
_injectedStyles.add(id);
|
|
10230
|
+
return;
|
|
10231
|
+
}
|
|
10232
|
+
const existing = document.querySelector(`style[data-octane="${id}"]`);
|
|
10233
|
+
if (existing !== null) {
|
|
10234
|
+
if (_injectedStyles.has(id)) {
|
|
10235
|
+
if (existing.textContent !== css) existing.textContent = css;
|
|
10236
|
+
} else {
|
|
10237
|
+
_injectedStyles.add(id);
|
|
10238
|
+
}
|
|
10239
|
+
return;
|
|
10240
|
+
}
|
|
10175
10241
|
if (_injectedStyles.has(id)) return;
|
|
10176
|
-
if (
|
|
10242
|
+
if (document.querySelector(`style[data-href~="octane-${id}"]`)) {
|
|
10177
10243
|
_injectedStyles.add(id);
|
|
10178
10244
|
return;
|
|
10179
10245
|
}
|
|
@@ -11201,13 +11267,12 @@ function armControlledBase(el) {
|
|
|
11201
11267
|
sv: null,
|
|
11202
11268
|
sawV: false,
|
|
11203
11269
|
sawC: false,
|
|
11270
|
+
sawDC: false,
|
|
11204
11271
|
dvv: UNCONTROLLED,
|
|
11205
11272
|
composing: false,
|
|
11206
11273
|
compositionEndTask: void 0,
|
|
11207
11274
|
queued: false,
|
|
11208
11275
|
formSeen: false,
|
|
11209
|
-
formDefaultValue: UNCONTROLLED,
|
|
11210
|
-
formDefaultChecked: UNCONTROLLED,
|
|
11211
11276
|
formMultiple: false
|
|
11212
11277
|
};
|
|
11213
11278
|
el.$$ctrl = ctrl;
|
|
@@ -11382,9 +11447,14 @@ function setCheckedState(input, value, ctrl) {
|
|
|
11382
11447
|
if (process.env.NODE_ENV !== "production")
|
|
11383
11448
|
queueDevFormDiagnostic(input, CURRENT_SCOPE ?? void 0);
|
|
11384
11449
|
const hydration = activeHydration();
|
|
11385
|
-
if (hydration !== null && !hydration.isFresh(input))
|
|
11386
|
-
|
|
11450
|
+
if (hydration !== null && !hydration.isFresh(input)) {
|
|
11451
|
+
input.checked = input.checked;
|
|
11452
|
+
ctrl.sawDC = true;
|
|
11453
|
+
return;
|
|
11454
|
+
}
|
|
11455
|
+
input.checked = b;
|
|
11387
11456
|
input.defaultChecked = b;
|
|
11457
|
+
ctrl.sawDC = true;
|
|
11388
11458
|
return;
|
|
11389
11459
|
}
|
|
11390
11460
|
if (process.env.NODE_ENV !== "production" && ctrl.c === -1) devWarnControlledFlip(input, true);
|
|
@@ -11398,7 +11468,7 @@ function inActivationWindow(input) {
|
|
|
11398
11468
|
const target = activationCheckable;
|
|
11399
11469
|
if (target === null) return false;
|
|
11400
11470
|
if (input === target) return true;
|
|
11401
|
-
return input.type === "radio" && target.type === "radio" && input.name !== "" && input.name === target.name && input.form === target.form;
|
|
11471
|
+
return input.type === "radio" && target.type === "radio" && input.name !== "" && input.name === target.name && input.form === target.form && (input.form !== null || input.getRootNode() === target.getRootNode());
|
|
11402
11472
|
}
|
|
11403
11473
|
function setChecked(el, value) {
|
|
11404
11474
|
const ctrl = armControlled(el);
|
|
@@ -11536,6 +11606,7 @@ function setDefaultValue(el, value, initial) {
|
|
|
11536
11606
|
}
|
|
11537
11607
|
}
|
|
11538
11608
|
const DEFAULT_VALUE_BASELINE = /* @__PURE__ */ Symbol("octane.defaultValue");
|
|
11609
|
+
const DEFAULT_CHECKED_INITIALIZED = /* @__PURE__ */ Symbol("octane.defaultCheckedInitialized");
|
|
11539
11610
|
function setDefaultValueUncontrolled(el, value) {
|
|
11540
11611
|
const hydration = activeHydration();
|
|
11541
11612
|
const input = el;
|
|
@@ -11564,10 +11635,30 @@ function setDefaultValueUncontrolled(el, value) {
|
|
|
11564
11635
|
}
|
|
11565
11636
|
function setDefaultChecked(el, value) {
|
|
11566
11637
|
const ctrl = armControlled(el);
|
|
11638
|
+
const input = el;
|
|
11567
11639
|
const hydration = activeHydration();
|
|
11568
|
-
|
|
11640
|
+
const hydrating = hydration !== null && !hydration.isFresh(el);
|
|
11641
|
+
const first = !ctrl.sawDC;
|
|
11642
|
+
if (first) {
|
|
11643
|
+
if (TRANSITION_JOURNAL !== null) {
|
|
11644
|
+
journalObjectOnce(ctrl);
|
|
11645
|
+
journalBag();
|
|
11646
|
+
}
|
|
11647
|
+
ctrl.sawDC = true;
|
|
11648
|
+
}
|
|
11649
|
+
if (hydrating) {
|
|
11650
|
+
if (first) input.checked = input.checked;
|
|
11651
|
+
return;
|
|
11652
|
+
}
|
|
11569
11653
|
if (ctrl.c !== -1) return;
|
|
11570
|
-
|
|
11654
|
+
if (first && !(DEFAULT_CHECKED_INITIALIZED in input)) {
|
|
11655
|
+
if (TRANSITION_JOURNAL !== null) {
|
|
11656
|
+
TRANSITION_JOURNAL.push(JOURNAL_PROP, input, "checked", input.checked);
|
|
11657
|
+
if (input.type === "radio" && input.name !== "" && !!value) journalRadioCousins(input);
|
|
11658
|
+
}
|
|
11659
|
+
input.checked = value == null ? input.checked : !!value;
|
|
11660
|
+
}
|
|
11661
|
+
if (value == null) return;
|
|
11571
11662
|
const b = !!value;
|
|
11572
11663
|
if (input.defaultChecked !== b) {
|
|
11573
11664
|
if (TRANSITION_JOURNAL !== null) {
|
|
@@ -11626,15 +11717,12 @@ function setFormControlSources(el, sources) {
|
|
|
11626
11717
|
}
|
|
11627
11718
|
const ctrl = armControlled(el);
|
|
11628
11719
|
const first = !ctrl.formSeen;
|
|
11629
|
-
const previousDefaultChecked = ctrl.formDefaultChecked;
|
|
11630
11720
|
const previousMultiple = ctrl.formMultiple;
|
|
11631
11721
|
if (TRANSITION_JOURNAL !== null) {
|
|
11632
11722
|
journalObjectOnce(ctrl);
|
|
11633
11723
|
journalBag();
|
|
11634
11724
|
}
|
|
11635
11725
|
ctrl.formSeen = true;
|
|
11636
|
-
ctrl.formDefaultValue = defaultValue;
|
|
11637
|
-
ctrl.formDefaultChecked = defaultChecked;
|
|
11638
11726
|
if (process.env.NODE_ENV !== "production" && hasDevFormDiagnosticContext(el, CURRENT_SCOPE ?? void 0)) {
|
|
11639
11727
|
const diagnostic = ensureDevFormDiagnosticState(el);
|
|
11640
11728
|
diagnostic.authoringProps = { value, defaultValue, checked, defaultChecked, multiple };
|
|
@@ -11650,10 +11738,8 @@ function setFormControlSources(el, sources) {
|
|
|
11650
11738
|
setDefaultValue(input, defaultString, first);
|
|
11651
11739
|
}
|
|
11652
11740
|
setChecked(input, checked);
|
|
11653
|
-
if (checked == null && defaultChecked != null
|
|
11654
|
-
|
|
11655
|
-
input.defaultChecked = false;
|
|
11656
|
-
}
|
|
11741
|
+
if (checked == null && (defaultChecked != null || first))
|
|
11742
|
+
setDefaultChecked(input, defaultChecked);
|
|
11657
11743
|
return;
|
|
11658
11744
|
}
|
|
11659
11745
|
if (tag === "textarea") {
|
|
@@ -11846,10 +11932,10 @@ function restoreCheckedState(input, ctrl) {
|
|
|
11846
11932
|
}
|
|
11847
11933
|
function restoreRadioCousins(input) {
|
|
11848
11934
|
const name = input.name;
|
|
11849
|
-
const group = input
|
|
11935
|
+
const group = radioCousins(input);
|
|
11850
11936
|
for (let i = 0; i < group.length; i++) {
|
|
11851
11937
|
const other = group[i];
|
|
11852
|
-
if (other === input || other.localName !== "input" || other.type !== "radio" || other.name !== name) {
|
|
11938
|
+
if (other === input || other.localName !== "input" || other.type !== "radio" || other.name !== name || other.form !== input.form) {
|
|
11853
11939
|
continue;
|
|
11854
11940
|
}
|
|
11855
11941
|
const octrl = other.$$ctrl;
|
|
@@ -13325,19 +13411,29 @@ function hasDangerHTML(props) {
|
|
|
13325
13411
|
function hasHostPropContent(descriptor) {
|
|
13326
13412
|
return hasDangerHTML(descriptor.props) || descriptor.type === "textarea" && (descriptor.props?.value != null || descriptor.props?.defaultValue != null);
|
|
13327
13413
|
}
|
|
13414
|
+
function markInputCheckedness(input) {
|
|
13415
|
+
input.checked = input.checked;
|
|
13416
|
+
input[DEFAULT_CHECKED_INITIALIZED] = true;
|
|
13417
|
+
}
|
|
13328
13418
|
function applyDeoptProps(el, props, ownerBlock) {
|
|
13329
13419
|
if (props == null) {
|
|
13420
|
+
if (el.localName === "input") markInputCheckedness(el);
|
|
13330
13421
|
if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, ownerBlock);
|
|
13331
13422
|
return;
|
|
13332
13423
|
}
|
|
13424
|
+
let needsCheckedInitialization = el.localName === "input";
|
|
13333
13425
|
for (const name in props) {
|
|
13334
13426
|
if (name === "key" || name === "children") continue;
|
|
13335
13427
|
if (name === "suppressHydrationWarning") {
|
|
13336
13428
|
el.__oct_suppress = props[name] === true;
|
|
13337
13429
|
continue;
|
|
13338
13430
|
}
|
|
13339
|
-
|
|
13431
|
+
const value = props[name];
|
|
13432
|
+
if (needsCheckedInitialization && (name === "defaultChecked" || name === "checked" && value != null))
|
|
13433
|
+
needsCheckedInitialization = false;
|
|
13434
|
+
applyDeoptProp(el, name, value, ownerBlock);
|
|
13340
13435
|
}
|
|
13436
|
+
if (needsCheckedInitialization) markInputCheckedness(el);
|
|
13341
13437
|
if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, ownerBlock);
|
|
13342
13438
|
}
|
|
13343
13439
|
function patchDeoptProps(el, prevProps, nextProps, ownerBlock) {
|
|
@@ -13398,6 +13494,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
|
|
|
13398
13494
|
}
|
|
13399
13495
|
function applyHostProps(el, props, scope, state) {
|
|
13400
13496
|
const prev = state.props;
|
|
13497
|
+
let needsCheckedInitialization = prev === void 0 && el.localName === "input";
|
|
13401
13498
|
if (ROOT_RENDER_TRANSACTION !== null && prev !== props) journalObjectOnce(state);
|
|
13402
13499
|
if (prev != null) {
|
|
13403
13500
|
for (const k in prev) {
|
|
@@ -13415,12 +13512,15 @@ function applyHostProps(el, props, scope, state) {
|
|
|
13415
13512
|
}
|
|
13416
13513
|
state.props = props;
|
|
13417
13514
|
if (props == null) {
|
|
13515
|
+
if (needsCheckedInitialization) markInputCheckedness(el);
|
|
13418
13516
|
if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, scope);
|
|
13419
13517
|
return;
|
|
13420
13518
|
}
|
|
13421
13519
|
for (const name in props) {
|
|
13422
13520
|
if (name === "key" || name === "children") continue;
|
|
13423
13521
|
const v = props[name];
|
|
13522
|
+
if (needsCheckedInitialization && (name === "defaultChecked" || name === "checked" && v != null))
|
|
13523
|
+
needsCheckedInitialization = false;
|
|
13424
13524
|
const actionName = formActionAttributeName(el, name);
|
|
13425
13525
|
if (actionName !== null) {
|
|
13426
13526
|
setFormAction(el, actionName, v, prev?.[name]);
|
|
@@ -13458,6 +13558,7 @@ function applyHostProps(el, props, scope, state) {
|
|
|
13458
13558
|
}
|
|
13459
13559
|
}
|
|
13460
13560
|
}
|
|
13561
|
+
if (needsCheckedInitialization) markInputCheckedness(el);
|
|
13461
13562
|
if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, scope);
|
|
13462
13563
|
}
|
|
13463
13564
|
const DEOPT_DESC = /* @__PURE__ */ Symbol("octane.deoptDesc");
|
package/dist/runtime.server.d.ts
CHANGED
|
@@ -213,7 +213,12 @@ export declare function ssrPortal(): string;
|
|
|
213
213
|
export declare function ssrAttr(name: string, v: unknown, tag?: string, namespace?: AttributeNamespace): string;
|
|
214
214
|
/** A dynamic `style` attribute (string cssText or an object). */
|
|
215
215
|
export declare function ssrStyle(v: unknown): string;
|
|
216
|
-
type SsrAttributeSource = readonly [
|
|
216
|
+
type SsrAttributeSource = readonly [
|
|
217
|
+
isSpread: boolean,
|
|
218
|
+
sourceOrName: unknown,
|
|
219
|
+
value?: unknown,
|
|
220
|
+
merge?: boolean
|
|
221
|
+
];
|
|
217
222
|
/**
|
|
218
223
|
* Resolve all serializable attributes across direct JSX writers and spread
|
|
219
224
|
* snapshots. HTML parsers keep the first duplicate attribute, while JSX props
|
|
@@ -222,6 +227,10 @@ type SsrAttributeSource = readonly [isSpread: boolean, sourceOrName: unknown, va
|
|
|
222
227
|
* writes of the same JSX prop retain its first insertion position like
|
|
223
228
|
* Object.assign. Distinct aliases that target one native attr still choose the
|
|
224
229
|
* latest authored writer and retain that winning prop's insertion position.
|
|
230
|
+
*
|
|
231
|
+
* A synthesized scope-hash class (4th tuple flag) composes onto the winning
|
|
232
|
+
* class identity after that last-writer fold, matching the client so a spread
|
|
233
|
+
* `class` is not replaced by the hash alone.
|
|
225
234
|
*/
|
|
226
235
|
export declare function ssrAttrs(sources: readonly SsrAttributeSource[], tag?: string, namespace?: AttributeNamespace, skipFormControls?: boolean): string;
|
|
227
236
|
/**
|
|
@@ -569,6 +578,24 @@ export declare function descriptorChildren<T>(component: T): T;
|
|
|
569
578
|
*/
|
|
570
579
|
export declare function isChildrenBlock(value: unknown): boolean;
|
|
571
580
|
export declare function injectStyle(id: string, css: string, nonce?: string): void;
|
|
581
|
+
/**
|
|
582
|
+
* A compiled assigned `<style>` block (`const theme = <style>…</style>`) on the
|
|
583
|
+
* server. Its CSS belongs to whichever request reads the map — a component in
|
|
584
|
+
* another module applying `theme` or using `theme.card` — so injection happens
|
|
585
|
+
* on property access into the active render's collector, after the CSS of the
|
|
586
|
+
* themes this block itself applies (`applied`: every applied map, same-module
|
|
587
|
+
* or imported, each a wrapper of its own, so a chain injects transitively in
|
|
588
|
+
* "applied before applier" order and each sheet once). A body-less bundle
|
|
589
|
+
* (`<style apply={[a, b]} />`) has no sheet — `id` and `css` are `null` — and
|
|
590
|
+
* only forwards the touch. Reads outside a render are no-ops.
|
|
591
|
+
*/
|
|
592
|
+
export declare function styleMap<T extends object>(id: string | null, css: string | null, map: T, applied?: ReadonlyArray<unknown>): T;
|
|
593
|
+
/**
|
|
594
|
+
* Compiled at the top of a server component body for every imported theme it
|
|
595
|
+
* applies, before its own `injectStyle` calls: reading the map injects the
|
|
596
|
+
* theme's CSS first, so the applying scope's rules win the cascade.
|
|
597
|
+
*/
|
|
598
|
+
export declare function touchStyleMap(map: unknown): void;
|
|
572
599
|
export declare function ssrHeadEl(key: string, tag: string, attrs: Record<string, unknown> | null, text: unknown): string;
|
|
573
600
|
interface NamespaceHeadProps {
|
|
574
601
|
headKey: string;
|