@cardenelabs/dragon 0.32.0 → 0.34.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/README.md +1 -1
- package/dist/index.cjs +116 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -23
- package/dist/index.d.ts +25 -23
- package/dist/index.js +116 -61
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/compile/actor-ids.ts +1 -1
- package/src/compile/actor-option-notice.ts +1 -1
- package/src/compile/edge-option-notice.ts +1 -1
- package/src/compile/kinds.ts +7 -16
- package/src/compile/lanes.ts +1 -1
- package/src/compile/notice.ts +1 -1
- package/src/compile/order.ts +8 -13
- package/src/compile.ts +2 -6
- package/src/focus.ts +1 -1
- package/src/json-parser.ts +26 -9
- package/src/keywords.ts +11 -8
- package/src/schemas/diagram.json +2 -3
- package/src/types.ts +4 -4
- package/src/v05/parser.ts +47 -43
- package/src/v05/removed-syntax.ts +115 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 外した書き方と置き換え先 (#2947)。
|
|
3
|
+
*
|
|
4
|
+
* dragon はどの分野にも寄らずに図を描く道具なので、特定の技術や会社に向けた書き方を外した。
|
|
5
|
+
* 外した書き方を黙って受けないために、**書いた人に置き換え先を誤りとして返す**。
|
|
6
|
+
*
|
|
7
|
+
* 外した語を受理集合 (`NODE_KIND_VALID` / `TYPE_ALIASES`) から消すだけだと、箱の種類は
|
|
8
|
+
* 見本 (parts) の名前として扱われて「そんな部品は無い」 と出て、図種は「図種が読めません」
|
|
9
|
+
* と出る。 どちらも何に書き換えればよいかが読み取れない。
|
|
10
|
+
*
|
|
11
|
+
* 記法 (`v05/parser.ts`) と JSON (`json-parser.ts`) の両方の入口がこの表を引く。
|
|
12
|
+
* 入口ごとに表を持つと、片方だけ受け付ける形が残る。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** 外した図種と、同じ図を描く書き方 */
|
|
16
|
+
export const 外した図種: ReadonlyMap<string, string> = new Map<string, string>([
|
|
17
|
+
["solidity", "`type: sequence` と `order: 種類`"],
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* cdl から外した挿絵の種類 (cardene777/cdl#1256)。
|
|
22
|
+
*
|
|
23
|
+
* 業界ごとに手で描いた形で、どこまで足しても偏るため cdl 0.140.0 で外した。
|
|
24
|
+
* 外す前の形は cdl の tag `archive/illustration-shapes` から取り出せる。
|
|
25
|
+
*/
|
|
26
|
+
export const 外した挿絵の種類: readonly string[] = [
|
|
27
|
+
"shape-kanban-card",
|
|
28
|
+
"shape-message-bubble",
|
|
29
|
+
"shape-gear",
|
|
30
|
+
"shape-network-node",
|
|
31
|
+
"shape-iot-sensor",
|
|
32
|
+
"shape-robot-arm",
|
|
33
|
+
"shape-satellite",
|
|
34
|
+
"shape-website",
|
|
35
|
+
"shape-cdn-edge",
|
|
36
|
+
"shape-api-gateway",
|
|
37
|
+
"shape-storefront",
|
|
38
|
+
"shape-warehouse",
|
|
39
|
+
"shape-online-shop",
|
|
40
|
+
"shape-customer-service",
|
|
41
|
+
"shape-lawyer",
|
|
42
|
+
"shape-auditor",
|
|
43
|
+
"shape-regulator",
|
|
44
|
+
"shape-notary",
|
|
45
|
+
"shape-trader",
|
|
46
|
+
"shape-smart-contract",
|
|
47
|
+
"shape-blockchain-block",
|
|
48
|
+
"shape-blockchain",
|
|
49
|
+
"shape-bitcoin-chain",
|
|
50
|
+
"shape-ethereum-chain",
|
|
51
|
+
"shape-blockchain-node",
|
|
52
|
+
"shape-rpc-node",
|
|
53
|
+
"shape-wallet",
|
|
54
|
+
"shape-nft",
|
|
55
|
+
"shape-token",
|
|
56
|
+
"shape-bank",
|
|
57
|
+
"shape-trust-bank",
|
|
58
|
+
"shape-payment-provider",
|
|
59
|
+
"shape-credit-card",
|
|
60
|
+
"shape-brokerage",
|
|
61
|
+
"shape-exchange",
|
|
62
|
+
"shape-atm",
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
/** 外した挿絵の代わり。 1 つに決まらないので、選べる 2 つの道を示す */
|
|
66
|
+
const 挿絵の代わり =
|
|
67
|
+
"基本の形 (`shape-file` / `shape-cylinder` など) を使うか、箱に `kindForm: icon` と `icon` を書く";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 外した箱の種類と、置き換え先。
|
|
71
|
+
*
|
|
72
|
+
* | 外した種類 | 置き換え先 | 元の役目 |
|
|
73
|
+
* |---|---|---|
|
|
74
|
+
* | `contract` / `proxy` / `library` / `interface` | `card` | Solidity の図の契約 |
|
|
75
|
+
* | `eoa` | `person` | Solidity の図の人が持つ財布 |
|
|
76
|
+
* | `multisig` | `signer` | Solidity の図の複数人の署名 |
|
|
77
|
+
* | `alb` / `ecs` / `iam` / `kms` / `lambda` / `rds` / `s3` | 同じ役目の汎用の種類 | AWS の名前の読み替え |
|
|
78
|
+
* | cdl から外した挿絵 | 基本の形か `kindForm: icon` | 業界ごとの挿絵 |
|
|
79
|
+
*
|
|
80
|
+
* 置き換え先は外す前に読み替えていた先と同じ種類にした (`alb` だけは読み替え先の挿絵が
|
|
81
|
+
* 外れたので `api` にした)。 書き換えた図は外す前と同じ形で描かれる。
|
|
82
|
+
*/
|
|
83
|
+
export const 外した種類: ReadonlyMap<string, string> = new Map<string, string>([
|
|
84
|
+
["contract", "`card`"],
|
|
85
|
+
["proxy", "`card`"],
|
|
86
|
+
["library", "`card`"],
|
|
87
|
+
["interface", "`card`"],
|
|
88
|
+
["eoa", "`person`"],
|
|
89
|
+
["multisig", "`signer`"],
|
|
90
|
+
["alb", "`api`"],
|
|
91
|
+
["ecs", "`microservice`"],
|
|
92
|
+
["iam", "`admin`"],
|
|
93
|
+
["kms", "`admin`"],
|
|
94
|
+
["lambda", "`function`"],
|
|
95
|
+
["rds", "`database`"],
|
|
96
|
+
["s3", "`storage`"],
|
|
97
|
+
...外した挿絵の種類.map((k): [string, string] => [k, 挿絵の代わり]),
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
/** 外した箱の種類なら、知らせの文面を返す */
|
|
101
|
+
export function 外した種類の知らせ(kind: string): { message: string; hint: string } | undefined {
|
|
102
|
+
const 代わり = 外した種類.get(kind);
|
|
103
|
+
if (代わり === undefined) return undefined;
|
|
104
|
+
return {
|
|
105
|
+
message: `箱の種類 "${kind}" は外しました`,
|
|
106
|
+
hint: 外した挿絵の種類.includes(kind) ? 代わり : `代わりに ${代わり} を書く`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** 外した図種なら、知らせの文面を返す */
|
|
111
|
+
export function 外した図種の知らせ(type: string): { message: string; hint: string } | undefined {
|
|
112
|
+
const 代わり = 外した図種.get(type);
|
|
113
|
+
if (代わり === undefined) return undefined;
|
|
114
|
+
return { message: `図種 "${type}" は外しました`, hint: `代わりに ${代わり} を書く` };
|
|
115
|
+
}
|