@wcstack/lint 4.2.0 → 4.4.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.
package/dist/cli.cjs CHANGED
@@ -56,31 +56,6 @@ function createFileReader(htmlPath, read = (p) => (0, import_node_fs.readFileSyn
56
56
  };
57
57
  }
58
58
 
59
- // src/core/offsetToPosition.ts
60
- function createPositionMapper(text3) {
61
- const lineStarts = [0];
62
- for (let i = 0; i < text3.length; i++) {
63
- const c = text3.charCodeAt(i);
64
- if (c === 10) {
65
- lineStarts.push(i + 1);
66
- } else if (c === 13) {
67
- if (text3.charCodeAt(i + 1) === 10) i++;
68
- lineStarts.push(i + 1);
69
- }
70
- }
71
- return (offset2) => {
72
- const clamped = Math.max(0, Math.min(offset2, text3.length));
73
- let lo = 0;
74
- let hi = lineStarts.length - 1;
75
- while (lo < hi) {
76
- const mid = lo + hi + 1 >> 1;
77
- if (lineStarts[mid] <= clamped) lo = mid;
78
- else hi = mid - 1;
79
- }
80
- return { line: lo + 1, column: clamped - lineStarts[lo] + 1 };
81
- };
82
- }
83
-
84
59
  // src/core/diagnostics.ts
85
60
  var WcsDiagnosticCode = {
86
61
  // --- sidecar manifest envelope / schema subset ---
@@ -107,8 +82,12 @@ var WcsDiagnosticCode = {
107
82
  // --- path / type resolution against a stateSchema ---
108
83
  PathNonexistent: "wcs/path-nonexistent",
109
84
  PathTypeMismatch: "wcs/path-type-mismatch",
85
+ // 書き戻す束縛(`value:` / `checked:` / `radio:` / `checkbox:`、`#ro` なし)が、setter の無い getter を指す。ランタイムは
86
+ // 入力のたびに `"<path>" is a getter without a setter` を投げる(code なし — 7GUIs の評価の Temperature)。error。
110
87
  PathReadonly: "wcs/path-readonly",
111
88
  PathReservedName: "wcs/path-reserved-name",
89
+ // lint の限界の告知(作者の誤りではない): `export default { … }` のトップレベルの spread が持ち込むキーは読めないので、
90
+ // stateSchema の無い state のパスは検査しない — それを spread の上で 1 回だけ言う。info。
112
91
  PathDynamicUnknown: "wcs/path-dynamic-unknown",
113
92
  // --- existing binding-expression validators (retrofitted) ---
114
93
  FilterUnknown: "wcs/filter-unknown",
@@ -119,15 +98,29 @@ var WcsDiagnosticCode = {
119
98
  BindingTypeExpectation: "wcs/binding-type-expectation",
120
99
  TokenUndeclared: "wcs/token-undeclared",
121
100
  TokenMisconfigured: "wcs/token-misconfigured",
101
+ // 宣言したコマンドトークンを emit する(スクリプトの `.emit()`・マークアップの `on*: $command.x`)のに、どの
102
+ // `command.<method>:` 束縛にも結ばれていない。emit は誰にも届かず、ランタイムは何も言わない(7GUIs の評価)。warning
103
+ // (ページの外 — 別ファイルのルートのテンプレート — で束ねる形は見えない)。
104
+ CommandTokenUnbound: "wcs/command-token-unbound",
105
+ // state が宣言していないトップレベルのキーへの書き込み(`this.selectedID = …` と `selectedId`)。新しいキーができる
106
+ // だけで、宣言したキーの束縛は変わらない。ランタイムは何も言わない。近い名前(打ち間違い)があるときだけ、warning。
107
+ WritePathMissing: "wcs/write-path-missing",
108
+ // getter・メソッドの中で読む state のパス(`this["items.*.amout"]`・`$getAll("items.*.amout")`・`this.totl`)が宣言に無い。
109
+ // 入れ子のパスの読みは undefined になり、そこから計算した金額が黙って違う(確定申告の下書きツールの評価)。トップレベルの
110
+ // キーは読んだ時点で throw する。近い名前(打ち間違い)があるときだけ、warning。ランタイムの diagnostics も同じ code。
111
+ ReadPathMissing: "wcs/read-path-missing",
122
112
  NestedAssign: "wcs/nested-assign",
123
113
  // --- 意味論(構文・存在検査では捕まらない取り違え。service/semanticValidator.ts) ---
124
114
  // `$getAll` / `$setAll` / `$resolve` の添字の本数がパスの `*` の本数と噛み合わない。
125
- // ランタイムは同じ code で raiseError する(超過は以前は黙って無視されていた)。
115
+ // ランタイムは #901 / #902 で throw する(diagnostics の後付けがあれば同じ code の文面。超過は 3.x では
116
+ // 黙って無視されていた)。error。
126
117
  IndexArity: "wcs/index-arity",
127
118
  // ワイルドカードの階数がスコープの段数を超える(`matrix.*.*` を 1 段の for で読む、
128
119
  // `$2` を 1 段のループで読む。ランタイムの #1401)。既存の「for の外」検査の深さ方向の一般化。
129
120
  // 4.0 は各段の `*` が**その段で囲む for のリスト**の行であることも確かめる(#1403・F32 — `for: a`
130
- // の行の中の `b.*.y` は投げる)。静的側も囲む for の一覧と段ごとに比べて同じ code で報告する。
121
+ // の行の中の `b.*.y` は投げる)。静的側も囲む for の一覧と段ごとに比べて同じ code で報告する
122
+ // (ランタイムの文面に code が付くのは diagnostics の後付けがあるとき)。for のスコープを組み直しきれない
123
+ // ので、ランタイムは初期化を失敗させるが warning のまま(vscode-wcs の README の重大度の例外)。
131
124
  WildcardRank: "wcs/wildcard-rank",
132
125
  // ループの添字の範囲(`$1`〜`$128`。上限は manifest の `syntax.indexParam.maxDepth`)の外。ランタイムと同じ code:
133
126
  // for の中のマークアップの `$129`(バインディングが失敗する)と、スクリプトの `this.$0` / `this.$129` / `this.$1000`
@@ -135,7 +128,8 @@ var WcsDiagnosticCode = {
135
128
  // `wcs/binding-path-missing`(ただしけっして動かないので error)。for の外の `$129` はランタイムでは #1401 なので
136
129
  // 従来どおり「for の外のループ添字」(`wcs/template-syntax`)で報告する。
137
130
  IndexParamRange: "wcs/index-param-range",
138
- // パス getter どうしの循環参照。ランタイムはアドレススタック上限まで再帰してから落ちる。
131
+ // パス getter どうしの循環参照。4.0 のランタイムは評価の時点で #701 として throw し、その getter を読む
132
+ // 束縛はすべて失敗する(3.x はアドレススタック上限まで再帰してから落ちた)。error。
139
133
  GetterCycle: "wcs/getter-cycle",
140
134
  // `$renderedCallback`(3.x の旧名 `$updatedCallback`)が、どのバインディングにも現れないパスを判定に使っている。
141
135
  // 同コールバックは **binding 駆動**(live binding が適用された path しか報告しない)
@@ -150,8 +144,9 @@ var WcsDiagnosticCode = {
150
144
  GetterUntrackedRead: "wcs/getter-untracked-read",
151
145
  OnHandlerThis: "wcs/on-handler-this",
152
146
  // --- <wcs-state> script: $watch declaration ---
153
- // ランタイム(watch/processWatchDeclaration.ts)が raiseError で落とす宣言。
154
- // 越境 `@` / `$` 始まり / 空キー・空セグメント / 明らかな非関数ハンドラ。
147
+ // temporal の後付け(state の temporal/watch.ts)が読み込みで throw する宣言: 越境 `@` / `$` 始まり /
148
+ // 空キー / 明らかな非関数ハンドラ。空の段(`a..b`)はランタイムが調べず、その watch は黙って発火しない
149
+ // (lint だけが知らせる — docs/mistake-catalogue.md)。
155
150
  WatchDeclarationInvalid: "wcs/watch-declaration-invalid",
156
151
  // `$watch` のキーが状態定義に存在しない。バインディング側と違い黙って発火しない
157
152
  // だけなので気づけない。severity は binding-path-missing に揃える(warning)。
@@ -170,8 +165,8 @@ var WcsDiagnosticCode = {
170
165
  //
171
166
  // `**` を解釈しない場所へ `**` が渡った(data-wcs / mustache / $watch キー / $listKeys
172
167
  // キー / $resolve / $postUpdate / $dependOn(旧名 $trackDependency) / 代入)、または `$recursion` 宣言が
173
- // 無いのに `**` を使った。runtime は PathInfo の不変条件として raiseError するか
174
- //(API 経由)、getter を黙って無視する(宣言なしの `**` getter)。
168
+ // 無いのに `**` を使った。4.0 の runtime はどれも #1101 で throw する — 宣言なしの `**` getter も、
169
+ // アクセサを登録する時点で(3.x は黙って無視した)。error。
175
170
  RecursionUnsupported: "wcs/recursion-unsupported",
176
171
  // 宣言済みアンカーと合致しない `**`(綴り違い・2 つ目の `**`)、または `**` の後ろが
177
172
  // 整形されていない(空セグメント・`**` 直後の素の `*`)。
@@ -209,7 +204,8 @@ var WcsDiagnosticCode = {
209
204
  // ドットアクセスを含むチェーン代入は NestedAssign の担当(相補・二重報告なし)。
210
205
  ArrayIndexAssign: "wcs/array-index-assign",
211
206
  // --- built-in wcs-* tag contract (generated/builtinTags.generated.ts が正本) ---
212
- // 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)。黙って無視される。
207
+ // 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)。4.0 のランタイムは #38 / #1203 /
208
+ // #1204 で拒み、root では初期化が、行では束縛が失敗する(3.x の「黙って無視」ではない)。error。
213
209
  TagMemberUnknown: "wcs/tag-member-unknown",
214
210
  // タグのメンバー名が "on" で始まる(`once` 等)のに先頭ドット無しで束縛した: ランタイムはイベント束縛にして
215
211
  // "ce" イベントを待ち、値は届かない。明示のプロパティ形 `.once:` を提案する(@wcstack/state 3.1・要件 B5 / 3.x 計画 D36)
@@ -271,7 +267,8 @@ var WcsDiagnosticCode = {
271
267
  // (error 昇格時は packages/lint/scripts/smoke-test.mjs の対ケース更新が必須)。
272
268
  AriaAttrUnknown: "wcs/aria-attr-unknown",
273
269
  // --- document-level load configuration ---
274
- // @wcstack/state/auto より後に他 wcstack /auto が読まれている。
270
+ // @wcstack/state/auto より後に @wcstack/devtools/auto が読まれている。info: 4.0 は後から付いた DevTools に
271
+ // 既存の束縛を送り直すので、欠けるのは付く前のタイムラインだけ。
275
272
  ScriptOrder: "wcs/script-order",
276
273
  // router/auto があるのに <base href> がない(SPA の basename 誤導出)。
277
274
  BaseHrefMissing: "wcs/base-href-missing",
@@ -319,6 +316,31 @@ function sortDiagnostics(diagnostics) {
319
316
  return [...diagnostics].sort((a, b) => a.start - b.start || severityRank[a.severity] - severityRank[b.severity] || (a.code < b.code ? -1 : a.code > b.code ? 1 : 0));
320
317
  }
321
318
 
319
+ // src/core/offsetToPosition.ts
320
+ function createPositionMapper(text3) {
321
+ const lineStarts = [0];
322
+ for (let i = 0; i < text3.length; i++) {
323
+ const c = text3.charCodeAt(i);
324
+ if (c === 10) {
325
+ lineStarts.push(i + 1);
326
+ } else if (c === 13) {
327
+ if (text3.charCodeAt(i + 1) === 10) i++;
328
+ lineStarts.push(i + 1);
329
+ }
330
+ }
331
+ return (offset2) => {
332
+ const clamped = Math.max(0, Math.min(offset2, text3.length));
333
+ let lo = 0;
334
+ let hi = lineStarts.length - 1;
335
+ while (lo < hi) {
336
+ const mid = lo + hi + 1 >> 1;
337
+ if (lineStarts[mid] <= clamped) lo = mid;
338
+ else hi = mid - 1;
339
+ }
340
+ return { line: lo + 1, column: clamped - lineStarts[lo] + 1 };
341
+ };
342
+ }
343
+
322
344
  // ../state/dist/parser.esm.js
323
345
  var hooks = {};
324
346
  function editDistance(a, b, max) {
@@ -578,8 +600,8 @@ function checkPathLikeGetPathInfo(path) {
578
600
  function recursionUnsupported(path) {
579
601
  raise(1101, [path]);
580
602
  }
581
- function parseStatePart(statePart) {
582
- const [stateAndPath, filters] = splitFilters(statePart, "output", cacheFilterInfos);
603
+ function parseStatePart(statePart2) {
604
+ const [stateAndPath, filters] = splitFilters(statePart2, "output", cacheFilterInfos);
583
605
  if (stateAndPath.includes("@")) {
584
606
  raise(32, [stateAndPath]);
585
607
  }
@@ -588,7 +610,7 @@ function parseStatePart(statePart) {
588
610
  const body = isLoopRelative ? statePathName.slice(DELIMITER.length) : statePathName;
589
611
  const hasEmptySegment = body.length > 0 && body.split(DELIMITER).some((segment) => segment.length === 0);
590
612
  if (hasEmptySegment || !isLoopRelative && body.length === 0) {
591
- raise(119, [statePart]);
613
+ raise(119, [statePart2]);
592
614
  }
593
615
  checkPathLikeGetPathInfo(statePathName);
594
616
  return {
@@ -1150,7 +1172,7 @@ function parseBindTextsForElement(bindText) {
1150
1172
  raise(101, [bindText2]);
1151
1173
  }
1152
1174
  const propPart = bindText2.slice(0, separatorIndex).trim();
1153
- const statePart = bindText2.slice(separatorIndex + 1).trim();
1175
+ const statePart2 = bindText2.slice(separatorIndex + 1).trim();
1154
1176
  const keyword = propPart.split(MODIFIER_SEPARATOR)[0].split(FILTER_SEPARATOR)[0].trim();
1155
1177
  if (KEYWORDS_WITHOUT_MODIFIERS.has(keyword)) {
1156
1178
  if (keyword !== propPart) {
@@ -1158,20 +1180,20 @@ function parseBindTextsForElement(bindText) {
1158
1180
  }
1159
1181
  let stateResult2;
1160
1182
  if (keyword === ELSE_KEYWORD) {
1161
- if (statePart.length > 0) {
1183
+ if (statePart2.length > 0) {
1162
1184
  raise(103, [bindText2]);
1163
1185
  }
1164
1186
  stateResult2 = { statePathName: "#else", outFilters: [] };
1165
1187
  } else if (keyword === SPREAD_PROP) {
1166
- if (statePart.length === 0) {
1188
+ if (statePart2.length === 0) {
1167
1189
  raise(104, [bindText2]);
1168
1190
  }
1169
- stateResult2 = parseStatePart(statePart);
1191
+ stateResult2 = parseStatePart(statePart2);
1170
1192
  if (stateResult2.outFilters.length > 0) {
1171
1193
  raise(105, [bindText2]);
1172
1194
  }
1173
1195
  } else {
1174
- stateResult2 = parseStatePart(statePart);
1196
+ stateResult2 = parseStatePart(statePart2);
1175
1197
  if (keyword === "for" && stateResult2.outFilters.length > 0) {
1176
1198
  raise(121, [bindText2]);
1177
1199
  }
@@ -1188,7 +1210,7 @@ function parseBindTextsForElement(bindText) {
1188
1210
  if (keyword === CLASS_NAMESPACE || keyword === ATTR_NAMESPACE) {
1189
1211
  raise(122, [bindText2, keyword]);
1190
1212
  }
1191
- const stateResult = parseStatePart(statePart);
1213
+ const stateResult = parseStatePart(statePart2);
1192
1214
  const propResult = parsePropPart(propPart);
1193
1215
  const [head] = propResult.propSegments;
1194
1216
  if (head === "" && propResult.propSegments.length > 1) {
@@ -1434,6 +1456,9 @@ function parseWcsStateElements(html, stateTagName = "wcs-state") {
1434
1456
  const jsonAttr = extractAttribute(wcsMatch.tagContent, "json") ?? void 0;
1435
1457
  const stateAttr = extractAttribute(wcsMatch.tagContent, "state") ?? void 0;
1436
1458
  const srcAttr = extractAttribute(wcsMatch.tagContent, "src") ?? void 0;
1459
+ const contentAt = pos + 1 + stateTagName.length;
1460
+ const srcSpan = extractAttributeSpan(wcsMatch.tagContent, "src", contentAt);
1461
+ const jsonSpan = extractAttributeSpan(wcsMatch.tagContent, "json", contentAt);
1437
1462
  const tagStart = pos;
1438
1463
  const tagEnd = wcsMatch.end;
1439
1464
  pos = wcsMatch.end;
@@ -1477,7 +1502,18 @@ function parseWcsStateElements(html, stateTagName = "wcs-state") {
1477
1502
  wcsEnd = wcsCloseIdx === -1 ? len : wcsCloseIdx;
1478
1503
  }
1479
1504
  }
1480
- elements.push({ mountPath, bindComponent, jsonAttr, stateAttr, srcAttr, scriptBlocks, tagStart, tagEnd });
1505
+ elements.push({
1506
+ mountPath,
1507
+ bindComponent,
1508
+ jsonAttr,
1509
+ stateAttr,
1510
+ srcAttr,
1511
+ scriptBlocks,
1512
+ tagStart,
1513
+ tagEnd,
1514
+ ...srcSpan !== null ? { srcSpan } : {},
1515
+ ...jsonSpan !== null ? { jsonSpan } : {}
1516
+ });
1481
1517
  pos = wcsEnd;
1482
1518
  if (wcsCloseIdx !== -1) pos = afterCloseTag(html, wcsCloseIdx);
1483
1519
  }
@@ -1612,13 +1648,13 @@ function findCloseTag(html, startPos, tagName, lower2 = asciiLowerCase(html)) {
1612
1648
  return -1;
1613
1649
  }
1614
1650
  function parseAttributeNames(tagContent) {
1615
- const names = /* @__PURE__ */ new Set();
1651
+ const names2 = /* @__PURE__ */ new Set();
1616
1652
  const attribute = /([^\s"'<>/=]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'<>`=]+))?/g;
1617
1653
  let match;
1618
1654
  while ((match = attribute.exec(tagContent)) !== null) {
1619
- names.add(match[1].toLowerCase());
1655
+ names2.add(match[1].toLowerCase());
1620
1656
  }
1621
- return names;
1657
+ return names2;
1622
1658
  }
1623
1659
  function extractAttribute(tagContent, attrName) {
1624
1660
  const regex = new RegExp(
@@ -1629,6 +1665,71 @@ function extractAttribute(tagContent, attrName) {
1629
1665
  if (!match) return null;
1630
1666
  return match[1] ?? match[2] ?? match[3] ?? null;
1631
1667
  }
1668
+ function extractAttributeSpan(tagContent, attrName, at2) {
1669
+ const regex = new RegExp(`(^|\\s)${attrName}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|(\\S+))`, "i");
1670
+ const match = regex.exec(tagContent);
1671
+ if (match === null) return null;
1672
+ const start = at2 + match.index + match[1].length;
1673
+ const end = at2 + match.index + match[0].length;
1674
+ const value = match[2] ?? match[3] ?? match[4] ?? "";
1675
+ const valueEnd = match[4] === void 0 ? end - 1 : end;
1676
+ return { start, end, valueStart: valueEnd - value.length, valueEnd };
1677
+ }
1678
+ var IGNORE_VOID_ELEMENTS = /* @__PURE__ */ new Set([
1679
+ "area",
1680
+ "base",
1681
+ "br",
1682
+ "col",
1683
+ "embed",
1684
+ "hr",
1685
+ "img",
1686
+ "input",
1687
+ "link",
1688
+ "meta",
1689
+ "param",
1690
+ "source",
1691
+ "track",
1692
+ "wbr"
1693
+ ]);
1694
+ function findIgnoredRanges(html, bindAttribute) {
1695
+ const marker = asciiLowerCase(`${bindAttribute}-ignore`);
1696
+ const lower2 = asciiLowerCase(html);
1697
+ if (!lower2.includes(marker)) return [];
1698
+ const out = [];
1699
+ const stack = [];
1700
+ const tag = /<!--[\s\S]*?(?:-->|$)|<(\/?)([a-zA-Z][^\s/>]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
1701
+ let match;
1702
+ while ((match = tag.exec(html)) !== null) {
1703
+ if (match[2] === void 0) continue;
1704
+ const name = asciiLowerCase(match[2]);
1705
+ const end = match.index + match[0].length;
1706
+ if (match[1] === "/") {
1707
+ for (let i = stack.length - 1; i >= 0; i--) {
1708
+ if (stack[i].name !== name) continue;
1709
+ for (const open of stack.slice(i)) if (open.start !== null) out.push([open.start, end]);
1710
+ stack.length = i;
1711
+ break;
1712
+ }
1713
+ continue;
1714
+ }
1715
+ const ignored = parseAttributeNames(match[3]).has(marker) ? match.index : null;
1716
+ if (IGNORE_VOID_ELEMENTS.has(name)) {
1717
+ if (ignored !== null) out.push([ignored, end]);
1718
+ continue;
1719
+ }
1720
+ if (RAW_TEXT_ELEMENTS.has(name)) {
1721
+ const close = name === "plaintext" ? -1 : lower2.indexOf(`</${name}`, end);
1722
+ const closeEnd = close === -1 ? html.length : html.indexOf(">", close) + 1 || html.length;
1723
+ if (ignored !== null) out.push([ignored, closeEnd]);
1724
+ if (close === -1) break;
1725
+ tag.lastIndex = closeEnd;
1726
+ continue;
1727
+ }
1728
+ stack.push({ name, start: ignored });
1729
+ }
1730
+ for (const open of stack) if (open.start !== null) out.push([open.start, html.length]);
1731
+ return out;
1732
+ }
1632
1733
 
1633
1734
  // src/core/parser/quoteAware.ts
1634
1735
  var isQuote = (c) => c === "'" || c === '"';
@@ -2136,10 +2237,11 @@ var builtinFilterMeta = {
2136
2237
  // `not` は真偽性(truthy / falsy)の反転。`if:` が `Boolean()` で寄せるのと同じ規則で、
2137
2238
  // `else:` はこのフィルタを足した束縛として組み立てられる(structural/createNotFilter.ts)
2138
2239
  not: { description: "\u771F\u507D\u6027\u3092\u53CD\u8EE2\uFF08falsy \u2192 true\uFF09", hasArgs: false, resultType: "boolean", acceptTypes: "any", minArgs: 0, maxArgs: 0 },
2139
- lt: { description: "\u3088\u308A\u5C0F\u3055\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number", "string"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2140
- le: { description: "\u4EE5\u4E0B\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number", "string"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2141
- gt: { description: "\u3088\u308A\u5927\u304D\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number", "string"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2142
- ge: { description: "\u4EE5\u4E0A\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number", "string"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2240
+ // 比較は数値だけを受ける(filters/core.ts の `numeric` は数値以外の値で #28。3.x も同じで、"string" は誤りだった)
2241
+ lt: { description: "\u3088\u308A\u5C0F\u3055\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2242
+ le: { description: "\u4EE5\u4E0B\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2243
+ gt: { description: "\u3088\u308A\u5927\u304D\u3044\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2244
+ ge: { description: "\u4EE5\u4E0A\u304B", hasArgs: true, resultType: "boolean", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2143
2245
  // 算術
2144
2246
  add: { description: "\u52A0\u7B97", hasArgs: true, resultType: "number", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
2145
2247
  sub: { description: "\u6E1B\u7B97", hasArgs: true, resultType: "number", acceptTypes: ["number"], minArgs: 1, maxArgs: 1, argTypes: ["number"] },
@@ -2927,17 +3029,25 @@ function hasDefaultExportObject(scriptContent) {
2927
3029
  return locateDefaultExportObject(scriptContent) !== null;
2928
3030
  }
2929
3031
  function hasTopLevelSpread(scriptContent) {
3032
+ return findTopLevelSpread(scriptContent) !== null;
3033
+ }
3034
+ function findTopLevelSpread(scriptContent) {
2930
3035
  const root = locateDefaultExportObject(scriptContent);
2931
- if (!root) return false;
3036
+ if (!root) return null;
2932
3037
  const scan = maskCommentsAndStrings(root.content);
2933
3038
  let depth = 0;
3039
+ let start = -1;
2934
3040
  for (let i = 0; i < scan.length; i++) {
2935
3041
  const ch = scan[i];
2936
3042
  if (ch === "(" || ch === "[" || ch === "{") depth++;
2937
3043
  else if (ch === ")" || ch === "]" || ch === "}") depth--;
2938
- else if (depth === 0 && ch === "." && scan.startsWith("...", i)) return true;
3044
+ else if (depth === 0 && start < 0 && ch === "." && scan.startsWith("...", i)) start = i;
3045
+ else if (depth === 0 && start >= 0 && ch === ",") return spreadRange(root.start, scan, start, i);
2939
3046
  }
2940
- return false;
3047
+ return start < 0 ? null : spreadRange(root.start, scan, start, scan.length);
3048
+ }
3049
+ function spreadRange(base, scan, start, stop) {
3050
+ return { start: base + start, end: base + start + scan.slice(start, stop).trimEnd().length };
2941
3051
  }
2942
3052
  function analyzeObjectEntries(scriptContent, key, allowEmptyKeys = false) {
2943
3053
  const root = locateDefaultExportObject(scriptContent);
@@ -3891,9 +4001,9 @@ function derefSchemaNodes(node, defs) {
3891
4001
  }
3892
4002
  return out;
3893
4003
  }
3894
- function schemaTypeHint(nodes) {
4004
+ function schemaTypeHint(nodes2) {
3895
4005
  const hints = /* @__PURE__ */ new Set();
3896
- for (const n of nodes) {
4006
+ for (const n of nodes2) {
3897
4007
  const types2 = typeof n.type === "string" ? [n.type] : Array.isArray(n.type) ? n.type : [];
3898
4008
  if (types2.length > 0) {
3899
4009
  for (const t of types2) {
@@ -3932,10 +4042,10 @@ function collectSchemaObjectPaths(node, prefix, paths, defs, depth) {
3932
4042
  }
3933
4043
  }
3934
4044
  function pushSchemaValuePaths(path, node, paths, defs, depth) {
3935
- const nodes = derefSchemaNodes(node, defs);
3936
- const typeHint = schemaTypeHint(nodes);
4045
+ const nodes2 = derefSchemaNodes(node, defs);
4046
+ const typeHint = schemaTypeHint(nodes2);
3937
4047
  paths.push(withHint({ path, kind: "data", fromSchema: true }, typeHint));
3938
- const items = nodes.map((n) => n.items).find((i) => i !== void 0 && i !== null && typeof i === "object");
4048
+ const items = nodes2.map((n) => n.items).find((i) => i !== void 0 && i !== null && typeof i === "object");
3939
4049
  const isArray2 = items !== void 0 || (typeHint?.split("|").includes("array") ?? false);
3940
4050
  if (isArray2) {
3941
4051
  const itemNodes = items !== void 0 ? derefSchemaNodes(items, defs) : [];
@@ -3952,7 +4062,7 @@ function pushSchemaValuePaths(path, node, paths, defs, depth) {
3952
4062
  }
3953
4063
  return;
3954
4064
  }
3955
- if (nodes.some((n) => n.properties !== void 0)) {
4065
+ if (nodes2.some((n) => n.properties !== void 0)) {
3956
4066
  collectSchemaObjectPaths(node, path, paths, defs, depth + 1);
3957
4067
  }
3958
4068
  }
@@ -4051,9 +4161,12 @@ function fromJson(text3) {
4051
4161
  const paths = analyzeJsonPaths(text3);
4052
4162
  return { paths, readable: paths.length > 0 || isJsonObject(text3) };
4053
4163
  }
4164
+ function scriptReadable(script, paths) {
4165
+ return !hasTopLevelSpread(script) && (paths.length > 0 || hasDefaultExportObject(script));
4166
+ }
4054
4167
  function fromScript(script) {
4055
4168
  const paths = analyzeStatePaths(script);
4056
- return { paths, readable: paths.length > 0 || isReadableStateScript(script) };
4169
+ return { paths, readable: scriptReadable(script, paths) };
4057
4170
  }
4058
4171
  function resolveElementPathsRaw(element2, html, fileReader) {
4059
4172
  let readable = false;
@@ -4076,19 +4189,23 @@ function resolveElementPathsRaw(element2, html, fileReader) {
4076
4189
  readable ||= resolved.readable;
4077
4190
  }
4078
4191
  if (element2.scriptBlocks.length > 0) {
4079
- const paths = element2.scriptBlocks.flatMap((block) => analyzeStatePaths(block.content));
4192
+ const blocks = element2.scriptBlocks.map((block) => ({ script: block.content, paths: analyzeStatePaths(block.content) }));
4080
4193
  return {
4081
- paths,
4082
- readable: paths.length > 0 || readable || element2.scriptBlocks.some((block) => isReadableStateScript(block.content))
4194
+ paths: blocks.flatMap((block) => block.paths),
4195
+ readable: readable || blocks.some((block) => scriptReadable(block.script, block.paths))
4083
4196
  };
4084
4197
  }
4085
4198
  return readable ? { paths: [], readable } : UNREADABLE;
4086
4199
  }
4087
4200
  function readStateScript(srcPath, fileReader) {
4088
- if (srcPath.endsWith(".js")) {
4089
- return fileReader(srcPath.replace(/\.js$/, ".ts")) || fileReader(srcPath) || void 0;
4201
+ return readStateScriptFile(srcPath, fileReader)?.text;
4202
+ }
4203
+ function readStateScriptFile(srcPath, fileReader) {
4204
+ const paths = srcPath.endsWith(".js") ? [srcPath.replace(/\.js$/, ".ts"), srcPath] : srcPath.endsWith(".ts") ? [srcPath] : [];
4205
+ for (const path of paths) {
4206
+ const text3 = fileReader(path);
4207
+ if (text3) return { path, text: text3 };
4090
4208
  }
4091
- if (srcPath.endsWith(".ts")) return fileReader(srcPath) || void 0;
4092
4209
  return void 0;
4093
4210
  }
4094
4211
  function resolveSrcAttribute(srcPath, fileReader) {
@@ -4121,10 +4238,6 @@ function isInsideForTemplate(html, offset2, bindAttrName = "data-wcs") {
4121
4238
  }
4122
4239
  return false;
4123
4240
  }
4124
- function getInnermostForPath(html, offset2, bindAttrName = "data-wcs") {
4125
- const chain = getEnclosingForPaths(html, offset2, bindAttrName);
4126
- return chain.length === 0 ? null : chain[chain.length - 1];
4127
- }
4128
4241
  var BINDING_SYNTAX_MARKER = `[${WcsDiagnosticCode.BindingSyntax}]`;
4129
4242
  function isForBindingRefused(bindText) {
4130
4243
  try {
@@ -4370,10 +4483,10 @@ function analyzeElementContexts(html, offsets, bindAttrName = "data-wcs", stateT
4370
4483
  }
4371
4484
  const match3 = bindAttr.exec(attrs);
4372
4485
  const value = match3 === null ? null : match3[1] ?? match3[2] ?? match3[3];
4373
- const names = value === null ? [] : propertyNamesOf(value);
4374
- const structural = name === "template" && names.length === 1 && STRUCTURAL_DIRECTIVES2.has(names[0]) && !value.slice(0, Math.max(0, indexOfOutsideQuotes2(value, ":"))).includes("#");
4486
+ const names2 = value === null ? [] : propertyNamesOf(value);
4487
+ const structural = name === "template" && names2.length === 1 && STRUCTURAL_DIRECTIVES2.has(names2[0]) && !value.slice(0, Math.max(0, indexOfOutsideQuotes2(value, ":"))).includes("#");
4375
4488
  const plainTemplate = name === "template" && !structural;
4376
- const blocks = plainTemplate && stack.some((e) => e.name === "template") || name !== "template" && names.some((n) => CONTENT_PROPERTIES.has(n));
4489
+ const blocks = plainTemplate && stack.some((e) => e.name === "template") || name !== "template" && names2.some((n) => CONTENT_PROPERTIES.has(n));
4377
4490
  const scope = plainTemplate ? { hasOwnState: false, id: extractAttribute(attrs, "id"), underRouter: stack.some((e) => e.name === ROUTER_TAG) } : null;
4378
4491
  stack.push({ name, structural, scope, blocks });
4379
4492
  }
@@ -5830,7 +5943,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
5830
5943
  }
5831
5944
  var ecmaVersion = this.options.ecmaVersion;
5832
5945
  var node = this.startNode();
5833
- var keyName = "";
5946
+ var keyName2 = "";
5834
5947
  var isGenerator = false;
5835
5948
  var isAsync = false;
5836
5949
  var kind = "method";
@@ -5843,34 +5956,34 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
5843
5956
  if (this.isClassElementNameStart() || this.type === types$1.star) {
5844
5957
  isStatic = true;
5845
5958
  } else {
5846
- keyName = "static";
5959
+ keyName2 = "static";
5847
5960
  }
5848
5961
  }
5849
5962
  node.static = isStatic;
5850
- if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
5963
+ if (!keyName2 && ecmaVersion >= 8 && this.eatContextual("async")) {
5851
5964
  if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
5852
5965
  isAsync = true;
5853
5966
  } else {
5854
- keyName = "async";
5967
+ keyName2 = "async";
5855
5968
  }
5856
5969
  }
5857
- if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
5970
+ if (!keyName2 && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
5858
5971
  isGenerator = true;
5859
5972
  }
5860
- if (!keyName && !isAsync && !isGenerator) {
5973
+ if (!keyName2 && !isAsync && !isGenerator) {
5861
5974
  var lastValue = this.value;
5862
5975
  if (this.eatContextual("get") || this.eatContextual("set")) {
5863
5976
  if (this.isClassElementNameStart()) {
5864
5977
  kind = lastValue;
5865
5978
  } else {
5866
- keyName = lastValue;
5979
+ keyName2 = lastValue;
5867
5980
  }
5868
5981
  }
5869
5982
  }
5870
- if (keyName) {
5983
+ if (keyName2) {
5871
5984
  node.computed = false;
5872
5985
  node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
5873
- node.key.name = keyName;
5986
+ node.key.name = keyName2;
5874
5987
  this.finishNode(node.key, "Identifier");
5875
5988
  } else {
5876
5989
  this.parseClassElementName(node);
@@ -6171,7 +6284,7 @@ pp$8.parseExportSpecifier = function(exports$1) {
6171
6284
  return this.finishNode(node, "ExportSpecifier");
6172
6285
  };
6173
6286
  pp$8.parseExportSpecifiers = function(exports$1) {
6174
- var nodes = [], first = true;
6287
+ var nodes2 = [], first = true;
6175
6288
  this.expect(types$1.braceL);
6176
6289
  while (!this.eat(types$1.braceR)) {
6177
6290
  if (!first) {
@@ -6182,9 +6295,9 @@ pp$8.parseExportSpecifiers = function(exports$1) {
6182
6295
  } else {
6183
6296
  first = false;
6184
6297
  }
6185
- nodes.push(this.parseExportSpecifier(exports$1));
6298
+ nodes2.push(this.parseExportSpecifier(exports$1));
6186
6299
  }
6187
- return nodes;
6300
+ return nodes2;
6188
6301
  };
6189
6302
  pp$8.parseImport = function(node) {
6190
6303
  this.next();
@@ -6229,16 +6342,16 @@ pp$8.parseImportNamespaceSpecifier = function() {
6229
6342
  return this.finishNode(node, "ImportNamespaceSpecifier");
6230
6343
  };
6231
6344
  pp$8.parseImportSpecifiers = function() {
6232
- var nodes = [], first = true;
6345
+ var nodes2 = [], first = true;
6233
6346
  if (this.type === types$1.name) {
6234
- nodes.push(this.parseImportDefaultSpecifier());
6347
+ nodes2.push(this.parseImportDefaultSpecifier());
6235
6348
  if (!this.eat(types$1.comma)) {
6236
- return nodes;
6349
+ return nodes2;
6237
6350
  }
6238
6351
  }
6239
6352
  if (this.type === types$1.star) {
6240
- nodes.push(this.parseImportNamespaceSpecifier());
6241
- return nodes;
6353
+ nodes2.push(this.parseImportNamespaceSpecifier());
6354
+ return nodes2;
6242
6355
  }
6243
6356
  this.expect(types$1.braceL);
6244
6357
  while (!this.eat(types$1.braceR)) {
@@ -6250,14 +6363,14 @@ pp$8.parseImportSpecifiers = function() {
6250
6363
  } else {
6251
6364
  first = false;
6252
6365
  }
6253
- nodes.push(this.parseImportSpecifier());
6366
+ nodes2.push(this.parseImportSpecifier());
6254
6367
  }
6255
- return nodes;
6368
+ return nodes2;
6256
6369
  };
6257
6370
  pp$8.parseWithClause = function() {
6258
- var nodes = [];
6371
+ var nodes2 = [];
6259
6372
  if (!this.eat(types$1._with)) {
6260
- return nodes;
6373
+ return nodes2;
6261
6374
  }
6262
6375
  this.expect(types$1.braceL);
6263
6376
  var attributeKeys = {};
@@ -6272,14 +6385,14 @@ pp$8.parseWithClause = function() {
6272
6385
  first = false;
6273
6386
  }
6274
6387
  var attr = this.parseImportAttribute();
6275
- var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
6276
- if (hasOwn(attributeKeys, keyName)) {
6277
- this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'");
6388
+ var keyName2 = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
6389
+ if (hasOwn(attributeKeys, keyName2)) {
6390
+ this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName2 + "'");
6278
6391
  }
6279
- attributeKeys[keyName] = true;
6280
- nodes.push(attr);
6392
+ attributeKeys[keyName2] = true;
6393
+ nodes2.push(attr);
6281
6394
  }
6282
- return nodes;
6395
+ return nodes2;
6283
6396
  };
6284
6397
  pp$8.parseImportAttribute = function() {
6285
6398
  var node = this.startNode();
@@ -10428,7 +10541,7 @@ function visitDestructure(pattern, prefix, scope, out) {
10428
10541
  emit(out, segments, { form: "destructure", callee: false, written: false }, property.start, property.end);
10429
10542
  }
10430
10543
  }
10431
- function collectThisMemberRefs(body, names) {
10544
+ function collectThisMemberRefs(body, names2) {
10432
10545
  let program;
10433
10546
  try {
10434
10547
  program = parse3(PREFIX + body + SUFFIX, { ecmaVersion: "latest", sourceType: "module" });
@@ -10437,11 +10550,11 @@ function collectThisMemberRefs(body, names) {
10437
10550
  }
10438
10551
  const fn = unwrapWrapper(program);
10439
10552
  if (fn === null) return null;
10440
- return walkThisMembers(fn.body, names, PREFIX.length);
10553
+ return walkThisMembers(fn.body, names2, PREFIX.length);
10441
10554
  }
10442
10555
  var VALUE_PREFIX = "(async function* () {\n(";
10443
10556
  var VALUE_SUFFIX = ")\n})";
10444
- function collectThisMemberRefsInValue(value, names) {
10557
+ function collectThisMemberRefsInValue(value, names2) {
10445
10558
  let program;
10446
10559
  try {
10447
10560
  program = parse3(VALUE_PREFIX + value + VALUE_SUFFIX, { ecmaVersion: "latest", sourceType: "module" });
@@ -10454,9 +10567,9 @@ function collectThisMemberRefsInValue(value, names) {
10454
10567
  if (statement.type !== "ExpressionStatement") return null;
10455
10568
  const expression = statement.expression;
10456
10569
  if (expression.type !== "FunctionExpression") return [];
10457
- return walkThisMembers(expression.body, names, VALUE_PREFIX.length);
10570
+ return walkThisMembers(expression.body, names2, VALUE_PREFIX.length);
10458
10571
  }
10459
- function walkThisMembers(root, names, offsetShift) {
10572
+ function walkThisMembers(root, names2, offsetShift) {
10460
10573
  const out = [];
10461
10574
  const walk = (node, thisIsState) => {
10462
10575
  if (isClassNode(node)) return;
@@ -10467,7 +10580,7 @@ function walkThisMembers(root, names, offsetShift) {
10467
10580
  }
10468
10581
  if (thisIsState && node.type === "MemberExpression" && node.object.type === "ThisExpression") {
10469
10582
  const hit = thisMemberName(node);
10470
- if (hit !== null && names.has(hit.name)) {
10583
+ if (hit !== null && names2.has(hit.name)) {
10471
10584
  out.push({ name: hit.name, start: hit.start - offsetShift, end: hit.end - offsetShift });
10472
10585
  }
10473
10586
  }
@@ -10634,13 +10747,13 @@ function findInPlaceChanges(text3, kind, root) {
10634
10747
  const collect2 = (node) => {
10635
10748
  if (isFunctionNode(node)) {
10636
10749
  if (node.type === "FunctionDeclaration" && node.id !== null) bind(node.id.name);
10637
- const names = /* @__PURE__ */ new Set();
10638
- for (const param of node.params) bindingNames(param, names);
10639
- names.forEach(bind);
10750
+ const names2 = /* @__PURE__ */ new Set();
10751
+ for (const param of node.params) bindingNames(param, names2);
10752
+ names2.forEach(bind);
10640
10753
  } else if (node.type === "VariableDeclarator") {
10641
- const names = /* @__PURE__ */ new Set();
10642
- bindingNames(node.id, names);
10643
- names.forEach(bind);
10754
+ const names2 = /* @__PURE__ */ new Set();
10755
+ bindingNames(node.id, names2);
10756
+ names2.forEach(bind);
10644
10757
  const init = node.init ? unwrapChain(node.init) : null;
10645
10758
  if (init !== null && node.id.type === "Identifier" && init.type === "MemberExpression") {
10646
10759
  const chain = memberChain(init, source);
@@ -10658,9 +10771,9 @@ function findInPlaceChanges(text3, kind, root) {
10658
10771
  }
10659
10772
  }
10660
10773
  } else if (node.type === "CatchClause" && node.param) {
10661
- const names = /* @__PURE__ */ new Set();
10662
- bindingNames(node.param, names);
10663
- names.forEach(bind);
10774
+ const names2 = /* @__PURE__ */ new Set();
10775
+ bindingNames(node.param, names2);
10776
+ names2.forEach(bind);
10664
10777
  } else if (node.type === "ClassDeclaration" && node.id !== null) {
10665
10778
  bind(node.id.name);
10666
10779
  } else if (node.type === "AssignmentExpression" && node.left.type === "Identifier") {
@@ -10722,14 +10835,14 @@ function findLocationRead(body) {
10722
10835
  }
10723
10836
  const wrapper = unwrapWrapper(program);
10724
10837
  if (wrapper === null) return null;
10725
- const names = /* @__PURE__ */ new Set();
10838
+ const names2 = /* @__PURE__ */ new Set();
10726
10839
  const scan = (node) => {
10727
- if (isFunctionNode(node)) for (const param of node.params) bindingNames(param, names);
10728
- if (node.type === "VariableDeclarator") bindingNames(node.id, names);
10840
+ if (isFunctionNode(node)) for (const param of node.params) bindingNames(param, names2);
10841
+ if (node.type === "VariableDeclarator") bindingNames(node.id, names2);
10729
10842
  forEachChild(node, scan);
10730
10843
  };
10731
10844
  scan(wrapper.body);
10732
- if (names.has("location")) return null;
10845
+ if (names2.has("location")) return null;
10733
10846
  const isLocation = (node) => {
10734
10847
  const n = unwrapChain(node);
10735
10848
  if (n.type === "Identifier") return n.name === "location";
@@ -10806,6 +10919,13 @@ var ja = {
10806
10919
  updatedCallbackUnbound: (p) => `$renderedCallback \u306F binding \u99C6\u52D5\u3067\u3059\u3002"${p}" \u306F\u3053\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u3069\u306E\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u306B\u3082\u73FE\u308C\u306A\u3044\u305F\u3081\u3001\u3053\u306E\u5206\u5C90\u306F\u4E00\u5EA6\u3082\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3002\u63CF\u753B\u306B\u4F9D\u5B58\u305B\u305A\u53CD\u5FDC\u3059\u308B\u306A\u3089 $watch \u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044`,
10807
10920
  onHandlerThis: (name) => `$on \u306E\u30CF\u30F3\u30C9\u30E9 "${name}" \u304C this \u3092\u4F7F\u3063\u3066\u3044\u307E\u3059\u3002$on \u306E\u30CF\u30F3\u30C9\u30E9\u306F state \u3092\u7B2C 1 \u5F15\u6570\u3067\u53D7\u3051\u53D6\u308A\uFF08\`${name}(state, event) { state.x = \u2026 }\`\uFF09\u3001this \u306F undefined \u306A\u306E\u3067\u3001this.\u2026 \u306F\u547C\u3070\u308C\u305F\u3068\u304D\u306B\u4F8B\u5916\u306B\u306A\u308A\u307E\u3059\u3002$watch \u3084\u30E1\u30BD\u30C3\u30C9\u3068\u9055\u3046\u70B9\u306B\u6CE8\u610F`,
10808
10921
  getterReadsLocation: (read) => `\u3053\u306E getter \u306F ${read} \u3092\u8AAD\u3093\u3067\u3044\u307E\u3059\u304C\u3001location \u306F state \u3067\u306F\u306A\u3044\u306E\u3067\u3001\u6700\u521D\u306B\u8AAD\u3093\u3060 URL \u3092\u6301\u3061\u7D9A\u3051\u307E\u3059\uFF08\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3067\u518D\u8A55\u4FA1\u3055\u308C\u307E\u305B\u3093\uFF09\u3002URL \u306F state \u3092\u901A\u3057\u3066\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044 \u2014 <wcs-router> \u306E path / searchParams \u3092\u675F\u306D\u308B`,
10922
+ getterReadsClock: (read) => `\u3053\u306E getter \u306F ${read} \u3092\u8AAD\u3093\u3067\u3044\u307E\u3059\u304C\u3001\u6642\u523B\u306F state \u3067\u306F\u306A\u3044\u306E\u3067\u4F9D\u5B58\u3068\u3057\u3066\u767B\u9332\u3055\u308C\u305A\u3001getter \u306F\u30AD\u30E3\u30C3\u30B7\u30E5\u3057\u305F\u6700\u521D\u306E\u5024\u3092\u8FD4\u3057\u7D9A\u3051\u307E\u3059\uFF08\u30A4\u30D9\u30F3\u30C8\u30C8\u30FC\u30AF\u30F3\u3067\u6BCE\u30D5\u30EC\u30FC\u30E0\u300C\u63CF\u304D\u76F4\u3057\u300D\u3066\u3082\u5909\u308F\u308A\u307E\u305B\u3093\uFF09\u3002\u6642\u523B\u3092 state \u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044 \u2014 <wcs-raf> \u3084 <wcs-timer> \u304C\u66F8\u304F\u5024\u3092\u675F\u306D\u308B`,
10923
+ updatedCallbackUnknownPath: (p) => `"${p}" \u306F state \u306E\u30D1\u30B9\u3067\u306F\u306A\u3044\u306E\u3067 $renderedCallback \u306E paths \u306B\u73FE\u308C\u305A\u3001\u3053\u306E\u5206\u5C90\u306F\u4E00\u5EA6\u3082\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093`,
10924
+ commandTokenUnbound: (t) => `\u30B3\u30DE\u30F3\u30C9\u30C8\u30FC\u30AF\u30F3 "${t}" \u3092 emit \u3057\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u305D\u308C\u3092\u53D7\u3051\u308B command.<\u30E1\u30BD\u30C3\u30C9>: ${t} \u306E\u675F\u7E1B\u304C\u3042\u308A\u307E\u305B\u3093\u3002emit \u306F\u8AB0\u306B\u3082\u5C4A\u304D\u307E\u305B\u3093\u3002\u30E1\u30BD\u30C3\u30C9\u3092\u547C\u3076\u8981\u7D20\u306B\u675F\u306D\u3066\u304F\u3060\u3055\u3044\uFF08command.focus: ${t}\uFF09`,
10925
+ writePathMissing: (k) => `"${k}" \u306F state \u304C\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044\u30AD\u30FC\u3067\u3059\u3002\u66F8\u304D\u8FBC\u307F\u306F\u65B0\u3057\u3044\u30AD\u30FC\u3092\u4F5C\u308B\u3060\u3051\u3067\u3001\u5BA3\u8A00\u3057\u305F\u30AD\u30FC\u306E\u675F\u7E1B\u306B\u306F\u5C4A\u304D\u307E\u305B\u3093`,
10926
+ readPathMissing: (p, top) => top ? `"${p}" \u306F state \u304C\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044\u30AD\u30FC\u3067\u3059\u3002\u8AAD\u3093\u3060\u6642\u70B9\u3067\u4F8B\u5916\u306B\u306A\u308A\u307E\u3059\uFF08#301\uFF09` : `\u30D1\u30B9 "${p}" \u306F\u72B6\u614B\u5B9A\u7FA9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\u3002\u8AAD\u307F\u306F undefined \u306B\u306A\u308A\u3001\u305D\u3053\u304B\u3089\u8A08\u7B97\u3057\u305F\u5024\u306F\u9ED9\u3063\u3066\u9055\u3044\u307E\u3059`,
10927
+ pathDynamicUnknownSpread: (sp) => `${sp} \u304C\u6301\u3061\u8FBC\u3080\u30AD\u30FC\u306F\u9759\u7684\u306B\u8AAD\u3081\u306A\u3044\u306E\u3067\u3001\u3053\u306E state \u306E\u30D1\u30B9\u306F\u691C\u67FB\u3057\u3066\u3044\u307E\u305B\u3093\uFF08\u675F\u7E1B\u30FBgetter \u306E\u4E2D\u306E\u8AAD\u307F\u30FB$watch \u306E\u30AD\u30FC\uFF09\u3002\u30AD\u30FC\u3092 wcstack.manifest.json \u306E stateSchema \u306B\u5BA3\u8A00\u3059\u308B\u3068\u691C\u67FB\u3055\u308C\u307E\u3059\u3002npx wcs-schema\uFF08@wcstack/typescript\uFF09\u304C state \u306E\u578B\uFF08JSDoc\u30FBTypeScript\uFF09\u304B\u3089\u4F5C\u308C\u307E\u3059`,
10928
+ pathReadonlyTwoWay: (p, prop) => `"${p}" \u306F setter \u306E\u7121\u3044 getter \u3067\u3059\u304C\u3001${prop}: \u306F\u8AAD\u8005\u306E\u5165\u529B\u3092\u66F8\u304D\u623B\u3059\u306E\u3067\u3001\u5165\u529B\u306E\u305F\u3073\u306B\u66F8\u304D\u8FBC\u307F\u304C\u5931\u6557\u3057\u307E\u3059\uFF08"${p}" is a getter without a setter\uFF09\u3002setter \u3092\u8DB3\u3059\uFF08set "${p}"(v) { \u2026 }\uFF09\u304B\u3001#ro \u3067\u4E00\u65B9\u5411\u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${prop}#ro: ${p}\uFF09`,
10809
10929
  submitWithoutPrevent: (h) => `onsubmit \u306B #prevent \u304C\u7121\u304F\u3001"${h}" \u3082 preventDefault \u3092\u547C\u3073\u307E\u305B\u3093\u3002\u30D6\u30E9\u30A6\u30B6\u306F\u30D5\u30A9\u30FC\u30E0\u3082\u9001\u308B\u306E\u3067\u3001\u30DA\u30FC\u30B8\u304C\u8AAD\u307F\u76F4\u3055\u308C\u308B\u304B\u3001router \u304C\u3042\u308C\u3070 GET \u304C\u6B04\u306E\u5024\uFF08\u30D1\u30B9\u30EF\u30FC\u30C9\u3082\uFF09\u3092 URL \u3068\u5C65\u6B74\u306B\u8F09\u305B\u307E\u3059\u3002onsubmit#prevent: ${h} \u3068\u66F8\u304F\u304B\u3001\u30CF\u30F3\u30C9\u30E9\u3067 event.preventDefault() \u3092\u547C\u3093\u3067\u304F\u3060\u3055\u3044`,
10810
10930
  getterUntrackedRead: (root, sp) => `\u3053\u3053\u3067\u8FFD\u8DE1\u3055\u308C\u308B\u306E\u306F "${root}" \u3060\u3051\u3067\u3059\u3002"${sp}" \u304C\u5909\u308F\u3063\u3066\u3082\u3053\u306E getter \u306F\u518D\u8A55\u4FA1\u3055\u308C\u307E\u305B\u3093\uFF08\u30D1\u30B9\u8AAD\u307F\u53D6\u308A\u306E\u5148\u306E\u7D20\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u30A2\u30AF\u30BB\u30B9\u306F\u8FFD\u8DE1\u3055\u308C\u306A\u3044\uFF09\u3002this["${sp}"] \u3067\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044`,
10811
10931
  handlerFilterNotAllowed: (prop) => `\u30A4\u30D9\u30F3\u30C8\u30CF\u30F3\u30C9\u30E9 "${prop}" \u306B\u30D5\u30A3\u30EB\u30BF\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093`,
@@ -10826,15 +10946,15 @@ var ja = {
10826
10946
  watchKeyEmptySegment: (k) => `$watch \u306E\u30AD\u30FC "${k}" \u306B\u7A7A\u306E\u30D1\u30B9\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u3059`,
10827
10947
  watchHandlerNotFunction: (k) => `$watch \u306E\u30A8\u30F3\u30C8\u30EA "${k}" \u306E\u5024\u306F\u95A2\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`,
10828
10948
  watchPathMissing: (k) => `$watch \u306E\u30AD\u30FC "${k}" \u306F\u72B6\u614B\u5B9A\u7FA9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\uFF08\u4E00\u5EA6\u3082\u767A\u706B\u3057\u307E\u305B\u3093\uFF09`,
10829
- scanRemoved: (mountPath) => mountPath === null ? `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09\u3002\u30D1\u30B9\u306E\u5909\u5316\u3092\u7573\u3080\u306A\u3089 $watch\u3001\u30A4\u30D9\u30F3\u30C8\u3092\u7573\u3080\u306A\u3089 $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u3001\u51FA\u529B\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3078\u66F8\u3044\u3066\u304F\u3060\u3055\u3044` : `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\u3002\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002root \u306E state \u306E $watch \u304B $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u7573\u3093\u3067\u304F\u3060\u3055\u3044`,
10949
+ scanRemoved: (mountPath) => mountPath === null ? `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08diagnostics \u306E\u5F8C\u4ED8\u3051\u3092\u5165\u308C\u305F\u5165\u53E3 \u2014 /auto \u306A\u3069 \u2014 \u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u3001/core \u3060\u3051\u3067\u306F\u9ED9\u3063\u3066\u7121\u8996\u3057\u307E\u3059\uFF09\u3002\u30D1\u30B9\u306E\u5909\u5316\u3092\u7573\u3080\u306A\u3089 $watch\u3001\u30A4\u30D9\u30F3\u30C8\u3092\u7573\u3080\u306A\u3089 $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u3001\u51FA\u529B\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3078\u66F8\u3044\u3066\u304F\u3060\u3055\u3044` : `$scan \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\u3002\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002root \u306E state \u306E $watch \u304B $on \u306E\u30CF\u30F3\u30C9\u30E9\u3067\u7573\u3093\u3067\u304F\u3060\u3055\u3044`,
10830
10950
  typeAnnotationIncompatible: (vt, rt) => `\u578B "${vt}" \u306F @type {${rt}} \u3068\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093`,
10831
10951
  arrayMutation: (m, alt) => `\u914D\u5217\u306E\u7834\u58CA\u7684\u30E1\u30BD\u30C3\u30C9 "${m}" \u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\uFF08\u540C\u4E00\u53C2\u7167\u306E\u81EA\u5DF1\u518D\u4EE3\u5165\u3067\u3082\u8981\u7D20\u306E\u8FFD\u52A0\u30FB\u524A\u9664\u306F\u53CD\u6620\u3055\u308C\u307E\u305B\u3093\uFF09\u3002\u975E\u7834\u58CA\u30E1\u30BD\u30C3\u30C9\u3068\u518D\u4EE3\u5165\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: ${alt}\uFF09\u3002`,
10832
10952
  arrayIndexAssign: (sp) => `\u914D\u5217\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3078\u306E\u76F4\u63A5\u4EE3\u5165\u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\u3002this["${sp}"] \u306E\u3088\u3046\u306A\u30C9\u30C3\u30C8\u30D1\u30B9\u4EE3\u5165\u3001\u307E\u305F\u306F with() \u3068\u518D\u4EE3\u5165\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
10833
10953
  inPlaceAlias: (a, src, t) => `"${a}" \u306F ${src}\uFF08state \u306E\u5024\u305D\u306E\u3082\u306E\uFF09\u3067\u3059\u3002\u305D\u308C\u3092\u901A\u3057\u305F\u5909\u66F4\u306F\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u305B\u305A\u3001\u540C\u3058\u5024\u3092\u66F8\u304D\u623B\u3057\u3066\u3082\u4E00\u89A7\u306E\u884C\u306F\u8FFD\u52A0\u30FB\u524A\u9664\u30FB\u7F6E\u304D\u63DB\u3048\u3055\u308C\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u5024\u3092\u4F5C\u3063\u3066 ${t} \u306B\u4EE3\u5165\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${a}.with(i, item) / [...${a}, item] / { ...${a}, key: value }\uFF09`,
10834
10954
  inPlaceChange: (src, t) => `${src} \u306F state \u306E\u5024\u3092\u305D\u306E\u5834\u3067\u5909\u3048\u308B\u306E\u3067\u3001\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u66F4\u65B0\u3092\u30C8\u30EA\u30AC\u30FC\u3057\u307E\u305B\u3093\u3002\u65B0\u3057\u3044\u5024\u3092\u4F5C\u3063\u3066 ${t} \u306B\u4EE3\u5165\u3057\u3066\u304F\u3060\u3055\u3044`,
10835
- tagMemberUnknown: (prop, tag) => `"${prop}" \u306F <${tag}> \u306E wcBindable \u30E1\u30F3\u30D0\u30FC\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u672A\u77E5\u30E1\u30F3\u30D0\u30FC\u3078\u306E\u30D0\u30A4\u30F3\u30C9\u306F\u9ED9\u3063\u3066\u7121\u8996\u3055\u308C\u307E\u3059\uFF09`,
10955
+ tagMemberUnknown: (prop, tag) => `"${prop}" \u306F <${tag}> \u306E wcBindable \u30E1\u30F3\u30D0\u30FC\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u5BA3\u8A00\u306B\u7121\u3044\u30E1\u30F3\u30D0\u30FC\u3078\u306E\u675F\u7E1B\u3092 #38 \u3067\u62D2\u307F\u3001root \u3067\u306F state \u304C\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3059\uFF09`,
10836
10956
  nameAlias: (written, canonical) => `"${written}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\u3067\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u3093\u3060\u6642\u70B9\u3067 throw \u3057\u307E\u3059\uFF09\u3002"${canonical}" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
10837
- declarationAliasRead: (alias, canonical) => `"${alias}" \u306F 4.0 \u3067\u5916\u308C\u305F\u5BA3\u8A00\u30AD\u30FC\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u306A\u306E\u3067\u3001this["${alias}"] \u306F undefined \u306B\u306A\u308A\u307E\u3059\u3002"${canonical}" \u3092\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044`,
10957
+ declarationAliasRead: (alias, canonical) => `"${alias}" \u306F 4.0 \u3067\u5916\u308C\u305F\u5BA3\u8A00\u30AD\u30FC\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u306A\u306E\u3067\u3001this["${alias}"] \u306F undefined \u306B\u306A\u308A\u307E\u3059\u3002\u5BA3\u8A00\u306F this \u3092\u901A\u3057\u3066\u8AAD\u3081\u307E\u305B\u3093 \u2014 "${canonical}" \u3092\u8AAD\u3093\u3067\u3082 undefined \u3067\u3059${canonical === "$stream" ? "\uFF08\u30B9\u30C8\u30EA\u30FC\u30E0\u306E\u72B6\u614B\u306F $streamStatus\u30FB$streamError \u3067\u8AAD\u307F\u307E\u3059\uFF09" : ""}`,
10838
10958
  declarationAlias: (alias, canonical) => `\u5BA3\u8A00\u30AD\u30FC "${alias}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\u3067\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09\u3002"${canonical}" \u3068\u66F8\u3044\u3066\u304F\u3060\u3055\u3044`,
10839
10959
  declarationAliasInVolume: (alias, canonical, mountPath) => `\u5BA3\u8A00\u30AD\u30FC "${alias}" \u306F 4.0 \u3067\u5916\u308C\u307E\u3057\u305F\uFF08"${canonical}" \u306E 3.x \u306E\u65E7\u540D\uFF09\u3002\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002"${canonical}" \u3082\u30DC\u30EA\u30E5\u30FC\u30E0\u3067\u306F\u5BA3\u8A00\u3067\u304D\u306A\u3044\u306E\u3067\u3001root \u306E state \u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044`,
10840
10960
  behaviorNotObject: (keys) => `$behavior \u306F { ${keys.map((k) => `${k}?`).join(", ")} } \u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09`,
@@ -10842,7 +10962,7 @@ var ja = {
10842
10962
  behaviorValueType: (key, type) => `$behavior \u306E "${key}" \u306F ${type === "boolean" ? "true \u304B false" : type} \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09`,
10843
10963
  configInVolume: (key, mountPath) => `${key} \u306F\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u307F\u3001console.error \u3067\u5831\u544A\u3057\u307E\u3059 \u2014 \u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002root \u306E state \u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044 \u2014 \u30DC\u30EA\u30E5\u30FC\u30E0\u306F root \u306E\u30A8\u30F3\u30B8\u30F3\u306B\u63A5\u304E\u6728\u3055\u308C\u307E\u3059`,
10844
10964
  featuresNotArray: () => `$features \u306F\u5F8C\u4ED8\u3051\u306E\u540D\u524D\u306E\u914D\u5217\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08\u4F8B: ["temporal", "formats"]\u3002\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B throw \u3057\u307E\u3059\uFF09`,
10845
- featureUnknown: (name, names, suggestion2) => `"${name}" \u306F\u5F8C\u4ED8\u3051\u306E\u540D\u524D\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08${names.join("\u30FB")}\uFF09${suggestion2}`,
10965
+ featureUnknown: (name, names2, suggestion2) => `"${name}" \u306F\u5F8C\u4ED8\u3051\u306E\u540D\u524D\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08${names2.join("\u30FB")}\uFF09${suggestion2}`,
10846
10966
  volumeDeclarationRejected: (key, mountPath) => `${key} \u306F\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3002\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u63A5\u304E\u6728\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF08\u3053\u306E state \u306F\u6728\u306B\u8F09\u308A\u307E\u305B\u3093\uFF09\u3002root \u306E state \u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044`,
10847
10967
  volumeDeclarationNotRun: (key, mountPath) => `${key} \u306F\u30DC\u30EA\u30E5\u30FC\u30E0\uFF08mount="${mountPath}"\uFF09\u3067\u306F\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F console.warn \u3067\u77E5\u3089\u305B\u3001\u3053\u306E\u5BA3\u8A00\u3092\u7121\u8996\u3057\u307E\u3059 \u2014 root \u306E state \u306E\u3082\u306E\u3067\u3059\uFF09\u3002root \u306E state \u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044`,
10848
10968
  secondRoot: () => '\u540C\u3058 root \u306B 2 \u3064\u76EE\u306E <wcs-state> \u304C\u3042\u308A\u307E\u3059\u3002state \u306E\u6728\u306F root \u3054\u3068\u306B 1 \u3064\u3067\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u5F8C\u304B\u3089\u8AAD\u307F\u8FBC\u3093\u3060\u65B9\u3092\u62D2\u3093\u3067 console.error \u3067\u5831\u544A\u3057\u307E\u3059\uFF09\u3002\u90E8\u5206\u6728\u306F <wcs-state mount="path"> \u3067\u63A5\u304E\u6728\u3057\u3066\u304F\u3060\u3055\u3044',
@@ -10864,7 +10984,7 @@ var ja = {
10864
10984
  storagePairClobber: (path) => `<wcs-storage> \u306E value \u3092 #init=element \u306A\u3057\u3067\u30A2\u30AF\u30BB\u30B5\u30DA\u30A2 "${path}" \u306B\u675F\u306D\u3066\u3044\u307E\u3059\u3002state \u306E\u5074\u304C\u5148\u306B\u66F8\u304F\u306E\u3067\u3001\u8AAD\u307F\u8FBC\u307F\u306E\u305F\u3073\u306B getter \u306E\u6700\u521D\u306E\u5024\u304C\u4FDD\u5B58\u5024\u306E\u4E0A\u306B\u4FDD\u5B58\u3055\u308C\u3001setter \u306F\u4FDD\u5B58\u5024\u3092\u53D7\u3051\u53D6\u308C\u307E\u305B\u3093 \u2014 #init=element \u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08\`value#init=element: ${path}\`\uFF09`,
10865
10985
  inputNestedWrite: (tag, input, path, example) => `<${tag}> \u306E\u5165\u529B "${input}" \u306B "${path}" \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u304C\u3001\u30DA\u30FC\u30B8\u306F\u305D\u306E\u4E0B\uFF08"${example}"\uFF09\u3078\u66F8\u304D\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002\u675F\u7E1B\u306F "${path}" \u81EA\u8EAB\u3078\u306E\u4EE3\u5165\u3067\u3057\u304B\u5F53\u3066\u76F4\u3055\u308C\u306A\u3044\u306E\u3067\u3001\u4E0B\u3078\u306E\u66F8\u304D\u8FBC\u307F\u306F <${tag}> \u306B\u5C4A\u304D\u307E\u305B\u3093 \u2014 \u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30D1\u30B9\u3067\u8AAD\u3093\u3067\u65B0\u3057\u3044\u5024\u3092\u8FD4\u3059 getter\uFF08\`this["${example}"]\`\u30FB\`$getAll\`\uFF09\u3092\u675F\u306D\u308B\u304B\u3001\u4E0B\u3078\u66F8\u304B\u305A\u306B "${path}" \u3092\u5DEE\u3057\u66FF\u3048\u3066\u304F\u3060\u3055\u3044`,
10866
10986
  inputNestedWriteOneShot: (tag, input, path, example) => `<${tag}> \u306E\u5165\u529B "${input}" \u306B "${path}" \u3092\u675F\u306D\u3066\u3044\u307E\u3059\u304C\u3001\u30DA\u30FC\u30B8\u306F\u305D\u306E\u4E0B\uFF08"${example}"\uFF09\u3078\u66F8\u304D\u8FBC\u3093\u3067\u3044\u307E\u3059\u3002\u675F\u7E1B\u306F "${path}" \u81EA\u8EAB\u3078\u306E\u4EE3\u5165\u3067\u3057\u304B\u5F53\u3066\u76F4\u3055\u308C\u305A\u3001<${tag}> \u306F\u8981\u6C42\u306E\u305F\u3073\u306B "${input}" \u3092 null \u306B\u623B\u3059\u306E\u3067\u3001\u6B21\u306E\u8981\u6C42\u306F "${input}" \u306A\u3057\u3067\u9001\u3089\u308C\u307E\u3059 \u2014 \u8981\u6C42\u3092\u59CB\u3081\u308B\u30CF\u30F3\u30C9\u30E9\u3067\u65B0\u3057\u3044\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u4F5C\u3063\u3066\u4EE3\u5165\u3057\uFF08\`this.submitBody = { \u2026 }\`\uFF09\u3001\u305D\u308C\u3092\u675F\u306D\u3066\u304F\u3060\u3055\u3044`,
10867
- devtoolsAfterState: () => `@wcstack/devtools/auto \u306F @wcstack/state/auto \u3088\u308A\u5148\u306B\u8AAD\u307F\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u5F8C\u3060\u3068\u914D\u7DDA\u53F0\u5E33\u304C\u30E9\u30A4\u30D6\u3067 captured \u3055\u308C\u307E\u305B\u3093\uFF09`,
10987
+ devtoolsAfterState: () => `@wcstack/devtools/auto \u306F @wcstack/state/auto \u3088\u308A\u5148\u306B\u8AAD\u307F\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u5F8C\u304B\u3089\u3060\u3068\u3001DevTools \u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u306F\u4ED8\u3044\u305F\u6642\u70B9\u304B\u3089\u59CB\u307E\u308A\u307E\u3059\u3002\u65E2\u306B\u3042\u308B\u914D\u7DDA\u306F 4.0 \u304C\u9001\u308A\u76F4\u3057\u307E\u3059\uFF09`,
10868
10988
  baseHrefMissing: () => `@wcstack/router \u3092\u4F7F\u3046 SPA \u306B\u306F <head> \u5185\u306E <base href="/"> \u304C\u5FC5\u8981\u3067\u3059\uFF08\u7121\u3044\u3068\u30C7\u30A3\u30FC\u30D7\u30EA\u30F3\u30AF\u3067 basename \u304C\u8AA4\u5C0E\u51FA\u3055\u308C\u307E\u3059\uFF09`,
10869
10989
  routerOutletMisplaced: () => `\u3053\u306E <wcs-outlet> \u306F <wcs-router> \u306E\u76F4\u5F8C\u306B\u7121\u3044\u306E\u3067\u3001\u3069\u306E router \u3082\u4F7F\u3044\u307E\u305B\u3093\u3002router \u306F\u81EA\u5206\u306E\u76F4\u5F8C\u306E\u8981\u7D20\u3060\u3051\u3092 outlet \u3068\u3057\u3066\u4F7F\u3044\u3001\u305D\u3053\u306B <wcs-outlet> \u304C\u7121\u3051\u308C\u3070\u81EA\u524D\u306E outlet \u3092\u4F5C\u308A\u307E\u3059\u3002\u30EB\u30FC\u30C8\u306F router \u306E\u76F4\u5F8C\u306B\u63CF\u304B\u308C\u3001\u3053\u306E outlet \u306F\u7A7A\u306E\u307E\u307E\u3067\u3059 \u2014 <wcs-router> \u306E\u76F4\u5F8C\u3078\u79FB\u3057\u3066\u304F\u3060\u3055\u3044`,
10870
10990
  signalsDualEntry: () => `@wcstack/signals \u3068 @wcstack/signals/dom \u304C\u540C\u4E00\u30DA\u30FC\u30B8\u304B\u3089 import \u3055\u308C\u3066\u3044\u307E\u3059\u3002CDN \u3067\u306F\u5404\u30A8\u30F3\u30C8\u30EA\u304C\u81EA\u5DF1\u5B8C\u7D50\u30D0\u30F3\u30C9\u30EB\u306E\u305F\u3081\u30EA\u30A2\u30AF\u30C6\u30A3\u30D6\u30B3\u30A2\u304C\u4E8C\u91CD\u5316\u3057\u3001\u5883\u754C\u3067\u53CD\u5FDC\u304C\u58CA\u308C\u307E\u3059 \u2014 \u3059\u3079\u3066 /dom \u30A8\u30F3\u30C8\u30EA\u304B\u3089 import \u3057\u3066\u304F\u3060\u3055\u3044`,
@@ -10876,13 +10996,15 @@ var ja = {
10876
10996
  mountPathInvalid: (problem, mountPath) => {
10877
10997
  switch (problem) {
10878
10998
  case "empty":
10879
- return `"mount" \u306B\u306F\u7A7A\u3067\u306A\u3044\u30C4\u30EA\u30FC\u30D1\u30B9\u304C\u5FC5\u8981\u3067\u3059\uFF08runtime: "mount" requires a non-empty tree path.\uFF09`;
10999
+ return `"mount" \u306B\u306F\u7A7A\u3067\u306A\u3044\u9759\u7684\u306A\u30D1\u30B9\u304C\u5FC5\u8981\u3067\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
10880
11000
  case "emptySegment":
10881
- return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u3059\uFF08runtime: has an empty segment.\uFF09`;
11001
+ return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u306E\u6BB5\u304C\u3042\u308A\u307E\u3059\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
10882
11002
  case "wildcard":
10883
- return `"mount" \u30D1\u30B9 "${mountPath}" \u306F\u9759\u7684\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093 \u2014 \u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08runtime: must be static.\uFF09`;
11003
+ return `"mount" \u30D1\u30B9 "${mountPath}" \u306F\u9759\u7684\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093 \u2014 "*" \u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
11004
+ case "whitespace":
11005
+ return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u7A7A\u767D\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
10884
11006
  default:
10885
- return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u4E88\u7D04\u6587\u5B57\uFF08$, #, @\uFF09\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08runtime: must not use reserved characters.\uFF09`;
11007
+ return `"mount" \u30D1\u30B9 "${mountPath}" \u306B\u4E88\u7D04\u6587\u5B57\uFF08$, #, @\uFF09\u306F\u4F7F\u3048\u307E\u305B\u3093\uFF08\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u62D2\u307F\u307E\u3059: has an invalid mount path\uFF09`;
10886
11008
  }
10887
11009
  },
10888
11010
  recursionUnsupported: (p, where) => {
@@ -10904,7 +11026,7 @@ var ja = {
10904
11026
  case "listKeys":
10905
11027
  return `$listKeys \u306E\u30AD\u30FC "${p}" \u306B "**" \u306F\u4F7F\u3048\u307E\u305B\u3093\u3002\u30AD\u30FC\u4ED8\u304D\u30EA\u30B9\u30C8\u306F 1 \u672C\u306E\u5177\u4F53\u30EA\u30B9\u30C8\u30D1\u30B9\u3067\u3059 \u2014 \u6DF1\u3055\u3054\u3068\u306B\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: "nodes.*.children"\uFF09`;
10906
11028
  default:
10907
- return `"${p}" \u306F "**" \u3092\u542B\u307F\u307E\u3059\u304C\u3001\u3053\u306E state \u306B\u306F $recursion \u5BA3\u8A00\u304C\u3042\u308A\u307E\u305B\u3093\u3002$recursion = { "<anchor>": "<repeat>" }\uFF08\u4F8B: { "nodes.*": "children.*" }\uFF09\u3092\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u304C\u7121\u3044\u3068 "**" \u306E\u30AD\u30FC\u306F\u9ED9\u3063\u3066\u7121\u8996\u3055\u308C\u307E\u3059\uFF09`;
11029
+ return `"${p}" \u306F "**" \u3092\u542B\u307F\u307E\u3059\u304C\u3001\u3053\u306E state \u306B\u306F $recursion \u5BA3\u8A00\u304C\u3042\u308A\u307E\u305B\u3093\u3002$recursion = { "<anchor>": "<repeat>" }\uFF08\u4F8B: { "nodes.*": "children.*" }\uFF09\u3092\u5BA3\u8A00\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u304C\u7121\u3044\u3068\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u8AAD\u307F\u8FBC\u307F\u6642\u306B #1101 \u3067 throw \u3057\u3001state \u306F\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3059\uFF09`;
10908
11030
  }
10909
11031
  },
10910
11032
  recursionAnchorMismatch: (p, anchor) => `"${p}" \u306F\u5BA3\u8A00\u6E08\u307F\u306E\u518D\u5E30\u30A2\u30F3\u30AB\u30FC "${anchor}" \u3068\u5408\u81F4\u3057\u307E\u305B\u3093\uFF08\u521D\u7248\u306F state \u3054\u3068\u306B 1 \u3064\u306E\u81EA\u5DF1\u518D\u5E30\u306E\u307F\u3002"**" \u306E\u5F8C\u308D\u306F\u6574\u5F62\u3055\u308C\u305F\u63A5\u5C3E\u8F9E \u2014 2 \u3064\u76EE\u306E "**"\u30FB\u7A7A\u30BB\u30B0\u30E1\u30F3\u30C8\u30FB"**" \u76F4\u5F8C\u306E\u7D20\u306E "*" \u306F\u7F6E\u3051\u307E\u305B\u3093\uFF09`,
@@ -11005,6 +11127,13 @@ var en = {
11005
11127
  updatedCallbackUnbound: (p) => `$renderedCallback is binding-driven. "${p}" is not bound anywhere in this document, so this branch never runs. Use $watch to react without depending on what is rendered`,
11006
11128
  onHandlerThis: (name) => `The $on handler "${name}" uses this. A $on handler receives the state as its first argument (\`${name}(state, event) { state.x = \u2026 }\`) and this is undefined, so this.\u2026 throws when it is called \u2014 unlike $watch handlers and methods`,
11007
11129
  getterReadsLocation: (read) => `This getter reads ${read}, which is not state: it keeps the URL it first read (a navigation does not re-evaluate it). Read the URL through state \u2014 bind <wcs-router>'s path / searchParams`,
11130
+ getterReadsClock: (read) => `This getter reads ${read}. The time is not state, so it is not a dependency: the getter is cached and keeps returning its first value (an event token "redrawing" every frame does not change it). Keep the time in state \u2014 bind the value <wcs-raf> or <wcs-timer> writes`,
11131
+ updatedCallbackUnknownPath: (p) => `"${p}" is not a path of this state, so it is never in $renderedCallback's paths and this branch never runs`,
11132
+ commandTokenUnbound: (t) => `The command token "${t}" is emitted, but no command.<method>: ${t} binding in this document receives it, so the emit reaches nothing. Bind it on the element whose method it should call (command.focus: ${t})`,
11133
+ writePathMissing: (k) => `"${k}" is not a key the state declares. The write creates a new key and reaches no binding of a declared one`,
11134
+ readPathMissing: (p, top) => top ? `"${p}" is not a key the state declares. Reading it throws (#301)` : `Path "${p}" does not exist in the state definition. The read gives undefined, and what is computed from it is wrong without a word`,
11135
+ pathDynamicUnknownSpread: (sp) => `The keys ${sp} brings in cannot be read statically, so this state's paths are not checked (bindings, reads in getters, $watch keys). Declare the keys in the stateSchema of wcstack.manifest.json to have them checked; npx wcs-schema (@wcstack/typescript) derives it from the state's types (JSDoc or TypeScript)`,
11136
+ pathReadonlyTwoWay: (p, prop) => `"${p}" is a getter without a setter, and ${prop}: writes back what the reader enters, so every edit fails ("${p}" is a getter without a setter). Add a setter (set "${p}"(v) { \u2026 }), or bind it one way with #ro (${prop}#ro: ${p})`,
11008
11137
  submitWithoutPrevent: (h) => `onsubmit has no #prevent and "${h}" does not call preventDefault, so the browser submits the form too: the page reloads, or with the router a GET puts the fields (a password too) in the URL and the history. Write onsubmit#prevent: ${h}, or call event.preventDefault() in the handler`,
11009
11138
  getterUntrackedRead: (root, sp) => `Only "${root}" is tracked here: the getter is not re-evaluated when "${sp}" changes (plain property access after a path read is not tracked). Read this["${sp}"] instead`,
11010
11139
  handlerFilterNotAllowed: (prop) => `Filters cannot be applied to event handler "${prop}"`,
@@ -11025,15 +11154,15 @@ var en = {
11025
11154
  watchKeyEmptySegment: (k) => `$watch key "${k}" has an empty path segment`,
11026
11155
  watchHandlerNotFunction: (k) => `The value of $watch entry "${k}" must be a function`,
11027
11156
  watchPathMissing: (k) => `$watch key "${k}" does not exist in the state definition (it will never fire)`,
11028
- scanRemoved: (mountPath) => mountPath === null ? `$scan was removed in 4.0 (the runtime throws at load time). Fold a path's changes in a $watch handler, or events in an $on handler, and write the output property there` : `$scan was removed in 4.0. In a volume (mount="${mountPath}") the runtime refuses to graft it and reports that with console.error (this state is not on the tree). Fold in a $watch or $on handler on the root state`,
11157
+ scanRemoved: (mountPath) => mountPath === null ? `$scan was removed in 4.0 (the entries with the diagnostics add-on, such as /auto, throw at load; /core alone ignores it). Fold a path's changes in a $watch handler, or events in an $on handler, and write the output property there` : `$scan was removed in 4.0. In a volume (mount="${mountPath}") the runtime refuses to graft it and reports that with console.error (this state is not on the tree). Fold in a $watch or $on handler on the root state`,
11029
11158
  typeAnnotationIncompatible: (vt, rt) => `Type "${vt}" is not compatible with @type {${rt}}`,
11030
11159
  arrayMutation: (m, alt) => `Destructive array method "${m}" does not trigger a reactive update (re-assigning the same reference does not reflect added/removed elements either). Use a non-destructive method with reassignment (e.g. ${alt}).`,
11031
11160
  arrayIndexAssign: (sp) => `Assigning directly to an array index does not trigger a reactive update. Use a dot-path assignment like this["${sp}"], or with() plus reassignment.`,
11032
11161
  inPlaceAlias: (a, src, t) => `"${a}" is ${src} \u2014 the state's own value. A change through it does not trigger a reactive update, and writing the same value back does not add, remove or replace a list's rows. Build a new value and assign it to ${t} (${a}.with(i, item), [...${a}, item], { ...${a}, key: value })`,
11033
11162
  inPlaceChange: (src, t) => `${src} changes the state's value in place, which does not trigger a reactive update. Build a new value and assign it to ${t}`,
11034
- tagMemberUnknown: (prop, tag) => `"${prop}" is not a wcBindable member of <${tag}> (bindings to unknown members are silently ignored)`,
11163
+ tagMemberUnknown: (prop, tag) => `"${prop}" is not a wcBindable member of <${tag}> (the runtime refuses a binding to an undeclared member with #38; at the root the state fails to initialize)`,
11035
11164
  nameAlias: (written, canonical) => `"${written}" was removed in 4.0 (the 3.x old name of "${canonical}"; the runtime throws when it is read) \u2014 write "${canonical}"`,
11036
- declarationAliasRead: (alias, canonical) => `"${alias}" is a declaration key 4.0 removed (the 3.x old name of "${canonical}"), so this["${alias}"] is undefined. Read "${canonical}" instead`,
11165
+ declarationAliasRead: (alias, canonical) => `"${alias}" is a declaration key 4.0 removed (the 3.x old name of "${canonical}"), so this["${alias}"] is undefined. A declaration cannot be read through this \u2014 reading "${canonical}" is undefined too${canonical === "$stream" ? " (read a stream's state from $streamStatus / $streamError)" : ""}`,
11037
11166
  declarationAlias: (alias, canonical) => `The declaration key "${alias}" was removed in 4.0 (the 3.x old name of "${canonical}"; the runtime throws at load time) \u2014 write "${canonical}"`,
11038
11167
  declarationAliasInVolume: (alias, canonical, mountPath) => `The declaration key "${alias}" was removed in 4.0 (the 3.x old name of "${canonical}"). In a volume (mount="${mountPath}") the runtime refuses to graft it and reports that with console.error (this state is not on the tree). "${canonical}" cannot be declared in a volume either \u2014 declare it on the root state`,
11039
11168
  behaviorNotObject: (keys) => `$behavior must be an object { ${keys.map((k) => `${k}?`).join(", ")} } (the runtime throws at load time)`,
@@ -11041,7 +11170,7 @@ var en = {
11041
11170
  behaviorValueType: (key, type) => `$behavior "${key}" must be ${type === "boolean" ? "true or false" : type} (the runtime throws at load time)`,
11042
11171
  configInVolume: (key, mountPath) => `${key} cannot be declared in a volume (mount="${mountPath}"): the runtime refuses to graft the volume and reports that with console.error (this state is not on the tree). Declare it on the root state \u2014 a volume is grafted onto the root's engine`,
11043
11172
  featuresNotArray: () => `$features must be an array of add-on names (for example ["temporal", "formats"]; the runtime throws at load time)`,
11044
- featureUnknown: (name, names, suggestion2) => `"${name}" is not an add-on (${names.join(", ")})${suggestion2}`,
11173
+ featureUnknown: (name, names2, suggestion2) => `"${name}" is not an add-on (${names2.join(", ")})${suggestion2}`,
11045
11174
  volumeDeclarationRejected: (key, mountPath) => `${key} is not run in a volume (mount="${mountPath}"): the runtime refuses to graft the volume and reports that with console.error (this state is not on the tree). Declare it on the root state`,
11046
11175
  volumeDeclarationNotRun: (key, mountPath) => `${key} is not run in a volume (mount="${mountPath}"): the runtime says so with console.warn and ignores this declaration \u2014 it belongs to the root state. Declare it there`,
11047
11176
  secondRoot: () => 'A second <wcs-state> on the same root: there is one state tree per root (the runtime refuses the one that loads second and reports it with console.error). Graft a subtree with <wcs-state mount="path">',
@@ -11063,7 +11192,7 @@ var en = {
11063
11192
  storagePairClobber: (path) => `The <wcs-storage> value is bound to the accessor pair "${path}" without #init=element. The state's side goes first, so on every load the getter's starting value is saved over the stored one, and the setter never receives it \u2014 add #init=element (\`value#init=element: ${path}\`)`,
11064
11193
  inputNestedWrite: (tag, input, path, example) => `"${path}" is bound to the input "${input}" of <${tag}>, but the page writes below it ("${example}"). A binding is re-applied only when "${path}" itself is assigned, so those writes never reach <${tag}> \u2014 bind a getter that reads the fields by path (\`this["${example}"]\`, \`$getAll\`) and returns a new value, or replace "${path}" instead of writing below it`,
11065
11194
  inputNestedWriteOneShot: (tag, input, path, example) => `"${path}" is bound to the input "${input}" of <${tag}>, but the page writes below it ("${example}"). A binding is re-applied only when "${path}" itself is assigned, and <${tag}> resets "${input}" to null after every request, so the next request goes without it \u2014 build a new object in the handler that starts the request (\`this.submitBody = { \u2026 }\`) and bind that`,
11066
- devtoolsAfterState: () => `Load @wcstack/devtools/auto BEFORE @wcstack/state/auto (otherwise the wiring ledger is not captured live)`,
11195
+ devtoolsAfterState: () => `Load @wcstack/devtools/auto before @wcstack/state/auto (loaded later, the DevTools timeline starts when it attaches; 4.0 sends it the wiring that is there already)`,
11067
11196
  baseHrefMissing: () => `An SPA using @wcstack/router needs <base href="/"> in <head> (without it, deep links misderive the basename)`,
11068
11197
  routerOutletMisplaced: () => `This <wcs-outlet> is not right after a <wcs-router>, so no router uses it: a router uses only the element right after it as its outlet, and makes an outlet of its own there when that is not a <wcs-outlet>. The routes render right after the router and this outlet stays empty \u2014 move it right after the <wcs-router>`,
11069
11198
  signalsDualEntry: () => `Both @wcstack/signals and @wcstack/signals/dom are imported on this page. On a CDN each entry is a self-contained bundle, so the reactive core is duplicated and reactivity breaks at the seam \u2014 import everything from the single /dom entry`,
@@ -11075,13 +11204,15 @@ var en = {
11075
11204
  mountPathInvalid: (problem, mountPath) => {
11076
11205
  switch (problem) {
11077
11206
  case "empty":
11078
- return `"mount" requires a non-empty tree path.`;
11207
+ return `"mount" needs a non-empty static path (the runtime refuses the volume: "has an invalid mount path").`;
11079
11208
  case "emptySegment":
11080
- return `"mount" path "${mountPath}" has an empty segment.`;
11209
+ return `"mount" path "${mountPath}" has an empty segment (the runtime refuses the volume: "has an invalid mount path").`;
11081
11210
  case "wildcard":
11082
- return `"mount" path "${mountPath}" must be static (wildcards are not allowed).`;
11211
+ return `"mount" path "${mountPath}" must be static \u2014 no "*" (the runtime refuses the volume: "has an invalid mount path").`;
11212
+ case "whitespace":
11213
+ return `"mount" path "${mountPath}" must not contain whitespace (the runtime refuses the volume: "has an invalid mount path").`;
11083
11214
  default:
11084
- return `"mount" path "${mountPath}" must not use reserved characters ($, #, @).`;
11215
+ return `"mount" path "${mountPath}" must not use the reserved characters $, #, @ (the runtime refuses the volume: "has an invalid mount path").`;
11085
11216
  }
11086
11217
  },
11087
11218
  recursionUnsupported: (p, where) => {
@@ -11103,7 +11234,7 @@ var en = {
11103
11234
  case "listKeys":
11104
11235
  return `$listKeys key "${p}" cannot contain "**" \u2014 a keyed list is one concrete list path. Declare the key per depth instead (for example "nodes.*.children")`;
11105
11236
  default:
11106
- return `"${p}" contains "**" but this state declares no $recursion anchor. Declare $recursion = { "<anchor>": "<repeat>" } (for example { "nodes.*": "children.*" }) \u2014 without it a "**" key is silently ignored`;
11237
+ return `"${p}" contains "**" but this state declares no $recursion anchor. Declare $recursion = { "<anchor>": "<repeat>" } (for example { "nodes.*": "children.*" }) \u2014 without it the runtime throws #1101 at load and the state fails to initialize`;
11107
11238
  }
11108
11239
  },
11109
11240
  recursionAnchorMismatch: (p, anchor) => `"${p}" does not match the declared recursion anchor "${anchor}" (this version supports exactly one self-recursive anchor per state, and "**" must be followed by a well-formed suffix: no second "**", no empty segment, no bare "*" right after "**")`,
@@ -11354,8 +11485,8 @@ function derefUnion(node, rootDefs) {
11354
11485
  }
11355
11486
  return { kind: "ok", nodes: out };
11356
11487
  }
11357
- function firstDefined(nodes, pick) {
11358
- for (const n of nodes) {
11488
+ function firstDefined(nodes2, pick) {
11489
+ for (const n of nodes2) {
11359
11490
  const v = pick(n);
11360
11491
  if (v !== void 0) return v;
11361
11492
  }
@@ -11483,11 +11614,11 @@ var DELEGATED_EVENTS = /* @__PURE__ */ new Set([
11483
11614
  ]);
11484
11615
  var CUSTOM_ELEMENT_OWN_EVENTS = /* @__PURE__ */ new Set(["input", "change", "submit"]);
11485
11616
  function collectCurrentTargetHandlers(elements, html, fileReader) {
11486
- const names = /* @__PURE__ */ new Set();
11617
+ const names2 = /* @__PURE__ */ new Set();
11487
11618
  forEachStateMethod(elements, html, fileReader, "currentTarget", (name, params, body) => {
11488
- if (readsEventCurrentTarget(params, body)) names.add(name);
11619
+ if (readsEventCurrentTarget(params, body)) names2.add(name);
11489
11620
  });
11490
- return names;
11621
+ return names2;
11491
11622
  }
11492
11623
  function collectPreventDefaultHandlers(elements, html, fileReader) {
11493
11624
  const handlers = /* @__PURE__ */ new Map();
@@ -11526,11 +11657,6 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
11526
11657
  const pathIndex = getStatePathIndex(html, stateTagName, fileReader);
11527
11658
  const statePaths = mergeSchemaCandidates(pathIndex.paths, applicationSchema);
11528
11659
  const attrs = findAllBindAttributes(html, attrName);
11529
- let structuralTemplates = null;
11530
- const getStructuralTemplates = () => {
11531
- structuralTemplates ??= collectStructuralTemplates(html, attrName);
11532
- return structuralTemplates;
11533
- };
11534
11660
  const outerCandidates = [];
11535
11661
  const currentTargetCandidates = [];
11536
11662
  let currentTargetHandlers = null;
@@ -11690,7 +11816,8 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
11690
11816
  start: pathStart,
11691
11817
  end: pathStart + tokenPath.length,
11692
11818
  message: msgs.commandRhsFormat(),
11693
- severity: "warning"
11819
+ // ランタイムは束縛の計画で #1201 として throw し、root では初期化が失敗する
11820
+ severity: "error"
11694
11821
  });
11695
11822
  } else if (commandNames.size > 0 && !commandNames.has(tokenPath)) {
11696
11823
  diagnostics.push({
@@ -11698,7 +11825,9 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
11698
11825
  start: pathStart,
11699
11826
  end: pathStart + tokenPath.length,
11700
11827
  message: msgs.commandTokenUndeclared(tokenPath),
11701
- severity: "warning"
11828
+ // ランタイムは取り付けで #1302 として throw し、root では初期化が失敗する
11829
+ // (eventToken. と `on*: $command.x` はイベントのたびに #1301 を記録するだけなので warning のまま)
11830
+ severity: "error"
11702
11831
  });
11703
11832
  }
11704
11833
  }
@@ -11736,6 +11865,18 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
11736
11865
  message: `${verdict.message}${pathTrimmed.startsWith(".") ? msgs.expansionSuffix(checkPath) : ""}`,
11737
11866
  severity: verdict.severity
11738
11867
  });
11868
+ } else if (writesBack(attr, propNoMod, parsed.property)) {
11869
+ const target = scopedPaths.find((p) => p.path === checkPath);
11870
+ if (target !== void 0 && target.kind === "computed" && target.settable !== true) {
11871
+ const pathStart = bindingStart + binding.indexOf(parsed.path);
11872
+ diagnostics.push({
11873
+ code: WcsDiagnosticCode.PathReadonly,
11874
+ start: pathStart,
11875
+ end: pathStart + pathTrimmed.length,
11876
+ message: msgs.pathReadonlyTwoWay(checkPath, propNoMod),
11877
+ severity: "error"
11878
+ });
11879
+ }
11739
11880
  }
11740
11881
  }
11741
11882
  }
@@ -11868,10 +12009,7 @@ function validateBindings(html, attrName, stateTagName = "wcs-state", locale2, f
11868
12009
  const typePath = candidateKeyOf(pathTrimmed, (c) => scopedPathSet.has(c));
11869
12010
  const resultType = resolveResultType(typePath, parsed.filters, scopedPaths);
11870
12011
  if (resultType !== null) {
11871
- const typeReq = getExpectedType(
11872
- parsed.property,
11873
- () => isNegatedByElseChain(getStructuralTemplates(), attr.valueStart)
11874
- );
12012
+ const typeReq = getExpectedType(parsed.property);
11875
12013
  if (typeReq && resultType !== typeReq.expected) {
11876
12014
  const pathOffset = binding.indexOf(parsed.path);
11877
12015
  const pathStart = bindingStart + pathOffset;
@@ -11925,6 +12063,19 @@ function openTagBefore(html, valueStart) {
11925
12063
  const lt2 = html.lastIndexOf("<", valueStart);
11926
12064
  return lt2 === -1 ? "" : html.slice(lt2, valueStart);
11927
12065
  }
12066
+ function writesBack(attr, prop, written) {
12067
+ if (written.split("#").slice(1).some((modifier) => modifier.trim() === "ro")) return false;
12068
+ if (prop === "radio" || prop === "checkbox") return true;
12069
+ const tag = attr.tagName;
12070
+ if (tag === void 0 || tag.includes("-")) return false;
12071
+ if (tag === "input") {
12072
+ const type = (attr.inputType || "text").toLowerCase();
12073
+ if (type === "button") return false;
12074
+ if ((type === "radio" || type === "checkbox") && prop === "checked") return true;
12075
+ return prop === "value" || prop === "valueAsNumber" || prop === "valueAsDate";
12076
+ }
12077
+ return (tag === "select" || tag === "textarea") && prop === "value";
12078
+ }
11928
12079
  function findAllBindAttributes(html, attrName) {
11929
12080
  const attrs = [];
11930
12081
  const escaped = attrName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -11938,7 +12089,8 @@ function findAllBindAttributes(html, attrName) {
11938
12089
  const valueStart = tag.start + match.index + match[0].length;
11939
12090
  const valueEnd = html.indexOf(quote, valueStart);
11940
12091
  if (valueEnd === -1 || valueEnd > tag.end) continue;
11941
- attrs.push({ value: html.slice(valueStart, valueEnd), valueStart, tagName: tag.tagName });
12092
+ const inputType = tag.tagName === "input" ? extractAttribute(attrsText, "type") ?? void 0 : void 0;
12093
+ attrs.push({ value: html.slice(valueStart, valueEnd), valueStart, tagName: tag.tagName, ...inputType !== void 0 ? { inputType } : {} });
11942
12094
  regex.lastIndex = valueEnd - tag.start;
11943
12095
  }
11944
12096
  }
@@ -12029,14 +12181,16 @@ function validateFilterUsage(filter, bindingStart, msgs) {
12029
12181
  for (let i = 0; i < Math.min(argCount, info.argTypes.length); i++) {
12030
12182
  const expectedArgType = info.argTypes[i];
12031
12183
  if (expectedArgType === "any") continue;
12032
- const actualArgType = inferArgType(filter.args[i]);
12033
- if (actualArgType !== expectedArgType) {
12184
+ const arg = filter.args[i];
12185
+ const numericFails = expectedArgType === "number" && !readsAsNumber(arg);
12186
+ const actualArgType = inferArgType(arg);
12187
+ if (expectedArgType === "number" ? numericFails : actualArgType !== expectedArgType) {
12034
12188
  diagnostics.push({
12035
12189
  code: WcsDiagnosticCode.FilterArgType,
12036
12190
  start: bindingStart + filter.argsOffset,
12037
12191
  end: bindingStart + filter.argsOffset + filter.name.length,
12038
- message: msgs.filterArgType(filter.name, i + 1, expectedArgType, filter.args[i], actualArgType),
12039
- severity: "warning"
12192
+ message: msgs.filterArgType(filter.name, i + 1, expectedArgType, arg, actualArgType),
12193
+ severity: numericFails ? "error" : "warning"
12040
12194
  });
12041
12195
  }
12042
12196
  }
@@ -12101,57 +12255,11 @@ function validateSchemaPathExistence(checkPath, displayPath, scopedPaths, scoped
12101
12255
  }
12102
12256
  return null;
12103
12257
  }
12104
- function collectStructuralTemplates(html, attrName) {
12105
- const escaped = attrName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
12106
- const attrRegex = new RegExp(`${escaped}\\s*=\\s*(["'])`, "i");
12107
- const tagRegex = /<template(?:\s[^>]*)?>|<\/template\s*>/gi;
12108
- const templates = [];
12109
- let depth = 0;
12110
- let match;
12111
- while ((match = tagRegex.exec(html)) !== null) {
12112
- if (match[0].startsWith("</")) {
12113
- depth = Math.max(0, depth - 1);
12114
- continue;
12115
- }
12116
- const attrMatch = attrRegex.exec(match[0]);
12117
- if (attrMatch) {
12118
- const quote = attrMatch[1];
12119
- const valueStart = match.index + attrMatch.index + attrMatch[0].length;
12120
- const valueEnd = html.indexOf(quote, valueStart);
12121
- if (valueEnd !== -1) {
12122
- const first = splitBindingExpressions(html.slice(valueStart, valueEnd))[0] ?? "";
12123
- const firstColon = indexOfOutsideQuotes2(first, ":");
12124
- const prop = (firstColon === -1 ? first : first.slice(0, firstColon)).replace(/#.*$/, "").trim();
12125
- const type = prop === "if" || prop === "elseif" || prop === "else" ? prop : "other";
12126
- templates.push({ valueStart, depth, type });
12127
- }
12128
- }
12129
- depth++;
12130
- }
12131
- return templates;
12132
- }
12133
- function isNegatedByElseChain(templates, valueStart) {
12134
- const index = templates.findIndex((t) => t.valueStart === valueStart);
12135
- if (index === -1) return false;
12136
- const selfDepth = templates[index].depth;
12137
- for (let i = index + 1; i < templates.length; i++) {
12138
- const next = templates[i];
12139
- if (next.depth > selfDepth) continue;
12140
- if (next.depth < selfDepth) return false;
12141
- if (next.type === "elseif" || next.type === "else") return true;
12142
- if (next.type === "if") return false;
12143
- }
12144
- return false;
12145
- }
12146
- function getExpectedType(property, isNegatedIf) {
12258
+ function getExpectedType(property) {
12147
12259
  const prop = property.replace(/#.*$/, "");
12148
12260
  if (prop === "for") {
12149
12261
  return { label: "for", expected: "array", severity: "error" };
12150
12262
  }
12151
- if (prop === "if" || prop === "elseif") {
12152
- if (!isNegatedIf()) return null;
12153
- return { label: prop, expected: "boolean", severity: "warning" };
12154
- }
12155
12263
  if (prop.startsWith("class.")) {
12156
12264
  return { label: prop, expected: "boolean", severity: "warning" };
12157
12265
  }
@@ -12207,6 +12315,10 @@ function inferArgType(arg) {
12207
12315
  if (/^-?\d+(\.\d+)?$/.test(v)) return "number";
12208
12316
  return "string";
12209
12317
  }
12318
+ function readsAsNumber(arg) {
12319
+ const v = arg.trim().replace(/^(["'])([\s\S]*)\1$/, "$2");
12320
+ return v !== "" && !Number.isNaN(Number(v));
12321
+ }
12210
12322
  function isLiteral(value) {
12211
12323
  return /^-?\d/.test(value) || /^["'`]/.test(value) || value === "true" || value === "false" || value === "null";
12212
12324
  }
@@ -14130,21 +14242,164 @@ var BUILTIN_TAGS = {
14130
14242
  }
14131
14243
  };
14132
14244
 
14245
+ // src/service/pageElements.ts
14246
+ var MAX_FILES = 32;
14247
+ var JS_TYPES = /* @__PURE__ */ new Set(["", "module", "text/javascript", "application/javascript", "text/ecmascript"]);
14248
+ function pageScripts(html) {
14249
+ const inline = [];
14250
+ const srcs = [];
14251
+ const re = /<script\b((?:"[^"]*"|'[^']*'|[^>"'])*)>([\s\S]*?)<\/script\s*>/gi;
14252
+ const text3 = html.replace(/<!--[\s\S]*?-->/g, (c) => " ".repeat(c.length));
14253
+ let m;
14254
+ while ((m = re.exec(text3)) !== null) {
14255
+ const attrs = m[1];
14256
+ const type = (extractAttribute(attrs, "type") ?? "").trim().toLowerCase();
14257
+ if (!JS_TYPES.has(type)) continue;
14258
+ const src = extractAttribute(attrs, "src");
14259
+ if (src !== null) srcs.push(src);
14260
+ else if (m[2].trim() !== "") inline.push(m[2]);
14261
+ }
14262
+ return { inline, srcs };
14263
+ }
14264
+ function joinRelative(from, spec) {
14265
+ if (!spec.startsWith("./") && !spec.startsWith("../")) return null;
14266
+ const dir = from.includes("/") ? from.slice(0, from.lastIndexOf("/") + 1) : "";
14267
+ const out = [];
14268
+ for (const seg of `${dir}${spec}`.split("/")) {
14269
+ if (seg === "" || seg === ".") continue;
14270
+ if (seg === ".." && out.length > 0 && out[out.length - 1] !== "..") out.pop();
14271
+ else out.push(seg);
14272
+ }
14273
+ return `./${out.join("/")}`;
14274
+ }
14275
+ function parseScript(source) {
14276
+ for (const sourceType of ["module", "script"]) {
14277
+ try {
14278
+ return parse3(source, { ecmaVersion: "latest", sourceType, allowHashBang: true });
14279
+ } catch {
14280
+ }
14281
+ }
14282
+ return null;
14283
+ }
14284
+ function* nodes(node) {
14285
+ yield node;
14286
+ for (const value of Object.values(node)) {
14287
+ if (Array.isArray(value)) {
14288
+ for (const v of value) if (v !== null && typeof v === "object" && typeof v.type === "string") yield* nodes(v);
14289
+ } else if (value !== null && typeof value === "object" && typeof value.type === "string") {
14290
+ yield* nodes(value);
14291
+ }
14292
+ }
14293
+ }
14294
+ var keyName = (key, computed) => computed ? null : key.type === "Identifier" ? key.name : key.type === "Literal" && typeof key.value === "string" ? key.value : null;
14295
+ function names(obj, key) {
14296
+ const prop = obj.properties.find((p) => p.type === "Property" && keyName(p.key, p.computed) === key);
14297
+ if (prop === void 0 || prop.type !== "Property") return void 0;
14298
+ if (prop.value.type !== "ArrayExpression") return null;
14299
+ const out = [];
14300
+ for (const el of prop.value.elements) {
14301
+ if (el === null || el.type !== "ObjectExpression" || el.properties.some((p) => p.type !== "Property")) return null;
14302
+ const name = el.properties.find((p) => p.type === "Property" && keyName(p.key, p.computed) === "name");
14303
+ if (name === void 0 || name.type !== "Property" || name.value.type !== "Literal" || typeof name.value.value !== "string") return null;
14304
+ out.push(name.value.value);
14305
+ }
14306
+ return out;
14307
+ }
14308
+ function contractOf(value) {
14309
+ if (value.type !== "ObjectExpression" || value.properties.some((p) => p.type !== "Property")) return "unknown";
14310
+ const properties = names(value, "properties");
14311
+ const inputs = names(value, "inputs");
14312
+ const commands = names(value, "commands");
14313
+ if (properties === null || inputs === null || commands === null) return "unknown";
14314
+ return {
14315
+ properties: properties ?? [],
14316
+ inputs: Object.fromEntries((inputs ?? []).map((n) => [n, null])),
14317
+ commands: commands ?? []
14318
+ };
14319
+ }
14320
+ function declaredBy(cls) {
14321
+ let declared = "none";
14322
+ for (const member of cls.body.body) {
14323
+ if (member.type !== "PropertyDefinition" && member.type !== "MethodDefinition" || !member.static) continue;
14324
+ if (keyName(member.key, member.computed) !== "wcBindable") continue;
14325
+ if (member.type === "PropertyDefinition") {
14326
+ declared = member.value === null || member.value === void 0 ? "unknown" : contractOf(member.value);
14327
+ } else {
14328
+ const body = member.kind === "get" ? member.value.body.body : [];
14329
+ const ret = body.length === 1 && body[0].type === "ReturnStatement" ? body[0].argument : null;
14330
+ declared = ret === null || ret === void 0 ? "unknown" : contractOf(ret);
14331
+ }
14332
+ }
14333
+ const sup = cls.superClass;
14334
+ return { declared, superName: sup !== null && sup !== void 0 && sup.type === "Identifier" ? sup.name : null };
14335
+ }
14336
+ function isDefine(callee) {
14337
+ if (callee.type !== "MemberExpression" || keyName(callee.property, callee.computed) !== "define") return false;
14338
+ const o = callee.object;
14339
+ return o.type === "Identifier" && o.name === "customElements" || o.type === "MemberExpression" && keyName(o.property, o.computed) === "customElements";
14340
+ }
14341
+ function collectPageElementContracts(html, fileReader) {
14342
+ const { inline, srcs } = pageScripts(html);
14343
+ const programs = [];
14344
+ const read = /* @__PURE__ */ new Set();
14345
+ const queue = srcs.map((spec) => ({ from: "", spec: spec.startsWith(".") ? spec : `./${spec}` }));
14346
+ const visit2 = (program, from) => {
14347
+ programs.push(program);
14348
+ for (const n of nodes(program)) {
14349
+ const source = n.type === "ImportDeclaration" || n.type === "ExportAllDeclaration" || n.type === "ExportNamedDeclaration" ? n.source : n.type === "ImportExpression" ? n.source : null;
14350
+ if (source !== null && source !== void 0 && source.type === "Literal" && typeof source.value === "string") queue.push({ from, spec: source.value });
14351
+ }
14352
+ };
14353
+ for (const source of inline) {
14354
+ const program = parseScript(source);
14355
+ if (program !== null) visit2(program, "");
14356
+ }
14357
+ while (queue.length > 0 && fileReader !== void 0 && read.size < MAX_FILES) {
14358
+ const { from, spec } = queue.shift();
14359
+ const path = joinRelative(from, spec);
14360
+ if (path === null || read.has(path) || !/\.m?js$/.test(path)) continue;
14361
+ read.add(path);
14362
+ const text3 = fileReader(path);
14363
+ const program = text3 === void 0 ? null : parseScript(text3);
14364
+ if (program !== null) visit2(program, path);
14365
+ }
14366
+ const classes = /* @__PURE__ */ new Map();
14367
+ const defines = [];
14368
+ for (const program of programs) {
14369
+ for (const n of nodes(program)) {
14370
+ if (n.type === "ClassDeclaration" && n.id !== null && !classes.has(n.id.name)) classes.set(n.id.name, declaredBy(n));
14371
+ else if (n.type === "VariableDeclarator" && n.id.type === "Identifier" && n.init?.type === "ClassExpression" && !classes.has(n.id.name)) {
14372
+ classes.set(n.id.name, declaredBy(n.init));
14373
+ } else if (n.type === "CallExpression" && isDefine(n.callee) && n.arguments.length >= 2) {
14374
+ const [tag, cls] = n.arguments;
14375
+ if (tag.type !== "Literal" || typeof tag.value !== "string") continue;
14376
+ if (cls.type === "ClassExpression") defines.push({ tag: tag.value, info: declaredBy(cls) });
14377
+ else if (cls.type === "Identifier") defines.push({ tag: tag.value, info: cls.name });
14378
+ }
14379
+ }
14380
+ }
14381
+ const resolve2 = (info, depth) => {
14382
+ if (info.declared === "unknown") return null;
14383
+ if (info.declared !== "none") return info.declared;
14384
+ const sup = info.superName === null ? void 0 : classes.get(info.superName);
14385
+ return sup === void 0 || depth > 16 ? null : resolve2(sup, depth + 1);
14386
+ };
14387
+ const out = /* @__PURE__ */ new Map();
14388
+ for (const { tag, info } of defines) {
14389
+ const name = tag.toLowerCase();
14390
+ if (name.startsWith("wcs-") || out.has(name)) continue;
14391
+ const cls = typeof info === "string" ? classes.get(info) : info;
14392
+ const contract = cls === void 0 ? null : resolve2(cls, 0);
14393
+ if (contract !== null) out.set(name, contract);
14394
+ }
14395
+ return out;
14396
+ }
14397
+ function mayDefineElements(html) {
14398
+ return /customElements|<script\b[^>]*\bsrc\s*=/i.test(html);
14399
+ }
14400
+
14133
14401
  // src/service/ioNodeValidator.ts
14134
- var DOM_COMMON_PROPERTIES = /* @__PURE__ */ new Set([
14135
- "textContent",
14136
- "innerHTML",
14137
- "innerText",
14138
- "hidden",
14139
- "title",
14140
- "id",
14141
- "slot",
14142
- "dir",
14143
- "lang",
14144
- "role",
14145
- "tabIndex",
14146
- "className"
14147
- ]);
14402
+ var HTML_SINK_PROPERTIES = /* @__PURE__ */ new Set(["html", "innerHTML", "outerHTML", "srcdoc"]);
14148
14403
  var STRUCTURAL_DIRECTIVES3 = /* @__PURE__ */ new Set(["for", "if", "elseif", "else"]);
14149
14404
  var EXPLICIT_PROPERTY_REJECTED_HEADS2 = /* @__PURE__ */ new Set([
14150
14405
  ...Object.values(getWcsManifest().syntax.bindingTypes.propNamespaces),
@@ -14157,7 +14412,6 @@ function validateIoNodes(html, bindAttribute = "data-wcs", stateTagName = "wcs-s
14157
14412
  const diagnostics = [];
14158
14413
  const msgs = getMessages(locale2);
14159
14414
  const occurrences = findBuiltinTagOccurrences(html);
14160
- if (occurrences.length === 0) return diagnostics;
14161
14415
  let statePaths = null;
14162
14416
  const getPaths = () => statePaths ??= getStatePathsFromHtml(html, stateTagName, fileReader);
14163
14417
  for (const occ of occurrences) {
@@ -14185,32 +14439,35 @@ function validateIoNodes(html, bindAttribute = "data-wcs", stateTagName = "wcs-s
14185
14439
  }
14186
14440
  if (contract.properties.length === 0 && contract.commands.length === 0 && Object.keys(contract.inputs).length === 0) continue;
14187
14441
  const hasManual = hasBooleanAttribute(occ.attrsText, "manual");
14188
- let exprOffset = 0;
14189
- for (const expr of splitBindingExpressions(bindAttr.value)) {
14190
- const exprStart = valueStart + exprOffset;
14191
- exprOffset += expr.length + 1;
14192
- const parsed = parseBindingExpression(expr);
14193
- const property = parsed.property;
14194
- if (!property) continue;
14195
- const propIndex = expr.indexOf(property);
14196
- const start = propIndex === -1 ? exprStart : exprStart + propIndex;
14197
- const end = propIndex === -1 ? exprStart + expr.length : start + property.length;
14198
- validateBindingAgainstContract(
14199
- occ.tagName,
14200
- contract,
14201
- parsed,
14202
- property,
14203
- start,
14204
- end,
14205
- hasManual,
14206
- getPaths,
14207
- diagnostics,
14208
- msgs
14209
- );
14442
+ checkBindings(occ.tagName, contract, bindAttr.value, valueStart, hasManual, getPaths, diagnostics, msgs);
14443
+ }
14444
+ if (mayDefineElements(html)) {
14445
+ const own2 = findPageTagOccurrences(html, bindAttribute);
14446
+ const contracts = own2.length > 0 ? collectPageElementContracts(html, fileReader) : null;
14447
+ for (const occ of own2) {
14448
+ const contract = contracts.get(occ.tagName);
14449
+ if (contract === void 0) continue;
14450
+ if (contract.properties.length === 0 && contract.commands.length === 0 && Object.keys(contract.inputs).length === 0) continue;
14451
+ const bindAttr = extractAttributeValue(occ.attrsText, bindAttribute);
14452
+ checkBindings(occ.tagName, contract, bindAttr.value, occ.attrsStart + bindAttr.valueOffsetInAttrs, false, getPaths, diagnostics, msgs);
14210
14453
  }
14211
14454
  }
14212
14455
  return diagnostics;
14213
14456
  }
14457
+ function checkBindings(tagName, contract, value, valueStart, hasManual, getPaths, diagnostics, msgs) {
14458
+ let exprOffset = 0;
14459
+ for (const expr of splitBindingExpressions(value)) {
14460
+ const exprStart = valueStart + exprOffset;
14461
+ exprOffset += expr.length + 1;
14462
+ const parsed = parseBindingExpression(expr);
14463
+ const property = parsed.property;
14464
+ if (!property) continue;
14465
+ const propIndex = expr.indexOf(property);
14466
+ const start = propIndex === -1 ? exprStart : exprStart + propIndex;
14467
+ const end = propIndex === -1 ? exprStart + expr.length : start + property.length;
14468
+ validateBindingAgainstContract(tagName, contract, parsed, property, start, end, hasManual, getPaths, diagnostics, msgs);
14469
+ }
14470
+ }
14214
14471
  function validateBindingAgainstContract(tagName, contract, parsed, property, start, end, hasManual, getPaths, diagnostics, msgs) {
14215
14472
  const hashIndex = property.indexOf("#");
14216
14473
  const modifiers = hashIndex === -1 ? "" : property.slice(hashIndex + 1);
@@ -14246,7 +14503,7 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
14246
14503
  code: WcsDiagnosticCode.TagMemberUnknown,
14247
14504
  start,
14248
14505
  end,
14249
- severity: "warning",
14506
+ severity: "error",
14250
14507
  tag: tagName,
14251
14508
  member: name,
14252
14509
  message: msgs.tagCommandUnknown(name, tagName, contract.commands.join(", ") || msgs.none()) + suggestion(name, contract.commands, msgs)
@@ -14261,7 +14518,7 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
14261
14518
  code: WcsDiagnosticCode.TagMemberUnknown,
14262
14519
  start,
14263
14520
  end,
14264
- severity: "warning",
14521
+ severity: "error",
14265
14522
  tag: tagName,
14266
14523
  member: name,
14267
14524
  message: msgs.tagEventTokenKeyUnknown(name, tagName, contract.properties.join(", ")) + suggestion(name, contract.properties, msgs)
@@ -14269,20 +14526,21 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
14269
14526
  }
14270
14527
  return;
14271
14528
  }
14272
- if (!contract.properties.includes(property) && !(property in contract.inputs) && !DOM_COMMON_PROPERTIES.has(property)) {
14529
+ if (!tagName.startsWith("wcs-") && property.includes(".")) return;
14530
+ if (!contract.properties.includes(property) && !(property in contract.inputs) && !HTML_SINK_PROPERTIES.has(property)) {
14273
14531
  const members = [...contract.properties, ...inputNames];
14274
14532
  diagnostics.push({
14275
14533
  code: WcsDiagnosticCode.TagMemberUnknown,
14276
14534
  start,
14277
14535
  end,
14278
- severity: "warning",
14536
+ severity: "error",
14279
14537
  tag: tagName,
14280
14538
  member: property,
14281
14539
  message: msgs.tagMemberUnknown(property, tagName) + suggestion(property, members, msgs)
14282
14540
  });
14283
14541
  return;
14284
14542
  }
14285
- if (property === "trigger" && "trigger" in contract.inputs && parsed.path) {
14543
+ if (tagName.startsWith("wcs-") && property === "trigger" && "trigger" in contract.inputs && parsed.path) {
14286
14544
  const cand = findDataSlot(getPaths(), parsed.path);
14287
14545
  if (cand?.rawInitial === "true") {
14288
14546
  diagnostics.push({
@@ -14359,6 +14617,17 @@ function findBuiltinTagOccurrences(html) {
14359
14617
  }
14360
14618
  return out;
14361
14619
  }
14620
+ function findPageTagOccurrences(html, bindAttribute) {
14621
+ const out = [];
14622
+ for (const region of findStartTagRegions(html)) {
14623
+ const tagName = region.tagName;
14624
+ if (!tagName.includes("-") || tagName.startsWith("wcs-")) continue;
14625
+ const attrsText = html.slice(region.start, region.end);
14626
+ if (extractAttributeValue(attrsText, bindAttribute) === null) continue;
14627
+ out.push({ tagName, tagStart: region.start - tagName.length - 1, attrsText, attrsStart: region.start });
14628
+ }
14629
+ return out;
14630
+ }
14362
14631
  function extractAttributeValue(attrsText, attrName) {
14363
14632
  const escaped = attrName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14364
14633
  const regex = new RegExp(`(?:^|\\s)${escaped}\\s*=\\s*(["'])`, "i");
@@ -14480,7 +14749,7 @@ function validateDocumentEnv(html, locale2) {
14480
14749
  code: WcsDiagnosticCode.ScriptOrder,
14481
14750
  start: later.start,
14482
14751
  end: later.end,
14483
- severity: "warning",
14752
+ severity: "info",
14484
14753
  message: msgs.devtoolsAfterState()
14485
14754
  });
14486
14755
  }
@@ -14804,7 +15073,7 @@ function validateWatchDeclarations(html, stateTagName = "wcs-state", locale2, fi
14804
15073
  const scopes = {
14805
15074
  mounts: volumes?.scopes.mounts ?? [],
14806
15075
  unresolvedMounts: volumes?.scopes.unresolvedMounts ?? NO_MOUNTS,
14807
- rootUnresolved: own2.length === 0 && !isReadableStateScript(block.content)
15076
+ rootUnresolved: !scriptReadable(block.content, own2)
14808
15077
  };
14809
15078
  for (const entry of entries) {
14810
15079
  const diagnostic = validateEntry(entry, pathSet, paths, scopes, msgs);
@@ -14825,10 +15094,10 @@ var NO_MOUNTS = /* @__PURE__ */ new Set();
14825
15094
  function assignVolumes(elements, html) {
14826
15095
  const chainOf = createTemplateChain(html);
14827
15096
  const innermost = (chain) => chain.length > 0 ? chain[chain.length - 1] : -1;
14828
- const treeOf = (root) => innermost(chainOf(root.tagStart));
15097
+ const treeOf2 = (root) => innermost(chainOf(root.tagStart));
14829
15098
  const rootTrees = /* @__PURE__ */ new Set();
14830
15099
  for (const element2 of elements) {
14831
- if (element2.mountPath === null && !element2.bindComponent) rootTrees.add(treeOf(element2));
15100
+ if (element2.mountPath === null && !element2.bindComponent) rootTrees.add(treeOf2(element2));
14832
15101
  }
14833
15102
  const volumes = /* @__PURE__ */ new Map();
14834
15103
  for (const element2 of elements) {
@@ -14845,7 +15114,7 @@ function assignVolumes(elements, html) {
14845
15114
  if (list === void 0) volumes.set(tree, [element2]);
14846
15115
  else list.push(element2);
14847
15116
  }
14848
- return { treeOf, volumes };
15117
+ return { treeOf: treeOf2, volumes };
14849
15118
  }
14850
15119
  function validateEntry(entry, pathSet, paths, scopes, msgs) {
14851
15120
  const { key } = entry;
@@ -15176,7 +15445,7 @@ function validateRecursiveGetters(script, offset2, spec, undeclared, msgs, out)
15176
15445
  start,
15177
15446
  end,
15178
15447
  msgs.recursionUnsupported(span.name, "undeclared"),
15179
- "warning"
15448
+ "error"
15180
15449
  );
15181
15450
  }
15182
15451
  continue;
@@ -15700,7 +15969,8 @@ function findMountPathProblem(mountPath) {
15700
15969
  if (mountPath.length === 0) return "empty";
15701
15970
  for (const segment of mountPath.split(".")) {
15702
15971
  if (segment.length === 0) return "emptySegment";
15703
- if (segment === "*") return "wildcard";
15972
+ if (segment.includes("*")) return "wildcard";
15973
+ if (/\s/.test(segment)) return "whitespace";
15704
15974
  if (segment.includes("$") || segment.includes("#") || segment.includes("@")) return "reserved";
15705
15975
  }
15706
15976
  return null;
@@ -15832,8 +16102,8 @@ function validateVolumeBlock2(block, mountPath, msgs, out) {
15832
16102
  }
15833
16103
  function validateBindComponentSource(html, tagStart, tagEnd, hasInlineScript, msgs, out) {
15834
16104
  const tag = html.slice(tagStart, tagEnd);
15835
- const names = parseAttributeNames(tag);
15836
- const sources = BIND_COMPONENT_SOURCE_ATTRIBUTES.filter((name) => names.has(name));
16105
+ const names2 = parseAttributeNames(tag);
16106
+ const sources = BIND_COMPONENT_SOURCE_ATTRIBUTES.filter((name) => names2.has(name));
15837
16107
  if (hasInlineScript) sources.push('<script type="module">');
15838
16108
  if (sources.length === 0) return;
15839
16109
  const prop = /\sbind-component\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>`=]+))/i.exec(tag);
@@ -15961,7 +16231,7 @@ var OLD_DECLARATION_KEY = /(^|[{,;\s])(\$streams|\$updatedCallback)(?=\s*(?:[:(]
15961
16231
  function collectDeclarationAliasReads(script) {
15962
16232
  return collectStateThisReads(script, OLD_DECLARATION_MEMBER_NAMES);
15963
16233
  }
15964
- function collectStateThisReads(script, names) {
16234
+ function collectStateThisReads(script, names2) {
15965
16235
  if (!hasDefaultExportObject(script)) return null;
15966
16236
  const out = [];
15967
16237
  const take = (refs, base) => {
@@ -15970,10 +16240,10 @@ function collectStateThisReads(script, names) {
15970
16240
  return true;
15971
16241
  };
15972
16242
  for (const callable of analyzeCallableBodies(script)) {
15973
- if (!take(collectThisMemberRefs(callable.body, names), callable.bodyStart)) return null;
16243
+ if (!take(collectThisMemberRefs(callable.body, names2), callable.bodyStart)) return null;
15974
16244
  }
15975
16245
  for (const handler of analyzeWatchHandlerSources(script)) {
15976
- const refs = handler.kind === "body" ? collectThisMemberRefs(handler.text, names) : collectThisMemberRefsInValue(handler.text, names);
16246
+ const refs = handler.kind === "body" ? collectThisMemberRefs(handler.text, names2) : collectThisMemberRefsInValue(handler.text, names2);
15977
16247
  if (!take(refs, handler.start)) return null;
15978
16248
  }
15979
16249
  out.sort((a, b) => a.start - b.start);
@@ -16072,7 +16342,7 @@ function validateIndexArity(script, scriptStart, locale2) {
16072
16342
  start: scriptStart + parsed.starts[1] + leading,
16073
16343
  end: scriptStart + parsed.starts[1] + argText.trimEnd().length,
16074
16344
  message: msgs.indexArity(api, path, requirement, wildcardCount, actual),
16075
- severity: "warning"
16345
+ severity: "error"
16076
16346
  });
16077
16347
  }
16078
16348
  return out;
@@ -16128,7 +16398,7 @@ function validateGetterCycles(script, scriptStart, locale2) {
16128
16398
  start: scriptStart + getter.start,
16129
16399
  end: scriptStart + getter.end,
16130
16400
  message: msgs.getterCycle(cycle),
16131
- severity: "warning"
16401
+ severity: "error"
16132
16402
  });
16133
16403
  }
16134
16404
  return out;
@@ -16181,6 +16451,26 @@ function validateGetterLocationReads(script, scriptStart, locale2) {
16181
16451
  }
16182
16452
  return out;
16183
16453
  }
16454
+ var CLOCK_READ = /\bDate\s*\.\s*now\s*\(|\bnew\s+Date\s*\(\s*\)|\bperformance\s*\.\s*now\s*\(/;
16455
+ function validateGetterClockReads(script, scriptStart, locale2) {
16456
+ if (!/Date|performance/.test(script)) return [];
16457
+ const msgs = getMessages(locale2);
16458
+ const out = [];
16459
+ for (const getter of analyzeCallableBodies(script)) {
16460
+ if (getter.kind !== "getter" || getter.accessor !== "get") continue;
16461
+ const read = CLOCK_READ.exec(maskCommentsAndStrings(getter.body));
16462
+ if (read === null) continue;
16463
+ const text3 = read[0].startsWith("new") ? "new Date()" : read[0].startsWith("performance") ? "performance.now()" : "Date.now()";
16464
+ out.push({
16465
+ code: WcsDiagnosticCode.GetterUntrackedRead,
16466
+ start: scriptStart + getter.bodyStart + read.index,
16467
+ end: scriptStart + getter.bodyStart + read.index + read[0].length,
16468
+ message: msgs.getterReadsClock(text3),
16469
+ severity: "warning"
16470
+ });
16471
+ }
16472
+ return out;
16473
+ }
16184
16474
  function onHandlerStateParam(script, handler) {
16185
16475
  if (handler.kind === "body") {
16186
16476
  const head = script.slice(Math.max(0, handler.start - 400), handler.start);
@@ -16240,7 +16530,7 @@ function validateInputNestedWrites(html, stateTagName, bindAttrName, nestedWrite
16240
16530
  code: WcsDiagnosticCode.InputNestedWrite,
16241
16531
  start: occ.pathRange.start,
16242
16532
  end: occ.pathRange.end,
16243
- severity: "warning",
16533
+ severity: "error",
16244
16534
  tag: tag.tagName,
16245
16535
  statePath: occ.path,
16246
16536
  message
@@ -16378,15 +16668,22 @@ function validateUpdatedCallbackDemand(html, stateTagName, bindAttrName, locale2
16378
16668
  const reported = /* @__PURE__ */ new Set();
16379
16669
  while ((match = PATH_TEST_LITERAL.exec(body)) !== null) {
16380
16670
  const path = match[2];
16381
- if (path.length === 0 || !declared.has(path) || bound.has(path)) continue;
16382
- if (reported.has(path)) continue;
16671
+ if (path.length === 0 || bound.has(path) || reported.has(path)) continue;
16672
+ let message;
16673
+ if (declared.has(path)) {
16674
+ message = msgs.updatedCallbackUnbound(path);
16675
+ } else {
16676
+ const near = suggestion(path, [...declared, ...bound], msgs);
16677
+ if (near === "") continue;
16678
+ message = msgs.updatedCallbackUnknownPath(path) + near;
16679
+ }
16383
16680
  reported.add(path);
16384
16681
  const quoteAt = match.index + match[0].length - path.length - 1;
16385
16682
  out.push({
16386
16683
  code: WcsDiagnosticCode.UpdatedCallbackUnbound,
16387
16684
  start: block.contentStart + callback.bodyStart + quoteAt,
16388
16685
  end: block.contentStart + callback.bodyStart + quoteAt + path.length,
16389
- message: msgs.updatedCallbackUnbound(path),
16686
+ message,
16390
16687
  severity: "warning"
16391
16688
  });
16392
16689
  }
@@ -16399,8 +16696,8 @@ function collectBoundPaths(html, stateTagName, bindAttrName) {
16399
16696
  for (const occurrence of index.occurrences) {
16400
16697
  bound.add(occurrence.path);
16401
16698
  if (!occurrence.path.startsWith(".")) continue;
16402
- const forPath = getInnermostForPath(html, occurrence.pathRange.start, bindAttrName);
16403
- if (forPath === null || forPath.startsWith(".")) continue;
16699
+ const forPath = getResolvedForListPath(html, occurrence.pathRange.start, bindAttrName);
16700
+ if (forPath === null) continue;
16404
16701
  bound.add(
16405
16702
  occurrence.path === "." ? `${forPath}.*` : `${forPath}.*.${occurrence.path.slice(1)}`
16406
16703
  );
@@ -16473,6 +16770,7 @@ function validateSemantics(html, stateTagName = "wcs-state", locale2, bindAttrNa
16473
16770
  out.push(...validateGetterCycles(block.content, block.contentStart, locale2));
16474
16771
  out.push(...validateGetterUntrackedReads(block.content, block.contentStart, getNestedWriteRoots, locale2));
16475
16772
  out.push(...validateGetterLocationReads(block.content, block.contentStart, locale2));
16773
+ out.push(...validateGetterClockReads(block.content, block.contentStart, locale2));
16476
16774
  out.push(...validateOnHandlerThis(block.content, block.contentStart, locale2));
16477
16775
  out.push(...validateInPlaceChanges(block.content, block.contentStart, locale2));
16478
16776
  }
@@ -16481,6 +16779,169 @@ function validateSemantics(html, stateTagName = "wcs-state", locale2, bindAttrNa
16481
16779
  return out;
16482
16780
  }
16483
16781
 
16782
+ // src/service/scriptStateUseValidator.ts
16783
+ var COMMAND_USE = /\.\s*\$command\s*\.\s*([A-Za-z_$][\w$]*)/dg;
16784
+ var EMIT_AFTER = /^\s*\.\s*emit\s*\(/;
16785
+ var THIS_WRITE = /\bthis\s*\.\s*([A-Za-z_][\w$]*)\s*(?:=(?![=>])|[-+*/%&|^]=|\*\*=|<<=|>>>?=|&&=|\|\|=|\?\?=|\+\+|--)/dg;
16786
+ var PRE_THIS_WRITE = /(?:\+\+|--)\s*this\s*\.\s*([A-Za-z_][\w$]*)/dg;
16787
+ function validateScriptStateUses(html, stateTagName = "wcs-state", locale2, bindAttrName = "data-wcs") {
16788
+ const blocks = parseLoadedScriptBlocks(html, stateTagName).filter((block) => isReadableStateScript(block.content));
16789
+ if (blocks.length === 0) return [];
16790
+ const msgs = getMessages(locale2);
16791
+ const out = [];
16792
+ let receivers = null;
16793
+ let markupEmits = null;
16794
+ const bindings = () => {
16795
+ if (receivers !== null) return;
16796
+ receivers = /* @__PURE__ */ new Set();
16797
+ markupEmits = /* @__PURE__ */ new Map();
16798
+ for (const o of buildReferenceIndex(html, { bindAttribute: bindAttrName, stateTagName }).occurrences) {
16799
+ if (!o.path.startsWith("$command.")) continue;
16800
+ const name = o.path.slice("$command.".length);
16801
+ const prop = o.propName ?? "";
16802
+ if (prop.startsWith("command.")) receivers.add(name);
16803
+ else if (prop.startsWith("on") && !markupEmits.has(name)) markupEmits.set(name, o.pathRange);
16804
+ }
16805
+ };
16806
+ for (const block of blocks) {
16807
+ const paths = analyzeStatePaths(block.content);
16808
+ const masked = maskCommentsAndStrings(block.content);
16809
+ const declared = paths.filter((p) => p.kind === "command").map((p) => p.path.slice("$command.".length));
16810
+ if (block.mountPath === null && declared.length > 0) {
16811
+ const emitted = /* @__PURE__ */ new Map();
16812
+ COMMAND_USE.lastIndex = 0;
16813
+ let match;
16814
+ while ((match = COMMAND_USE.exec(masked)) !== null) {
16815
+ const name = match[1];
16816
+ const [start, end] = match.indices[1];
16817
+ if (!declared.includes(name)) {
16818
+ out.push({
16819
+ code: WcsDiagnosticCode.TokenUndeclared,
16820
+ start: block.contentStart + start,
16821
+ end: block.contentStart + end,
16822
+ // `$command` holds the declared tokens only: `.emit()` on what it lacks is a TypeError
16823
+ message: msgs.commandTokenUndeclared(`$command.${name}`) + suggestion(name, declared, msgs),
16824
+ severity: "error"
16825
+ });
16826
+ } else if (!emitted.has(name) && EMIT_AFTER.test(masked.slice(match.index + match[0].length))) {
16827
+ emitted.set(name, { start: block.contentStart + start, end: block.contentStart + end });
16828
+ }
16829
+ }
16830
+ bindings();
16831
+ for (const name of declared) {
16832
+ if (receivers.has(name)) continue;
16833
+ const at2 = emitted.get(name) ?? markupEmits.get(name);
16834
+ if (at2 === void 0) continue;
16835
+ out.push({
16836
+ code: WcsDiagnosticCode.CommandTokenUnbound,
16837
+ start: at2.start,
16838
+ end: at2.end,
16839
+ message: msgs.commandTokenUnbound(`$command.${name}`),
16840
+ severity: "warning"
16841
+ });
16842
+ }
16843
+ }
16844
+ const keys = [...new Set(paths.map((p) => p.path.split(".")[0]).filter((key) => key !== "" && !key.startsWith("$")))];
16845
+ const reported = /* @__PURE__ */ new Set();
16846
+ for (const pattern of [THIS_WRITE, PRE_THIS_WRITE]) {
16847
+ pattern.lastIndex = 0;
16848
+ let match;
16849
+ while ((match = pattern.exec(masked)) !== null) {
16850
+ const key = match[1];
16851
+ if (keys.includes(key) || reported.has(key)) continue;
16852
+ const near = suggestion(key, keys, msgs);
16853
+ if (near === "") continue;
16854
+ reported.add(key);
16855
+ const [start, end] = match.indices[1];
16856
+ out.push({
16857
+ code: WcsDiagnosticCode.WritePathMissing,
16858
+ start: block.contentStart + start,
16859
+ end: block.contentStart + end,
16860
+ message: msgs.writePathMissing(key) + near,
16861
+ severity: "warning"
16862
+ });
16863
+ }
16864
+ }
16865
+ }
16866
+ return out;
16867
+ }
16868
+
16869
+ // src/service/scriptReadValidator.ts
16870
+ function validateScriptReads(html, stateTagName = "wcs-state", locale2, fileReader, applicationSchema) {
16871
+ const blocks = parseLoadedScriptBlocks(html, stateTagName);
16872
+ if (blocks.length === 0) return [];
16873
+ const msgs = getMessages(locale2);
16874
+ const index = getStatePathIndex(html, stateTagName, fileReader);
16875
+ const candidates = mergeSchemaCandidates(index.paths, applicationSchema);
16876
+ const candidateSet = new Set(candidates.map((p) => p.path));
16877
+ let tree = null;
16878
+ const out = [];
16879
+ for (const block of blocks) {
16880
+ const spread = applicationSchema === void 0 ? findTopLevelSpread(block.content) : null;
16881
+ if (spread !== null) {
16882
+ out.push({
16883
+ code: WcsDiagnosticCode.PathDynamicUnknown,
16884
+ start: block.contentStart + spread.start,
16885
+ end: block.contentStart + spread.end,
16886
+ message: msgs.pathDynamicUnknownSpread(block.content.slice(spread.start, spread.end)),
16887
+ severity: "info"
16888
+ });
16889
+ }
16890
+ const prefix = block.mountPath === null || block.mountPath === "" ? "" : `${block.mountPath}.`;
16891
+ for (const callable of analyzeCallableBodies(block.content)) {
16892
+ for (const read of collectGetterReads(callable.body) ?? []) {
16893
+ if (read.written || read.path.split(".").some((s) => s === "" || s.startsWith("$")) || hasRecursionWildcard(read.path)) continue;
16894
+ const path = prefix + read.path;
16895
+ if (pathExistsInCandidates(path, candidates, candidateSet)) continue;
16896
+ if (applicationSchema !== void 0 ? resolveIndexedSchemaPath(applicationSchema, path).kind !== "nonexistent" : isUnresolvedPath(path, index.scopes)) continue;
16897
+ const near = nearName(path, tree ??= treeOf(candidates));
16898
+ if (near === null) continue;
16899
+ const said = suggestion(near.segment, near.names, msgs);
16900
+ if (said === "") continue;
16901
+ const at2 = block.contentStart + callable.bodyStart;
16902
+ out.push({
16903
+ code: WcsDiagnosticCode.ReadPathMissing,
16904
+ start: at2 + read.start,
16905
+ end: read.form === "member" ? at2 + read.start + statePart(callable.body.slice(read.start, read.end)) : at2 + read.end,
16906
+ message: msgs.readPathMissing(read.path, !read.path.includes(".")) + said,
16907
+ // a stateSchema says the path is not there, as for a binding's `wcs/path-nonexistent`
16908
+ severity: applicationSchema !== void 0 ? "error" : "warning"
16909
+ });
16910
+ }
16911
+ }
16912
+ }
16913
+ return out;
16914
+ }
16915
+ var THIS_PART = /^this\s*(?:\?\.\s*|\.\s*)(?:[A-Za-z_$][\w$]*)|^this\s*(?:\?\.)?\s*\[\s*(["'`])[^"'`]*\1\s*\]/;
16916
+ function statePart(text3) {
16917
+ return THIS_PART.exec(text3)?.[0].length ?? text3.length;
16918
+ }
16919
+ function treeOf(candidates) {
16920
+ const tree = /* @__PURE__ */ new Map();
16921
+ for (const c of candidates) {
16922
+ let parent = "";
16923
+ for (const segment of c.path.split(".")) {
16924
+ let names2 = tree.get(parent);
16925
+ if (names2 === void 0) tree.set(parent, names2 = /* @__PURE__ */ new Set());
16926
+ names2.add(segment);
16927
+ parent = parent === "" ? segment : `${parent}.${segment}`;
16928
+ }
16929
+ }
16930
+ return tree;
16931
+ }
16932
+ function nearName(path, tree) {
16933
+ let parent = "";
16934
+ for (const segment of (hasIndexSegment(path) ? toWildcardForm(path) : path).split(".")) {
16935
+ const names2 = tree.get(parent);
16936
+ if (names2?.has(segment)) {
16937
+ parent = parent === "" ? segment : `${parent}.${segment}`;
16938
+ continue;
16939
+ }
16940
+ return { segment, names: [...names2 ?? []].filter((name) => name !== "*" && !name.startsWith("$")) };
16941
+ }
16942
+ return null;
16943
+ }
16944
+
16484
16945
  // src/core/sidecar/jsonSource.ts
16485
16946
  var JsonReader = class {
16486
16947
  constructor(text3) {
@@ -16868,13 +17329,104 @@ function joinRelativeSource(htmlSource, relativePath) {
16868
17329
  return dirSegments.join("/");
16869
17330
  }
16870
17331
 
17332
+ // src/core/externalState.ts
17333
+ var OPEN = '<script type="module">';
17334
+ var CLOSE = "</script>";
17335
+ function inlineExternalStates(html, stateTagName, fileReader) {
17336
+ let text3 = "";
17337
+ let from = 0;
17338
+ let shift = 0;
17339
+ const states = [];
17340
+ for (const element2 of parseWcsStateElements(html, stateTagName)) {
17341
+ const src = element2.srcSpan;
17342
+ if (src === void 0 || element2.srcAttr === void 0 || element2.stateAttr !== void 0 || element2.bindComponent) continue;
17343
+ const file = readStateScriptFile(element2.srcAttr, fileReader);
17344
+ if (file === void 0) continue;
17345
+ const blanks = [src];
17346
+ if (element2.jsonSpan !== void 0) blanks.push(element2.jsonSpan);
17347
+ blanks.sort((a, b) => a.start - b.start);
17348
+ for (const span of blanks) {
17349
+ text3 += html.slice(from, span.start) + " ".repeat(span.end - span.start);
17350
+ from = span.end;
17351
+ }
17352
+ text3 += html.slice(from, element2.tagEnd);
17353
+ from = element2.tagEnd;
17354
+ const content = file.text.replace(/<\/(script)/gi, "<\\$1");
17355
+ const at2 = element2.tagEnd + shift;
17356
+ const length = OPEN.length + content.length + CLOSE.length;
17357
+ text3 += OPEN + content + CLOSE;
17358
+ states.push({
17359
+ path: file.path,
17360
+ text: file.text,
17361
+ at: at2,
17362
+ contentAt: at2 + OPEN.length,
17363
+ length,
17364
+ valueStart: src.valueStart,
17365
+ valueEnd: src.valueEnd,
17366
+ position: createPositionMapper(file.text)
17367
+ });
17368
+ shift += length;
17369
+ }
17370
+ if (states.length === 0) return null;
17371
+ return { text: text3 + html.slice(from), states };
17372
+ }
17373
+ function locateInlined(page, offset2) {
17374
+ let shift = 0;
17375
+ for (const state of page.states) {
17376
+ if (offset2 < state.at) break;
17377
+ if (offset2 < state.at + state.length) {
17378
+ return { state, offset: Math.min(Math.max(offset2 - state.contentAt, 0), state.text.length) };
17379
+ }
17380
+ shift += state.length;
17381
+ }
17382
+ return { offset: offset2 - shift };
17383
+ }
17384
+
16871
17385
  // src/core/validateDocument.ts
16872
17386
  function validateDocument(text3, options = {}) {
17387
+ const stateTagName = options.stateTagName ?? "wcs-state";
17388
+ const fileReader = options.fileReader;
17389
+ const applicationSchema = options.applicationSchema ?? (fileReader !== void 0 ? discoverApplicationManifest(fileReader)?.schema : void 0);
17390
+ const found = validateText(text3, options, applicationSchema);
17391
+ const page = fileReader === void 0 ? null : inlineExternalStates(text3, stateTagName, fileReader);
17392
+ if (page === null) return found;
17393
+ const key = (d) => [d.code, d.start, d.end, d.message, d.origin?.path, d.origin?.start].join("\0");
17394
+ const seen2 = new Set(found.map(key));
17395
+ const out = [...found];
17396
+ for (const d of validateText(page.text, options, applicationSchema)) {
17397
+ const start = locateInlined(page, d.start);
17398
+ const end = locateInlined(page, d.end);
17399
+ let mapped;
17400
+ if (start.state !== void 0) {
17401
+ const state = start.state;
17402
+ const fileEnd = end.state === state ? Math.max(end.offset, start.offset) : start.offset;
17403
+ mapped = {
17404
+ ...d,
17405
+ start: state.valueStart,
17406
+ end: state.valueEnd,
17407
+ origin: {
17408
+ path: state.path,
17409
+ start: start.offset,
17410
+ end: fileEnd,
17411
+ startPosition: state.position(start.offset),
17412
+ endPosition: state.position(fileEnd)
17413
+ }
17414
+ };
17415
+ } else {
17416
+ mapped = { ...d, start: start.offset, end: end.state === void 0 ? Math.max(end.offset, start.offset) : start.offset };
17417
+ }
17418
+ const k = key(mapped);
17419
+ if (seen2.has(k)) continue;
17420
+ seen2.add(k);
17421
+ out.push(mapped);
17422
+ }
17423
+ return sortDiagnostics(out);
17424
+ }
17425
+ function validateText(text3, options, applicationSchema) {
16873
17426
  const bindAttribute = options.bindAttribute ?? "data-wcs";
16874
17427
  const stateTagName = options.stateTagName ?? "wcs-state";
16875
17428
  const locale2 = options.locale;
16876
17429
  const fileReader = options.fileReader;
16877
- const applicationSchema = options.applicationSchema ?? (fileReader !== void 0 ? discoverApplicationManifest(fileReader)?.schema : void 0);
16878
17430
  const out = [];
16879
17431
  out.push(...validateBindings(text3, bindAttribute, stateTagName, locale2, fileReader, applicationSchema));
16880
17432
  out.push(...validateTemplateSyntax(text3, stateTagName, bindAttribute, locale2, fileReader, applicationSchema));
@@ -16883,6 +17435,8 @@ function validateDocument(text3, options = {}) {
16883
17435
  out.push(...validateAriaAttributes(text3, bindAttribute, locale2));
16884
17436
  out.push(...validateDocumentEnv(text3, locale2));
16885
17437
  out.push(...validateSemantics(text3, stateTagName, locale2, bindAttribute));
17438
+ out.push(...validateScriptStateUses(text3, stateTagName, locale2, bindAttribute));
17439
+ out.push(...validateScriptReads(text3, stateTagName, locale2, fileReader, applicationSchema));
16886
17440
  out.push(...validateArrayMutations(text3, stateTagName, locale2));
16887
17441
  out.push(...validateWatchDeclarations(text3, stateTagName, locale2, fileReader));
16888
17442
  out.push(...validateScanDeclarations(text3, stateTagName, locale2));
@@ -16897,7 +17451,9 @@ function validateDocument(text3, options = {}) {
16897
17451
  for (const d of validateNestedAssigns(text3, stateTagName, locale2)) {
16898
17452
  out.push({ code: WcsDiagnosticCode.NestedAssign, start: d.start, end: d.end, message: d.message, severity: d.severity });
16899
17453
  }
16900
- return sortDiagnostics(out);
17454
+ const ignored = findIgnoredRanges(text3, bindAttribute);
17455
+ const kept = ignored.length === 0 ? out : out.filter((d) => !ignored.some(([start, end]) => d.start >= start && d.start < end));
17456
+ return sortDiagnostics(kept);
16901
17457
  }
16902
17458
 
16903
17459
  // src/core/sidecar/drift.ts
@@ -17052,6 +17608,7 @@ function runValidation(inputs, options = {}) {
17052
17608
  explicitSchema = result.resolvedSchema;
17053
17609
  }
17054
17610
  }
17611
+ const inFiles = /* @__PURE__ */ new Map();
17055
17612
  for (const input of inputs) {
17056
17613
  if (input.kind !== "html") continue;
17057
17614
  let applicationSchema = explicitSchema;
@@ -17071,8 +17628,24 @@ function runValidation(inputs, options = {}) {
17071
17628
  ...input.fileReader !== void 0 ? { fileReader: input.fileReader } : {},
17072
17629
  ...applicationSchema !== void 0 ? { applicationSchema } : {}
17073
17630
  };
17074
- diagnosticsBySource.set(input.source, validateDocument(input.text, docOptions));
17631
+ const own2 = [];
17632
+ for (const d of validateDocument(input.text, docOptions)) {
17633
+ if (d.origin === void 0) {
17634
+ own2.push(d);
17635
+ continue;
17636
+ }
17637
+ const source = joinRelativeSource(input.source, d.origin.path);
17638
+ if (!textBySource.has(source)) textBySource.set(source, input.fileReader?.(d.origin.path) ?? "");
17639
+ let list = inFiles.get(source);
17640
+ if (list === void 0) inFiles.set(source, list = []);
17641
+ const { origin, ...rest } = d;
17642
+ if (!list.some((x) => x.code === d.code && x.start === origin.start && x.end === origin.end && x.message === d.message)) {
17643
+ list.push({ ...rest, start: origin.start, end: origin.end });
17644
+ }
17645
+ }
17646
+ diagnosticsBySource.set(input.source, own2);
17075
17647
  }
17648
+ for (const [source, list] of inFiles) diagnosticsBySource.set(source, sortDiagnostics(list));
17076
17649
  const lines = [];
17077
17650
  let errorCount = 0;
17078
17651
  let warningCount = 0;