@json-to-office/shared-pptx 0.20.0 → 0.22.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.
@@ -0,0 +1,68 @@
1
+ import {
2
+ createAllPptxComponentSchemasNarrowed
3
+ } from "./chunk-G3FMM4FX.js";
4
+
5
+ // src/schemas/generator.ts
6
+ import { Type } from "@sinclair/typebox";
7
+ import { latestVersion } from "@json-to-office/shared";
8
+ function createPluginVersionSchema(custom, entry, recursiveRef, isLatest) {
9
+ const fields = {
10
+ name: Type.Literal(custom.name),
11
+ id: Type.Optional(Type.String()),
12
+ enabled: Type.Optional(
13
+ Type.Boolean({
14
+ default: true,
15
+ description: "When false, this component is filtered out and not rendered. Defaults to true."
16
+ })
17
+ ),
18
+ // Omitting version selects the latest release at runtime. Explicit older
19
+ // versions remain discriminated so their own props schema is enforced.
20
+ version: isLatest ? Type.Optional(Type.Literal(entry.version)) : Type.Literal(entry.version),
21
+ props: entry.propsSchema
22
+ };
23
+ if (entry.hasChildren) {
24
+ fields.children = Type.Optional(Type.Array(recursiveRef));
25
+ }
26
+ return Type.Object(fields, {
27
+ additionalProperties: false,
28
+ description: entry.description ?? custom.name
29
+ });
30
+ }
31
+ function generateUnifiedDocumentSchema(options = {}) {
32
+ const { customComponents = [] } = options;
33
+ return Type.Recursive((Self) => {
34
+ const pluginSchemas = [];
35
+ for (const custom of customComponents) {
36
+ if (custom.versions.length > 0) {
37
+ const latest = latestVersion(
38
+ custom.versions.map((entry) => entry.version)
39
+ );
40
+ const versions = custom.versions.map(
41
+ (entry) => createPluginVersionSchema(
42
+ custom,
43
+ entry,
44
+ Self,
45
+ entry.version === latest
46
+ )
47
+ );
48
+ pluginSchemas.push(
49
+ versions.length === 1 ? versions[0] : Type.Union(versions)
50
+ );
51
+ }
52
+ }
53
+ const standardSchemas = createAllPptxComponentSchemasNarrowed(
54
+ Self,
55
+ pluginSchemas
56
+ );
57
+ const componentSchemas = [...standardSchemas, ...pluginSchemas];
58
+ if (componentSchemas.length === 0) {
59
+ return Type.Object({});
60
+ }
61
+ return Type.Union(componentSchemas);
62
+ });
63
+ }
64
+
65
+ export {
66
+ generateUnifiedDocumentSchema
67
+ };
68
+ //# sourceMappingURL=chunk-3TK45DVZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/generator.ts"],"sourcesContent":["/**\n * Unified Presentation Schema Generator\n *\n * Generates JSON schemas that include both standard and custom plugin components.\n * Used at build-time for static schema files and at runtime for plugin-aware validation.\n */\nimport { Type, TSchema } from '@sinclair/typebox';\nimport { latestVersion } from '@json-to-office/shared';\nimport { createAllPptxComponentSchemasNarrowed } from './component-registry';\n\nexport interface VersionedPropsEntry {\n version: string;\n propsSchema: TSchema;\n hasChildren?: boolean;\n description?: string;\n}\n\nexport interface CustomComponentInfo {\n name: string;\n versions: VersionedPropsEntry[];\n}\n\nexport interface GenerateSchemaOptions {\n customComponents?: CustomComponentInfo[];\n includeMetadata?: boolean;\n}\n\nfunction createPluginVersionSchema(\n custom: CustomComponentInfo,\n entry: VersionedPropsEntry,\n recursiveRef: TSchema,\n isLatest: boolean\n): TSchema {\n const fields: Record<string, TSchema> = {\n name: Type.Literal(custom.name),\n id: Type.Optional(Type.String()),\n enabled: Type.Optional(\n Type.Boolean({\n default: true,\n description:\n 'When false, this component is filtered out and not rendered. Defaults to true.',\n })\n ),\n // Omitting version selects the latest release at runtime. Explicit older\n // versions remain discriminated so their own props schema is enforced.\n version: isLatest\n ? Type.Optional(Type.Literal(entry.version))\n : Type.Literal(entry.version),\n props: entry.propsSchema,\n };\n\n if (entry.hasChildren) {\n fields.children = Type.Optional(Type.Array(recursiveRef));\n }\n\n return Type.Object(fields, {\n additionalProperties: false,\n description: entry.description ?? custom.name,\n });\n}\n\n/**\n * Generate a unified presentation schema that includes standard + custom components.\n * Uses Type.Recursive so container components (presentation, slide) can have children.\n */\nexport function generateUnifiedDocumentSchema(\n options: GenerateSchemaOptions = {}\n): TSchema {\n const { customComponents = [] } = options;\n\n return Type.Recursive((Self) => {\n // ── Phase 1: Build plugin schemas (plugins get Self for arbitrary nesting) ──\n const pluginSchemas: TSchema[] = [];\n\n for (const custom of customComponents) {\n if (custom.versions.length > 0) {\n const latest = latestVersion(\n custom.versions.map((entry) => entry.version)\n );\n const versions = custom.versions.map((entry) =>\n createPluginVersionSchema(\n custom,\n entry,\n Self,\n entry.version === latest\n )\n );\n pluginSchemas.push(\n versions.length === 1 ? versions[0] : Type.Union(versions)\n );\n }\n }\n\n // ── Phase 2: Build standard components with narrowed children ──\n const standardSchemas = createAllPptxComponentSchemasNarrowed(\n Self,\n pluginSchemas\n );\n\n const componentSchemas = [...standardSchemas, ...pluginSchemas];\n\n if (componentSchemas.length === 0) {\n return Type.Object({});\n }\n\n return Type.Union(componentSchemas);\n });\n}\n"],"mappings":";;;;;AAMA,SAAS,YAAqB;AAC9B,SAAS,qBAAqB;AAoB9B,SAAS,0BACP,QACA,OACA,cACA,UACS;AACT,QAAM,SAAkC;AAAA,IACtC,MAAM,KAAK,QAAQ,OAAO,IAAI;AAAA,IAC9B,IAAI,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,IAC/B,SAAS,KAAK;AAAA,MACZ,KAAK,QAAQ;AAAA,QACX,SAAS;AAAA,QACT,aACE;AAAA,MACJ,CAAC;AAAA,IACH;AAAA;AAAA;AAAA,IAGA,SAAS,WACL,KAAK,SAAS,KAAK,QAAQ,MAAM,OAAO,CAAC,IACzC,KAAK,QAAQ,MAAM,OAAO;AAAA,IAC9B,OAAO,MAAM;AAAA,EACf;AAEA,MAAI,MAAM,aAAa;AACrB,WAAO,WAAW,KAAK,SAAS,KAAK,MAAM,YAAY,CAAC;AAAA,EAC1D;AAEA,SAAO,KAAK,OAAO,QAAQ;AAAA,IACzB,sBAAsB;AAAA,IACtB,aAAa,MAAM,eAAe,OAAO;AAAA,EAC3C,CAAC;AACH;AAMO,SAAS,8BACd,UAAiC,CAAC,GACzB;AACT,QAAM,EAAE,mBAAmB,CAAC,EAAE,IAAI;AAElC,SAAO,KAAK,UAAU,CAAC,SAAS;AAE9B,UAAM,gBAA2B,CAAC;AAElC,eAAW,UAAU,kBAAkB;AACrC,UAAI,OAAO,SAAS,SAAS,GAAG;AAC9B,cAAM,SAAS;AAAA,UACb,OAAO,SAAS,IAAI,CAAC,UAAU,MAAM,OAAO;AAAA,QAC9C;AACA,cAAM,WAAW,OAAO,SAAS;AAAA,UAAI,CAAC,UACpC;AAAA,YACE;AAAA,YACA;AAAA,YACA;AAAA,YACA,MAAM,YAAY;AAAA,UACpB;AAAA,QACF;AACA,sBAAc;AAAA,UACZ,SAAS,WAAW,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,QAAQ;AAAA,QAC3D;AAAA,MACF;AAAA,IACF;AAGA,UAAM,kBAAkB;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAEA,UAAM,mBAAmB,CAAC,GAAG,iBAAiB,GAAG,aAAa;AAE9D,QAAI,iBAAiB,WAAW,GAAG;AACjC,aAAO,KAAK,OAAO,CAAC,CAAC;AAAA,IACvB;AAEA,WAAO,KAAK,MAAM,gBAAgB;AAAA,EACpC,CAAC;AACH;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PptxComponentDefinitionSchema
3
- } from "./chunk-5ER63EW5.js";
3
+ } from "./chunk-HYJ6MU3F.js";
4
4
 
5
5
  // src/schemas/document.ts
6
6
  var PptxJsonComponentDefinitionSchema = PptxComponentDefinitionSchema;
@@ -18,4 +18,4 @@ export {
18
18
  PptxJsonComponentDefinitionSchema,
19
19
  PPTX_JSON_SCHEMA_URLS
20
20
  };
21
- //# sourceMappingURL=chunk-7MPP5MFF.js.map
21
+ //# sourceMappingURL=chunk-BIJP7NTG.js.map
@@ -1,46 +1,150 @@
1
1
  import {
2
2
  ColorValueSchema,
3
3
  GridConfigSchema,
4
- GridPositionSchema,
4
+ ThemeConfigSchema
5
+ } from "./chunk-ZMZKHRBS.js";
6
+ import {
5
7
  PptxChartPropsSchema,
6
8
  PptxComponentDefaultsSchema,
7
9
  PptxHighchartsPropsSchema,
8
10
  PptxImagePropsSchema,
9
11
  PptxTablePropsSchema,
10
12
  ShapePropsSchema,
11
- SlideBackgroundSchema,
12
- TextPropsSchema,
13
- ThemeConfigSchema,
14
- TransitionSchema
15
- } from "./chunk-STLETJGO.js";
13
+ TextPropsSchema
14
+ } from "./chunk-NCBBMAVS.js";
16
15
 
17
16
  // src/schemas/component-registry.ts
18
- import { Type as Type4 } from "@sinclair/typebox";
17
+ import { Type as Type5 } from "@sinclair/typebox";
18
+ import { PPTX_SLIDE_CONTENT_COMPONENTS } from "@json-to-office/shared/schemas/slide-content";
19
19
 
20
20
  // src/schemas/components/presentation.ts
21
- import { Type as Type2 } from "@sinclair/typebox";
21
+ import { Type as Type3 } from "@sinclair/typebox";
22
22
 
23
23
  // src/schemas/components/template.ts
24
+ import { Type as Type2 } from "@sinclair/typebox";
25
+
26
+ // src/schemas/components/common.ts
24
27
  import { Type } from "@sinclair/typebox";
25
- var Coord = Type.Union([
26
- Type.Number({ description: "Position/size in inches" }),
27
- Type.String({
28
+ import { ColorValueSchema as ColorValueSchema2 } from "@json-to-office/shared/schemas/slide-content";
29
+ import {
30
+ PptxAlignmentSchema,
31
+ VerticalAlignmentSchema,
32
+ ShadowSchema,
33
+ GridPositionSchema
34
+ } from "@json-to-office/shared/schemas/slide-content";
35
+ var PositionSchema = Type.Object(
36
+ {
37
+ x: Type.Optional(
38
+ Type.Union([
39
+ Type.Number({ description: "X position in inches" }),
40
+ Type.String({
41
+ pattern: "^\\d+(\\.\\d+)?%$",
42
+ description: 'X position as percentage (e.g., "10%")'
43
+ })
44
+ ])
45
+ ),
46
+ y: Type.Optional(
47
+ Type.Union([
48
+ Type.Number({ description: "Y position in inches" }),
49
+ Type.String({
50
+ pattern: "^\\d+(\\.\\d+)?%$",
51
+ description: 'Y position as percentage (e.g., "10%")'
52
+ })
53
+ ])
54
+ ),
55
+ w: Type.Optional(
56
+ Type.Union([
57
+ Type.Number({ description: "Width in inches" }),
58
+ Type.String({
59
+ pattern: "^\\d+(\\.\\d+)?%$",
60
+ description: 'Width as percentage (e.g., "80%")'
61
+ })
62
+ ])
63
+ ),
64
+ h: Type.Optional(
65
+ Type.Union([
66
+ Type.Number({ description: "Height in inches" }),
67
+ Type.String({
68
+ pattern: "^\\d+(\\.\\d+)?%$",
69
+ description: 'Height as percentage (e.g., "20%")'
70
+ })
71
+ ])
72
+ )
73
+ },
74
+ {
75
+ description: "Position and size in inches or percentages",
76
+ additionalProperties: false
77
+ }
78
+ );
79
+ var SlideBackgroundSchema = Type.Object(
80
+ {
81
+ color: Type.Optional(ColorValueSchema2),
82
+ image: Type.Optional(
83
+ Type.Object(
84
+ {
85
+ path: Type.Optional(
86
+ Type.String({ description: "Image file path or URL" })
87
+ ),
88
+ base64: Type.Optional(
89
+ Type.String({ description: "Base64-encoded image data" })
90
+ )
91
+ },
92
+ { description: "Background image", additionalProperties: false }
93
+ )
94
+ )
95
+ },
96
+ {
97
+ description: "Slide background configuration",
98
+ additionalProperties: false
99
+ }
100
+ );
101
+ var TransitionSchema = Type.Object(
102
+ {
103
+ type: Type.Optional(
104
+ Type.Union(
105
+ [
106
+ Type.Literal("fade"),
107
+ Type.Literal("push"),
108
+ Type.Literal("wipe"),
109
+ Type.Literal("zoom"),
110
+ Type.Literal("none")
111
+ ],
112
+ { description: "Transition effect type" }
113
+ )
114
+ ),
115
+ speed: Type.Optional(
116
+ Type.Union(
117
+ [Type.Literal("slow"), Type.Literal("medium"), Type.Literal("fast")],
118
+ { description: "Transition speed" }
119
+ )
120
+ )
121
+ },
122
+ {
123
+ description: "Slide transition configuration",
124
+ additionalProperties: false
125
+ }
126
+ );
127
+
128
+ // src/schemas/components/template.ts
129
+ var Coord = Type2.Union([
130
+ Type2.Number({ description: "Position/size in inches" }),
131
+ Type2.String({
28
132
  pattern: "^\\d+(\\.\\d+)?%$",
29
133
  description: 'Position/size as percentage of slide dimension (e.g., "50%")'
30
134
  })
31
135
  ]);
32
136
  function contentComponent(name, propsSchema) {
33
- return Type.Object({
34
- name: Type.Literal(name),
35
- id: Type.Optional(Type.String()),
36
- enabled: Type.Optional(Type.Boolean({
137
+ return Type2.Object({
138
+ name: Type2.Literal(name),
139
+ id: Type2.Optional(Type2.String()),
140
+ enabled: Type2.Optional(Type2.Boolean({
37
141
  default: true,
38
142
  description: "When false, this component is filtered out and not rendered. Defaults to true."
39
143
  })),
40
144
  props: propsSchema
41
145
  }, { additionalProperties: false });
42
146
  }
43
- var TemplateObjectComponentSchema = Type.Union([
147
+ var TemplateObjectComponentSchema = Type2.Union([
44
148
  contentComponent("text", TextPropsSchema),
45
149
  contentComponent("image", PptxImagePropsSchema),
46
150
  contentComponent("shape", ShapePropsSchema),
@@ -52,12 +156,12 @@ var TemplateObjectComponentSchema = Type.Union([
52
156
  description: "Fixed component on a template slide (same format as slide children)"
53
157
  });
54
158
  function defaultsComponent(name, propsSchema) {
55
- return Type.Object({
56
- name: Type.Literal(name),
57
- props: Type.Partial(propsSchema, { description: "Default props inherited by the component placed in this placeholder" })
159
+ return Type2.Object({
160
+ name: Type2.Literal(name),
161
+ props: Type2.Partial(propsSchema, { description: "Default props inherited by the component placed in this placeholder" })
58
162
  }, { additionalProperties: false });
59
163
  }
60
- var PlaceholderDefaultsSchema = Type.Union([
164
+ var PlaceholderDefaultsSchema = Type2.Union([
61
165
  defaultsComponent("text", TextPropsSchema),
62
166
  defaultsComponent("image", PptxImagePropsSchema),
63
167
  defaultsComponent("shape", ShapePropsSchema),
@@ -68,54 +172,54 @@ var PlaceholderDefaultsSchema = Type.Union([
68
172
  discriminator: { propertyName: "name" },
69
173
  description: "Partial component stub \u2014 styling defaults only"
70
174
  });
71
- var PlaceholderDefinitionSchema = Type.Object({
72
- name: Type.String({ description: "Unique placeholder name" }),
73
- x: Type.Optional(Coord),
74
- y: Type.Optional(Coord),
75
- w: Type.Optional(Coord),
76
- h: Type.Optional(Coord),
77
- grid: Type.Optional(GridPositionSchema),
78
- defaults: Type.Optional(PlaceholderDefaultsSchema)
175
+ var PlaceholderDefinitionSchema = Type2.Object({
176
+ name: Type2.String({ description: "Unique placeholder name" }),
177
+ x: Type2.Optional(Coord),
178
+ y: Type2.Optional(Coord),
179
+ w: Type2.Optional(Coord),
180
+ h: Type2.Optional(Coord),
181
+ grid: Type2.Optional(GridPositionSchema),
182
+ defaults: Type2.Optional(PlaceholderDefaultsSchema)
79
183
  }, { additionalProperties: false, description: "Placeholder on a template slide \u2014 defaults is a component stub whose props are inherited by the actual component" });
80
- var TemplateSlideDefinitionSchema = Type.Object({
81
- name: Type.String({ description: "Unique template slide name" }),
82
- background: Type.Optional(SlideBackgroundSchema),
83
- margin: Type.Optional(Type.Union([
84
- Type.Number({ description: "Margin in inches (all sides)" }),
85
- Type.Array(Type.Number(), { minItems: 4, maxItems: 4, description: "Margin [top, right, bottom, left] in inches" })
184
+ var TemplateSlideDefinitionSchema = Type2.Object({
185
+ name: Type2.String({ description: "Unique template slide name" }),
186
+ background: Type2.Optional(SlideBackgroundSchema),
187
+ margin: Type2.Optional(Type2.Union([
188
+ Type2.Number({ description: "Margin in inches (all sides)" }),
189
+ Type2.Array(Type2.Number(), { minItems: 4, maxItems: 4, description: "Margin [top, right, bottom, left] in inches" })
86
190
  ])),
87
- slideNumber: Type.Optional(Type.Object({
191
+ slideNumber: Type2.Optional(Type2.Object({
88
192
  x: Coord,
89
193
  y: Coord,
90
- w: Type.Optional(Coord),
91
- h: Type.Optional(Coord),
92
- color: Type.Optional(ColorValueSchema),
93
- fontSize: Type.Optional(Type.Number({ description: "Slide number font size in points" }))
194
+ w: Type2.Optional(Coord),
195
+ h: Type2.Optional(Coord),
196
+ color: Type2.Optional(ColorValueSchema),
197
+ fontSize: Type2.Optional(Type2.Number({ description: "Slide number font size in points" }))
94
198
  }, { additionalProperties: false, description: "Slide number position and styling" })),
95
- objects: Type.Optional(Type.Array(TemplateObjectComponentSchema, { description: "Fixed components (logos, footers, decorations) \u2014 same { name, props } format as slide children" })),
96
- placeholders: Type.Optional(Type.Array(PlaceholderDefinitionSchema, { description: "Placeholder regions for slide content" })),
97
- grid: Type.Optional(GridConfigSchema)
199
+ objects: Type2.Optional(Type2.Array(TemplateObjectComponentSchema, { description: "Fixed components (logos, footers, decorations) \u2014 same { name, props } format as slide children" })),
200
+ placeholders: Type2.Optional(Type2.Array(PlaceholderDefinitionSchema, { description: "Placeholder regions for slide content" })),
201
+ grid: Type2.Optional(GridConfigSchema)
98
202
  }, { additionalProperties: false, description: "Template slide definition (reusable slide template)" });
99
203
 
100
204
  // src/schemas/components/presentation.ts
101
- var PresentationPropsSchema = Type2.Object(
205
+ var PresentationPropsSchema = Type3.Object(
102
206
  {
103
- title: Type2.Optional(
104
- Type2.String({ description: "Presentation title metadata" })
207
+ title: Type3.Optional(
208
+ Type3.String({ description: "Presentation title metadata" })
105
209
  ),
106
- author: Type2.Optional(
107
- Type2.String({ description: "Presentation author metadata" })
210
+ author: Type3.Optional(
211
+ Type3.String({ description: "Presentation author metadata" })
108
212
  ),
109
- subject: Type2.Optional(
110
- Type2.String({ description: "Presentation subject metadata" })
213
+ subject: Type3.Optional(
214
+ Type3.String({ description: "Presentation subject metadata" })
111
215
  ),
112
- company: Type2.Optional(
113
- Type2.String({ description: "Company name metadata" })
216
+ company: Type3.Optional(
217
+ Type3.String({ description: "Company name metadata" })
114
218
  ),
115
- theme: Type2.Optional(
116
- Type2.Union(
219
+ theme: Type3.Optional(
220
+ Type3.Union(
117
221
  [
118
- Type2.String({
222
+ Type3.String({
119
223
  description: 'Theme name to apply (default: "default")',
120
224
  default: "default"
121
225
  }),
@@ -126,38 +230,38 @@ var PresentationPropsSchema = Type2.Object(
126
230
  }
127
231
  )
128
232
  ),
129
- slideWidth: Type2.Optional(
130
- Type2.Number({
233
+ slideWidth: Type3.Optional(
234
+ Type3.Number({
131
235
  description: "Slide width in inches (default: 10)",
132
236
  default: 10
133
237
  })
134
238
  ),
135
- slideHeight: Type2.Optional(
136
- Type2.Number({
239
+ slideHeight: Type3.Optional(
240
+ Type3.Number({
137
241
  description: "Slide height in inches (default: 7.5)",
138
242
  default: 7.5
139
243
  })
140
244
  ),
141
- rtlMode: Type2.Optional(
142
- Type2.Boolean({ description: "Right-to-left text direction" })
245
+ rtlMode: Type3.Optional(
246
+ Type3.Boolean({ description: "Right-to-left text direction" })
143
247
  ),
144
- language: Type2.Optional(
145
- Type2.String({
248
+ language: Type3.Optional(
249
+ Type3.String({
146
250
  pattern: "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
147
251
  description: 'Default presentation language (BCP-47 tag, e.g. "en-US"). Sets the spell-check language for all text; individual text components can override it.',
148
252
  examples: ["en-US", "fr-FR", "de-DE", "it-IT", "es-ES"]
149
253
  })
150
254
  ),
151
- pageNumberFormat: Type2.Optional(
152
- Type2.Union([Type2.Literal("9"), Type2.Literal("09")], {
255
+ pageNumberFormat: Type3.Optional(
256
+ Type3.Union([Type3.Literal("9"), Type3.Literal("09")], {
153
257
  description: 'Format for {PAGE_NUMBER} placeholders: "9" = bare number (default), "09" = zero-padded',
154
258
  default: "9"
155
259
  })
156
260
  ),
157
- componentDefaults: Type2.Optional(PptxComponentDefaultsSchema),
158
- grid: Type2.Optional(GridConfigSchema),
159
- templates: Type2.Optional(
160
- Type2.Array(TemplateSlideDefinitionSchema, {
261
+ componentDefaults: Type3.Optional(PptxComponentDefaultsSchema),
262
+ grid: Type3.Optional(GridConfigSchema),
263
+ templates: Type3.Optional(
264
+ Type3.Array(TemplateSlideDefinitionSchema, {
161
265
  description: "Template slide definitions (reusable slide templates)"
162
266
  })
163
267
  )
@@ -169,24 +273,24 @@ var PresentationPropsSchema = Type2.Object(
169
273
  );
170
274
 
171
275
  // src/schemas/components/slide.ts
172
- import { Type as Type3 } from "@sinclair/typebox";
173
- var SlidePropsSchema = Type3.Object(
276
+ import { Type as Type4 } from "@sinclair/typebox";
277
+ var SlidePropsSchema = Type4.Object(
174
278
  {
175
- background: Type3.Optional(SlideBackgroundSchema),
176
- transition: Type3.Optional(TransitionSchema),
177
- notes: Type3.Optional(
178
- Type3.String({ description: "Speaker notes for this slide" })
279
+ background: Type4.Optional(SlideBackgroundSchema),
280
+ transition: Type4.Optional(TransitionSchema),
281
+ notes: Type4.Optional(
282
+ Type4.String({ description: "Speaker notes for this slide" })
179
283
  ),
180
- layout: Type3.Optional(
181
- Type3.String({
284
+ layout: Type4.Optional(
285
+ Type4.String({
182
286
  description: 'Slide layout name (e.g., "Title Slide", "Blank")'
183
287
  })
184
288
  ),
185
- hidden: Type3.Optional(
186
- Type3.Boolean({ description: "Hide this slide from presentation" })
289
+ hidden: Type4.Optional(
290
+ Type4.Boolean({ description: "Hide this slide from presentation" })
187
291
  ),
188
- template: Type3.Optional(
189
- Type3.String({ description: "Template slide name to apply" })
292
+ template: Type4.Optional(
293
+ Type4.String({ description: "Template slide name to apply" })
190
294
  )
191
295
  // Note: `placeholders` is added dynamically by the component registry
192
296
  // with the recursive component ref, to avoid circular imports.
@@ -217,63 +321,14 @@ var PPTX_STANDARD_COMPONENTS_REGISTRY = [
217
321
  name: "slide",
218
322
  propsSchema: SlidePropsSchema,
219
323
  hasChildren: true,
220
- allowedChildren: [
221
- "text",
222
- "image",
223
- "shape",
224
- "table",
225
- "highcharts",
226
- "chart"
227
- ],
324
+ allowedChildren: PPTX_SLIDE_CONTENT_COMPONENTS.map(({ name }) => name),
228
325
  hasPlaceholders: true,
229
326
  category: "container",
230
327
  description: "Slide container - groups content elements on a single slide."
231
328
  },
232
- // ========================================================================
233
- // Content Components (leaf nodes, no children)
234
- // ========================================================================
235
- {
236
- name: "text",
237
- propsSchema: TextPropsSchema,
238
- hasChildren: false,
239
- category: "content",
240
- description: "Text element - displays text with formatting, positioning and styling options."
241
- },
242
- {
243
- name: "image",
244
- propsSchema: PptxImagePropsSchema,
245
- hasChildren: false,
246
- category: "content",
247
- description: "Image element - displays images from file path, URL, or base64 data."
248
- },
249
- {
250
- name: "shape",
251
- propsSchema: ShapePropsSchema,
252
- hasChildren: false,
253
- category: "content",
254
- description: "Shape element - draws geometric shapes with optional text, fill, and line styling."
255
- },
256
- {
257
- name: "table",
258
- propsSchema: PptxTablePropsSchema,
259
- hasChildren: false,
260
- category: "content",
261
- description: "Table element - displays tabular data with rows and columns."
262
- },
263
- {
264
- name: "highcharts",
265
- propsSchema: PptxHighchartsPropsSchema,
266
- hasChildren: false,
267
- category: "content",
268
- description: "Highcharts element - renders charts via Highcharts Export Server."
269
- },
270
- {
271
- name: "chart",
272
- propsSchema: PptxChartPropsSchema,
273
- hasChildren: false,
274
- category: "content",
275
- description: "Native PowerPoint chart - editable, scalable, no external server needed."
276
- }
329
+ // Content components are canonical in @json-to-office/shared so DOCX
330
+ // visuals can reuse the exact schemas without depending on shared-pptx.
331
+ ...PPTX_SLIDE_CONTENT_COMPONENTS
277
332
  ];
278
333
  function getPptxStandardComponent(name) {
279
334
  return PPTX_STANDARD_COMPONENTS_REGISTRY.find((c) => c.name === name);
@@ -297,30 +352,30 @@ function isPptxStandardComponent(name) {
297
352
  }
298
353
  function createPptxComponentSchemaObject(component, recursiveRef, placeholderRef) {
299
354
  const schema = {
300
- name: Type4.Literal(component.name),
301
- id: Type4.Optional(Type4.String()),
302
- enabled: Type4.Optional(
303
- Type4.Boolean({
355
+ name: Type5.Literal(component.name),
356
+ id: Type5.Optional(Type5.String()),
357
+ enabled: Type5.Optional(
358
+ Type5.Boolean({
304
359
  default: true,
305
360
  description: "When false, this component is filtered out and not rendered. Defaults to true."
306
361
  })
307
362
  )
308
363
  };
309
364
  if (component.special?.hasSchemaField) {
310
- schema.$schema = Type4.Optional(Type4.String({ format: "uri" }));
365
+ schema.$schema = Type5.Optional(Type5.String({ format: "uri" }));
311
366
  }
312
367
  schema.props = component.propsSchema;
313
368
  if (component.hasChildren && recursiveRef) {
314
- schema.children = Type4.Optional(Type4.Array(recursiveRef));
369
+ schema.children = Type5.Optional(Type5.Array(recursiveRef));
315
370
  }
316
371
  if (component.hasPlaceholders && (placeholderRef ?? recursiveRef)) {
317
372
  const baseProperties = component.propsSchema.properties ?? {};
318
373
  const phRef = placeholderRef ?? recursiveRef;
319
- schema.props = Type4.Object(
374
+ schema.props = Type5.Object(
320
375
  {
321
376
  ...baseProperties,
322
- placeholders: Type4.Optional(
323
- Type4.Record(Type4.String(), phRef, {
377
+ placeholders: Type5.Optional(
378
+ Type5.Record(Type5.String(), phRef, {
324
379
  description: 'Content for named placeholders: { "title": { "name": "text", ... } }'
325
380
  })
326
381
  )
@@ -331,7 +386,7 @@ function createPptxComponentSchemaObject(component, recursiveRef, placeholderRef
331
386
  }
332
387
  );
333
388
  }
334
- return Type4.Object(schema, { additionalProperties: false });
389
+ return Type5.Object(schema, { additionalProperties: false });
335
390
  }
336
391
  function createAllPptxComponentSchemas(recursiveRef) {
337
392
  return PPTX_STANDARD_COMPONENTS_REGISTRY.map(
@@ -371,7 +426,7 @@ function createAllPptxComponentSchemasNarrowed(selfRef, pluginSchemas = []) {
371
426
  if (!containerDeps.every((d) => resolved.has(d))) continue;
372
427
  const childSchemas = comp.allowedChildren.map((name) => resolved.get(name) ?? leafSchemas.get(name)).filter((s) => s !== void 0);
373
428
  const allChildSchemas = [...childSchemas, ...pluginSchemas];
374
- const childrenType = allChildSchemas.length === 1 ? allChildSchemas[0] : Type4.Union(allChildSchemas);
429
+ const childrenType = allChildSchemas.length === 1 ? allChildSchemas[0] : Type5.Union(allChildSchemas);
375
430
  resolved.set(
376
431
  comp.name,
377
432
  createPptxComponentSchemaObject(comp, childrenType, selfRef)
@@ -388,6 +443,13 @@ function createAllPptxComponentSchemasNarrowed(selfRef, pluginSchemas = []) {
388
443
  }
389
444
 
390
445
  export {
446
+ PositionSchema,
447
+ SlideBackgroundSchema,
448
+ TransitionSchema,
449
+ PptxAlignmentSchema,
450
+ VerticalAlignmentSchema,
451
+ ShadowSchema,
452
+ GridPositionSchema,
391
453
  PresentationPropsSchema,
392
454
  SlidePropsSchema,
393
455
  PPTX_STANDARD_COMPONENTS_REGISTRY,
@@ -401,4 +463,4 @@ export {
401
463
  createAllPptxComponentSchemas,
402
464
  createAllPptxComponentSchemasNarrowed
403
465
  };
404
- //# sourceMappingURL=chunk-I3XL4HX7.js.map
466
+ //# sourceMappingURL=chunk-G3FMM4FX.js.map