@json-to-office/shared 0.21.0 → 0.25.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/index.d.ts +38 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/dist/schemas/slide-content.d.ts +231 -11
- package/dist/schemas/slide-content.js +302 -3
- package/dist/schemas/slide-content.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -517,6 +517,43 @@ interface ApplyExportModeResult<D, T> {
|
|
|
517
517
|
*/
|
|
518
518
|
declare function applyExportMode<D, T>(input: ApplyExportModeInput<D, T>): ApplyExportModeResult<D, T>;
|
|
519
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Default series-color tokens for charts. Single source of truth for every
|
|
522
|
+
* format: the PPTX `chart` and `highcharts` components and the DOCX
|
|
523
|
+
* `highcharts` component all resolve this list, in this order, against the
|
|
524
|
+
* active theme when the author sets no explicit colors. Both theme schemas
|
|
525
|
+
* declare all six tokens (accent4-6 optional in each), so a theme that fills
|
|
526
|
+
* every slot produces the same palette in a deck and in a document.
|
|
527
|
+
*
|
|
528
|
+
* Slots the theme leaves unset are skipped in both formats: the implicit
|
|
529
|
+
* palette shrinks and the chart library cycles the shorter list rather than
|
|
530
|
+
* repeating `primary` for every empty slot. A theme carrying only
|
|
531
|
+
* primary/secondary/accent — which is what the bundled DOCX themes carry —
|
|
532
|
+
* therefore paints series 4+ identically in a deck and in a document.
|
|
533
|
+
*
|
|
534
|
+
* Skipping compacts holes: a theme defining accent5 but not accent4 yields
|
|
535
|
+
* [primary, secondary, accent, accent5], so accent5 paints series 4. The list
|
|
536
|
+
* is a preference-ordered pool of candidate colors, not fixed per-series slots,
|
|
537
|
+
* so keeping a color the theme did define beats dropping or duplicating one.
|
|
538
|
+
*
|
|
539
|
+
* A slot may also hold another token's name (`"accent4": "primary"`) — both
|
|
540
|
+
* theme schemas allow it — and both formats walk that reference to hex before
|
|
541
|
+
* using it, so a chained slot lands on the same color in a deck as in a
|
|
542
|
+
* document. A slot whose value reaches no hex (`"accent4": "nonsense"`, or a
|
|
543
|
+
* reference cycle) is dropped from the implicit palette in both formats rather
|
|
544
|
+
* than emitted verbatim: PowerPoint and Highcharts both answer an unparseable
|
|
545
|
+
* color with silent black. Parity here covers the token names the two schemas
|
|
546
|
+
* share; each format also has private color keys (DOCX `textSecondary`, PPTX
|
|
547
|
+
* `text2`) that only resolve in their own format.
|
|
548
|
+
*
|
|
549
|
+
* Only the implicit palette skips. An author who names a token explicitly
|
|
550
|
+
* (PPTX `chartColors: ['accent4']`) still gets the `primary` fallback and a
|
|
551
|
+
* warning — naming an undefined token is an authoring error and stays loud.
|
|
552
|
+
* PPTX warns THEME_COLOR_FALLBACK for an unset slot and UNKNOWN_COLOR for one
|
|
553
|
+
* holding an unresolvable value; DOCX throws.
|
|
554
|
+
*/
|
|
555
|
+
declare const DEFAULT_CHART_THEME_COLORS: string[];
|
|
556
|
+
|
|
520
557
|
/**
|
|
521
558
|
* Deep Merge Utilities
|
|
522
559
|
* Generic deep-merge helpers used by both docx and pptx
|
|
@@ -530,4 +567,4 @@ declare function applyExportMode<D, T>(input: ApplyExportModeInput<D, T>): Apply
|
|
|
530
567
|
*/
|
|
531
568
|
declare function mergeWithDefaults<T>(userConfig: T, themeDefaults: Partial<T>): T;
|
|
532
569
|
|
|
533
|
-
export { DEFAULT_VISUAL_DPI, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, type HighchartsHeaders, type HighchartsHeadersResolver, type HighchartsServiceConfig, MAX_VISUAL_DPI, MIN_VISUAL_DPI, POPULAR_GOOGLE_FONTS, type PopularGoogleFont, type PptxRasterizeRequest, type PptxRasterizeResult, type PptxRasterizer, type PptxServiceConfig, type PptxServiceHeaders, type PptxServiceHeadersResolver, ResolvedFont, ResolvedFontSource, type ServicesConfig, type SynthesizedFamily, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyExportMode, applyFontSubstitution, buildDefaultSubstitutionMap, clampVisualDpi, collectFontNamesFromDocx, collectFontNamesFromPptx, defaultSubstituteFor, detectFontFormat, fetchGoogleFontSources, getUpstreamOverride, mergeWithDefaults, rewriteFontFamilyName, scopedThemeName, synthesizeFamilyName, validateFontReferences };
|
|
570
|
+
export { DEFAULT_CHART_THEME_COLORS, DEFAULT_VISUAL_DPI, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, type HighchartsHeaders, type HighchartsHeadersResolver, type HighchartsServiceConfig, MAX_VISUAL_DPI, MIN_VISUAL_DPI, POPULAR_GOOGLE_FONTS, type PopularGoogleFont, type PptxRasterizeRequest, type PptxRasterizeResult, type PptxRasterizer, type PptxServiceConfig, type PptxServiceHeaders, type PptxServiceHeadersResolver, ResolvedFont, ResolvedFontSource, type ServicesConfig, type SynthesizedFamily, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyExportMode, applyFontSubstitution, buildDefaultSubstitutionMap, clampVisualDpi, collectFontNamesFromDocx, collectFontNamesFromPptx, defaultSubstituteFor, detectFontFormat, fetchGoogleFontSources, getUpstreamOverride, mergeWithDefaults, rewriteFontFamilyName, scopedThemeName, synthesizeFamilyName, validateFontReferences };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,21 @@ import {
|
|
|
2
2
|
detectFontFormat,
|
|
3
3
|
isAllowedFontUrl
|
|
4
4
|
} from "./chunk-CP2I5NPP.js";
|
|
5
|
+
import {
|
|
6
|
+
convertToJsonSchema,
|
|
7
|
+
createComponentSchema,
|
|
8
|
+
createComponentSchemaObject,
|
|
9
|
+
exportSchemaToFile,
|
|
10
|
+
fixSchemaReferences
|
|
11
|
+
} from "./chunk-5J43F4XD.js";
|
|
12
|
+
import {
|
|
13
|
+
FontFamilyNameSchema,
|
|
14
|
+
FontRegistryEntrySchema,
|
|
15
|
+
FontRegistrySchema,
|
|
16
|
+
FontSourceSchema,
|
|
17
|
+
SAFE_FONTS,
|
|
18
|
+
isSafeFont
|
|
19
|
+
} from "./chunk-6KUQYVPT.js";
|
|
5
20
|
import {
|
|
6
21
|
ComponentValidationError,
|
|
7
22
|
DuplicateComponentError,
|
|
@@ -33,21 +48,6 @@ import {
|
|
|
33
48
|
transformValueError,
|
|
34
49
|
transformValueErrors
|
|
35
50
|
} from "./chunk-ZKD5BAMU.js";
|
|
36
|
-
import {
|
|
37
|
-
convertToJsonSchema,
|
|
38
|
-
createComponentSchema,
|
|
39
|
-
createComponentSchemaObject,
|
|
40
|
-
exportSchemaToFile,
|
|
41
|
-
fixSchemaReferences
|
|
42
|
-
} from "./chunk-5J43F4XD.js";
|
|
43
|
-
import {
|
|
44
|
-
FontFamilyNameSchema,
|
|
45
|
-
FontRegistryEntrySchema,
|
|
46
|
-
FontRegistrySchema,
|
|
47
|
-
FontSourceSchema,
|
|
48
|
-
SAFE_FONTS,
|
|
49
|
-
isSafeFont
|
|
50
|
-
} from "./chunk-6KUQYVPT.js";
|
|
51
51
|
import {
|
|
52
52
|
compareSemver,
|
|
53
53
|
isValidSemver,
|
|
@@ -1356,6 +1356,16 @@ function applyExportMode(input) {
|
|
|
1356
1356
|
};
|
|
1357
1357
|
}
|
|
1358
1358
|
|
|
1359
|
+
// src/theme/chart-palette.ts
|
|
1360
|
+
var DEFAULT_CHART_THEME_COLORS = [
|
|
1361
|
+
"primary",
|
|
1362
|
+
"secondary",
|
|
1363
|
+
"accent",
|
|
1364
|
+
"accent4",
|
|
1365
|
+
"accent5",
|
|
1366
|
+
"accent6"
|
|
1367
|
+
];
|
|
1368
|
+
|
|
1359
1369
|
// src/utils/deepMerge.ts
|
|
1360
1370
|
function isObject(item) {
|
|
1361
1371
|
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
@@ -1382,6 +1392,7 @@ function mergeWithDefaults(userConfig, themeDefaults) {
|
|
|
1382
1392
|
}
|
|
1383
1393
|
export {
|
|
1384
1394
|
ComponentValidationError,
|
|
1395
|
+
DEFAULT_CHART_THEME_COLORS,
|
|
1385
1396
|
DEFAULT_ERROR_CONFIG,
|
|
1386
1397
|
DEFAULT_VISUAL_DPI,
|
|
1387
1398
|
DuplicateComponentError,
|