@json-to-office/shared-pptx 0.24.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NCBBMAVS.js → chunk-7CKCXKN7.js} +15 -3
- package/dist/{chunk-NCBBMAVS.js.map → chunk-7CKCXKN7.js.map} +1 -1
- package/dist/{chunk-3TK45DVZ.js → chunk-7O7XPZXS.js} +2 -2
- package/dist/{chunk-HYJ6MU3F.js → chunk-B7HWVX62.js} +2 -2
- package/dist/{chunk-ZMZKHRBS.js → chunk-M5PJJLWM.js} +2 -2
- package/dist/{chunk-BIJP7NTG.js → chunk-X2MWLKFW.js} +2 -2
- package/dist/{chunk-G3FMM4FX.js → chunk-ZJTUC7DA.js} +8 -4
- package/dist/{chunk-G3FMM4FX.js.map → chunk-ZJTUC7DA.js.map} +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.js +53 -7
- package/dist/index.js.map +1 -1
- package/dist/schemas/component-defaults.d.ts +120 -4
- package/dist/schemas/component-defaults.js +1 -1
- package/dist/schemas/component-registry.js +3 -3
- package/dist/schemas/component-union.js +4 -4
- package/dist/schemas/components.d.ts +151 -5
- package/dist/schemas/components.js +14 -4
- package/dist/schemas/document.js +5 -5
- package/dist/schemas/generator.js +4 -4
- package/dist/schemas/theme.d.ts +60 -2
- package/dist/schemas/theme.js +2 -2
- package/package.json +2 -2
- /package/dist/{chunk-3TK45DVZ.js.map → chunk-7O7XPZXS.js.map} +0 -0
- /package/dist/{chunk-HYJ6MU3F.js.map → chunk-B7HWVX62.js.map} +0 -0
- /package/dist/{chunk-ZMZKHRBS.js.map → chunk-M5PJJLWM.js.map} +0 -0
- /package/dist/{chunk-BIJP7NTG.js.map → chunk-X2MWLKFW.js.map} +0 -0
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { Type } from "@sinclair/typebox";
|
|
3
3
|
|
|
4
4
|
// src/schemas/components/text.ts
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
TextPropsSchema,
|
|
7
|
+
TextRunSchema
|
|
8
|
+
} from "@json-to-office/shared/schemas/slide-content";
|
|
6
9
|
|
|
7
10
|
// src/schemas/components/image.ts
|
|
8
11
|
import { PptxImagePropsSchema } from "@json-to-office/shared/schemas/slide-content";
|
|
@@ -11,7 +14,11 @@ import { PptxImagePropsSchema } from "@json-to-office/shared/schemas/slide-conte
|
|
|
11
14
|
import {
|
|
12
15
|
ShapePropsSchema,
|
|
13
16
|
ShapeTypeSchema,
|
|
14
|
-
TextSegmentSchema
|
|
17
|
+
TextSegmentSchema,
|
|
18
|
+
GradientStopSchema,
|
|
19
|
+
GradientFillSchema,
|
|
20
|
+
PatternFillSchema,
|
|
21
|
+
PATTERN_FILL_PRESETS
|
|
15
22
|
} from "@json-to-office/shared/schemas/slide-content";
|
|
16
23
|
|
|
17
24
|
// src/schemas/components/table.ts
|
|
@@ -46,10 +53,15 @@ var PptxComponentDefaultsSchema = Type.Object(
|
|
|
46
53
|
|
|
47
54
|
export {
|
|
48
55
|
TextPropsSchema,
|
|
56
|
+
TextRunSchema,
|
|
49
57
|
PptxImagePropsSchema,
|
|
50
58
|
ShapePropsSchema,
|
|
51
59
|
ShapeTypeSchema,
|
|
52
60
|
TextSegmentSchema,
|
|
61
|
+
GradientStopSchema,
|
|
62
|
+
GradientFillSchema,
|
|
63
|
+
PatternFillSchema,
|
|
64
|
+
PATTERN_FILL_PRESETS,
|
|
53
65
|
PptxTablePropsSchema,
|
|
54
66
|
PptxHighchartsPropsSchema,
|
|
55
67
|
PptxChartPropsSchema,
|
|
@@ -61,4 +73,4 @@ export {
|
|
|
61
73
|
ChartComponentDefaultsSchema,
|
|
62
74
|
PptxComponentDefaultsSchema
|
|
63
75
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-7CKCXKN7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/component-defaults.ts","../src/schemas/components/text.ts","../src/schemas/components/image.ts","../src/schemas/components/shape.ts","../src/schemas/components/table.ts","../src/schemas/components/highcharts.ts","../src/schemas/components/chart.ts"],"sourcesContent":["/**\n * PPTX Component Defaults Schemas\n *\n * Imports directly from individual component files to avoid circular deps.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { TextPropsSchema } from './components/text';\nimport { PptxImagePropsSchema } from './components/image';\nimport { ShapePropsSchema } from './components/shape';\nimport { PptxTablePropsSchema } from './components/table';\nimport { PptxHighchartsPropsSchema } from './components/highcharts';\nimport { PptxChartPropsSchema } from './components/chart';\n\n// Create component defaults by making all fields optional (Type.Partial)\nexport const TextComponentDefaultsSchema = Type.Partial(TextPropsSchema);\nexport const ImageComponentDefaultsSchema = Type.Partial(PptxImagePropsSchema);\nexport const ShapeComponentDefaultsSchema = Type.Partial(ShapePropsSchema);\nexport const TableComponentDefaultsSchema = Type.Partial(PptxTablePropsSchema);\nexport const HighchartsComponentDefaultsSchema = Type.Partial(\n PptxHighchartsPropsSchema\n);\nexport const ChartComponentDefaultsSchema = Type.Partial(PptxChartPropsSchema);\n\nexport const PptxComponentDefaultsSchema = Type.Object(\n {\n text: Type.Optional(TextComponentDefaultsSchema),\n image: Type.Optional(ImageComponentDefaultsSchema),\n shape: Type.Optional(ShapeComponentDefaultsSchema),\n table: Type.Optional(TableComponentDefaultsSchema),\n highcharts: Type.Optional(HighchartsComponentDefaultsSchema),\n chart: Type.Optional(ChartComponentDefaultsSchema),\n },\n { additionalProperties: true }\n);\n\n// TypeScript types\nexport type TextComponentDefaults = Static<typeof TextComponentDefaultsSchema>;\nexport type ImageComponentDefaults = Static<\n typeof ImageComponentDefaultsSchema\n>;\nexport type ShapeComponentDefaults = Static<\n typeof ShapeComponentDefaultsSchema\n>;\nexport type TableComponentDefaults = Static<\n typeof TableComponentDefaultsSchema\n>;\nexport type HighchartsComponentDefaults = Static<\n typeof HighchartsComponentDefaultsSchema\n>;\nexport type ChartComponentDefaults = Static<\n typeof ChartComponentDefaultsSchema\n>;\nexport type PptxComponentDefaults = Static<\n typeof PptxComponentDefaultsSchema\n>;\n","export {
|
|
1
|
+
{"version":3,"sources":["../src/schemas/component-defaults.ts","../src/schemas/components/text.ts","../src/schemas/components/image.ts","../src/schemas/components/shape.ts","../src/schemas/components/table.ts","../src/schemas/components/highcharts.ts","../src/schemas/components/chart.ts"],"sourcesContent":["/**\n * PPTX Component Defaults Schemas\n *\n * Imports directly from individual component files to avoid circular deps.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { TextPropsSchema } from './components/text';\nimport { PptxImagePropsSchema } from './components/image';\nimport { ShapePropsSchema } from './components/shape';\nimport { PptxTablePropsSchema } from './components/table';\nimport { PptxHighchartsPropsSchema } from './components/highcharts';\nimport { PptxChartPropsSchema } from './components/chart';\n\n// Create component defaults by making all fields optional (Type.Partial)\nexport const TextComponentDefaultsSchema = Type.Partial(TextPropsSchema);\nexport const ImageComponentDefaultsSchema = Type.Partial(PptxImagePropsSchema);\nexport const ShapeComponentDefaultsSchema = Type.Partial(ShapePropsSchema);\nexport const TableComponentDefaultsSchema = Type.Partial(PptxTablePropsSchema);\nexport const HighchartsComponentDefaultsSchema = Type.Partial(\n PptxHighchartsPropsSchema\n);\nexport const ChartComponentDefaultsSchema = Type.Partial(PptxChartPropsSchema);\n\nexport const PptxComponentDefaultsSchema = Type.Object(\n {\n text: Type.Optional(TextComponentDefaultsSchema),\n image: Type.Optional(ImageComponentDefaultsSchema),\n shape: Type.Optional(ShapeComponentDefaultsSchema),\n table: Type.Optional(TableComponentDefaultsSchema),\n highcharts: Type.Optional(HighchartsComponentDefaultsSchema),\n chart: Type.Optional(ChartComponentDefaultsSchema),\n },\n { additionalProperties: true }\n);\n\n// TypeScript types\nexport type TextComponentDefaults = Static<typeof TextComponentDefaultsSchema>;\nexport type ImageComponentDefaults = Static<\n typeof ImageComponentDefaultsSchema\n>;\nexport type ShapeComponentDefaults = Static<\n typeof ShapeComponentDefaultsSchema\n>;\nexport type TableComponentDefaults = Static<\n typeof TableComponentDefaultsSchema\n>;\nexport type HighchartsComponentDefaults = Static<\n typeof HighchartsComponentDefaultsSchema\n>;\nexport type ChartComponentDefaults = Static<\n typeof ChartComponentDefaultsSchema\n>;\nexport type PptxComponentDefaults = Static<\n typeof PptxComponentDefaultsSchema\n>;\n","export {\n TextPropsSchema,\n TextRunSchema,\n} from '@json-to-office/shared/schemas/slide-content';\nexport type {\n TextProps,\n TextRun,\n} from '@json-to-office/shared/schemas/slide-content';\n","export { PptxImagePropsSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { PptxImageProps } from '@json-to-office/shared/schemas/slide-content';\n","export {\n ShapePropsSchema,\n ShapeTypeSchema,\n TextSegmentSchema,\n GradientStopSchema,\n GradientFillSchema,\n PatternFillSchema,\n PATTERN_FILL_PRESETS,\n} from '@json-to-office/shared/schemas/slide-content';\nexport type {\n ShapeProps,\n ShapeType,\n TextSegment,\n GradientStop,\n GradientFill,\n PatternFill,\n} from '@json-to-office/shared/schemas/slide-content';\n","export { PptxTablePropsSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { PptxTableProps } from '@json-to-office/shared/schemas/slide-content';\n","export { PptxHighchartsPropsSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { PptxHighchartsProps } from '@json-to-office/shared/schemas/slide-content';\n","export { PptxChartPropsSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { PptxChartProps } from '@json-to-office/shared/schemas/slide-content';\n"],"mappings":";AAMA,SAAS,YAAoB;;;ACN7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACHP,SAAS,4BAA4B;;;ACArC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACRP,SAAS,4BAA4B;;;ACArC,SAAS,iCAAiC;;;ACA1C,SAAS,4BAA4B;;;ANe9B,IAAM,8BAA8B,KAAK,QAAQ,eAAe;AAChE,IAAM,+BAA+B,KAAK,QAAQ,oBAAoB;AACtE,IAAM,+BAA+B,KAAK,QAAQ,gBAAgB;AAClE,IAAM,+BAA+B,KAAK,QAAQ,oBAAoB;AACtE,IAAM,oCAAoC,KAAK;AAAA,EACpD;AACF;AACO,IAAM,+BAA+B,KAAK,QAAQ,oBAAoB;AAEtE,IAAM,8BAA8B,KAAK;AAAA,EAC9C;AAAA,IACE,MAAM,KAAK,SAAS,2BAA2B;AAAA,IAC/C,OAAO,KAAK,SAAS,4BAA4B;AAAA,IACjD,OAAO,KAAK,SAAS,4BAA4B;AAAA,IACjD,OAAO,KAAK,SAAS,4BAA4B;AAAA,IACjD,YAAY,KAAK,SAAS,iCAAiC;AAAA,IAC3D,OAAO,KAAK,SAAS,4BAA4B;AAAA,EACnD;AAAA,EACA,EAAE,sBAAsB,KAAK;AAC/B;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAllPptxComponentSchemasNarrowed
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZJTUC7DA.js";
|
|
4
4
|
|
|
5
5
|
// src/schemas/generator.ts
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
@@ -65,4 +65,4 @@ function generateUnifiedDocumentSchema(options = {}) {
|
|
|
65
65
|
export {
|
|
66
66
|
generateUnifiedDocumentSchema
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-7O7XPZXS.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAllPptxComponentSchemas,
|
|
3
3
|
createAllPptxComponentSchemasNarrowed
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZJTUC7DA.js";
|
|
5
5
|
|
|
6
6
|
// src/schemas/component-union.ts
|
|
7
7
|
import { Type } from "@sinclair/typebox";
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
PptxComponentDefinitionSchema,
|
|
26
26
|
PptxSlideContentSchema
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-B7HWVX62.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PptxComponentDefaultsSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7CKCXKN7.js";
|
|
4
4
|
|
|
5
5
|
// src/schemas/theme.ts
|
|
6
6
|
import { Type } from "@sinclair/typebox";
|
|
@@ -155,4 +155,4 @@ export {
|
|
|
155
155
|
STYLE_NAMES2 as STYLE_NAMES,
|
|
156
156
|
StyleNameSchema
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
158
|
+
//# sourceMappingURL=chunk-M5PJJLWM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PptxComponentDefinitionSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B7HWVX62.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-
|
|
21
|
+
//# sourceMappingURL=chunk-X2MWLKFW.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ColorValueSchema,
|
|
3
3
|
GridConfigSchema,
|
|
4
4
|
ThemeConfigSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M5PJJLWM.js";
|
|
6
6
|
import {
|
|
7
7
|
PptxChartPropsSchema,
|
|
8
8
|
PptxComponentDefaultsSchema,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
PptxTablePropsSchema,
|
|
12
12
|
ShapePropsSchema,
|
|
13
13
|
TextPropsSchema
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7CKCXKN7.js";
|
|
15
15
|
|
|
16
16
|
// src/schemas/component-registry.ts
|
|
17
17
|
import { Type as Type5 } from "@sinclair/typebox";
|
|
@@ -25,7 +25,10 @@ import { Type as Type2 } from "@sinclair/typebox";
|
|
|
25
25
|
|
|
26
26
|
// src/schemas/components/common.ts
|
|
27
27
|
import { Type } from "@sinclair/typebox";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
ColorValueSchema as ColorValueSchema2,
|
|
30
|
+
GradientFillSchema
|
|
31
|
+
} from "@json-to-office/shared/schemas/slide-content";
|
|
29
32
|
import {
|
|
30
33
|
PptxAlignmentSchema,
|
|
31
34
|
VerticalAlignmentSchema,
|
|
@@ -79,6 +82,7 @@ var PositionSchema = Type.Object(
|
|
|
79
82
|
var SlideBackgroundSchema = Type.Object(
|
|
80
83
|
{
|
|
81
84
|
color: Type.Optional(ColorValueSchema2),
|
|
85
|
+
gradient: Type.Optional(GradientFillSchema),
|
|
82
86
|
image: Type.Optional(
|
|
83
87
|
Type.Object(
|
|
84
88
|
{
|
|
@@ -463,4 +467,4 @@ export {
|
|
|
463
467
|
createAllPptxComponentSchemas,
|
|
464
468
|
createAllPptxComponentSchemasNarrowed
|
|
465
469
|
};
|
|
466
|
-
//# sourceMappingURL=chunk-
|
|
470
|
+
//# sourceMappingURL=chunk-ZJTUC7DA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/component-registry.ts","../src/schemas/components/presentation.ts","../src/schemas/components/template.ts","../src/schemas/components/common.ts","../src/schemas/components/slide.ts"],"sourcesContent":["/**\n * PPTX Component Registry - SINGLE SOURCE OF TRUTH\n *\n * This is the ONLY place where standard PPTX components are defined.\n * All schema generators MUST use this registry.\n */\n\nimport { Type, TSchema } from '@sinclair/typebox';\nimport { PPTX_SLIDE_CONTENT_COMPONENTS } from '@json-to-office/shared/schemas/slide-content';\n\n/**\n * Component definition with metadata\n */\nexport interface PptxStandardComponentDefinition {\n name: string;\n propsSchema: TSchema;\n hasChildren: boolean;\n /**\n * Names of standard components allowed as direct children.\n * Only meaningful when hasChildren is true.\n * Plugin components are always allowed in addition to these.\n * Omit to allow the full recursive union (backward-compat).\n */\n allowedChildren?: readonly string[];\n hasPlaceholders?: boolean;\n category: 'container' | 'content' | 'layout';\n description: string;\n special?: {\n hasSchemaField?: boolean;\n };\n}\nimport { PresentationPropsSchema } from './components/presentation';\nimport { SlidePropsSchema } from './components/slide';\n\n/**\n * SINGLE SOURCE OF TRUTH for all standard PPTX components\n */\nexport const PPTX_STANDARD_COMPONENTS_REGISTRY: readonly PptxStandardComponentDefinition[] =\n [\n // ========================================================================\n // Container Components (can contain children)\n // ========================================================================\n {\n name: 'pptx',\n propsSchema: PresentationPropsSchema,\n hasChildren: true,\n allowedChildren: ['slide'],\n category: 'container',\n description:\n 'Main presentation container - defines the overall presentation structure. Required as the root component.',\n special: {\n hasSchemaField: true,\n },\n },\n {\n name: 'slide',\n propsSchema: SlidePropsSchema,\n hasChildren: true,\n allowedChildren: PPTX_SLIDE_CONTENT_COMPONENTS.map(({ name }) => name),\n hasPlaceholders: true,\n category: 'container',\n description:\n 'Slide container - groups content elements on a single slide.',\n },\n\n // Content components are canonical in @json-to-office/shared so DOCX\n // visuals can reuse the exact schemas without depending on shared-pptx.\n ...PPTX_SLIDE_CONTENT_COMPONENTS,\n ] as const;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\nexport function getPptxStandardComponent(\n name: string\n): PptxStandardComponentDefinition | undefined {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.find((c) => c.name === name);\n}\n\nexport function getAllPptxComponentNames(): readonly string[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.map((c) => c.name);\n}\n\nexport function getPptxComponentsByCategory(\n category: PptxStandardComponentDefinition['category']\n): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter(\n (c) => c.category === category\n );\n}\n\nexport function getPptxContainerComponents(): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) => c.hasChildren);\n}\n\nexport function getPptxContentComponents(): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) => !c.hasChildren);\n}\n\nexport function isPptxStandardComponent(name: string): boolean {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.some((c) => c.name === name);\n}\n\n// ============================================================================\n// Schema Generation Helpers\n// ============================================================================\n\nexport function createPptxComponentSchemaObject(\n component: PptxStandardComponentDefinition,\n recursiveRef?: TSchema,\n placeholderRef?: TSchema\n): TSchema {\n const schema: Record<string, TSchema> = {\n name: Type.Literal(component.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 };\n\n if (component.special?.hasSchemaField) {\n schema.$schema = Type.Optional(Type.String({ format: 'uri' }));\n }\n\n schema.props = component.propsSchema;\n\n if (component.hasChildren && recursiveRef) {\n schema.children = Type.Optional(Type.Array(recursiveRef));\n }\n\n if (component.hasPlaceholders && (placeholderRef ?? recursiveRef)) {\n const baseProperties = (component.propsSchema as any).properties ?? {};\n const phRef = placeholderRef ?? recursiveRef!;\n schema.props = Type.Object(\n {\n ...baseProperties,\n placeholders: Type.Optional(\n Type.Record(Type.String(), phRef, {\n description:\n 'Content for named placeholders: { \"title\": { \"name\": \"text\", ... } }',\n })\n ),\n },\n {\n additionalProperties: false,\n description: (component.propsSchema as any).description,\n }\n );\n }\n\n return Type.Object(schema, { additionalProperties: false });\n}\n\nexport function createAllPptxComponentSchemas(\n recursiveRef?: TSchema\n): readonly TSchema[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.map((component) =>\n createPptxComponentSchemaObject(component, recursiveRef)\n );\n}\n\n/**\n * Build all standard PPTX component schemas with per-container narrowed children.\n *\n * Resolves containers in dependency order so each container's children union\n * only references its allowedChildren. Plugin schemas are always included in\n * every container's children.\n *\n * @param selfRef - The Type.Recursive self-reference (fallback and for plugin children)\n * @param pluginSchemas - Plugin component schemas (always allowed in all containers)\n * @returns Array of TypeBox schemas with narrowed children per container\n */\nexport function createAllPptxComponentSchemasNarrowed(\n selfRef: TSchema,\n pluginSchemas: TSchema[] = []\n): TSchema[] {\n // Phase 1: Build leaf (non-container) component schemas — no children\n const leafSchemas = new Map<string, TSchema>();\n for (const comp of PPTX_STANDARD_COMPONENTS_REGISTRY) {\n if (!comp.hasChildren) {\n leafSchemas.set(\n comp.name,\n createPptxComponentSchemaObject(comp, undefined, selfRef)\n );\n }\n }\n\n // Phase 2: Resolve containers in dependency order\n const containers = PPTX_STANDARD_COMPONENTS_REGISTRY.filter(\n (c) => c.hasChildren\n );\n const resolved = new Map<string, TSchema>();\n const pending = [...containers];\n\n while (pending.length > 0) {\n const before = pending.length;\n for (let i = pending.length - 1; i >= 0; i--) {\n const comp = pending[i];\n\n if (!comp.allowedChildren) {\n // No allowedChildren declared — fallback to full recursive ref\n resolved.set(\n comp.name,\n createPptxComponentSchemaObject(comp, selfRef, selfRef)\n );\n pending.splice(i, 1);\n continue;\n }\n\n // Check if all container dependencies are resolved\n const containerDeps = comp.allowedChildren.filter((name) =>\n containers.some((c) => c.name === name)\n );\n if (!containerDeps.every((d) => resolved.has(d))) continue;\n\n // Build narrowed children union\n const childSchemas = comp.allowedChildren\n .map((name) => resolved.get(name) ?? leafSchemas.get(name))\n .filter((s): s is TSchema => s !== undefined);\n\n const allChildSchemas = [...childSchemas, ...pluginSchemas];\n const childrenType =\n allChildSchemas.length === 1\n ? allChildSchemas[0]\n : Type.Union(allChildSchemas);\n\n resolved.set(\n comp.name,\n createPptxComponentSchemaObject(comp, childrenType, selfRef)\n );\n pending.splice(i, 1);\n }\n\n if (pending.length === before) {\n throw new Error(\n `Circular allowedChildren among: ${pending.map((c) => c.name).join(', ')}`\n );\n }\n }\n\n // Combine: containers (resolved) + leaves\n return [...resolved.values(), ...leafSchemas.values()];\n}\n","/**\n * Presentation Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { TemplateSlideDefinitionSchema } from './template';\nimport { GridConfigSchema, ThemeConfigSchema } from '../theme';\nimport { PptxComponentDefaultsSchema } from '../component-defaults';\n\nexport const PresentationPropsSchema = Type.Object(\n {\n title: Type.Optional(\n Type.String({ description: 'Presentation title metadata' })\n ),\n author: Type.Optional(\n Type.String({ description: 'Presentation author metadata' })\n ),\n subject: Type.Optional(\n Type.String({ description: 'Presentation subject metadata' })\n ),\n company: Type.Optional(\n Type.String({ description: 'Company name metadata' })\n ),\n theme: Type.Optional(\n Type.Union(\n [\n Type.String({\n description: 'Theme name to apply (default: \"default\")',\n default: 'default',\n }),\n ThemeConfigSchema,\n ],\n {\n description:\n 'Theme to apply: a built-in/custom theme name (default: ' +\n '\"default\"), or an inline theme config object so the document ' +\n 'stays self-contained',\n }\n )\n ),\n slideWidth: Type.Optional(\n Type.Number({\n description: 'Slide width in inches (default: 10)',\n default: 10,\n })\n ),\n slideHeight: Type.Optional(\n Type.Number({\n description: 'Slide height in inches (default: 7.5)',\n default: 7.5,\n })\n ),\n rtlMode: Type.Optional(\n Type.Boolean({ description: 'Right-to-left text direction' })\n ),\n language: Type.Optional(\n Type.String({\n pattern: '^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$',\n description:\n 'Default presentation language (BCP-47 tag, e.g. \"en-US\"). Sets the spell-check language for all text; individual text components can override it.',\n examples: ['en-US', 'fr-FR', 'de-DE', 'it-IT', 'es-ES'],\n })\n ),\n pageNumberFormat: Type.Optional(\n Type.Union([Type.Literal('9'), Type.Literal('09')], {\n description:\n 'Format for {PAGE_NUMBER} placeholders: \"9\" = bare number (default), \"09\" = zero-padded',\n default: '9',\n })\n ),\n componentDefaults: Type.Optional(PptxComponentDefaultsSchema),\n grid: Type.Optional(GridConfigSchema),\n templates: Type.Optional(\n Type.Array(TemplateSlideDefinitionSchema, {\n description: 'Template slide definitions (reusable slide templates)',\n })\n ),\n },\n {\n description: 'Presentation container props',\n additionalProperties: false,\n }\n);\n\nexport type PresentationProps = Static<typeof PresentationPropsSchema>;\n","/**\n * Template Slide Definition Schemas\n */\n\nimport { Type, Static, TSchema } from '@sinclair/typebox';\nimport { SlideBackgroundSchema, GridPositionSchema } from './common';\nimport { ColorValueSchema, GridConfigSchema } from '../theme';\nimport { TextPropsSchema } from './text';\nimport { PptxImagePropsSchema } from './image';\nimport { ShapePropsSchema } from './shape';\nimport { PptxTablePropsSchema } from './table';\nimport { PptxChartPropsSchema } from './chart';\nimport { PptxHighchartsPropsSchema } from './highcharts';\n\n// Position helpers (number in inches OR percentage string e.g. \"50%\")\nconst Coord = Type.Union([\n Type.Number({ description: 'Position/size in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Position/size as percentage of slide dimension (e.g., \"50%\")',\n }),\n]);\n\n// Helper: wrap a props schema into { name, props } component format\nfunction contentComponent(name: string, propsSchema: TSchema) {\n return Type.Object({\n name: Type.Literal(name),\n id: Type.Optional(Type.String()),\n enabled: Type.Optional(Type.Boolean({\n default: true,\n description: 'When false, this component is filtered out and not rendered. Defaults to true.',\n })),\n props: propsSchema,\n }, { additionalProperties: false });\n}\n\n// Content component union — same { name, props } format as slide children\nconst TemplateObjectComponentSchema = Type.Union([\n contentComponent('text', TextPropsSchema),\n contentComponent('image', PptxImagePropsSchema),\n contentComponent('shape', ShapePropsSchema),\n contentComponent('table', PptxTablePropsSchema),\n contentComponent('chart', PptxChartPropsSchema),\n contentComponent('highcharts', PptxHighchartsPropsSchema),\n], {\n discriminator: { propertyName: 'name' },\n description: 'Fixed component on a template slide (same format as slide children)',\n});\n\n// Defaults schema — partial component stub (carries styling props, not content)\n// Discriminated union so Monaco can autocomplete prop names per component type\nfunction defaultsComponent(name: string, propsSchema: TSchema) {\n return Type.Object({\n name: Type.Literal(name),\n props: Type.Partial(propsSchema, { description: 'Default props inherited by the component placed in this placeholder' }),\n }, { additionalProperties: false });\n}\n\nconst PlaceholderDefaultsSchema = Type.Union([\n defaultsComponent('text', TextPropsSchema),\n defaultsComponent('image', PptxImagePropsSchema),\n defaultsComponent('shape', ShapePropsSchema),\n defaultsComponent('table', PptxTablePropsSchema),\n defaultsComponent('chart', PptxChartPropsSchema),\n defaultsComponent('highcharts', PptxHighchartsPropsSchema),\n], {\n discriminator: { propertyName: 'name' },\n description: 'Partial component stub — styling defaults only',\n});\n\n// Placeholder definition\nexport const PlaceholderDefinitionSchema = Type.Object({\n name: Type.String({ description: 'Unique placeholder name' }),\n x: Type.Optional(Coord),\n y: Type.Optional(Coord),\n w: Type.Optional(Coord),\n h: Type.Optional(Coord),\n grid: Type.Optional(GridPositionSchema),\n defaults: Type.Optional(PlaceholderDefaultsSchema),\n}, { additionalProperties: false, description: 'Placeholder on a template slide — defaults is a component stub whose props are inherited by the actual component' });\n\n// Template slide definition\nexport const TemplateSlideDefinitionSchema = Type.Object({\n name: Type.String({ description: 'Unique template slide name' }),\n background: Type.Optional(SlideBackgroundSchema),\n margin: Type.Optional(Type.Union([\n Type.Number({ description: 'Margin in inches (all sides)' }),\n Type.Array(Type.Number(), { minItems: 4, maxItems: 4, description: 'Margin [top, right, bottom, left] in inches' }),\n ])),\n slideNumber: Type.Optional(Type.Object({\n x: Coord, y: Coord,\n w: Type.Optional(Coord),\n h: Type.Optional(Coord),\n color: Type.Optional(ColorValueSchema),\n fontSize: Type.Optional(Type.Number({ description: 'Slide number font size in points' })),\n }, { additionalProperties: false, description: 'Slide number position and styling' })),\n objects: Type.Optional(Type.Array(TemplateObjectComponentSchema, { description: 'Fixed components (logos, footers, decorations) — same { name, props } format as slide children' })),\n placeholders: Type.Optional(Type.Array(PlaceholderDefinitionSchema, { description: 'Placeholder regions for slide content' })),\n grid: Type.Optional(GridConfigSchema),\n}, { additionalProperties: false, description: 'Template slide definition (reusable slide template)' });\n\nexport type PlaceholderDefinition = Static<typeof PlaceholderDefinitionSchema>;\nexport type TemplateSlideDefinition = Static<typeof TemplateSlideDefinitionSchema>;\n","/**\n * Common Types and Schemas for PPTX Components\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { ColorValueSchema } from '@json-to-office/shared/schemas/slide-content';\n\nexport {\n PptxAlignmentSchema,\n VerticalAlignmentSchema,\n ShadowSchema,\n GridPositionSchema,\n} from '@json-to-office/shared/schemas/slide-content';\n\nexport type {\n PptxAlignment,\n VerticalAlignment,\n Shadow,\n GridPosition,\n} from '@json-to-office/shared/schemas/slide-content';\n\nexport const PositionSchema = Type.Object(\n {\n x: Type.Optional(\n Type.Union([\n Type.Number({ description: 'X position in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'X position as percentage (e.g., \"10%\")',\n }),\n ])\n ),\n y: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Y position in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Y position as percentage (e.g., \"10%\")',\n }),\n ])\n ),\n w: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Width in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Width as percentage (e.g., \"80%\")',\n }),\n ])\n ),\n h: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Height in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Height as percentage (e.g., \"20%\")',\n }),\n ])\n ),\n },\n {\n description: 'Position and size in inches or percentages',\n additionalProperties: false,\n }\n);\n\nexport const SlideBackgroundSchema = Type.Object(\n {\n color: Type.Optional(ColorValueSchema),\n image: Type.Optional(\n Type.Object(\n {\n path: Type.Optional(\n Type.String({ description: 'Image file path or URL' })\n ),\n base64: Type.Optional(\n Type.String({ description: 'Base64-encoded image data' })\n ),\n },\n { description: 'Background image', additionalProperties: false }\n )\n ),\n },\n {\n description: 'Slide background configuration',\n additionalProperties: false,\n }\n);\n\nexport const TransitionSchema = Type.Object(\n {\n type: Type.Optional(\n Type.Union(\n [\n Type.Literal('fade'),\n Type.Literal('push'),\n Type.Literal('wipe'),\n Type.Literal('zoom'),\n Type.Literal('none'),\n ],\n { description: 'Transition effect type' }\n )\n ),\n speed: Type.Optional(\n Type.Union(\n [Type.Literal('slow'), Type.Literal('medium'), Type.Literal('fast')],\n { description: 'Transition speed' }\n )\n ),\n },\n {\n description: 'Slide transition configuration',\n additionalProperties: false,\n }\n);\n\nexport type Position = Static<typeof PositionSchema>;\nexport type SlideBackground = Static<typeof SlideBackgroundSchema>;\nexport type Transition = Static<typeof TransitionSchema>;\n","/**\n * Slide Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { SlideBackgroundSchema, TransitionSchema } from './common';\n\nexport const SlidePropsSchema = Type.Object(\n {\n background: Type.Optional(SlideBackgroundSchema),\n transition: Type.Optional(TransitionSchema),\n notes: Type.Optional(\n Type.String({ description: 'Speaker notes for this slide' })\n ),\n layout: Type.Optional(\n Type.String({\n description: 'Slide layout name (e.g., \"Title Slide\", \"Blank\")',\n })\n ),\n hidden: Type.Optional(\n Type.Boolean({ description: 'Hide this slide from presentation' })\n ),\n template: Type.Optional(\n Type.String({ description: 'Template slide name to apply' })\n ),\n // Note: `placeholders` is added dynamically by the component registry\n // with the recursive component ref, to avoid circular imports.\n },\n {\n description: 'Slide container props',\n additionalProperties: false,\n }\n);\n\nexport type SlideProps = Static<typeof SlidePropsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;AAOA,SAAS,QAAAA,aAAqB;AAC9B,SAAS,qCAAqC;;;ACJ9C,SAAS,QAAAC,aAAoB;;;ACA7B,SAAS,QAAAC,aAA6B;;;ACAtC,SAAS,YAAoB;AAC7B,SAAS,oBAAAC,yBAAwB;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASA,IAAM,iBAAiB,K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A,MAAK,MAAM,eAAe;AAEhC,eAAS;AAAA,QACP,KAAK;AAAA,QACL,gCAAgC,MAAM,cAAc,OAAO;AAAA,MAC7D;AACA,cAAQ,OAAO,GAAG,CAAC;AAAA,IACrB;AAEA,QAAI,QAAQ,WAAW,QAAQ;AAC7B,YAAM,IAAI;AAAA,QACR,mCAAmC,QAAQ,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAAA,MAC1E;AAAA,IACF;AAAA,EACF;AAGA,SAAO,CAAC,GAAG,SAAS,OAAO,GAAG,GAAG,YAAY,OAAO,CAAC;AACvD;","names":["Type","Type","Type","ColorValueSchema","Type","Type","Type","Type","Type"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/component-registry.ts","../src/schemas/components/presentation.ts","../src/schemas/components/template.ts","../src/schemas/components/common.ts","../src/schemas/components/slide.ts"],"sourcesContent":["/**\n * PPTX Component Registry - SINGLE SOURCE OF TRUTH\n *\n * This is the ONLY place where standard PPTX components are defined.\n * All schema generators MUST use this registry.\n */\n\nimport { Type, TSchema } from '@sinclair/typebox';\nimport { PPTX_SLIDE_CONTENT_COMPONENTS } from '@json-to-office/shared/schemas/slide-content';\n\n/**\n * Component definition with metadata\n */\nexport interface PptxStandardComponentDefinition {\n name: string;\n propsSchema: TSchema;\n hasChildren: boolean;\n /**\n * Names of standard components allowed as direct children.\n * Only meaningful when hasChildren is true.\n * Plugin components are always allowed in addition to these.\n * Omit to allow the full recursive union (backward-compat).\n */\n allowedChildren?: readonly string[];\n hasPlaceholders?: boolean;\n category: 'container' | 'content' | 'layout';\n description: string;\n special?: {\n hasSchemaField?: boolean;\n };\n}\nimport { PresentationPropsSchema } from './components/presentation';\nimport { SlidePropsSchema } from './components/slide';\n\n/**\n * SINGLE SOURCE OF TRUTH for all standard PPTX components\n */\nexport const PPTX_STANDARD_COMPONENTS_REGISTRY: readonly PptxStandardComponentDefinition[] =\n [\n // ========================================================================\n // Container Components (can contain children)\n // ========================================================================\n {\n name: 'pptx',\n propsSchema: PresentationPropsSchema,\n hasChildren: true,\n allowedChildren: ['slide'],\n category: 'container',\n description:\n 'Main presentation container - defines the overall presentation structure. Required as the root component.',\n special: {\n hasSchemaField: true,\n },\n },\n {\n name: 'slide',\n propsSchema: SlidePropsSchema,\n hasChildren: true,\n allowedChildren: PPTX_SLIDE_CONTENT_COMPONENTS.map(({ name }) => name),\n hasPlaceholders: true,\n category: 'container',\n description:\n 'Slide container - groups content elements on a single slide.',\n },\n\n // Content components are canonical in @json-to-office/shared so DOCX\n // visuals can reuse the exact schemas without depending on shared-pptx.\n ...PPTX_SLIDE_CONTENT_COMPONENTS,\n ] as const;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\nexport function getPptxStandardComponent(\n name: string\n): PptxStandardComponentDefinition | undefined {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.find((c) => c.name === name);\n}\n\nexport function getAllPptxComponentNames(): readonly string[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.map((c) => c.name);\n}\n\nexport function getPptxComponentsByCategory(\n category: PptxStandardComponentDefinition['category']\n): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter(\n (c) => c.category === category\n );\n}\n\nexport function getPptxContainerComponents(): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) => c.hasChildren);\n}\n\nexport function getPptxContentComponents(): readonly PptxStandardComponentDefinition[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) => !c.hasChildren);\n}\n\nexport function isPptxStandardComponent(name: string): boolean {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.some((c) => c.name === name);\n}\n\n// ============================================================================\n// Schema Generation Helpers\n// ============================================================================\n\nexport function createPptxComponentSchemaObject(\n component: PptxStandardComponentDefinition,\n recursiveRef?: TSchema,\n placeholderRef?: TSchema\n): TSchema {\n const schema: Record<string, TSchema> = {\n name: Type.Literal(component.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 };\n\n if (component.special?.hasSchemaField) {\n schema.$schema = Type.Optional(Type.String({ format: 'uri' }));\n }\n\n schema.props = component.propsSchema;\n\n if (component.hasChildren && recursiveRef) {\n schema.children = Type.Optional(Type.Array(recursiveRef));\n }\n\n if (component.hasPlaceholders && (placeholderRef ?? recursiveRef)) {\n const baseProperties = (component.propsSchema as any).properties ?? {};\n const phRef = placeholderRef ?? recursiveRef!;\n schema.props = Type.Object(\n {\n ...baseProperties,\n placeholders: Type.Optional(\n Type.Record(Type.String(), phRef, {\n description:\n 'Content for named placeholders: { \"title\": { \"name\": \"text\", ... } }',\n })\n ),\n },\n {\n additionalProperties: false,\n description: (component.propsSchema as any).description,\n }\n );\n }\n\n return Type.Object(schema, { additionalProperties: false });\n}\n\nexport function createAllPptxComponentSchemas(\n recursiveRef?: TSchema\n): readonly TSchema[] {\n return PPTX_STANDARD_COMPONENTS_REGISTRY.map((component) =>\n createPptxComponentSchemaObject(component, recursiveRef)\n );\n}\n\n/**\n * Build all standard PPTX component schemas with per-container narrowed children.\n *\n * Resolves containers in dependency order so each container's children union\n * only references its allowedChildren. Plugin schemas are always included in\n * every container's children.\n *\n * @param selfRef - The Type.Recursive self-reference (fallback and for plugin children)\n * @param pluginSchemas - Plugin component schemas (always allowed in all containers)\n * @returns Array of TypeBox schemas with narrowed children per container\n */\nexport function createAllPptxComponentSchemasNarrowed(\n selfRef: TSchema,\n pluginSchemas: TSchema[] = []\n): TSchema[] {\n // Phase 1: Build leaf (non-container) component schemas — no children\n const leafSchemas = new Map<string, TSchema>();\n for (const comp of PPTX_STANDARD_COMPONENTS_REGISTRY) {\n if (!comp.hasChildren) {\n leafSchemas.set(\n comp.name,\n createPptxComponentSchemaObject(comp, undefined, selfRef)\n );\n }\n }\n\n // Phase 2: Resolve containers in dependency order\n const containers = PPTX_STANDARD_COMPONENTS_REGISTRY.filter(\n (c) => c.hasChildren\n );\n const resolved = new Map<string, TSchema>();\n const pending = [...containers];\n\n while (pending.length > 0) {\n const before = pending.length;\n for (let i = pending.length - 1; i >= 0; i--) {\n const comp = pending[i];\n\n if (!comp.allowedChildren) {\n // No allowedChildren declared — fallback to full recursive ref\n resolved.set(\n comp.name,\n createPptxComponentSchemaObject(comp, selfRef, selfRef)\n );\n pending.splice(i, 1);\n continue;\n }\n\n // Check if all container dependencies are resolved\n const containerDeps = comp.allowedChildren.filter((name) =>\n containers.some((c) => c.name === name)\n );\n if (!containerDeps.every((d) => resolved.has(d))) continue;\n\n // Build narrowed children union\n const childSchemas = comp.allowedChildren\n .map((name) => resolved.get(name) ?? leafSchemas.get(name))\n .filter((s): s is TSchema => s !== undefined);\n\n const allChildSchemas = [...childSchemas, ...pluginSchemas];\n const childrenType =\n allChildSchemas.length === 1\n ? allChildSchemas[0]\n : Type.Union(allChildSchemas);\n\n resolved.set(\n comp.name,\n createPptxComponentSchemaObject(comp, childrenType, selfRef)\n );\n pending.splice(i, 1);\n }\n\n if (pending.length === before) {\n throw new Error(\n `Circular allowedChildren among: ${pending.map((c) => c.name).join(', ')}`\n );\n }\n }\n\n // Combine: containers (resolved) + leaves\n return [...resolved.values(), ...leafSchemas.values()];\n}\n","/**\n * Presentation Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { TemplateSlideDefinitionSchema } from './template';\nimport { GridConfigSchema, ThemeConfigSchema } from '../theme';\nimport { PptxComponentDefaultsSchema } from '../component-defaults';\n\nexport const PresentationPropsSchema = Type.Object(\n {\n title: Type.Optional(\n Type.String({ description: 'Presentation title metadata' })\n ),\n author: Type.Optional(\n Type.String({ description: 'Presentation author metadata' })\n ),\n subject: Type.Optional(\n Type.String({ description: 'Presentation subject metadata' })\n ),\n company: Type.Optional(\n Type.String({ description: 'Company name metadata' })\n ),\n theme: Type.Optional(\n Type.Union(\n [\n Type.String({\n description: 'Theme name to apply (default: \"default\")',\n default: 'default',\n }),\n ThemeConfigSchema,\n ],\n {\n description:\n 'Theme to apply: a built-in/custom theme name (default: ' +\n '\"default\"), or an inline theme config object so the document ' +\n 'stays self-contained',\n }\n )\n ),\n slideWidth: Type.Optional(\n Type.Number({\n description: 'Slide width in inches (default: 10)',\n default: 10,\n })\n ),\n slideHeight: Type.Optional(\n Type.Number({\n description: 'Slide height in inches (default: 7.5)',\n default: 7.5,\n })\n ),\n rtlMode: Type.Optional(\n Type.Boolean({ description: 'Right-to-left text direction' })\n ),\n language: Type.Optional(\n Type.String({\n pattern: '^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$',\n description:\n 'Default presentation language (BCP-47 tag, e.g. \"en-US\"). Sets the spell-check language for all text; individual text components can override it.',\n examples: ['en-US', 'fr-FR', 'de-DE', 'it-IT', 'es-ES'],\n })\n ),\n pageNumberFormat: Type.Optional(\n Type.Union([Type.Literal('9'), Type.Literal('09')], {\n description:\n 'Format for {PAGE_NUMBER} placeholders: \"9\" = bare number (default), \"09\" = zero-padded',\n default: '9',\n })\n ),\n componentDefaults: Type.Optional(PptxComponentDefaultsSchema),\n grid: Type.Optional(GridConfigSchema),\n templates: Type.Optional(\n Type.Array(TemplateSlideDefinitionSchema, {\n description: 'Template slide definitions (reusable slide templates)',\n })\n ),\n },\n {\n description: 'Presentation container props',\n additionalProperties: false,\n }\n);\n\nexport type PresentationProps = Static<typeof PresentationPropsSchema>;\n","/**\n * Template Slide Definition Schemas\n */\n\nimport { Type, Static, TSchema } from '@sinclair/typebox';\nimport { SlideBackgroundSchema, GridPositionSchema } from './common';\nimport { ColorValueSchema, GridConfigSchema } from '../theme';\nimport { TextPropsSchema } from './text';\nimport { PptxImagePropsSchema } from './image';\nimport { ShapePropsSchema } from './shape';\nimport { PptxTablePropsSchema } from './table';\nimport { PptxChartPropsSchema } from './chart';\nimport { PptxHighchartsPropsSchema } from './highcharts';\n\n// Position helpers (number in inches OR percentage string e.g. \"50%\")\nconst Coord = Type.Union([\n Type.Number({ description: 'Position/size in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Position/size as percentage of slide dimension (e.g., \"50%\")',\n }),\n]);\n\n// Helper: wrap a props schema into { name, props } component format\nfunction contentComponent(name: string, propsSchema: TSchema) {\n return Type.Object({\n name: Type.Literal(name),\n id: Type.Optional(Type.String()),\n enabled: Type.Optional(Type.Boolean({\n default: true,\n description: 'When false, this component is filtered out and not rendered. Defaults to true.',\n })),\n props: propsSchema,\n }, { additionalProperties: false });\n}\n\n// Content component union — same { name, props } format as slide children\nconst TemplateObjectComponentSchema = Type.Union([\n contentComponent('text', TextPropsSchema),\n contentComponent('image', PptxImagePropsSchema),\n contentComponent('shape', ShapePropsSchema),\n contentComponent('table', PptxTablePropsSchema),\n contentComponent('chart', PptxChartPropsSchema),\n contentComponent('highcharts', PptxHighchartsPropsSchema),\n], {\n discriminator: { propertyName: 'name' },\n description: 'Fixed component on a template slide (same format as slide children)',\n});\n\n// Defaults schema — partial component stub (carries styling props, not content)\n// Discriminated union so Monaco can autocomplete prop names per component type\nfunction defaultsComponent(name: string, propsSchema: TSchema) {\n return Type.Object({\n name: Type.Literal(name),\n props: Type.Partial(propsSchema, { description: 'Default props inherited by the component placed in this placeholder' }),\n }, { additionalProperties: false });\n}\n\nconst PlaceholderDefaultsSchema = Type.Union([\n defaultsComponent('text', TextPropsSchema),\n defaultsComponent('image', PptxImagePropsSchema),\n defaultsComponent('shape', ShapePropsSchema),\n defaultsComponent('table', PptxTablePropsSchema),\n defaultsComponent('chart', PptxChartPropsSchema),\n defaultsComponent('highcharts', PptxHighchartsPropsSchema),\n], {\n discriminator: { propertyName: 'name' },\n description: 'Partial component stub — styling defaults only',\n});\n\n// Placeholder definition\nexport const PlaceholderDefinitionSchema = Type.Object({\n name: Type.String({ description: 'Unique placeholder name' }),\n x: Type.Optional(Coord),\n y: Type.Optional(Coord),\n w: Type.Optional(Coord),\n h: Type.Optional(Coord),\n grid: Type.Optional(GridPositionSchema),\n defaults: Type.Optional(PlaceholderDefaultsSchema),\n}, { additionalProperties: false, description: 'Placeholder on a template slide — defaults is a component stub whose props are inherited by the actual component' });\n\n// Template slide definition\nexport const TemplateSlideDefinitionSchema = Type.Object({\n name: Type.String({ description: 'Unique template slide name' }),\n background: Type.Optional(SlideBackgroundSchema),\n margin: Type.Optional(Type.Union([\n Type.Number({ description: 'Margin in inches (all sides)' }),\n Type.Array(Type.Number(), { minItems: 4, maxItems: 4, description: 'Margin [top, right, bottom, left] in inches' }),\n ])),\n slideNumber: Type.Optional(Type.Object({\n x: Coord, y: Coord,\n w: Type.Optional(Coord),\n h: Type.Optional(Coord),\n color: Type.Optional(ColorValueSchema),\n fontSize: Type.Optional(Type.Number({ description: 'Slide number font size in points' })),\n }, { additionalProperties: false, description: 'Slide number position and styling' })),\n objects: Type.Optional(Type.Array(TemplateObjectComponentSchema, { description: 'Fixed components (logos, footers, decorations) — same { name, props } format as slide children' })),\n placeholders: Type.Optional(Type.Array(PlaceholderDefinitionSchema, { description: 'Placeholder regions for slide content' })),\n grid: Type.Optional(GridConfigSchema),\n}, { additionalProperties: false, description: 'Template slide definition (reusable slide template)' });\n\nexport type PlaceholderDefinition = Static<typeof PlaceholderDefinitionSchema>;\nexport type TemplateSlideDefinition = Static<typeof TemplateSlideDefinitionSchema>;\n","/**\n * Common Types and Schemas for PPTX Components\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport {\n ColorValueSchema,\n GradientFillSchema,\n} from '@json-to-office/shared/schemas/slide-content';\n\nexport {\n PptxAlignmentSchema,\n VerticalAlignmentSchema,\n ShadowSchema,\n GridPositionSchema,\n} from '@json-to-office/shared/schemas/slide-content';\n\nexport type {\n PptxAlignment,\n VerticalAlignment,\n Shadow,\n GridPosition,\n} from '@json-to-office/shared/schemas/slide-content';\n\nexport const PositionSchema = Type.Object(\n {\n x: Type.Optional(\n Type.Union([\n Type.Number({ description: 'X position in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'X position as percentage (e.g., \"10%\")',\n }),\n ])\n ),\n y: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Y position in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Y position as percentage (e.g., \"10%\")',\n }),\n ])\n ),\n w: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Width in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Width as percentage (e.g., \"80%\")',\n }),\n ])\n ),\n h: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Height in inches' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Height as percentage (e.g., \"20%\")',\n }),\n ])\n ),\n },\n {\n description: 'Position and size in inches or percentages',\n additionalProperties: false,\n }\n);\n\nexport const SlideBackgroundSchema = Type.Object(\n {\n color: Type.Optional(ColorValueSchema),\n gradient: Type.Optional(GradientFillSchema),\n image: Type.Optional(\n Type.Object(\n {\n path: Type.Optional(\n Type.String({ description: 'Image file path or URL' })\n ),\n base64: Type.Optional(\n Type.String({ description: 'Base64-encoded image data' })\n ),\n },\n { description: 'Background image', additionalProperties: false }\n )\n ),\n },\n {\n description: 'Slide background configuration',\n additionalProperties: false,\n }\n);\n\nexport const TransitionSchema = Type.Object(\n {\n type: Type.Optional(\n Type.Union(\n [\n Type.Literal('fade'),\n Type.Literal('push'),\n Type.Literal('wipe'),\n Type.Literal('zoom'),\n Type.Literal('none'),\n ],\n { description: 'Transition effect type' }\n )\n ),\n speed: Type.Optional(\n Type.Union(\n [Type.Literal('slow'), Type.Literal('medium'), Type.Literal('fast')],\n { description: 'Transition speed' }\n )\n ),\n },\n {\n description: 'Slide transition configuration',\n additionalProperties: false,\n }\n);\n\nexport type Position = Static<typeof PositionSchema>;\nexport type SlideBackground = Static<typeof SlideBackgroundSchema>;\nexport type Transition = Static<typeof TransitionSchema>;\n","/**\n * Slide Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { SlideBackgroundSchema, TransitionSchema } from './common';\n\nexport const SlidePropsSchema = Type.Object(\n {\n background: Type.Optional(SlideBackgroundSchema),\n transition: Type.Optional(TransitionSchema),\n notes: Type.Optional(\n Type.String({ description: 'Speaker notes for this slide' })\n ),\n layout: Type.Optional(\n Type.String({\n description: 'Slide layout name (e.g., \"Title Slide\", \"Blank\")',\n })\n ),\n hidden: Type.Optional(\n Type.Boolean({ description: 'Hide this slide from presentation' })\n ),\n template: Type.Optional(\n Type.String({ description: 'Template slide name to apply' })\n ),\n // Note: `placeholders` is added dynamically by the component registry\n // with the recursive component ref, to avoid circular imports.\n },\n {\n description: 'Slide container props',\n additionalProperties: false,\n }\n);\n\nexport type SlideProps = Static<typeof SlidePropsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;AAOA,SAAS,QAAAA,aAAqB;AAC9B,SAAS,qCAAqC;;;ACJ9C,SAAS,QAAAC,aAAoB;;;ACA7B,SAAS,QAAAC,aAA6B;;;ACAtC,SAAS,YAAoB;AAC7B;AAAA,EACE,oBAAAC;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASA,IAAM,iBAAiB,KAAK;AAAA,EACjC;AAAA,IACE,GAAG,KAAK;AAAA,MACN,KAAK,MAAM;AAAA,QACT,KAAK,OAAO,EAAE,aAAa,uBAAuB,CAAC;AAAA,QACnD,KAAK,OAAO;AAAA,UACV,SAAS;AAAA,UACT,aAAa;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,GAAG,KAAK;AAAA,MACN,KAAK,MAAM;AAAA,QACT,KAAK,OAAO,EAAE,aAAa,uBAAuB,CAAC;AAAA,QACnD,KAAK,OAAO;AAAA,UACV,SAAS;AAAA,UACT,aAAa;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,GAAG,KAAK;AAAA,MACN,KAAK,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","Type","Type","Type","Type"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Position, PositionSchema, PresentationProps, PresentationPropsSchema, SlideBackground, SlideBackgroundSchema, SlideProps, SlidePropsSchema, Transition, TransitionSchema } from './schemas/components.js';
|
|
2
|
-
export { ColorValueSchema, PptxChartProps, PptxChartPropsSchema, PptxHighchartsProps, PptxHighchartsPropsSchema, PptxImageProps, PptxImagePropsSchema, PptxSlideContent, PptxSlideContentSchema, PptxTableProps, PptxTablePropsSchema, SEMANTIC_COLOR_ALIASES, SEMANTIC_COLOR_NAMES, STYLE_NAMES, Shadow, ShadowSchema, ShapeProps, ShapePropsSchema, ShapeType, ShapeTypeSchema, StyleName, StyleNameSchema, TextProps, TextPropsSchema, TextSegment, VerticalAlignment, VerticalAlignmentSchema } from '@json-to-office/shared/schemas/slide-content';
|
|
2
|
+
export { ColorValueSchema, GradientFill, GradientFillSchema, GradientStop, GradientStopSchema, PATTERN_FILL_PRESETS, PatternFill, PatternFillSchema, PptxChartProps, PptxChartPropsSchema, PptxHighchartsProps, PptxHighchartsPropsSchema, PptxImageProps, PptxImagePropsSchema, PptxSlideContent, PptxSlideContentSchema, PptxTableProps, PptxTablePropsSchema, SEMANTIC_COLOR_ALIASES, SEMANTIC_COLOR_NAMES, STYLE_NAMES, Shadow, ShadowSchema, ShapeProps, ShapePropsSchema, ShapeType, ShapeTypeSchema, StyleName, StyleNameSchema, TextProps, TextPropsSchema, TextRun, TextRunSchema, TextSegment, VerticalAlignment, VerticalAlignmentSchema } from '@json-to-office/shared/schemas/slide-content';
|
|
3
3
|
export { PptxComponentDefinition, PptxComponentDefinitionSchema, PptxStandardComponentDefinitionSchema } from './schemas/component-union.js';
|
|
4
4
|
export { PPTX_STANDARD_COMPONENTS_REGISTRY, PptxStandardComponentDefinition, createAllPptxComponentSchemas, createPptxComponentSchemaObject, getAllPptxComponentNames, getPptxComponentsByCategory, getPptxContainerComponents, getPptxContentComponents, getPptxStandardComponent, isPptxStandardComponent } from './schemas/component-registry.js';
|
|
5
5
|
import { PptxJsonComponentDefinition } from './schemas/document.js';
|
|
@@ -44,6 +44,26 @@ declare function presentImageSources(props: unknown): string[];
|
|
|
44
44
|
*/
|
|
45
45
|
declare function collectImageSourceConflicts(data: unknown): ValidationError[];
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Text content conflict detection (PPTX)
|
|
49
|
+
*
|
|
50
|
+
* `text` and `runs` are mutually exclusive on the text component, but both are
|
|
51
|
+
* optional fields on a single object schema — so a payload carrying both (or
|
|
52
|
+
* neither) passes the structural check and would otherwise be silently resolved
|
|
53
|
+
* by runtime precedence. This walk runs unconditionally during validation and
|
|
54
|
+
* rejects such payloads. It traverses every nested value, so text components
|
|
55
|
+
* inside slides, placeholders, and template objects are all covered.
|
|
56
|
+
*
|
|
57
|
+
* Placeholder `defaults` stubs are exempt from the "neither" rule: they carry
|
|
58
|
+
* styling defaults only, and the actual content arrives with the component
|
|
59
|
+
* placed in the placeholder.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Collect `text`/`runs` mutual-exclusivity conflicts anywhere in a presentation.
|
|
64
|
+
*/
|
|
65
|
+
declare function collectTextContentConflicts(data: unknown): ValidationError[];
|
|
66
|
+
|
|
47
67
|
/**
|
|
48
68
|
* Deep validation utilities for collecting ALL errors in nested structures.
|
|
49
69
|
*
|
|
@@ -148,4 +168,4 @@ declare const validateStrict: {
|
|
|
148
168
|
|
|
149
169
|
declare const PPTX_SHARED_VERSION = "1.0.0";
|
|
150
170
|
|
|
151
|
-
export { type DeepValidateOptions, PPTX_SHARED_VERSION, PptxJsonComponentDefinition, type PptxValidationResult, type ReportComponent, collectImageSourceConflicts, comprehensiveValidatePresentation, deepValidatePresentation, presentImageSources, validate, validateJsonPptxTheme, validateJsonPresentationDocument, validatePptxTheme, validatePresentationDocument, validateStrict };
|
|
171
|
+
export { type DeepValidateOptions, PPTX_SHARED_VERSION, PptxJsonComponentDefinition, type PptxValidationResult, type ReportComponent, collectImageSourceConflicts, collectTextContentConflicts, comprehensiveValidatePresentation, deepValidatePresentation, presentImageSources, validate, validateJsonPptxTheme, validateJsonPresentationDocument, validatePptxTheme, validatePresentationDocument, validateStrict };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PPTX_JSON_SCHEMA_URLS,
|
|
3
3
|
PptxJsonComponentDefinitionSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-X2MWLKFW.js";
|
|
5
5
|
import "./chunk-J4OT5Y5B.js";
|
|
6
6
|
import {
|
|
7
7
|
PptxComponentDefinitionSchema,
|
|
8
8
|
PptxSlideContentSchema,
|
|
9
9
|
PptxStandardComponentDefinitionSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-B7HWVX62.js";
|
|
11
11
|
import {
|
|
12
12
|
PPTX_BASE_SCHEMA_METADATA,
|
|
13
13
|
PPTX_COMPONENT_METADATA
|
|
14
14
|
} from "./chunk-RV7W3UXU.js";
|
|
15
15
|
import {
|
|
16
16
|
generateUnifiedDocumentSchema
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7O7XPZXS.js";
|
|
18
18
|
import {
|
|
19
19
|
PPTX_STANDARD_COMPONENTS_REGISTRY,
|
|
20
20
|
PositionSchema,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
getPptxContentComponents,
|
|
33
33
|
getPptxStandardComponent,
|
|
34
34
|
isPptxStandardComponent
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ZJTUC7DA.js";
|
|
36
36
|
import {
|
|
37
37
|
ColorValueSchema,
|
|
38
38
|
SEMANTIC_COLOR_ALIASES,
|
|
@@ -42,11 +42,15 @@ import {
|
|
|
42
42
|
TextStyleSchema,
|
|
43
43
|
ThemeConfigSchema,
|
|
44
44
|
isValidThemeConfig
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-M5PJJLWM.js";
|
|
46
46
|
import {
|
|
47
47
|
ChartComponentDefaultsSchema,
|
|
48
|
+
GradientFillSchema,
|
|
49
|
+
GradientStopSchema,
|
|
48
50
|
HighchartsComponentDefaultsSchema,
|
|
49
51
|
ImageComponentDefaultsSchema,
|
|
52
|
+
PATTERN_FILL_PRESETS,
|
|
53
|
+
PatternFillSchema,
|
|
50
54
|
PptxChartPropsSchema,
|
|
51
55
|
PptxComponentDefaultsSchema,
|
|
52
56
|
PptxHighchartsPropsSchema,
|
|
@@ -57,8 +61,9 @@ import {
|
|
|
57
61
|
ShapeTypeSchema,
|
|
58
62
|
TableComponentDefaultsSchema,
|
|
59
63
|
TextComponentDefaultsSchema,
|
|
60
|
-
TextPropsSchema
|
|
61
|
-
|
|
64
|
+
TextPropsSchema,
|
|
65
|
+
TextRunSchema
|
|
66
|
+
} from "./chunk-7CKCXKN7.js";
|
|
62
67
|
|
|
63
68
|
// src/validation/image-source-conflicts.ts
|
|
64
69
|
var IMAGE_SOURCE_FIELDS = ["path", "base64", "svg"];
|
|
@@ -96,6 +101,40 @@ function collectImageSourceConflicts(data) {
|
|
|
96
101
|
return errors;
|
|
97
102
|
}
|
|
98
103
|
|
|
104
|
+
// src/validation/text-content-conflicts.ts
|
|
105
|
+
function collectTextContentConflicts(data) {
|
|
106
|
+
const errors = [];
|
|
107
|
+
const visit = (node, path, parentKey) => {
|
|
108
|
+
if (Array.isArray(node)) {
|
|
109
|
+
node.forEach((item, i) => visit(item, `${path}/${i}`, parentKey));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!node || typeof node !== "object") return;
|
|
113
|
+
if (node.name === "text" && node.props && typeof node.props === "object") {
|
|
114
|
+
const hasText = typeof node.props.text === "string";
|
|
115
|
+
const hasRuns = Array.isArray(node.props.runs);
|
|
116
|
+
if (hasText && hasRuns) {
|
|
117
|
+
errors.push({
|
|
118
|
+
path: `${path}/props`,
|
|
119
|
+
message: 'Text component accepts either "text" or "runs", not both. Use exactly one of the two.',
|
|
120
|
+
code: "mutually_exclusive"
|
|
121
|
+
});
|
|
122
|
+
} else if (!hasText && !hasRuns && parentKey !== "defaults") {
|
|
123
|
+
errors.push({
|
|
124
|
+
path: `${path}/props`,
|
|
125
|
+
message: 'Text component requires content: set either "text" or "runs".',
|
|
126
|
+
code: "required_property"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (const key of Object.keys(node)) {
|
|
131
|
+
visit(node[key], `${path}/${key}`, key);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
visit(data, "", "");
|
|
135
|
+
return errors;
|
|
136
|
+
}
|
|
137
|
+
|
|
99
138
|
// src/validation/unified/index.ts
|
|
100
139
|
import { Value as Value2 } from "@sinclair/typebox/value";
|
|
101
140
|
import { transformValueErrors as transformValueErrors2 } from "@json-to-office/shared";
|
|
@@ -351,6 +390,7 @@ function parseJsonInput(jsonInput) {
|
|
|
351
390
|
function validatePresentationDocument(data, opts = {}) {
|
|
352
391
|
const errors = comprehensiveValidatePresentation(data, [], opts);
|
|
353
392
|
errors.push(...collectImageSourceConflicts(data));
|
|
393
|
+
errors.push(...collectTextContentConflicts(data));
|
|
354
394
|
const valid = errors.length === 0;
|
|
355
395
|
return {
|
|
356
396
|
valid,
|
|
@@ -416,13 +456,17 @@ export {
|
|
|
416
456
|
ChartComponentDefaultsSchema,
|
|
417
457
|
ColorValueSchema,
|
|
418
458
|
DEFAULT_ERROR_CONFIG,
|
|
459
|
+
GradientFillSchema,
|
|
460
|
+
GradientStopSchema,
|
|
419
461
|
HighchartsComponentDefaultsSchema,
|
|
420
462
|
ImageComponentDefaultsSchema,
|
|
463
|
+
PATTERN_FILL_PRESETS,
|
|
421
464
|
PPTX_BASE_SCHEMA_METADATA,
|
|
422
465
|
PPTX_COMPONENT_METADATA,
|
|
423
466
|
PPTX_JSON_SCHEMA_URLS,
|
|
424
467
|
PPTX_SHARED_VERSION,
|
|
425
468
|
PPTX_STANDARD_COMPONENTS_REGISTRY,
|
|
469
|
+
PatternFillSchema,
|
|
426
470
|
PositionSchema,
|
|
427
471
|
PptxChartPropsSchema,
|
|
428
472
|
PptxComponentDefaultsSchema,
|
|
@@ -447,11 +491,13 @@ export {
|
|
|
447
491
|
TableComponentDefaultsSchema,
|
|
448
492
|
TextComponentDefaultsSchema,
|
|
449
493
|
TextPropsSchema,
|
|
494
|
+
TextRunSchema,
|
|
450
495
|
TextStyleSchema,
|
|
451
496
|
ThemeConfigSchema,
|
|
452
497
|
TransitionSchema,
|
|
453
498
|
VerticalAlignmentSchema,
|
|
454
499
|
collectImageSourceConflicts,
|
|
500
|
+
collectTextContentConflicts,
|
|
455
501
|
compareSemver,
|
|
456
502
|
comprehensiveValidatePresentation,
|
|
457
503
|
convertToJsonSchema,
|