@openpresentation/opf-editor 0.12.1 → 0.15.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.
Files changed (103) hide show
  1. package/README.md +122 -80
  2. package/dist/annotations.d.ts +16 -16
  3. package/dist/annotations.js +71 -79
  4. package/dist/assets.d.ts +7 -7
  5. package/dist/assets.js +16 -16
  6. package/dist/background-options.d.ts +12 -5
  7. package/dist/background-options.js +44 -19
  8. package/dist/block-controls.js +7 -7
  9. package/dist/block-convert.d.ts +7 -7
  10. package/dist/block-convert.js +22 -21
  11. package/dist/blocks.d.ts +8 -8
  12. package/dist/blocks.js +41 -40
  13. package/dist/canvas-fields.js +35 -12
  14. package/dist/canvas.d.ts +30 -31
  15. package/dist/canvas.js +64 -68
  16. package/dist/catalogs.d.ts +48 -0
  17. package/dist/catalogs.js +217 -0
  18. package/dist/chart-data.d.ts +10 -10
  19. package/dist/chart-data.js +21 -21
  20. package/dist/chart-options-panel.d.ts +2 -2
  21. package/dist/chart-options-panel.js +82 -8
  22. package/dist/chart-options.d.ts +35 -9
  23. package/dist/chart-options.js +133 -40
  24. package/dist/checks.js +23 -0
  25. package/dist/color-authoring.js +1 -1
  26. package/dist/content-actions.d.ts +17 -17
  27. package/dist/content-actions.js +74 -73
  28. package/dist/content-controls.js +21 -21
  29. package/dist/data-grid.js +7 -8
  30. package/dist/data.d.ts +4 -4
  31. package/dist/data.js +5 -5
  32. package/dist/dataset-refs.d.ts +2 -2
  33. package/dist/dataset-refs.js +5 -5
  34. package/dist/design-controls.d.ts +12 -5
  35. package/dist/design-controls.js +312 -111
  36. package/dist/design-options.d.ts +20 -18
  37. package/dist/design-options.js +91 -99
  38. package/dist/edit-helpers.js +8 -7
  39. package/dist/exact-source.js +5 -5
  40. package/dist/export.d.ts +7 -7
  41. package/dist/export.js +48 -17
  42. package/dist/find-panel.js +5 -5
  43. package/dist/find-replace.d.ts +3 -3
  44. package/dist/find-replace.js +23 -20
  45. package/dist/font-gate.js +49 -58
  46. package/dist/galleries.js +50 -101
  47. package/dist/grid-model.d.ts +25 -27
  48. package/dist/grid-model.js +92 -102
  49. package/dist/image-crop.d.ts +4 -4
  50. package/dist/image-crop.js +28 -29
  51. package/dist/image-cropper.js +3 -3
  52. package/dist/image-options.d.ts +45 -0
  53. package/dist/image-options.js +195 -0
  54. package/dist/index.d.ts +48 -31
  55. package/dist/index.js +154 -126
  56. package/dist/json-editor.js +2 -2
  57. package/dist/json-menu.js +2 -2
  58. package/dist/json-options.d.ts +3 -3
  59. package/dist/json-options.js +44 -54
  60. package/dist/layout-handles.js +5 -5
  61. package/dist/layout-placeholders.js +4 -4
  62. package/dist/layout.d.ts +2 -2
  63. package/dist/layout.js +8 -7
  64. package/dist/numbering-panel.js +3 -5
  65. package/dist/numbering.d.ts +3 -5
  66. package/dist/numbering.js +14 -26
  67. package/dist/outline-view.js +24 -24
  68. package/dist/outline.d.ts +12 -12
  69. package/dist/outline.js +52 -50
  70. package/dist/persistence.d.ts +1 -1
  71. package/dist/persistence.js +19 -18
  72. package/dist/presentation-ids.js +2 -2
  73. package/dist/react.js +3 -3
  74. package/dist/review-panel.d.ts +30 -13
  75. package/dist/review-panel.js +160 -53
  76. package/dist/review.d.ts +36 -43
  77. package/dist/review.js +92 -53
  78. package/dist/rich-text-input.js +4 -3
  79. package/dist/rich-text-toolbar.js +5 -3
  80. package/dist/rich-text.js +5 -2
  81. package/dist/schema-inspector.d.ts +2 -2
  82. package/dist/schema-inspector.js +16 -11
  83. package/dist/schema.d.ts +1 -1
  84. package/dist/schema.js +26 -6
  85. package/dist/slide-manager.d.ts +2 -2
  86. package/dist/slide-manager.js +19 -19
  87. package/dist/slides.d.ts +21 -21
  88. package/dist/slides.js +104 -101
  89. package/dist/svelte.js +2 -3
  90. package/dist/switches.d.ts +37 -22
  91. package/dist/switches.js +282 -171
  92. package/dist/table-options.d.ts +8 -8
  93. package/dist/table-options.js +28 -27
  94. package/dist/table-structure.d.ts +10 -10
  95. package/dist/table-structure.js +21 -21
  96. package/dist/template-panel.d.ts +3 -3
  97. package/dist/template-panel.js +37 -13
  98. package/dist/templates.d.ts +22 -11
  99. package/dist/templates.js +48 -55
  100. package/dist/transfer.d.ts +15 -4
  101. package/dist/transfer.js +107 -161
  102. package/package.json +12 -6
  103. package/dist/font-defaults.js +0 -25
@@ -1,8 +1,16 @@
1
1
  import type { ConvertOptions } from "@openpresentation/opf/convert";
2
+ import type { Catalog } from "@openpresentation/opf";
2
3
  import type { EditorChange, EditorSession, JsonPatchOperation } from "./index.js";
3
4
 
5
+ /** Display metadata for the engine vocabularies, in the shape of `catalogDisplay` (`@openpresentation/opf/catalog`): records by id, or a list of records with `id` (`bcp47` for a language). */
6
+ export interface SwitchVocabularies {
7
+ languages?: unknown;
8
+ chartTypes?: unknown;
9
+ socialPlatforms?: unknown;
10
+ }
11
+
4
12
  /** The schema's DimensionPreset values: the values of the slide-sizes switch. */
5
- export declare const SLIDE_SIZE_PRESETS: readonly ["16:9", "4:3", "16:10", "letter", "a4", "widescreen", "standard"];
13
+ export declare const SLIDE_SIZE_PRESETS: readonly ["16:9", "4:3", "16:10", "1:1", "4:5", "9:16", "letter", "a4", "widescreen", "standard"];
6
14
  export type SlideSizePreset = (typeof SLIDE_SIZE_PRESETS)[number];
7
15
 
8
16
  /** Every switchable dimension: the 14 pptx.gallery dimensions, then `slide-sizes` and `purposes`. */
@@ -29,16 +37,19 @@ export type SwitchDimension = (typeof SWITCH_DIMENSIONS)[number];
29
37
  export interface DimensionSwitchOptions {
30
38
  /** Required for layouts and charts; for design dimensions it scopes the switch to one slide (default: the deck). */
31
39
  slideIndex?: number;
32
- /** blocks: the complete block (`slides.0.blocks.1`) or one-payload slide/region to replace. charts: the block holding the chart (default: the slide's first chart). */
40
+ /** blocks: the complete block (`slides.0.blocks.1`) or one-payload slide/region to replace. charts: the block holding the chart (default: the slide's first chart). image-treatments: the image block. */
33
41
  path?: string | string[];
34
- /** A gallery item's catalog record, added inline in the same transaction when the id is not already defined. */
42
+ /** A gallery item's catalog record, embedded in the same transaction (under the group of `recordSource`, else `custom`) when it is not embedded yet. */
35
43
  record?: Record<string, unknown> & { id: string };
36
- /** Extra caller-loaded catalog records by kind. */
37
- catalogs?: Record<string, unknown>;
38
- catalogSources?: Record<string, unknown>;
39
- /** themes: also write the theme's color scheme, font scheme, background and dimensions to the deck design (default true). */
44
+ /** The catalog source of `record` (for example "https://www.pptx.gallery"). */
45
+ recordSource?: string;
46
+ /** Host catalogs (`Catalog[]`): references resolve in the document, then in these. */
47
+ catalogs?: readonly Catalog[];
48
+ /** Display metadata for languages, chart types and social platforms (labels in pickers). */
49
+ vocabularies?: SwitchVocabularies;
50
+ /** themes: the theme's own color scheme, font scheme and background (and, for the deck, dimensions) apply: overrides of those at the switched scope are removed; on a slide whose deck sets one, the theme's value is written on the slide (default true). */
40
51
  bundle?: boolean;
41
- /** Deck-scope design switches (and slide-sizes): remove slide-level values that would hide the switch. */
52
+ /** Deck-scope design switches: remove slide-level values that would hide the switch. */
42
53
  clearSlideOverrides?: boolean;
43
54
  /** socials: which document field holds the handle (default "speaker") and, for an array, which entry (default 0). */
44
55
  owner?: "speaker" | "organization";
@@ -55,18 +66,17 @@ export interface DimensionSwitchOptions {
55
66
 
56
67
  export type DimensionSwitchValue =
57
68
  | null /* backgrounds: remove it */
58
- | string /* slide-sizes: a SlideSizePreset. purposes: a catalog id or free-form goal text. */
59
- | string[] /* audiences: catalog ids */
69
+ | string /* slide-sizes: a SlideSizePreset. purposes: a catalog reference or free-form goal text. languages: a BCP-47 tag. Catalog dimensions: a reference, `id` or `name:id`. */
70
+ | string[] /* audiences: catalog references */
60
71
  | { platform: string; handle: string }
61
72
  | { header?: unknown; footer?: unknown }
62
- | { slideImage?: unknown; imageFill?: string | null }
63
- | Record<string, unknown>;
73
+ | Record<string, unknown> /* image-treatments: fit, focus, aspectRatio, shape, cornerRadius, border, opacity, recolor, overlay, placement (null removes) */;
64
74
 
65
75
  export interface PreparedDimensionSwitch {
66
76
  dimension: SwitchDimension;
67
77
  scope: "deck" | "slide" | "block";
68
78
  slideIndex?: number;
69
- document: unknown;
79
+ presentation: unknown;
70
80
  patches: JsonPatchOperation[];
71
81
  changed: boolean;
72
82
  /** Slides whose own design hides a deck-level switch. */
@@ -75,8 +85,8 @@ export interface PreparedDimensionSwitch {
75
85
  loss?: string[];
76
86
  }
77
87
 
78
- export interface DimensionSwitchChange extends Omit<EditorChange, "document" | "patches"> {
79
- document: unknown;
88
+ export interface DimensionSwitchChange extends Omit<EditorChange, "presentation" | "patches"> {
89
+ presentation: unknown;
80
90
  patches: JsonPatchOperation[];
81
91
  dimension: SwitchDimension;
82
92
  scope: "deck" | "slide" | "block";
@@ -87,23 +97,28 @@ export interface DimensionSwitchChange extends Omit<EditorChange, "document" | "
87
97
  }
88
98
 
89
99
  /** Compute and validate the patch for one dimension without changing any session. */
90
- export declare function prepareDimensionSwitch(document: unknown, dimension: SwitchDimension, value: DimensionSwitchValue, options?: DimensionSwitchOptions): PreparedDimensionSwitch;
100
+ export declare function prepareDimensionSwitch(presentation: unknown, dimension: SwitchDimension, value: DimensionSwitchValue, options?: DimensionSwitchOptions): PreparedDimensionSwitch;
91
101
  /** Apply one dimension switch to a session as a single undoable transaction. */
92
102
  export declare function switchDimension(editor: EditorSession, dimension: SwitchDimension, value: DimensionSwitchValue, options?: DimensionSwitchOptions): DimensionSwitchChange;
93
103
 
94
104
  export interface SwitchOption {
105
+ /** The value to switch to: for a catalog dimension the reference, `id` or `name:id`. */
95
106
  id: string;
96
107
  label: string;
97
108
  record?: Record<string, unknown>;
109
+ reference?: string;
110
+ group?: string;
111
+ source?: string;
112
+ origin?: "document" | "host";
98
113
  }
99
114
  export interface CompatibleChartType extends SwitchOption {
100
115
  /** True for the chart's present type, which is always listed. */
101
116
  current: boolean;
102
117
  }
103
- /** Values a picker can offer for a catalog-backed dimension (document inline records, caller catalogs, then the bundled catalog, without duplicates); `blocks` lists the content kinds and `slide-sizes` the presets (labelled with their inches). `purposes` lists the catalog; any other goal text is also a valid switch value. */
104
- export declare function listSwitchOptions(document: unknown, dimension: SwitchDimension, options?: Pick<DimensionSwitchOptions, "catalogs" | "catalogSources">): SwitchOption[];
105
- /** Chart types the chart's inline data can use as it is (data-shape compatibility, not an engine-support claim). `path` or `slideIndex` picks the chart. */
106
- export declare function compatibleChartTypes(document: unknown, options?: Pick<DimensionSwitchOptions, "slideIndex" | "path" | "catalogs" | "catalogSources">): CompatibleChartType[];
107
- /** The value a dimension currently has: `{ value, scope }`, with the catalog id for catalog dimensions. `slide-sizes` reads the deck's design.dimensions, else its theme's (a preset string, or the object for a custom size); `purposes` reads the goal text or Purpose id. */
108
- export declare function currentSwitchValue(document: unknown, dimension: SwitchDimension, options?: Pick<DimensionSwitchOptions, "slideIndex" | "path" | "owner" | "index">): { value: unknown; scope: "deck" | "slide" | "block" };
118
+ /** Values a picker can offer: a catalog dimension lists core's `catalogRecords` (embedded records, then `catalogs`); `charts` and `socials` list core's vocabularies, `languages` core's `LANGUAGES` tags; `blocks` lists the content kinds and `slide-sizes` the presets. `purposes` lists the catalogs; any other goal text is also a valid switch value. */
119
+ export declare function listSwitchOptions(presentation: unknown, dimension: SwitchDimension, options?: Pick<DimensionSwitchOptions, "catalogs" | "vocabularies">): SwitchOption[];
120
+ /** Chart types the chart's inline data can use as it is (data-shape compatibility from `vocabularies.chartTypes`, not an engine-support claim). `path` or `slideIndex` picks the chart. */
121
+ export declare function compatibleChartTypes(presentation: unknown, options?: Pick<DimensionSwitchOptions, "slideIndex" | "path" | "catalogs" | "vocabularies">): CompatibleChartType[];
122
+ /** The value a dimension currently has: `{ value, scope }`, with the reference (`id` or `name:id`) for catalog dimensions. `slide-sizes` reads the deck's design.dimensions, else its theme's (a preset string, or the object for a custom size); `purposes` reads the goal text or Purpose id. */
123
+ export declare function currentSwitchValue(presentation: unknown, dimension: SwitchDimension, options?: Pick<DimensionSwitchOptions, "slideIndex" | "path" | "owner" | "index" | "catalogs">): { value: unknown; scope: "deck" | "slide" | "block" };
109
124
  export { blockConversionTargets } from "./block-convert.js";