@bendyline/squisq 2.13.11 → 2.13.13
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/{Doc-DqYt_b2b.d.ts → Doc-BhvotZx_.d.ts} +48 -2
- package/dist/{ImageEditDoc-CXXiXVJ-.d.ts → ImageEditDoc-D8hYio6b.d.ts} +1 -1
- package/dist/{chunk-S76W65BB.js → chunk-5DFFVW75.js} +1 -1
- package/dist/{chunk-DOOUVVOM.js → chunk-7MS26OXD.js} +4 -0
- package/dist/{chunk-XDOSE5M3.js → chunk-C4SB3NN4.js} +1 -1
- package/dist/{chunk-SKGMNBQX.js → chunk-CTT4XAGO.js} +2033 -375
- package/dist/{chunk-SG3HXPMF.js → chunk-DBVCSVNV.js} +2 -1
- package/dist/chunk-FCB6JLWB.js +125 -0
- package/dist/{chunk-WNEH3BZP.js → chunk-JNUNNQ74.js} +3 -3
- package/dist/chunk-L4AFSOT3.js +26 -0
- package/dist/{chunk-65WL5ILB.js → chunk-OIQ2GO2O.js} +1 -1
- package/dist/{chunk-3WUI2N6C.js → chunk-SGNWO7OF.js} +20 -1
- package/dist/{chunk-ESGKI6CD.js → chunk-TCGGJUKC.js} +25 -6
- package/dist/{chunk-GLWQTZ4C.js → chunk-XEQALK5B.js} +1 -1
- package/dist/{chunk-N7I6JP6Q.js → chunk-YQQWE4HG.js} +413 -216
- package/dist/doc/index.d.ts +225 -9
- package/dist/doc/index.js +32 -7
- package/dist/fence/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/imageEdit/index.d.ts +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.js +79 -11
- package/dist/jsonForm/index.d.ts +1 -1
- package/dist/jsonForm/index.js +3 -3
- package/dist/markdown/index.js +3 -3
- package/dist/{materializePageSection-S2hxZ_lO.d.ts → materializePageSection-CWxou4mX.d.ts} +62 -2
- package/dist/mediaEdit/index.d.ts +2 -2
- package/dist/narration/index.d.ts +1 -1
- package/dist/narration/index.js +5 -5
- package/dist/recommend/index.js +1 -1
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/index.js +2 -2
- package/dist/{themeLibrary-CFJbeItn.d.ts → themeLibrary-BIYE6aLw.d.ts} +1 -1
- package/dist/timing/index.d.ts +58 -2
- package/dist/timing/index.js +9 -1
- package/dist/transform/index.d.ts +173 -72
- package/dist/transform/index.js +43 -6
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
relativeLuminance,
|
|
16
16
|
resolveFontFamily,
|
|
17
17
|
withAlpha
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JNUNNQ74.js";
|
|
19
19
|
import {
|
|
20
20
|
SVG_ISLAND_LIMITS,
|
|
21
21
|
parseBuildSpec
|
|
@@ -216,6 +216,7 @@ function validateLayerContent(type, content, path, issues) {
|
|
|
216
216
|
optionalFiniteNumber(content, "maxVisibleRows", `${path}.maxVisibleRows`, issues, {
|
|
217
217
|
min: 1
|
|
218
218
|
});
|
|
219
|
+
optionalBoolean(content, "wrap", `${path}.wrap`, issues);
|
|
219
220
|
requiredRecord(content, "style", `${path}.style`, issues);
|
|
220
221
|
break;
|
|
221
222
|
case "tree":
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// src/transform/grounding.ts
|
|
2
|
+
var NUMBER = /\d[\d,]*(?:\.\d+)?/gu;
|
|
3
|
+
function normalizeGroundingText(text) {
|
|
4
|
+
return text.toLowerCase().replace(/[‘’ʼ`]/gu, "'").replace(/[“”]/gu, '"').replace(/[–—]/gu, "-").replace(/[^a-z0-9'%\s-]/gu, " ").replace(/\s+/gu, " ").trim();
|
|
5
|
+
}
|
|
6
|
+
function numbersIn(value) {
|
|
7
|
+
if (typeof value === "number") return Number.isFinite(value) ? [String(value)] : [];
|
|
8
|
+
return (value.match(NUMBER) ?? []).map((number) => number.replace(/,/gu, ""));
|
|
9
|
+
}
|
|
10
|
+
var UNIT_WORDS = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
|
|
11
|
+
var TEEN_WORDS = [
|
|
12
|
+
"ten",
|
|
13
|
+
"eleven",
|
|
14
|
+
"twelve",
|
|
15
|
+
"thirteen",
|
|
16
|
+
"fourteen",
|
|
17
|
+
"fifteen",
|
|
18
|
+
"sixteen",
|
|
19
|
+
"seventeen",
|
|
20
|
+
"eighteen",
|
|
21
|
+
"nineteen"
|
|
22
|
+
];
|
|
23
|
+
var TENS_WORDS = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
|
|
24
|
+
var NUMBER_WORD = new RegExp(
|
|
25
|
+
`\\b(?:(${TENS_WORDS.join("|")})(?:[-\\s](${UNIT_WORDS.join("|")}))?|(${[...UNIT_WORDS.slice(1), ...TEEN_WORDS].join("|")}))\\b`,
|
|
26
|
+
"giu"
|
|
27
|
+
);
|
|
28
|
+
function spelledNumbers(source) {
|
|
29
|
+
return [...source.matchAll(NUMBER_WORD)].map((match) => {
|
|
30
|
+
const [, tens, unit, small] = match;
|
|
31
|
+
const value = small ? [...UNIT_WORDS, ...TEEN_WORDS].indexOf(small.toLowerCase()) + 1 : (TENS_WORDS.indexOf(tens.toLowerCase()) + 2) * 10 + (unit ? UNIT_WORDS.indexOf(unit.toLowerCase()) + 1 : 0);
|
|
32
|
+
return { value: String(value), index: match.index };
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function sourceNumbers(source) {
|
|
36
|
+
return /* @__PURE__ */ new Set([...numbersIn(source), ...spelledNumbers(source).map(({ value }) => value)]);
|
|
37
|
+
}
|
|
38
|
+
function ungroundedNumber(values, source) {
|
|
39
|
+
const stated = typeof source === "string" ? sourceNumbers(source) : source;
|
|
40
|
+
const list = Array.isArray(values) ? values : [values];
|
|
41
|
+
for (const value of list) {
|
|
42
|
+
const missing = numbersIn(value).find((number) => !stated.has(number));
|
|
43
|
+
if (missing !== void 0) return missing;
|
|
44
|
+
}
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
function groundingSentences(text) {
|
|
48
|
+
return (text.match(/[^.!?\n]+[.!?]*/gu) ?? []).map((sentence) => sentence.trim()).filter(Boolean);
|
|
49
|
+
}
|
|
50
|
+
function isVerbatimQuote(quote, source, options = {}) {
|
|
51
|
+
const q = normalizeGroundingText(quote);
|
|
52
|
+
if (!q) return false;
|
|
53
|
+
if (normalizeGroundingText(source).includes(q)) return true;
|
|
54
|
+
const words = q.split(" ").filter((word) => word.length > 1);
|
|
55
|
+
if (words.length === 0) return false;
|
|
56
|
+
const minShare = options.minShare ?? 0.9;
|
|
57
|
+
for (const sentence of options.sentences ?? groundingSentences(source)) {
|
|
58
|
+
const present = new Set(normalizeGroundingText(sentence).split(" "));
|
|
59
|
+
const hits = words.filter((word) => present.has(word)).length;
|
|
60
|
+
if (hits / words.length >= minShare) return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
var COMMON = new Set(
|
|
65
|
+
"about after also because been before being both could does each from have into just like more most much only other over same should some such than that their them then there these they this those through very what when where which while will with would your ours".split(
|
|
66
|
+
" "
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
function distinctiveStems(text) {
|
|
70
|
+
return (text.toLowerCase().replace(/[‘’]/gu, "'").replace(/[“”]/gu, '"').replace(/[‐‑]/gu, "-").replace(/[‒–—―]/gu, " ").match(/[\p{L}\p{N}][\p{L}\p{N}'-]*/gu) ?? []).filter((word) => word.length >= 4 && !COMMON.has(word)).map((word) => word.slice(0, 4));
|
|
71
|
+
}
|
|
72
|
+
function isGroundedParaphrase(text, source, options = {}) {
|
|
73
|
+
if (ungroundedNumber(text, source) !== void 0) return false;
|
|
74
|
+
const stems = new Set(distinctiveStems(source));
|
|
75
|
+
const words = distinctiveStems(text);
|
|
76
|
+
const minShare = options.minShare ?? 2 / 3;
|
|
77
|
+
return words.filter((word) => stems.has(word)).length >= Math.ceil(words.length * minShare);
|
|
78
|
+
}
|
|
79
|
+
function restatesHeadline(point, headline) {
|
|
80
|
+
const title = distinctiveStems(headline);
|
|
81
|
+
const words = distinctiveStems(point);
|
|
82
|
+
const shared = words.filter((word) => title.includes(word)).length;
|
|
83
|
+
return words.length > 0 && shared >= words.length * 0.6 || title.length >= 3 && title.every((word) => words.includes(word));
|
|
84
|
+
}
|
|
85
|
+
var RANGE = /(?:\bbetween\s+(\d[\d,]*(?:\.\d+)?)\s+and\s+(\d[\d,]*(?:\.\d+)?))|(?:(\d[\d,]*(?:\.\d+)?)\s*(?:[-–—]|\bto\b)\s*(\d[\d,]*(?:\.\d+)?))/giu;
|
|
86
|
+
function statedRanges(source) {
|
|
87
|
+
return [...source.matchAll(RANGE)].map((match) => ({
|
|
88
|
+
low: (match[1] ?? match[3]).replace(/,/gu, ""),
|
|
89
|
+
high: (match[2] ?? match[4]).replace(/,/gu, ""),
|
|
90
|
+
text: match[0],
|
|
91
|
+
index: match.index
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
function rangeEndOnly(value, source) {
|
|
95
|
+
const [number] = numbersIn(value);
|
|
96
|
+
if (number === void 0) return void 0;
|
|
97
|
+
const ranges = statedRanges(source);
|
|
98
|
+
if (ranges.length === 0) return void 0;
|
|
99
|
+
if (spelledNumbers(source).some((spelled) => spelled.value === number)) return void 0;
|
|
100
|
+
let first;
|
|
101
|
+
for (const match of source.matchAll(NUMBER)) {
|
|
102
|
+
if (match[0].replace(/,/gu, "") !== number) continue;
|
|
103
|
+
const range = ranges.find(
|
|
104
|
+
(candidate) => match.index >= candidate.index && match.index < candidate.index + candidate.text.length
|
|
105
|
+
);
|
|
106
|
+
if (!range) return void 0;
|
|
107
|
+
first ?? (first = range);
|
|
108
|
+
}
|
|
109
|
+
return first;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
normalizeGroundingText,
|
|
114
|
+
numbersIn,
|
|
115
|
+
spelledNumbers,
|
|
116
|
+
sourceNumbers,
|
|
117
|
+
ungroundedNumber,
|
|
118
|
+
groundingSentences,
|
|
119
|
+
isVerbatimQuote,
|
|
120
|
+
distinctiveStems,
|
|
121
|
+
isGroundedParaphrase,
|
|
122
|
+
restatesHeadline,
|
|
123
|
+
statedRanges,
|
|
124
|
+
rangeEndOnly
|
|
125
|
+
};
|
|
@@ -1816,7 +1816,7 @@ var documentary_default = {
|
|
|
1816
1816
|
},
|
|
1817
1817
|
typography: {
|
|
1818
1818
|
bodyFont: {
|
|
1819
|
-
stackId: "
|
|
1819
|
+
stackId: "inter"
|
|
1820
1820
|
},
|
|
1821
1821
|
titleFont: {
|
|
1822
1822
|
stackId: "playfair"
|
|
@@ -2100,7 +2100,7 @@ var morning_light_default = {
|
|
|
2100
2100
|
},
|
|
2101
2101
|
typography: {
|
|
2102
2102
|
bodyFont: {
|
|
2103
|
-
stackId: "
|
|
2103
|
+
stackId: "dm-sans"
|
|
2104
2104
|
},
|
|
2105
2105
|
titleFont: {
|
|
2106
2106
|
stackId: "merriweather"
|
|
@@ -2638,7 +2638,7 @@ var warm_earth_default = {
|
|
|
2638
2638
|
warning: "#e53e3e"
|
|
2639
2639
|
},
|
|
2640
2640
|
typography: {
|
|
2641
|
-
bodyFont: { stackId: "
|
|
2641
|
+
bodyFont: { stackId: "dm-sans" },
|
|
2642
2642
|
titleFont: { stackId: "pt-serif" },
|
|
2643
2643
|
captionFont: { stackId: "pt-sans" },
|
|
2644
2644
|
captionCase: "as-written",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/timing/wordTiming.ts
|
|
2
|
+
function wordTimeAt(bookmarks, offset, snap = "containing") {
|
|
3
|
+
if (snap === "next") return bookmarks.find((word) => word.charOffset >= offset)?.time;
|
|
4
|
+
let best = bookmarks[0];
|
|
5
|
+
for (const bookmark of bookmarks) {
|
|
6
|
+
if (bookmark.charOffset <= offset) best = bookmark;
|
|
7
|
+
else break;
|
|
8
|
+
}
|
|
9
|
+
return best?.time;
|
|
10
|
+
}
|
|
11
|
+
function phraseOffset(timeline, phrase, from = 0) {
|
|
12
|
+
return phrase ? timeline.sourceText.indexOf(phrase, from) : -1;
|
|
13
|
+
}
|
|
14
|
+
function phraseStartTime(timeline, phrase, options = {}) {
|
|
15
|
+
const offset = phraseOffset(timeline, phrase, options.from ?? 0);
|
|
16
|
+
if (offset < 0) return null;
|
|
17
|
+
const time = wordTimeAt(timeline.bookmarks, offset, options.snap);
|
|
18
|
+
if (time === void 0) return null;
|
|
19
|
+
return Math.max(0, time - (options.lead ?? 0));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
wordTimeAt,
|
|
24
|
+
phraseOffset,
|
|
25
|
+
phraseStartTime
|
|
26
|
+
};
|
|
@@ -3111,7 +3111,7 @@ function findFirstList(contents) {
|
|
|
3111
3111
|
}
|
|
3112
3112
|
|
|
3113
3113
|
// src/recommend/numberHighlight.ts
|
|
3114
|
-
var NUMBER_HIGHLIGHT_RE = /(?:[$€£¥]\s?\d+(?:[.,]\d+)*(?:\s?(?:[MBK]|million|billion|thousand))?|\d+(?:[.,]\d+)*\s?(?:%|‰|x
|
|
3114
|
+
var NUMBER_HIGHLIGHT_RE = /(?:[$€£¥]\s?\d+(?:[.,]\d+)*(?:\s?(?:[MBK]|million|billion|thousand)(?![a-z]))?|\d+(?:[.,]\d+)*\s?(?:%|‰|(?:x|×)(?!\s?\d)|[MBK]|million|billion|thousand|percent|times|years?|days?|hours?)(?![a-z])|(?<![\d.,])(?<!\d\s?(?:by|x|×)\s?)(?:\d{1,3}(?:,\d{3})+|\d{3,})(?:\.\d+)?(?![\d.,]?\d)(?!\s?(?:by|x|×)\s?\d))/i;
|
|
3115
3115
|
function matchNumberHighlight(text) {
|
|
3116
3116
|
const match = NUMBER_HIGHLIGHT_RE.exec(text);
|
|
3117
3117
|
if (!match || match.index === void 0) return null;
|
|
@@ -3666,6 +3666,25 @@ function deriveTemplateInputs(templateName, headingText, contents, options = {})
|
|
|
3666
3666
|
}
|
|
3667
3667
|
return placeholders ? { items: ["Item 1", "Item 2", "Item 3"] } : null;
|
|
3668
3668
|
}
|
|
3669
|
+
case "cards":
|
|
3670
|
+
case "process":
|
|
3671
|
+
case "cycle":
|
|
3672
|
+
case "layers": {
|
|
3673
|
+
const listed = extractListItems(contents);
|
|
3674
|
+
const items = listed.length ? listed : (contents ?? []).filter((node) => node.type === "paragraph" && !isPictureParagraph(node)).map((node) => extractPlainText(node).trim()).filter(Boolean);
|
|
3675
|
+
if (items.length > 0) return { items, ...headingText ? { title: headingText } : {} };
|
|
3676
|
+
return placeholders ? {
|
|
3677
|
+
items: templateName === "cards" ? [
|
|
3678
|
+
"First idea: what makes it matter",
|
|
3679
|
+
"Second idea: how it differs",
|
|
3680
|
+
"Third idea: why it helps"
|
|
3681
|
+
] : templateName === "layers" ? [
|
|
3682
|
+
"Core: the innermost part",
|
|
3683
|
+
"Middle: what surrounds it",
|
|
3684
|
+
"Outer: the outermost layer"
|
|
3685
|
+
] : ["Begin: the first stage", "Grow: what happens next", "Finish: where it leads"]
|
|
3686
|
+
} : null;
|
|
3687
|
+
}
|
|
3669
3688
|
case "definitionCard":
|
|
3670
3689
|
return { term: headingText, definition: bodyText };
|
|
3671
3690
|
case "dateEvent":
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HKHOFTGM.js";
|
|
4
4
|
import {
|
|
5
5
|
applySavedPresentation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YQQWE4HG.js";
|
|
7
7
|
import {
|
|
8
8
|
SHAPE_NAMES,
|
|
9
9
|
buildChartData,
|
|
@@ -28,10 +28,11 @@ import {
|
|
|
28
28
|
placeLayersInRect,
|
|
29
29
|
readCustomThemesFromFrontmatter,
|
|
30
30
|
resolvePersistentLayers,
|
|
31
|
+
splitConceptItem,
|
|
31
32
|
templateRegistry,
|
|
32
33
|
writeCustomTemplatesToFrontmatter,
|
|
33
34
|
writeCustomThemesToFrontmatter
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CTT4XAGO.js";
|
|
35
36
|
import {
|
|
36
37
|
ASCII_TREE_VOCAB,
|
|
37
38
|
ASCII_VOCAB,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
toCells,
|
|
55
56
|
toGrid,
|
|
56
57
|
traceBoxes
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-SGNWO7OF.js";
|
|
58
59
|
import {
|
|
59
60
|
iconMarker
|
|
60
61
|
} from "./chunk-7ZAAICW4.js";
|
|
@@ -78,7 +79,7 @@ import {
|
|
|
78
79
|
resolveFontFamily,
|
|
79
80
|
resolveTheme,
|
|
80
81
|
withAlpha
|
|
81
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-JNUNNQ74.js";
|
|
82
83
|
import {
|
|
83
84
|
createMediaTimeMap
|
|
84
85
|
} from "./chunk-JSGIWW35.js";
|
|
@@ -87,13 +88,13 @@ import {
|
|
|
87
88
|
} from "./chunk-L7QZORLB.js";
|
|
88
89
|
import {
|
|
89
90
|
parseMarkdown
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-C4SB3NN4.js";
|
|
91
92
|
import {
|
|
92
93
|
TABLE_FED_TEMPLATES,
|
|
93
94
|
TEMPLATE_ALIASES,
|
|
94
95
|
isContainerTemplate,
|
|
95
96
|
resolveTemplateName
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-7MS26OXD.js";
|
|
97
98
|
import {
|
|
98
99
|
KNOWN_BLOCK_META_KEYS,
|
|
99
100
|
coerceAnnotationValues,
|
|
@@ -1476,6 +1477,20 @@ var list = (input) => {
|
|
|
1476
1477
|
colorScheme: l.colorScheme
|
|
1477
1478
|
};
|
|
1478
1479
|
};
|
|
1480
|
+
var concept = (input) => {
|
|
1481
|
+
const c = input;
|
|
1482
|
+
return {
|
|
1483
|
+
kind: "item-list",
|
|
1484
|
+
slots: {
|
|
1485
|
+
title: c.title,
|
|
1486
|
+
items: (c.items ?? []).map((item) => {
|
|
1487
|
+
const { label, detail } = splitConceptItem(item);
|
|
1488
|
+
return label ? { title: label, body: detail } : { body: detail };
|
|
1489
|
+
})
|
|
1490
|
+
},
|
|
1491
|
+
colorScheme: c.colorScheme
|
|
1492
|
+
};
|
|
1493
|
+
};
|
|
1479
1494
|
var photoGrid = (input) => {
|
|
1480
1495
|
const p = input;
|
|
1481
1496
|
const images = p.images ?? [];
|
|
@@ -1648,6 +1663,10 @@ var sectionExtractors = {
|
|
|
1648
1663
|
map,
|
|
1649
1664
|
fullBleedQuote,
|
|
1650
1665
|
list,
|
|
1666
|
+
cards: concept,
|
|
1667
|
+
process: concept,
|
|
1668
|
+
cycle: concept,
|
|
1669
|
+
layers: concept,
|
|
1651
1670
|
photoGrid,
|
|
1652
1671
|
definitionCard,
|
|
1653
1672
|
comparisonBar,
|