@json-to-office/shared-pptx 0.19.0 → 0.21.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-3TK45DVZ.js +68 -0
- package/dist/chunk-3TK45DVZ.js.map +1 -0
- package/dist/{chunk-2R6VYDG2.js → chunk-BIJP7NTG.js} +2 -2
- package/dist/{chunk-UVET7RT3.js → chunk-G3FMM4FX.js} +217 -146
- package/dist/chunk-G3FMM4FX.js.map +1 -0
- package/dist/{chunk-BJP72XV3.js → chunk-HYJ6MU3F.js} +4 -13
- package/dist/chunk-HYJ6MU3F.js.map +1 -0
- package/dist/chunk-NCBBMAVS.js +64 -0
- package/dist/chunk-NCBBMAVS.js.map +1 -0
- package/dist/chunk-ZMZKHRBS.js +158 -0
- package/dist/chunk-ZMZKHRBS.js.map +1 -0
- package/dist/index.d.ts +108 -68
- package/dist/index.js +327 -21
- package/dist/index.js.map +1 -1
- package/dist/schemas/component-defaults.js +1 -1
- package/dist/schemas/component-registry.js +3 -2
- package/dist/schemas/component-union.d.ts +2 -11
- package/dist/schemas/component-union.js +4 -3
- package/dist/schemas/components.d.ts +319 -266
- package/dist/schemas/components.js +12 -11
- package/dist/schemas/document.js +5 -4
- package/dist/schemas/generator.js +4 -3
- package/dist/schemas/theme.d.ts +2 -8
- package/dist/schemas/theme.js +2 -1
- package/package.json +2 -2
- package/dist/chunk-BJP72XV3.js.map +0 -1
- package/dist/chunk-GUSMSJT6.js +0 -42
- package/dist/chunk-GUSMSJT6.js.map +0 -1
- package/dist/chunk-STLETJGO.js +0 -1102
- package/dist/chunk-STLETJGO.js.map +0 -1
- package/dist/chunk-UVET7RT3.js.map +0 -1
- /package/dist/{chunk-2R6VYDG2.js.map → chunk-BIJP7NTG.js.map} +0 -0
|
@@ -3,27 +3,28 @@ import {
|
|
|
3
3
|
PptxComponentDefinitionSchema,
|
|
4
4
|
PptxSlideContentSchema,
|
|
5
5
|
PptxStandardComponentDefinitionSchema
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import {
|
|
8
|
-
PresentationPropsSchema,
|
|
9
|
-
SlidePropsSchema
|
|
10
|
-
} from "../chunk-UVET7RT3.js";
|
|
6
|
+
} from "../chunk-HYJ6MU3F.js";
|
|
11
7
|
import {
|
|
12
8
|
GridPositionSchema,
|
|
13
9
|
PositionSchema,
|
|
14
10
|
PptxAlignmentSchema,
|
|
11
|
+
PresentationPropsSchema,
|
|
12
|
+
ShadowSchema,
|
|
13
|
+
SlideBackgroundSchema,
|
|
14
|
+
SlidePropsSchema,
|
|
15
|
+
TransitionSchema,
|
|
16
|
+
VerticalAlignmentSchema
|
|
17
|
+
} from "../chunk-G3FMM4FX.js";
|
|
18
|
+
import "../chunk-ZMZKHRBS.js";
|
|
19
|
+
import {
|
|
15
20
|
PptxHighchartsPropsSchema,
|
|
16
21
|
PptxImagePropsSchema,
|
|
17
22
|
PptxTablePropsSchema,
|
|
18
|
-
ShadowSchema,
|
|
19
23
|
ShapePropsSchema,
|
|
20
24
|
ShapeTypeSchema,
|
|
21
|
-
SlideBackgroundSchema,
|
|
22
25
|
TextPropsSchema,
|
|
23
|
-
TextSegmentSchema
|
|
24
|
-
|
|
25
|
-
VerticalAlignmentSchema
|
|
26
|
-
} from "../chunk-STLETJGO.js";
|
|
26
|
+
TextSegmentSchema
|
|
27
|
+
} from "../chunk-NCBBMAVS.js";
|
|
27
28
|
export {
|
|
28
29
|
GridPositionSchema,
|
|
29
30
|
PositionSchema,
|
package/dist/schemas/document.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PPTX_JSON_SCHEMA_URLS,
|
|
3
3
|
PptxJsonComponentDefinitionSchema
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-BIJP7NTG.js";
|
|
5
5
|
import "../chunk-J4OT5Y5B.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-HYJ6MU3F.js";
|
|
7
|
+
import "../chunk-G3FMM4FX.js";
|
|
8
|
+
import "../chunk-ZMZKHRBS.js";
|
|
9
|
+
import "../chunk-NCBBMAVS.js";
|
|
9
10
|
export {
|
|
10
11
|
PPTX_JSON_SCHEMA_URLS,
|
|
11
12
|
PptxJsonComponentDefinitionSchema
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateUnifiedDocumentSchema
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-3TK45DVZ.js";
|
|
4
|
+
import "../chunk-G3FMM4FX.js";
|
|
5
|
+
import "../chunk-ZMZKHRBS.js";
|
|
6
|
+
import "../chunk-NCBBMAVS.js";
|
|
6
7
|
export {
|
|
7
8
|
generateUnifiedDocumentSchema
|
|
8
9
|
};
|
package/dist/schemas/theme.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
2
|
import { Static } from '@sinclair/typebox';
|
|
3
|
+
export { ColorValueSchema, SEMANTIC_COLOR_ALIASES, SEMANTIC_COLOR_NAMES, STYLE_NAMES, StyleName, StyleNameSchema } from '@json-to-office/shared/schemas/slide-content';
|
|
3
4
|
|
|
4
5
|
declare const GridMarginSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TObject<{
|
|
5
6
|
top: _sinclair_typebox.TNumber;
|
|
@@ -28,12 +29,6 @@ declare const GridConfigSchema: _sinclair_typebox.TObject<{
|
|
|
28
29
|
type GridMargin = Static<typeof GridMarginSchema>;
|
|
29
30
|
type GridGutter = Static<typeof GridGutterSchema>;
|
|
30
31
|
type GridConfig = Static<typeof GridConfigSchema>;
|
|
31
|
-
declare const SEMANTIC_COLOR_NAMES: readonly ["primary", "secondary", "accent", "background", "text", "text2", "background2", "accent4", "accent5", "accent6"];
|
|
32
|
-
/** PowerPoint XML aliases that resolve to canonical semantic names at runtime */
|
|
33
|
-
declare const SEMANTIC_COLOR_ALIASES: readonly ["accent1", "accent2", "accent3", "tx1", "tx2", "bg1", "bg2"];
|
|
34
|
-
declare const ColorValueSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, ...(_sinclair_typebox.TLiteral<"text" | "primary" | "secondary" | "accent" | "background" | "text2" | "background2" | "accent4" | "accent5" | "accent6"> | _sinclair_typebox.TLiteral<"accent1" | "accent2" | "accent3" | "tx1" | "tx2" | "bg1" | "bg2">)[]]>;
|
|
35
|
-
declare const STYLE_NAMES: readonly ["title", "subtitle", "heading1", "heading2", "heading3", "body", "caption"];
|
|
36
|
-
declare const StyleNameSchema: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"title" | "subtitle" | "heading1" | "heading2" | "heading3" | "body" | "caption">[]>;
|
|
37
32
|
declare const TextStyleSchema: _sinclair_typebox.TObject<{
|
|
38
33
|
fontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
39
34
|
fontFace: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
@@ -46,7 +41,6 @@ declare const TextStyleSchema: _sinclair_typebox.TObject<{
|
|
|
46
41
|
charSpacing: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
47
42
|
paraSpaceAfter: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
48
43
|
}>;
|
|
49
|
-
type StyleName = (typeof STYLE_NAMES)[number];
|
|
50
44
|
type TextStyle = Static<typeof TextStyleSchema>;
|
|
51
45
|
declare const ThemeConfigSchema: _sinclair_typebox.TObject<{
|
|
52
46
|
name: _sinclair_typebox.TString;
|
|
@@ -367,4 +361,4 @@ declare const ThemeConfigSchema: _sinclair_typebox.TObject<{
|
|
|
367
361
|
type ThemeConfigJson = Static<typeof ThemeConfigSchema>;
|
|
368
362
|
declare function isValidThemeConfig(data: unknown): data is ThemeConfigJson;
|
|
369
363
|
|
|
370
|
-
export {
|
|
364
|
+
export { type GridConfig, GridConfigSchema, type GridGutter, GridGutterSchema, type GridMargin, GridMarginSchema, type TextStyle, TextStyleSchema, type ThemeConfigJson, ThemeConfigSchema, isValidThemeConfig };
|
package/dist/schemas/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-to-office/shared-pptx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "PPTX-specific schemas, component registry and validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@sinclair/typebox": "0.34.38",
|
|
27
|
-
"@json-to-office/shared": "^0.
|
|
27
|
+
"@json-to-office/shared": "^0.21.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "20.11.0",
|
|
@@ -1 +0,0 @@
|
|
|
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 createPptxComponentSchemaObject,\n getPptxContentComponents,\n} from './component-registry';\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\n/**\n * A single PPTX slide content element — the discriminated union of the\n * leaf content components a slide can hold (text, image, shape, table,\n * highcharts, chart). Non-recursive (these components have no children), so it\n * embeds cleanly into other schemas (e.g. the docx `visual` component's\n * `elements`). The explicit `$id` lets JSON-Schema export hoist it into a\n * single shared `definitions` entry instead of inlining it at every use site.\n */\nexport const PptxSlideContentSchema = Type.Union(\n getPptxContentComponents().map((c) => createPptxComponentSchemaObject(c)),\n {\n $id: 'PptxSlideContent',\n discriminator: { propertyName: 'name' },\n description:\n 'A single PPTX slide content element (text, image, shape, table, highcharts, or chart).',\n }\n);\n\nexport type PptxSlideContent = Static<typeof PptxSlideContentSchema>;\n"],"mappings":";;;;;;;;AAQA,SAAS,YAAoB;AAQtB,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;AAcO,IAAM,yBAAyB,KAAK;AAAA,EACzC,yBAAyB,EAAE,IAAI,CAAC,MAAM,gCAAgC,CAAC,CAAC;AAAA,EACxE;AAAA,IACE,KAAK;AAAA,IACL,eAAe,EAAE,cAAc,OAAO;AAAA,IACtC,aACE;AAAA,EACJ;AACF;","names":[]}
|
package/dist/chunk-GUSMSJT6.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAllPptxComponentSchemasNarrowed,
|
|
3
|
-
createPptxComponentSchemaObject
|
|
4
|
-
} from "./chunk-UVET7RT3.js";
|
|
5
|
-
|
|
6
|
-
// src/schemas/generator.ts
|
|
7
|
-
import { Type } from "@sinclair/typebox";
|
|
8
|
-
function generateUnifiedDocumentSchema(options = {}) {
|
|
9
|
-
const { customComponents = [] } = options;
|
|
10
|
-
return Type.Recursive((Self) => {
|
|
11
|
-
const pluginSchemas = [];
|
|
12
|
-
for (const custom of customComponents) {
|
|
13
|
-
if (custom.versions.length > 0) {
|
|
14
|
-
const latest = custom.versions.reduce(
|
|
15
|
-
(a, b) => a.version > b.version ? a : b
|
|
16
|
-
);
|
|
17
|
-
const customDef = {
|
|
18
|
-
name: custom.name,
|
|
19
|
-
propsSchema: latest.propsSchema,
|
|
20
|
-
hasChildren: latest.hasChildren ?? false,
|
|
21
|
-
category: "content",
|
|
22
|
-
description: custom.name
|
|
23
|
-
};
|
|
24
|
-
pluginSchemas.push(createPptxComponentSchemaObject(customDef, Self));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const standardSchemas = createAllPptxComponentSchemasNarrowed(
|
|
28
|
-
Self,
|
|
29
|
-
pluginSchemas
|
|
30
|
-
);
|
|
31
|
-
const componentSchemas = [...standardSchemas, ...pluginSchemas];
|
|
32
|
-
if (componentSchemas.length === 0) {
|
|
33
|
-
return Type.Object({});
|
|
34
|
-
}
|
|
35
|
-
return Type.Union(componentSchemas);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
generateUnifiedDocumentSchema
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=chunk-GUSMSJT6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/generator.ts"],"sourcesContent":["/**\n * Unified Presentation Schema Generator\n *\n * Generates JSON schemas that include both standard and custom plugin components.\n * Used at build-time for static schema files and at runtime for plugin-aware validation.\n */\nimport { Type, TSchema } from '@sinclair/typebox';\nimport {\n createPptxComponentSchemaObject,\n createAllPptxComponentSchemasNarrowed,\n type PptxStandardComponentDefinition,\n} from './component-registry';\n\nexport interface VersionedPropsEntry {\n version: string;\n propsSchema: TSchema;\n hasChildren?: boolean;\n description?: string;\n}\n\nexport interface CustomComponentInfo {\n name: string;\n versions: VersionedPropsEntry[];\n}\n\nexport interface GenerateSchemaOptions {\n customComponents?: CustomComponentInfo[];\n includeMetadata?: boolean;\n}\n\n/**\n * Generate a unified presentation schema that includes standard + custom components.\n * Uses Type.Recursive so container components (presentation, slide) can have children.\n */\nexport function generateUnifiedDocumentSchema(\n options: GenerateSchemaOptions = {}\n): TSchema {\n const { customComponents = [] } = options;\n\n return Type.Recursive((Self) => {\n // ── Phase 1: Build plugin schemas (plugins get Self for arbitrary nesting) ──\n const pluginSchemas: TSchema[] = [];\n\n for (const custom of customComponents) {\n if (custom.versions.length > 0) {\n const latest = custom.versions.reduce((a, b) =>\n a.version > b.version ? a : b\n );\n const customDef: PptxStandardComponentDefinition = {\n name: custom.name,\n propsSchema: latest.propsSchema,\n hasChildren: latest.hasChildren ?? false,\n category: 'content',\n description: custom.name,\n };\n pluginSchemas.push(createPptxComponentSchemaObject(customDef, Self));\n }\n }\n\n // ── Phase 2: Build standard components with narrowed children ──\n const standardSchemas = createAllPptxComponentSchemasNarrowed(\n Self,\n pluginSchemas\n );\n\n const componentSchemas = [...standardSchemas, ...pluginSchemas];\n\n if (componentSchemas.length === 0) {\n return Type.Object({});\n }\n\n return Type.Union(componentSchemas);\n });\n}\n"],"mappings":";;;;;;AAMA,SAAS,YAAqB;AA4BvB,SAAS,8BACd,UAAiC,CAAC,GACzB;AACT,QAAM,EAAE,mBAAmB,CAAC,EAAE,IAAI;AAElC,SAAO,KAAK,UAAU,CAAC,SAAS;AAE9B,UAAM,gBAA2B,CAAC;AAElC,eAAW,UAAU,kBAAkB;AACrC,UAAI,OAAO,SAAS,SAAS,GAAG;AAC9B,cAAM,SAAS,OAAO,SAAS;AAAA,UAAO,CAAC,GAAG,MACxC,EAAE,UAAU,EAAE,UAAU,IAAI;AAAA,QAC9B;AACA,cAAM,YAA6C;AAAA,UACjD,MAAM,OAAO;AAAA,UACb,aAAa,OAAO;AAAA,UACpB,aAAa,OAAO,eAAe;AAAA,UACnC,UAAU;AAAA,UACV,aAAa,OAAO;AAAA,QACtB;AACA,sBAAc,KAAK,gCAAgC,WAAW,IAAI,CAAC;AAAA,MACrE;AAAA,IACF;AAGA,UAAM,kBAAkB;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAEA,UAAM,mBAAmB,CAAC,GAAG,iBAAiB,GAAG,aAAa;AAE9D,QAAI,iBAAiB,WAAW,GAAG;AACjC,aAAO,KAAK,OAAO,CAAC,CAAC;AAAA,IACvB;AAEA,WAAO,KAAK,MAAM,gBAAgB;AAAA,EACpC,CAAC;AACH;","names":[]}
|