octane 0.1.36 → 0.1.37

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.
@@ -0,0 +1,9 @@
1
+ /** Development-only ARIA naming diagnostics shared by the DOM and SSR runtimes. */
2
+ /** Return whether an authored property belongs to the ARIA naming surface. */
3
+ export declare function isAriaAttributeName(name: string): boolean;
4
+ /** Unknown lowercase aria-* names aggregate by host; casing errors do not. */
5
+ export declare function isUnknownAriaAttribute(name: string): boolean;
6
+ /** Build Octane's actionable development diagnostic without changing serialization. */
7
+ export declare function ariaAttributeWarning(name: string, tag: string): string | null;
8
+ /** Group separately unknown lowercase names into React's singular/plural form. */
9
+ export declare function unknownAriaAttributeWarning(names: readonly string[], tag: string): string;
@@ -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,119 @@
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 aria_diagnostics_exports = {};
20
+ __export(aria_diagnostics_exports, {
21
+ ariaAttributeWarning: () => ariaAttributeWarning,
22
+ isAriaAttributeName: () => isAriaAttributeName,
23
+ isUnknownAriaAttribute: () => isUnknownAriaAttribute,
24
+ unknownAriaAttributeWarning: () => unknownAriaAttributeWarning
25
+ });
26
+ module.exports = __toCommonJS(aria_diagnostics_exports);
27
+ const VALID_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
28
+ "aria-activedescendant",
29
+ "aria-atomic",
30
+ "aria-autocomplete",
31
+ "aria-braillelabel",
32
+ "aria-brailleroledescription",
33
+ "aria-busy",
34
+ "aria-checked",
35
+ "aria-colcount",
36
+ "aria-colindex",
37
+ "aria-colindextext",
38
+ "aria-colspan",
39
+ "aria-controls",
40
+ "aria-current",
41
+ "aria-describedby",
42
+ "aria-description",
43
+ "aria-details",
44
+ "aria-disabled",
45
+ "aria-dropeffect",
46
+ "aria-errormessage",
47
+ "aria-expanded",
48
+ "aria-flowto",
49
+ "aria-grabbed",
50
+ "aria-haspopup",
51
+ "aria-hidden",
52
+ "aria-invalid",
53
+ "aria-keyshortcuts",
54
+ "aria-label",
55
+ "aria-labelledby",
56
+ "aria-level",
57
+ "aria-live",
58
+ "aria-modal",
59
+ "aria-multiline",
60
+ "aria-multiselectable",
61
+ "aria-orientation",
62
+ "aria-owns",
63
+ "aria-placeholder",
64
+ "aria-posinset",
65
+ "aria-pressed",
66
+ "aria-readonly",
67
+ "aria-relevant",
68
+ "aria-required",
69
+ "aria-roledescription",
70
+ "aria-rowcount",
71
+ "aria-rowindex",
72
+ "aria-rowindextext",
73
+ "aria-rowspan",
74
+ "aria-selected",
75
+ "aria-setsize",
76
+ "aria-sort",
77
+ "aria-valuemax",
78
+ "aria-valuemin",
79
+ "aria-valuenow",
80
+ "aria-valuetext"
81
+ ]);
82
+ function isAriaAttributeName(name) {
83
+ if (name === "aria") return true;
84
+ if (name.length < 5 || name.slice(0, 4) !== "aria") return false;
85
+ const next = name.charCodeAt(4);
86
+ return next === 45 || next >= 65 && next <= 90;
87
+ }
88
+ function isUnknownAriaAttribute(name) {
89
+ return name.startsWith("aria-") && !VALID_ARIA_ATTRIBUTES.has(name.toLowerCase());
90
+ }
91
+ function ariaAttributeWarning(name, tag) {
92
+ if (name === "aria") {
93
+ return "The `aria` attribute is reserved for future use. Pass individual `aria-*` attributes instead.";
94
+ }
95
+ if (name.length < 5 || name.slice(0, 4) !== "aria") return null;
96
+ if (name.charCodeAt(4) === 45) {
97
+ const lowercase = name.toLowerCase();
98
+ if (VALID_ARIA_ATTRIBUTES.has(lowercase)) {
99
+ return name === lowercase ? null : `Unknown ARIA attribute \`${name}\`. Did you mean \`${lowercase}\`?`;
100
+ }
101
+ return `Invalid aria prop \`${name}\` on <${tag}> tag. ARIA attributes must use valid, lowercase aria-* names.`;
102
+ }
103
+ const next = name.charCodeAt(4);
104
+ if (next < 65 || next > 90) return null;
105
+ const correctName = "aria-" + name.slice(4).toLowerCase();
106
+ 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.`;
107
+ }
108
+ function unknownAriaAttributeWarning(names, tag) {
109
+ const noun = names.length === 1 ? "prop" : "props";
110
+ const quoted = names.map((name) => `\`${name}\``).join(", ");
111
+ return `Invalid aria ${noun} ${quoted} on <${tag}> tag. ARIA attributes must use valid, lowercase aria-* names.`;
112
+ }
113
+ // Annotate the CommonJS export names for ESM import in node:
114
+ 0 && (module.exports = {
115
+ ariaAttributeWarning,
116
+ isAriaAttributeName,
117
+ isUnknownAriaAttribute,
118
+ unknownAriaAttributeWarning
119
+ });
@@ -43,6 +43,7 @@ __export(constants_exports, {
43
43
  POSITIVE_NUMERIC_ATTR_PROPS: () => POSITIVE_NUMERIC_ATTR_PROPS,
44
44
  REJECTION_SENTINEL_KEY: () => REJECTION_SENTINEL_KEY,
45
45
  STREAM_BOUNDARY_ATTR: () => import_stream_protocol2.STREAM_BOUNDARY_ATTR,
46
+ STREAM_RESOURCE_ATTR: () => STREAM_RESOURCE_ATTR,
46
47
  STREAM_SCRIPT_ATTR: () => STREAM_SCRIPT_ATTR,
47
48
  STREAM_SEED_ATTR: () => STREAM_SEED_ATTR,
48
49
  STREAM_SEED_COMMENT: () => STREAM_SEED_COMMENT,
@@ -90,6 +91,7 @@ const HYDRATE_SEED_ATTR = "data-octane-hydrate-seed";
90
91
  const STREAM_SEGMENT_ATTR = "data-oct-s";
91
92
  const STREAM_SEED_ATTR = "data-oct-seed";
92
93
  const STREAM_SCRIPT_ATTR = "data-octane-stream";
94
+ const STREAM_RESOURCE_ATTR = "data-oct-fr";
93
95
  const STREAM_SEED_COMMENT = "oct-seed:";
94
96
  const VOID_ELEMENTS = import_dom_tables.VOID_ELEMENTS;
95
97
  const BOOLEAN_ATTR_PROPS = import_dom_tables.BOOLEAN_ATTR_PROPS;
@@ -128,6 +130,7 @@ const cssStyleValue = import_dom_tables.cssStyleValue;
128
130
  POSITIVE_NUMERIC_ATTR_PROPS,
129
131
  REJECTION_SENTINEL_KEY,
130
132
  STREAM_BOUNDARY_ATTR,
133
+ STREAM_RESOURCE_ATTR,
131
134
  STREAM_SCRIPT_ATTR,
132
135
  STREAM_SEED_ATTR,
133
136
  STREAM_SEED_COMMENT,
package/dist/cjs/css.cjs CHANGED
@@ -18,6 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var css_exports = {};
20
20
  __export(css_exports, {
21
+ devWarnStyleCoercion: () => devWarnStyleCoercion,
22
+ devWarnStyleProperty: () => devWarnStyleProperty,
21
23
  normalizeClass: () => normalizeClass,
22
24
  styleName: () => styleName
23
25
  });
@@ -53,8 +55,62 @@ function styleName(name) {
53
55
  styleNameCache.set(name, result);
54
56
  return result;
55
57
  }
58
+ let warnedStyleNames = null;
59
+ let warnedStyleValues = null;
60
+ let warnedStyleNaN = 0;
61
+ let warnedStyleInfinity = 0;
62
+ function devWarnStyleProperty(name, value, server) {
63
+ const type = typeof value;
64
+ if (name.charCodeAt(0) === 45 && name.charCodeAt(1) === 45) return;
65
+ let prefixLength = 0;
66
+ if (name.startsWith("webkit")) prefixLength = 6;
67
+ else if (name.startsWith("moz")) prefixLength = 3;
68
+ else if (name.charCodeAt(0) === 111) prefixLength = 1;
69
+ const following = name.charCodeAt(prefixLength);
70
+ if (prefixLength !== 0 && following >= 65 && following <= 90) {
71
+ const key = (server ? "s:" : "c:") + name;
72
+ const warned = warnedStyleNames ??= /* @__PURE__ */ new Set();
73
+ if (!warned.has(key)) {
74
+ warned.add(key);
75
+ console.error(
76
+ `Unsupported vendor-prefixed style property ${name}. Did you mean ${name.charAt(0).toUpperCase()}${name.slice(1)}?`
77
+ );
78
+ }
79
+ } else if (type === "string") {
80
+ const text = value;
81
+ if (text.trimEnd().endsWith(";")) {
82
+ const key = (server ? "s:" : "c:") + text;
83
+ const warned = warnedStyleValues ??= /* @__PURE__ */ new Set();
84
+ if (!warned.has(key)) {
85
+ warned.add(key);
86
+ console.error(
87
+ `Style property values shouldn't contain a semicolon. Try "${name}: ${text.slice(0, text.lastIndexOf(";"))}" instead.`
88
+ );
89
+ }
90
+ }
91
+ }
92
+ if (type !== "number") return;
93
+ const surface = server ? 2 : 1;
94
+ if (Number.isNaN(value)) {
95
+ if ((warnedStyleNaN & surface) !== 0) return;
96
+ warnedStyleNaN |= surface;
97
+ console.error(`\`NaN\` is an invalid value for the \`${name}\` css style property.`);
98
+ } else if (!Number.isFinite(value)) {
99
+ if ((warnedStyleInfinity & surface) !== 0) return;
100
+ warnedStyleInfinity |= surface;
101
+ console.error(`\`Infinity\` is an invalid value for the \`${name}\` css style property.`);
102
+ }
103
+ }
104
+ function devWarnStyleCoercion(name, value) {
105
+ const valueType = typeof value === "symbol" ? "Symbol" : value.constructor?.name || "Object";
106
+ console.error(
107
+ `The provided \`${name}\` CSS property is an unsupported type ${valueType}. This value must be coerced to a string before using it here.`
108
+ );
109
+ }
56
110
  // Annotate the CommonJS export names for ESM import in node:
57
111
  0 && (module.exports = {
112
+ devWarnStyleCoercion,
113
+ devWarnStyleProperty,
58
114
  normalizeClass,
59
115
  styleName
60
116
  });
@@ -220,6 +220,7 @@ module.exports = __toCommonJS(runtime_exports);
220
220
  var import_constants = require("./constants.cjs");
221
221
  var import_has_own = require("./has-own.cjs");
222
222
  var import_head_ownership = require("./head-ownership.cjs");
223
+ var import_aria_diagnostics = require("./aria-diagnostics.cjs");
223
224
  var import_shared_value_helpers = require("./shared-value-helpers.cjs");
224
225
  var import_profiling = require("./profiling.cjs");
225
226
  var import_devtools_hook = require("./devtools-hook.cjs");
@@ -6105,7 +6106,7 @@ class HydrationCapability {
6105
6106
  const before = style.cssText;
6106
6107
  const expectedStyle = document.createElement("div").style;
6107
6108
  if (staticCss !== void 0) expectedStyle.cssText = staticCss;
6108
- applyStyleValue(expectedStyle, value, void 0);
6109
+ applyStyleValue(el, expectedStyle, value, void 0);
6109
6110
  const expected = expectedStyle.cssText;
6110
6111
  const expectsStyleAttribute = expected !== "";
6111
6112
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
@@ -7113,6 +7114,10 @@ function attrNamespace(name) {
7113
7114
  return null;
7114
7115
  }
7115
7116
  function setAttribute(el, name, value) {
7117
+ if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && (0, import_aria_diagnostics.isAriaAttributeName)(name) && !isHtmlCustomElement(el)) {
7118
+ const warning = (0, import_aria_diagnostics.ariaAttributeWarning)(name, el.localName);
7119
+ if (warning !== null) devWarnAttributeOnce(el, name, warning);
7120
+ }
7116
7121
  if (name === "dangerouslySetInnerHTML") {
7117
7122
  setDangerouslySetInnerHTML(el, value);
7118
7123
  return;
@@ -7237,6 +7242,25 @@ function devWarnAttributeOnce(_el, name, message) {
7237
7242
  warned.add(name);
7238
7243
  console.error(message);
7239
7244
  }
7245
+ function devValidateAriaProps(el, props) {
7246
+ if (el.__oct_loc === void 0 || isHtmlCustomElement(el)) return;
7247
+ let unknown;
7248
+ for (const name of Object.keys(props)) {
7249
+ if (!(0, import_aria_diagnostics.isAriaAttributeName)(name)) continue;
7250
+ const warning = (0, import_aria_diagnostics.ariaAttributeWarning)(name, el.localName);
7251
+ if (warning === null) continue;
7252
+ if (!(0, import_aria_diagnostics.isUnknownAriaAttribute)(name)) {
7253
+ devWarnAttributeOnce(el, name, warning);
7254
+ continue;
7255
+ }
7256
+ if (DEV_ATTRIBUTE_WARNINGS?.has(name)) continue;
7257
+ (DEV_ATTRIBUTE_WARNINGS ??= /* @__PURE__ */ new Set()).add(name);
7258
+ (unknown ??= []).push(name);
7259
+ }
7260
+ if (unknown !== void 0) {
7261
+ console.error((0, import_aria_diagnostics.unknownAriaAttributeWarning)(unknown, el.localName));
7262
+ }
7263
+ }
7240
7264
  function setStringData(el, name, value) {
7241
7265
  const t = typeof value;
7242
7266
  let next;
@@ -7268,6 +7292,10 @@ function setBooleanAttribute(el, name, value) {
7268
7292
  else el.setAttribute(name, next);
7269
7293
  }
7270
7294
  function setAriaAttribute(el, name, value) {
7295
+ if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0 && !isHtmlCustomElement(el)) {
7296
+ const warning = (0, import_aria_diagnostics.ariaAttributeWarning)(name, el.localName);
7297
+ if (warning !== null) devWarnAttributeOnce(el, name, warning);
7298
+ }
7271
7299
  const next = value == null ? null : String(value);
7272
7300
  const hydration = activeHydration();
7273
7301
  if (hydration !== null && !hydration.allowAttribute(el, name, next)) return;
@@ -7381,7 +7409,7 @@ function setStyle(el, value, prev) {
7381
7409
  const hydration = activeHydration();
7382
7410
  if (hydration !== null && hydration.applyStyle(el, value, prev)) return;
7383
7411
  if (TRANSITION_JOURNAL !== null) journalAttr(el, "style");
7384
- applyStyleValue(style, value, prev);
7412
+ applyStyleValue(el, style, value, prev);
7385
7413
  }
7386
7414
  function setStyleProperty(el, name, value, staticCss, previous) {
7387
7415
  const hydration = activeHydration();
@@ -7394,9 +7422,9 @@ function setStyleProperty(el, name, value, staticCss, previous) {
7394
7422
  if (TRANSITION_JOURNAL !== null) journalAttr(el, "style");
7395
7423
  const style = el.style;
7396
7424
  if (remove) style.removeProperty((0, import_css.styleName)(name));
7397
- else applyStyleProperty(style, name, value);
7425
+ else applyStyleProperty(el, style, name, value);
7398
7426
  }
7399
- function applyStyleValue(style, value, prev) {
7427
+ function applyStyleValue(el, style, value, prev) {
7400
7428
  if (value == null || value === false || value === "") {
7401
7429
  if (prev != null && prev !== false && prev !== "") style.cssText = "";
7402
7430
  return;
@@ -7413,19 +7441,30 @@ function applyStyleValue(style, value, prev) {
7413
7441
  const v = value[k];
7414
7442
  if (v === prev[k]) continue;
7415
7443
  if (v == null || typeof v === "boolean") style.removeProperty((0, import_css.styleName)(k));
7416
- else applyStyleProperty(style, k, v);
7444
+ else applyStyleProperty(el, style, k, v);
7417
7445
  }
7418
7446
  } else {
7419
7447
  if (typeof prev === "string") style.cssText = "";
7420
7448
  for (const k in value) {
7421
7449
  const v = value[k];
7422
- if (v != null && typeof v !== "boolean") applyStyleProperty(style, k, v);
7450
+ if (v != null && typeof v !== "boolean") applyStyleProperty(el, style, k, v);
7423
7451
  }
7424
7452
  }
7425
7453
  }
7426
- function applyStyleProperty(style, name, value) {
7454
+ function applyStyleProperty(el, style, name, value) {
7427
7455
  const prop = (0, import_css.styleName)(name);
7428
- const s = (0, import_constants.cssStyleValue)(name, value);
7456
+ let s;
7457
+ if (process.env.NODE_ENV !== "production" && el.__oct_loc !== void 0) {
7458
+ (0, import_css.devWarnStyleProperty)(name, value, false);
7459
+ try {
7460
+ s = (0, import_constants.cssStyleValue)(name, value);
7461
+ } catch (error) {
7462
+ (0, import_css.devWarnStyleCoercion)(name, value);
7463
+ throw error;
7464
+ }
7465
+ } else {
7466
+ s = (0, import_constants.cssStyleValue)(name, value);
7467
+ }
7429
7468
  const tail = s.trimEnd();
7430
7469
  if (tail.endsWith(IMPORTANT_SUFFIX)) {
7431
7470
  style.setProperty(
@@ -7575,6 +7614,9 @@ function isAggregatedFormControlProp(el, name) {
7575
7614
  return false;
7576
7615
  }
7577
7616
  function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = false, skipFormControls = false) {
7617
+ if (process.env.NODE_ENV !== "production" && value != null) {
7618
+ devValidateAriaProps(el, Object(value));
7619
+ }
7578
7620
  if (value != null && Object.prototype.propertyIsEnumerable.call(Object(value), "suppressHydrationWarning")) {
7579
7621
  el.__oct_suppress = value.suppressHydrationWarning !== false;
7580
7622
  }
@@ -16382,7 +16424,17 @@ function preload(href, options) {
16382
16424
  const rawHref = guarded;
16383
16425
  if (as === "font") options = { ...options, crossOrigin: "" };
16384
16426
  if (as === "style" || as === "script") stashPreloadTransfer(as, rawHref, options);
16385
- if (as === "style" && resourceState().sheets.has(rawHref)) return;
16427
+ if (as === "style" && resourceState().sheets.has(rawHref)) {
16428
+ const styles = document.head.querySelectorAll("style[data-precedence]");
16429
+ let hasInlineStyle = false;
16430
+ for (let i = 0; i < styles.length; i++) {
16431
+ if (styles[i].getAttribute("data-href") === rawHref) {
16432
+ hasInlineStyle = true;
16433
+ break;
16434
+ }
16435
+ }
16436
+ if (!hasInlineStyle) return;
16437
+ }
16386
16438
  if (as === "script" && resourceState().scripts.has(rawHref)) return;
16387
16439
  const imageSrcSet = as === "image" ? options.imageSrcSet : void 0;
16388
16440
  const key = typeof imageSrcSet === "string" && imageSrcSet !== "" ? "preload:image:" + imageSrcSet + "::" + String(options.imageSizes ?? "") : "preload:" + as + ":" + rawHref;
@@ -16460,7 +16512,12 @@ function preloadModule(href, options) {
16460
16512
  function preinitModule(href, options) {
16461
16513
  const rawHref = guardHintHref("preinitModule", href);
16462
16514
  if (rawHref === null) return;
16463
- if ((options?.as ?? "script") !== "script") return;
16515
+ if ((options?.as ?? "script") !== "script") {
16516
+ warnHintUsage(
16517
+ 'preinitModule() supports only as: "script" (got ' + JSON.stringify(options?.as) + "); the call was ignored. Use preloadModule() for other module destinations."
16518
+ );
16519
+ return;
16520
+ }
16464
16521
  const state = resourceState();
16465
16522
  if (state.scripts.has(rawHref)) return;
16466
16523
  const safeHref = (0, import_sanitize_url.sanitizeURL)(rawHref);
@@ -16502,6 +16559,14 @@ function resourceState() {
16502
16559
  const src = el.getAttribute("src");
16503
16560
  if (src !== null) state.scripts.add(src);
16504
16561
  }
16562
+ if (typeof window !== "undefined") {
16563
+ window.$OCTFR = (el) => {
16564
+ const href = el.getAttribute("href") ?? el.getAttribute("data-href");
16565
+ if (href === null || state.sheets.has(href)) return;
16566
+ insertPrecedenced(state, el, el.getAttribute("data-precedence") ?? "");
16567
+ state.sheets.add(href);
16568
+ };
16569
+ }
16505
16570
  }
16506
16571
  return _resourceState = state;
16507
16572
  }
@@ -16529,7 +16594,25 @@ function applyResourceAttrs(el, attrs) {
16529
16594
  el.setAttribute(name, (0, import_sanitize_url.sanitizeURLAttribute)(el.localName, name, v === true ? "" : String(v)));
16530
16595
  }
16531
16596
  }
16532
- function stylesheetResource(attrs) {
16597
+ function warnInvalidStylesheetResource(reason) {
16598
+ let conflict;
16599
+ if (reason === "missing-href") {
16600
+ conflict = "requires a non-empty string `href`";
16601
+ } else if (reason === "empty-href") {
16602
+ conflict = "has an empty `href`; a stylesheet resource requires a non-empty string `href`";
16603
+ } else {
16604
+ const props = reason === "onLoad+onError" ? "`onLoad` and `onError`" : "`" + reason + "`";
16605
+ conflict = "also has " + props + ", which requires an independently managed stylesheet";
16606
+ }
16607
+ console.error(
16608
+ 'A <link rel="stylesheet"> with `precedence` ' + conflict + ". It will not be hoisted or deduplicated; remove the conflicting prop or `precedence`."
16609
+ );
16610
+ }
16611
+ function stylesheetResource(attrs, invalidReason) {
16612
+ if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
16613
+ warnInvalidStylesheetResource(invalidReason);
16614
+ return;
16615
+ }
16533
16616
  if (typeof document === "undefined" || attrs == null) return;
16534
16617
  const href = attrs.href;
16535
16618
  if (typeof href !== "string" || href === "") return;
@@ -16544,12 +16627,17 @@ function stylesheetResource(attrs) {
16544
16627
  insertPrecedenced(state, l, precedence);
16545
16628
  state.sheets.add(href);
16546
16629
  }
16547
- function styleResource(attrs, css) {
16630
+ function styleResource(attrs, css, development) {
16548
16631
  if (typeof document === "undefined" || attrs == null) return;
16549
16632
  const href = attrs.href;
16550
16633
  if (typeof href !== "string" || href === "") return;
16551
16634
  const state = resourceState();
16552
16635
  if (state.sheets.has(href)) return;
16636
+ if (process.env.NODE_ENV !== "production" && development === true && hasHeadHint("preload:style:" + href)) {
16637
+ console.error(
16638
+ 'A <style> resource with href "' + href + '" follows a stylesheet preload for the same href. Inline styles cannot consume a stylesheet preload; remove the preload or use a stylesheet link.'
16639
+ );
16640
+ }
16553
16641
  const precedence = attrs.precedence == null ? "" : String(attrs.precedence);
16554
16642
  if (process.env.NODE_ENV !== "production" && /<\/style/i.test(css)) {
16555
16643
  console.error(
@@ -16567,6 +16655,7 @@ function styleResource(attrs, css) {
16567
16655
  function resetFloatResourceState() {
16568
16656
  _resourceState = null;
16569
16657
  _preloadTransfer = null;
16658
+ if (typeof window !== "undefined") delete window.$OCTFR;
16570
16659
  }
16571
16660
  function scriptResource(attrs) {
16572
16661
  if (typeof document === "undefined" || attrs == null) return;