@json-to-office/core-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.
@@ -4,12 +4,24 @@
4
4
  * convention uses '#'-prefixed values (e.g. '#FF0000').
5
5
  */
6
6
  import type { PptxThemeConfig, PipelineWarning } from '../types';
7
+ import { DEFAULT_CHART_THEME_COLORS } from '@json-to-office/shared';
7
8
  /**
8
- * Default series-color tokens for charts. Shared by the native `chart`
9
- * component and the `highcharts` component so both palettes stay in sync
10
- * with the active theme when the author sets no explicit colors.
9
+ * Default series-color tokens for charts, used by the native `chart` component
10
+ * and the `highcharts` component. Defined in @json-to-office/shared so the DOCX
11
+ * `highcharts` component resolves the same tokens; re-exported here because
12
+ * every PPTX call site already imports colors from this module.
11
13
  */
12
- export declare const DEFAULT_CHART_THEME_COLORS: string[];
14
+ export { DEFAULT_CHART_THEME_COLORS };
15
+ /**
16
+ * The default chart palette narrowed to the tokens this theme actually defines
17
+ * *and* can resolve to a color. Both PPTX chart paths build their implicit
18
+ * palette from this, so an unset accent4-6 is skipped — matching DOCX — instead
19
+ * of resolving to `primary` six times over, and a slot holding an unresolvable
20
+ * value is dropped rather than posted as `#primary`. Author-supplied colors must
21
+ * NOT go through here: naming an undefined token stays a loud `resolveColor`
22
+ * fallback + warning.
23
+ */
24
+ export declare function definedChartColorTokens(theme: PptxThemeConfig): string[];
13
25
  /**
14
26
  * Resolve a color value to bare hex (no '#' prefix).
15
27
  * Accepts hex colors (with or without '#') or semantic theme color names.
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAiBjE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,UAOtC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,EACtB,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,MAAM,CA8BR"}
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAgBpE;;;;;GAKG;AACH,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAoCtC;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,EAAE,CAWxE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,EACtB,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,MAAM,CAsCR"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Slide-targeted hyperlinks
3
+ *
4
+ * `hyperlink.slide` is 1-based over the slides *as authored* in the JSON —
5
+ * slides carrying `enabled: false` still count. Structure processing remaps
6
+ * every ref to the position its target ends up at in the generated deck, so
7
+ * toggling one slide off never silently retargets the links after it.
8
+ *
9
+ * A ref that cannot be resolved — target dropped, or index outside the
10
+ * authored range — is marked unresolved here and dropped by the writer with a
11
+ * warning. It must never reach pptxgenjs: it would emit a relationship to a
12
+ * `slideN.xml` part that is not in the archive, which PowerPoint reports as a
13
+ * damaged file.
14
+ */
15
+ import type { PipelineWarning, PptxComponentInput } from '../types';
16
+ export declare const HYPERLINK_SLIDE_UNRESOLVED = "HYPERLINK_SLIDE_UNRESOLVED";
17
+ export interface HyperlinkProps {
18
+ url?: string;
19
+ slide?: number;
20
+ tooltip?: string;
21
+ /** Internal: authored `slide` ref that resolves to no rendered slide. */
22
+ unresolvedSlideRef?: number;
23
+ }
24
+ /** Authored 1-based slide number -> rendered 1-based slide number. */
25
+ export type SlideIndexMap = ReadonlyMap<number, number>;
26
+ /**
27
+ * Rewrite `hyperlink.slide` in a bare props bag. Template placeholder
28
+ * `defaults` are merged into a component at render time without ever being a
29
+ * component themselves, so they need rebasing on their own — otherwise a
30
+ * `defaults.props.hyperlink.slide` reaches the writer as a raw authored index.
31
+ */
32
+ export declare function remapHyperlinkProps<T extends Record<string, unknown>>(props: T, map: SlideIndexMap): T;
33
+ /** Rewrite every `hyperlink.slide` in a component subtree. Returns a new tree. */
34
+ export declare function remapHyperlinkSlideRefs(component: PptxComponentInput, map: SlideIndexMap): PptxComponentInput;
35
+ /**
36
+ * Write the pptxgenjs `hyperlink` option, dropping unresolvable slide refs.
37
+ * Shared by every component that accepts a hyperlink.
38
+ */
39
+ export declare function applyHyperlink(opts: Record<string, unknown>, hyperlink: HyperlinkProps | undefined, componentName: string, warnings?: PipelineWarning[]): void;
40
+ //# sourceMappingURL=hyperlink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../../src/utils/hyperlink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEpE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAmBxD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,aAAa,GACjB,CAAC,CAMH;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,aAAa,GACjB,kBAAkB,CAqBpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,IAAI,CA2BN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-to-office/core-pptx",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Core PPTX presentation generation engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "jszip": "3.10.1",
23
23
  "pptxgenjs": "^3.12.0",
24
24
  "probe-image-size": "7.2.3",
25
- "@json-to-office/shared": "^0.16.0",
26
- "@json-to-office/shared-pptx": "^0.20.0"
25
+ "@json-to-office/shared": "^0.22.0",
26
+ "@json-to-office/shared-pptx": "^0.22.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "20.11.0",