@officedk/pptxdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/build.d.ts +94 -0
- package/dist/build.js +148 -0
- package/dist/capabilities/dist/all.js +32 -0
- package/dist/capabilities/dist/box/box-codegen.js +51 -0
- package/dist/capabilities/dist/box/box-declaration.js +31 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +138 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +77 -0
- package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
- package/dist/capabilities/dist/chart/chart-elements.js +12 -0
- package/dist/capabilities/dist/chart/chart-import.js +2272 -0
- package/dist/capabilities/dist/chart/chart-labels.js +86 -0
- package/dist/capabilities/dist/chart/chart-model.js +9 -0
- package/dist/capabilities/dist/chart/chart-schemas.js +1078 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1124 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +298 -0
- package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
- package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
- package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
- package/dist/capabilities/dist/chart/preview/index.js +190 -0
- package/dist/capabilities/dist/chart/preview/layout.js +519 -0
- package/dist/capabilities/dist/chart/preview/legend.js +273 -0
- package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
- package/dist/capabilities/dist/chart/preview/markers.js +100 -0
- package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
- package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
- package/dist/capabilities/dist/chart/preview/scales.js +365 -0
- package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
- package/dist/capabilities/dist/chart/preview/style.js +48 -0
- package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
- package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
- package/dist/capabilities/dist/chart/preview/types.js +5 -0
- package/dist/capabilities/dist/document.js +148 -0
- package/dist/capabilities/dist/font/font-embedding.js +289 -0
- package/dist/capabilities/dist/font/font-family.js +10 -0
- package/dist/capabilities/dist/font/font-import.js +302 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +25 -0
- package/dist/capabilities/dist/group/group-codegen.js +51 -0
- package/dist/capabilities/dist/group/group-declaration.js +42 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +319 -0
- package/dist/capabilities/dist/group/group-xml.js +7 -0
- package/dist/capabilities/dist/group/group.js +211 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +94 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +221 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +778 -0
- package/dist/capabilities/dist/image/image-schemas.js +149 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +472 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +685 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +21 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +527 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +340 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1033 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2189 -0
- package/dist/capabilities/dist/motion/motion-query.js +420 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +216 -0
- package/dist/capabilities/dist/motion/motion.js +1372 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +20 -0
- package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
- package/dist/capabilities/dist/notes/notes-elements.js +12 -0
- package/dist/capabilities/dist/notes/notes-import.js +292 -0
- package/dist/capabilities/dist/notes/notes-schemas.js +35 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +191 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +23 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +12 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +292 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +166 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +57 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +579 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +337 -0
- package/dist/capabilities/dist/shared/geometry.js +1423 -0
- package/dist/capabilities/dist/shared/identity.js +205 -0
- package/dist/capabilities/dist/shared/morph-api.js +11 -0
- package/dist/capabilities/dist/shared/placeholder-import.js +113 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +21390 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +166 -0
- package/dist/capabilities/dist/shared/style-parse.js +11 -0
- package/dist/capabilities/dist/shared/text-schemas.js +216 -0
- package/dist/capabilities/dist/shared/text-service.js +1883 -0
- package/dist/capabilities/dist/shared/visual.js +918 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +161 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +21 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +221 -0
- package/dist/capabilities/dist/table/table-codegen.js +81 -0
- package/dist/capabilities/dist/table/table-declaration.js +15 -0
- package/dist/capabilities/dist/table/table-elements.js +27 -0
- package/dist/capabilities/dist/table/table-import.js +539 -0
- package/dist/capabilities/dist/table/table-schemas.js +279 -0
- package/dist/capabilities/dist/table/table-xml.js +37 -0
- package/dist/capabilities/dist/table/table.js +662 -0
- package/dist/capabilities/dist/text/text-codegen.js +129 -0
- package/dist/capabilities/dist/text/text-declaration.js +19 -0
- package/dist/capabilities/dist/text/text-elements.js +38 -0
- package/dist/capabilities/dist/text/text-import.js +1077 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +335 -0
- package/dist/capabilities/dist/transition/transition-api.js +139 -0
- package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
- package/dist/capabilities/dist/transition/transition-import.js +477 -0
- package/dist/capabilities/dist/transition/transition.js +260 -0
- package/dist/capability-D_xeNVIw.d.ts +29496 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +78 -0
- package/dist/codegen/dist/codegen.js +611 -0
- package/dist/codegen/dist/identifiers.js +193 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +49 -0
- package/dist/core/dist/author-ids.js +48 -0
- package/dist/core/dist/author-schemas.js +313 -0
- package/dist/core/dist/block-flex-layout.js +749 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +13 -0
- package/dist/core/dist/declaration.js +15 -0
- package/dist/core/dist/diagnostics.js +21 -0
- package/dist/core/dist/document-internals.js +13 -0
- package/dist/core/dist/document.js +408 -0
- package/dist/core/dist/geometry-schemas.js +249 -0
- package/dist/core/dist/grid-layout.js +445 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +45 -0
- package/dist/core/dist/layout-protocol.js +66 -0
- package/dist/core/dist/layout-schemas.js +208 -0
- package/dist/core/dist/layout.js +299 -0
- package/dist/core/dist/masters.js +169 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +213 -0
- package/dist/core/dist/query.js +155 -0
- package/dist/core/dist/resolution.js +11 -0
- package/dist/core/dist/resolve.js +1827 -0
- package/dist/core/dist/stage-options.js +67 -0
- package/dist/core/dist/theme.js +931 -0
- package/dist/document-BHPUODPP.d.ts +27759 -0
- package/dist/emit/dist/emit.js +936 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +606 -0
- package/dist/emit/dist/shape-tree.js +12 -0
- package/dist/import/dist/alternate-content.js +54 -0
- package/dist/import/dist/diagnostics.js +153 -0
- package/dist/import/dist/fonts.js +250 -0
- package/dist/import/dist/import.js +504 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1153 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +60 -0
- package/dist/import/dist/notes-masters.js +300 -0
- package/dist/import/dist/opc.js +233 -0
- package/dist/import/dist/resources.js +166 -0
- package/dist/import/dist/sections.js +139 -0
- package/dist/import/dist/themes.js +671 -0
- package/dist/import/dist/visual.js +761 -0
- package/dist/import/dist/xml-fragments.js +36 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-B5m3hqjC.d.ts +7 -0
- package/dist/index-CCy-Yo8G.d.ts +1208 -0
- package/dist/index-DpxcZ4Gs.d.ts +725 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +70 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +194 -0
- package/dist/pptxdk/src/cli-commands.js +913 -0
- package/dist/pptxdk/src/compose.js +44 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +240 -0
- package/dist/preview/dist/options.js +53 -0
- package/dist/preview-Cfw0QdMM.d.ts +86 -0
- package/dist/preview.d.ts +3 -0
- package/dist/preview.js +27 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +65 -0
- package/dist/react/dist/elements.js +59 -0
- package/dist/react/dist/index.js +68 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +27 -0
- package/dist/transition-Cips9wma.d.ts +82 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +14 -0
- package/package.json +78 -3
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { placeholderSizeSchema, slideBackgroundSchema, xml10StringSchema } from "./author-schemas.js";
|
|
2
|
+
import { CapabilityError } from "./diagnostics.js";
|
|
3
|
+
import { masterPlaceholderMapSchema, masterTextStylesSchema, placeholderMapSchema } from "./placeholders.js";
|
|
4
|
+
import { colorMapOverrideSchema, colorMapSchema, textStyleSchema, themeOverrideSchema } from "./theme.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
// ../core/dist/masters.js
|
|
7
|
+
/** OOXML `<p:hf>` header/footer visibility flags on SlideMaster and SlideLayout (ECMA-376 §19.3.1.24). */
|
|
8
|
+
const headerFooterSchema = z.strictObject({
|
|
9
|
+
dateTime: z.boolean().optional(),
|
|
10
|
+
footer: z.boolean().optional(),
|
|
11
|
+
header: z.boolean().optional(),
|
|
12
|
+
slideNumber: z.boolean().optional()
|
|
13
|
+
}).readonly();
|
|
14
|
+
/** Geometry, placeholder metadata, and default text/style for a `dt`, `ftr`, or `sldNum` slot. */
|
|
15
|
+
const footerPlaceholderSpecSchema = z.strictObject({
|
|
16
|
+
x: z.number().finite().optional(),
|
|
17
|
+
y: z.number().finite().optional(),
|
|
18
|
+
width: z.number().finite().positive().optional(),
|
|
19
|
+
height: z.number().finite().positive().optional(),
|
|
20
|
+
idx: z.number().int().nonnegative().optional(),
|
|
21
|
+
size: placeholderSizeSchema.optional(),
|
|
22
|
+
text: xml10StringSchema.optional(),
|
|
23
|
+
style: textStyleSchema.optional(),
|
|
24
|
+
visible: z.boolean().optional()
|
|
25
|
+
}).readonly();
|
|
26
|
+
/** Collection of date, footer, and slide-number metadata placeholder definitions on a master or layout. */
|
|
27
|
+
const footerPlaceholdersSchema = z.strictObject({
|
|
28
|
+
dateTime: footerPlaceholderSpecSchema.optional(),
|
|
29
|
+
footer: footerPlaceholderSpecSchema.optional(),
|
|
30
|
+
slideNumber: footerPlaceholderSpecSchema.optional()
|
|
31
|
+
}).readonly();
|
|
32
|
+
/** Official OOXML ST_SlideLayoutType enumeration values (ECMA-376 §19.7.15). */
|
|
33
|
+
const slideLayoutTypeValues = [
|
|
34
|
+
"title",
|
|
35
|
+
"tx",
|
|
36
|
+
"twoColTx",
|
|
37
|
+
"tbl",
|
|
38
|
+
"txAndChart",
|
|
39
|
+
"chartAndTx",
|
|
40
|
+
"dgm",
|
|
41
|
+
"chart",
|
|
42
|
+
"txAndClipArt",
|
|
43
|
+
"clipArtAndTx",
|
|
44
|
+
"titleOnly",
|
|
45
|
+
"blank",
|
|
46
|
+
"txAndObj",
|
|
47
|
+
"objAndTx",
|
|
48
|
+
"objOnly",
|
|
49
|
+
"obj",
|
|
50
|
+
"txAndMedia",
|
|
51
|
+
"mediaAndTx",
|
|
52
|
+
"objOverTx",
|
|
53
|
+
"txOverObj",
|
|
54
|
+
"txAndTwoObj",
|
|
55
|
+
"twoObjAndTx",
|
|
56
|
+
"twoObjOverTx",
|
|
57
|
+
"fourObj",
|
|
58
|
+
"vertTx",
|
|
59
|
+
"clipArtAndVertTx",
|
|
60
|
+
"vertTitleAndTx",
|
|
61
|
+
"vertTitleAndTxOverChart",
|
|
62
|
+
"twoObj",
|
|
63
|
+
"objAndTwoObj",
|
|
64
|
+
"twoObjAndObj",
|
|
65
|
+
"cust",
|
|
66
|
+
"secHead",
|
|
67
|
+
"twoTxTwoObj",
|
|
68
|
+
"objTx",
|
|
69
|
+
"picTx"
|
|
70
|
+
];
|
|
71
|
+
const slideLayoutTypeSchema = z.enum(slideLayoutTypeValues);
|
|
72
|
+
const slideMasterDataPropsSchema = z.strictObject({
|
|
73
|
+
id: z.string().trim().min(1).optional(),
|
|
74
|
+
name: z.string().optional(),
|
|
75
|
+
preserve: z.boolean().optional(),
|
|
76
|
+
placeholders: masterPlaceholderMapSchema.optional(),
|
|
77
|
+
textStyles: masterTextStylesSchema.optional(),
|
|
78
|
+
colorMap: colorMapSchema.optional(),
|
|
79
|
+
background: slideBackgroundSchema.optional(),
|
|
80
|
+
headerFooter: headerFooterSchema.optional(),
|
|
81
|
+
footerPlaceholders: footerPlaceholdersSchema.optional(),
|
|
82
|
+
transition: z.unknown().optional(),
|
|
83
|
+
advanceAfter: z.number().optional(),
|
|
84
|
+
motion: z.unknown().optional()
|
|
85
|
+
}).readonly();
|
|
86
|
+
const slideLayoutDataPropsSchema = z.strictObject({
|
|
87
|
+
id: z.string().trim().min(1).optional(),
|
|
88
|
+
name: z.string().optional(),
|
|
89
|
+
type: slideLayoutTypeSchema.optional(),
|
|
90
|
+
preserve: z.boolean().optional(),
|
|
91
|
+
matchingName: z.string().optional(),
|
|
92
|
+
userDrawn: z.boolean().optional(),
|
|
93
|
+
showMasterShapes: z.boolean().optional(),
|
|
94
|
+
showMasterPlaceholderAnimations: z.boolean().optional(),
|
|
95
|
+
placeholders: placeholderMapSchema.optional(),
|
|
96
|
+
colorMapOverride: colorMapOverrideSchema.optional(),
|
|
97
|
+
themeOverride: themeOverrideSchema.optional(),
|
|
98
|
+
background: slideBackgroundSchema.optional(),
|
|
99
|
+
headerFooter: headerFooterSchema.optional(),
|
|
100
|
+
footerPlaceholders: footerPlaceholdersSchema.optional(),
|
|
101
|
+
transition: z.unknown().optional(),
|
|
102
|
+
advanceAfter: z.number().optional(),
|
|
103
|
+
motion: z.unknown().optional()
|
|
104
|
+
}).readonly();
|
|
105
|
+
const slideLayoutObservationSchema = z.object({
|
|
106
|
+
id: z.string().min(1),
|
|
107
|
+
name: z.string().optional(),
|
|
108
|
+
type: slideLayoutTypeSchema.optional(),
|
|
109
|
+
preserve: z.boolean().optional(),
|
|
110
|
+
matchingName: z.string().optional(),
|
|
111
|
+
userDrawn: z.boolean().optional(),
|
|
112
|
+
showMasterShapes: z.boolean().optional(),
|
|
113
|
+
showMasterPlaceholderAnimations: z.boolean().optional(),
|
|
114
|
+
colorMapOverride: colorMapOverrideSchema.optional(),
|
|
115
|
+
themeOverride: themeOverrideSchema.optional(),
|
|
116
|
+
background: slideBackgroundSchema.optional(),
|
|
117
|
+
headerFooter: headerFooterSchema.optional(),
|
|
118
|
+
capabilities: z.record(z.string(), z.unknown()).readonly().optional()
|
|
119
|
+
}).readonly();
|
|
120
|
+
const slideMasterObservationSchema = z.object({
|
|
121
|
+
id: z.string().min(1),
|
|
122
|
+
name: z.string().optional(),
|
|
123
|
+
preserve: z.boolean().optional(),
|
|
124
|
+
colorMap: colorMapSchema.optional(),
|
|
125
|
+
headerFooter: headerFooterSchema.optional(),
|
|
126
|
+
capabilities: z.record(z.string(), z.unknown()).readonly().optional(),
|
|
127
|
+
layouts: z.array(slideLayoutObservationSchema).readonly()
|
|
128
|
+
}).readonly();
|
|
129
|
+
const slideLayoutDefinitionSymbol = Symbol.for("@pptxdk/core/slide-layout-definition");
|
|
130
|
+
/** Checks whether a runtime value was produced by `defineSlideLayout`. */
|
|
131
|
+
function isSlideLayoutDefinition(value) {
|
|
132
|
+
return typeof value === "object" && value !== null && slideLayoutDefinitionSymbol in value;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Defines a reusable native slide layout specification that can be mounted into a `SlideMaster`
|
|
136
|
+
* across both JSX (`<SlideLayout layout={def} />`) and imperative (`slideLayout(def)`) entries.
|
|
137
|
+
*/
|
|
138
|
+
function defineSlideLayout(spec) {
|
|
139
|
+
const parsed = slideLayoutDataPropsSchema.safeParse(spec);
|
|
140
|
+
if (!parsed.success) {
|
|
141
|
+
const first = parsed.error.issues[0];
|
|
142
|
+
throw new CapabilityError("invalid-slide-layout", first?.message ?? "Invalid slide layout specification");
|
|
143
|
+
}
|
|
144
|
+
const normalized = {};
|
|
145
|
+
for (const [key, value] of Object.entries(parsed.data)) if (value !== void 0) normalized[key] = value;
|
|
146
|
+
const frozenProps = Object.freeze(normalized);
|
|
147
|
+
return Object.freeze({
|
|
148
|
+
[slideLayoutDefinitionSymbol]: true,
|
|
149
|
+
props: frozenProps,
|
|
150
|
+
...frozenProps.id === void 0 ? {} : { id: frozenProps.id },
|
|
151
|
+
...frozenProps.name === void 0 ? {} : { name: frozenProps.name },
|
|
152
|
+
...frozenProps.type === void 0 ? {} : { type: frozenProps.type },
|
|
153
|
+
...frozenProps.preserve === void 0 ? {} : { preserve: frozenProps.preserve },
|
|
154
|
+
...frozenProps.matchingName === void 0 ? {} : { matchingName: frozenProps.matchingName },
|
|
155
|
+
...frozenProps.userDrawn === void 0 ? {} : { userDrawn: frozenProps.userDrawn },
|
|
156
|
+
...frozenProps.showMasterShapes === void 0 ? {} : { showMasterShapes: frozenProps.showMasterShapes },
|
|
157
|
+
...frozenProps.showMasterPlaceholderAnimations === void 0 ? {} : { showMasterPlaceholderAnimations: frozenProps.showMasterPlaceholderAnimations },
|
|
158
|
+
...frozenProps.placeholders === void 0 ? {} : { placeholders: frozenProps.placeholders },
|
|
159
|
+
...frozenProps.colorMapOverride === void 0 ? {} : { colorMapOverride: frozenProps.colorMapOverride },
|
|
160
|
+
...frozenProps.themeOverride === void 0 ? {} : { themeOverride: frozenProps.themeOverride },
|
|
161
|
+
...frozenProps.background === void 0 ? {} : { background: frozenProps.background },
|
|
162
|
+
...frozenProps.headerFooter === void 0 ? {} : { headerFooter: frozenProps.headerFooter },
|
|
163
|
+
...frozenProps.footerPlaceholders === void 0 ? {} : { footerPlaceholders: frozenProps.footerPlaceholders },
|
|
164
|
+
...frozenProps.transition === void 0 ? {} : { transition: frozenProps.transition },
|
|
165
|
+
...frozenProps.advanceAfter === void 0 ? {} : { advanceAfter: frozenProps.advanceAfter },
|
|
166
|
+
...frozenProps.motion === void 0 ? {} : { motion: frozenProps.motion }
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export { defineSlideLayout, footerPlaceholderSpecSchema, footerPlaceholdersSchema, headerFooterSchema, isSlideLayoutDefinition, slideLayoutDataPropsSchema, slideLayoutObservationSchema, slideLayoutTypeSchema, slideLayoutTypeValues, slideMasterDataPropsSchema, slideMasterObservationSchema };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// ../core/dist/morph.js
|
|
2
|
+
const morphKeyBrand = Symbol("MorphKey");
|
|
3
|
+
const morphKeyLabel = Symbol("MorphKeyLabel");
|
|
4
|
+
/**
|
|
5
|
+
* Create an independent continuity scope; handles correspond across slides only when explicitly reused.
|
|
6
|
+
*
|
|
7
|
+
* When created in a React component, use useMemo or useState to keep the return value stable; cross-slide correspondence requires reusing the same scope.
|
|
8
|
+
*/
|
|
9
|
+
function createMorphScope() {
|
|
10
|
+
const handles = /* @__PURE__ */ new Map();
|
|
11
|
+
return Object.freeze({ handle(name) {
|
|
12
|
+
if (typeof name !== "string" || name.trim() === "") throw new TypeError("MorphScope.handle(name) requires a non-empty name");
|
|
13
|
+
let handle = handles.get(name);
|
|
14
|
+
if (handle === void 0) {
|
|
15
|
+
handle = Object.freeze({
|
|
16
|
+
[morphKeyBrand]: true,
|
|
17
|
+
[morphKeyLabel]: name
|
|
18
|
+
});
|
|
19
|
+
handles.set(name, handle);
|
|
20
|
+
}
|
|
21
|
+
return handle;
|
|
22
|
+
} });
|
|
23
|
+
}
|
|
24
|
+
function isMorphKey(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && morphKeyBrand in value && morphKeyLabel in value;
|
|
26
|
+
}
|
|
27
|
+
function getMorphKeyLabel(value) {
|
|
28
|
+
return value[morphKeyLabel];
|
|
29
|
+
}
|
|
30
|
+
export { createMorphScope, getMorphKeyLabel, isMorphKey };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { geometrySchema } from "./geometry-schemas.js";
|
|
2
|
+
import { paddingStyleSchema } from "./layout-schemas.js";
|
|
3
|
+
import { textStyleShape, visualStyleSchema } from "./theme.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
// ../core/dist/placeholders.js
|
|
6
|
+
const singleUnicodeCharacterSchema = z.string().refine((character) => {
|
|
7
|
+
const codePoint = character.codePointAt(0);
|
|
8
|
+
return codePoint !== void 0 && String.fromCodePoint(codePoint) === character;
|
|
9
|
+
}, "Bullet must be a single Unicode character");
|
|
10
|
+
const textListBulletSchema = z.strictObject({
|
|
11
|
+
type: z.literal("bullet"),
|
|
12
|
+
character: singleUnicodeCharacterSchema.optional(),
|
|
13
|
+
level: z.number().int().min(0).max(8).optional()
|
|
14
|
+
}).readonly();
|
|
15
|
+
const textListNumberSchema = z.strictObject({
|
|
16
|
+
type: z.literal("number"),
|
|
17
|
+
style: z.literal("arabicPeriod").optional(),
|
|
18
|
+
startAt: z.number().int().min(1).max(32767).optional(),
|
|
19
|
+
level: z.number().int().min(0).max(8).optional()
|
|
20
|
+
}).readonly();
|
|
21
|
+
/** Native paragraph list schema (bullets and Arabic period numbering). */
|
|
22
|
+
const textListSchema = z.discriminatedUnion("type", [textListBulletSchema, textListNumberSchema]);
|
|
23
|
+
const textPlaceholderRoles = [
|
|
24
|
+
"title",
|
|
25
|
+
"ctrTitle",
|
|
26
|
+
"subTitle",
|
|
27
|
+
"body",
|
|
28
|
+
"dt",
|
|
29
|
+
"ftr",
|
|
30
|
+
"hdr"
|
|
31
|
+
];
|
|
32
|
+
z.enum(textPlaceholderRoles);
|
|
33
|
+
const contentPlaceholderRoles = [
|
|
34
|
+
...textPlaceholderRoles,
|
|
35
|
+
"pic",
|
|
36
|
+
"clipArt",
|
|
37
|
+
"tbl",
|
|
38
|
+
"chart",
|
|
39
|
+
"obj",
|
|
40
|
+
"sldNum",
|
|
41
|
+
"dgm",
|
|
42
|
+
"media"
|
|
43
|
+
];
|
|
44
|
+
const placeholderRoleSchema = z.enum(contentPlaceholderRoles);
|
|
45
|
+
const placeholderSzSchema = z.enum([
|
|
46
|
+
"full",
|
|
47
|
+
"half",
|
|
48
|
+
"quarter"
|
|
49
|
+
]);
|
|
50
|
+
const placeholderOrientSchema = z.enum(["horz", "vert"]);
|
|
51
|
+
const placeholderLevelStyleSchema = z.strictObject({
|
|
52
|
+
...textStyleShape,
|
|
53
|
+
list: textListSchema.optional(),
|
|
54
|
+
marginLeft: z.number().finite().nonnegative().optional(),
|
|
55
|
+
indent: z.number().finite().optional(),
|
|
56
|
+
spacingBefore: z.number().finite().nonnegative().optional()
|
|
57
|
+
}).readonly();
|
|
58
|
+
const placeholderListStylesSchema = z.strictObject({
|
|
59
|
+
1: placeholderLevelStyleSchema.optional(),
|
|
60
|
+
2: placeholderLevelStyleSchema.optional(),
|
|
61
|
+
3: placeholderLevelStyleSchema.optional(),
|
|
62
|
+
4: placeholderLevelStyleSchema.optional(),
|
|
63
|
+
5: placeholderLevelStyleSchema.optional(),
|
|
64
|
+
6: placeholderLevelStyleSchema.optional(),
|
|
65
|
+
7: placeholderLevelStyleSchema.optional(),
|
|
66
|
+
8: placeholderLevelStyleSchema.optional(),
|
|
67
|
+
9: placeholderLevelStyleSchema.optional()
|
|
68
|
+
}).readonly();
|
|
69
|
+
const placeholderStyleSchema = z.strictObject({
|
|
70
|
+
...paddingStyleSchema.unwrap().shape,
|
|
71
|
+
...textStyleShape,
|
|
72
|
+
...visualStyleSchema.unwrap().shape
|
|
73
|
+
}).readonly();
|
|
74
|
+
const layoutPlaceholderSpecSchema = z.strictObject({
|
|
75
|
+
type: placeholderRoleSchema,
|
|
76
|
+
explicitType: z.boolean().optional(),
|
|
77
|
+
idx: z.number().int().nonnegative().optional(),
|
|
78
|
+
sz: placeholderSzSchema.optional(),
|
|
79
|
+
orient: placeholderOrientSchema.optional(),
|
|
80
|
+
hasCustomPrompt: z.boolean().optional(),
|
|
81
|
+
name: z.string().optional(),
|
|
82
|
+
x: z.number().finite().optional(),
|
|
83
|
+
y: z.number().finite().optional(),
|
|
84
|
+
width: z.number().finite().positive().optional(),
|
|
85
|
+
height: z.number().finite().positive().optional(),
|
|
86
|
+
geometry: geometrySchema.optional(),
|
|
87
|
+
flipH: z.boolean().optional(),
|
|
88
|
+
flipV: z.boolean().optional(),
|
|
89
|
+
style: placeholderStyleSchema.optional(),
|
|
90
|
+
listStyles: placeholderListStylesSchema.optional(),
|
|
91
|
+
promptText: z.string().optional()
|
|
92
|
+
}).readonly();
|
|
93
|
+
const masterPlaceholderSpecSchema = layoutPlaceholderSpecSchema;
|
|
94
|
+
const placeholderMapSchema = z.record(z.string().min(1), layoutPlaceholderSpecSchema).readonly();
|
|
95
|
+
const masterPlaceholderMapSchema = placeholderMapSchema;
|
|
96
|
+
const masterTextStylesSchema = z.strictObject({
|
|
97
|
+
titleStyle: placeholderListStylesSchema.optional(),
|
|
98
|
+
bodyStyle: placeholderListStylesSchema.optional(),
|
|
99
|
+
otherStyle: placeholderListStylesSchema.optional()
|
|
100
|
+
}).readonly();
|
|
101
|
+
const nativePlaceholderRefSchema = z.strictObject({
|
|
102
|
+
type: placeholderRoleSchema,
|
|
103
|
+
explicitType: z.boolean().optional(),
|
|
104
|
+
idx: z.number().int().nonnegative().optional(),
|
|
105
|
+
sz: placeholderSzSchema.optional(),
|
|
106
|
+
orient: placeholderOrientSchema.optional(),
|
|
107
|
+
hasCustomPrompt: z.boolean().optional()
|
|
108
|
+
}).readonly();
|
|
109
|
+
const baseAuthorKeyByRole = {
|
|
110
|
+
title: "title",
|
|
111
|
+
ctrTitle: "ctrTitle",
|
|
112
|
+
subTitle: "subTitle",
|
|
113
|
+
body: "body",
|
|
114
|
+
obj: "content",
|
|
115
|
+
pic: "pic",
|
|
116
|
+
clipArt: "clipArt",
|
|
117
|
+
tbl: "tbl",
|
|
118
|
+
chart: "chart",
|
|
119
|
+
dt: "dt",
|
|
120
|
+
ftr: "ftr",
|
|
121
|
+
sldNum: "sldNum",
|
|
122
|
+
hdr: "hdr",
|
|
123
|
+
dgm: "dgm",
|
|
124
|
+
media: "media"
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Allocates deterministic unique author keys for placeholders on a SlideLayout or SlideMaster.
|
|
128
|
+
*
|
|
129
|
+
* Never infers semantic column/side names from coordinates. When multiple placeholders share the
|
|
130
|
+
* same base role (e.g. two `body` slots with `idx=1` and `idx=3`), disambiguates deterministically
|
|
131
|
+
* via `${base}-${idx}` (falling back to `-2`, `-3` in XML order if needed).
|
|
132
|
+
*/
|
|
133
|
+
function allocatePlaceholderAuthorKeys(specs) {
|
|
134
|
+
const counts = /* @__PURE__ */ new Map();
|
|
135
|
+
const bases = specs.map((spec) => spec.explicitType === false ? "content" : baseAuthorKeyByRole[spec.type]);
|
|
136
|
+
for (const base of bases) counts.set(base, (counts.get(base) ?? 0) + 1);
|
|
137
|
+
const used = /* @__PURE__ */ new Set();
|
|
138
|
+
return specs.map((spec, index) => {
|
|
139
|
+
const base = bases[index];
|
|
140
|
+
const preferred = (counts.get(base) ?? 1) === 1 ? base : spec.idx !== void 0 ? `${base}-${spec.idx}` : base;
|
|
141
|
+
if (!used.has(preferred)) {
|
|
142
|
+
used.add(preferred);
|
|
143
|
+
return preferred;
|
|
144
|
+
}
|
|
145
|
+
let suffix = 2;
|
|
146
|
+
while (used.has(`${preferred}-${suffix}`)) suffix += 1;
|
|
147
|
+
const unique = `${preferred}-${suffix}`;
|
|
148
|
+
used.add(unique);
|
|
149
|
+
return unique;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Matches a slide `<p:ph>` reference onto a layout placeholder slot per ECMA-376 §19.3.1.36:
|
|
154
|
+
* `@idx` matches first; when `@idx` is absent, matches `@type` (preferring an unindexed slot).
|
|
155
|
+
*/
|
|
156
|
+
function matchLayoutPlaceholderKey(placeholders, ref) {
|
|
157
|
+
if (placeholders === void 0) return void 0;
|
|
158
|
+
const entries = Object.entries(placeholders);
|
|
159
|
+
if (ref.idx !== void 0) {
|
|
160
|
+
const byIdx = entries.find(([, spec]) => spec.idx === ref.idx);
|
|
161
|
+
if (byIdx !== void 0) return byIdx[0];
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (ref.type !== void 0) {
|
|
165
|
+
const unindexedByType = entries.find(([, spec]) => spec.idx === void 0 && spec.type === ref.type);
|
|
166
|
+
if (unindexedByType !== void 0) return unindexedByType[0];
|
|
167
|
+
const anyByType = entries.find(([, spec]) => spec.type === ref.type);
|
|
168
|
+
if (anyByType !== void 0) return anyByType[0];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Matches a layout or slide placeholder onto its parent master placeholder by role (not `@idx`).
|
|
173
|
+
*/
|
|
174
|
+
function matchMasterPlaceholderSpec(masterPlaceholders, role) {
|
|
175
|
+
if (masterPlaceholders === void 0) return void 0;
|
|
176
|
+
const specs = Object.values(masterPlaceholders);
|
|
177
|
+
const exact = specs.find((spec) => spec.type === role);
|
|
178
|
+
if (exact !== void 0) return exact;
|
|
179
|
+
switch (role) {
|
|
180
|
+
case "ctrTitle": return specs.find((spec) => spec.type === "title");
|
|
181
|
+
case "subTitle":
|
|
182
|
+
case "obj":
|
|
183
|
+
case "pic":
|
|
184
|
+
case "clipArt":
|
|
185
|
+
case "tbl":
|
|
186
|
+
case "chart":
|
|
187
|
+
case "dgm":
|
|
188
|
+
case "media": return specs.find((spec) => spec.type === "body");
|
|
189
|
+
default: return;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** Selects the master `<p:txStyles>` bucket (`titleStyle`, `bodyStyle`, `otherStyle`) for a role. */
|
|
193
|
+
function masterTextStyleCategoryForRole(role) {
|
|
194
|
+
switch (role) {
|
|
195
|
+
case "title":
|
|
196
|
+
case "ctrTitle": return "titleStyle";
|
|
197
|
+
case "body":
|
|
198
|
+
case "subTitle":
|
|
199
|
+
case "obj":
|
|
200
|
+
case "pic":
|
|
201
|
+
case "clipArt":
|
|
202
|
+
case "tbl":
|
|
203
|
+
case "chart":
|
|
204
|
+
case "dgm":
|
|
205
|
+
case "media": return "bodyStyle";
|
|
206
|
+
case "dt":
|
|
207
|
+
case "ftr":
|
|
208
|
+
case "sldNum":
|
|
209
|
+
case "hdr": return "otherStyle";
|
|
210
|
+
default: return role;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export { allocatePlaceholderAuthorKeys, contentPlaceholderRoles, layoutPlaceholderSpecSchema, masterPlaceholderMapSchema, masterPlaceholderSpecSchema, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, nativePlaceholderRefSchema, placeholderLevelStyleSchema, placeholderListStylesSchema, placeholderMapSchema, placeholderOrientSchema, placeholderRoleSchema, placeholderStyleSchema, placeholderSzSchema, textListBulletSchema, textListNumberSchema, textListSchema, textPlaceholderRoles };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// ../core/dist/query.js
|
|
2
|
+
var BuildQueryError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor(code, message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.name = "BuildQueryError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function assertQueryName(value, label) {
|
|
11
|
+
if (typeof value !== "string" || value.trim() === "") throw new BuildQueryError("invalid-query", `${label} must be a non-empty string`);
|
|
12
|
+
}
|
|
13
|
+
function collectObjects(node, objectsById, seen, objects) {
|
|
14
|
+
const addObject = (id) => {
|
|
15
|
+
const object = objectsById.get(id);
|
|
16
|
+
if (object === void 0 || seen.has(id)) return;
|
|
17
|
+
seen.add(id);
|
|
18
|
+
objects.push(object);
|
|
19
|
+
for (const member of object.members ?? []) addObject(member.id);
|
|
20
|
+
};
|
|
21
|
+
if (node.reference?.kind === "object") addObject(node.reference.id);
|
|
22
|
+
if (node.reference?.kind === "layout") for (const id of node.reference.objectIds) addObject(id);
|
|
23
|
+
for (const child of node.children) collectObjects(child, objectsById, seen, objects);
|
|
24
|
+
}
|
|
25
|
+
function collectTexts(node, objectsById, seen, texts) {
|
|
26
|
+
const addMemberObjects = (object) => {
|
|
27
|
+
if (!seen.has(object.id)) {
|
|
28
|
+
seen.add(object.id);
|
|
29
|
+
if (object.text !== void 0) texts.push(object.text);
|
|
30
|
+
}
|
|
31
|
+
for (const member of object.members ?? []) addMemberObjects(member);
|
|
32
|
+
};
|
|
33
|
+
if (node.reference?.kind === "object") {
|
|
34
|
+
const object = objectsById.get(node.reference.id);
|
|
35
|
+
if (object !== void 0 && !seen.has(object.id)) {
|
|
36
|
+
seen.add(object.id);
|
|
37
|
+
if (object.text !== void 0) texts.push(object.text);
|
|
38
|
+
else for (const child of node.children) if (child.reference?.kind === "part" && child.reference.text !== void 0) texts.push(child.reference.text);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const child of node.children) if (child.reference?.kind !== "part") collectTexts(child, objectsById, seen, texts);
|
|
42
|
+
if (node.reference?.kind === "object") {
|
|
43
|
+
const object = objectsById.get(node.reference.id);
|
|
44
|
+
if (object !== void 0) for (const member of object.members ?? []) addMemberObjects(member);
|
|
45
|
+
}
|
|
46
|
+
if (node.reference?.kind === "layout") for (const id of node.reference.objectIds) {
|
|
47
|
+
const object = objectsById.get(id);
|
|
48
|
+
if (object !== void 0) addMemberObjects(object);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function collectDescendantEntries(node) {
|
|
52
|
+
return node.children.flatMap((child) => [{ node: child }, ...collectDescendantEntries(child)]);
|
|
53
|
+
}
|
|
54
|
+
/** Entries visible from one author scope: anonymous nodes stay transparent, named nodes are boundaries. */
|
|
55
|
+
function collectScopedEntries(node) {
|
|
56
|
+
return node.children.flatMap((child) => [{ node: child }, ...child.authorId === void 0 ? collectScopedEntries(child) : []]);
|
|
57
|
+
}
|
|
58
|
+
function queryNode(node) {
|
|
59
|
+
const children = node.children.map((child) => queryNode(child));
|
|
60
|
+
return Object.freeze({
|
|
61
|
+
...node.authorId === void 0 ? {} : { authorId: node.authorId },
|
|
62
|
+
reference: node.reference,
|
|
63
|
+
children: Object.freeze(children)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function makeLocator(entry, layouts, objectsById, resourcesByObjectId) {
|
|
67
|
+
const childLocators = () => Object.freeze(entry.node.children.map((child) => makeLocator({ node: child }, layouts, objectsById, resourcesByObjectId)));
|
|
68
|
+
const descendants = () => Object.freeze(collectDescendantEntries(entry.node).map((descendant) => makeLocator(descendant, layouts, objectsById, resourcesByObjectId)));
|
|
69
|
+
const findAuthorIds = (id) => {
|
|
70
|
+
assertQueryName(id, "id");
|
|
71
|
+
return Object.freeze(collectScopedEntries(entry.node).filter(({ node }) => node.authorId === id).map(({ node }) => makeLocator({ node }, layouts, objectsById, resourcesByObjectId)));
|
|
72
|
+
};
|
|
73
|
+
const oneMatch = (matches, label, value) => {
|
|
74
|
+
if (matches.length === 0) throw new BuildQueryError("missing-match", `No match found for ${label} ${JSON.stringify(value)}`);
|
|
75
|
+
if (matches.length > 1) throw new BuildQueryError("ambiguous-match", `${label} ${JSON.stringify(value)} matched multiple items`);
|
|
76
|
+
const [match] = matches;
|
|
77
|
+
if (match === void 0) throw new Error("Query match item missing");
|
|
78
|
+
return match;
|
|
79
|
+
};
|
|
80
|
+
const observe = () => {
|
|
81
|
+
const objects = [];
|
|
82
|
+
collectObjects(entry.node, objectsById, /* @__PURE__ */ new Set(), objects);
|
|
83
|
+
const layoutBox = entry.node.reference?.kind === "layout" ? layouts.get(entry.node.reference.id)?.box : void 0;
|
|
84
|
+
const objectBox = entry.node.reference?.kind === "object" ? objectsById.get(entry.node.reference.id)?.box : void 0;
|
|
85
|
+
const partRef = entry.node.reference?.kind === "part" ? entry.node.reference : void 0;
|
|
86
|
+
const text = [];
|
|
87
|
+
if (partRef === void 0) collectTexts(entry.node, objectsById, /* @__PURE__ */ new Set(), text);
|
|
88
|
+
const selectedText = text.length === 0 ? void 0 : text.join("\n");
|
|
89
|
+
const box = partRef !== void 0 ? partRef.box : layoutBox ?? objectBox;
|
|
90
|
+
const observedText = partRef !== void 0 ? partRef.text : selectedText;
|
|
91
|
+
const resources = objects.flatMap((object) => (resourcesByObjectId.get(object.id) ?? []).map((resource) => Object.freeze({
|
|
92
|
+
objectId: object.id,
|
|
93
|
+
...resource
|
|
94
|
+
})));
|
|
95
|
+
return Object.freeze({
|
|
96
|
+
evidence: "generation",
|
|
97
|
+
...entry.node.authorId === void 0 ? {} : { authorId: entry.node.authorId },
|
|
98
|
+
...box === void 0 ? {} : { box },
|
|
99
|
+
...observedText === void 0 ? {} : { text: observedText },
|
|
100
|
+
objects: Object.freeze(objects),
|
|
101
|
+
...resources.length === 0 ? {} : { resources: Object.freeze(resources) }
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
get(id) {
|
|
106
|
+
return oneMatch(findAuthorIds(id), "id", id);
|
|
107
|
+
},
|
|
108
|
+
getAll(id) {
|
|
109
|
+
return findAuthorIds(id);
|
|
110
|
+
},
|
|
111
|
+
children: childLocators,
|
|
112
|
+
descendants,
|
|
113
|
+
observe
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function slideQuery(observation, content, resources) {
|
|
117
|
+
const objectsById = /* @__PURE__ */ new Map();
|
|
118
|
+
const addObject = (object) => {
|
|
119
|
+
if (objectsById.has(object.id)) return;
|
|
120
|
+
objectsById.set(object.id, object);
|
|
121
|
+
for (const member of object.members ?? []) addObject(member);
|
|
122
|
+
};
|
|
123
|
+
for (const object of observation.objects) addObject(object);
|
|
124
|
+
const layouts = new Map((observation.layouts ?? []).map((layout) => [layout.id, layout]));
|
|
125
|
+
const resourcesByObjectId = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const { objectId, ...resource } of resources) {
|
|
127
|
+
const items = resourcesByObjectId.get(objectId) ?? [];
|
|
128
|
+
items.push(Object.freeze({ ...resource }));
|
|
129
|
+
resourcesByObjectId.set(objectId, items);
|
|
130
|
+
}
|
|
131
|
+
const locator = makeLocator({ node: Object.freeze({ children: Object.freeze(content.map((node) => queryNode(node))) }) }, layouts, objectsById, resourcesByObjectId);
|
|
132
|
+
return Object.freeze({
|
|
133
|
+
...locator,
|
|
134
|
+
id: observation.id,
|
|
135
|
+
...observation.authorId === void 0 ? {} : { authorId: observation.authorId },
|
|
136
|
+
index: observation.index,
|
|
137
|
+
observation
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Bind content references retained during the compilation phase to the same report without copying or rebuilding the deck tree. */
|
|
141
|
+
function createBuildQuery(slides) {
|
|
142
|
+
const queries = Object.freeze(slides.map(({ observation, content, resources = [] }) => slideQuery(observation, content, resources)));
|
|
143
|
+
const byId = new Map(queries.map((slide) => [slide.id, slide]));
|
|
144
|
+
return Object.freeze({
|
|
145
|
+
evidence: "generation",
|
|
146
|
+
slides: queries,
|
|
147
|
+
getSlide(id) {
|
|
148
|
+
assertQueryName(id, "id");
|
|
149
|
+
const slide = byId.get(id);
|
|
150
|
+
if (slide === void 0) throw new BuildQueryError("missing-slide", `No slide found for author id ${JSON.stringify(id)}`);
|
|
151
|
+
return slide;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export { BuildQueryError, createBuildQuery };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ../core/dist/resolution.js
|
|
2
|
+
const resolutionStore = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function registerInternalResolution(resolution, internal) {
|
|
4
|
+
resolutionStore.set(resolution, internal);
|
|
5
|
+
}
|
|
6
|
+
function getInternalResolution(resolution) {
|
|
7
|
+
const internal = resolutionStore.get(resolution);
|
|
8
|
+
if (internal === void 0) throw new TypeError("Expected a Resolution produced by resolve()");
|
|
9
|
+
return internal;
|
|
10
|
+
}
|
|
11
|
+
export { getInternalResolution, registerInternalResolution };
|