@yanqirenshi/model.sitemap 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2026 Satoshi Iwasaki (yanqirenshi@gmail.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,121 @@
1
- # Temporary Holding Version
1
+ # @yanqirenshi/model.sitemap
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 画面遷移図(サイトマップ図。view = `d3.sitemap`)の**図ごとの知識**を、描画から独立させたパッケージです。
4
+ react / d3 に依存しない、純粋なデータと関数だけを持ちます。
5
+ d3.sitemap は、このパッケージの既定値(ラベル・枠線・背景・余白・線の stroke・端点の角度)を読みます。
6
+
7
+ | 持つもの | 入口 |
8
+ |---|---|
9
+ | 入力データのスキーマ(JSON Schema 2020-12) | `SCHEMAS.nodes` / `SCHEMAS.edges` |
10
+ | コレクションをまたぐ整合性ルール(id の重複・参照先の存在) | `check(data)` |
11
+ | d3.sitemap が既定で描いている値 | `withDefaults(record)` / `nodeStyle` / `edgeStyle`、`NODE_STYLE_DEFAULTS` など |
12
+ | 編集できる項目の一覧(インスペクタ用) | `fieldsOf(record)` |
13
+ | UI の操作を保存する patch に変える変換 | `movePatch(node, move)` / `applyPatch(record, values)` |
14
+
15
+ 利用側(iHub など)は、モデルが返す `{ collection, id, patch }` を保存するだけで、図の種類を知らずに書けます。
16
+
17
+ ## 位置づけ
18
+
19
+ ```
20
+ 利用側 ──▶ d3.sitemap (view) ──▶ model.sitemap (既定値を読む)
21
+ ──▶ colonoscope (ModelInspector)
22
+ ──▶ model.sitemap
23
+ ──▶ 自前の永続化
24
+ ```
25
+
26
+ model.sitemap・colonoscope の間に横の依存はありません。組み合わせるのは利用側だけです。
27
+ これは [Foolsgolds/Assholes#138](https://github.com/Foolsgolds/Assholes/issues/138) の派生([#145](https://github.com/Foolsgolds/Assholes/issues/145))です。
28
+ ノードと線の図なので [model.unchi](../model.unchi) と形が近く、`check` / `movePatch` などは model.unchi から複製しています
29
+ (graph 系の共通部分の切り出しは #146 のあとに判断します)。
30
+
31
+ ## レコードの形
32
+
33
+ d3.sitemap の `data()` に渡す入力そのもの(`nodes` / `edges` の 1 要素)です。
34
+
35
+ ```js
36
+ {
37
+ nodes: [{ id, type, label: { contents, position, font, link }, size: { w, h }, position: { x, y },
38
+ padding, border, background, link: { url, icon, position }, path, node_type,
39
+ children: [ /* 同じ形 */ ] }],
40
+ edges: [{ id, from: { id, position }, to: { id, position }, stroke: { color, width } }],
41
+ }
42
+ ```
43
+
44
+ model.unchi(ポンチ絵)との違い: ラベルは `label.contents`(unchi は `label.text`)、ノードにリンク(`link.url`)・URL パス(`path`)・画面の種類(`node_type`)があり、線にマーカーとラベルはありません。
45
+
46
+ ## 使い方
47
+
48
+ ```js
49
+ import D3Sitemap, { Rectum } from '@yanqirenshi/d3.sitemap';
50
+ import { ModelInspector } from '@yanqirenshi/colonoscope';
51
+ import {
52
+ check, fieldsOf, titleOf, withDefaults, movePatch, applyPatch, mergePatch, findById, ModelError,
53
+ } from '@yanqirenshi/model.sitemap';
54
+
55
+ const errors = check({ nodes, edges }); // [] なら問題なし
56
+
57
+ const rectum = new Rectum({
58
+ callbacks: {
59
+ node: {
60
+ // ドラッグの終わり → 位置の patch(core は入力のレコード)
61
+ dragend: (core, node, move) => save(movePatch(core, move)),
62
+ // → { collection: 'nodes', id: 1000031, patch: { position: { x: 120, y: 40 } } }
63
+ contextmenu: (core) => setTarget(core.id),
64
+ },
65
+ },
66
+ });
67
+
68
+ const record = findById(nodes, target); // 子も探す
69
+ <ModelInspector
70
+ target={record && withDefaults(record)}
71
+ fields={fieldsOf}
72
+ title={titleOf}
73
+ onApply={(values) => {
74
+ try {
75
+ save(applyPatch(record, values)); // 変えた項目だけが patch に入る
76
+ } catch (e) {
77
+ if (e instanceof ModelError) alert(e.message); // 利用者向けの日本語
78
+ }
79
+ }}
80
+ />
81
+ ```
82
+
83
+ ### `applyPatch` の検証
84
+
85
+ | 項目 | 規則 |
86
+ |---|---|
87
+ | 名称(`label.contents`) | 空にできない |
88
+ | 種類(`node_type`) | 空にすると項目を除く |
89
+ | URL(`link.url`) | 空にすると `link` ごと除く(d3.sitemap は url の無い link を描かない) |
90
+ | 幅・高さ | 0 以上。整数に丸める(0 で子に合わせる) |
91
+ | 色(背景・枠線・線) | ブラウザでは `CSS.supports('color', v)`。CSS の無い環境では `#hex` / 関数表記 / 英字の色名を通す緩い判定 |
92
+ | 枠線・線の太さ | 0 以上の数 |
93
+ | 接続位置(角度) | 数。0 以上 360 未満の整数に正規化 |
94
+
95
+ 図に描いている値(`withDefaults` の結果)から**変えた項目だけ**を patch に入れます。
96
+
97
+ ### 編集できる項目(`fieldsOf`)
98
+
99
+ - ノード: 名称・種類・URL・ID・幅・高さ・背景色・枠線の色 / 太さ
100
+ - 線: ID・遷移元 / 遷移先のノードと位置(角度)・線の色 / 太さ
101
+
102
+ `path`(文字列か `{ contents, link, font }` の 2 つの形がある)と `label.link` は当面スコープ外です。
103
+ `border.type` は d3.sitemap が描かないので項目にしません。
104
+
105
+ ## スコープ外(いまは持たない)
106
+
107
+ - `path` / `label.link` / `link.icon` の編集、ノード・線の追加削除
108
+ - ファイル・HTTP などの永続化(利用側の実装)
109
+
110
+ ## 配布形式
111
+
112
+ ESM(`dist/`)に加えて CommonJS 版(`dist/cjs/`)も出します。
113
+ Babel 系の `d3.sitemap` を jest(CommonJS)でテストするためで、d3.sitemap の jest が ESM を読めるようになったら外せます。
114
+
115
+ ## コマンド
116
+
117
+ ```bash
118
+ npm run build -w @yanqirenshi/model.sitemap # tsc で dist/(ESM + d.ts)と dist/cjs/(CommonJS)へビルド
119
+ npm run typecheck -w @yanqirenshi/model.sitemap
120
+ npm test -w @yanqirenshi/model.sitemap # vitest(d3.sitemap の Drawer との突き合わせを含む)
121
+ ```
@@ -0,0 +1,15 @@
1
+ import type { SitemapGraph, SitemapId, SitemapNodeRecord, SitemapRecord } from './types.js';
2
+ /** 入れ子のノード(children)を平らにする(親 → 子 の順) */
3
+ export declare function flatten(nodes: SitemapNodeRecord[]): SitemapNodeRecord[];
4
+ /**
5
+ * 図全体を検査する。
6
+ * - nodes(子を含む)の id が重複していない
7
+ * - edges の id が重複していない
8
+ * - edges の from.id / to.id がノードに存在する
9
+ *
10
+ * @param prefix メッセージのコレクション名の前に付ける文字列(例: 'sitemap/')
11
+ */
12
+ export declare function check(data: SitemapGraph, prefix?: string): string[];
13
+ /** ノード(子を含む)か線を id で探す(無ければ null) */
14
+ export declare function findById<T extends SitemapRecord>(list: readonly T[] | undefined, id: SitemapId): T | null;
15
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5F,wCAAwC;AACxC,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE,CAEvE;AAgBD;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,SAAK,GAAG,MAAM,EAAE,CAa/D;AAED,qCAAqC;AACrC,wBAAgB,QAAQ,CAAC,CAAC,SAAS,aAAa,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,CAAC,GAAG,IAAI,CAazG"}
package/dist/check.js ADDED
@@ -0,0 +1,50 @@
1
+ // コレクションをまたぐ整合性の検査(id の重複・参照先の存在)。
2
+ // スキーマ(schema.ts)に合っているデータを渡す。戻り値はエラーのメッセージの配列(空なら問題なし)。
3
+ //
4
+ // iHub の server/validation/rules.mjs の checkGraph('sitemap', data) と同じ検査・同じ文言。
5
+ // model.unchi の check.ts の複製(graph 系の共通化は #146 のあとに判断する — #145 の「やらないこと」)。
6
+ // メッセージの先頭はコレクション名で、prefix を渡すと 'sitemap/nodes: ...' のように付けられる。
7
+ /** 入れ子のノード(children)を平らにする(親 → 子 の順) */
8
+ export function flatten(nodes) {
9
+ return nodes.flatMap(node => [node, ...flatten(node.children || [])]);
10
+ }
11
+ // list の中で id が重複していればエラーにする。id の集合を返す。
12
+ function checkUnique(errors, label, list) {
13
+ const values = new Set();
14
+ for (const d of list) {
15
+ if (values.has(d.id))
16
+ errors.push(`${label}: id が重複しています。(id=${String(d.id)})`);
17
+ values.add(d.id);
18
+ }
19
+ return values;
20
+ }
21
+ /**
22
+ * 図全体を検査する。
23
+ * - nodes(子を含む)の id が重複していない
24
+ * - edges の id が重複していない
25
+ * - edges の from.id / to.id がノードに存在する
26
+ *
27
+ * @param prefix メッセージのコレクション名の前に付ける文字列(例: 'sitemap/')
28
+ */
29
+ export function check(data, prefix = '') {
30
+ const errors = [];
31
+ const node_ids = checkUnique(errors, `${prefix}nodes`, flatten(data.nodes || []));
32
+ checkUnique(errors, `${prefix}edges`, data.edges || []);
33
+ for (const edge of data.edges || [])
34
+ for (const end of ['from', 'to'])
35
+ if (!edge[end] || !node_ids.has(edge[end].id))
36
+ errors.push(`${prefix}edges: ${end}.id のノードが見つかりません。(id=${String(edge.id)}, ${end}.id=${String(edge[end]?.id)})`);
37
+ return errors;
38
+ }
39
+ /** ノード(子を含む)か線を id で探す(無ければ null) */
40
+ export function findById(list, id) {
41
+ for (const d of list || []) {
42
+ if (d.id === id)
43
+ return d;
44
+ const children = d.children;
45
+ const hit = children ? findById(children, id) : null;
46
+ if (hit)
47
+ return hit;
48
+ }
49
+ return null;
50
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ // コレクションをまたぐ整合性の検査(id の重複・参照先の存在)。
3
+ // スキーマ(schema.ts)に合っているデータを渡す。戻り値はエラーのメッセージの配列(空なら問題なし)。
4
+ //
5
+ // iHub の server/validation/rules.mjs の checkGraph('sitemap', data) と同じ検査・同じ文言。
6
+ // model.unchi の check.ts の複製(graph 系の共通化は #146 のあとに判断する — #145 の「やらないこと」)。
7
+ // メッセージの先頭はコレクション名で、prefix を渡すと 'sitemap/nodes: ...' のように付けられる。
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.flatten = flatten;
10
+ exports.check = check;
11
+ exports.findById = findById;
12
+ /** 入れ子のノード(children)を平らにする(親 → 子 の順) */
13
+ function flatten(nodes) {
14
+ return nodes.flatMap(node => [node, ...flatten(node.children || [])]);
15
+ }
16
+ // list の中で id が重複していればエラーにする。id の集合を返す。
17
+ function checkUnique(errors, label, list) {
18
+ const values = new Set();
19
+ for (const d of list) {
20
+ if (values.has(d.id))
21
+ errors.push(`${label}: id が重複しています。(id=${String(d.id)})`);
22
+ values.add(d.id);
23
+ }
24
+ return values;
25
+ }
26
+ /**
27
+ * 図全体を検査する。
28
+ * - nodes(子を含む)の id が重複していない
29
+ * - edges の id が重複していない
30
+ * - edges の from.id / to.id がノードに存在する
31
+ *
32
+ * @param prefix メッセージのコレクション名の前に付ける文字列(例: 'sitemap/')
33
+ */
34
+ function check(data, prefix = '') {
35
+ const errors = [];
36
+ const node_ids = checkUnique(errors, `${prefix}nodes`, flatten(data.nodes || []));
37
+ checkUnique(errors, `${prefix}edges`, data.edges || []);
38
+ for (const edge of data.edges || [])
39
+ for (const end of ['from', 'to'])
40
+ if (!edge[end] || !node_ids.has(edge[end].id))
41
+ errors.push(`${prefix}edges: ${end}.id のノードが見つかりません。(id=${String(edge.id)}, ${end}.id=${String(edge[end]?.id)})`);
42
+ return errors;
43
+ }
44
+ /** ノード(子を含む)か線を id で探す(無ければ null) */
45
+ function findById(list, id) {
46
+ for (const d of list || []) {
47
+ if (d.id === id)
48
+ return d;
49
+ const children = d.children;
50
+ const hit = children ? findById(children, id) : null;
51
+ if (hit)
52
+ return hit;
53
+ }
54
+ return null;
55
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // d3.sitemap が「書いていない項目」に既定で描く値。
3
+ //
4
+ // 値の出どころは d3.sitemap の src/js/Drawer.js(normalizeLabel / normalizeBorder / normalizeBackground /
5
+ // normalizePadding)、Edges.js の dataTemplate(stroke)、Rectum.getPortLineTo(角度の既定 90)。
6
+ // d3.sitemap はこのファイルを読む(#145)ので、ここが正。
7
+ //
8
+ // d3.sitemap は border.type を正規化するが描画には使わない(dasharray を付けない)ので、モデルも項目にしない。
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EDGE_DEFAULTS = exports.NODE_DEFAULTS = exports.LABEL_DEFAULTS = exports.NODE_STYLE_DEFAULTS = void 0;
11
+ exports.isEdge = isEdge;
12
+ exports.nodeStyle = nodeStyle;
13
+ exports.edgeStyle = edgeStyle;
14
+ exports.degreeOf = degreeOf;
15
+ exports.withDefaults = withDefaults;
16
+ /** ノードの枠線・背景の既定(Drawer.normalizeBorder / normalizeBackground) */
17
+ exports.NODE_STYLE_DEFAULTS = {
18
+ border: { color: '#666666', width: 1, type: 'solid' },
19
+ background: { color: '#ffffff' },
20
+ };
21
+ /** ラベルの既定(Drawer.normalizeLabel) */
22
+ exports.LABEL_DEFAULTS = {
23
+ position: { x: 20, y: 20 },
24
+ font: { size: 16, color: '#333333' },
25
+ };
26
+ /** ノードの既定(Drawer.normalizePadding / normalizePosition / normalizeSize)。size の 0 は「子に合わせる」 */
27
+ exports.NODE_DEFAULTS = {
28
+ type: 'NODE',
29
+ padding: 0,
30
+ position: { x: 0, y: 0 },
31
+ };
32
+ /** 線の既定(Edges.dataTemplate の stroke、端点の角度は Rectum.getPortLineTo の 90=左) */
33
+ exports.EDGE_DEFAULTS = {
34
+ stroke: { color: '#333', width: 1.5 },
35
+ position: 90,
36
+ };
37
+ /** 線か(from と to を持つ)。ノードは持たない */
38
+ function isEdge(record) {
39
+ return !!(record && record.from && record.to);
40
+ }
41
+ /** 既定に入力の指定(truthy な項目だけ。Drawer.normalize* と同じ判定)を重ねる。width は 0 も通す */
42
+ function mergeStyle(defaults, given) {
43
+ const out = { ...defaults };
44
+ for (const key of Object.keys(given || {})) {
45
+ const v = given[key];
46
+ if (v || (key === 'width' && v === 0))
47
+ out[key] = v;
48
+ }
49
+ return out;
50
+ }
51
+ /** ノードが描かれる枠線・背景(既定に入力を重ねた、実際に描かれる値) */
52
+ function nodeStyle(node) {
53
+ return {
54
+ border: mergeStyle(exports.NODE_STYLE_DEFAULTS.border, node.border),
55
+ background: mergeStyle(exports.NODE_STYLE_DEFAULTS.background, node.background),
56
+ };
57
+ }
58
+ /** 線が描かれる値。stroke は d3.sitemap の Edges.normalize と同じく、stroke があればそれ(無ければ既定) */
59
+ function edgeStyle(edge) {
60
+ return {
61
+ stroke: {
62
+ color: edge.stroke?.color || exports.EDGE_DEFAULTS.stroke.color,
63
+ width: edge.stroke?.width || exports.EDGE_DEFAULTS.stroke.width,
64
+ },
65
+ };
66
+ }
67
+ /** 端点の角度(無ければ 90。Rectum.getPortLineTo と同じ: 0 は 0、それ以外の falsy は 90) */
68
+ function degreeOf(position) {
69
+ if (position === 0)
70
+ return 0;
71
+ return position ? position : exports.EDGE_DEFAULTS.position;
72
+ }
73
+ /**
74
+ * レコードに、d3.sitemap が既定で描いている値を重ねて返す(入力は書き換えない)。
75
+ * インスペクタの初期値に使う。children は重ねない(子は右クリックしたときに自分で通す)。
76
+ *
77
+ * 重ねる項目: ノードは label.contents(無ければ '')・border・background・type・padding・position、
78
+ * 線は stroke・from.position・to.position。size は view が子に合わせて埋めるので触らない。
79
+ */
80
+ function withDefaults(record) {
81
+ if (isEdge(record)) {
82
+ return {
83
+ ...record,
84
+ ...edgeStyle(record),
85
+ from: { ...record.from, position: degreeOf(record.from.position) },
86
+ to: { ...record.to, position: degreeOf(record.to.position) },
87
+ };
88
+ }
89
+ const node = record;
90
+ const style = nodeStyle(node);
91
+ const label = node.label && typeof node.label === 'object' ? node.label : {};
92
+ return {
93
+ ...node,
94
+ type: node.type || exports.NODE_DEFAULTS.type,
95
+ label: { ...label, contents: typeof label.contents === 'string' ? label.contents : '' },
96
+ padding: node.padding || node.padding === 0 ? node.padding : exports.NODE_DEFAULTS.padding,
97
+ position: { ...exports.NODE_DEFAULTS.position, ...(node.position || {}) },
98
+ border: style.border,
99
+ background: style.background,
100
+ };
101
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // 編集できる項目の一覧。インスペクタ(colonoscope の ModelInspector)に渡す。
3
+ //
4
+ // path はレコードの実際の項目を指す。既定値は withDefaults() で重ねてから渡すので、
5
+ // 書いていない項目(枠線の色など)も、図に描かれている値が初期値として出る。
6
+ // type: 'readonly' は表示だけ。
7
+ //
8
+ // iHub の ScreenTransitionDiagram.js の fields(label.contents / node_type / link.url / id)から始め、
9
+ // d3.sitemap が描く枠線・背景・幅・高さを足した。path(文字列か { contents, link, font })は形が 2 つあるので
10
+ // 当面スコープ外(#145)。border.type は d3.sitemap が描かないので出さない。
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EDGE_FIELDS = exports.NODE_FIELDS = void 0;
13
+ exports.fieldsOf = fieldsOf;
14
+ const defaults_js_1 = require("./defaults.js");
15
+ /** ノードの項目 */
16
+ exports.NODE_FIELDS = [
17
+ { path: 'label.contents', label: '名称', type: 'text' },
18
+ { path: 'node_type', label: '種類', type: 'text' },
19
+ { path: 'link.url', label: 'URL', type: 'text' },
20
+ { path: 'id', label: 'ID', type: 'readonly' },
21
+ { path: 'size.w', label: '幅', type: 'number' },
22
+ { path: 'size.h', label: '高さ', type: 'number' },
23
+ { path: 'background.color', label: '背景色', type: 'text' },
24
+ { path: 'border.color', label: '枠線の色', type: 'text' },
25
+ { path: 'border.width', label: '枠線の太さ', type: 'number' },
26
+ ];
27
+ /** 線の項目。接続位置はノードの中心から見た角度(0=真下・時計回り。90=左 / 180=真上 / 270=右) */
28
+ exports.EDGE_FIELDS = [
29
+ { path: 'id', label: 'ID', type: 'readonly' },
30
+ { path: 'from.id', label: '遷移元のノード', type: 'readonly' },
31
+ { path: 'from.position', label: '遷移元の位置 (角度)', type: 'number' },
32
+ { path: 'to.id', label: '遷移先のノード', type: 'readonly' },
33
+ { path: 'to.position', label: '遷移先の位置 (角度)', type: 'number' },
34
+ { path: 'stroke.color', label: '線の色', type: 'text' },
35
+ { path: 'stroke.width', label: '線の太さ', type: 'number' },
36
+ ];
37
+ /** レコードに応じた項目の一覧(線 / ノード) */
38
+ function fieldsOf(record) {
39
+ return (0, defaults_js_1.isEdge)(record) ? [...exports.EDGE_FIELDS] : [...exports.NODE_FIELDS];
40
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // model.sitemap — 画面遷移図(d3.sitemap)の「図ごとの知識」。描画はしない(react / d3 に依存しない)。
3
+ //
4
+ // スキーマ: SCHEMAS / NODES_SCHEMA / EDGES_SCHEMA(JSON Schema 2020-12)
5
+ // 整合性ルール: check(data)(id の重複・参照先の存在)/ flatten / findById
6
+ // 既定値の補完: withDefaults(record) / nodeStyle / edgeStyle / degreeOf
7
+ // NODE_STYLE_DEFAULTS / LABEL_DEFAULTS / NODE_DEFAULTS / EDGE_DEFAULTS(d3.sitemap が読む)
8
+ // 編集できる項目: fieldsOf(record) / NODE_FIELDS / EDGE_FIELDS
9
+ // patch への変換: movePatch(node, move) / applyPatch(record, values) / mergePatch(record, patch)
10
+ //
11
+ // graph 系(unchi / sitemap / deployment)の共通部分はまだ切り出していない(#145 の「やらないこと」。#146 のあとに判断)。
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isColor = exports.applyPatch = exports.movePatch = exports.mergePatch = exports.getByPath = exports.titleOf = exports.collectionOf = exports.ModelError = exports.fieldsOf = exports.EDGE_FIELDS = exports.NODE_FIELDS = exports.findById = exports.flatten = exports.check = exports.SCHEMAS = exports.EDGES_SCHEMA = exports.NODES_SCHEMA = exports.withDefaults = exports.degreeOf = exports.edgeStyle = exports.nodeStyle = exports.isEdge = exports.EDGE_DEFAULTS = exports.NODE_DEFAULTS = exports.LABEL_DEFAULTS = exports.NODE_STYLE_DEFAULTS = void 0;
14
+ var defaults_js_1 = require("./defaults.js");
15
+ Object.defineProperty(exports, "NODE_STYLE_DEFAULTS", { enumerable: true, get: function () { return defaults_js_1.NODE_STYLE_DEFAULTS; } });
16
+ Object.defineProperty(exports, "LABEL_DEFAULTS", { enumerable: true, get: function () { return defaults_js_1.LABEL_DEFAULTS; } });
17
+ Object.defineProperty(exports, "NODE_DEFAULTS", { enumerable: true, get: function () { return defaults_js_1.NODE_DEFAULTS; } });
18
+ Object.defineProperty(exports, "EDGE_DEFAULTS", { enumerable: true, get: function () { return defaults_js_1.EDGE_DEFAULTS; } });
19
+ Object.defineProperty(exports, "isEdge", { enumerable: true, get: function () { return defaults_js_1.isEdge; } });
20
+ Object.defineProperty(exports, "nodeStyle", { enumerable: true, get: function () { return defaults_js_1.nodeStyle; } });
21
+ Object.defineProperty(exports, "edgeStyle", { enumerable: true, get: function () { return defaults_js_1.edgeStyle; } });
22
+ Object.defineProperty(exports, "degreeOf", { enumerable: true, get: function () { return defaults_js_1.degreeOf; } });
23
+ Object.defineProperty(exports, "withDefaults", { enumerable: true, get: function () { return defaults_js_1.withDefaults; } });
24
+ var schema_js_1 = require("./schema.js");
25
+ Object.defineProperty(exports, "NODES_SCHEMA", { enumerable: true, get: function () { return schema_js_1.NODES_SCHEMA; } });
26
+ Object.defineProperty(exports, "EDGES_SCHEMA", { enumerable: true, get: function () { return schema_js_1.EDGES_SCHEMA; } });
27
+ Object.defineProperty(exports, "SCHEMAS", { enumerable: true, get: function () { return schema_js_1.SCHEMAS; } });
28
+ var check_js_1 = require("./check.js");
29
+ Object.defineProperty(exports, "check", { enumerable: true, get: function () { return check_js_1.check; } });
30
+ Object.defineProperty(exports, "flatten", { enumerable: true, get: function () { return check_js_1.flatten; } });
31
+ Object.defineProperty(exports, "findById", { enumerable: true, get: function () { return check_js_1.findById; } });
32
+ var fields_js_1 = require("./fields.js");
33
+ Object.defineProperty(exports, "NODE_FIELDS", { enumerable: true, get: function () { return fields_js_1.NODE_FIELDS; } });
34
+ Object.defineProperty(exports, "EDGE_FIELDS", { enumerable: true, get: function () { return fields_js_1.EDGE_FIELDS; } });
35
+ Object.defineProperty(exports, "fieldsOf", { enumerable: true, get: function () { return fields_js_1.fieldsOf; } });
36
+ var patch_js_1 = require("./patch.js");
37
+ Object.defineProperty(exports, "ModelError", { enumerable: true, get: function () { return patch_js_1.ModelError; } });
38
+ Object.defineProperty(exports, "collectionOf", { enumerable: true, get: function () { return patch_js_1.collectionOf; } });
39
+ Object.defineProperty(exports, "titleOf", { enumerable: true, get: function () { return patch_js_1.titleOf; } });
40
+ Object.defineProperty(exports, "getByPath", { enumerable: true, get: function () { return patch_js_1.getByPath; } });
41
+ Object.defineProperty(exports, "mergePatch", { enumerable: true, get: function () { return patch_js_1.mergePatch; } });
42
+ Object.defineProperty(exports, "movePatch", { enumerable: true, get: function () { return patch_js_1.movePatch; } });
43
+ Object.defineProperty(exports, "applyPatch", { enumerable: true, get: function () { return patch_js_1.applyPatch; } });
44
+ Object.defineProperty(exports, "isColor", { enumerable: true, get: function () { return patch_js_1.isColor; } });
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }