@wcstack/typescript 4.4.0 → 4.6.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/index.esm.js +1 -1
- package/dist/schema-core.cjs +42 -3
- package/dist/wcs-schema.mjs +1 -1
- package/dist/wcs-tsc.mjs +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
package/dist/schema-core.cjs
CHANGED
|
@@ -178,6 +178,11 @@ var WcsDiagnosticCode = {
|
|
|
178
178
|
// 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)。4.0 のランタイムは #38 / #1203 /
|
|
179
179
|
// #1204 で拒み、root では初期化が、行では束縛が失敗する(3.x の「黙って無視」ではない)。error。
|
|
180
180
|
TagMemberUnknown: "wcs/tag-member-unknown",
|
|
181
|
+
// `semantics: "handle"` の出力(`<wcs-camera>` の `streamReady` = 生の MediaStream)を、値としてパスに
|
|
182
|
+
// 束ねた。プロトコルは「値の置き場ではなく ref / callback で受ける」と定める(protocol/wc-bindable.ts)。
|
|
183
|
+
// ランタイムは書くので動くが、スナップショット・DevTools・SSR に載らないオブジェクトが state に入る
|
|
184
|
+
// (docs/seam-apps.md、state-field-report)。warning。5.0 でランタイムが拒むかは誤りの目録の議題。
|
|
185
|
+
HandleBoundAsValue: "wcs/handle-bound-as-value",
|
|
181
186
|
// タグのメンバー名が "on" で始まる(`once` 等)のに先頭ドット無しで束縛した: ランタイムはイベント束縛にして
|
|
182
187
|
// "ce" イベントを待ち、値は届かない。明示のプロパティ形 `.once:` を提案する(@wcstack/state 3.1・要件 B5 / 3.x 計画 D36)
|
|
183
188
|
OnPrefixedMember: "wcs/on-prefixed-member",
|
|
@@ -3847,7 +3852,7 @@ function readBase(expr, scan, aliases, paths) {
|
|
|
3847
3852
|
if (alias === null) return null;
|
|
3848
3853
|
if (alias[1] !== "this") {
|
|
3849
3854
|
const shape = aliases.get(alias[1]);
|
|
3850
|
-
return shape
|
|
3855
|
+
return { shape: shape ?? OPAQUE, rest: alias[1].length };
|
|
3851
3856
|
}
|
|
3852
3857
|
const segments = [];
|
|
3853
3858
|
let i = 4;
|
|
@@ -3872,6 +3877,7 @@ function readBase(expr, scan, aliases, paths) {
|
|
|
3872
3877
|
break;
|
|
3873
3878
|
}
|
|
3874
3879
|
const path = segments.join(".");
|
|
3880
|
+
if (path === "" && /^\s*\??\.\s*\$[$\w]*\s*\(/.test(scan.slice(4))) return { shape: OPAQUE, rest: 4 };
|
|
3875
3881
|
if (path === "" || path.startsWith("$")) return null;
|
|
3876
3882
|
return {
|
|
3877
3883
|
shape: { isList: hasPath(paths, `${path}.*`), mirrors: [{ from: path, to: "" }], fields: [] },
|
|
@@ -3882,12 +3888,25 @@ function applyChain(expr, scan, start, initial) {
|
|
|
3882
3888
|
let shape = initial;
|
|
3883
3889
|
let i = start;
|
|
3884
3890
|
while (scan.slice(i).trim() !== "") {
|
|
3891
|
+
if (shape.opaque && /^\s*\(/.test(scan.slice(i))) {
|
|
3892
|
+
const open2 = scan.indexOf("(", i);
|
|
3893
|
+
i = open2 + extractDelimitedContent(expr, scan, open2, "(", ")").length + 2;
|
|
3894
|
+
continue;
|
|
3895
|
+
}
|
|
3885
3896
|
const call = /^\s*\??\.\s*([$\w]+)\s*\(/.exec(scan.slice(i));
|
|
3886
3897
|
if (call === null) return null;
|
|
3887
3898
|
const open = i + call[0].length - 1;
|
|
3888
3899
|
const args = extractDelimitedContent(expr, scan, open, "(", ")");
|
|
3889
3900
|
i = open + args.length + 2;
|
|
3890
3901
|
const method = call[1];
|
|
3902
|
+
if (shape.opaque) {
|
|
3903
|
+
if (method === "map") {
|
|
3904
|
+
const mapped = mapRows(args, shape);
|
|
3905
|
+
if (mapped === null) return null;
|
|
3906
|
+
shape = mapped;
|
|
3907
|
+
}
|
|
3908
|
+
continue;
|
|
3909
|
+
}
|
|
3891
3910
|
if (ROW_PRESERVING_METHODS.has(method)) {
|
|
3892
3911
|
if (!shape.isList) return null;
|
|
3893
3912
|
} else if (ROW_PICKING_METHODS.has(method)) {
|
|
@@ -3902,8 +3921,9 @@ function applyChain(expr, scan, start, initial) {
|
|
|
3902
3921
|
return null;
|
|
3903
3922
|
}
|
|
3904
3923
|
}
|
|
3905
|
-
return shape;
|
|
3924
|
+
return shape.opaque ? null : shape;
|
|
3906
3925
|
}
|
|
3926
|
+
var OPAQUE = { isList: true, mirrors: [], fields: [], opaque: true };
|
|
3907
3927
|
function pickRow(shape) {
|
|
3908
3928
|
return {
|
|
3909
3929
|
isList: false,
|
|
@@ -3914,7 +3934,7 @@ function pickRow(shape) {
|
|
|
3914
3934
|
function mapRows(args, shape) {
|
|
3915
3935
|
const [callback] = splitTopLevelElements(args);
|
|
3916
3936
|
if (callback === void 0) return null;
|
|
3917
|
-
const head = /^(?:async\s+)?(?:function\b[^(]*\(\s*([$\w]+)[^)]*\)|\(\s*([$\w]+)[^)]*\)|([$\w]+))\s*(=>)?\s*/.exec(callback);
|
|
3937
|
+
const head = /^(?:async\s+)?(?:function\b[^(]*\(\s*([$\w]+)?[^)]*\)|\(\s*([$\w]+)?[^)]*\)|([$\w]+))\s*(=>)?\s*/.exec(callback);
|
|
3918
3938
|
if (head === null) return null;
|
|
3919
3939
|
const param = head[1] ?? head[2] ?? head[3];
|
|
3920
3940
|
const body = callback.slice(head[0].length);
|
|
@@ -11402,6 +11422,7 @@ var ja = {
|
|
|
11402
11422
|
nativeCommandUnknown: (method, tag, allowed) => `"${method}" \u306F\u30CD\u30A4\u30C6\u30A3\u30D6\u306E <${tag}> \u306B command \u3067\u547C\u3079\u308B\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u547C\u3079\u308B\u306E\u306F ${allowed}\u3002\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u521D\u671F\u5316\u3067 wcs/token-misconfigured \u3092\u6295\u3052\u307E\u3059\uFF09`,
|
|
11403
11423
|
spreadNoBindable: (tag) => `'...'\uFF08spread\uFF09\u306F <${tag}> \u306B\u6709\u52B9\u306A wcBindable \u5BA3\u8A00\u304C\u5FC5\u8981\u3067\u3059 \u2014 \u3053\u306E\u30BF\u30B0\u306F\u5BA3\u8A00\u3092\u6301\u305F\u306A\u3044\u305F\u3081\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30A8\u30E9\u30FC\u3092\u9001\u51FA\u3057\u307E\u3059`,
|
|
11404
11424
|
tagEventTokenKeyUnknown: (name, tag, declared) => `eventToken \u306E\u30AD\u30FC "${name}" \u306F <${tag}> \u306E wcBindable \u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u751F DOM \u30A4\u30D9\u30F3\u30C8\u540D\u306F\u767A\u706B\u3057\u307E\u305B\u3093 \u2014 \u30D7\u30ED\u30D1\u30C6\u30A3\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u6E08\u307F: ${declared}\uFF09`,
|
|
11425
|
+
handleBoundAsValue: (name, tag) => `<${tag}> \u306E "${name}" \u306F\u751F\u304D\u305F\u30EA\u30BD\u30FC\u30B9\uFF08\u30CF\u30F3\u30C9\u30EB\uFF09\u3067\u3001\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002state \u306E\u30D1\u30B9\u306B\u675F\u306D\u308B\u3068\u3001\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3084 SSR \u306B\u8F09\u3089\u306A\u3044\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C state \u306B\u5165\u308A\u307E\u3059 \u2014 eventToken.${name}: \u3067\u53D7\u3051\u3001\u30B3\u30DE\u30F3\u30C9\u306E\u5F15\u6570\u3068\u3057\u3066\u6B21\u306E\u8981\u7D20\u3078\u76F4\u63A5\u6E21\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
11405
11426
|
ariaAttrUnknown: (name) => `"${name}" \u306F WAI-ARIA \u306E\u5C5E\u6027\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002setAttribute \u306F\u305D\u306E\u307E\u307E\u66F8\u304D\u8FBC\u307F\u307E\u3059\u304C\u3001\u652F\u63F4\u6280\u8853\u306B\u306F\u9ED9\u3063\u3066\u7121\u8996\u3055\u308C\u307E\u3059`,
|
|
11406
11427
|
didYouMean: (c) => `\u3002\u3082\u3057\u304B\u3057\u3066: "${c}"`,
|
|
11407
11428
|
none: () => `\u306A\u3057`,
|
|
@@ -11610,6 +11631,7 @@ var en = {
|
|
|
11610
11631
|
nativeCommandUnknown: (method, tag, allowed) => `"${method}" is not a command of a native <${tag}> (its commands: ${allowed}; the runtime throws wcs/token-misconfigured at initialization)`,
|
|
11611
11632
|
spreadNoBindable: (tag) => `'...' (spread) requires <${tag}> to expose a valid wcBindable declaration \u2014 this tag declares none, so the runtime raises an error`,
|
|
11612
11633
|
tagEventTokenKeyUnknown: (name, tag, declared) => `eventToken key "${name}" is not a wcBindable property of <${tag}>. Raw DOM event names never fire \u2014 use the property name (declared: ${declared})`,
|
|
11634
|
+
handleBoundAsValue: (name, tag) => `"${name}" of <${tag}> is a live resource (a handle), not a value. Bound to a state path, it puts an object no snapshot or SSR can carry into the state \u2014 receive it with eventToken.${name}: and hand it to the next element as a command argument`,
|
|
11613
11635
|
ariaAttrUnknown: (name) => `"${name}" is not a WAI-ARIA attribute. setAttribute writes it anyway, and assistive technology silently ignores it`,
|
|
11614
11636
|
didYouMean: (c) => `. Did you mean "${c}"?`,
|
|
11615
11637
|
none: () => `none`,
|
|
@@ -13534,6 +13556,9 @@ var BUILTIN_TAGS = {
|
|
|
13534
13556
|
"start",
|
|
13535
13557
|
"stop",
|
|
13536
13558
|
"switchCamera"
|
|
13559
|
+
],
|
|
13560
|
+
"handles": [
|
|
13561
|
+
"streamReady"
|
|
13537
13562
|
]
|
|
13538
13563
|
},
|
|
13539
13564
|
"wcs-recorder": {
|
|
@@ -14261,10 +14286,12 @@ var BUILTIN_TAGS = {
|
|
|
14261
14286
|
"hasWcBindable": true,
|
|
14262
14287
|
"observedAttributes": [
|
|
14263
14288
|
"key",
|
|
14289
|
+
"storage-key",
|
|
14264
14290
|
"type"
|
|
14265
14291
|
],
|
|
14266
14292
|
"inputs": {
|
|
14267
14293
|
"key": null,
|
|
14294
|
+
"storageKey": null,
|
|
14268
14295
|
"type": null,
|
|
14269
14296
|
"value": null,
|
|
14270
14297
|
"manual": null,
|
|
@@ -14775,6 +14802,18 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
|
|
|
14775
14802
|
});
|
|
14776
14803
|
return;
|
|
14777
14804
|
}
|
|
14805
|
+
if (contract.handles?.includes(property)) {
|
|
14806
|
+
diagnostics.push({
|
|
14807
|
+
code: WcsDiagnosticCode.HandleBoundAsValue,
|
|
14808
|
+
start,
|
|
14809
|
+
end,
|
|
14810
|
+
severity: "warning",
|
|
14811
|
+
tag: tagName,
|
|
14812
|
+
member: property,
|
|
14813
|
+
message: msgs.handleBoundAsValue(property, tagName)
|
|
14814
|
+
});
|
|
14815
|
+
return;
|
|
14816
|
+
}
|
|
14778
14817
|
if (tagName.startsWith("wcs-") && property === "trigger" && "trigger" in contract.inputs && parsed.path) {
|
|
14779
14818
|
const cand = findDataSlot(getPaths(), parsed.path);
|
|
14780
14819
|
if (cand?.rawInitial === "true") {
|
package/dist/wcs-schema.mjs
CHANGED
package/dist/wcs-tsc.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/typescript",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "TypeScript tooling for wcstack apps: wcs-schema generates the sidecar stateSchema from a typed state file, so wcs-validate checks data-wcs paths against real types in CI and every editor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|