@openpresentation/opf 0.32.1 → 0.33.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.
Files changed (95) hide show
  1. package/README.md +9 -0
  2. package/dist/browser.js +20 -20
  3. package/dist/{catalog-refs-kAefsZWT.d.ts → catalog-refs-B_0_vZg0.d.ts} +5 -0
  4. package/dist/{catalog-schemas-LdqOPebq.d.ts → catalog-schemas-CQTM-G8p.d.ts} +10 -4
  5. package/dist/{chunk-CLRYHWQN.js → chunk-ABWEUXLV.js} +72 -6
  6. package/dist/{chunk-XFHXQCXL.js → chunk-BI4ERFAA.js} +52 -1
  7. package/dist/{chunk-SZFO3MAJ.js → chunk-DAS75LGR.js} +3 -3
  8. package/dist/{chunk-F7DN33UL.js → chunk-E7WQHMCL.js} +6 -6
  9. package/dist/chunk-IJXKVM4W.js +221 -0
  10. package/dist/{chunk-AQEAZDL2.js → chunk-INIMUBSE.js} +2 -1
  11. package/dist/{chunk-NEJ32O7X.js → chunk-KVHNDHVS.js} +1 -1
  12. package/dist/{chunk-NVAJASOD.js → chunk-OPVJLL7H.js} +6867 -1862
  13. package/dist/{chunk-GM7WFPGG.js → chunk-PRXZD2II.js} +6 -1
  14. package/dist/{chunk-BBVW5ZC2.js → chunk-QD6DPS7X.js} +2 -2
  15. package/dist/{chunk-LEF4X4KI.js → chunk-QF5RSRXU.js} +1797 -170
  16. package/dist/{chunk-HKUV7NEN.js → chunk-R6C6BQOG.js} +1 -1
  17. package/dist/{chunk-IT7FQKED.js → chunk-S5QRGMUQ.js} +6 -6
  18. package/dist/{chunk-OXLA4HXQ.js → chunk-UK3J6FSU.js} +346 -53
  19. package/dist/{chunk-XQO2CT6Q.js → chunk-VKEYV3ZK.js} +1 -1
  20. package/dist/{chunk-ONVFUVQ5.js → chunk-VMBLNCX2.js} +31 -13
  21. package/dist/{chunk-YFJIIIOL.js → chunk-VSBZC2PR.js} +2 -2
  22. package/dist/{chunk-UJSAR6GF.js → chunk-W4DYDRV2.js} +21 -0
  23. package/dist/{chunk-J63CIRIV.js → chunk-XANW7MB7.js} +4 -4
  24. package/dist/{chunk-PB7ME64J.js → chunk-XIOC6N5P.js} +1 -1
  25. package/dist/{chunk-2E6CDYL2.js → chunk-Y557TYML.js} +5 -5
  26. package/dist/{chunk-SW676APJ.js → chunk-YS333HLA.js} +2 -2
  27. package/dist/chunk-YYT6N7AI.js +642 -0
  28. package/dist/chunk-ZXOIGUHX.js +1 -0
  29. package/dist/{composition-Ds6WHyO7.d.ts → composition-zMiIgzip.d.ts} +2353 -272
  30. package/dist/composition.d.ts +3 -2
  31. package/dist/composition.js +2 -2
  32. package/dist/conversion-POHRAMSN.js +24 -0
  33. package/dist/{conversion-CdzrTxib.d.ts → conversion-mNth9XKm.d.ts} +20 -9
  34. package/dist/convert.d.ts +3 -2
  35. package/dist/convert.js +9 -9
  36. package/dist/data.d.ts +1 -1
  37. package/dist/data.js +3 -3
  38. package/dist/{deck-report-CKDNQ2t4.d.ts → deck-report-BSlRiR0_.d.ts} +3 -3
  39. package/dist/deck.d.ts +6 -5
  40. package/dist/deck.js +12 -12
  41. package/dist/diagram-engine-eager.js +1 -1
  42. package/dist/diagram-engine-lazy.js +1 -1
  43. package/dist/diff.js +5 -5
  44. package/dist/docs.js +48 -24
  45. package/dist/examples.js +7507 -142
  46. package/dist/font-policy.js +1 -1
  47. package/dist/format.js +3 -3
  48. package/dist/ids.js +5 -5
  49. package/dist/index.d.ts +13 -12
  50. package/dist/index.js +24 -24
  51. package/dist/markdown.d.ts +2 -1
  52. package/dist/markdown.js +9 -9
  53. package/dist/node-engine.d.ts +7 -6
  54. package/dist/node-engine.js +24 -24
  55. package/dist/{pagination-DRZ_JNFY.d.ts → pagination-CYzNMazO.d.ts} +20 -3
  56. package/dist/pagination.d.ts +4 -3
  57. package/dist/pagination.js +5 -5
  58. package/dist/patch.js +4 -4
  59. package/dist/precompiled.js +3 -3
  60. package/dist/{presentation-DnD7mfmf.d.ts → presentation-CXhfpB_z.d.ts} +876 -39
  61. package/dist/repo-readme.js +2 -2
  62. package/dist/schema-engine-ajv.js +2 -2
  63. package/dist/schema-engine-precompiled.js +3 -3
  64. package/dist/schema.d.ts +2 -2
  65. package/dist/schema.js +4 -4
  66. package/dist/schemas.d.ts +40 -4
  67. package/dist/schemas.js +2 -2
  68. package/dist/shape-catalog.d.ts +98 -0
  69. package/dist/shape-catalog.js +302 -0
  70. package/dist/shape-engine-eager.js +9 -0
  71. package/dist/shape-engine-lazy.js +12 -0
  72. package/dist/shape-engine-module-BK7JNEUV.js +3 -0
  73. package/dist/shape-geometry.d.ts +126 -0
  74. package/dist/shape-geometry.js +2 -0
  75. package/dist/source.js +11 -11
  76. package/dist/spec/README.md +1 -1
  77. package/dist/spec/reference/preset-geometry.json +10699 -0
  78. package/dist/spec/reference/preset-geometry.schema.json +126 -0
  79. package/dist/spec/schemas/catalog-index.schema.json +1 -0
  80. package/dist/spec/schemas/chart-type.schema.json +4 -4
  81. package/dist/spec/schemas/icon-set.schema.json +75 -0
  82. package/dist/spec/schemas/layout.schema.json +14 -1
  83. package/dist/spec/schemas/opf.schema.json +1144 -196
  84. package/dist/spec-files.d.ts +1 -1
  85. package/dist/spec-files.js +2 -2
  86. package/dist/symbol-font-encodings.js +1 -1
  87. package/dist/types.d.ts +10 -6
  88. package/dist/{validation-types-DxyYPebs.d.ts → validation-types-COwTel3H.d.ts} +2 -2
  89. package/dist/validator.d.ts +5 -4
  90. package/dist/validator.js +4 -4
  91. package/dist/yaml.d.ts +2 -1
  92. package/dist/yaml.js +8 -8
  93. package/package.json +21 -5
  94. package/dist/chunk-DGS47ONG.js +0 -1
  95. package/dist/conversion-5FUDQPED.js +0 -24
@@ -0,0 +1,302 @@
1
+ import './chunk-PRXZD2II.js';
2
+
3
+ // src/shape-catalog.ts
4
+ var SHAPE_CATEGORIES = [
5
+ { id: "lines", title: "Lines" },
6
+ { id: "rectangles", title: "Rectangles" },
7
+ { id: "basic", title: "Basic Shapes" },
8
+ { id: "blockArrows", title: "Block Arrows" },
9
+ { id: "equations", title: "Equation Shapes" },
10
+ { id: "flowchart", title: "Flowchart" },
11
+ { id: "starsBanners", title: "Stars and Banners" },
12
+ { id: "callouts", title: "Callouts" },
13
+ { id: "actionButtons", title: "Action Buttons" }
14
+ ];
15
+ var ROWS = [
16
+ ["line", "lines", "straight line"],
17
+ ["lineInv", "lines", "straight line inverse diagonal"],
18
+ ["straightConnector1", "lines", "connector line arrow straight"],
19
+ ["bentConnector2", "lines", "elbow connector corner"],
20
+ ["bentConnector3", "lines", "elbow connector"],
21
+ ["bentConnector4", "lines", "elbow connector"],
22
+ ["bentConnector5", "lines", "elbow connector"],
23
+ ["curvedConnector2", "lines", "curve connector"],
24
+ ["curvedConnector3", "lines", "curve connector s curve"],
25
+ ["curvedConnector4", "lines", "curve connector"],
26
+ ["curvedConnector5", "lines", "curve connector"],
27
+ ["rect", "rectangles", "box square"],
28
+ ["roundRect", "rectangles", "rounded rectangle button card box"],
29
+ ["snip1Rect", "rectangles", "cut corner"],
30
+ ["snip2SameRect", "rectangles", "cut corners"],
31
+ ["snip2DiagRect", "rectangles", "cut corners"],
32
+ ["snipRoundRect", "rectangles", "cut round corner"],
33
+ ["round1Rect", "rectangles", "rounded corner"],
34
+ ["round2SameRect", "rectangles", "rounded corners tab"],
35
+ ["round2DiagRect", "rectangles", "rounded corners"],
36
+ ["ellipse", "basic", "circle oval round"],
37
+ ["triangle", "basic", "isosceles triangle"],
38
+ ["rtTriangle", "basic", "right triangle"],
39
+ ["parallelogram", "basic", "slanted rhomboid"],
40
+ ["trapezoid", "basic", "trapezium"],
41
+ ["nonIsoscelesTrapezoid", "basic", "trapezium"],
42
+ ["diamond", "basic", "rhombus"],
43
+ ["pentagon", "basic", "five sides regular polygon"],
44
+ ["hexagon", "basic", "six sides polygon honeycomb"],
45
+ ["heptagon", "basic", "seven sides polygon"],
46
+ ["octagon", "basic", "eight sides polygon stop sign"],
47
+ ["decagon", "basic", "ten sides polygon"],
48
+ ["dodecagon", "basic", "twelve sides polygon"],
49
+ ["pie", "basic", "pie slice sector wedge"],
50
+ ["pieWedge", "basic", "quarter pie slice"],
51
+ ["chord", "basic", "circle segment"],
52
+ ["teardrop", "basic", "drop water tear"],
53
+ ["frame", "basic", "border picture frame"],
54
+ ["halfFrame", "basic", "corner frame"],
55
+ ["corner", "basic", "l shape bracket"],
56
+ ["diagStripe", "basic", "diagonal stripe band"],
57
+ ["plus", "basic", "cross add medical"],
58
+ ["plaque", "basic", "badge label"],
59
+ ["can", "basic", "cylinder database storage"],
60
+ ["cube", "basic", "box 3d block"],
61
+ ["bevel", "basic", "button raised"],
62
+ ["donut", "basic", "ring circle hole"],
63
+ ["noSmoking", "basic", "prohibited forbidden ban not allowed"],
64
+ ["blockArc", "basic", "arc ring half circle rainbow"],
65
+ ["foldedCorner", "basic", "note page sticky paper"],
66
+ ["smileyFace", "basic", "smile emoji happy"],
67
+ ["heart", "basic", "love like favorite"],
68
+ ["lightningBolt", "basic", "lightning flash energy power electric"],
69
+ ["sun", "basic", "sunny day weather"],
70
+ ["moon", "basic", "crescent night"],
71
+ ["cloud", "basic", "weather cloud computing"],
72
+ ["arc", "basic", "curve arch"],
73
+ ["bracketPair", "basic", "brackets square"],
74
+ ["bracePair", "basic", "braces curly"],
75
+ ["leftBracket", "basic", "square bracket"],
76
+ ["rightBracket", "basic", "square bracket"],
77
+ ["leftBrace", "basic", "curly brace"],
78
+ ["rightBrace", "basic", "curly brace"],
79
+ ["gear6", "basic", "cog settings"],
80
+ ["gear9", "basic", "cog settings"],
81
+ ["funnel", "basic", "filter"],
82
+ ["cornerTabs", "basic", "corner marks"],
83
+ ["squareTabs", "basic", "corner marks"],
84
+ ["plaqueTabs", "basic", "corner marks"],
85
+ ["chartPlus", "basic", "chart marker"],
86
+ ["chartStar", "basic", "chart marker"],
87
+ ["chartX", "basic", "chart marker"],
88
+ ["rightArrow", "blockArrows", "arrow next forward"],
89
+ ["leftArrow", "blockArrows", "arrow back previous"],
90
+ ["upArrow", "blockArrows", "arrow"],
91
+ ["downArrow", "blockArrows", "arrow"],
92
+ ["leftRightArrow", "blockArrows", "double arrow horizontal"],
93
+ ["upDownArrow", "blockArrows", "double arrow vertical"],
94
+ ["quadArrow", "blockArrows", "four way arrow move"],
95
+ ["leftRightUpArrow", "blockArrows", "three way arrow"],
96
+ ["bentArrow", "blockArrows", "turn arrow"],
97
+ ["uturnArrow", "blockArrows", "u turn arrow return"],
98
+ ["leftUpArrow", "blockArrows", "bent arrow"],
99
+ ["bentUpArrow", "blockArrows", "turn arrow"],
100
+ ["curvedRightArrow", "blockArrows", "curve arrow"],
101
+ ["curvedLeftArrow", "blockArrows", "curve arrow"],
102
+ ["curvedUpArrow", "blockArrows", "curve arrow"],
103
+ ["curvedDownArrow", "blockArrows", "curve arrow"],
104
+ ["stripedRightArrow", "blockArrows", "arrow dashed"],
105
+ ["notchedRightArrow", "blockArrows", "arrow notch"],
106
+ ["homePlate", "blockArrows", "pentagon arrow step"],
107
+ ["chevron", "blockArrows", "arrow step process"],
108
+ ["rightArrowCallout", "blockArrows", "arrow label"],
109
+ ["downArrowCallout", "blockArrows", "arrow label"],
110
+ ["leftArrowCallout", "blockArrows", "arrow label"],
111
+ ["upArrowCallout", "blockArrows", "arrow label"],
112
+ ["leftRightArrowCallout", "blockArrows", "arrow label"],
113
+ ["upDownArrowCallout", "blockArrows", "arrow label"],
114
+ ["quadArrowCallout", "blockArrows", "arrow label"],
115
+ ["circularArrow", "blockArrows", "cycle refresh loop arrow"],
116
+ ["leftCircularArrow", "blockArrows", "cycle refresh loop arrow"],
117
+ ["leftRightCircularArrow", "blockArrows", "cycle refresh loop arrow"],
118
+ ["swooshArrow", "blockArrows", "swoosh arrow growth"],
119
+ ["mathPlus", "equations", "add plus equation"],
120
+ ["mathMinus", "equations", "subtract minus equation"],
121
+ ["mathMultiply", "equations", "times multiply cross equation"],
122
+ ["mathDivide", "equations", "divide equation"],
123
+ ["mathEqual", "equations", "equals equation"],
124
+ ["mathNotEqual", "equations", "not equal unequal equation"],
125
+ ["flowChartAlternateProcess", "flowchart", "rounded step"],
126
+ ["flowChartCollate", "flowchart", "hourglass"],
127
+ ["flowChartConnector", "flowchart", "circle join"],
128
+ ["flowChartDecision", "flowchart", "diamond choice branch if"],
129
+ ["flowChartDelay", "flowchart", "wait"],
130
+ ["flowChartDisplay", "flowchart", "screen monitor"],
131
+ ["flowChartDocument", "flowchart", "page report"],
132
+ ["flowChartExtract", "flowchart", "triangle"],
133
+ ["flowChartInputOutput", "flowchart", "data parallelogram"],
134
+ ["flowChartInternalStorage", "flowchart", "storage"],
135
+ ["flowChartMagneticDisk", "flowchart", "database disk cylinder"],
136
+ ["flowChartMagneticDrum", "flowchart", "drum storage"],
137
+ ["flowChartMagneticTape", "flowchart", "tape"],
138
+ ["flowChartManualInput", "flowchart", "keyboard input"],
139
+ ["flowChartManualOperation", "flowchart", "manual step"],
140
+ ["flowChartMerge", "flowchart", "triangle join"],
141
+ ["flowChartMultidocument", "flowchart", "pages reports"],
142
+ ["flowChartOfflineStorage", "flowchart", "storage triangle"],
143
+ ["flowChartOffpageConnector", "flowchart", "page reference"],
144
+ ["flowChartOnlineStorage", "flowchart", "storage"],
145
+ ["flowChartOr", "flowchart", "or circle"],
146
+ ["flowChartPredefinedProcess", "flowchart", "subprocess subroutine"],
147
+ ["flowChartPreparation", "flowchart", "hexagon setup"],
148
+ ["flowChartProcess", "flowchart", "rectangle step"],
149
+ ["flowChartPunchedCard", "flowchart", "card"],
150
+ ["flowChartPunchedTape", "flowchart", "tape"],
151
+ ["flowChartSort", "flowchart", "diamond order"],
152
+ ["flowChartSummingJunction", "flowchart", "sum circle cross"],
153
+ ["flowChartTerminator", "flowchart", "start end stop oval"],
154
+ ["irregularSeal1", "starsBanners", "burst explosion bang"],
155
+ ["irregularSeal2", "starsBanners", "burst explosion bang"],
156
+ ["star4", "starsBanners", "four point star sparkle"],
157
+ ["star5", "starsBanners", "five point star favorite rating"],
158
+ ["star6", "starsBanners", "six point star david"],
159
+ ["star7", "starsBanners", "seven point star"],
160
+ ["star8", "starsBanners", "eight point star"],
161
+ ["star10", "starsBanners", "ten point star"],
162
+ ["star12", "starsBanners", "twelve point star seal badge"],
163
+ ["star16", "starsBanners", "sixteen point star seal badge"],
164
+ ["star24", "starsBanners", "twenty four point star seal badge"],
165
+ ["star32", "starsBanners", "thirty two point star seal badge"],
166
+ ["ribbon2", "starsBanners", "banner up ribbon"],
167
+ ["ribbon", "starsBanners", "banner down ribbon"],
168
+ ["ellipseRibbon2", "starsBanners", "banner curved up ribbon"],
169
+ ["ellipseRibbon", "starsBanners", "banner curved down ribbon"],
170
+ ["leftRightRibbon", "starsBanners", "banner ribbon"],
171
+ ["verticalScroll", "starsBanners", "scroll paper banner"],
172
+ ["horizontalScroll", "starsBanners", "scroll paper banner"],
173
+ ["wave", "starsBanners", "banner flag water"],
174
+ ["doubleWave", "starsBanners", "banner flag water"],
175
+ ["wedgeRectCallout", "callouts", "speech bubble comment tooltip"],
176
+ ["wedgeRoundRectCallout", "callouts", "speech bubble comment tooltip"],
177
+ ["wedgeEllipseCallout", "callouts", "speech bubble comment thought oval"],
178
+ ["cloudCallout", "callouts", "thought bubble cloud comment"],
179
+ ["borderCallout1", "callouts", "line callout annotation"],
180
+ ["borderCallout2", "callouts", "line callout annotation"],
181
+ ["borderCallout3", "callouts", "line callout annotation"],
182
+ ["accentCallout1", "callouts", "line callout annotation"],
183
+ ["accentCallout2", "callouts", "line callout annotation"],
184
+ ["accentCallout3", "callouts", "line callout annotation"],
185
+ ["callout1", "callouts", "line callout annotation"],
186
+ ["callout2", "callouts", "line callout annotation"],
187
+ ["callout3", "callouts", "line callout annotation"],
188
+ ["accentBorderCallout1", "callouts", "line callout annotation"],
189
+ ["accentBorderCallout2", "callouts", "line callout annotation"],
190
+ ["accentBorderCallout3", "callouts", "line callout annotation"],
191
+ ["actionButtonBackPrevious", "actionButtons", "back previous button"],
192
+ ["actionButtonBeginning", "actionButtons", "first start button"],
193
+ ["actionButtonBlank", "actionButtons", "empty button"],
194
+ ["actionButtonDocument", "actionButtons", "file page button"],
195
+ ["actionButtonEnd", "actionButtons", "last finish button"],
196
+ ["actionButtonForwardNext", "actionButtons", "forward next button"],
197
+ ["actionButtonHelp", "actionButtons", "question mark button"],
198
+ ["actionButtonHome", "actionButtons", "house button"],
199
+ ["actionButtonInformation", "actionButtons", "info button"],
200
+ ["actionButtonMovie", "actionButtons", "video film button"],
201
+ ["actionButtonReturn", "actionButtons", "back return button"],
202
+ ["actionButtonSound", "actionButtons", "audio speaker volume button"]
203
+ ];
204
+ var split = (text) => text.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Za-z])([0-9])/g, "$1 $2").replace(/([0-9])([A-Za-z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
205
+ var SHAPE_CATALOG = Object.freeze(
206
+ ROWS.map((row) => Object.freeze({ name: row[0], category: row[1], keywords: Object.freeze(row[2] ? row[2].split(" ") : []) }))
207
+ );
208
+ var BY_NAME = new Map(SHAPE_CATALOG.map((entry) => [entry.name, entry]));
209
+ var WORDS = new Map(
210
+ SHAPE_CATALOG.map((entry) => {
211
+ const category = SHAPE_CATEGORIES.find((item) => item.id === entry.category);
212
+ return [
213
+ entry.name,
214
+ {
215
+ name: split(entry.name),
216
+ keywords: entry.keywords.flatMap(split),
217
+ category: [...split(category.id), ...split(category.title)],
218
+ joined: entry.name.toLowerCase()
219
+ }
220
+ ];
221
+ })
222
+ );
223
+ function shapeCatalogEntry(name) {
224
+ return BY_NAME.get(name);
225
+ }
226
+ function shapesInCategory(category) {
227
+ return SHAPE_CATALOG.filter((entry) => entry.category === category);
228
+ }
229
+ var stems = (word) => word.length > 3 && word.endsWith("s") ? [word, word.slice(0, -1)] : [word];
230
+ function wordScore(word, fields) {
231
+ let best = 0;
232
+ for (const form of stems(word)) {
233
+ const score = (words, equal, prefix) => words.includes(form) ? equal : words.some((item) => item.startsWith(form)) ? prefix : 0;
234
+ best = Math.max(
235
+ best,
236
+ score(fields.name, 10, 6),
237
+ score(fields.keywords, 5, 3),
238
+ score(fields.category, 2, 1),
239
+ fields.joined.includes(form) ? 1 : 0
240
+ );
241
+ }
242
+ return best;
243
+ }
244
+ function searchShapeCatalog(query = "", options = {}) {
245
+ const typed = query.trim();
246
+ const words = [...new Set(split(typed))];
247
+ const joined = typed.toLowerCase().replace(/[^a-z0-9]+/g, "");
248
+ const found = [];
249
+ for (const entry of SHAPE_CATALOG) {
250
+ if (options.category && entry.category !== options.category) continue;
251
+ const fields = WORDS.get(entry.name);
252
+ let score = 0;
253
+ if (words.length) {
254
+ let total = 0;
255
+ for (const word of words) {
256
+ const one = wordScore(word, fields);
257
+ if (!one) {
258
+ total = 0;
259
+ break;
260
+ }
261
+ total += one;
262
+ }
263
+ if (!total) continue;
264
+ score = total;
265
+ if (joined === fields.joined) score += 100;
266
+ else if (joined.length > 2 && fields.joined.startsWith(joined)) score += 20;
267
+ }
268
+ found.push({ entry, score });
269
+ }
270
+ found.sort((a, b) => b.score - a.score);
271
+ return options.limit === void 0 ? found : found.slice(0, Math.max(0, options.limit));
272
+ }
273
+ var FILL_OF = { norm: "solid", none: "none", lighten: "light", lightenLess: "light", darken: "dark", darkenLess: "dark" };
274
+ function shapeThumbnail(geometry, width, height) {
275
+ let minX = 0;
276
+ let minY = 0;
277
+ let maxX = width;
278
+ let maxY = height;
279
+ const grow = (x, y) => {
280
+ minX = Math.min(minX, x);
281
+ minY = Math.min(minY, y);
282
+ maxX = Math.max(maxX, x);
283
+ maxY = Math.max(maxY, y);
284
+ };
285
+ for (const path of geometry.paths) for (const command of path.commands) for (let at = 1; at < command.length; at += 2) grow(command[at], command[at + 1]);
286
+ const round = (value) => Math.round(value * 100) / 100;
287
+ return {
288
+ viewBox: `${round(minX)} ${round(minY)} ${round(maxX - minX)} ${round(maxY - minY)}`,
289
+ paths: geometry.paths.map((path) => ({ d: path.d, fill: FILL_OF[path.fill], stroke: path.stroke }))
290
+ };
291
+ }
292
+ function shapeThumbnailSvg(geometry, width, height, options = {}) {
293
+ const thumb = shapeThumbnail(geometry, width, height);
294
+ const stroke = options.stroke ?? "currentColor";
295
+ const fill = options.fill ?? "currentColor";
296
+ const line = options.strokeWidth ?? Math.round(Math.max(width, height) / 50 * 100) / 100;
297
+ const opacity = { solid: options.fill ? 1 : 0.18, light: options.fill ? 0.6 : 0.1, dark: options.fill ? 1 : 0.3, none: 0 };
298
+ const parts = thumb.paths.map((path) => `<path d="${path.d}" fill="${path.fill === "none" ? "none" : fill}"${path.fill === "none" ? "" : ` fill-opacity="${opacity[path.fill]}"`} stroke="${path.stroke ? stroke : "none"}"${path.stroke ? ` stroke-width="${line}" stroke-linejoin="round" stroke-linecap="round"` : ""}/>`);
299
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${thumb.viewBox}" role="img" aria-hidden="true">${parts.join("")}</svg>`;
300
+ }
301
+
302
+ export { SHAPE_CATALOG, SHAPE_CATEGORIES, searchShapeCatalog, shapeCatalogEntry, shapeThumbnail, shapeThumbnailSvg, shapesInCategory };
@@ -0,0 +1,9 @@
1
+ import { shape_engine_module_exports } from './chunk-IJXKVM4W.js';
2
+ import './chunk-YYT6N7AI.js';
3
+ import './chunk-PRXZD2II.js';
4
+
5
+ // src/shape-engine-eager.ts
6
+ var shapeGeometry = () => shape_engine_module_exports;
7
+ var loadShapeGeometry = async () => shape_engine_module_exports;
8
+
9
+ export { loadShapeGeometry, shapeGeometry };
@@ -0,0 +1,12 @@
1
+ import './chunk-PRXZD2II.js';
2
+
3
+ // src/shape-engine-lazy.ts
4
+ var loaded;
5
+ var loading;
6
+ var shapeGeometry = () => loaded;
7
+ function loadShapeGeometry() {
8
+ loading ??= import('./shape-engine-module-BK7JNEUV.js').then((module) => loaded = module);
9
+ return loading;
10
+ }
11
+
12
+ export { loadShapeGeometry, shapeGeometry };
@@ -0,0 +1,3 @@
1
+ export { sketchPathData, sketchSeed, starOutline } from './chunk-IJXKVM4W.js';
2
+ export { PRESET_SHAPES, adjustFromDrawingML, adjustToDrawingML, customGeometry, evaluateGuideFormula, flattenShapePath, isPresetShape, presetAdjustments, presetGeometry } from './chunk-YYT6N7AI.js';
3
+ import './chunk-PRXZD2II.js';
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Preset shape geometry (shapes SH-01): the 187 DrawingML preset shapes of ECMA-376 Part 1 (`ST_ShapeType`), evaluated
3
+ * to SVG path data for a size and a set of adjust values, plus OPF custom outlines (`path`, SVG path data).
4
+ *
5
+ * One definition drives both engines: the preview draws `presetGeometry(...)`; PPTX export writes the native
6
+ * `a:prstGeom` with its `a:avLst` (see `adjustToDrawingML`), so PowerPoint draws the same outline from its own definition.
7
+ *
8
+ * Units. Geometry comes out in the units of the `width` and `height` you pass (OPF reference pixels, EMU, anything).
9
+ * Adjust values are OPF units: a fraction for the values the standard writes in 1/100000 (DrawingML `val 25000` is
10
+ * OPF `0.25`; what dimension it is a fraction of depends on the shape, most often the shorter side), and degrees for
11
+ * the values the standard writes in 60000ths of a degree (the angle adjusts of arc, blockArc, chord, pie, the circular
12
+ * arrows and mathNotEqual; DrawingML `val 16200000` is OPF `270`). Angles of connection sites are degrees, clockwise
13
+ * from the positive x axis (y points down), as in DrawingML.
14
+ *
15
+ * Data: spec/reference/preset-geometry.json (generated from the standard's presetShapeDefinitions.xml; source and
16
+ * license in docs/shapes.md). Edge-safe: no Node import.
17
+ */
18
+ /** A DrawingML path fill mode: `norm` is the shape's fill; the others shade it; `none` is stroke only. */
19
+ type ShapePathFill = "norm" | "none" | "lighten" | "lightenLess" | "darken" | "darkenLess";
20
+ /** An absolute path command: move, line, cubic Bézier, quadratic Bézier, close. Arcs are converted to cubic Béziers. */
21
+ type ShapePathCommand = readonly ["M", number, number] | readonly ["L", number, number] | readonly ["C", number, number, number, number, number, number] | readonly ["Q", number, number, number, number] | readonly ["Z"];
22
+ interface ShapePath {
23
+ /** SVG path data in the requested size (absolute commands; preset arcs stay exact elliptical arcs). */
24
+ d: string;
25
+ fill: ShapePathFill;
26
+ stroke: boolean;
27
+ /** The same outline as absolute commands, arcs as cubic Béziers: for bounds, hit tests and native custom geometry. */
28
+ commands: readonly ShapePathCommand[];
29
+ }
30
+ interface ShapeRect {
31
+ x: number;
32
+ y: number;
33
+ width: number;
34
+ height: number;
35
+ }
36
+ interface ShapeConnectionSite {
37
+ x: number;
38
+ y: number;
39
+ /** The direction a connector leaves the site, in degrees clockwise from the positive x axis. */
40
+ angle: number;
41
+ }
42
+ /** One axis of an adjust handle: the adjust value it moves and that value's range (OPF units; null is unbounded). */
43
+ interface ShapeHandleAxis {
44
+ adjust: string;
45
+ min: number | null;
46
+ max: number | null;
47
+ }
48
+ interface ShapeHandle {
49
+ /** `xy` moves along x and/or y; `polar` moves a radius and/or an angle around the shape's center of the guide. */
50
+ kind: "xy" | "polar";
51
+ /** Where the handle is drawn. */
52
+ x: number;
53
+ y: number;
54
+ horizontal?: ShapeHandleAxis;
55
+ vertical?: ShapeHandleAxis;
56
+ radius?: ShapeHandleAxis;
57
+ angle?: ShapeHandleAxis;
58
+ }
59
+ interface ShapeGeometry {
60
+ paths: ShapePath[];
61
+ /** The text rectangle (the whole shape when the preset has none). */
62
+ textRect: ShapeRect;
63
+ connectionSites: ShapeConnectionSite[];
64
+ handles: ShapeHandle[];
65
+ }
66
+ interface ShapeAdjustment {
67
+ default: number;
68
+ /** The handle range at the size asked for (null when unbounded or when no handle moves the value). */
69
+ min: number | null;
70
+ max: number | null;
71
+ unit: "fraction" | "degrees";
72
+ }
73
+ /** OPF adjust values: names as DrawingML's guides (`adj`, `adj1`, ...), values as OPF fractions or degrees. */
74
+ type ShapeAdjustValues = Readonly<Record<string, number>>;
75
+ /** The 187 DrawingML preset shape names (ECMA-376 `ST_ShapeType`), in the order of the standard's definitions file. */
76
+ declare const PRESET_SHAPES: readonly string[];
77
+ /** True when `name` is one of the 187 preset shape names (case-sensitive, as DrawingML writes them). */
78
+ declare function isPresetShape(name: unknown): name is string;
79
+ /**
80
+ * The DrawingML `a:avLst` values for OPF adjust values: integers, in 1/100000 for fractions and 60000ths of a degree for
81
+ * angles (`{ adj1: 0.25 }` on `rightArrow` is `{ adj1: 25000 }`), in the preset's avLst order. When any value is
82
+ * given, every avLst value is written, the others at their defaults, as PowerPoint writes them: PowerPoint refuses to open a
83
+ * file whose avLst names a hexagon's or star's `adj` without its `hf`/`vf` factors. No value (or none the preset has)
84
+ * gives `{}`, an empty avLst: the preset's defaults.
85
+ */
86
+ declare function adjustToDrawingML(name: string, adjust: ShapeAdjustValues | undefined): Record<string, number>;
87
+ /** OPF adjust values for DrawingML `a:avLst` values (the inverse of `adjustToDrawingML`). */
88
+ declare function adjustFromDrawingML(name: string, avLst: Readonly<Record<string, number>>): Record<string, number>;
89
+ /**
90
+ * Evaluates one DrawingML guide formula (such as `+- r 0 dx1`) against the guides defined so far. Angles are 60000ths of a
91
+ * degree, as the standard writes them. Exported for tests and for hosts that evaluate their own `a:custGeom` guides.
92
+ */
93
+ declare function evaluateGuideFormula(formula: string, guides: ReadonlyMap<string, number> | Readonly<Record<string, number>>): number;
94
+ /**
95
+ * The adjust values of a preset: each one's default and, from the handle that moves it, its range at the size asked for
96
+ * (handle ranges can depend on the size; the default size is a square). OPF units: fractions and degrees (see the module
97
+ * comment). A preset with no adjust values gives `{}`.
98
+ */
99
+ declare function presetAdjustments(name: string, width?: number, height?: number): Record<string, ShapeAdjustment>;
100
+ /**
101
+ * Evaluates a preset at a size: its paths as SVG path data (each with its DrawingML fill mode and stroke flag), its text
102
+ * rectangle, its connection sites and its adjust handles, all in the units of `width` and `height`. `adjust` takes OPF
103
+ * adjust values (fractions and degrees); values outside a handle's range are pinned by the preset's own guides, exactly
104
+ * as PowerPoint pins them.
105
+ */
106
+ declare function presetGeometry(name: string, width: number, height: number, adjust?: ShapeAdjustValues): ShapeGeometry;
107
+ /** An OPF custom outline: SVG path data in a 0 to 1 box, or in its `viewBox` (`"minX minY width height"` or four numbers). */
108
+ type CustomPathInput = string | {
109
+ d: string;
110
+ viewBox?: string | readonly [number, number, number, number];
111
+ };
112
+ /**
113
+ * Evaluates an OPF custom outline (`path`): SVG path data in a 0 to 1 box (or in its viewBox), scaled to width by height.
114
+ * The result has the shape of `presetGeometry`'s: one filled and stroked path (arcs as cubic Béziers, so a non-uniform
115
+ * scale stays exact), the whole box as the text rectangle, and the four edge midpoints as connection sites (top, left,
116
+ * bottom, right, as DrawingML's rect).
117
+ */
118
+ declare function customGeometry(pathData: CustomPathInput, width: number, height: number): ShapeGeometry;
119
+ /** Flattens path commands to polylines (one per subpath), `segments` points per curve. */
120
+ declare function flattenShapePath(commands: readonly ShapePathCommand[], segments?: number): {
121
+ x: number;
122
+ y: number;
123
+ }[][];
124
+
125
+ export { PRESET_SHAPES, adjustFromDrawingML, adjustToDrawingML, customGeometry, evaluateGuideFormula, flattenShapePath, isPresetShape, presetAdjustments, presetGeometry };
126
+ export type { CustomPathInput, ShapeAdjustValues, ShapeAdjustment, ShapeConnectionSite, ShapeGeometry, ShapeHandle, ShapeHandleAxis, ShapePath, ShapePathCommand, ShapePathFill, ShapeRect };
@@ -0,0 +1,2 @@
1
+ export { PRESET_SHAPES, adjustFromDrawingML, adjustToDrawingML, customGeometry, evaluateGuideFormula, flattenShapePath, isPresetShape, presetAdjustments, presetGeometry } from './chunk-YYT6N7AI.js';
2
+ import './chunk-PRXZD2II.js';
package/dist/source.js CHANGED
@@ -1,15 +1,15 @@
1
- export { explain } from './chunk-XFHXQCXL.js';
2
- import { readMarkdown, frontMatter, splitSegments, isOutline, NOTES, fenceStart, fenceClose, COMMENT } from './chunk-2E6CDYL2.js';
3
- import './chunk-NEJ32O7X.js';
4
- import { splitLines } from './chunk-BBVW5ZC2.js';
5
- export { analyzeYamlSyntax } from './chunk-BBVW5ZC2.js';
6
- import './chunk-XQO2CT6Q.js';
7
- import { rememberByText, SLIDE_OPTION_KEYS, FENCE_KINDS, createLocator, parsePointer } from './chunk-OXLA4HXQ.js';
8
- export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SPAN_FLAGS, SPAN_VALUES, analyzeJsonSyntax, applyTextEdits, describeFinding, distance, nearest, segmentsOf as pointerSegments, starterValue } from './chunk-OXLA4HXQ.js';
1
+ export { explain } from './chunk-BI4ERFAA.js';
2
+ import { readMarkdown, frontMatter, splitSegments, isOutline, NOTES, fenceStart, fenceClose, COMMENT } from './chunk-Y557TYML.js';
3
+ import './chunk-KVHNDHVS.js';
4
+ import { splitLines } from './chunk-QD6DPS7X.js';
5
+ export { analyzeYamlSyntax } from './chunk-QD6DPS7X.js';
6
+ import './chunk-VKEYV3ZK.js';
7
+ import { rememberByText, SLIDE_OPTION_KEYS, FENCE_KINDS, createLocator, parsePointer } from './chunk-UK3J6FSU.js';
8
+ export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SPAN_FLAGS, SPAN_VALUES, analyzeJsonSyntax, applyTextEdits, describeFinding, distance, nearest, segmentsOf as pointerSegments, starterValue } from './chunk-UK3J6FSU.js';
9
9
  import './chunk-JBARNYFR.js';
10
- import './chunk-LEF4X4KI.js';
11
- import './chunk-NVAJASOD.js';
12
- import './chunk-GM7WFPGG.js';
10
+ import './chunk-QF5RSRXU.js';
11
+ import './chunk-OPVJLL7H.js';
12
+ import './chunk-PRXZD2II.js';
13
13
  import { findNodeAtOffset, getNodePath, parseTree } from 'jsonc-parser';
14
14
  import { parseDocument, isMap, isSeq, isScalar, isAlias } from 'yaml';
15
15
 
@@ -17,7 +17,7 @@ New to the format? Read [`docs/how-opf-works.md`](../docs/how-opf-works.md) firs
17
17
 
18
18
  ## Layout templates and previews
19
19
 
20
- The gallery package's `catalog/layouts/` contains the 30 v2 intent templates that `Slide.layout` resolves against. They are ordered lists of regions with content rules, nested for two dimensions; examples include `cover`, `text`, `chart` and `two-column`.
20
+ The gallery package's `catalog/layouts/` contains the 36 v2 intent templates that `Slide.layout` resolves against. They are ordered lists of regions with content rules, nested for two dimensions; examples include `cover`, `text`, `chart` and `two-column`.
21
21
 
22
22
  `previews/layouts/` contains one self-contained SVG preview for each template, keyed by the same layout id. Its version-2 index names the SVG filename and exact UTF-8 byte length. Picker thumbnails therefore show the template the slide will use.
23
23