@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 @@
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,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,MAAM;AAAA,QACT,KAAK,OAAO,EAAE,aAAa,kBAAkB,CAAC;AAAA,QAC9C,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,mBAAmB,CAAC;AAAA,QAC/C,KAAK,OAAO;AAAA,UACV,SAAS;AAAA,UACT,aAAa;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF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gB,KAAK,gBAAgB;AAAA,QAAO,CAAC,SACjD,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,MACxC;AACA,UAAI,CAAC,cAAc,MAAM,CAAC,MAAM,SAAS,IAAI,CAAC,CAAC,EAAG;AAGlD,YAAM,eAAe,KAAK,gBACvB,IAAI,CAAC,SAAS,SAAS,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,EACzD,OAAO,CAAC,MAAoB,MAAM,MAAS;AAE9C,YAAM,kBAAkB,CAAC,GAAG,cAAc,GAAG,aAAa;AAC1D,YAAM,eACJ,gBAAgB,WAAW,IACvB,gBAAgB,CAAC,IACjBA,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,12 +1,11 @@
1
1
  import {
2
2
  createAllPptxComponentSchemas,
3
- createAllPptxComponentSchemasNarrowed,
4
- createPptxComponentSchemaObject,
5
- getPptxContentComponents
6
- } from "./chunk-I3XL4HX7.js";
3
+ createAllPptxComponentSchemasNarrowed
4
+ } from "./chunk-G3FMM4FX.js";
7
5
 
8
6
  // src/schemas/component-union.ts
9
7
  import { Type } from "@sinclair/typebox";
8
+ import { PptxSlideContentSchema } from "@json-to-office/shared/schemas/slide-content";
10
9
  var PptxStandardComponentDefinitionSchema = Type.Union(
11
10
  [...createAllPptxComponentSchemas(Type.Any())],
12
11
  {
@@ -20,18 +19,10 @@ var PptxComponentDefinitionSchema = Type.Recursive(
20
19
  description: "PPTX component definition with discriminated union"
21
20
  })
22
21
  );
23
- var PptxSlideContentSchema = Type.Union(
24
- getPptxContentComponents().map((c) => createPptxComponentSchemaObject(c)),
25
- {
26
- $id: "PptxSlideContent",
27
- discriminator: { propertyName: "name" },
28
- description: "A single PPTX slide content element (text, image, shape, table, highcharts, or chart)."
29
- }
30
- );
31
22
 
32
23
  export {
33
24
  PptxStandardComponentDefinitionSchema,
34
25
  PptxComponentDefinitionSchema,
35
26
  PptxSlideContentSchema
36
27
  };
37
- //# sourceMappingURL=chunk-5ER63EW5.js.map
28
+ //# sourceMappingURL=chunk-HYJ6MU3F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/component-union.ts"],"sourcesContent":["/**\n * PPTX Component Definition Schemas (discriminated union)\n *\n * Extracted to its own file to break circular imports:\n * slide.ts → component-union.ts → component-registry.ts → slide.ts\n * ESM resolves this safely because SlidePropsSchema is a top-level declaration.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport {\n createAllPptxComponentSchemas,\n createAllPptxComponentSchemasNarrowed,\n} from './component-registry';\n\nexport { PptxSlideContentSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { PptxSlideContent } from '@json-to-office/shared/schemas/slide-content';\n\nexport const PptxStandardComponentDefinitionSchema = Type.Union(\n [...createAllPptxComponentSchemas(Type.Any())],\n {\n discriminator: { propertyName: 'name' },\n description: 'Standard PPTX component definition with discriminated union',\n }\n);\n\nexport const PptxComponentDefinitionSchema = Type.Recursive((This) =>\n Type.Union([...createAllPptxComponentSchemasNarrowed(This)], {\n discriminator: { propertyName: 'name' },\n description: 'PPTX component definition with discriminated union',\n })\n);\n\nexport type PptxComponentDefinition = Static<\n typeof PptxComponentDefinitionSchema\n>;\n"],"mappings":";;;;;;AAQA,SAAS,YAAoB;AAM7B,SAAS,8BAA8B;AAGhC,IAAM,wCAAwC,KAAK;AAAA,EACxD,CAAC,GAAG,8BAA8B,KAAK,IAAI,CAAC,CAAC;AAAA,EAC7C;AAAA,IACE,eAAe,EAAE,cAAc,OAAO;AAAA,IACtC,aAAa;AAAA,EACf;AACF;AAEO,IAAM,gCAAgC,KAAK;AAAA,EAAU,CAAC,SAC3D,KAAK,MAAM,CAAC,GAAG,sCAAsC,IAAI,CAAC,GAAG;AAAA,IAC3D,eAAe,EAAE,cAAc,OAAO;AAAA,IACtC,aAAa;AAAA,EACf,CAAC;AACH;","names":[]}
@@ -0,0 +1,64 @@
1
+ // src/schemas/component-defaults.ts
2
+ import { Type } from "@sinclair/typebox";
3
+
4
+ // src/schemas/components/text.ts
5
+ import { TextPropsSchema } from "@json-to-office/shared/schemas/slide-content";
6
+
7
+ // src/schemas/components/image.ts
8
+ import { PptxImagePropsSchema } from "@json-to-office/shared/schemas/slide-content";
9
+
10
+ // src/schemas/components/shape.ts
11
+ import {
12
+ ShapePropsSchema,
13
+ ShapeTypeSchema,
14
+ TextSegmentSchema
15
+ } from "@json-to-office/shared/schemas/slide-content";
16
+
17
+ // src/schemas/components/table.ts
18
+ import { PptxTablePropsSchema } from "@json-to-office/shared/schemas/slide-content";
19
+
20
+ // src/schemas/components/highcharts.ts
21
+ import { PptxHighchartsPropsSchema } from "@json-to-office/shared/schemas/slide-content";
22
+
23
+ // src/schemas/components/chart.ts
24
+ import { PptxChartPropsSchema } from "@json-to-office/shared/schemas/slide-content";
25
+
26
+ // src/schemas/component-defaults.ts
27
+ var TextComponentDefaultsSchema = Type.Partial(TextPropsSchema);
28
+ var ImageComponentDefaultsSchema = Type.Partial(PptxImagePropsSchema);
29
+ var ShapeComponentDefaultsSchema = Type.Partial(ShapePropsSchema);
30
+ var TableComponentDefaultsSchema = Type.Partial(PptxTablePropsSchema);
31
+ var HighchartsComponentDefaultsSchema = Type.Partial(
32
+ PptxHighchartsPropsSchema
33
+ );
34
+ var ChartComponentDefaultsSchema = Type.Partial(PptxChartPropsSchema);
35
+ var PptxComponentDefaultsSchema = Type.Object(
36
+ {
37
+ text: Type.Optional(TextComponentDefaultsSchema),
38
+ image: Type.Optional(ImageComponentDefaultsSchema),
39
+ shape: Type.Optional(ShapeComponentDefaultsSchema),
40
+ table: Type.Optional(TableComponentDefaultsSchema),
41
+ highcharts: Type.Optional(HighchartsComponentDefaultsSchema),
42
+ chart: Type.Optional(ChartComponentDefaultsSchema)
43
+ },
44
+ { additionalProperties: true }
45
+ );
46
+
47
+ export {
48
+ TextPropsSchema,
49
+ PptxImagePropsSchema,
50
+ ShapePropsSchema,
51
+ ShapeTypeSchema,
52
+ TextSegmentSchema,
53
+ PptxTablePropsSchema,
54
+ PptxHighchartsPropsSchema,
55
+ PptxChartPropsSchema,
56
+ TextComponentDefaultsSchema,
57
+ ImageComponentDefaultsSchema,
58
+ ShapeComponentDefaultsSchema,
59
+ TableComponentDefaultsSchema,
60
+ HighchartsComponentDefaultsSchema,
61
+ ChartComponentDefaultsSchema,
62
+ PptxComponentDefaultsSchema
63
+ };
64
+ //# sourceMappingURL=chunk-NCBBMAVS.js.map
@@ -0,0 +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 { TextPropsSchema } from '@json-to-office/shared/schemas/slide-content';\nexport type { TextProps } 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} from '@json-to-office/shared/schemas/slide-content';\nexport type {\n ShapeProps,\n ShapeType,\n TextSegment,\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,SAAS,uBAAuB;;;ACAhC,SAAS,4BAA4B;;;ACArC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACJP,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":[]}
@@ -0,0 +1,158 @@
1
+ import {
2
+ PptxComponentDefaultsSchema
3
+ } from "./chunk-NCBBMAVS.js";
4
+
5
+ // src/schemas/theme.ts
6
+ import { Type } from "@sinclair/typebox";
7
+ import { FontFamilyNameSchema } from "@json-to-office/shared";
8
+ import {
9
+ ColorValueSchema,
10
+ STYLE_NAMES
11
+ } from "@json-to-office/shared/schemas/slide-content";
12
+ import {
13
+ ColorValueSchema as ColorValueSchema2,
14
+ SEMANTIC_COLOR_NAMES,
15
+ SEMANTIC_COLOR_ALIASES,
16
+ STYLE_NAMES as STYLE_NAMES2,
17
+ StyleNameSchema
18
+ } from "@json-to-office/shared/schemas/slide-content";
19
+ var GridMarginSchema = Type.Union(
20
+ [
21
+ Type.Number({ description: "Margin in inches (all sides)" }),
22
+ Type.Object(
23
+ {
24
+ top: Type.Number({ description: "Top margin in inches" }),
25
+ right: Type.Number({ description: "Right margin in inches" }),
26
+ bottom: Type.Number({ description: "Bottom margin in inches" }),
27
+ left: Type.Number({ description: "Left margin in inches" })
28
+ },
29
+ { additionalProperties: false }
30
+ )
31
+ ],
32
+ { description: "Slide margins in inches" }
33
+ );
34
+ var GridGutterSchema = Type.Union(
35
+ [
36
+ Type.Number({ description: "Gutter in inches (both axes)" }),
37
+ Type.Object(
38
+ {
39
+ column: Type.Number({ description: "Column gutter in inches" }),
40
+ row: Type.Number({ description: "Row gutter in inches" })
41
+ },
42
+ { additionalProperties: false }
43
+ )
44
+ ],
45
+ { description: "Gaps between grid tracks in inches" }
46
+ );
47
+ var GridConfigSchema = Type.Object(
48
+ {
49
+ columns: Type.Optional(
50
+ Type.Number({
51
+ minimum: 1,
52
+ description: "Number of columns (default: 12)"
53
+ })
54
+ ),
55
+ rows: Type.Optional(
56
+ Type.Number({ minimum: 1, description: "Number of rows (default: 6)" })
57
+ ),
58
+ margin: Type.Optional(GridMarginSchema),
59
+ gutter: Type.Optional(GridGutterSchema)
60
+ },
61
+ { additionalProperties: false, description: "Grid layout configuration" }
62
+ );
63
+ var HexColorSchema = Type.String({
64
+ pattern: "^#?[0-9A-Fa-f]{6}$",
65
+ description: "Hex color (e.g. #FF0000)"
66
+ });
67
+ var TextStyleSchema = Type.Object(
68
+ {
69
+ fontSize: Type.Optional(Type.Number()),
70
+ fontFace: Type.Optional(FontFamilyNameSchema),
71
+ fontColor: Type.Optional(ColorValueSchema),
72
+ bold: Type.Optional(Type.Boolean()),
73
+ fontWeight: Type.Optional(Type.Integer({ minimum: 100, maximum: 900 })),
74
+ italic: Type.Optional(Type.Boolean()),
75
+ align: Type.Optional(
76
+ Type.Union([
77
+ Type.Literal("left"),
78
+ Type.Literal("center"),
79
+ Type.Literal("right"),
80
+ Type.Literal("justify")
81
+ ])
82
+ ),
83
+ lineSpacing: Type.Optional(Type.Number()),
84
+ charSpacing: Type.Optional(Type.Number()),
85
+ paraSpaceAfter: Type.Optional(Type.Number())
86
+ },
87
+ { additionalProperties: false, description: "Text style preset" }
88
+ );
89
+ var ThemeConfigSchema = Type.Object(
90
+ {
91
+ name: Type.String({ description: "Theme name" }),
92
+ colors: Type.Object(
93
+ {
94
+ primary: HexColorSchema,
95
+ secondary: HexColorSchema,
96
+ accent: HexColorSchema,
97
+ background: HexColorSchema,
98
+ text: HexColorSchema,
99
+ text2: Type.Optional(HexColorSchema),
100
+ background2: Type.Optional(HexColorSchema),
101
+ accent4: Type.Optional(HexColorSchema),
102
+ accent5: Type.Optional(HexColorSchema),
103
+ accent6: Type.Optional(HexColorSchema)
104
+ },
105
+ {
106
+ additionalProperties: false,
107
+ description: "Theme color palette (10-slot scheme)"
108
+ }
109
+ ),
110
+ fonts: Type.Object(
111
+ {
112
+ heading: FontFamilyNameSchema,
113
+ body: FontFamilyNameSchema
114
+ },
115
+ { additionalProperties: false, description: "Font families" }
116
+ ),
117
+ defaults: Type.Object(
118
+ {
119
+ fontSize: Type.Number({ description: "Default font size in points" }),
120
+ fontColor: HexColorSchema
121
+ },
122
+ { additionalProperties: false, description: "Default text styling" }
123
+ ),
124
+ styles: Type.Optional(
125
+ Type.Partial(
126
+ Type.Object(
127
+ Object.fromEntries(
128
+ STYLE_NAMES.map((n) => [n, TextStyleSchema])
129
+ )
130
+ ),
131
+ { additionalProperties: false, description: "Named text style presets" }
132
+ )
133
+ ),
134
+ componentDefaults: Type.Optional(PptxComponentDefaultsSchema)
135
+ },
136
+ {
137
+ additionalProperties: false,
138
+ description: "Presentation theme configuration"
139
+ }
140
+ );
141
+ function isValidThemeConfig(data) {
142
+ return typeof data === "object" && data !== null;
143
+ }
144
+
145
+ export {
146
+ GridMarginSchema,
147
+ GridGutterSchema,
148
+ GridConfigSchema,
149
+ TextStyleSchema,
150
+ ThemeConfigSchema,
151
+ isValidThemeConfig,
152
+ ColorValueSchema2 as ColorValueSchema,
153
+ SEMANTIC_COLOR_NAMES,
154
+ SEMANTIC_COLOR_ALIASES,
155
+ STYLE_NAMES2 as STYLE_NAMES,
156
+ StyleNameSchema
157
+ };
158
+ //# sourceMappingURL=chunk-ZMZKHRBS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/theme.ts"],"sourcesContent":["/**\n * PPTX Theme Schema\n * Simplified theme configuration for presentations\n */\nimport { Type, Static } from '@sinclair/typebox';\nimport { FontFamilyNameSchema } from '@json-to-office/shared';\nimport {\n ColorValueSchema,\n STYLE_NAMES,\n} from '@json-to-office/shared/schemas/slide-content';\nimport { PptxComponentDefaultsSchema } from './component-defaults';\n\nexport {\n ColorValueSchema,\n SEMANTIC_COLOR_NAMES,\n SEMANTIC_COLOR_ALIASES,\n STYLE_NAMES,\n StyleNameSchema,\n} from '@json-to-office/shared/schemas/slide-content';\nexport type { StyleName } from '@json-to-office/shared/schemas/slide-content';\n\nexport const GridMarginSchema = Type.Union(\n [\n Type.Number({ description: 'Margin in inches (all sides)' }),\n Type.Object(\n {\n top: Type.Number({ description: 'Top margin in inches' }),\n right: Type.Number({ description: 'Right margin in inches' }),\n bottom: Type.Number({ description: 'Bottom margin in inches' }),\n left: Type.Number({ description: 'Left margin in inches' }),\n },\n { additionalProperties: false }\n ),\n ],\n { description: 'Slide margins in inches' }\n);\n\nexport const GridGutterSchema = Type.Union(\n [\n Type.Number({ description: 'Gutter in inches (both axes)' }),\n Type.Object(\n {\n column: Type.Number({ description: 'Column gutter in inches' }),\n row: Type.Number({ description: 'Row gutter in inches' }),\n },\n { additionalProperties: false }\n ),\n ],\n { description: 'Gaps between grid tracks in inches' }\n);\n\nexport const GridConfigSchema = Type.Object(\n {\n columns: Type.Optional(\n Type.Number({\n minimum: 1,\n description: 'Number of columns (default: 12)',\n })\n ),\n rows: Type.Optional(\n Type.Number({ minimum: 1, description: 'Number of rows (default: 6)' })\n ),\n margin: Type.Optional(GridMarginSchema),\n gutter: Type.Optional(GridGutterSchema),\n },\n { additionalProperties: false, description: 'Grid layout configuration' }\n);\n\nexport type GridMargin = Static<typeof GridMarginSchema>;\nexport type GridGutter = Static<typeof GridGutterSchema>;\nexport type GridConfig = Static<typeof GridConfigSchema>;\n\nconst HexColorSchema = Type.String({\n pattern: '^#?[0-9A-Fa-f]{6}$',\n description: 'Hex color (e.g. #FF0000)',\n});\n\nexport const TextStyleSchema = Type.Object(\n {\n fontSize: Type.Optional(Type.Number()),\n fontFace: Type.Optional(FontFamilyNameSchema),\n fontColor: Type.Optional(ColorValueSchema),\n bold: Type.Optional(Type.Boolean()),\n fontWeight: Type.Optional(Type.Integer({ minimum: 100, maximum: 900 })),\n italic: Type.Optional(Type.Boolean()),\n align: Type.Optional(\n Type.Union([\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('justify'),\n ])\n ),\n lineSpacing: Type.Optional(Type.Number()),\n charSpacing: Type.Optional(Type.Number()),\n paraSpaceAfter: Type.Optional(Type.Number()),\n },\n { additionalProperties: false, description: 'Text style preset' }\n);\n\nexport type TextStyle = Static<typeof TextStyleSchema>;\n\n// ── Theme config ───────────────────────────────────────────────────\n\nexport const ThemeConfigSchema = Type.Object(\n {\n name: Type.String({ description: 'Theme name' }),\n colors: Type.Object(\n {\n primary: HexColorSchema,\n secondary: HexColorSchema,\n accent: HexColorSchema,\n background: HexColorSchema,\n text: HexColorSchema,\n text2: Type.Optional(HexColorSchema),\n background2: Type.Optional(HexColorSchema),\n accent4: Type.Optional(HexColorSchema),\n accent5: Type.Optional(HexColorSchema),\n accent6: Type.Optional(HexColorSchema),\n },\n {\n additionalProperties: false,\n description: 'Theme color palette (10-slot scheme)',\n }\n ),\n fonts: Type.Object(\n {\n heading: FontFamilyNameSchema,\n body: FontFamilyNameSchema,\n },\n { additionalProperties: false, description: 'Font families' }\n ),\n defaults: Type.Object(\n {\n fontSize: Type.Number({ description: 'Default font size in points' }),\n fontColor: HexColorSchema,\n },\n { additionalProperties: false, description: 'Default text styling' }\n ),\n styles: Type.Optional(\n Type.Partial(\n Type.Object(\n Object.fromEntries(\n STYLE_NAMES.map((n) => [n, TextStyleSchema])\n ) as Record<string, typeof TextStyleSchema>\n ),\n { additionalProperties: false, description: 'Named text style presets' }\n )\n ),\n componentDefaults: Type.Optional(PptxComponentDefaultsSchema),\n },\n {\n additionalProperties: false,\n description: 'Presentation theme configuration',\n }\n);\n\nexport type ThemeConfigJson = Static<typeof ThemeConfigSchema>;\n\nexport function isValidThemeConfig(data: unknown): data is ThemeConfigJson {\n return typeof data === 'object' && data !== null;\n}\n"],"mappings":";;;;;AAIA,SAAS,YAAoB;AAC7B,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE,oBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAAC;AAAA,EACA;AAAA,OACK;AAGA,IAAM,mBAAmB,KAAK;AAAA,EACnC;AAAA,IACE,KAAK,OAAO,EAAE,aAAa,+BAA+B,CAAC;AAAA,IAC3D,KAAK;AAAA,MACH;AAAA,QACE,KAAK,KAAK,OAAO,EAAE,aAAa,uBAAuB,CAAC;AAAA,QACxD,OAAO,KAAK,OAAO,EAAE,aAAa,yBAAyB,CAAC;AAAA,QAC5D,QAAQ,KAAK,OAAO,EAAE,aAAa,0BAA0B,CAAC;AAAA,QAC9D,MAAM,KAAK,OAAO,EAAE,aAAa,wBAAwB,CAAC;AAAA,MAC5D;AAAA,MACA,EAAE,sBAAsB,MAAM;AAAA,IAChC;AAAA,EACF;AAAA,EACA,EAAE,aAAa,0BAA0B;AAC3C;AAEO,IAAM,mBAAmB,KAAK;AAAA,EACnC;AAAA,IACE,KAAK,OAAO,EAAE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sB,OAAO,aAAa,2BAA2B;AAAA,MACzE;AAAA,IACF;AAAA,IACA,mBAAmB,KAAK,SAAS,2BAA2B;AAAA,EAC9D;AAAA,EACA;AAAA,IACE,sBAAsB;AAAA,IACtB,aAAa;AAAA,EACf;AACF;AAIO,SAAS,mBAAmB,MAAwC;AACzE,SAAO,OAAO,SAAS,YAAY,SAAS;AAC9C;","names":["ColorValueSchema","STYLE_NAMES"]}
package/dist/index.d.ts CHANGED
@@ -1,78 +1,16 @@
1
- export { Position, PositionSchema, PptxHighchartsProps, PptxHighchartsPropsSchema, PptxImageProps, PptxImagePropsSchema, PptxTableProps, PptxTablePropsSchema, PresentationProps, PresentationPropsSchema, Shadow, ShadowSchema, ShapeProps, ShapePropsSchema, ShapeType, ShapeTypeSchema, SlideBackground, SlideBackgroundSchema, SlideProps, SlidePropsSchema, TextProps, TextPropsSchema, TextSegment, Transition, TransitionSchema, VerticalAlignment, VerticalAlignmentSchema } from './schemas/components.js';
2
- export { PptxComponentDefinition, PptxComponentDefinitionSchema, PptxSlideContent, PptxSlideContentSchema, PptxStandardComponentDefinitionSchema } from './schemas/component-union.js';
3
- import * as _sinclair_typebox from '@sinclair/typebox';
4
- import { Static } from '@sinclair/typebox';
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';
3
+ export { PptxComponentDefinition, PptxComponentDefinitionSchema, PptxStandardComponentDefinitionSchema } from './schemas/component-union.js';
5
4
  export { PPTX_STANDARD_COMPONENTS_REGISTRY, PptxStandardComponentDefinition, createAllPptxComponentSchemas, createPptxComponentSchemaObject, getAllPptxComponentNames, getPptxComponentsByCategory, getPptxContainerComponents, getPptxContentComponents, getPptxStandardComponent, isPptxStandardComponent } from './schemas/component-registry.js';
6
5
  import { PptxJsonComponentDefinition } from './schemas/document.js';
7
6
  export { PPTX_JSON_SCHEMA_URLS, PptxJsonComponentDefinitionSchema } from './schemas/document.js';
8
7
  export { PPTX_BASE_SCHEMA_METADATA, PPTX_COMPONENT_METADATA } from './schemas/export.js';
9
8
  export { ChartComponentDefaults, ChartComponentDefaultsSchema, HighchartsComponentDefaults, HighchartsComponentDefaultsSchema, ImageComponentDefaults, ImageComponentDefaultsSchema, PptxComponentDefaults, PptxComponentDefaultsSchema, ShapeComponentDefaults, ShapeComponentDefaultsSchema, TableComponentDefaults, TableComponentDefaultsSchema, TextComponentDefaults, TextComponentDefaultsSchema } from './schemas/component-defaults.js';
10
- export { ColorValueSchema, SEMANTIC_COLOR_ALIASES, SEMANTIC_COLOR_NAMES, STYLE_NAMES, StyleName, StyleNameSchema, TextStyle, TextStyleSchema, ThemeConfigJson, ThemeConfigSchema, isValidThemeConfig } from './schemas/theme.js';
9
+ export { TextStyle, TextStyleSchema, ThemeConfigJson, ThemeConfigSchema, isValidThemeConfig } from './schemas/theme.js';
11
10
  export { CustomComponentInfo, GenerateSchemaOptions, VersionedPropsEntry, generateUnifiedDocumentSchema } from './schemas/generator.js';
12
11
  import { ValidationError } from '@json-to-office/shared';
13
12
  export { ComponentSchemaConfig, DEFAULT_ERROR_CONFIG, ErrorFormatterConfig, ParsedSemver, ValidationError, compareSemver, convertToJsonSchema, createComponentSchema, createErrorConfig, exportSchemaToFile, fixSchemaReferences, isValidSemver, latestVersion, parseSemver, transformValueError, transformValueErrors } from '@json-to-office/shared';
14
-
15
- declare const PptxChartPropsSchema: _sinclair_typebox.TObject<{
16
- type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"area">, _sinclair_typebox.TLiteral<"bar">, _sinclair_typebox.TLiteral<"bar3D">, _sinclair_typebox.TLiteral<"bubble">, _sinclair_typebox.TLiteral<"doughnut">, _sinclair_typebox.TLiteral<"line">, _sinclair_typebox.TLiteral<"pie">, _sinclair_typebox.TLiteral<"radar">, _sinclair_typebox.TLiteral<"scatter">]>;
17
- data: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
18
- name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
19
- labels: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
20
- values: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TNumber>>;
21
- sizes: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TNumber>>;
22
- }>>;
23
- showLegend: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
24
- showTitle: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
25
- showValue: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
26
- showPercent: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
27
- showLabel: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
28
- showSerName: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
29
- title: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
30
- titleFontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
31
- titleColor: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
32
- titleFontFace: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
33
- chartColors: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
34
- legendPos: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"b">, _sinclair_typebox.TLiteral<"l">, _sinclair_typebox.TLiteral<"r">, _sinclair_typebox.TLiteral<"t">, _sinclair_typebox.TLiteral<"tr">]>>;
35
- legendFontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
36
- legendFontFace: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
37
- legendColor: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
38
- catAxisTitle: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
39
- catAxisHidden: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
40
- catAxisLabelRotate: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
41
- catAxisLabelFontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
42
- catAxisLabelColor: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
43
- valAxisTitle: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
44
- valAxisHidden: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
45
- valAxisMinVal: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
46
- valAxisMaxVal: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
47
- valAxisLabelFormatCode: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
48
- valAxisMajorUnit: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
49
- valAxisLabelColor: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
50
- barDir: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"bar">, _sinclair_typebox.TLiteral<"col">]>>;
51
- barGrouping: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"clustered">, _sinclair_typebox.TLiteral<"stacked">, _sinclair_typebox.TLiteral<"percentStacked">]>>;
52
- barGapWidthPct: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
53
- lineSmooth: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
54
- lineDataSymbol: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"circle">, _sinclair_typebox.TLiteral<"dash">, _sinclair_typebox.TLiteral<"diamond">, _sinclair_typebox.TLiteral<"dot">, _sinclair_typebox.TLiteral<"none">, _sinclair_typebox.TLiteral<"square">, _sinclair_typebox.TLiteral<"triangle">]>>;
55
- lineSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
56
- firstSliceAng: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
57
- holeSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
58
- radarStyle: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"standard">, _sinclair_typebox.TLiteral<"marker">, _sinclair_typebox.TLiteral<"filled">]>>;
59
- dataLabelColor: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
60
- dataLabelFontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
61
- dataLabelFontFace: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
62
- dataLabelFontBold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
63
- dataLabelPosition: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"b">, _sinclair_typebox.TLiteral<"bestFit">, _sinclair_typebox.TLiteral<"ctr">, _sinclair_typebox.TLiteral<"l">, _sinclair_typebox.TLiteral<"r">, _sinclair_typebox.TLiteral<"t">, _sinclair_typebox.TLiteral<"inEnd">, _sinclair_typebox.TLiteral<"outEnd">]>>;
64
- x: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString]>>;
65
- y: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString]>>;
66
- w: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString]>>;
67
- h: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString]>>;
68
- grid: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
69
- column: _sinclair_typebox.TNumber;
70
- row: _sinclair_typebox.TNumber;
71
- columnSpan: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
72
- rowSpan: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
73
- }>>;
74
- }>;
75
- type PptxChartProps = Static<typeof PptxChartPropsSchema>;
13
+ import '@sinclair/typebox';
76
14
 
77
15
  /**
78
16
  * Component Types for Plugin System
@@ -210,4 +148,4 @@ declare const validateStrict: {
210
148
 
211
149
  declare const PPTX_SHARED_VERSION = "1.0.0";
212
150
 
213
- export { type DeepValidateOptions, PPTX_SHARED_VERSION, type PptxChartProps, PptxChartPropsSchema, PptxJsonComponentDefinition, type PptxValidationResult, type ReportComponent, collectImageSourceConflicts, comprehensiveValidatePresentation, deepValidatePresentation, presentImageSources, validate, validateJsonPptxTheme, validateJsonPresentationDocument, validatePptxTheme, validatePresentationDocument, validateStrict };
151
+ export { type DeepValidateOptions, PPTX_SHARED_VERSION, PptxJsonComponentDefinition, type PptxValidationResult, type ReportComponent, collectImageSourceConflicts, comprehensiveValidatePresentation, deepValidatePresentation, presentImageSources, validate, validateJsonPptxTheme, validateJsonPresentationDocument, validatePptxTheme, validatePresentationDocument, validateStrict };
package/dist/index.js CHANGED
@@ -1,24 +1,29 @@
1
1
  import {
2
2
  PPTX_JSON_SCHEMA_URLS,
3
3
  PptxJsonComponentDefinitionSchema
4
- } from "./chunk-7MPP5MFF.js";
4
+ } from "./chunk-BIJP7NTG.js";
5
5
  import "./chunk-J4OT5Y5B.js";
6
6
  import {
7
7
  PptxComponentDefinitionSchema,
8
8
  PptxSlideContentSchema,
9
9
  PptxStandardComponentDefinitionSchema
10
- } from "./chunk-5ER63EW5.js";
10
+ } from "./chunk-HYJ6MU3F.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-YKBPU4GM.js";
17
+ } from "./chunk-3TK45DVZ.js";
18
18
  import {
19
19
  PPTX_STANDARD_COMPONENTS_REGISTRY,
20
+ PositionSchema,
20
21
  PresentationPropsSchema,
22
+ ShadowSchema,
23
+ SlideBackgroundSchema,
21
24
  SlidePropsSchema,
25
+ TransitionSchema,
26
+ VerticalAlignmentSchema,
22
27
  createAllPptxComponentSchemas,
23
28
  createPptxComponentSchemaObject,
24
29
  getAllPptxComponentNames,
@@ -27,36 +32,33 @@ import {
27
32
  getPptxContentComponents,
28
33
  getPptxStandardComponent,
29
34
  isPptxStandardComponent
30
- } from "./chunk-I3XL4HX7.js";
35
+ } from "./chunk-G3FMM4FX.js";
31
36
  import {
32
- ChartComponentDefaultsSchema,
33
37
  ColorValueSchema,
38
+ SEMANTIC_COLOR_ALIASES,
39
+ SEMANTIC_COLOR_NAMES,
40
+ STYLE_NAMES,
41
+ StyleNameSchema,
42
+ TextStyleSchema,
43
+ ThemeConfigSchema,
44
+ isValidThemeConfig
45
+ } from "./chunk-ZMZKHRBS.js";
46
+ import {
47
+ ChartComponentDefaultsSchema,
34
48
  HighchartsComponentDefaultsSchema,
35
49
  ImageComponentDefaultsSchema,
36
- PositionSchema,
37
50
  PptxChartPropsSchema,
38
51
  PptxComponentDefaultsSchema,
39
52
  PptxHighchartsPropsSchema,
40
53
  PptxImagePropsSchema,
41
54
  PptxTablePropsSchema,
42
- SEMANTIC_COLOR_ALIASES,
43
- SEMANTIC_COLOR_NAMES,
44
- STYLE_NAMES,
45
- ShadowSchema,
46
55
  ShapeComponentDefaultsSchema,
47
56
  ShapePropsSchema,
48
57
  ShapeTypeSchema,
49
- SlideBackgroundSchema,
50
- StyleNameSchema,
51
58
  TableComponentDefaultsSchema,
52
59
  TextComponentDefaultsSchema,
53
- TextPropsSchema,
54
- TextStyleSchema,
55
- ThemeConfigSchema,
56
- TransitionSchema,
57
- VerticalAlignmentSchema,
58
- isValidThemeConfig
59
- } from "./chunk-STLETJGO.js";
60
+ TextPropsSchema
61
+ } from "./chunk-NCBBMAVS.js";
60
62
 
61
63
  // src/validation/image-source-conflicts.ts
62
64
  var IMAGE_SOURCE_FIELDS = ["path", "base64", "svg"];
@@ -116,6 +118,10 @@ var COMPONENT_OBJECT_KEYS = /* @__PURE__ */ new Set([
116
118
  "props",
117
119
  "children"
118
120
  ]);
121
+ var CUSTOM_COMPONENT_OBJECT_KEYS = /* @__PURE__ */ new Set([
122
+ ...COMPONENT_OBJECT_KEYS,
123
+ "version"
124
+ ]);
119
125
  var ROOT_OBJECT_KEYS = /* @__PURE__ */ new Set([...COMPONENT_OBJECT_KEYS, "$schema"]);
120
126
  function deepValidatePresentation(data, opts = {}) {
121
127
  const allErrors = [];
@@ -150,7 +156,13 @@ function deepValidatePresentation(data, opts = {}) {
150
156
  });
151
157
  }
152
158
  }
153
- if (ROOT_COMPONENT_NAMES.has(data.name) && "props" in data) {
159
+ if (!("props" in data)) {
160
+ allErrors.push({
161
+ path: "/props",
162
+ message: 'Missing required field "props"',
163
+ code: "required_property"
164
+ });
165
+ } else if (ROOT_COMPONENT_NAMES.has(data.name)) {
154
166
  allErrors.push(
155
167
  ...validateComponentProps(data.name, data.props, "/props", opts)
156
168
  );
@@ -190,9 +202,10 @@ function walkComponentTree(node, path, opts, errors) {
190
202
  });
191
203
  return;
192
204
  }
193
- if (opts.knownCustomNames?.has(child.name)) return;
205
+ const isCustomComponent = opts.knownCustomNames?.has(child.name) ?? false;
206
+ const allowedObjectKeys = isCustomComponent ? CUSTOM_COMPONENT_OBJECT_KEYS : COMPONENT_OBJECT_KEYS;
194
207
  for (const key of Object.keys(child)) {
195
- if (!COMPONENT_OBJECT_KEYS.has(key)) {
208
+ if (!allowedObjectKeys.has(key)) {
196
209
  errors.push({
197
210
  path: `${childPath}/${key}`,
198
211
  message: `Unknown field "${key}" on component "${child.name}"`,
@@ -200,6 +213,10 @@ function walkComponentTree(node, path, opts, errors) {
200
213
  });
201
214
  }
202
215
  }
216
+ if (isCustomComponent) {
217
+ walkComponentTree(child, childPath, opts, errors);
218
+ return;
219
+ }
203
220
  const propsPath = `${childPath}/props`;
204
221
  if (child.props != null) {
205
222
  errors.push(