@wcstack/state 1.32.0 → 2.0.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.
@@ -47,12 +47,11 @@ interface IWcsManifest {
47
47
  pathDelimiter: string;
48
48
  /** ワイルドカード(`*`) */
49
49
  wildcard: string;
50
- /** バインディング構文 `[prop][#mod]: [path][@state][|filter...]` の区切り文字 */
50
+ /** バインディング構文 `[prop][#mod]: [path][|filter...]` の区切り文字 */
51
51
  delimiters: {
52
52
  binding: string;
53
53
  propValue: string;
54
54
  modifier: string;
55
- stateName: string;
56
55
  filter: string;
57
56
  };
58
57
  /** 構造ディレクティブ(`<template data-wcs="for: ...">` 等) */
@@ -1014,12 +1014,11 @@ const STRUCTURAL_BINDING_TYPE_SET = new Set([
1014
1014
  const DELIMITER = '.';
1015
1015
  const WILDCARD = '*';
1016
1016
  const MAX_WILDCARD_DEPTH = 128;
1017
- // data-wcs バインディング構文 `[prop][#mod]: [path][@state][|filter...]` の区切り文字(単一正本)。
1017
+ // data-wcs バインディング構文 `[prop][#mod]: [path][|filter...]` の区切り文字(単一正本・`@state` は v2 で撤去)。
1018
1018
  // これらは「死守の壁(構文契約)」であり値は不変。manifest.syntax.delimiters で公開される。
1019
1019
  const BINDING_SEPARATOR = ';'; // 複数バインディングの区切り
1020
1020
  const PROP_VALUE_SEPARATOR = ':'; // 左辺(prop)と右辺(path)の区切り
1021
1021
  const MODIFIER_SEPARATOR = '#'; // prop と修飾子の区切り
1022
- const STATE_NAME_SEPARATOR = '@'; // path と @stateName の区切り
1023
1022
  const FILTER_SEPARATOR = '|'; // フィルタパイプの区切り
1024
1023
  // 修飾子(`#` 後)の語彙(単一正本)。manifest.syntax.modifiers で公開される。
1025
1024
  // フラグ形(`#prevent` — 値を取らない)とキー値形(`#init=element` — `=` で値を取る)。
@@ -1111,7 +1110,6 @@ function getWcsManifest() {
1111
1110
  binding: BINDING_SEPARATOR,
1112
1111
  propValue: PROP_VALUE_SEPARATOR,
1113
1112
  modifier: MODIFIER_SEPARATOR,
1114
- stateName: STATE_NAME_SEPARATOR,
1115
1113
  filter: FILTER_SEPARATOR,
1116
1114
  },
1117
1115
  // 正本 STRUCTURAL_BINDING_TYPE_SET から導出(手書きの二重定義を排除)。
package/dist/parser.d.ts CHANGED
@@ -57,7 +57,6 @@ interface IParsedBinding {
57
57
  readonly propModifiers: string[];
58
58
  readonly statePathName: string;
59
59
  readonly statePathInfo: IPathInfo;
60
- readonly stateName: string;
61
60
  readonly inFilters: IFilterInfo[];
62
61
  readonly outFilters: IFilterInfo[];
63
62
  readonly bindingType: BindingType;
@@ -1,12 +1,11 @@
1
1
  const DELIMITER = '.';
2
2
  const WILDCARD = '*';
3
3
  const MAX_WILDCARD_DEPTH = 128;
4
- // data-wcs バインディング構文 `[prop][#mod]: [path][@state][|filter...]` の区切り文字(単一正本)。
4
+ // data-wcs バインディング構文 `[prop][#mod]: [path][|filter...]` の区切り文字(単一正本・`@state` は v2 で撤去)。
5
5
  // これらは「死守の壁(構文契約)」であり値は不変。manifest.syntax.delimiters で公開される。
6
6
  const BINDING_SEPARATOR = ';'; // 複数バインディングの区切り
7
7
  const PROP_VALUE_SEPARATOR = ':'; // 左辺(prop)と右辺(path)の区切り
8
8
  const MODIFIER_SEPARATOR = '#'; // prop と修飾子の区切り
9
- const STATE_NAME_SEPARATOR = '@'; // path と @stateName の区切り
10
9
  const FILTER_SEPARATOR = '|'; // フィルタパイプの区切り
11
10
  // bindingType 判別と左辺 namespace の語彙(単一正本)。manifest.syntax.bindingTypes で
12
11
  // 公開される。パーサ(parseBindTextsForElement)とイベント層はこの定数に分岐する。
@@ -1356,9 +1355,8 @@ const cacheFilterInfos = new Map();
1356
1355
  function clearStatePartCacheForTooling() {
1357
1356
  cacheFilterInfos.clear();
1358
1357
  }
1359
- // format: statePath@stateName|filter|filter
1358
+ // format: statePath|filter|filter
1360
1359
  // statePath-format: path.to.property (e.g., user.name.first, users.*.name, users.0.name, not include @)
1361
- // stateName: optional, default is 'default'
1362
1360
  // filters-format: filterName or filterName(arg1,arg2)
1363
1361
  function parseStatePart(statePart) {
1364
1362
  const pos = statePart.indexOf(FILTER_SEPARATOR);
@@ -1381,10 +1379,14 @@ function parseStatePart(statePart) {
1381
1379
  else {
1382
1380
  stateAndPath = statePart.trim();
1383
1381
  }
1384
- const [statePathName, stateName = 'default'] = stateAndPath.split(STATE_NAME_SEPARATOR).map(trimFn);
1382
+ if (stateAndPath.indexOf("@") !== -1) {
1383
+ // 名前次元は v2 で撤去(docs/state-mount-design.md D16 / §9)。パスは 1 本のツリー。
1384
+ raiseError(`"${stateAndPath}": the "@name" selector was removed in v2 — there is a single state tree. ` +
1385
+ `Mount the named state onto the tree (<wcs-state mount="...">) and read it by its path prefix instead.`);
1386
+ }
1387
+ const statePathName = stateAndPath;
1385
1388
  const pathInfo = getPathInfo(statePathName);
1386
1389
  return {
1387
- stateName,
1388
1390
  statePathName,
1389
1391
  statePathInfo: pathInfo,
1390
1392
  outFilters: filters,
@@ -1416,7 +1418,6 @@ function parseBindTextsForElement(bindText) {
1416
1418
  propModifiers: [],
1417
1419
  statePathName: '#else',
1418
1420
  statePathInfo: pathInfo,
1419
- stateName: '',
1420
1421
  inFilters: [],
1421
1422
  outFilters: [],
1422
1423
  bindingType: 'else',
@@ -9,7 +9,6 @@
9
9
  "binding": ";",
10
10
  "propValue": ":",
11
11
  "modifier": "#",
12
- "stateName": "@",
13
12
  "filter": "|"
14
13
  },
15
14
  "structuralDirectives": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/state",
3
- "version": "1.32.0",
3
+ "version": "2.0.0",
4
4
  "description": "Reactive state management with declarative data binding for Web Components. Zero dependencies, buildless.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",