octane 0.1.36 → 0.1.38

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.
Files changed (39) hide show
  1. package/dist/aria-diagnostics.d.ts +9 -0
  2. package/dist/aria-diagnostics.js +92 -0
  3. package/dist/cjs/aria-diagnostics.cjs +119 -0
  4. package/dist/cjs/constants.cjs +3 -0
  5. package/dist/cjs/css.cjs +56 -0
  6. package/dist/cjs/form-diagnostics.cjs +120 -0
  7. package/dist/cjs/host-property-diagnostics.cjs +197 -0
  8. package/dist/cjs/html-tree-validation.cjs +51 -7
  9. package/dist/cjs/index.cjs +4 -0
  10. package/dist/cjs/resource-hint-diagnostics.cjs +91 -0
  11. package/dist/cjs/runtime.cjs +345 -43
  12. package/dist/cjs/runtime.server.cjs +364 -53
  13. package/dist/cjs/server/index.cjs +4 -0
  14. package/dist/cjs/version.cjs +1 -1
  15. package/dist/compiler/compile.js +629 -59
  16. package/dist/constants.d.ts +3 -0
  17. package/dist/constants.js +2 -0
  18. package/dist/css.d.ts +4 -0
  19. package/dist/css.js +54 -0
  20. package/dist/form-diagnostics.d.ts +10 -0
  21. package/dist/form-diagnostics.js +96 -0
  22. package/dist/host-property-diagnostics.d.ts +10 -0
  23. package/dist/host-property-diagnostics.js +169 -0
  24. package/dist/html-tree-validation.d.ts +3 -1
  25. package/dist/html-tree-validation.js +49 -6
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +4 -0
  28. package/dist/resource-hint-diagnostics.d.ts +4 -0
  29. package/dist/resource-hint-diagnostics.js +67 -0
  30. package/dist/runtime.d.ts +6 -2
  31. package/dist/runtime.js +359 -44
  32. package/dist/runtime.server.d.ts +11 -5
  33. package/dist/runtime.server.js +377 -55
  34. package/dist/server/index.d.ts +1 -1
  35. package/dist/server/index.js +4 -0
  36. package/dist/universal-core.d.ts +11 -0
  37. package/dist/universal-core.js +75 -8
  38. package/dist/version.js +1 -1
  39. package/package.json +2 -2
@@ -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
  });
@@ -0,0 +1,120 @@
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 form_diagnostics_exports = {};
20
+ __export(form_diagnostics_exports, {
21
+ formAuthoringDiagnostics: () => formAuthoringDiagnostics
22
+ });
23
+ module.exports = __toCommonJS(form_diagnostics_exports);
24
+ function formAuthoringDiagnostics(tag, props, children) {
25
+ const diagnostics = [];
26
+ if (tag === "input" || tag === "textarea" || tag === "select") {
27
+ if (props.value !== void 0 && props.defaultValue !== void 0) {
28
+ diagnostics.push({
29
+ kind: "value-default",
30
+ message: `A <${tag}> has both \`value\` and \`defaultValue\` props. A form field must be either controlled or uncontrolled; remove one of these props.`
31
+ });
32
+ }
33
+ if (tag === "input" && props.checked !== void 0 && props.defaultChecked !== void 0) {
34
+ diagnostics.push({
35
+ kind: "checked-default",
36
+ message: "A <input> has both `checked` and `defaultChecked` props. A form field must be either controlled or uncontrolled; remove one of these props."
37
+ });
38
+ }
39
+ }
40
+ if (tag === "textarea" && children != null && props.value == null) {
41
+ diagnostics.push({
42
+ kind: "textarea-children",
43
+ message: "Use `defaultValue` or `value` instead of children on <textarea>."
44
+ });
45
+ }
46
+ if (tag === "option") {
47
+ if (props.selected != null) {
48
+ diagnostics.push({
49
+ kind: "option-selected",
50
+ message: "Use `value` or `defaultValue` on <select> instead of `selected` on <option>."
51
+ });
52
+ }
53
+ if (props.value == null && children !== void 0 && typeof children === "object" && children !== null) {
54
+ diagnostics.push({
55
+ kind: "option-children",
56
+ message: "Cannot infer an <option> value from complex children. Pass an explicit `value` prop or use plain text children."
57
+ });
58
+ }
59
+ }
60
+ const action = tag === "form" ? props.action : props.formAction ?? props.formaction;
61
+ if (action == null) return diagnostics;
62
+ if (tag === "input") {
63
+ if (props.type !== "submit" && props.type !== "image") {
64
+ diagnostics.push({
65
+ kind: "action-type",
66
+ message: 'A <input> can only specify `formAction` with type="submit" or type="image".'
67
+ });
68
+ return diagnostics;
69
+ }
70
+ } else if (tag === "button") {
71
+ if (props.type != null && props.type !== "submit") {
72
+ diagnostics.push({
73
+ kind: "action-type",
74
+ message: 'A <button> can only specify `formAction` with type="submit" or no type.'
75
+ });
76
+ return diagnostics;
77
+ }
78
+ } else if (tag !== "form") {
79
+ return diagnostics;
80
+ }
81
+ if (typeof action !== "function") return diagnostics;
82
+ if (tag === "form") {
83
+ if (props.method != null || props.encType != null || props.enctype != null) {
84
+ diagnostics.push({
85
+ kind: "action-method",
86
+ message: "A function form action cannot specify `method` or `encType`; Octane controls the submission transport."
87
+ });
88
+ }
89
+ if (props.target != null) {
90
+ diagnostics.push({
91
+ kind: "action-target",
92
+ message: "A function form action cannot specify `target`; the action always executes in the current window."
93
+ });
94
+ }
95
+ return diagnostics;
96
+ }
97
+ if (props.name != null) {
98
+ diagnostics.push({
99
+ kind: "action-name",
100
+ message: "A function `formAction` cannot specify `name`; the submitter identity is controlled by the action."
101
+ });
102
+ }
103
+ if (props.formMethod != null || props.formmethod != null || props.formEncType != null || props.formenctype != null) {
104
+ diagnostics.push({
105
+ kind: "action-method",
106
+ message: "A function `formAction` cannot specify `formMethod` or `formEncType`; Octane controls the submission transport."
107
+ });
108
+ }
109
+ if (props.formTarget != null || props.formtarget != null) {
110
+ diagnostics.push({
111
+ kind: "action-target",
112
+ message: "A function `formAction` cannot specify `formTarget`; the action always executes in the current window."
113
+ });
114
+ }
115
+ return diagnostics;
116
+ }
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ formAuthoringDiagnostics
120
+ });
@@ -0,0 +1,197 @@
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 host_property_diagnostics_exports = {};
20
+ __export(host_property_diagnostics_exports, {
21
+ booleanAttributeStringWarning: () => booleanAttributeStringWarning,
22
+ emptyResourceUrlWarning: () => emptyResourceUrlWarning,
23
+ hostPropertyWarning: () => hostPropertyWarning,
24
+ invalidHostPropertiesWarning: () => invalidHostPropertiesWarning,
25
+ unsupportedAttributeCoercionWarning: () => unsupportedAttributeCoercionWarning
26
+ });
27
+ module.exports = __toCommonJS(host_property_diagnostics_exports);
28
+ var import_constants = require("./constants.cjs");
29
+ const KNOWN_CAMELCASE_PROPERTIES = /* @__PURE__ */ new Set([
30
+ "autoCapitalize",
31
+ "autoComplete",
32
+ "autoCorrect",
33
+ "autoFocus",
34
+ "autoPlay",
35
+ "allowFullScreen",
36
+ "charSet",
37
+ "className",
38
+ "contentEditable",
39
+ "dangerouslySetInnerHTML",
40
+ "defaultChecked",
41
+ "defaultValue",
42
+ "disablePictureInPicture",
43
+ "disableRemotePlayback",
44
+ "encType",
45
+ "fetchPriority",
46
+ "formAction",
47
+ "formEncType",
48
+ "formMethod",
49
+ "formNoValidate",
50
+ "formTarget",
51
+ "imageSizes",
52
+ "imageSrcSet",
53
+ "inputMode",
54
+ "itemID",
55
+ "itemProp",
56
+ "itemRef",
57
+ "itemScope",
58
+ "itemType",
59
+ "maxLength",
60
+ "noModule",
61
+ "noValidate",
62
+ "playsInline",
63
+ "readOnly",
64
+ "referrerPolicy",
65
+ "spellCheck",
66
+ "srcDoc",
67
+ "srcLang",
68
+ "srcSet",
69
+ "suppressContentEditableWarning",
70
+ "suppressHydrationWarning",
71
+ "suppressNativeChangeWarning",
72
+ "tabIndex",
73
+ "viewBox"
74
+ ]);
75
+ const KNOWN_PROPERTY_SPELLINGS = /* @__PURE__ */ new Map();
76
+ for (const name of KNOWN_CAMELCASE_PROPERTIES)
77
+ KNOWN_PROPERTY_SPELLINGS.set(name.toLowerCase(), name);
78
+ for (const [name, alias] of import_constants.ATTRIBUTE_ALIASES) {
79
+ KNOWN_PROPERTY_SPELLINGS.set(name.toLowerCase(), name);
80
+ KNOWN_PROPERTY_SPELLINGS.set(alias.toLowerCase(), name);
81
+ }
82
+ const KNOWN_SVG_PROPERTY_SPELLINGS = /* @__PURE__ */ new Map();
83
+ for (const name of [
84
+ "allowReorder",
85
+ "attributeName",
86
+ "attributeType",
87
+ "autoReverse",
88
+ "baseFrequency",
89
+ "baseProfile",
90
+ "calcMode",
91
+ "clipPathUnits",
92
+ "contentScriptType",
93
+ "contentStyleType",
94
+ "diffuseConstant",
95
+ "edgeMode",
96
+ "externalResourcesRequired",
97
+ "filterRes",
98
+ "filterUnits",
99
+ "glyphRef",
100
+ "gradientTransform",
101
+ "gradientUnits",
102
+ "kernelMatrix",
103
+ "kernelUnitLength",
104
+ "keyPoints",
105
+ "keySplines",
106
+ "keyTimes",
107
+ "lengthAdjust",
108
+ "limitingConeAngle",
109
+ "markerHeight",
110
+ "markerUnits",
111
+ "markerWidth",
112
+ "maskContentUnits",
113
+ "maskUnits",
114
+ "numOctaves",
115
+ "pathLength",
116
+ "patternContentUnits",
117
+ "patternTransform",
118
+ "patternUnits",
119
+ "pointsAtX",
120
+ "pointsAtY",
121
+ "pointsAtZ",
122
+ "preserveAlpha",
123
+ "preserveAspectRatio",
124
+ "primitiveUnits",
125
+ "refX",
126
+ "refY",
127
+ "repeatCount",
128
+ "repeatDur",
129
+ "requiredExtensions",
130
+ "requiredFeatures",
131
+ "specularConstant",
132
+ "specularExponent",
133
+ "spreadMethod",
134
+ "startOffset",
135
+ "stdDeviation",
136
+ "stitchTiles",
137
+ "surfaceScale",
138
+ "systemLanguage",
139
+ "tableValues",
140
+ "targetX",
141
+ "targetY",
142
+ "textLength",
143
+ "viewTarget",
144
+ "xChannelSelector",
145
+ "yChannelSelector",
146
+ "zoomAndPan"
147
+ ]) {
148
+ KNOWN_SVG_PROPERTY_SPELLINGS.set(name.toLowerCase(), name);
149
+ }
150
+ function hostPropertyWarning(name, value, tag, isSvg = false) {
151
+ const lower = name.toLowerCase();
152
+ if (name === "for" && tag === "label") return null;
153
+ if (lower === "innerhtml") {
154
+ return "Directly setting property `innerHTML` is not permitted. Use `dangerouslySetInnerHTML={{ __html: value }}` instead.";
155
+ }
156
+ if (lower === "is" && value != null && typeof value !== "string") {
157
+ return `Received a \`${typeof value}\` for a string attribute \`is\`. If this is expected, cast the value to a string.`;
158
+ }
159
+ if (name.length > 2 && name[0] === "o" && name[1] === "n" && typeof value === "string") {
160
+ return `Unknown event handler property \`${name}\`. It will be ignored.`;
161
+ }
162
+ if (name.startsWith("aria-") || /^aria[A-Z]/.test(name) || name.startsWith("data-")) return null;
163
+ const known = KNOWN_PROPERTY_SPELLINGS.get(lower) ?? (isSvg ? KNOWN_SVG_PROPERTY_SPELLINGS.get(lower) : void 0);
164
+ if (known !== void 0) {
165
+ if (isSvg && import_constants.ATTRIBUTE_ALIASES.get(known) === name) return null;
166
+ return name !== known ? `Invalid DOM property \`${name}\`. Did you mean \`${known}\`?` : null;
167
+ }
168
+ if (name !== lower && !name.includes(":")) {
169
+ return `Octane does not recognize the \`${name}\` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase \`${lower}\` instead. If you accidentally passed it from a parent component, remove it from the DOM element.`;
170
+ }
171
+ return null;
172
+ }
173
+ function booleanAttributeStringWarning(name, value) {
174
+ if (value !== "false" && value !== "true" || !import_constants.BOOLEAN_ATTR_PROPS.has(name.toLowerCase())) {
175
+ return null;
176
+ }
177
+ return `Received the string \`${value}\` for the boolean attribute \`${name}\`. ` + (value === "false" ? "The browser will interpret it as a truthy value. " : 'Although this works, it will not work as expected if you pass the string "false". ') + `Did you mean ${name}={${value}}?`;
178
+ }
179
+ function invalidHostPropertiesWarning(names, tag) {
180
+ const quoted = names.map((name) => `\`${name}\``).join(", ");
181
+ return names.length === 1 ? `Invalid value for prop ${quoted} on <${tag}> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.` : `Invalid values for props ${quoted} on <${tag}> tag. Either remove them from the element, or pass a string or number value to keep them in the DOM.`;
182
+ }
183
+ function emptyResourceUrlWarning(name) {
184
+ return `An empty string was passed to the \`${name}\` attribute. This may cause the browser to download the whole page again. Pass null instead of an empty string.`;
185
+ }
186
+ function unsupportedAttributeCoercionWarning(name, value) {
187
+ const type = typeof value === "symbol" ? "Symbol" : value.constructor?.name || typeof value;
188
+ return `The provided \`${name}\` attribute is an unsupported type ${type}. Coerce it to a string before passing it to a DOM element.`;
189
+ }
190
+ // Annotate the CommonJS export names for ESM import in node:
191
+ 0 && (module.exports = {
192
+ booleanAttributeStringWarning,
193
+ emptyResourceUrlWarning,
194
+ hostPropertyWarning,
195
+ invalidHostPropertiesWarning,
196
+ unsupportedAttributeCoercionWarning
197
+ });