tutuca 0.9.66 → 0.9.67

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.
@@ -5367,34 +5367,31 @@ var init_attribute = __esm(() => {
5367
5367
  });
5368
5368
 
5369
5369
  // src/vdom.js
5370
- function applyProperties(node, props, previous) {
5370
+ function applyProperties(node, props, _previous) {
5371
5371
  const namespaced = isNamespaced(node);
5372
- for (const propName in props) {
5373
- const propValue = props[propName];
5374
- if (propValue === undefined)
5375
- removeProperty(node, propName, previous);
5376
- else if (propName === "dangerouslySetInnerHTML")
5377
- node.innerHTML = propValue.__html ?? "";
5378
- else if (propName === "className")
5379
- node.setAttribute("class", propValue);
5380
- else if (namespaced || isHtmlAttribute(propName))
5381
- node.setAttribute(propName, propValue);
5372
+ for (const name in props)
5373
+ setProp2(node, name, props[name], namespaced);
5374
+ }
5375
+ function setProp2(node, name, value, namespaced) {
5376
+ if (name === "dangerouslySetInnerHTML") {
5377
+ if (value === undefined)
5378
+ node.replaceChildren();
5382
5379
  else
5383
- node[propName] = propValue;
5384
- }
5385
- }
5386
- function removeProperty(node, propName, previous) {
5387
- const previousValue = previous[propName];
5388
- if (propName === "dangerouslySetInnerHTML")
5389
- node.replaceChildren();
5390
- else if (propName === "className")
5391
- node.removeAttribute("class");
5392
- else if (propName === "htmlFor")
5393
- node.removeAttribute("for");
5394
- else if (isNamespaced(node) || typeof previousValue === "string" || isHtmlAttribute(propName))
5395
- node.removeAttribute(propName);
5380
+ node.innerHTML = value.__html ?? "";
5381
+ return;
5382
+ }
5383
+ if (typeof value === "function")
5384
+ return;
5385
+ if (!namespaced && !NEVER_ASSIGN.has(name) && name in node) {
5386
+ try {
5387
+ node[name] = value == null ? "" : value;
5388
+ return;
5389
+ } catch {}
5390
+ }
5391
+ if (value == null || value === false && name[4] !== "-")
5392
+ node.removeAttribute(name);
5396
5393
  else
5397
- node[propName] = null;
5394
+ node.setAttribute(name, value);
5398
5395
  }
5399
5396
 
5400
5397
  class VBase {
@@ -5564,22 +5561,12 @@ function h(tagName, properties, children, namespace) {
5564
5561
  if (properties) {
5565
5562
  for (const propName in properties) {
5566
5563
  const propVal = properties[propName];
5567
- switch (propName) {
5568
- case "key":
5569
- key = propVal;
5570
- break;
5571
- case "namespace":
5572
- namespace = namespace ?? propVal;
5573
- break;
5574
- case "class":
5575
- props.className = propVal;
5576
- break;
5577
- case "for":
5578
- props.htmlFor = propVal;
5579
- break;
5580
- default:
5581
- props[propName] = isHtmlAttribute(propName) ? String(propVal) : propVal;
5582
- }
5564
+ if (propName === "key")
5565
+ key = propVal;
5566
+ else if (propName === "namespace")
5567
+ namespace = namespace ?? propVal;
5568
+ else
5569
+ props[propName] = propVal;
5583
5570
  }
5584
5571
  }
5585
5572
  const c = tagName.charCodeAt(0);
@@ -5588,11 +5575,24 @@ function h(tagName, properties, children, namespace) {
5588
5575
  addChild(normalizedChildren, children);
5589
5576
  return new VNode2(tag, props, normalizedChildren, key, namespace);
5590
5577
  }
5591
- var isHtmlAttribute = (propName) => propName[4] === "-" && (propName[0] === "d" || propName[0] === "a"), HTML_NS = "http://www.w3.org/1999/xhtml", isNamespaced = (node) => {
5578
+ var HTML_NS = "http://www.w3.org/1999/xhtml", isNamespaced = (node) => {
5592
5579
  const ns = node.namespaceURI;
5593
5580
  return ns !== null && ns !== HTML_NS;
5594
- }, getKey = (child) => child instanceof VNode2 ? child.key : undefined, isIterable = (obj) => obj != null && typeof obj !== "string" && typeof obj[Symbol.iterator] === "function", VText, VComment, VFragment, VNode2;
5581
+ }, NEVER_ASSIGN, getKey = (child) => child instanceof VNode2 ? child.key : undefined, isIterable = (obj) => obj != null && typeof obj !== "string" && typeof obj[Symbol.iterator] === "function", VText, VComment, VFragment, VNode2;
5595
5582
  var init_vdom = __esm(() => {
5583
+ NEVER_ASSIGN = new Set([
5584
+ "width",
5585
+ "height",
5586
+ "href",
5587
+ "list",
5588
+ "form",
5589
+ "tabIndex",
5590
+ "download",
5591
+ "rowSpan",
5592
+ "colSpan",
5593
+ "role",
5594
+ "popover"
5595
+ ]);
5596
5596
  VText = class VText extends VBase {
5597
5597
  constructor(text) {
5598
5598
  super();
@@ -8680,6 +8680,7 @@ function classifyBadValue(value) {
8680
8680
  function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SET2 } = {}) {
8681
8681
  return lx.push({ componentName: Comp.name }, () => {
8682
8682
  checkUnknownSpecKeys(lx, Comp, wellKnownExtras);
8683
+ checkFieldDeclarations(lx, Comp);
8683
8684
  const referencedAlters = new Set;
8684
8685
  const referencedInputs = new Set;
8685
8686
  const referencedDynamics = new Set;
@@ -9074,6 +9075,31 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
9074
9075
  lx.warn(UNKNOWN_COMPONENT_SPEC_KEY, { key }, replaceNameSuggestion(key, candidates));
9075
9076
  }
9076
9077
  }
9078
+ function checkFieldDeclarations(lx, Comp) {
9079
+ const fields = Comp.Class?.getMetaClass?.().fields;
9080
+ if (!fields)
9081
+ return;
9082
+ for (const fieldName in fields) {
9083
+ const field = fields[fieldName];
9084
+ if (!Object.hasOwn(field, "args"))
9085
+ continue;
9086
+ if (typeof field.type !== "string") {
9087
+ lx.error(COMP_FIELD_BAD_SHAPE, {
9088
+ fieldName,
9089
+ kind: "component-not-string",
9090
+ got: typeof field.type,
9091
+ gotName: field.type?.name ?? null
9092
+ });
9093
+ }
9094
+ if (field.args == null || field.args.constructor !== Object) {
9095
+ lx.error(COMP_FIELD_BAD_SHAPE, {
9096
+ fieldName,
9097
+ kind: "args-not-object",
9098
+ got: field.args === null ? "null" : typeof field.args
9099
+ });
9100
+ }
9101
+ }
9102
+ }
9077
9103
  function checkUnreferencedAlterHandlers(lx, Comp, referencedAlters) {
9078
9104
  for (const name in Comp.alter) {
9079
9105
  if (!referencedAlters.has(name)) {
@@ -9124,7 +9150,7 @@ class LintContext {
9124
9150
  this.reports.push({ id, info, level, context: { ...this.frame }, suggestion });
9125
9151
  }
9126
9152
  }
9127
- var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET2, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED = "ALT_HANDLER_NOT_DEFINED", ALT_HANDLER_NOT_REFERENCED = "ALT_HANDLER_NOT_REFERENCED", DYN_VAL_NOT_DEFINED = "DYN_VAL_NOT_DEFINED", DYN_ALIAS_NOT_REFERENCED = "DYN_ALIAS_NOT_REFERENCED", RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP", UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER", UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME", INPUT_HANDLER_NOT_IMPLEMENTED = "INPUT_HANDLER_NOT_IMPLEMENTED", INPUT_HANDLER_NOT_REFERENCED = "INPUT_HANDLER_NOT_REFERENCED", INPUT_HANDLER_METHOD_NOT_IMPLEMENTED = "INPUT_HANDLER_METHOD_NOT_IMPLEMENTED", INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD = "INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD", INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER = "INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER", FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED", FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD", METHOD_VAL_NOT_DEFINED = "METHOD_VAL_NOT_DEFINED", METHOD_VAL_IS_FIELD = "METHOD_VAL_IS_FIELD", DUPLICATE_ATTR_DEFINITION = "DUPLICATE_ATTR_DEFINITION", IF_NO_BRANCH_SET = "IF_NO_BRANCH_SET", UNKNOWN_REQUEST_NAME = "UNKNOWN_REQUEST_NAME", UNKNOWN_COMPONENT_NAME = "UNKNOWN_COMPONENT_NAME", UNKNOWN_MACRO_ARG = "UNKNOWN_MACRO_ARG", UNKNOWN_DIRECTIVE = "UNKNOWN_DIRECTIVE", UNKNOWN_X_OP = "UNKNOWN_X_OP", UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR", MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX", BAD_VALUE = "BAD_VALUE", UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX", REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING", PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING", UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY", PARSE_ISSUE_KIND_TO_LINT_ID, X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, AT_PREFIX_HINT_KNOWN_BY_KIND, LEVEL_WARN2 = "warn", LEVEL_ERROR2 = "error", LEVEL_HINT = "hint", PARSE_ISSUE_KIND_TO_KNOWN_NAMES, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS, KNOWN_HANDLER_NAMES, NODE_KIND_TO_CTX, LintParseContext;
9153
+ var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET2, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED = "ALT_HANDLER_NOT_DEFINED", ALT_HANDLER_NOT_REFERENCED = "ALT_HANDLER_NOT_REFERENCED", DYN_VAL_NOT_DEFINED = "DYN_VAL_NOT_DEFINED", DYN_ALIAS_NOT_REFERENCED = "DYN_ALIAS_NOT_REFERENCED", RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP", UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER", UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME", INPUT_HANDLER_NOT_IMPLEMENTED = "INPUT_HANDLER_NOT_IMPLEMENTED", INPUT_HANDLER_NOT_REFERENCED = "INPUT_HANDLER_NOT_REFERENCED", INPUT_HANDLER_METHOD_NOT_IMPLEMENTED = "INPUT_HANDLER_METHOD_NOT_IMPLEMENTED", INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD = "INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD", INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER = "INPUT_HANDLER_METHOD_FOR_INPUT_HANDLER", FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED", FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD", METHOD_VAL_NOT_DEFINED = "METHOD_VAL_NOT_DEFINED", METHOD_VAL_IS_FIELD = "METHOD_VAL_IS_FIELD", DUPLICATE_ATTR_DEFINITION = "DUPLICATE_ATTR_DEFINITION", IF_NO_BRANCH_SET = "IF_NO_BRANCH_SET", UNKNOWN_REQUEST_NAME = "UNKNOWN_REQUEST_NAME", UNKNOWN_COMPONENT_NAME = "UNKNOWN_COMPONENT_NAME", UNKNOWN_MACRO_ARG = "UNKNOWN_MACRO_ARG", UNKNOWN_DIRECTIVE = "UNKNOWN_DIRECTIVE", UNKNOWN_X_OP = "UNKNOWN_X_OP", UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR", MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX", BAD_VALUE = "BAD_VALUE", UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX", REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING", PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING", UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY", COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE", PARSE_ISSUE_KIND_TO_LINT_ID, X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, AT_PREFIX_HINT_KNOWN_BY_KIND, LEVEL_WARN2 = "warn", LEVEL_ERROR2 = "error", LEVEL_HINT = "hint", PARSE_ISSUE_KIND_TO_KNOWN_NAMES, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS, KNOWN_HANDLER_NAMES, NODE_KIND_TO_CTX, LintParseContext;
9128
9154
  var init_lint_check = __esm(() => {
9129
9155
  init_anode();
9130
9156
  init_htmllinter();
@@ -9424,6 +9450,12 @@ var init_lint_rules = __esm(() => {
9424
9450
  level: "warn",
9425
9451
  group: "Component spec",
9426
9452
  summary: "`component({...})` has an unrecognized key; its value is ignored at runtime."
9453
+ },
9454
+ {
9455
+ code: COMP_FIELD_BAD_SHAPE,
9456
+ level: "error",
9457
+ group: "Component field declarations",
9458
+ summary: "`fields: { x: { component, args } }` shape is wrong: `component` must be a string and `args` must be a plain object."
9427
9459
  }
9428
9460
  ];
9429
9461
  });
@@ -57,7 +57,7 @@ __export(exports_dev, {
57
57
  component: () => component,
58
58
  compileClassesToStyleText: () => compileClassesToStyleText,
59
59
  compileClassesToStyle: () => compileClassesToStyle,
60
- collectIterBindings: () => collectIterBindings,
60
+ collectIterBindings: () => collectIterBindings2,
61
61
  checkComponent: () => checkComponent,
62
62
  check: () => check2,
63
63
  UNSUPPORTED_EXPR_SYNTAX: () => UNSUPPORTED_EXPR_SYNTAX,
@@ -116,6 +116,7 @@ __export(exports_dev, {
116
116
  ComponentSummary: () => ComponentSummary,
117
117
  ComponentList: () => ComponentList,
118
118
  ComponentDocs: () => ComponentDocs,
119
+ COMP_FIELD_BAD_SHAPE: () => COMP_FIELD_BAD_SHAPE,
119
120
  BAD_VALUE: () => BAD_VALUE,
120
121
  ALT_HANDLER_NOT_REFERENCED: () => ALT_HANDLER_NOT_REFERENCED,
121
122
  ALT_HANDLER_NOT_DEFINED: () => ALT_HANDLER_NOT_DEFINED
@@ -4633,40 +4634,49 @@ class RequestHandler {
4633
4634
  }
4634
4635
 
4635
4636
  // src/vdom.js
4636
- var isHtmlAttribute = (propName) => propName[4] === "-" && (propName[0] === "d" || propName[0] === "a");
4637
4637
  var HTML_NS = "http://www.w3.org/1999/xhtml";
4638
4638
  var isNamespaced = (node) => {
4639
4639
  const ns = node.namespaceURI;
4640
4640
  return ns !== null && ns !== HTML_NS;
4641
4641
  };
4642
- function applyProperties(node, props, previous) {
4642
+ var NEVER_ASSIGN = new Set([
4643
+ "width",
4644
+ "height",
4645
+ "href",
4646
+ "list",
4647
+ "form",
4648
+ "tabIndex",
4649
+ "download",
4650
+ "rowSpan",
4651
+ "colSpan",
4652
+ "role",
4653
+ "popover"
4654
+ ]);
4655
+ function applyProperties(node, props, _previous) {
4643
4656
  const namespaced = isNamespaced(node);
4644
- for (const propName in props) {
4645
- const propValue = props[propName];
4646
- if (propValue === undefined)
4647
- removeProperty(node, propName, previous);
4648
- else if (propName === "dangerouslySetInnerHTML")
4649
- node.innerHTML = propValue.__html ?? "";
4650
- else if (propName === "className")
4651
- node.setAttribute("class", propValue);
4652
- else if (namespaced || isHtmlAttribute(propName))
4653
- node.setAttribute(propName, propValue);
4657
+ for (const name in props)
4658
+ setProp(node, name, props[name], namespaced);
4659
+ }
4660
+ function setProp(node, name, value, namespaced) {
4661
+ if (name === "dangerouslySetInnerHTML") {
4662
+ if (value === undefined)
4663
+ node.replaceChildren();
4654
4664
  else
4655
- node[propName] = propValue;
4656
- }
4657
- }
4658
- function removeProperty(node, propName, previous) {
4659
- const previousValue = previous[propName];
4660
- if (propName === "dangerouslySetInnerHTML")
4661
- node.replaceChildren();
4662
- else if (propName === "className")
4663
- node.removeAttribute("class");
4664
- else if (propName === "htmlFor")
4665
- node.removeAttribute("for");
4666
- else if (isNamespaced(node) || typeof previousValue === "string" || isHtmlAttribute(propName))
4667
- node.removeAttribute(propName);
4665
+ node.innerHTML = value.__html ?? "";
4666
+ return;
4667
+ }
4668
+ if (typeof value === "function")
4669
+ return;
4670
+ if (!namespaced && !NEVER_ASSIGN.has(name) && name in node) {
4671
+ try {
4672
+ node[name] = value == null ? "" : value;
4673
+ return;
4674
+ } catch {}
4675
+ }
4676
+ if (value == null || value === false && name[4] !== "-")
4677
+ node.removeAttribute(name);
4668
4678
  else
4669
- node[propName] = null;
4679
+ node.setAttribute(name, value);
4670
4680
  }
4671
4681
 
4672
4682
  class VBase {
@@ -4938,22 +4948,12 @@ function h(tagName, properties, children, namespace) {
4938
4948
  if (properties) {
4939
4949
  for (const propName in properties) {
4940
4950
  const propVal = properties[propName];
4941
- switch (propName) {
4942
- case "key":
4943
- key = propVal;
4944
- break;
4945
- case "namespace":
4946
- namespace = namespace ?? propVal;
4947
- break;
4948
- case "class":
4949
- props.className = propVal;
4950
- break;
4951
- case "for":
4952
- props.htmlFor = propVal;
4953
- break;
4954
- default:
4955
- props[propName] = isHtmlAttribute(propName) ? String(propVal) : propVal;
4956
- }
4951
+ if (propName === "key")
4952
+ key = propVal;
4953
+ else if (propName === "namespace")
4954
+ namespace = namespace ?? propVal;
4955
+ else
4956
+ props[propName] = propVal;
4957
4957
  }
4958
4958
  }
4959
4959
  const c = tagName.charCodeAt(0);
@@ -5812,6 +5812,7 @@ __export(exports_lint_check, {
5812
5812
  DYN_VAL_NOT_DEFINED: () => DYN_VAL_NOT_DEFINED,
5813
5813
  DYN_ALIAS_NOT_REFERENCED: () => DYN_ALIAS_NOT_REFERENCED,
5814
5814
  DUPLICATE_ATTR_DEFINITION: () => DUPLICATE_ATTR_DEFINITION,
5815
+ COMP_FIELD_BAD_SHAPE: () => COMP_FIELD_BAD_SHAPE,
5815
5816
  BAD_VALUE: () => BAD_VALUE,
5816
5817
  ALT_HANDLER_NOT_REFERENCED: () => ALT_HANDLER_NOT_REFERENCED,
5817
5818
  ALT_HANDLER_NOT_DEFINED: () => ALT_HANDLER_NOT_DEFINED
@@ -8123,6 +8124,7 @@ var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
8123
8124
  var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
8124
8125
  var PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING";
8125
8126
  var UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY";
8127
+ var COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE";
8126
8128
  var PARSE_ISSUE_KIND_TO_LINT_ID = {
8127
8129
  "unknown-directive": UNKNOWN_DIRECTIVE,
8128
8130
  "unknown-x-op": UNKNOWN_X_OP,
@@ -8207,6 +8209,7 @@ var UNSUPPORTED_EXPR_GUIDANCE = {
8207
8209
  function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SET } = {}) {
8208
8210
  return lx.push({ componentName: Comp.name }, () => {
8209
8211
  checkUnknownSpecKeys(lx, Comp, wellKnownExtras);
8212
+ checkFieldDeclarations(lx, Comp);
8210
8213
  const referencedAlters = new Set;
8211
8214
  const referencedInputs = new Set;
8212
8215
  const referencedDynamics = new Set;
@@ -8635,6 +8638,31 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
8635
8638
  lx.warn(UNKNOWN_COMPONENT_SPEC_KEY, { key }, replaceNameSuggestion(key, candidates));
8636
8639
  }
8637
8640
  }
8641
+ function checkFieldDeclarations(lx, Comp) {
8642
+ const fields = Comp.Class?.getMetaClass?.().fields;
8643
+ if (!fields)
8644
+ return;
8645
+ for (const fieldName in fields) {
8646
+ const field = fields[fieldName];
8647
+ if (!Object.hasOwn(field, "args"))
8648
+ continue;
8649
+ if (typeof field.type !== "string") {
8650
+ lx.error(COMP_FIELD_BAD_SHAPE, {
8651
+ fieldName,
8652
+ kind: "component-not-string",
8653
+ got: typeof field.type,
8654
+ gotName: field.type?.name ?? null
8655
+ });
8656
+ }
8657
+ if (field.args == null || field.args.constructor !== Object) {
8658
+ lx.error(COMP_FIELD_BAD_SHAPE, {
8659
+ fieldName,
8660
+ kind: "args-not-object",
8661
+ got: field.args === null ? "null" : typeof field.args
8662
+ });
8663
+ }
8664
+ }
8665
+ }
8638
8666
  function checkUnreferencedAlterHandlers(lx, Comp, referencedAlters) {
8639
8667
  for (const name in Comp.alter) {
8640
8668
  if (!referencedAlters.has(name)) {
@@ -9421,6 +9449,7 @@ __export(exports_extra, {
9421
9449
  component: () => component,
9422
9450
  compileClassesToStyleText: () => compileClassesToStyleText,
9423
9451
  compileClassesToStyle: () => compileClassesToStyle,
9452
+ collectIterBindings: () => collectIterBindings,
9424
9453
  check: () => check,
9425
9454
  SEQ_INFO: () => SEQ_INFO,
9426
9455
  ParseContext: () => ParseContext,
@@ -11124,6 +11153,7 @@ __export(exports_tutuca, {
11124
11153
  html: () => html,
11125
11154
  css: () => css,
11126
11155
  component: () => component,
11156
+ collectIterBindings: () => collectIterBindings,
11127
11157
  check: () => check,
11128
11158
  SEQ_INFO: () => SEQ_INFO,
11129
11159
  ParseContext: () => ParseContext,
@@ -11150,6 +11180,10 @@ function check(_app) {
11150
11180
  async function test2(_opts) {
11151
11181
  return null;
11152
11182
  }
11183
+ function collectIterBindings() {
11184
+ console.warn("collectIterBindings is a no-op in the core tutuca build; use the tutuca-dev build for a functional implementation");
11185
+ return [];
11186
+ }
11153
11187
  function tutuca(nodeOrSelector) {
11154
11188
  const rootNode = typeof nodeOrSelector === "string" ? document.querySelector(nodeOrSelector) : nodeOrSelector;
11155
11189
  const comps = new Components;
@@ -11361,7 +11395,7 @@ function docComponents(normalized, { name = null } = {}) {
11361
11395
  // src/util/testing.js
11362
11396
  var exports_testing = {};
11363
11397
  __export(exports_testing, {
11364
- collectIterBindings: () => collectIterBindings
11398
+ collectIterBindings: () => collectIterBindings2
11365
11399
  });
11366
11400
  var filterAlwaysTrue2 = () => true;
11367
11401
  var nullLoopWith2 = (seq) => ({ iterData: { seq } });
@@ -11397,7 +11431,7 @@ function resolveAlter(Comp, name) {
11397
11431
  }
11398
11432
  return fn;
11399
11433
  }
11400
- function collectIterBindings(Comp, compInstance, seq, opts = {}) {
11434
+ function collectIterBindings2(Comp, compInstance, seq, opts = {}) {
11401
11435
  const whenFn = resolveAlter(Comp, opts.when) ?? filterAlwaysTrue2;
11402
11436
  const loopWithFn = resolveAlter(Comp, opts.loopWith) ?? nullLoopWith2;
11403
11437
  const enrichFn = resolveAlter(Comp, opts.enrichWith);
@@ -11501,7 +11535,7 @@ export {
11501
11535
  component,
11502
11536
  compileClassesToStyleText,
11503
11537
  compileClassesToStyle,
11504
- collectIterBindings,
11538
+ collectIterBindings2 as collectIterBindings,
11505
11539
  checkComponent,
11506
11540
  check2 as check,
11507
11541
  UNSUPPORTED_EXPR_SYNTAX,
@@ -11560,6 +11594,7 @@ export {
11560
11594
  ComponentSummary,
11561
11595
  ComponentList,
11562
11596
  ComponentDocs,
11597
+ COMP_FIELD_BAD_SHAPE,
11563
11598
  BAD_VALUE,
11564
11599
  ALT_HANDLER_NOT_REFERENCED,
11565
11600
  ALT_HANDLER_NOT_DEFINED
@@ -8840,40 +8840,49 @@ class RequestHandler {
8840
8840
  }
8841
8841
 
8842
8842
  // src/vdom.js
8843
- var isHtmlAttribute = (propName) => propName[4] === "-" && (propName[0] === "d" || propName[0] === "a");
8844
8843
  var HTML_NS = "http://www.w3.org/1999/xhtml";
8845
8844
  var isNamespaced = (node) => {
8846
8845
  const ns = node.namespaceURI;
8847
8846
  return ns !== null && ns !== HTML_NS;
8848
8847
  };
8849
- function applyProperties(node, props, previous) {
8848
+ var NEVER_ASSIGN = new Set([
8849
+ "width",
8850
+ "height",
8851
+ "href",
8852
+ "list",
8853
+ "form",
8854
+ "tabIndex",
8855
+ "download",
8856
+ "rowSpan",
8857
+ "colSpan",
8858
+ "role",
8859
+ "popover"
8860
+ ]);
8861
+ function applyProperties(node, props, _previous) {
8850
8862
  const namespaced = isNamespaced(node);
8851
- for (const propName in props) {
8852
- const propValue = props[propName];
8853
- if (propValue === undefined)
8854
- removeProperty(node, propName, previous);
8855
- else if (propName === "dangerouslySetInnerHTML")
8856
- node.innerHTML = propValue.__html ?? "";
8857
- else if (propName === "className")
8858
- node.setAttribute("class", propValue);
8859
- else if (namespaced || isHtmlAttribute(propName))
8860
- node.setAttribute(propName, propValue);
8863
+ for (const name in props)
8864
+ setProp2(node, name, props[name], namespaced);
8865
+ }
8866
+ function setProp2(node, name, value, namespaced) {
8867
+ if (name === "dangerouslySetInnerHTML") {
8868
+ if (value === undefined)
8869
+ node.replaceChildren();
8861
8870
  else
8862
- node[propName] = propValue;
8863
- }
8864
- }
8865
- function removeProperty(node, propName, previous) {
8866
- const previousValue = previous[propName];
8867
- if (propName === "dangerouslySetInnerHTML")
8868
- node.replaceChildren();
8869
- else if (propName === "className")
8870
- node.removeAttribute("class");
8871
- else if (propName === "htmlFor")
8872
- node.removeAttribute("for");
8873
- else if (isNamespaced(node) || typeof previousValue === "string" || isHtmlAttribute(propName))
8874
- node.removeAttribute(propName);
8871
+ node.innerHTML = value.__html ?? "";
8872
+ return;
8873
+ }
8874
+ if (typeof value === "function")
8875
+ return;
8876
+ if (!namespaced && !NEVER_ASSIGN.has(name) && name in node) {
8877
+ try {
8878
+ node[name] = value == null ? "" : value;
8879
+ return;
8880
+ } catch {}
8881
+ }
8882
+ if (value == null || value === false && name[4] !== "-")
8883
+ node.removeAttribute(name);
8875
8884
  else
8876
- node[propName] = null;
8885
+ node.setAttribute(name, value);
8877
8886
  }
8878
8887
 
8879
8888
  class VBase {
@@ -9145,22 +9154,12 @@ function h(tagName, properties, children, namespace) {
9145
9154
  if (properties) {
9146
9155
  for (const propName in properties) {
9147
9156
  const propVal = properties[propName];
9148
- switch (propName) {
9149
- case "key":
9150
- key = propVal;
9151
- break;
9152
- case "namespace":
9153
- namespace = namespace ?? propVal;
9154
- break;
9155
- case "class":
9156
- props.className = propVal;
9157
- break;
9158
- case "for":
9159
- props.htmlFor = propVal;
9160
- break;
9161
- default:
9162
- props[propName] = isHtmlAttribute(propName) ? String(propVal) : propVal;
9163
- }
9157
+ if (propName === "key")
9158
+ key = propVal;
9159
+ else if (propName === "namespace")
9160
+ namespace = namespace ?? propVal;
9161
+ else
9162
+ props[propName] = propVal;
9164
9163
  }
9165
9164
  }
9166
9165
  const c = tagName.charCodeAt(0);
@@ -12275,6 +12274,7 @@ var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
12275
12274
  var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
12276
12275
  var PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING";
12277
12276
  var UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY";
12277
+ var COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE";
12278
12278
  var PARSE_ISSUE_KIND_TO_LINT_ID = {
12279
12279
  "unknown-directive": UNKNOWN_DIRECTIVE,
12280
12280
  "unknown-x-op": UNKNOWN_X_OP,
@@ -12359,6 +12359,7 @@ var UNSUPPORTED_EXPR_GUIDANCE = {
12359
12359
  function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SET2 } = {}) {
12360
12360
  return lx.push({ componentName: Comp.name }, () => {
12361
12361
  checkUnknownSpecKeys(lx, Comp, wellKnownExtras);
12362
+ checkFieldDeclarations(lx, Comp);
12362
12363
  const referencedAlters = new Set;
12363
12364
  const referencedInputs = new Set;
12364
12365
  const referencedDynamics = new Set;
@@ -12787,6 +12788,31 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
12787
12788
  lx.warn(UNKNOWN_COMPONENT_SPEC_KEY, { key }, replaceNameSuggestion(key, candidates));
12788
12789
  }
12789
12790
  }
12791
+ function checkFieldDeclarations(lx, Comp) {
12792
+ const fields = Comp.Class?.getMetaClass?.().fields;
12793
+ if (!fields)
12794
+ return;
12795
+ for (const fieldName in fields) {
12796
+ const field = fields[fieldName];
12797
+ if (!Object.hasOwn(field, "args"))
12798
+ continue;
12799
+ if (typeof field.type !== "string") {
12800
+ lx.error(COMP_FIELD_BAD_SHAPE, {
12801
+ fieldName,
12802
+ kind: "component-not-string",
12803
+ got: typeof field.type,
12804
+ gotName: field.type?.name ?? null
12805
+ });
12806
+ }
12807
+ if (field.args == null || field.args.constructor !== Object) {
12808
+ lx.error(COMP_FIELD_BAD_SHAPE, {
12809
+ fieldName,
12810
+ kind: "args-not-object",
12811
+ got: field.args === null ? "null" : typeof field.args
12812
+ });
12813
+ }
12814
+ }
12815
+ }
12790
12816
  function checkUnreferencedAlterHandlers(lx, Comp, referencedAlters) {
12791
12817
  for (const name in Comp.alter) {
12792
12818
  if (!referencedAlters.has(name)) {
@@ -15587,6 +15613,7 @@ export {
15587
15613
  ComponentList,
15588
15614
  ComponentDocs,
15589
15615
  Collection,
15616
+ COMP_FIELD_BAD_SHAPE,
15590
15617
  BAD_VALUE,
15591
15618
  ALT_HANDLER_NOT_REFERENCED,
15592
15619
  ALT_HANDLER_NOT_DEFINED