@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,198 @@
1
+ import { readInternalDeclarationProps } from "../../../core/dist/document-internals.js";
2
+ import { nativePlaceholderRefSchema } from "../../../core/dist/placeholders.js";
3
+ import "../../../codegen/dist/index.js";
4
+ import "../../../core/dist/capability.js";
5
+ import { CommonNode } from "../../../core/dist/document.js";
6
+ import { defineObjectCodegen, expr } from "../../../codegen/dist/types.js";
7
+ import { serializeImageDescriptorValue } from "../image/image-codegen.js";
8
+ import { motionPropKeySet } from "../motion/motion-schemas.js";
9
+ import { paragraphAuthorPropsKeys, paragraphStyleSchema, runStyleSchema, slideNumberAuthorPropsKeys, spanAuthorPropsKeys, subAuthorPropsKeys, supAuthorPropsKeys, textAuthorPropsKeys, textBoxStyleSchema } from "../shared/text-schemas.js";
10
+ // ../capabilities/dist/text/text-codegen.js
11
+ const objectMotionPropKeys = motionPropKeySet;
12
+ const textAllowedPropKeys = new Set(textAuthorPropsKeys);
13
+ const paragraphAllowedPropKeys = new Set(paragraphAuthorPropsKeys);
14
+ const spanAllowedPropKeys = new Set(spanAuthorPropsKeys);
15
+ const supAllowedPropKeys = new Set(supAuthorPropsKeys);
16
+ const subAllowedPropKeys = new Set(subAuthorPropsKeys);
17
+ const slideNumberAllowedPropKeys = new Set(slideNumberAuthorPropsKeys);
18
+ function isPlainRecord(value) {
19
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
20
+ const proto = Object.getPrototypeOf(value);
21
+ return proto === Object.prototype || proto === null;
22
+ }
23
+ function validateRichTextNativePlaceholder(nodeType, value, ctx) {
24
+ const parsed = nativePlaceholderRefSchema.safeParse(value);
25
+ if (!parsed.success) ctx.fail("unexpressible-value", parsed.error.issues[0]?.message ?? `${nodeType}.nativePlaceholder cannot be expressed`, "@nativePlaceholder");
26
+ }
27
+ function serializeRichTextStyleProp(nodeType, style, ctx) {
28
+ if (!isPlainRecord(style)) ctx.fail("unexpressible-value", `${nodeType}.style must be a plain object`, "@style");
29
+ const schema = nodeType === "text" ? textBoxStyleSchema : nodeType === "paragraph" ? paragraphStyleSchema : nodeType === "span" || nodeType === "sup" || nodeType === "sub" || nodeType === "slide-number" ? runStyleSchema : void 0;
30
+ if (schema !== void 0) {
31
+ const parsed = schema.safeParse(style);
32
+ if (!parsed.success) {
33
+ const issue = parsed.error.issues[0];
34
+ const issuePath = issue !== void 0 && issue.path.length > 0 ? `@style.${issue.path.join(".")}` : "@style";
35
+ ctx.fail("unexpressible-value", issue?.message ?? `${nodeType}.style cannot be expressed`, issuePath);
36
+ }
37
+ }
38
+ const entries = [];
39
+ for (const [key, entryValue] of Object.entries(style)) {
40
+ if (entryValue === void 0) continue;
41
+ if (key === "background") {
42
+ const serializedImage = serializeImageDescriptorValue(entryValue, ctx);
43
+ entries.push([key, serializedImage ?? entryValue]);
44
+ continue;
45
+ }
46
+ entries.push([key, entryValue]);
47
+ }
48
+ return expr(ctx.formatProps(entries));
49
+ }
50
+ /** Container-level rich-text child declaration types allowed directly inside `Notes` and `Cell`. */
51
+ const blockRichTextChildKinds = /* @__PURE__ */ new Set([
52
+ "paragraph",
53
+ "span",
54
+ "sup",
55
+ "sub",
56
+ "slide-number"
57
+ ]);
58
+ /** Container-level rich-text child declaration types allowed directly inside `Text`. */
59
+ const steppableRichTextChildKinds = /* @__PURE__ */ new Set([...blockRichTextChildKinds, "motion-step"]);
60
+ /** Inline-level rich-text child declaration types allowed inside `P` and `Span`. */
61
+ const inlineRichTextChildKinds = /* @__PURE__ */ new Set([
62
+ "span",
63
+ "sup",
64
+ "sub",
65
+ "slide-number"
66
+ ]);
67
+ function singleTextLeaf(node) {
68
+ if (node.children.length !== 1) return void 0;
69
+ const only = node.children[0];
70
+ if (only === void 0 || only instanceof CommonNode) return void 0;
71
+ const leaf = only;
72
+ return leaf.type === "#text" ? leaf.text : void 0;
73
+ }
74
+ /** Collects and validates own defined props on a rich-text or slide-number node. */
75
+ function collectRichTextNodeProps(node, ctx, allowedPropKeys, supportObjectExtras) {
76
+ const props = readInternalDeclarationProps(node);
77
+ const extra = supportObjectExtras ? ctx.emitObjectExtraProps(props) : {};
78
+ const entries = [];
79
+ for (const [key, value] of Object.entries(props)) {
80
+ if (value === void 0) continue;
81
+ if (!allowedPropKeys.has(key)) ctx.fail("invalid-document", `${node.type} declaration does not support property ${JSON.stringify(key)}`, `@${key}`);
82
+ if (key === "nativePlaceholder") {
83
+ validateRichTextNativePlaceholder(node.type, value, ctx);
84
+ entries.push([key, value]);
85
+ continue;
86
+ }
87
+ if (key === "style") {
88
+ entries.push([key, serializeRichTextStyleProp(node.type, value, ctx)]);
89
+ continue;
90
+ }
91
+ if (supportObjectExtras && objectMotionPropKeys.has(key)) {
92
+ if (node.type === "paragraph" && !/^deck\/slide(?:\[[^\]]*\])?(?:\/.*)?\/(?:text|shape)(?:\[[^\]]*\])?(?:\/motion-step(?:\[[^\]]*\])?)?\/paragraph(?:\[[^\]]*\])?(?:@.*)?$/u.test(ctx.path)) ctx.fail("invalid-document", "Paragraph motion properties are only supported inside page-level Text and Shape", `@${key}`);
93
+ if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
94
+ else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
95
+ continue;
96
+ }
97
+ entries.push([key, value]);
98
+ }
99
+ return entries;
100
+ }
101
+ function assertAllowedRichTextChildren(node, ctx, allowedChildKinds) {
102
+ let childIndex = 0;
103
+ for (const child of node.children) {
104
+ if (!(child instanceof CommonNode)) continue;
105
+ const label = child.id === void 0 ? `${child.type}[${childIndex + 1}]` : `${child.type}[${child.id}]`;
106
+ if (!allowedChildKinds.has(child.type)) ctx.fail("invalid-document", `${node.type} declaration cannot contain ${JSON.stringify(child.type)} child`, `${ctx.path}/${label}`);
107
+ childIndex += 1;
108
+ }
109
+ }
110
+ /**
111
+ * Creates a dual-target (`vanilla` / `react`) codegen handler for a rich-text container node
112
+ * (`Text`, `P`, `Span`, or `Notes`), validating props and child declaration types.
113
+ */
114
+ function createRichTextCodegenHandler(options) {
115
+ return {
116
+ emitVanilla(node, ctx) {
117
+ assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
118
+ const callee = ctx.useImport(options.vanillaFactory);
119
+ const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
120
+ const leafText = singleTextLeaf(node);
121
+ if (leafText !== void 0) {
122
+ const args = propsEntries.length === 0 ? [JSON.stringify(leafText)] : [JSON.stringify(leafText), ctx.formatProps(propsEntries)];
123
+ return ctx.formatVanillaCall(callee, args);
124
+ }
125
+ if (node.children.length === 0) {
126
+ const args = propsEntries.length === 0 ? [] : ["[]", ctx.formatProps(propsEntries)];
127
+ return ctx.formatVanillaCall(callee, args);
128
+ }
129
+ const children = ctx.emitRichTextChildren(node.children);
130
+ if (propsEntries.length === 0) return ctx.formatVanillaCall(callee, [], children);
131
+ const contentArg = ctx.emitValueExpr(children.map((code) => expr(code)));
132
+ return ctx.formatVanillaCall(callee, [contentArg, ctx.formatProps(propsEntries)]);
133
+ },
134
+ emitReact(node, ctx) {
135
+ assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
136
+ const tag = ctx.useImport(options.reactComponent);
137
+ const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
138
+ const children = ctx.emitRichTextChildren(node.children);
139
+ return ctx.formatJsxElement(tag, propsEntries, children);
140
+ }
141
+ };
142
+ }
143
+ function emitSlideNumberProps(node, ctx) {
144
+ if (node.children.length > 0) ctx.fail("invalid-document", "SlideNumber declaration cannot have children");
145
+ return collectRichTextNodeProps(node, ctx, slideNumberAllowedPropKeys, false);
146
+ }
147
+ /** Source codegen contribution for `text`, `paragraph`, `span`, and `slide-number` declarations. */
148
+ const textCodegen = defineObjectCodegen({ declarations: {
149
+ text: createRichTextCodegenHandler({
150
+ vanillaFactory: "text",
151
+ reactComponent: "Text",
152
+ allowedPropKeys: textAllowedPropKeys,
153
+ allowedChildKinds: steppableRichTextChildKinds,
154
+ supportObjectExtras: true
155
+ }),
156
+ paragraph: createRichTextCodegenHandler({
157
+ vanillaFactory: "paragraph",
158
+ reactComponent: "P",
159
+ allowedPropKeys: paragraphAllowedPropKeys,
160
+ allowedChildKinds: inlineRichTextChildKinds,
161
+ supportObjectExtras: true
162
+ }),
163
+ span: createRichTextCodegenHandler({
164
+ vanillaFactory: "span",
165
+ reactComponent: "Span",
166
+ allowedPropKeys: spanAllowedPropKeys,
167
+ allowedChildKinds: inlineRichTextChildKinds,
168
+ supportObjectExtras: false
169
+ }),
170
+ sup: createRichTextCodegenHandler({
171
+ vanillaFactory: "sup",
172
+ reactComponent: "Sup",
173
+ allowedPropKeys: supAllowedPropKeys,
174
+ allowedChildKinds: inlineRichTextChildKinds,
175
+ supportObjectExtras: false
176
+ }),
177
+ sub: createRichTextCodegenHandler({
178
+ vanillaFactory: "sub",
179
+ reactComponent: "Sub",
180
+ allowedPropKeys: subAllowedPropKeys,
181
+ allowedChildKinds: inlineRichTextChildKinds,
182
+ supportObjectExtras: false
183
+ }),
184
+ "slide-number": {
185
+ emitVanilla(node, ctx) {
186
+ const callee = ctx.useImport("slideNumber");
187
+ const propsEntries = emitSlideNumberProps(node, ctx);
188
+ const args = propsEntries.length === 0 ? [] : [ctx.formatProps(propsEntries)];
189
+ return ctx.formatVanillaCall(callee, args);
190
+ },
191
+ emitReact(node, ctx) {
192
+ const tag = ctx.useImport("SlideNumber");
193
+ const propsEntries = emitSlideNumberProps(node, ctx);
194
+ return ctx.formatJsxElement(tag, propsEntries, []);
195
+ }
196
+ }
197
+ } });
198
+ export { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler, inlineRichTextChildKinds, steppableRichTextChildKinds, textCodegen };
@@ -0,0 +1,27 @@
1
+ import { CommonNode, RichTextContainer } from "../../../core/dist/document.js";
2
+ // ../capabilities/dist/text/text-declaration.js
3
+ /** Creates the editable text box shared by the command factory and the Text JSX element. */
4
+ function createTextNode(props) {
5
+ return new RichTextContainer("text", "text", props);
6
+ }
7
+ /** Creates the editable paragraph shared by P JSX and command authoring. */
8
+ function createParagraphNode(props) {
9
+ return new RichTextContainer("paragraph", "paragraph", props);
10
+ }
11
+ /** Creates the editable span shared by Span JSX and command authoring. */
12
+ function createSpanNode(props) {
13
+ return new RichTextContainer("span", "span", props);
14
+ }
15
+ /** Creates the editable superscript inline node shared by Sup JSX and command authoring. */
16
+ function createSupNode(props) {
17
+ return new RichTextContainer("sup", "sup", props);
18
+ }
19
+ /** Creates the editable subscript inline node shared by Sub JSX and command authoring. */
20
+ function createSubNode(props) {
21
+ return new RichTextContainer("sub", "sub", props);
22
+ }
23
+ /** Creates the editable slide number field shared by the command factory and JSX element. */
24
+ function createSlideNumberNode(props) {
25
+ return new CommonNode("slide-number", "slide-number", props);
26
+ }
27
+ export { createParagraphNode, createSlideNumberNode, createSpanNode, createSubNode, createSupNode, createTextNode };
@@ -0,0 +1,54 @@
1
+ import { hostNodeCreator } from "../../../core/dist/host.js";
2
+ import { motionElement } from "../motion/motion-elements.js";
3
+ import { createParagraphNode, createSlideNumberNode, createSpanNode, createSubNode, createSupNode, createTextNode } from "./text-declaration.js";
4
+ import { createElement } from "react";
5
+ // ../capabilities/dist/text/text-elements.js
6
+ /** Native text box; numeric height preserves a fixed region, while auto height uses explicit font measurement. */
7
+ function Text(props) {
8
+ return motionElement("text", {
9
+ ...props,
10
+ [hostNodeCreator]: createTextNode
11
+ });
12
+ }
13
+ /** Declares a native paragraph within a text box, with line spacing and paragraph list semantics. */
14
+ function P(props) {
15
+ return createElement("paragraph", {
16
+ ...props,
17
+ [hostNodeCreator]: createParagraphNode
18
+ }, props.children);
19
+ }
20
+ /** Declares an individually styled text run within a paragraph. */
21
+ function Span(props) {
22
+ return createElement("span", {
23
+ ...props,
24
+ [hostNodeCreator]: createSpanNode
25
+ }, props.children);
26
+ }
27
+ /** Declares an inline superscript run (`baseline="30000"`). */
28
+ function Sup(props) {
29
+ return createElement("sup", {
30
+ ...props,
31
+ [hostNodeCreator]: createSupNode
32
+ }, props.children);
33
+ }
34
+ /** Declares an inline subscript run (`baseline="-25000"`). */
35
+ function Sub(props) {
36
+ return createElement("sub", {
37
+ ...props,
38
+ [hostNodeCreator]: createSubNode
39
+ }, props.children);
40
+ }
41
+ /** Emits a native slide number field resolved by presentation applications. */
42
+ function SlideNumber(props) {
43
+ return createElement("slide-number", {
44
+ ...props,
45
+ [hostNodeCreator]: createSlideNumberNode
46
+ });
47
+ }
48
+ const inlineTextMarker = Symbol.for("@pptxdk/text-inline-element");
49
+ Object.defineProperty(P, inlineTextMarker, { value: true });
50
+ Object.defineProperty(Span, inlineTextMarker, { value: true });
51
+ Object.defineProperty(Sup, inlineTextMarker, { value: true });
52
+ Object.defineProperty(Sub, inlineTextMarker, { value: true });
53
+ Object.defineProperty(SlideNumber, inlineTextMarker, { value: true });
54
+ export { P, SlideNumber, Span, Sub, Sup, Text };