@cardenelabs/dragon 0.42.0 → 0.42.2
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 +54 -1
- package/dist/cli.cjs +9 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +9 -8
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +9 -8
- package/dist/export.cjs.map +1 -1
- package/dist/export.js +9 -8
- package/dist/export.js.map +1 -1
- package/package.json +1 -1
- package/src/export/fonts.ts +13 -6
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ mountDiagram(host, parsed.diagram, {
|
|
|
77
77
|
3. 空白を含む名前と文は、行末か `[` の前に置く。`,` か `]` を含む値と、`[` を含む名前だけを `"` で囲む
|
|
78
78
|
4. 入れ子は `group … end` だけ。段は次の `step` までで、字下げは読みやすさのために付ける。`say` の続きの行だけは `say` より深く字下げする
|
|
79
79
|
|
|
80
|
-
行の頭の語は `sequence` `architecture` `state` `git` `group` `end` `box` `branch` `strip` `step` `say` `code` `source` `commit` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
|
|
80
|
+
行の頭の語は `sequence` `architecture` `state` `git` `time` `group` `end` `box` `branch` `scale` `period` `row` `point` `zoom` `strip` `step` `say` `code` `source` `commit` `mark` `span` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
|
|
81
81
|
箱の行の属性 `link` に飛び先を書くと、描いた図でその箱が飛び先への link になる。
|
|
82
82
|
段の中の `source <名前> [url: <URL>]` の行は段の出典になり、1 つの段に何行でも書け、読み上げの段の一覧に名前の link で出る。
|
|
83
83
|
飛び先と出典の URL には、`/` で始まる path か、`http://` か `https://` で始まる URL だけを書ける。
|
|
@@ -172,6 +172,59 @@ step 早送りする
|
|
|
172
172
|
main -> C'
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
+
### 時間軸の図
|
|
176
|
+
|
|
177
|
+
`time` で始めると、決まった間隔で進む時間の上で、出来事がどの目盛りで起きたかを段ごとに追う時間軸の図になる。`scale <単位> <長さ> <数>` で目盛りを宣言し、`period` で区切りを、`row` で印の列を、`point` で軸の下の節目を、`zoom <範囲>` で上の帯に拡大する目盛りを宣言する。
|
|
178
|
+
段の中では `now -> <目盛り>` で針を進める。針は目盛り 1 つを決まった速さで進み、過ぎた目盛りの印がその時に出る。`mark` で印の色を変え、`span` で軸の下に範囲の括弧か、印の列を囲む枠を出す。
|
|
179
|
+
中身の帯の欄に `[meter: <割合>]` を付けると物差しになり、`set` で書いた割合まで針と一緒に満ちる。
|
|
180
|
+
|
|
181
|
+
```dragon
|
|
182
|
+
time ブロックが確定して戻せなくなるまで
|
|
183
|
+
|
|
184
|
+
scale slot 12s 64
|
|
185
|
+
period epoch 32
|
|
186
|
+
row ブロック [color: blue, empty: 5]
|
|
187
|
+
point C0 at 0
|
|
188
|
+
point C1 at 32
|
|
189
|
+
zoom 0-1
|
|
190
|
+
|
|
191
|
+
box 提案者 [color: blue, icon: user]
|
|
192
|
+
box ブロック [color: blue, icon: box]
|
|
193
|
+
|
|
194
|
+
strip 確定の進み: 経過, 今の epoch の票 [meter: 2/3]
|
|
195
|
+
|
|
196
|
+
step ブロックを出す
|
|
197
|
+
say slot ごとに提案者が 1 人選ばれ、ブロックを 1 つ出す。上の帯は最初の 2 slot を拡大した所。
|
|
198
|
+
提案者 -> ブロック [at: 0]
|
|
199
|
+
提案者 -> ブロック [at: 1]
|
|
200
|
+
now -> 1
|
|
201
|
+
set 経過: 24 秒
|
|
202
|
+
|
|
203
|
+
step 1 epoch 分の票を集める
|
|
204
|
+
say 32 slot で 1 epoch。針が過ぎた slot にブロックの印が出て、提案者が応答しなかった slot は空きの印になる。
|
|
205
|
+
note C0: 提案済み [color: blue]
|
|
206
|
+
span 0-31: 1 epoch = 6.4 分 [color: slate]
|
|
207
|
+
now -> 31
|
|
208
|
+
set 経過: 6 分 24 秒
|
|
209
|
+
set 今の epoch の票: 97%
|
|
210
|
+
|
|
211
|
+
step 次の epoch へ進む
|
|
212
|
+
say C0 への票が全体の 2/3 を超えたので、C0 は正当化される。次の epoch では C1 へ票が集まる。
|
|
213
|
+
note C0: 正当化 [color: violet]
|
|
214
|
+
note C1: 提案済み [color: blue]
|
|
215
|
+
now -> 63
|
|
216
|
+
set 経過: 12 分 48 秒
|
|
217
|
+
set 今の epoch の票: 97%
|
|
218
|
+
|
|
219
|
+
step C0 が確定する
|
|
220
|
+
say C1 も正当化されると、続けて正当化された 2 つのうち前の C0 が確定する。確定したブロックは戻せない。
|
|
221
|
+
C0 -> C1: 2/3 を超えた [carry: none]
|
|
222
|
+
note C1: 正当化 [color: violet]
|
|
223
|
+
note C0: 確定 [color: green]
|
|
224
|
+
mark ブロック 0-31 [color: green]
|
|
225
|
+
span 0-31: 確定して戻せない [shape: box, color: rose]
|
|
226
|
+
```
|
|
227
|
+
|
|
175
228
|
## 書き出し
|
|
176
229
|
|
|
177
230
|
書き出しは画面なしの Chromium で、頁と同じ描画を時刻を止めて 1 コマずつ撮る。
|
package/dist/cli.cjs
CHANGED
|
@@ -8526,8 +8526,8 @@ var Motion = class {
|
|
|
8526
8526
|
]);
|
|
8527
8527
|
}
|
|
8528
8528
|
/** 少し下から浮いて出る。 */
|
|
8529
|
-
rise(a, b = this.last,
|
|
8530
|
-
return this.vis(a, b, { on: { transform: "translateY(0)" }, off: { transform: `translateY(${LOOK.rise}px)` }, within });
|
|
8529
|
+
rise(a, b = this.last, within2 = false) {
|
|
8530
|
+
return this.vis(a, b, { on: { transform: "translateY(0)" }, off: { transform: `translateY(${LOOK.rise}px)` }, within: within2 });
|
|
8531
8531
|
}
|
|
8532
8532
|
/** 小さな所から弾んで出る。 */
|
|
8533
8533
|
pop(a, b = this.last) {
|
|
@@ -9253,6 +9253,10 @@ function ranges(list2) {
|
|
|
9253
9253
|
});
|
|
9254
9254
|
}
|
|
9255
9255
|
var hex = (code) => `U+${code.toString(16).toUpperCase()}`;
|
|
9256
|
+
function within(span, char) {
|
|
9257
|
+
const code = char.codePointAt(0) ?? -1;
|
|
9258
|
+
return span.some(([from, to]) => code >= from && code <= to);
|
|
9259
|
+
}
|
|
9256
9260
|
var shapeless = (char) => /^[\s\p{Cf}\p{Cc}]$/u.test(char);
|
|
9257
9261
|
function shapedIn(span) {
|
|
9258
9262
|
for (const [from, to] of span) {
|
|
@@ -9271,12 +9275,9 @@ async function fontFaces(chars) {
|
|
|
9271
9275
|
PACKAGES.flatMap(({ family, name }) => {
|
|
9272
9276
|
const base = path$1.dirname(require_2.resolve(`@fontsource-variable/${name}/unicode.json`));
|
|
9273
9277
|
const table = JSON.parse(fs.readFileSync(path$1.join(base, "unicode.json"), "utf8"));
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
const own = chars.filter((char) =>
|
|
9277
|
-
const code = char.codePointAt(0) ?? -1;
|
|
9278
|
-
return span.some(([from, to]) => code >= from && code <= to);
|
|
9279
|
-
});
|
|
9278
|
+
const spans = Object.entries(table).map(([key, list2]) => ({ key, span: ranges(list2) }));
|
|
9279
|
+
return spans.map(async ({ key, span }, index) => {
|
|
9280
|
+
const own = chars.filter((char) => within(span, char) && !spans.slice(index + 1).some((later) => within(later.span, char)));
|
|
9280
9281
|
if (!own.length) return "";
|
|
9281
9282
|
const filler = own.every(shapeless) ? shapedIn(span) ?? "" : "";
|
|
9282
9283
|
const file = path$1.join(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
|