@officedk/pptxdk 0.0.0-stage → 0.2.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 (206) hide show
  1. package/LICENSE +21 -0
  2. package/dist/build-zrZuX4fK.d.ts +3 -0
  3. package/dist/build.d.ts +35 -0
  4. package/dist/build.js +128 -0
  5. package/dist/capabilities/dist/all.js +34 -0
  6. package/dist/capabilities/dist/box/box-codegen.js +84 -0
  7. package/dist/capabilities/dist/box/box-declaration.js +32 -0
  8. package/dist/capabilities/dist/box/box-elements.js +17 -0
  9. package/dist/capabilities/dist/box/box.js +142 -0
  10. package/dist/capabilities/dist/chart/chart-codegen.js +79 -0
  11. package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
  12. package/dist/capabilities/dist/chart/chart-elements.js +12 -0
  13. package/dist/capabilities/dist/chart/chart-import.js +2403 -0
  14. package/dist/capabilities/dist/chart/chart-labels.js +86 -0
  15. package/dist/capabilities/dist/chart/chart-model.js +9 -0
  16. package/dist/capabilities/dist/chart/chart-schemas.js +1088 -0
  17. package/dist/capabilities/dist/chart/chart-xml.js +788 -0
  18. package/dist/capabilities/dist/chart/chart.js +1119 -0
  19. package/dist/capabilities/dist/chart/preview/axes-and-grid.js +311 -0
  20. package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
  21. package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
  22. package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
  23. package/dist/capabilities/dist/chart/preview/index.js +192 -0
  24. package/dist/capabilities/dist/chart/preview/layout.js +592 -0
  25. package/dist/capabilities/dist/chart/preview/legend.js +273 -0
  26. package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
  27. package/dist/capabilities/dist/chart/preview/markers.js +100 -0
  28. package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
  29. package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
  30. package/dist/capabilities/dist/chart/preview/scales.js +365 -0
  31. package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
  32. package/dist/capabilities/dist/chart/preview/style.js +60 -0
  33. package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
  34. package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
  35. package/dist/capabilities/dist/chart/preview/types.js +5 -0
  36. package/dist/capabilities/dist/document.js +168 -0
  37. package/dist/capabilities/dist/font/font-embedding.js +119 -0
  38. package/dist/capabilities/dist/font/font-engine.js +834 -0
  39. package/dist/capabilities/dist/font/font-import.js +766 -0
  40. package/dist/capabilities/dist/font/font-subset.js +55 -0
  41. package/dist/capabilities/dist/font/font.js +72 -0
  42. package/dist/capabilities/dist/group/group-codegen.js +74 -0
  43. package/dist/capabilities/dist/group/group-declaration.js +41 -0
  44. package/dist/capabilities/dist/group/group-elements.js +12 -0
  45. package/dist/capabilities/dist/group/group-import.js +649 -0
  46. package/dist/capabilities/dist/group/group-xml.js +8 -0
  47. package/dist/capabilities/dist/group/group.js +260 -0
  48. package/dist/capabilities/dist/image/gif-decoder.js +244 -0
  49. package/dist/capabilities/dist/image/image-codegen.js +164 -0
  50. package/dist/capabilities/dist/image/image-declaration.js +8 -0
  51. package/dist/capabilities/dist/image/image-decode.js +244 -0
  52. package/dist/capabilities/dist/image/image-elements.js +12 -0
  53. package/dist/capabilities/dist/image/image-import.js +984 -0
  54. package/dist/capabilities/dist/image/image-schemas.js +147 -0
  55. package/dist/capabilities/dist/image/image-xml.js +12 -0
  56. package/dist/capabilities/dist/image/image.js +552 -0
  57. package/dist/capabilities/dist/line/line-codegen.js +89 -0
  58. package/dist/capabilities/dist/line/line-declaration.js +72 -0
  59. package/dist/capabilities/dist/line/line-elements.js +12 -0
  60. package/dist/capabilities/dist/line/line-import.js +504 -0
  61. package/dist/capabilities/dist/line/line-xml.js +9 -0
  62. package/dist/capabilities/dist/line/line.js +331 -0
  63. package/dist/capabilities/dist/masters/footer-placeholder.js +683 -0
  64. package/dist/capabilities/dist/masters/masters-codegen.js +69 -0
  65. package/dist/capabilities/dist/masters/masters.js +250 -0
  66. package/dist/capabilities/dist/motion/motion-api.js +757 -0
  67. package/dist/capabilities/dist/motion/motion-codegen.js +406 -0
  68. package/dist/capabilities/dist/motion/motion-elements.js +43 -0
  69. package/dist/capabilities/dist/motion/motion-import.js +1568 -0
  70. package/dist/capabilities/dist/motion/motion-plan.js +2340 -0
  71. package/dist/capabilities/dist/motion/motion-query.js +423 -0
  72. package/dist/capabilities/dist/motion/motion-schemas.js +339 -0
  73. package/dist/capabilities/dist/motion/motion.js +1617 -0
  74. package/dist/capabilities/dist/notes/notes-codegen.js +19 -0
  75. package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
  76. package/dist/capabilities/dist/notes/notes-elements.js +12 -0
  77. package/dist/capabilities/dist/notes/notes-import.js +292 -0
  78. package/dist/capabilities/dist/notes/notes-schemas.js +38 -0
  79. package/dist/capabilities/dist/notes/notes-xml.js +38 -0
  80. package/dist/capabilities/dist/notes/notes.js +194 -0
  81. package/dist/capabilities/dist/placeholder/placeholder-codegen.js +54 -0
  82. package/dist/capabilities/dist/placeholder/placeholder-elements.js +13 -0
  83. package/dist/capabilities/dist/placeholder/placeholder-schemas.js +33 -0
  84. package/dist/capabilities/dist/placeholder/placeholder.js +451 -0
  85. package/dist/capabilities/dist/shape/shape-codegen.js +236 -0
  86. package/dist/capabilities/dist/shape/shape-declaration.js +45 -0
  87. package/dist/capabilities/dist/shape/shape-elements.js +12 -0
  88. package/dist/capabilities/dist/shape/shape-import.js +628 -0
  89. package/dist/capabilities/dist/shape/shape-xml.js +6 -0
  90. package/dist/capabilities/dist/shape/shape.js +320 -0
  91. package/dist/capabilities/dist/shared/geometry.js +1681 -0
  92. package/dist/capabilities/dist/shared/identity.js +205 -0
  93. package/dist/capabilities/dist/shared/morph-api.js +11 -0
  94. package/dist/capabilities/dist/shared/placeholder-import.js +238 -0
  95. package/dist/capabilities/dist/shared/preset-definitions.js +22423 -0
  96. package/dist/capabilities/dist/shared/style-inheritance.js +161 -0
  97. package/dist/capabilities/dist/shared/text-schemas.js +241 -0
  98. package/dist/capabilities/dist/shared/text-service.js +2252 -0
  99. package/dist/capabilities/dist/shared/visual.js +1197 -0
  100. package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
  101. package/dist/capabilities/dist/slide-background/slide-background-import.js +166 -0
  102. package/dist/capabilities/dist/slide-background/slide-background-xml.js +34 -0
  103. package/dist/capabilities/dist/slide-background/slide-background.js +238 -0
  104. package/dist/capabilities/dist/table/table-codegen.js +125 -0
  105. package/dist/capabilities/dist/table/table-declaration.js +15 -0
  106. package/dist/capabilities/dist/table/table-elements.js +27 -0
  107. package/dist/capabilities/dist/table/table-import.js +606 -0
  108. package/dist/capabilities/dist/table/table-schemas.js +334 -0
  109. package/dist/capabilities/dist/table/table-xml.js +30 -0
  110. package/dist/capabilities/dist/table/table.js +739 -0
  111. package/dist/capabilities/dist/text/text-codegen.js +198 -0
  112. package/dist/capabilities/dist/text/text-declaration.js +27 -0
  113. package/dist/capabilities/dist/text/text-elements.js +54 -0
  114. package/dist/capabilities/dist/text/text-import.js +1224 -0
  115. package/dist/capabilities/dist/text/text-xml.js +9 -0
  116. package/dist/capabilities/dist/text/text.js +320 -0
  117. package/dist/capabilities/dist/transition/transition-api.js +136 -0
  118. package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
  119. package/dist/capabilities/dist/transition/transition-import.js +477 -0
  120. package/dist/capabilities/dist/transition/transition.js +260 -0
  121. package/dist/capability-BbKW9w4O.d.ts +2131 -0
  122. package/dist/cli.js +20 -0
  123. package/dist/codegen/dist/assets.js +79 -0
  124. package/dist/codegen/dist/codegen.js +691 -0
  125. package/dist/codegen/dist/identifiers.js +203 -0
  126. package/dist/codegen/dist/index.js +3 -0
  127. package/dist/codegen/dist/printer.js +143 -0
  128. package/dist/codegen/dist/types.js +77 -0
  129. package/dist/core/dist/author-ids.js +51 -0
  130. package/dist/core/dist/author-schemas.js +330 -0
  131. package/dist/core/dist/block-flex-layout.js +801 -0
  132. package/dist/core/dist/build.js +4 -0
  133. package/dist/core/dist/capability.js +15 -0
  134. package/dist/core/dist/declaration.js +16 -0
  135. package/dist/core/dist/diagnostics.js +353 -0
  136. package/dist/core/dist/document-internals.js +26 -0
  137. package/dist/core/dist/document.js +417 -0
  138. package/dist/core/dist/font-seal.js +204 -0
  139. package/dist/core/dist/geometry-schemas.js +256 -0
  140. package/dist/core/dist/grid-layout.js +449 -0
  141. package/dist/core/dist/host.js +40 -0
  142. package/dist/core/dist/index.js +15 -0
  143. package/dist/core/dist/input-values.js +61 -0
  144. package/dist/core/dist/layout-protocol.js +61 -0
  145. package/dist/core/dist/layout-schemas.js +201 -0
  146. package/dist/core/dist/layout.js +340 -0
  147. package/dist/core/dist/masters.js +194 -0
  148. package/dist/core/dist/morph.js +30 -0
  149. package/dist/core/dist/placeholders.js +275 -0
  150. package/dist/core/dist/query.js +190 -0
  151. package/dist/core/dist/resolution.js +12 -0
  152. package/dist/core/dist/resolve.js +2246 -0
  153. package/dist/core/dist/stage-options.js +300 -0
  154. package/dist/core/dist/theme.js +1023 -0
  155. package/dist/core/dist/transform-geometry.js +72 -0
  156. package/dist/document-41spD7bq.d.ts +1350 -0
  157. package/dist/emit/dist/emit.js +957 -0
  158. package/dist/emit/dist/index.js +5 -0
  159. package/dist/emit/dist/ooxml.js +661 -0
  160. package/dist/emit/dist/shape-tree.js +12 -0
  161. package/dist/import/dist/alternate-content.js +54 -0
  162. package/dist/import/dist/diagnostics.js +157 -0
  163. package/dist/import/dist/fonts.js +309 -0
  164. package/dist/import/dist/import.js +513 -0
  165. package/dist/import/dist/index.js +16 -0
  166. package/dist/import/dist/masters.js +1293 -0
  167. package/dist/import/dist/mechanism.js +10 -0
  168. package/dist/import/dist/namespaces.js +61 -0
  169. package/dist/import/dist/notes-masters.js +300 -0
  170. package/dist/import/dist/opc.js +233 -0
  171. package/dist/import/dist/resources.js +166 -0
  172. package/dist/import/dist/sections.js +139 -0
  173. package/dist/import/dist/themes.js +777 -0
  174. package/dist/import/dist/visual.js +821 -0
  175. package/dist/import/dist/xml-fragments.js +277 -0
  176. package/dist/import/dist/xml-reader.js +267 -0
  177. package/dist/index-1ag7U9Jt.d.ts +63 -0
  178. package/dist/index-BEwhk7c8.d.ts +72 -0
  179. package/dist/index-cK2KtukZ.d.ts +161 -0
  180. package/dist/index-v77CTJev.d.ts +55 -0
  181. package/dist/index.d.ts +8 -0
  182. package/dist/index.js +82 -0
  183. package/dist/node.d.ts +53 -0
  184. package/dist/node.js +225 -0
  185. package/dist/pptxdk/src/cli-commands.js +907 -0
  186. package/dist/pptxdk/src/compose.js +53 -0
  187. package/dist/pptxdk/src/slide.js +9 -0
  188. package/dist/preview/dist/index.js +342 -0
  189. package/dist/preview/dist/options.js +40 -0
  190. package/dist/preview/dist/svg-guard.js +1089 -0
  191. package/dist/preview.d.ts +12 -0
  192. package/dist/preview.js +29 -0
  193. package/dist/react/dist/append.js +66 -0
  194. package/dist/react/dist/document-adapter.js +404 -0
  195. package/dist/react/dist/elements.js +82 -0
  196. package/dist/react/dist/from-vanilla.js +57 -0
  197. package/dist/react/dist/index.js +89 -0
  198. package/dist/react/dist/mount.js +34 -0
  199. package/dist/react/dist/reconciler.js +290 -0
  200. package/dist/react.d.ts +235 -0
  201. package/dist/react.js +31 -0
  202. package/dist/transition-6n8GZxSg.d.ts +9 -0
  203. package/dist/vanilla.d.ts +4 -0
  204. package/dist/vanilla.js +15 -0
  205. package/package.json +79 -3
  206. package/README.md +0 -3
@@ -0,0 +1,4 @@
1
+ import { createResolver } from "./resolve.js";
2
+ import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic } from "./diagnostics.js";
3
+ import { PreviewPageRangeError, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorOptionSchemas, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets } from "./stage-options.js";
4
+ export { BuildError, CapabilityError, PreviewPageRangeError, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, capabilityErrorToDiagnostic, createResolver, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorOptionSchemas, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets, toBuildDiagnostic };
@@ -0,0 +1,15 @@
1
+ import { readInternalDeclarationProps } from "./document-internals.js";
2
+ import { authorIdSchema } from "./author-ids.js";
3
+ import { linkTargetSchema, parseLinkTarget, slideBackgroundSchema, slideFooterValueSchema, slideNumberValueSchema } from "./author-schemas.js";
4
+ import { footerPlaceholdersSchema, headerFooterSchema } from "./masters.js";
5
+ import { CapabilityError } from "./diagnostics.js";
6
+ import { bytesSha256, computePitchFamilyFromPanose, createSealedFontFace, formatPanoseHex, hasFontFaceBytes, isImmutableBytes, markImmutableBytes, markSealedFont, peekFontFaceResource, resolveFontClassification } from "./font-seal.js";
7
+ import { createMorphScope, getMorphKeyLabel, isMorphKey } from "./morph.js";
8
+ import { customGeometrySchema, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, presetGeometryNameSchema, presetGeometryTuple } from "./geometry-schemas.js";
9
+ import { layoutStyleShape, nonNegativeLayoutSpacingSchema } from "./layout-schemas.js";
10
+ import "./stage-options.js";
11
+ import { applyFormatColorTransforms, assertValidLang, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, colorValueSchema, defaultColorMap, defaultTheme, defineTheme, fontOptionsSchema, imageBackgroundSchema, isFont, isTheme, linearGradientSchema, radialGradientSchema, schemeColorNameSchema, shadowSchema, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, unsealedFontSchema, validateTextStyle, visualStyleShape } from "./theme.js";
12
+ import { layoutPlaceholderSpecSchema, masterTextStyleCategoryForRole, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, nativePlaceholderRefSchema, placeholderRoleSchema, placeholderStyleSchema, resolvePlaceholderBoxFromLayers, textListSchema } from "./placeholders.js";
13
+ import { paddingStyleKeys } from "./block-flex-layout.js";
14
+ import { parseCapabilityLayoutContract } from "./layout.js";
15
+ export { CapabilityError, applyFormatColorTransforms, assertValidLang, authorIdSchema, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, bytesSha256, colorValueSchema, computePitchFamilyFromPanose, createMorphScope, createSealedFontFace, customGeometrySchema, defaultColorMap, defaultTheme, defineTheme, fontOptionsSchema, footerPlaceholdersSchema, formatPanoseHex, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, getMorphKeyLabel, hasFontFaceBytes, headerFooterSchema, imageBackgroundSchema, isFont, isImmutableBytes, isMorphKey, isTheme, layoutPlaceholderSpecSchema, layoutStyleShape, linearGradientSchema, linkTargetSchema, markImmutableBytes, markSealedFont, masterTextStyleCategoryForRole, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, nativePlaceholderRefSchema, nonNegativeLayoutSpacingSchema, paddingStyleKeys, parseCapabilityLayoutContract, parseLinkTarget, peekFontFaceResource, placeholderRoleSchema, placeholderStyleSchema, presetGeometryNameSchema, presetGeometryTuple, radialGradientSchema, readInternalDeclarationProps, resolveFontClassification, resolvePlaceholderBoxFromLayers, schemeColorNameSchema, shadowSchema, slideBackgroundSchema, slideFooterValueSchema, slideNumberValueSchema, textListSchema, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, unsealedFontSchema, validateTextStyle, visualStyleShape };
@@ -0,0 +1,16 @@
1
+ import { readInternalDeclarationProps } from "./document-internals.js";
2
+ // ../core/dist/declaration.js
3
+ function isDeclarationNode(child) {
4
+ return typeof child === "object" && child !== null && "props" in child && "children" in child;
5
+ }
6
+ /** Author-visible identity used in diagnostic labels; the scoped author id is the only identity. */
7
+ function declarationIdentity(props) {
8
+ return props["id"];
9
+ }
10
+ /** Diagnostic label for a child declaration, matching the existing build path vocabulary. */
11
+ function componentLabel(node, index) {
12
+ const identity = declarationIdentity(readInternalDeclarationProps(node));
13
+ const label = typeof identity === "string" && identity.trim() !== "" ? identity : String(index + 1);
14
+ return `${node.type}[${label}]`;
15
+ }
16
+ export { componentLabel, declarationIdentity, isDeclarationNode };
@@ -0,0 +1,353 @@
1
+ // ../core/dist/diagnostics.js
2
+ function freezeDiagnostic(diagnostic) {
3
+ const copy = { ...diagnostic };
4
+ delete copy["severity"];
5
+ if ("font" in diagnostic) copy["font"] = Object.freeze({ ...diagnostic.font });
6
+ if ("characters" in diagnostic) copy["characters"] = Object.freeze([...diagnostic.characters]);
7
+ return Object.freeze(copy);
8
+ }
9
+ var BuildError = class extends Error {
10
+ diagnostics;
11
+ constructor(diagnostics) {
12
+ super(diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join("\n"));
13
+ this.name = "BuildError";
14
+ this.diagnostics = Object.freeze(diagnostics.map(freezeDiagnostic));
15
+ }
16
+ };
17
+ var CapabilityError = class extends Error {
18
+ code;
19
+ path;
20
+ details;
21
+ /** Subpath relative to the native object triggering the capability, facilitating localization of cell declarations inside the object. */
22
+ constructor(code, message, path, details) {
23
+ super(message);
24
+ this.name = "CapabilityError";
25
+ this.code = code;
26
+ this.path = path;
27
+ this.details = details === void 0 ? void 0 : Object.freeze({ ...details });
28
+ }
29
+ };
30
+ function readOptionalString(details, key) {
31
+ const val = details?.[key];
32
+ return typeof val === "string" && val !== "" ? val : void 0;
33
+ }
34
+ function readFontDescriptor(details) {
35
+ const rawFont = typeof details?.["font"] === "object" && details["font"] !== null ? details["font"] : details;
36
+ const family = typeof rawFont?.["family"] === "string" && rawFont["family"] !== "" ? rawFont["family"] : "unknown";
37
+ const weight = typeof rawFont?.["weight"] === "number" && Number.isFinite(rawFont["weight"]) ? rawFont["weight"] : void 0;
38
+ const style = rawFont?.["style"] === "normal" || rawFont?.["style"] === "italic" ? rawFont["style"] : void 0;
39
+ return {
40
+ family,
41
+ ...weight === void 0 ? {} : { weight },
42
+ ...style === void 0 ? {} : { style }
43
+ };
44
+ }
45
+ function extractUnknownPropName(details, message) {
46
+ const explicit = readOptionalString(details, "prop");
47
+ if (explicit !== void 0) return explicit;
48
+ return (/(?:unknown|unsupported|unimplemented) (?:parameter|property|style(?: property)?)\s+["']?([A-Za-z0-9_.-]+)["']?/iu.exec(message) ?? /does not support (?:style |property )?["']?([A-Za-z0-9_.-]+)["']?/iu.exec(message))?.[1] ?? "unknown";
49
+ }
50
+ function inferStyleField(code, details, message) {
51
+ const explicit = readOptionalString(details, "field");
52
+ if (explicit !== void 0) return explicit;
53
+ switch (code) {
54
+ case "invalid-font-size": return "style.fontSize";
55
+ case "invalid-baseline-shift":
56
+ case "conflicting-baseline-shift": return "style.baselineShift";
57
+ case "invalid-letter-spacing": return "style.letterSpacing";
58
+ case "invalid-paragraph-spacing": return "style.spacingAfter";
59
+ case "invalid-list": return "style.list";
60
+ case "invalid-text-alignment": return "style.textAlign";
61
+ case "invalid-text-decoration": return "style.textDecoration";
62
+ case "invalid-text-lang": return "style.lang";
63
+ case "invalid-text-transform": return "style.textTransform";
64
+ case "invalid-text-wrap": return "style.whiteSpace";
65
+ case "invalid-vertical-align": return "style.verticalAlign";
66
+ case "invalid-shadow": return message.includes("textShadow") ? "style.textShadow" : "style.boxShadow";
67
+ case "invalid-line-end-type": return "style.border";
68
+ default: {
69
+ const stylePrefix = /\bstyle\.([A-Za-z0-9_.[\]]+)/u.exec(message);
70
+ if (stylePrefix?.[1] !== void 0) return `style.${stylePrefix[1]}`;
71
+ const keyColon = /^([A-Za-z][A-Za-z0-9_]*):/u.exec(message);
72
+ if (keyColon?.[1] !== void 0 && keyColon[1] !== "style") return `style.${keyColon[1]}`;
73
+ if (/^style\b/u.test(message)) return "style";
74
+ return;
75
+ }
76
+ }
77
+ }
78
+ const styleErrorCodes = /* @__PURE__ */ new Set([
79
+ "invalid-style",
80
+ "invalid-visual-style",
81
+ "invalid-layout-style",
82
+ "unsupported-layout-style",
83
+ "unsupported-layout-value",
84
+ "unsupported-style-combination",
85
+ "unsupported-grid-alignment",
86
+ "unsupported-grid-positioning",
87
+ "invalid-grid-placement",
88
+ "invalid-grid-tracks",
89
+ "invalid-color",
90
+ "invalid-shadow",
91
+ "invalid-font-size",
92
+ "invalid-baseline-shift",
93
+ "conflicting-baseline-shift",
94
+ "invalid-letter-spacing",
95
+ "invalid-paragraph-spacing",
96
+ "invalid-list",
97
+ "invalid-text-alignment",
98
+ "invalid-text-decoration",
99
+ "invalid-text-lang",
100
+ "invalid-text-length",
101
+ "invalid-text-transform",
102
+ "invalid-text-wrap",
103
+ "invalid-vertical-align",
104
+ "invalid-line-end-type",
105
+ "invalid-table-border",
106
+ "invalid-table-padding"
107
+ ]);
108
+ const structureErrorCodes = /* @__PURE__ */ new Set([
109
+ "invalid-structure",
110
+ "document-root",
111
+ "missing-slide",
112
+ "unexpected-text",
113
+ "unexpected-section-text",
114
+ "mixed-sections",
115
+ "nested-section",
116
+ "unexpected-declaration",
117
+ "unsupported-children",
118
+ "invalid-text-child",
119
+ "unsupported-text-child",
120
+ "conflicting-text-content",
121
+ "empty-group",
122
+ "empty-group-projection",
123
+ "member-without-geometry",
124
+ "empty-slide-master",
125
+ "placeholder-inside-container",
126
+ "placeholder-requires-layout",
127
+ "incompatible-placeholder-content",
128
+ "duplicate-notes",
129
+ "invalid-layout-context",
130
+ "layout-unavailable",
131
+ "unsupported-baseline-context",
132
+ "baseline-measurement-unavailable",
133
+ "invalid-table-structure",
134
+ "conflicting-table-merge",
135
+ "link-needs-object",
136
+ "motion-target-geometry",
137
+ "cross-step-motion",
138
+ "motion-cycle",
139
+ "motion-plan-conflict",
140
+ "no-natural-completion",
141
+ "conflicting-presentation-attribute",
142
+ "conflicting-presentation-item",
143
+ "conflicting-presentation-record",
144
+ "invalid-presentation-contribution",
145
+ "conflicting-resource-type",
146
+ "conflicting-shared-part"
147
+ ]);
148
+ const fontUnavailableReasonByLegacyCode = {
149
+ "font-measurement-unavailable": "missing-resource",
150
+ "font-embedding-resource-missing": "missing-resource",
151
+ "font-face-mismatch": "style-mismatch",
152
+ "font-family-mismatch": "family-mismatch",
153
+ "font-style-mismatch": "style-mismatch",
154
+ "font-weight-mismatch": "style-mismatch",
155
+ "font-substitution-required": "substitute-required",
156
+ "font-substitute-not-embeddable": "not-embeddable",
157
+ "font-not-embeddable": "not-embeddable",
158
+ "font-format-unsupported": "unsupported-format",
159
+ "unsupported-font-format": "unsupported-format",
160
+ "font-embedding-bitmap-only": "unsupported-format",
161
+ "font-metrics-invalid": "invalid-metrics",
162
+ "invalid-font-permissions": "license-restricted",
163
+ "font-embedding-restricted": "license-restricted",
164
+ "font-embedding-preview-print": "license-restricted",
165
+ "font-subsetting-forbidden": "subsetting-forbidden",
166
+ "font-subsetting-failed": "subsetting-failed"
167
+ };
168
+ const validFontReasons = new Set(Object.values(fontUnavailableReasonByLegacyCode).concat(["missing-face"]));
169
+ /**
170
+ * Normalizes a direct or capability-originated error code and optional metadata
171
+ * into a schema-valid `BuildDiagnostic` union member.
172
+ */
173
+ function toBuildDiagnostic(path, code, message, details) {
174
+ const field = readOptionalString(details, "field");
175
+ const expected = readOptionalString(details, "expected");
176
+ const conflictPath = readOptionalString(details, "conflictPath");
177
+ if (code === "invalid-options" || code === "invalid-target" || code === "unsupported-format" || code === "invalid-capability-selection") return {
178
+ code: "invalid-options",
179
+ path,
180
+ message,
181
+ ...field === void 0 ? {} : { field },
182
+ ...expected === void 0 ? {} : { expected }
183
+ };
184
+ if (code === "unknown-prop" || code === "unknown-parameter" || code === "unknown-section-property" || code === "unknown-style" || code === "unknown-style-property") {
185
+ const prop = extractUnknownPropName(details, message);
186
+ const rawScope = details?.["scope"];
187
+ const scope = rawScope === "props" || rawScope === "style" || rawScope === "options" ? rawScope : code === "unknown-style" || code === "unknown-style-property" ? "style" : path === "resolve" || path === "build" || path.startsWith("build.") || path.startsWith("resolve.") ? "options" : "props";
188
+ const resolvedField = field ?? (prop === "unknown" ? void 0 : scope === "style" && !prop.startsWith("style.") ? `style.${prop}` : prop);
189
+ return {
190
+ code: "unknown-prop",
191
+ path,
192
+ message,
193
+ prop,
194
+ scope,
195
+ ...resolvedField === void 0 ? {} : { field: resolvedField }
196
+ };
197
+ }
198
+ const mappedFontReason = fontUnavailableReasonByLegacyCode[code];
199
+ if (code === "font-unavailable" || mappedFontReason !== void 0) {
200
+ const rawReason = readOptionalString(details, "reason");
201
+ const reason = rawReason !== void 0 && validFontReasons.has(rawReason) ? rawReason : mappedFontReason ?? "missing-resource";
202
+ return {
203
+ code: "font-unavailable",
204
+ path,
205
+ message,
206
+ font: readFontDescriptor(details),
207
+ reason,
208
+ ...field === void 0 ? {} : { field }
209
+ };
210
+ }
211
+ if (code === "font-missing-glyph") {
212
+ const descriptor = readFontDescriptor(details);
213
+ const rawChars = details?.["characters"];
214
+ const characters = Array.isArray(rawChars) ? rawChars.filter((item) => typeof item === "string") : [];
215
+ return {
216
+ code: "font-missing-glyph",
217
+ path,
218
+ message,
219
+ font: {
220
+ family: descriptor.family,
221
+ weight: descriptor.weight ?? 400,
222
+ style: descriptor.style ?? "normal"
223
+ },
224
+ characters,
225
+ ...field === void 0 ? {} : { field }
226
+ };
227
+ }
228
+ if (code === "duplicate-id" || code === "duplicate-author-id" || code === "duplicate-morph-key" || code === "duplicate-slide-placeholder" || code === "duplicate-scope" || code === "duplicate-cue" || code === "duplicate-part" || code === "conflicting-resource") {
229
+ const identifier = readOptionalString(details, "identifier") ?? /"([^"]+)"/u.exec(message)?.[1];
230
+ const resolvedField = field ?? (code === "duplicate-author-id" ? "id" : code === "duplicate-morph-key" ? "morphKey" : code === "duplicate-slide-placeholder" ? "placeholder" : void 0);
231
+ return {
232
+ code: "duplicate-id",
233
+ path,
234
+ message,
235
+ ...resolvedField === void 0 ? {} : { field: resolvedField },
236
+ ...identifier === void 0 ? {} : { identifier },
237
+ ...conflictPath === void 0 ? {} : { conflictPath }
238
+ };
239
+ }
240
+ if (code === "broken-reference" || code === "missing-link-target" || code === "ambiguous-slide-layout" || code === "foreign-slide-layout" || code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" || code === "unknown-chart-axis" || code === "missing-motion-target" || code === "missing-cue" || code === "missing-scope" || code === "unknown-motion-start" || code === "missing-part-target" || code === "missing-resource-claim") {
241
+ const reference = readOptionalString(details, "reference") ?? (code === "unknown-slide-placeholder" ? /does not define placeholder "([^"]+)"/u.exec(message)?.[1] : void 0) ?? /"([^"]+)"/u.exec(message)?.[1];
242
+ const rawTargetKind = details?.["targetKind"];
243
+ const targetKind = rawTargetKind === "slide" || rawTargetKind === "layout" || rawTargetKind === "placeholder" || rawTargetKind === "object" || rawTargetKind === "cue" || rawTargetKind === "scope" || rawTargetKind === "part" || rawTargetKind === "resource" || rawTargetKind === "axis" ? rawTargetKind : code === "missing-link-target" ? "slide" : code === "ambiguous-slide-layout" || code === "foreign-slide-layout" ? "layout" : code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" ? "placeholder" : code === "unknown-chart-axis" ? "axis" : code === "missing-motion-target" ? "object" : code === "missing-cue" || code === "unknown-motion-start" ? "cue" : code === "missing-scope" ? "scope" : code === "missing-part-target" ? "part" : code === "missing-resource-claim" ? "resource" : void 0;
244
+ const resolvedField = field ?? (code === "missing-link-target" ? "link" : code === "ambiguous-slide-layout" || code === "foreign-slide-layout" ? "layout" : code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" ? "placeholder" : void 0);
245
+ return {
246
+ code: "broken-reference",
247
+ path,
248
+ message,
249
+ ...resolvedField === void 0 ? {} : { field: resolvedField },
250
+ ...reference === void 0 ? {} : { reference },
251
+ ...targetKind === void 0 ? {} : { targetKind }
252
+ };
253
+ }
254
+ if (code === "invalid-continuity" || code === "morph-inside-group" || code === "morph-on-master" || code === "morph-needs-object" || code === "unsupported-morph-object" || code === "morph-object-kind-mismatch" || code === "morph-object-name-conflict") {
255
+ const rawReason = details?.["reason"];
256
+ const reason = rawReason === "inside-group" || rawReason === "on-master" || rawReason === "needs-object" || rawReason === "unsupported-object" || rawReason === "kind-mismatch" || rawReason === "name-conflict" ? rawReason : code === "morph-inside-group" ? "inside-group" : code === "morph-on-master" ? "on-master" : code === "morph-needs-object" ? "needs-object" : code === "unsupported-morph-object" ? "unsupported-object" : code === "morph-object-kind-mismatch" ? "kind-mismatch" : code === "morph-object-name-conflict" ? "name-conflict" : void 0;
257
+ return {
258
+ code: "invalid-continuity",
259
+ path,
260
+ message,
261
+ field: field ?? "morphKey",
262
+ ...reason === void 0 ? {} : { reason },
263
+ ...conflictPath === void 0 ? {} : { conflictPath }
264
+ };
265
+ }
266
+ if (code === "missing-capability" || code === "unsupported-declaration" || code === "unknown-capability" || code === "duplicate-capability" || code === "invalid-capability-module" || code === "invalid-capability-binding") return {
267
+ code: "missing-capability",
268
+ path,
269
+ message,
270
+ capability: readOptionalString(details, "capability") ?? /registered for ([A-Za-z0-9_.-]+)/u.exec(message)?.[1] ?? /^([A-Za-z0-9_.-]+) declarations are only supported/u.exec(message)?.[1] ?? "unknown",
271
+ ...field === void 0 ? {} : { field }
272
+ };
273
+ if (code === "invalid-resource" || code === "invalid-image-source" || code === "unsupported-image-format" || code === "image-read-failed" || code === "image-resource-failure" || code === "invalid-part" || code === "resource-contribution-failed" || code === "capability-failure") {
274
+ const rawKind = details?.["resourceKind"];
275
+ return {
276
+ code: "invalid-resource",
277
+ path,
278
+ message,
279
+ resourceKind: rawKind === "image" || rawKind === "part" || rawKind === "capability" ? rawKind : code === "invalid-image-source" || code === "unsupported-image-format" || code === "image-read-failed" || code === "image-resource-failure" ? "image" : code === "capability-failure" ? "capability" : "part",
280
+ ...field === void 0 ? {} : { field }
281
+ };
282
+ }
283
+ if (code === "target-violation" || code === "forbidden-mechanism" || code === "unsupported-extension" || code === "duplicate-extension" || code === "unsupported-font-embedding") {
284
+ const target = readOptionalString(details, "target") ?? "transitional";
285
+ const extension = readOptionalString(details, "extension");
286
+ const mechanism = readOptionalString(details, "mechanism");
287
+ return {
288
+ code: "target-violation",
289
+ path,
290
+ message,
291
+ target,
292
+ ...field === void 0 ? {} : { field },
293
+ ...extension === void 0 ? {} : { extension },
294
+ ...mechanism === void 0 ? {} : { mechanism }
295
+ };
296
+ }
297
+ if (code === "render-failed" || code === "react-render" || code === "append") {
298
+ const rawPhase = details?.["phase"];
299
+ return {
300
+ code: "render-failed",
301
+ path,
302
+ message,
303
+ phase: rawPhase === "expand" || rawPhase === "append" ? rawPhase : code === "append" ? "append" : "expand",
304
+ ...field === void 0 ? {} : { field }
305
+ };
306
+ }
307
+ if (styleErrorCodes.has(code)) {
308
+ const styleField = inferStyleField(code, details, message);
309
+ return {
310
+ code: "invalid-style",
311
+ path,
312
+ message,
313
+ ...styleField === void 0 ? {} : { field: styleField },
314
+ ...expected === void 0 ? {} : { expected }
315
+ };
316
+ }
317
+ if (structureErrorCodes.has(code)) return {
318
+ code: "invalid-structure",
319
+ path,
320
+ message,
321
+ ...field === void 0 ? {} : { field },
322
+ ...expected === void 0 ? {} : { expected },
323
+ ...conflictPath === void 0 ? {} : { conflictPath }
324
+ };
325
+ const resolvedField = field ?? (code === "invalid-author-id" || code === "invalid-id" ? "id" : code === "invalid-link" ? "link" : code === "invalid-morph-key" ? "morphKey" : code === "invalid-notes" ? "notes" : void 0);
326
+ return {
327
+ code: "invalid-prop",
328
+ path,
329
+ message,
330
+ ...resolvedField === void 0 ? {} : { field: resolvedField },
331
+ ...expected === void 0 ? {} : { expected }
332
+ };
333
+ }
334
+ function capabilityErrorToDiagnostic(error, basePath, relativeToBase = false) {
335
+ return toBuildDiagnostic(error.path === void 0 || error.path === "" ? basePath : !relativeToBase || error.path.startsWith("deck/") ? error.path : `${basePath}/${error.path}`, error.code, error.message, error.details);
336
+ }
337
+ /** Converts a Zod validation issue into a structured `BuildDiagnostic`, mapping unrecognized keys to `unknown-prop`. */
338
+ function zodIssueToBuildDiagnostic(path, fallbackCode, fallbackMessage, issue, pathPrefix) {
339
+ const pathSegments = [...pathPrefix === void 0 ? [] : [pathPrefix], ...issue === void 0 ? [] : issue.path.map(String)];
340
+ if (issue?.code === "unrecognized_keys" && issue.keys !== void 0 && issue.keys[0] !== void 0) {
341
+ const prop = issue.keys[0];
342
+ const inStyle = pathSegments.includes("style");
343
+ const field = [...pathSegments, prop].join(".");
344
+ return toBuildDiagnostic(path, inStyle ? "unknown-style" : "unknown-parameter", issue.message, {
345
+ prop,
346
+ field,
347
+ scope: inStyle ? "style" : "props"
348
+ });
349
+ }
350
+ const field = pathSegments.length > 0 ? pathSegments.join(".") : void 0;
351
+ return toBuildDiagnostic(path, field?.startsWith("style") ? "invalid-style" : fallbackCode, issue?.message ?? fallbackMessage, field === void 0 ? void 0 : { field });
352
+ }
353
+ export { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic, zodIssueToBuildDiagnostic };
@@ -0,0 +1,26 @@
1
+ // ../core/dist/document-internals.js
2
+ /**
3
+ * Operation keys shared by the editable document and the React host adapter.
4
+ *
5
+ * The adapter must insert, reorder, and replace complete JSX declarations without exposing those
6
+ * reconciliation operations as author API. These symbols are internal to the core package and are
7
+ * not re-exported by the public document entry.
8
+ */
9
+ const replaceDeclarationProps = Symbol("pptxdk.replaceDeclarationProps");
10
+ const insertDeclarationChild = Symbol("pptxdk.insertDeclarationChild");
11
+ const removeDeclarationChild = Symbol("pptxdk.removeDeclarationChild");
12
+ const setDeclarationText = Symbol("pptxdk.setDeclarationText");
13
+ const internalPropsByNode = /* @__PURE__ */ new WeakMap();
14
+ /** Records a `CommonNode`'s internal frozen props snapshot without exposing a symbol method on the class. */
15
+ function registerInternalDeclarationProps(node, props) {
16
+ internalPropsByNode.set(node, props);
17
+ }
18
+ /**
19
+ * Reads a declaration node's internal props view for read-only pipeline stages without triggering
20
+ * `CommonNode.props`'s defensive `cloneExternalValue` copy, preserving internal `Uint8Array`
21
+ * identity so `bytesSha256` memoizes across `resolve`, `emit`, and `codegen`.
22
+ */
23
+ function readInternalDeclarationProps(node) {
24
+ return internalPropsByNode.get(node) ?? node.props;
25
+ }
26
+ export { insertDeclarationChild, readInternalDeclarationProps, registerInternalDeclarationProps, removeDeclarationChild, replaceDeclarationProps, setDeclarationText };