@kayjs/kay 1.109.0 → 1.110.0

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 (115) hide show
  1. package/dist/eslint.js +332 -52
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/actions-from-islands.md +1 -1
  4. package/llms/components.md +1 -1
  5. package/llms/deprecated-lints.md +1 -1
  6. package/llms/island-and-form-lints.md +2 -1
  7. package/llms/islands.md +4 -2
  8. package/llms/live-values.md +1 -1
  9. package/llms/navigation-from-code.md +1 -1
  10. package/llms/navigation.md +4 -2
  11. package/llms/templates-elements-slots-snippets.md +2 -2
  12. package/llms/upgrading-archive.md +31 -1
  13. package/llms/upgrading.md +26 -32
  14. package/llms/whats-new.md +15 -0
  15. package/llms.txt +1 -1
  16. package/package.json +6 -6
  17. package/src/build/variants.ts +132 -18
  18. package/src/check/env-types.ts +1 -1
  19. package/src/check/project.ts +4 -0
  20. package/src/check/schema-builders.ts +125 -26
  21. package/src/commands/upgrade.ts +2 -1
  22. package/src/compiler/allow-comments.ts +38 -2
  23. package/src/compiler/ast.ts +4 -4
  24. package/src/compiler/codegen.ts +3 -3
  25. package/src/compiler/deprecated-lints-1-106.ts +2 -2
  26. package/src/compiler/hand-parts.ts +36 -8
  27. package/src/compiler/helper-imports.ts +2 -2
  28. package/src/compiler/index.ts +4 -3
  29. package/src/compiler/island-arguments.ts +9 -0
  30. package/src/compiler/island-lints.ts +7 -0
  31. package/src/compiler/items.ts +12 -0
  32. package/src/compiler/jsx.ts +5 -4
  33. package/src/compiler/lints.ts +5 -6
  34. package/src/compiler/markup.ts +16 -21
  35. package/src/compiler/names.ts +1 -1
  36. package/src/compiler/removed-lints.ts +90 -0
  37. package/src/compiler/signal-from-prop.ts +141 -0
  38. package/src/compiler/template-reads.ts +16 -0
  39. package/src/runtime/checks.ts +14 -2
  40. package/src/runtime/client.ts +5 -9
  41. package/src/runtime/dom.ts +1 -1
  42. package/src/runtime/html.ts +1 -1
  43. package/src/runtime/image.ts +2 -19
  44. package/src/runtime/index.ts +1 -1
  45. package/src/runtime/island.server.ts +40 -10
  46. package/src/runtime/navigate.ts +9 -0
  47. package/src/runtime/navigation.ts +5 -1
  48. package/src/runtime/page-swap.ts +2 -2
  49. package/src/runtime/swap-flight.ts +10 -10
  50. package/src/runtime/swap-kept.ts +69 -29
  51. package/src/runtime/swap-morph.ts +49 -9
  52. package/src/runtime/text-hash.ts +17 -0
  53. package/src/runtime/uid.server.ts +6 -4
  54. package/src/runtime/values.ts +12 -0
  55. package/src/server/render-document.ts +8 -6
  56. package/src/server/render.ts +1 -1
  57. package/types/build/variants.d.ts +9 -1
  58. package/types/build/variants.d.ts.map +1 -1
  59. package/types/check/project.d.ts.map +1 -1
  60. package/types/check/schema-builders.d.ts.map +1 -1
  61. package/types/commands/upgrade.d.ts.map +1 -1
  62. package/types/compiler/allow-comments.d.ts +2 -0
  63. package/types/compiler/allow-comments.d.ts.map +1 -1
  64. package/types/compiler/ast.d.ts +1 -1
  65. package/types/compiler/ast.d.ts.map +1 -1
  66. package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
  67. package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
  68. package/types/compiler/deprecated-lints.d.ts +2 -2
  69. package/types/compiler/hand-parts.d.ts +6 -3
  70. package/types/compiler/hand-parts.d.ts.map +1 -1
  71. package/types/compiler/index.d.ts.map +1 -1
  72. package/types/compiler/island-arguments.d.ts +5 -0
  73. package/types/compiler/island-arguments.d.ts.map +1 -1
  74. package/types/compiler/island-lints.d.ts +7 -0
  75. package/types/compiler/island-lints.d.ts.map +1 -1
  76. package/types/compiler/items.d.ts +1 -0
  77. package/types/compiler/items.d.ts.map +1 -1
  78. package/types/compiler/jsx.d.ts.map +1 -1
  79. package/types/compiler/lints.d.ts +11 -4
  80. package/types/compiler/lints.d.ts.map +1 -1
  81. package/types/compiler/markup.d.ts +1 -1
  82. package/types/compiler/markup.d.ts.map +1 -1
  83. package/types/compiler/names.d.ts.map +1 -1
  84. package/types/compiler/removed-lints.d.ts +3 -0
  85. package/types/compiler/removed-lints.d.ts.map +1 -0
  86. package/types/compiler/signal-from-prop.d.ts +4 -0
  87. package/types/compiler/signal-from-prop.d.ts.map +1 -0
  88. package/types/compiler/template-reads.d.ts +1 -0
  89. package/types/compiler/template-reads.d.ts.map +1 -1
  90. package/types/runtime/checks.d.ts +8 -2
  91. package/types/runtime/checks.d.ts.map +1 -1
  92. package/types/runtime/client.d.ts.map +1 -1
  93. package/types/runtime/dom.d.ts +1 -1
  94. package/types/runtime/dom.d.ts.map +1 -1
  95. package/types/runtime/html.d.ts +1 -1
  96. package/types/runtime/html.d.ts.map +1 -1
  97. package/types/runtime/image.d.ts.map +1 -1
  98. package/types/runtime/index.d.ts +1 -1
  99. package/types/runtime/index.d.ts.map +1 -1
  100. package/types/runtime/island.server.d.ts +1 -0
  101. package/types/runtime/island.server.d.ts.map +1 -1
  102. package/types/runtime/navigate.d.ts.map +1 -1
  103. package/types/runtime/navigation.d.ts +2 -0
  104. package/types/runtime/navigation.d.ts.map +1 -1
  105. package/types/runtime/swap-flight.d.ts +1 -1
  106. package/types/runtime/swap-flight.d.ts.map +1 -1
  107. package/types/runtime/swap-kept.d.ts.map +1 -1
  108. package/types/runtime/swap-morph.d.ts.map +1 -1
  109. package/types/runtime/text-hash.d.ts +2 -0
  110. package/types/runtime/text-hash.d.ts.map +1 -0
  111. package/types/runtime/uid.server.d.ts.map +1 -1
  112. package/types/runtime/values.d.ts +4 -0
  113. package/types/runtime/values.d.ts.map +1 -1
  114. package/types/server/render-document.d.ts +1 -1
  115. package/types/server/render-document.d.ts.map +1 -1
package/dist/eslint.js CHANGED
@@ -25,7 +25,7 @@ var __esm = (fn, res, err) => () => {
25
25
  };
26
26
 
27
27
  // package.json
28
- var version = "1.109.0", peerDependencies;
28
+ var version = "1.110.0", peerDependencies;
29
29
  var init_package = __esm(() => {
30
30
  peerDependencies = {
31
31
  "@happy-dom/global-registrator": "^20.14.6 || ^21.0.3",
@@ -428,7 +428,7 @@ function addRecipe(facts, file, recipe) {
428
428
  if (facts.parts.root !== "none")
429
429
  facts.helpers.add("partClass");
430
430
  if (facts.parts.implicit?.component) {
431
- facts.helpers.add("partsClass");
431
+ facts.helpers.add("partProps");
432
432
  facts.helpers.add("handParts");
433
433
  }
434
434
  }
@@ -462,7 +462,7 @@ function factsOf(file) {
462
462
  }
463
463
  facts.helpers.add("partClass");
464
464
  if (node.component) {
465
- facts.helpers.add("partsClass");
465
+ facts.helpers.add("partProps");
466
466
  facts.helpers.add("handParts");
467
467
  }
468
468
  if (index > 0)
@@ -489,7 +489,7 @@ function factsOf(file) {
489
489
  if (facts.parts) {
490
490
  markRoot(facts.parts, file.template);
491
491
  if (facts.parts.implicit?.component) {
492
- facts.helpers.add("partsClass");
492
+ facts.helpers.add("partProps");
493
493
  facts.helpers.add("handParts");
494
494
  }
495
495
  }
@@ -3764,7 +3764,7 @@ function defaultName(index) {
3764
3764
  var PROPS = "__props", CURRENT = "KayCurrent", VALUES = "__values", WRITABLE = "KayWritable(", DEFAULTED = "KayDefault(", HANDED = "KayHanded(", WRITE_HELPERS, PROBE = "(KayTarget, KayKey) => { KayTarget[KayKey] = undefined as never }", SUBJECT = "KaySubject", LOAD = "load", LOAD_TABLE = "KayLoadTable", LOAD_RUN = "KayKept", LOAD_KEY = "Symbol.for('kay.kept')", SELF = "KaySelf", DEFAULT_PREFIX = "__default_", GENERATED_NAME;
3765
3765
  var init_names = __esm(() => {
3766
3766
  WRITE_HELPERS = { to: "KayWriteTo", update: "KayUpdateTo", back: "KayWriteBack", updateBack: "KayUpdateBack" };
3767
- GENERATED_NAME = new RegExp(`^(?:${[PROPS, VALUES, CURRENT, "kayEvent", "kayMatched", "kayAwaited", "kayEach"].join("|")}|${DEFAULT_PREFIX}\\d+|Kay(?:Default|LoopFor|StaticFor|Show|Omit|ComponentClass|PartClass|PartsClass|HandParts|PartOf|HandedPart|Dynamic|TemplateHelpers|Island|IslandBrand|HydrateWhen|Href|Html|ComputedHtml|Field|FormValues|FormError|Prop|PlainProp|FunctionProp|PromotedProp|PromotedFunctionProp|HandsPart|Children|Row|List|Truthy|Unmatched|Keyed|Radio|Writable|WriteTo|UpdateTo|WriteBack|UpdateBack|Bound|Bindable|Handed|PageContext|PrerenderedContext|PageSettings|QueryOf|PageData|JSX|FormAction|RegisterActions|ActionStub|ReviveActions|UseHead|Await|Awaited|Try))$`);
3767
+ GENERATED_NAME = new RegExp(`^(?:${[PROPS, VALUES, CURRENT, "kayEvent", "kayMatched", "kayAwaited", "kayEach"].join("|")}|${DEFAULT_PREFIX}\\d+|Kay(?:Default|LoopFor|StaticFor|Show|Omit|ComponentClass|PartClass|PartsClass|PartProps|HandParts|PartOf|HandedPart|Dynamic|TemplateHelpers|Island|IslandBrand|IslandAsked|IslandExport|HydrateWhen|Href|Html|ComputedHtml|Field|FormValues|FormError|Prop|PlainProp|FunctionProp|PromotedProp|PromotedFunctionProp|HandsPart|Children|Row|List|Truthy|Unmatched|Keyed|Radio|Writable|WriteTo|UpdateTo|WriteBack|UpdateBack|Bound|Bindable|Handed|PageContext|PrerenderedContext|PageSettings|QueryOf|PageData|JSX|FormAction|RegisterActions|ActionStub|ReviveActions|UseHead|Await|Awaited|Try))$`);
3768
3768
  });
3769
3769
 
3770
3770
  // src/compiler/pattern-names.ts
@@ -3946,12 +3946,19 @@ function fixedSource(element) {
3946
3946
  function ambientHelpers(facts, mode) {
3947
3947
  return [...facts.ambientForm ? ["formHere", "formError"] : [], ...mode === "dom" && facts.snippet && facts.forms.size > 0 ? ["issueScope"] : []];
3948
3948
  }
3949
- var pendingElements;
3949
+ function usedProps(element, text) {
3950
+ if (element.attributes.some((attribute) => attribute.kind === "spread"))
3951
+ return "";
3952
+ const names = [...element.attributes.flatMap((attribute) => attribute.kind === "spread" ? [] : [attribute.name]), ...element.children.flatMap((child) => child.kind === "slot" ? [child.name] : [])];
3953
+ return `, { ${names.map((name) => `${JSON.stringify(text(name).replace(BOUND, ""))}: 0`).join(", ")} }`;
3954
+ }
3955
+ var pendingElements, BOUND;
3950
3956
  var init_items = __esm(() => {
3951
3957
  init_ast();
3952
3958
  init_names();
3953
3959
  init_pattern_names();
3954
3960
  pendingElements = new WeakMap;
3961
+ BOUND = /^bind:/;
3955
3962
  });
3956
3963
 
3957
3964
  // src/compiler/kay-exports.ts
@@ -5757,12 +5764,30 @@ function writtenParts(element, source) {
5757
5764
  const hand = element.attributes.find((one) => one.kind === "expression" && source.slice(one.name.start, one.name.end) === "parts");
5758
5765
  return [...element.attributes.filter((one) => one.kind === "spread"), hand].filter((attribute) => attribute !== undefined);
5759
5766
  }
5760
- function openClassList(b, component, parts, handing) {
5761
- const helper = handing ? "handParts" : "partsClass";
5762
- b.add(component ? `${helperName(parts ? helper : "componentClass")}([` : "[");
5767
+ function writesTogether(element, source, facts) {
5768
+ return element.component && partsOf(element, source, facts).length > 0 && handedParts(element, source, facts).length === 0;
5769
+ }
5770
+ function handedItem(b, part, recipe) {
5771
+ return {
5772
+ emit: () => {
5773
+ b.add(`${helperName("partHanded")}(${JSON.stringify(part)}, [`);
5774
+ for (const emit of recipe) {
5775
+ emit();
5776
+ b.add(", ");
5777
+ }
5778
+ b.add(`${helperName("partClass")}(${PROPS}, ${JSON.stringify(part)})])`);
5779
+ }
5780
+ };
5781
+ }
5782
+ function openClassList(b, component, handing, together) {
5783
+ if (together) {
5784
+ b.add(`${helperName("partProps")}(() => [[`);
5785
+ return;
5786
+ }
5787
+ b.add(component ? `${helperName(handing ? "handParts" : "componentClass")}([` : "[");
5763
5788
  }
5764
- function closeHandParts(b, component, written) {
5765
- b.add(component && !written ? "])" : "]");
5789
+ function closeHandParts(b, component, written, together) {
5790
+ b.add(component && !written && !together ? "])" : "]");
5766
5791
  const given = written?.filter((attribute) => attribute.kind === "expression" || attribute.kind === "spread") ?? [];
5767
5792
  const emit = (attribute) => {
5768
5793
  if (attribute.kind === "spread")
@@ -5782,13 +5807,15 @@ function closeHandParts(b, component, written) {
5782
5807
  b.add(" }");
5783
5808
  }
5784
5809
  if (written)
5785
- b.add(")");
5810
+ b.add(together ? "])" : ")");
5786
5811
  }
5787
5812
  function handsEntry(element, source, attribute, hands) {
5788
5813
  return hands && writtenParts(element, source).includes(attribute);
5789
5814
  }
5790
5815
  var init_hand_parts = __esm(() => {
5816
+ init_ast();
5791
5817
  init_markup();
5818
+ init_names();
5792
5819
  });
5793
5820
 
5794
5821
  // src/compiler/image-attributes.ts
@@ -7319,7 +7346,7 @@ class TemplateWriter {
7319
7346
  }
7320
7347
  componentProps(element, getters, except) {
7321
7348
  const { b } = this;
7322
- const spreads = element.attributes.some((attribute) => attribute.kind === "spread");
7349
+ const spreads = element.attributes.some((attribute) => attribute.kind === "spread") || writesTogether(element, this.src, this.facts.parts);
7323
7350
  if (spreads)
7324
7351
  b.add(`${helperName("merge")}(`);
7325
7352
  const props = this.sources(element, getters, true);
@@ -7456,9 +7483,15 @@ class TemplateWriter {
7456
7483
  if (element.name === "img" && ownStyle !== undefined && element.attributes.lastIndexOf(ownStyle) < lastSpread)
7457
7484
  namedEntry(ownStyle, "style");
7458
7485
  const hands = element.component && handedParts(element, this.src, this.facts.parts).length > 0;
7459
- if (hands ? spreads : mergedClass)
7486
+ const together = writesTogether(element, this.src, this.facts.parts);
7487
+ if (together) {
7488
+ closeObject();
7489
+ b.add(objects++ > 0 ? ", " : "");
7490
+ this.mergedClass(element, classAttribute, spreads, writtenParts(element, this.src), true);
7491
+ }
7492
+ if (!together && (hands ? spreads : mergedClass))
7460
7493
  entry("class", () => hands ? b.add("undefined") : this.mergedClass(element, classAttribute, spreads), !hands);
7461
- if (element.component && parts.length > 0)
7494
+ if (!together && element.component && parts.length > 0)
7462
7495
  entry("parts", () => this.mergedClass(element, classAttribute, spreads, writtenParts(element, this.src)), true);
7463
7496
  if (!keepOpen)
7464
7497
  close();
@@ -7549,7 +7582,7 @@ class TemplateWriter {
7549
7582
  if (defaults.length > 0)
7550
7583
  this.b.add(`, { ${defaults.map(([name, value]) => `${JSON.stringify(name)}: ${JSON.stringify(value)}`).join(", ")} }`);
7551
7584
  }
7552
- mergedClass(element, classAttribute, spreads, handing) {
7585
+ mergedClass(element, classAttribute, spreads, handing, together = false) {
7553
7586
  const { b } = this;
7554
7587
  const shorthand = element.classes.length > 0 ? this.shorthand(element) : undefined;
7555
7588
  const parts = partsOf(element, this.src, this.facts.parts);
@@ -7569,22 +7602,12 @@ class TemplateWriter {
7569
7602
  else if (attribute === classAttribute && attribute.kind === "expression")
7570
7603
  items.push({ emit: () => b.add("(").addSource(attribute.expression).add(")") });
7571
7604
  }
7572
- for (const part of handed) {
7573
- items.push({
7574
- emit: () => {
7575
- b.add(`${helperName("partHanded")}(${JSON.stringify(part)}, [`);
7576
- for (const emit of this.recipeItem(part)) {
7577
- emit();
7578
- b.add(", ");
7579
- }
7580
- b.add(`${helperName("partClass")}(${PROPS}, ${JSON.stringify(part)})])`);
7581
- }
7582
- });
7583
- }
7605
+ for (const part of handed)
7606
+ items.push(handedItem(b, part, this.recipeItem(part)));
7584
7607
  for (const part of parts)
7585
7608
  items.push(...this.recipeItem(part).map((emit) => ({ emit })), { emit: () => b.add(`${helperName("partClass")}(${PROPS}, ${JSON.stringify(part)})`) });
7586
7609
  const written = this.classTable === undefined ? items : joinTexts(items, (texts) => this.joinLiterals(texts));
7587
- openClassList(b, element.component, parts.length > 0, handing);
7610
+ openClassList(b, element.component, handing, together);
7588
7611
  for (const [index, item] of written.entries()) {
7589
7612
  if (index > 0)
7590
7613
  b.add(", ");
@@ -7593,7 +7616,7 @@ class TemplateWriter {
7593
7616
  else
7594
7617
  item.emit();
7595
7618
  }
7596
- closeHandParts(b, element.component, handing);
7619
+ closeHandParts(b, element.component, handing, together);
7597
7620
  }
7598
7621
  childrenValue(nodes, lazy = false, scope, fromSource = false) {
7599
7622
  const { b } = this;
@@ -7894,8 +7917,8 @@ function awaitAlertTail(alert, target) {
7894
7917
  var HTML_HELPERS, DOM_HELPERS, APART;
7895
7918
  var init_helper_imports = __esm(() => {
7896
7919
  init_markup();
7897
- HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "handParts", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partsClass", "raw", "rawData", "rawTyped", "refillOptions", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
7898
- DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "handParts", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "part", "partClass", "partHanded", "partsClass", "property", "ref", "setClass", "setStyle", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
7920
+ HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "handParts", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partProps", "raw", "rawData", "rawTyped", "refillOptions", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
7921
+ DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "handParts", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "part", "partClass", "partHanded", "partProps", "property", "ref", "setClass", "setStyle", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
7899
7922
  APART = [["kay/dom-loop", ["loop", "rowKey"]], ["kay/dom-await", ["awaited"]], ["kay/dom-try", ["attempt"]], ["kay/dom-spread", ["dynamic", "spread"]], ["kay/dom-image", ["image"]], ["kay/pending", ["pendingCall"]]];
7900
7923
  });
7901
7924
 
@@ -9404,6 +9427,17 @@ function islandMessages(source, client = false, lives = [], cause, fallback = fa
9404
9427
  return `, ${JSON.stringify(keys)}, true`;
9405
9428
  return keys.length > 0 ? `, ${JSON.stringify(keys)}` : "";
9406
9429
  }
9430
+ function islandExport(expression, island, options) {
9431
+ if (island?.interactive === undefined || options.client || (options.lives?.length ?? 0) > 0 || island.hydrate !== undefined || island.persist !== undefined)
9432
+ return `
9433
+ export default ${expression}
9434
+ `;
9435
+ return `
9436
+ import type { IslandAsked as KayIslandAsked } from 'kay'
9437
+ const KayIslandExport = ${expression}
9438
+ export default KayIslandExport as typeof KayIslandExport & KayIslandAsked<${JSON.stringify(island.interactive)}>
9439
+ `;
9440
+ }
9407
9441
  var MESSAGE_KEY, AWAIT_LINE, KAY_IMPORT;
9408
9442
  var init_island_arguments = __esm(() => {
9409
9443
  MESSAGE_KEY = /(?:\b(?:t|T|wording)\(\s*|\bT\([^)]*?\bkey=)(['"`])([\w.-]+)\1/g;
@@ -10355,7 +10389,7 @@ class JsxTemplate {
10355
10389
  const sent = sentParts(this.src.slice(start, end)) ?? { parts: [{ start: 0, end: end - start }], functions: false };
10356
10390
  let at = start;
10357
10391
  if (sent.functions) {
10358
- this.emitFunctionPropCheck(element, attribute.name);
10392
+ this.emitFunctionPropCheck(element, attribute.name, false);
10359
10393
  b.add(" ");
10360
10394
  }
10361
10395
  this.attributeName(attribute).add("={");
@@ -10371,8 +10405,8 @@ class JsxTemplate {
10371
10405
  return this.b.wrap(attribute.name, () => this.b.add(this.text(attribute.name)));
10372
10406
  return this.b.addSource(attribute.name);
10373
10407
  }
10374
- emitFunctionPropCheck(element, name) {
10375
- this.b.add("{...KayFunctionProp(").addSource(element.tag).add(")(").wrap(name, () => this.b.add("0")).add(")}");
10408
+ emitFunctionPropCheck(element, name, whole = true) {
10409
+ this.b.add("{...KayFunctionProp(").addSource(element.tag).add(whole ? usedProps(element, (span) => this.text(span)) : "").add(")(").wrap(name, () => this.b.add("0")).add(")}");
10376
10410
  }
10377
10411
  emitBind(element, attribute, property) {
10378
10412
  const { b } = this;
@@ -10787,6 +10821,16 @@ function templateWords(file) {
10787
10821
  });
10788
10822
  return [...words];
10789
10823
  }
10824
+ function templateWrites(file) {
10825
+ const names = new Set;
10826
+ visitNodes(file.template, (node) => {
10827
+ for (const span of nodeExpressions(node)) {
10828
+ for (const [, after, before] of file.source.slice(span.start, span.end).matchAll(WRITE))
10829
+ names.add(after ?? before);
10830
+ }
10831
+ });
10832
+ return names;
10833
+ }
10790
10834
  function scopedBlocks(node) {
10791
10835
  switch (node.kind) {
10792
10836
  case "for":
@@ -10836,7 +10880,7 @@ function shadowedBinds(file) {
10836
10880
  walk(file.template, new Set);
10837
10881
  return shadowed;
10838
10882
  }
10839
- var WORD4, FIRST_NAME, TYPED_VALUES, IDENTIFIER2, FUNCTIONS2;
10883
+ var WORD4, FIRST_NAME, TYPED_VALUES, IDENTIFIER2, FUNCTIONS2, WRITE;
10840
10884
  var init_template_reads = __esm(() => {
10841
10885
  init_ast();
10842
10886
  init_estree();
@@ -10847,6 +10891,7 @@ var init_template_reads = __esm(() => {
10847
10891
  TYPED_VALUES = new Set(["TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"]);
10848
10892
  IDENTIFIER2 = /(?<![\w$.])[A-Z_$][\w$]*/gi;
10849
10893
  FUNCTIONS2 = new Set(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration"]);
10894
+ WRITE = /([\w$]+)\s*(?:\.(?:set|update)\s*\(|(?:\*\*|<<|>>>?|&&|\|\||\?\?|[-+*/%&|^])?=(?![=>])|\+\+|--)|(?:\+\+|--)\s*([\w$]+)/g;
10850
10895
  });
10851
10896
 
10852
10897
  // src/compiler/load-plan.ts
@@ -11507,17 +11552,13 @@ ${name}.kayFailed = KayFailed
11507
11552
  export default ${this.mode === "html" && this.options.failedCode !== undefined ? `Object.assign((props: never) => KayInsideIsland() ? KayHydrated(props) : ${name}(props), { kayFailed: KayFailed })` : `((props: never) => KayInsideIsland() ? KayHydrated(props) : ${name}(props))`} as typeof ${name}${widened ? this.widenedCall(`typeof ${name}`) : ""}
11508
11553
  `);
11509
11554
  else if (this.kind === "island" && widened && !this.genericComponent)
11510
- b.add(`
11511
- export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.islandTail(src)}) as unknown as ReturnType<typeof KayIsland<Parameters<typeof ${name}>[0]>>${this.widenedCall(`ReturnType<typeof KayIsland<Parameters<typeof ${name}>[0]>>`)}
11512
- `);
11555
+ b.add(islandExport(`KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.islandTail(src)}) as unknown as ReturnType<typeof KayIsland<Parameters<typeof ${name}>[0]>>${this.widenedCall(`ReturnType<typeof KayIsland<Parameters<typeof ${name}>[0]>>`)}`, this.script.island, this.options));
11513
11556
  else if (widened && this.kind !== "island")
11514
11557
  b.add(`
11515
11558
  export default ${name} as typeof ${name}${this.widenedCall(`typeof ${name}`)}
11516
11559
  `);
11517
11560
  else if (this.kind === "island")
11518
- b.add(`
11519
- export default KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.genericComponent ? " as never" : ""}${this.islandTail(src)})${this.genericIslandType()}${widened ? this.widenedCall(`typeof ${name}`) : ""}
11520
- `);
11561
+ b.add(islandExport(`KayIsland(${JSON.stringify(this.options.island)}, ${name}${this.genericComponent ? " as never" : ""}${this.islandTail(src)})${this.genericIslandType()}${widened ? this.widenedCall(`typeof ${name}`) : ""}`, this.script.island, this.options));
11521
11562
  }
11522
11563
  islandTail(src) {
11523
11564
  const html = this.options.output === "html";
@@ -12989,13 +13030,132 @@ var init_a11y = __esm(() => {
12989
13030
  WALKS = { element: "element", text: "within", slot: "within", if: "alternatives", match: "alternatives", for: "alternatives", await: "alternatives", try: "alternatives", pending: "within", snippet: "within", const: "none", error: "none" };
12990
13031
  });
12991
13032
 
13033
+ // src/compiler/removed-lints.ts
13034
+ var REMOVED_LINTS;
13035
+ var init_removed_lints = __esm(() => {
13036
+ REMOVED_LINTS = [
13037
+ "deprecated-action-readers",
13038
+ "deprecated-action-type",
13039
+ "deprecated-ai-labels",
13040
+ "deprecated-ai-language",
13041
+ "deprecated-ai-links",
13042
+ "deprecated-ai-options",
13043
+ "deprecated-ai-props",
13044
+ "deprecated-analytics-options",
13045
+ "deprecated-app-hooks",
13046
+ "deprecated-auth-methods",
13047
+ "deprecated-auth-rate-limits",
13048
+ "deprecated-auth-signed",
13049
+ "deprecated-await-consent",
13050
+ "deprecated-call-result",
13051
+ "deprecated-callback-handler",
13052
+ "deprecated-children-prop",
13053
+ "deprecated-client-keys",
13054
+ "deprecated-cms-options",
13055
+ "deprecated-cms-test-helpers",
13056
+ "deprecated-config-groups",
13057
+ "deprecated-config-keys",
13058
+ "deprecated-config-switch",
13059
+ "deprecated-context-import",
13060
+ "deprecated-ctx-fail",
13061
+ "deprecated-deny-call",
13062
+ "deprecated-disk-files",
13063
+ "deprecated-env-files",
13064
+ "deprecated-event-names",
13065
+ "deprecated-filter-options",
13066
+ "deprecated-format-duration",
13067
+ "deprecated-guard-option",
13068
+ "deprecated-hook-context",
13069
+ "deprecated-hook-names",
13070
+ "deprecated-i18n-keys",
13071
+ "deprecated-if-alias",
13072
+ "deprecated-image-options",
13073
+ "deprecated-images-keys",
13074
+ "deprecated-import-path",
13075
+ "deprecated-infinite-list-options",
13076
+ "deprecated-island-attributes",
13077
+ "deprecated-island-events",
13078
+ "deprecated-island-fence",
13079
+ "deprecated-job-handler",
13080
+ "deprecated-job-options",
13081
+ "deprecated-link-flags",
13082
+ "deprecated-listen-target",
13083
+ "deprecated-live-api",
13084
+ "deprecated-local-state",
13085
+ "deprecated-mail-form",
13086
+ "deprecated-mail-send",
13087
+ "deprecated-navigate-query",
13088
+ "deprecated-navigation-hooks",
13089
+ "deprecated-package-names",
13090
+ "deprecated-page-cache",
13091
+ "deprecated-page-island",
13092
+ "deprecated-page-seo",
13093
+ "deprecated-pages-options",
13094
+ "deprecated-parts-class",
13095
+ "deprecated-persisted-call",
13096
+ "deprecated-persisted-query",
13097
+ "deprecated-persisted-storage",
13098
+ "deprecated-rate-enforce",
13099
+ "deprecated-redirect-permanent",
13100
+ "deprecated-refuse-call",
13101
+ "deprecated-route-keys",
13102
+ "deprecated-schedule-call",
13103
+ "deprecated-schedule-tz",
13104
+ "deprecated-schema-type",
13105
+ "deprecated-script-fence",
13106
+ "deprecated-secret-keys",
13107
+ "deprecated-socket-frames",
13108
+ "deprecated-source-readers",
13109
+ "deprecated-store-ms",
13110
+ "deprecated-store-names",
13111
+ "deprecated-test-helpers",
13112
+ "deprecated-ttl-names",
13113
+ "deprecated-ui-callbacks",
13114
+ "deprecated-ui-hotkey",
13115
+ "deprecated-ui-input",
13116
+ "deprecated-ui-item-keys",
13117
+ "deprecated-ui-items",
13118
+ "deprecated-uncaught-await",
13119
+ "deprecated-workflow-start-id",
13120
+ "uncaught-await",
13121
+ "unreturned-fail"
13122
+ ];
13123
+ });
13124
+
12992
13125
  // src/compiler/allow-comments.ts
12993
13126
  function allowComments(source) {
12994
13127
  return Array.from(source.matchAll(ALLOW_COMMENT), (comment) => {
12995
13128
  const { line, column } = positionAt(source, comment.index);
12996
13129
  const listStart = comment.index + comment[0].length - comment[3].length - comment[2].length;
12997
13130
  const names = Array.from(comment[2].matchAll(LINT_NAME), (name) => ({ name: name[0], start: listStart + name.index }));
12998
- return { names, file: comment[1] === "kay-allow-file", line: source.slice(comment.index - column + 1, comment.index).trim() === "" ? line + 1 : line, start: comment.index, reasoned: REASON.test(comment[3]) };
13131
+ return { names, file: comment[1] === "kay-allow-file", line: source.slice(comment.index - column + 1, comment.index).trim() === "" ? line + 1 : line, start: comment.index, end: comment.index + comment[0].length, reasoned: REASON.test(comment[3]) };
13132
+ });
13133
+ }
13134
+ function unknownNames(comment, source, known, help) {
13135
+ const unknown = comment.names.filter(({ name }) => !known(name));
13136
+ const removed = new Set(REMOVED_LINTS);
13137
+ const lastKept = comment.names.findLastIndex(({ name }) => !removed.has(name));
13138
+ const lineStart = source.lastIndexOf(`
13139
+ `, comment.start - 1) + 1;
13140
+ const whole = source.slice(lineStart, comment.start).trim() === "";
13141
+ const after = comment.end + (source.startsWith(`\r
13142
+ `, comment.end) ? 2 : Number(source[comment.end] === `
13143
+ `));
13144
+ const before = comment.start - (BLANK_END.exec(source.slice(lineStart, comment.start))?.[0].length ?? 0);
13145
+ const last = comment.names.at(-1);
13146
+ return unknown.map(({ name, start }) => {
13147
+ const end = start + name.length;
13148
+ if (!removed.has(name))
13149
+ return { start, end, code: "unknown-lint", message: `Unknown lint \`${name}\``, help, checkOnly: true };
13150
+ const position = comment.names.findIndex((other) => other.start === start);
13151
+ const diagnostic = { start, end, code: "unknown-lint", severity: "warning", message: `\`${name}\` is a lint kay has removed`, help: "remove it from the comment: it allows nothing", checkOnly: true };
13152
+ if (position > lastKept && position !== lastKept + 1)
13153
+ return diagnostic;
13154
+ const kept = comment.names[lastKept];
13155
+ const dropped = whole ? { start: lineStart, end: after } : { start: before, end: comment.end };
13156
+ const tail = kept ? { start: kept.start + kept.name.length, end: last.start + last.name.length } : dropped;
13157
+ const edit = position > lastKept ? tail : { start, end: comment.names[position + 1].start };
13158
+ return { ...diagnostic, fixes: [{ title: kept || position < lastKept ? `remove \`${name}\`` : "remove the comment", safe: true, edits: [{ ...edit, text: "" }] }] };
12999
13159
  });
13000
13160
  }
13001
13161
  function refusal(comment, rules) {
@@ -13016,11 +13176,13 @@ function refusedComments(comments, rules) {
13016
13176
  return message === undefined ? [] : [{ start: comment.start, end: comment.start + 2, code: "allow-refused", message, checkOnly: true }];
13017
13177
  });
13018
13178
  }
13019
- var ALLOW_COMMENT, LINT_NAME, REASON;
13179
+ var ALLOW_COMMENT, LINT_NAME, BLANK_END, REASON;
13020
13180
  var init_allow_comments = __esm(() => {
13021
13181
  init_mapping();
13182
+ init_removed_lints();
13022
13183
  ALLOW_COMMENT = /\/\/[ \t]*(kay-allow(?:-file)?)[ \t]+(\w[\w-]*(?:[ \t]*,[ \t]*\w[\w-]*)*)([^\n]*)/g;
13023
13184
  LINT_NAME = /[\w-]+/g;
13185
+ BLANK_END = /[ \t]*$/;
13024
13186
  REASON = /^[ \t]*--[ \t]*\S/;
13025
13187
  });
13026
13188
 
@@ -13033,7 +13195,7 @@ var init_deprecated_lints_1_106 = __esm(() => {
13033
13195
  group: "deprecated",
13034
13196
  since: "1.106",
13035
13197
  site: true,
13036
- summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
13198
+ summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of a `defineEnv` is the record of fields alone, as an env reads only the names it declares; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed, and keeps what each did: an `s.Array` takes `max: Number.MAX_SAFE_INTEGER` (the lowercase list stops at 1,000 items) and an `s.Object` `extra: 'strip'`, a rewrite whose options are not an object literal being reported without a fix; an `s.Union` of `Object.keys(R).map(key => s.Literal(key))` is `s.enum(R)`, and any other `s.Union` of a mapped array is reported without a fix; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by, so the fix writes `{ extra: 'strip' }`. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
13037
13199
  wrong: `--- server
13038
13200
  import { action, s } from 'kay'
13039
13201
 
@@ -13043,7 +13205,7 @@ p x`,
13043
13205
  right: `--- server
13044
13206
  import { action, s } from 'kay'
13045
13207
 
13046
- export const add = action({ title: s.string({ max: 200 }), note: s.string({ optional: true }) }, ({ title }) => title)
13208
+ export const add = action(s.object({ title: s.string({ max: 200 }), note: s.string({ optional: true }) }, { extra: 'strip' }), ({ title }) => title)
13047
13209
  ---
13048
13210
  p x`
13049
13211
  }
@@ -13161,6 +13323,25 @@ button(onClick={() => count.set(count() + 1)}) {count()}`,
13161
13323
  import Counter from '../components/counter.kay'
13162
13324
  ---
13163
13325
  Counter`
13326
+ },
13327
+ "signal-from-prop": {
13328
+ level: "warn",
13329
+ group: "islands",
13330
+ summary: "A `signal` seeded from a destructured prop at the top of an island's script, `signal(light)` or `signal(todo.title)`, that the island never writes: an island stays when the page gives it new props, as after an action or a refresh, so the signal keeps the first value. `linked(() => light)` follows the prop; `kay check --fix` writes it. A signal the island writes, as a counter starting from a prop, is its own state and is left alone, as is a prop named `initial...` or `default...` or a comment `// kay-allow signal-from-prop`.",
13331
+ wrong: `---
13332
+ import { signal } from 'kay'
13333
+
13334
+ const { light } = props<{ light: string }>()
13335
+ const picked = signal(light)
13336
+ ---
13337
+ p {picked()}`,
13338
+ right: `---
13339
+ import { linked } from 'kay'
13340
+
13341
+ const { light } = props<{ light: string }>()
13342
+ const picked = linked(() => light)
13343
+ ---
13344
+ p {picked()}`
13164
13345
  }
13165
13346
  };
13166
13347
  });
@@ -13928,9 +14109,6 @@ var init_template_scopes = __esm(() => {
13928
14109
  WORD8 = /[\w$]+/g;
13929
14110
  });
13930
14111
 
13931
- // src/compiler/minor.ts
13932
- var init_minor = () => {};
13933
-
13934
14112
  // src/compiler/lints.ts
13935
14113
  function isLint(code) {
13936
14114
  return code !== undefined && Object.hasOwn(LINTS, code);
@@ -13971,7 +14149,7 @@ function applyLints(diagnostics, source, levels = {}) {
13971
14149
  return [...leveled, ...unknownLints(source), ...refusedComments(allowComments(source), levels.comments)];
13972
14150
  }
13973
14151
  function unknownLints(source) {
13974
- return allowComments(source).flatMap((comment) => comment.names.filter(({ name }) => !isLint(name)).map(({ name, start }) => ({ start, end: start + name.length, code: "unknown-lint", message: `Unknown lint \`${name}\``, help: `the lints are ${Object.keys(LINTS).map((lint) => `\`${lint}\``).join(", ")}`, checkOnly: true })));
14152
+ return allowComments(source).flatMap((comment) => unknownNames(comment, source, isLint, `the lints are ${Object.keys(LINTS).map((lint) => `\`${lint}\``).join(", ")}`));
13975
14153
  }
13976
14154
  function templateLints(file) {
13977
14155
  const found = [];
@@ -14087,7 +14265,6 @@ var init_lints = __esm(() => {
14087
14265
  init_style_lints();
14088
14266
  init_template_scopes();
14089
14267
  init_deprecated_lints();
14090
- init_minor();
14091
14268
  LINTS = {
14092
14269
  "unread-name": {
14093
14270
  level: "deny",
@@ -17488,6 +17665,108 @@ var init_server_imports = __esm(() => {
17488
17665
  WORD9 = /(?<![\w$.])[a-z_$][\w$]*/gi;
17489
17666
  });
17490
17667
 
17668
+ // src/compiler/signal-from-prop.ts
17669
+ function propRoot(node) {
17670
+ if (node.type === "Identifier")
17671
+ return node.name;
17672
+ return node.type === "MemberExpression" && !node.computed && node.property.type === "Identifier" ? propRoot(node.object) : undefined;
17673
+ }
17674
+ function importedAs(node, name) {
17675
+ return node.type === "ImportSpecifier" && node.importKind !== "type" && node.local.name === name && (node.imported.type === "Identifier" ? node.imported.name : node.imported.value) === name;
17676
+ }
17677
+ function followedByEffects(ast) {
17678
+ const names = new Set;
17679
+ eachNode(ast, (node) => {
17680
+ if (node.type !== "CallExpression" || node.callee.type !== "Identifier" || node.callee.name !== "effect")
17681
+ return;
17682
+ eachNode(node, (inner) => {
17683
+ if (inner.type === "AssignmentExpression" && inner.left.type === "Identifier")
17684
+ names.add(inner.left.name);
17685
+ if (inner.type === "CallExpression" && inner.callee.type === "MemberExpression" && inner.callee.property.type === "Identifier" && inner.callee.property.name === "set" && inner.callee.object.type === "Identifier")
17686
+ names.add(inner.callee.object.name);
17687
+ });
17688
+ return false;
17689
+ });
17690
+ return names;
17691
+ }
17692
+ function writtenNames(ast) {
17693
+ const names = new Set;
17694
+ eachNode(ast, (node) => {
17695
+ if (node.type === "AssignmentExpression" && node.left.type === "Identifier")
17696
+ names.add(node.left.name);
17697
+ if (node.type === "UpdateExpression" && node.argument.type === "Identifier")
17698
+ names.add(node.argument.name);
17699
+ if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.property.type === "Identifier" && (node.callee.property.name === "set" || node.callee.property.name === "update"))
17700
+ names.add(node.callee.object.name);
17701
+ });
17702
+ return names;
17703
+ }
17704
+ function signalFromProps(fence, props, writtenInTemplate) {
17705
+ if (!props || !fence.code.includes("signal"))
17706
+ return [];
17707
+ const watched = new Set(props.bindings.filter((binding) => !INITIAL_PROP.test(binding.key)).map((binding) => fence.code.slice(binding.local.start - fence.offset, binding.local.end - fence.offset)));
17708
+ const declaration = fence.ast.body.find((node) => node.type === "ImportDeclaration" && node.source.value === KAY && node.importKind !== "type");
17709
+ const specifier = declaration?.type === "ImportDeclaration" ? declaration.specifiers.find((node) => importedAs(node, "signal")) : undefined;
17710
+ if (watched.size === 0 || specifier?.type !== "ImportSpecifier")
17711
+ return [];
17712
+ const linked = declaration?.type === "ImportDeclaration" && declaration.specifiers.some((node) => importedAs(node, "linked"));
17713
+ let others = 0;
17714
+ let taken = false;
17715
+ const seeds = [];
17716
+ eachNode(fence.ast, (node) => {
17717
+ if (node.type === "ImportDeclaration" || node.type === "VariableDeclaration" && fence.shift(node).start === props.statement.start)
17718
+ return false;
17719
+ if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") {
17720
+ for (const param of node.params) {
17721
+ for (const name of patternNames(param))
17722
+ watched.delete(name);
17723
+ }
17724
+ }
17725
+ if (node.type === "VariableDeclarator") {
17726
+ for (const name of patternNames(node.id)) {
17727
+ watched.delete(name);
17728
+ taken ||= name === "linked";
17729
+ }
17730
+ const { init } = node;
17731
+ if (init?.type === "CallExpression" && init.callee.type === "Identifier" && init.callee.name === "signal" && init.arguments.length === 1 && init.arguments[0].type !== "SpreadElement")
17732
+ seeds.push({ call: init, name: node.id.type === "Identifier" ? node.id.name : undefined });
17733
+ }
17734
+ if (node.type === "Identifier" && node.name === "signal")
17735
+ others++;
17736
+ return true;
17737
+ });
17738
+ const diagnostics = [];
17739
+ const followed = followedByEffects(fence.ast);
17740
+ const written = writtenNames(fence.ast);
17741
+ const found = seeds.filter(({ call, name }) => {
17742
+ const root = call.typeArguments || name !== undefined && (followed.has(name) || written.has(name) || writtenInTemplate.has(name)) ? undefined : propRoot(call.arguments[0]);
17743
+ return root !== undefined && watched.has(root);
17744
+ });
17745
+ for (const { call } of found) {
17746
+ const seed = call.arguments[0];
17747
+ const root = propRoot(seed);
17748
+ const text = fence.code.slice(seed.start, seed.end);
17749
+ const imports = linked || taken ? [] : [{ ...fence.shift(specifier), text: others > found.length ? "linked, signal" : "linked" }];
17750
+ const fix = { title: `Write \`linked(() => ${text})\``, safe: !taken, edits: [{ ...fence.shift(call), text: `linked(() => ${text})` }, ...imports] };
17751
+ diagnostics.push({
17752
+ ...fence.shift(call),
17753
+ code: "signal-from-prop",
17754
+ message: `\`signal(${text})\` keeps the first value of \`${root}\`, as a signal made from a prop does not follow it`,
17755
+ note: "the island stays when the page gives it new props, as after an action or a refresh, so a seed read once shows the old value",
17756
+ help: `write \`linked(() => ${text})\`, which follows the prop and can still be written, or \`// kay-allow signal-from-prop\` when the first value is meant`,
17757
+ checkOnly: true,
17758
+ fixes: taken ? [] : [fix]
17759
+ });
17760
+ }
17761
+ return diagnostics;
17762
+ }
17763
+ var KAY = "kay";
17764
+ var init_signal_from_prop = __esm(() => {
17765
+ init_each_node();
17766
+ init_live_reads();
17767
+ init_pattern_names();
17768
+ });
17769
+
17491
17770
  // src/compiler/twin.ts
17492
17771
  var ISLAND_TWIN = "?island";
17493
17772
 
@@ -17708,7 +17987,7 @@ function compileKay(original, filename, options = {}) {
17708
17987
  const fenceLints = [script.fence, script.moduleFence, server?.fence].flatMap((fence) => fence ? [...cssImportsWithoutText(fence), ...asyncReplies(fence), ...openRedirects(fence), ...missingCaptchas(fence)] : []);
17709
17988
  const browserScript = (island !== undefined || options.insideIsland === true) && !routeFile ? scriptFences(script) : [];
17710
17989
  const unusedLints = broken ? [] : [...unreadNames(source, file.template, script, server, found.findings), ...constantSignals(source, [file.script, file.module], found.findings)];
17711
- diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? onceReadProps(script.fence, script.props, templateWords(file)) : [], ...unusedLints, ...templateLints(file), ...linkFlags(file));
17990
+ diagnostics.push(...unboundedFields(server), ...fenceLints, ...serialAwaits(server), ...browserScript.flatMap((fence) => serverOnlyImports(fence)), ...browserScript.includes(script.fence) ? [...onceReadProps(script.fence, script.props, templateWords(file)), ...signalFromProps(script.fence, script.props, templateWrites(file))] : [], ...unusedLints, ...templateLints(file), ...linkFlags(file));
17712
17991
  }
17713
17992
  if (checked && pin !== undefined)
17714
17993
  diagnostics.push(...markerMismatch(pin, pageFile));
@@ -17917,6 +18196,7 @@ var init_compiler = __esm(() => {
17917
18196
  init_script();
17918
18197
  init_serial_awaits();
17919
18198
  init_server_imports();
18199
+ init_signal_from_prop();
17920
18200
  init_status_pages();
17921
18201
  init_template_reads();
17922
18202
  init_unowned_effects();
@@ -1,14 +1,14 @@
1
1
  id = "kay"
2
2
  name = "Kay"
3
3
  description = "Highlighting and the kay language server for .kay components"
4
- version = "1.109.0"
4
+ version = "1.110.0"
5
5
  schema_version = 1
6
6
  authors = [ "Kaynooo" ]
7
7
  repository = "https://github.com/Kayno0o/kayjs"
8
8
 
9
9
  [grammars.kay]
10
10
  repository = "https://github.com/Kayno0o/kayjs"
11
- rev = "v1.109.0"
11
+ rev = "v1.110.0"
12
12
  path = "editors/tree-sitter-kay"
13
13
 
14
14
  [language_servers.kay]