@bendyline/squisq 2.4.2 → 2.4.4
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/chunk-24SENDJY.js +750 -0
- package/dist/{chunk-JUAC2QWP.js → chunk-CYRIVZTR.js} +1 -1
- package/dist/{chunk-EMXYZLRH.js → chunk-GGTDYLW4.js} +1 -1
- package/dist/{chunk-AQF5ZYDI.js → chunk-GXUFHFYD.js} +3 -3
- package/dist/{chunk-2HY2ZA7U.js → chunk-OIIIHI3Y.js} +45 -9
- package/dist/{chunk-7TJJA2RI.js → chunk-YQW6AQBV.js} +1 -1
- package/dist/doc/index.d.ts +8 -2
- package/dist/doc/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -8
- package/dist/jsonForm/index.js +1 -1
- package/dist/markdown/index.js +3 -3
- package/dist/narration/index.js +3 -3
- package/dist/schemas/index.d.ts +22 -3
- package/dist/schemas/index.js +6 -2
- package/package.json +1 -1
- package/dist/chunk-GODLNXO4.js +0 -360
- package/dist/{chunk-D6YTLQCL.js → chunk-O3LLD7HG.js} +176 -176
|
@@ -70,6 +70,180 @@ function isReservedAnnotationToken(token) {
|
|
|
70
70
|
return TEMPLATE_TOKEN_NAMES.has(resolveTemplateName(token));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
// src/markdown/annotationCoercion.ts
|
|
74
|
+
var KNOWN_BLOCK_META_KEYS = {
|
|
75
|
+
x: "number",
|
|
76
|
+
y: "number",
|
|
77
|
+
startTime: "time",
|
|
78
|
+
duration: "time",
|
|
79
|
+
connectsTo: "connectionList",
|
|
80
|
+
transition: "transition",
|
|
81
|
+
transitionDuration: "time",
|
|
82
|
+
transitionDirection: "transitionDirection"
|
|
83
|
+
};
|
|
84
|
+
var BLOCK_META_KEY_DESCRIPTORS = [
|
|
85
|
+
{
|
|
86
|
+
key: "transition",
|
|
87
|
+
description: "Block-to-block transition effect",
|
|
88
|
+
values: TRANSITION_TYPES
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "transitionDuration",
|
|
92
|
+
description: "How long the transition lasts",
|
|
93
|
+
valueHint: "seconds \u2014 e.g. 0.7, 700ms"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "transitionDirection",
|
|
97
|
+
description: "Directional variant for the transition",
|
|
98
|
+
values: TRANSITION_DIRECTIONS
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "startTime",
|
|
102
|
+
description: "Timeline start time of this block",
|
|
103
|
+
valueHint: "mm:ss or seconds \u2014 e.g. 01:30, 5, 1500ms"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "duration",
|
|
107
|
+
description: "How long this block lasts",
|
|
108
|
+
valueHint: "mm:ss or seconds \u2014 e.g. 45, 1500ms"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: "x",
|
|
112
|
+
description: "Horizontal position on the diagram canvas",
|
|
113
|
+
valueHint: "number \u2014 e.g. 600"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "y",
|
|
117
|
+
description: "Vertical position on the diagram canvas",
|
|
118
|
+
valueHint: "number \u2014 e.g. 300"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
key: "connectsTo",
|
|
122
|
+
description: "Diagram connections to other blocks",
|
|
123
|
+
valueHint: "comma-separated target or target:type \u2014 e.g. foo,bar:flow"
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
function coerceAnnotationValues(params) {
|
|
127
|
+
const blockMeta = {};
|
|
128
|
+
const metadata = {};
|
|
129
|
+
const warnings = [];
|
|
130
|
+
let transitionType = null;
|
|
131
|
+
let transitionDuration;
|
|
132
|
+
let transitionDirection;
|
|
133
|
+
for (const [key, raw] of Object.entries(params)) {
|
|
134
|
+
const kind = KNOWN_BLOCK_META_KEYS[key];
|
|
135
|
+
if (!kind) {
|
|
136
|
+
metadata[key] = raw;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (kind === "number") {
|
|
140
|
+
const n = parseNumber(raw);
|
|
141
|
+
if (n == null) {
|
|
142
|
+
warnings.push(`Invalid number for "${key}": ${JSON.stringify(raw)}`);
|
|
143
|
+
} else {
|
|
144
|
+
blockMeta[key] = n;
|
|
145
|
+
}
|
|
146
|
+
} else if (kind === "time") {
|
|
147
|
+
const s = parseTimeSeconds(raw);
|
|
148
|
+
if (s == null) {
|
|
149
|
+
warnings.push(`Invalid time for "${key}": ${JSON.stringify(raw)}`);
|
|
150
|
+
} else if (key === "transitionDuration") {
|
|
151
|
+
transitionDuration = s;
|
|
152
|
+
} else {
|
|
153
|
+
blockMeta[key] = s;
|
|
154
|
+
}
|
|
155
|
+
} else if (kind === "connectionList") {
|
|
156
|
+
const { list, warning } = parseConnectionList(raw);
|
|
157
|
+
if (warning) warnings.push(`"${key}": ${warning}`);
|
|
158
|
+
blockMeta.connectsTo = list;
|
|
159
|
+
} else if (kind === "transition") {
|
|
160
|
+
const transition = normalizeTransitionType(raw);
|
|
161
|
+
if (transition == null) {
|
|
162
|
+
warnings.push(`Invalid transition for "${key}": ${JSON.stringify(raw)}`);
|
|
163
|
+
} else {
|
|
164
|
+
transitionType = transition;
|
|
165
|
+
}
|
|
166
|
+
} else if (kind === "transitionDirection") {
|
|
167
|
+
const direction = normalizeTransitionDirection(raw);
|
|
168
|
+
if (direction == null) {
|
|
169
|
+
warnings.push(`Invalid transition direction for "${key}": ${JSON.stringify(raw)}`);
|
|
170
|
+
} else {
|
|
171
|
+
transitionDirection = direction;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (transitionType) {
|
|
176
|
+
blockMeta.transition = {
|
|
177
|
+
type: transitionType,
|
|
178
|
+
...transitionDuration !== void 0 ? { duration: transitionDuration } : {},
|
|
179
|
+
...transitionDirection !== void 0 ? { direction: transitionDirection } : {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return { blockMeta, metadata, warnings };
|
|
183
|
+
}
|
|
184
|
+
function parseNumber(raw) {
|
|
185
|
+
if (raw.trim() === "") return null;
|
|
186
|
+
const n = Number(raw);
|
|
187
|
+
return Number.isFinite(n) ? n : null;
|
|
188
|
+
}
|
|
189
|
+
var TIME_BARE_RE = /^\d+(?:\.\d+)?$/;
|
|
190
|
+
var TIME_MS_RE = /^(\d+(?:\.\d+)?)ms$/;
|
|
191
|
+
var TIME_MMSS_RE = /^(\d+):(\d{1,2})(?:\.(\d+))?$/;
|
|
192
|
+
function parseTimeSeconds(raw) {
|
|
193
|
+
const trimmed = raw.trim();
|
|
194
|
+
if (!trimmed) return null;
|
|
195
|
+
if (TIME_BARE_RE.test(trimmed)) {
|
|
196
|
+
const n = Number(trimmed);
|
|
197
|
+
return Number.isFinite(n) ? n : null;
|
|
198
|
+
}
|
|
199
|
+
const msMatch = trimmed.match(TIME_MS_RE);
|
|
200
|
+
if (msMatch) {
|
|
201
|
+
const n = Number(msMatch[1]);
|
|
202
|
+
return Number.isFinite(n) ? n / 1e3 : null;
|
|
203
|
+
}
|
|
204
|
+
const mmssMatch = trimmed.match(TIME_MMSS_RE);
|
|
205
|
+
if (mmssMatch) {
|
|
206
|
+
const mins = Number(mmssMatch[1]);
|
|
207
|
+
const secs = Number(mmssMatch[2]);
|
|
208
|
+
const frac = mmssMatch[3] ? Number(`0.${mmssMatch[3]}`) : 0;
|
|
209
|
+
if (!Number.isFinite(mins) || !Number.isFinite(secs) || !Number.isFinite(frac)) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
if (secs >= 60) return null;
|
|
213
|
+
return mins * 60 + secs + frac;
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
function parseConnectionList(raw) {
|
|
218
|
+
const trimmed = raw.trim();
|
|
219
|
+
if (!trimmed) return { list: [], warning: null };
|
|
220
|
+
const list = [];
|
|
221
|
+
let droppedEmpty = false;
|
|
222
|
+
for (const part of trimmed.split(",")) {
|
|
223
|
+
const entry = part.trim();
|
|
224
|
+
if (!entry) {
|
|
225
|
+
droppedEmpty = true;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const colonIdx = entry.indexOf(":");
|
|
229
|
+
if (colonIdx < 0) {
|
|
230
|
+
list.push({ target: entry });
|
|
231
|
+
} else {
|
|
232
|
+
const target = entry.slice(0, colonIdx).trim();
|
|
233
|
+
const type = entry.slice(colonIdx + 1).trim();
|
|
234
|
+
if (!target) {
|
|
235
|
+
droppedEmpty = true;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
list.push(type ? { target, type } : { target });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
list,
|
|
243
|
+
warning: droppedEmpty ? "dropped empty connection entries" : null
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
73
247
|
// src/markdown/sanitize.ts
|
|
74
248
|
var SAFE_LINK_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto", "tel"]);
|
|
75
249
|
var SAFE_MEDIA_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "blob"]);
|
|
@@ -313,180 +487,6 @@ function stripUrlSchemeNoise(value) {
|
|
|
313
487
|
return out;
|
|
314
488
|
}
|
|
315
489
|
|
|
316
|
-
// src/markdown/annotationCoercion.ts
|
|
317
|
-
var KNOWN_BLOCK_META_KEYS = {
|
|
318
|
-
x: "number",
|
|
319
|
-
y: "number",
|
|
320
|
-
startTime: "time",
|
|
321
|
-
duration: "time",
|
|
322
|
-
connectsTo: "connectionList",
|
|
323
|
-
transition: "transition",
|
|
324
|
-
transitionDuration: "time",
|
|
325
|
-
transitionDirection: "transitionDirection"
|
|
326
|
-
};
|
|
327
|
-
var BLOCK_META_KEY_DESCRIPTORS = [
|
|
328
|
-
{
|
|
329
|
-
key: "transition",
|
|
330
|
-
description: "Block-to-block transition effect",
|
|
331
|
-
values: TRANSITION_TYPES
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
key: "transitionDuration",
|
|
335
|
-
description: "How long the transition lasts",
|
|
336
|
-
valueHint: "seconds \u2014 e.g. 0.7, 700ms"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
key: "transitionDirection",
|
|
340
|
-
description: "Directional variant for the transition",
|
|
341
|
-
values: TRANSITION_DIRECTIONS
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
key: "startTime",
|
|
345
|
-
description: "Timeline start time of this block",
|
|
346
|
-
valueHint: "mm:ss or seconds \u2014 e.g. 01:30, 5, 1500ms"
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
key: "duration",
|
|
350
|
-
description: "How long this block lasts",
|
|
351
|
-
valueHint: "mm:ss or seconds \u2014 e.g. 45, 1500ms"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
key: "x",
|
|
355
|
-
description: "Horizontal position on the diagram canvas",
|
|
356
|
-
valueHint: "number \u2014 e.g. 600"
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
key: "y",
|
|
360
|
-
description: "Vertical position on the diagram canvas",
|
|
361
|
-
valueHint: "number \u2014 e.g. 300"
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
key: "connectsTo",
|
|
365
|
-
description: "Diagram connections to other blocks",
|
|
366
|
-
valueHint: "comma-separated target or target:type \u2014 e.g. foo,bar:flow"
|
|
367
|
-
}
|
|
368
|
-
];
|
|
369
|
-
function coerceAnnotationValues(params) {
|
|
370
|
-
const blockMeta = {};
|
|
371
|
-
const metadata = {};
|
|
372
|
-
const warnings = [];
|
|
373
|
-
let transitionType = null;
|
|
374
|
-
let transitionDuration;
|
|
375
|
-
let transitionDirection;
|
|
376
|
-
for (const [key, raw] of Object.entries(params)) {
|
|
377
|
-
const kind = KNOWN_BLOCK_META_KEYS[key];
|
|
378
|
-
if (!kind) {
|
|
379
|
-
metadata[key] = raw;
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
if (kind === "number") {
|
|
383
|
-
const n = parseNumber(raw);
|
|
384
|
-
if (n == null) {
|
|
385
|
-
warnings.push(`Invalid number for "${key}": ${JSON.stringify(raw)}`);
|
|
386
|
-
} else {
|
|
387
|
-
blockMeta[key] = n;
|
|
388
|
-
}
|
|
389
|
-
} else if (kind === "time") {
|
|
390
|
-
const s = parseTimeSeconds(raw);
|
|
391
|
-
if (s == null) {
|
|
392
|
-
warnings.push(`Invalid time for "${key}": ${JSON.stringify(raw)}`);
|
|
393
|
-
} else if (key === "transitionDuration") {
|
|
394
|
-
transitionDuration = s;
|
|
395
|
-
} else {
|
|
396
|
-
blockMeta[key] = s;
|
|
397
|
-
}
|
|
398
|
-
} else if (kind === "connectionList") {
|
|
399
|
-
const { list, warning } = parseConnectionList(raw);
|
|
400
|
-
if (warning) warnings.push(`"${key}": ${warning}`);
|
|
401
|
-
blockMeta.connectsTo = list;
|
|
402
|
-
} else if (kind === "transition") {
|
|
403
|
-
const transition = normalizeTransitionType(raw);
|
|
404
|
-
if (transition == null) {
|
|
405
|
-
warnings.push(`Invalid transition for "${key}": ${JSON.stringify(raw)}`);
|
|
406
|
-
} else {
|
|
407
|
-
transitionType = transition;
|
|
408
|
-
}
|
|
409
|
-
} else if (kind === "transitionDirection") {
|
|
410
|
-
const direction = normalizeTransitionDirection(raw);
|
|
411
|
-
if (direction == null) {
|
|
412
|
-
warnings.push(`Invalid transition direction for "${key}": ${JSON.stringify(raw)}`);
|
|
413
|
-
} else {
|
|
414
|
-
transitionDirection = direction;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
if (transitionType) {
|
|
419
|
-
blockMeta.transition = {
|
|
420
|
-
type: transitionType,
|
|
421
|
-
...transitionDuration !== void 0 ? { duration: transitionDuration } : {},
|
|
422
|
-
...transitionDirection !== void 0 ? { direction: transitionDirection } : {}
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
return { blockMeta, metadata, warnings };
|
|
426
|
-
}
|
|
427
|
-
function parseNumber(raw) {
|
|
428
|
-
if (raw.trim() === "") return null;
|
|
429
|
-
const n = Number(raw);
|
|
430
|
-
return Number.isFinite(n) ? n : null;
|
|
431
|
-
}
|
|
432
|
-
var TIME_BARE_RE = /^\d+(?:\.\d+)?$/;
|
|
433
|
-
var TIME_MS_RE = /^(\d+(?:\.\d+)?)ms$/;
|
|
434
|
-
var TIME_MMSS_RE = /^(\d+):(\d{1,2})(?:\.(\d+))?$/;
|
|
435
|
-
function parseTimeSeconds(raw) {
|
|
436
|
-
const trimmed = raw.trim();
|
|
437
|
-
if (!trimmed) return null;
|
|
438
|
-
if (TIME_BARE_RE.test(trimmed)) {
|
|
439
|
-
const n = Number(trimmed);
|
|
440
|
-
return Number.isFinite(n) ? n : null;
|
|
441
|
-
}
|
|
442
|
-
const msMatch = trimmed.match(TIME_MS_RE);
|
|
443
|
-
if (msMatch) {
|
|
444
|
-
const n = Number(msMatch[1]);
|
|
445
|
-
return Number.isFinite(n) ? n / 1e3 : null;
|
|
446
|
-
}
|
|
447
|
-
const mmssMatch = trimmed.match(TIME_MMSS_RE);
|
|
448
|
-
if (mmssMatch) {
|
|
449
|
-
const mins = Number(mmssMatch[1]);
|
|
450
|
-
const secs = Number(mmssMatch[2]);
|
|
451
|
-
const frac = mmssMatch[3] ? Number(`0.${mmssMatch[3]}`) : 0;
|
|
452
|
-
if (!Number.isFinite(mins) || !Number.isFinite(secs) || !Number.isFinite(frac)) {
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
if (secs >= 60) return null;
|
|
456
|
-
return mins * 60 + secs + frac;
|
|
457
|
-
}
|
|
458
|
-
return null;
|
|
459
|
-
}
|
|
460
|
-
function parseConnectionList(raw) {
|
|
461
|
-
const trimmed = raw.trim();
|
|
462
|
-
if (!trimmed) return { list: [], warning: null };
|
|
463
|
-
const list = [];
|
|
464
|
-
let droppedEmpty = false;
|
|
465
|
-
for (const part of trimmed.split(",")) {
|
|
466
|
-
const entry = part.trim();
|
|
467
|
-
if (!entry) {
|
|
468
|
-
droppedEmpty = true;
|
|
469
|
-
continue;
|
|
470
|
-
}
|
|
471
|
-
const colonIdx = entry.indexOf(":");
|
|
472
|
-
if (colonIdx < 0) {
|
|
473
|
-
list.push({ target: entry });
|
|
474
|
-
} else {
|
|
475
|
-
const target = entry.slice(0, colonIdx).trim();
|
|
476
|
-
const type = entry.slice(colonIdx + 1).trim();
|
|
477
|
-
if (!target) {
|
|
478
|
-
droppedEmpty = true;
|
|
479
|
-
continue;
|
|
480
|
-
}
|
|
481
|
-
list.push(type ? { target, type } : { target });
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return {
|
|
485
|
-
list,
|
|
486
|
-
warning: droppedEmpty ? "dropped empty connection entries" : null
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
|
|
490
490
|
// src/markdown/attrTokens.ts
|
|
491
491
|
var DQ_RUN = `"(?:[^"\\\\]|\\\\.)*"`;
|
|
492
492
|
var SQ_RUN = `'(?:[^'\\\\]|\\\\.)*'`;
|
|
@@ -589,13 +589,13 @@ export {
|
|
|
589
589
|
CONTAINER_TEMPLATES,
|
|
590
590
|
isContainerTemplate,
|
|
591
591
|
isReservedAnnotationToken,
|
|
592
|
-
sanitizeUrl,
|
|
593
|
-
sanitizeHtmlNodes,
|
|
594
592
|
KNOWN_BLOCK_META_KEYS,
|
|
595
593
|
BLOCK_META_KEY_DESCRIPTORS,
|
|
596
594
|
coerceAnnotationValues,
|
|
597
595
|
parseNumber,
|
|
598
596
|
parseTimeSeconds,
|
|
597
|
+
sanitizeUrl,
|
|
598
|
+
sanitizeHtmlNodes,
|
|
599
599
|
matchTrailingTemplateAnnotation,
|
|
600
600
|
matchTrailingPandocAttr,
|
|
601
601
|
tokenizeAttrTokens,
|