@openpresentation/gallery 0.0.1 → 2.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 2.0.0 (2026-10-11)
6
+
7
+ - **Breaking: replace the 278 placeholder layouts of 1.x with 28 OPF 0.19 intent layouts.** Records now use `opf-layout/v2` grid templates with `areas`, `columns`, `rows` and typed content regions; `CATALOG_SCHEMA` and `opf.catalogSchema` are `2`. Consumers require `@openpresentation/opf` 0.19 or later. There are no v1 aliases or migration APIs. Six old ids remain with new template semantics: `agenda`, `comparison`, `dashboard`, `faq`, `timeline` and `two-column`. Other old ids no longer resolve in this catalog. Boxed treatment, direction, alignment, image fit and item images are design settings rather than layout variants.
8
+ - The six intent groups are openers and closers (`cover`, `section`, `agenda`, `statement`, `closing`); text (`text`, `list`, `quote`, `two-column`); groups of items (`pillars`, `comparison`, `process`, `timeline`, `faq`); numbers (`metrics`, `scorecard`); visuals (`image`, `image-beside`, `gallery`, `chart`, `chart-beside`, `table`, `table-beside`, `code`); mixed (`hero`, `dashboard`, `team`, `logos`). Gallery owns these layout records directly. Each has an authored usage description and SVG preview link; layout index entries include `summary` and `group`. The `image` and `image-beside` templates preserve whole-picture `imageFit: contain`.
9
+ - **Breaking preview contract:** `@openpresentation/gallery/previews` provides one SVG per layout id instead of the 70 HTML slide-archetype thumbnails. `npm run previews` generates them and `npm run check:previews` checks them. Schema 2 establishes a new major-version pixel-stability baseline, with filled and empty region cases retained.
10
+ - Narrative beats now name existing v2 intent layouts, preserving narrative prose and the other beat fields. Themes, colour schemes, font schemes, audiences, purposes and tones remain unchanged. The published package remains dependency-free and registers through `catalogs: [gallery]`; OPF 0.19 obtains the default catalog from this package instead of a core-owned snapshot.
11
+ - Build tooling for this first schema-2 release can validate and draw the catalog using exact merged core/renderer sources before their registry releases. It stages development tarballs with original versions and unchanged runtime bytes, records original/staged manifests and integrity, and verifies a shared core/gallery installation. Bootstrap leaves the release package metadata and built catalog bytes intact; merged-source, preview, stability and trusted-publication gates still apply. This bootstrap is build tooling, not native acceptance or publication of the engine packages.
12
+
13
+ ## 1.0.0 (2026-10-10)
14
+
15
+ Released from `3458f50`; the original tagged changelog kept this entry under Unreleased.
16
+
17
+ - First release of `@openpresentation/gallery` from OpenPresentation/gallery: the pptx.gallery catalog on its own version line. `import { gallery } from "@openpresentation/gallery"` and register it with `catalogs: [gallery]`. It holds the records that `@openpresentation/opf/catalog`'s `defaultCatalog` held up to OPF 0.18: 278 layouts, 4 themes, 14 colour schemes, 89 font schemes, 48 narratives, 16 audiences, 9 purposes and 7 tones. The package also exports `GALLERY_SOURCE`, `CATALOG_SCHEMA` (`1`, also `opf.catalogSchema` in `package.json`), `catalogDisplay`, `catalogIndexes` and `catalogManifest`; `@openpresentation/gallery/previews` exports the layout previews. It has no dependency, not even for its types: `GalleryCatalog` has the shape of core's `Catalog`. New records are a minor release; a removed or renamed id or a changed drawing is a major release, which CI enforces by drawing every existing layout, theme, colour scheme and font scheme against the previous published release. Replaces the 0.0.1 placeholder.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenPresentation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,2 +1,145 @@
1
- # @openpresentation/gallery
2
- The pptx.gallery catalog for OPF. `import { gallery } from "@openpresentation/gallery"`, then pass `catalogs: [gallery]`.
1
+ # gallery
2
+
3
+ The default catalog for Open Presentation: layouts, themes, colour schemes and font schemes for OPF decks, published as
4
+ [`@openpresentation/gallery`](https://www.npmjs.com/package/@openpresentation/gallery) and previewed at
5
+ [pptx.gallery](https://www.pptx.gallery).
6
+
7
+ It holds every layout, theme, colour scheme, font scheme, narrative, audience, purpose and tone that
8
+ [OPF](https://openpresentation.org) decks name by id (`layout: "pillars"`, `design: { theme: "minimal" }`). Engines
9
+ never fetch records: a host registers the catalogs it trusts, and this package is the catalog every OPF host registers by
10
+ default.
11
+
12
+ **2.x is the catalog of OPF 0.19 and later.** Its layouts are the 28 OPF 0.19 layouts named by intent, written as grid
13
+ templates (`opf-layout/v2`); they need `@openpresentation/opf` 0.19 or later. 1.x holds the 278 OPF 0.18 layouts. 2.0.0
14
+ changed the layouts with no migration path: see [Layouts](#layouts) and the [changelog](CHANGELOG.md).
15
+
16
+ ## Use
17
+
18
+ ```sh
19
+ npm install @openpresentation/gallery
20
+ ```
21
+
22
+ ```js
23
+ import { validate } from "@openpresentation/opf";
24
+ import { gallery } from "@openpresentation/gallery";
25
+
26
+ validate(deck, { catalogs: [gallery] });
27
+ ```
28
+
29
+ Pass `catalogs: [gallery]` to every entry point that resolves references: core's `validate`, `paginate`, `embed` and
30
+ `resolveSlideContext`, and opf-render, opf-pptx and opf-editor, which pass the option through to core. The first
31
+ registered catalog is the default for bare ids. From OPF 0.19, `@openpresentation/opf` depends on this package and its
32
+ Node functions (and the `opf` command) register `gallery` when a call names no catalogs; a browser host registers it
33
+ itself. Save decks with their records embedded (`embed`), so they draw the same whichever gallery version a host
34
+ registers later.
35
+
36
+ | Export | What it is |
37
+ | --- | --- |
38
+ | `gallery` | The content records by kind and then by id, without `$schema`, `id` or `x-*` members, with `source: "https://www.pptx.gallery"` |
39
+ | `GALLERY_SOURCE` | `https://www.pptx.gallery`, the `source` of a document's `catalogs.default` |
40
+ | `CATALOG_SCHEMA` | The version of core's catalog record schemas these records target (also `opf.catalogSchema` in `package.json`): `2`, the layouts are `opf-layout/v2` grid templates |
41
+ | `catalogDisplay` | Display metadata for pickers: `chartTypes`, `languages` and `socialPlatforms` by id |
42
+ | `catalogIndexes` | Each kind's `index.json`: the record summaries and their content hash (a layout's entry also has its `summary` and `group`) |
43
+ | `catalogManifest` | The pptx.gallery commit the 1.x records were taken from, and a content hash per kind |
44
+
45
+ `@openpresentation/gallery/previews` exports one SVG preview per layout, keyed by the layout id (`layoutPreviews`,
46
+ `layoutPreviewIndex`, `layoutPreviewSlugs`, `getLayoutPreview`, `hasLayoutPreview`): the layout drawn with sample
47
+ content in every region by the pinned `@openpresentation/opf-render`, a self-contained `<svg>` with a 16:9 viewBox. The
48
+ package has no dependency, not even for its types: `GalleryCatalog` has the shape of core's `Catalog`, so `gallery` is
49
+ assignable to it.
50
+
51
+ ## Layouts
52
+
53
+ A slide names a layout by intent; its content flows into the layout's regions, so no layout fixes a block count.
54
+ Variants are design settings on the slide or the deck, not layout ids: cards (`design.contentBox`), one row or one
55
+ column (`contentDirection`), title and content alignment (`titleAlignment`, `contentAlignment`), picture fit
56
+ (`imageFit`) and image bullets (`listBullet`), which a theme can also set, and a mirrored side (`mirror`). A slide with no layout composes
57
+ automatically. A deck's own layouts are records of the same schema under `catalogs.custom.layouts`.
58
+
59
+ | Layout | When to use it |
60
+ | --- | --- |
61
+ | **Openers and closers** | |
62
+ | `cover` | The opening slide: title, subtitle and an optional picture. |
63
+ | `section` | A divider between parts: the section title and an optional subtitle. |
64
+ | `agenda` | What the talk covers: the parts, as one list that flows into columns when long. |
65
+ | `statement` | One message, large and alone. |
66
+ | `closing` | The last slide: thanks, the call to action and contact details. |
67
+ | **Text** | |
68
+ | `text` | Prose. Several blocks sit side by side when short and stack when long. |
69
+ | `list` | Bulleted or numbered points; one long list flows into columns. |
70
+ | `quote` | One or more quotations with attribution and photo. |
71
+ | `two-column` | Two independent columns of any content. |
72
+ | **Groups of items** | |
73
+ | `pillars` | Two to six ideas of equal weight, as cards. |
74
+ | `comparison` | Two options side by side (before and after, pros and cons, us and them), with an optional verdict. |
75
+ | `process` | Steps in order, in one row. |
76
+ | `timeline` | Dated events or a roadmap along one axis, with optional notes. |
77
+ | `faq` | Questions with their answers. |
78
+ | **Numbers** | |
79
+ | `metrics` | One to six headline numbers, with an optional note. |
80
+ | `scorecard` | Metrics with commentary or status, as cards. |
81
+ | **Visuals** | |
82
+ | `image` | One picture edge to edge under an optional title. |
83
+ | `image-beside` | A picture or video beside text. |
84
+ | `gallery` | One to six framed pictures: a screenshot, a diagram, a photo set. |
85
+ | `chart` | One to six charts, with an optional note. |
86
+ | `chart-beside` | A chart with the takeaway beside it. |
87
+ | `table` | A table across the slide, with an optional note. |
88
+ | `table-beside` | A table with commentary beside it. |
89
+ | `code` | Source code with the explanation beside it. |
90
+ | **Mixed** | |
91
+ | `hero` | A lead message with a picture and supporting points. |
92
+ | `dashboard` | Headline numbers over charts. |
93
+ | `team` | People: photo, name and role cards. |
94
+ | `logos` | Customer, partner or sponsor logos in a grid of up to 12. |
95
+
96
+ The 1.x ids `agenda`, `comparison`, `dashboard`, `faq`, `timeline` and `two-column` are 2.x layouts of the same id. Every
97
+ other 1.x layout id is gone, with no alias: a deck that names one finds no layout (`opf/unresolved-reference`) and its
98
+ slides compose automatically, unless the deck embeds the old record.
99
+
100
+ ## Versions
101
+
102
+ The gallery has its own version line, independent of the OPF engine packages. Releases are tagged `vX.Y.Z`.
103
+
104
+ - **Minor:** new records. Every existing record draws exactly as in the previous release.
105
+ - **Major:** an id removed or renamed, a change to how an existing record draws, or a change that needs a newer record
106
+ schema (`CATALOG_SCHEMA`).
107
+ - **Patch:** fixes that change no record's drawing (text a drawing never shows, such as a name or a summary; the package
108
+ code; the declarations).
109
+
110
+ The pixel-stability check enforces the rule (`npm run check:stability`, `scripts/stability.mjs`). It runs on every pull
111
+ request and before every publish. It takes the highest published version at or below the candidate's, and for every
112
+ layout, theme, colour scheme and font scheme both releases have, it draws a fixture deck with the pinned published
113
+ `@openpresentation/opf` and `@openpresentation/opf-render`, once per release: for a layout, a slide with sample content
114
+ in every region (three blocks in a flowing region, one in a `none` region) and a slide with every region empty, which
115
+ exercises collapse; for a design record, a six-slide sample deck. SVG bytes are compared first; a mismatch is rasterized
116
+ to count the pixels that differ. A changed drawing, a removed id or a new `CATALOG_SCHEMA` fails unless the major version
117
+ goes up. New ids pass. 2.0.0 is a new baseline: it is compared with 1.x for the record only, and every 2.x minor and
118
+ patch is held to the 2.x release below it.
119
+
120
+ ## Where the records come from
121
+
122
+ - **Layouts** are written here, in `catalog/layouts/`: one short `opf-layout/v2` record per layout, reviewed as code.
123
+ - **The other kinds** (themes, colour and font schemes, narratives, audiences, purposes, tones and the display kinds) are
124
+ unchanged from 1.x: the pinned snapshot of the catalog pptx.gallery published at
125
+ `https://www.pptx.gallery/<kind>/index.json`, with the pptx.gallery commit in `catalog/manifest.json`.
126
+ - `scripts/sync-gallery-catalog.mjs` took the 1.x records from a pptx.gallery checkout (`npm run sync`). pptx.gallery
127
+ publishes the 1.x layouts, so a sync now refuses to run: it would remove the 28 layouts. pptx.gallery reads its records
128
+ from this package from 2.0.0, and the sync is retired with that change.
129
+
130
+ ## Contributing a layout
131
+
132
+ 1. Write the record in `catalog/layouts/<id>.json` (`$schema` `https://openpresentation.org/schema/opf-layout/v2`,
133
+ `id`, `name`, `summary`, `tags` with its group, `areas`, `columns`, `rows`, `regions` and any `design`) and add its
134
+ entry (`id`, `name`, `summary`, `group`, `file`) to `catalog/layouts/index.json` in picker order. A new layout gets a
135
+ new id; an existing id never changes meaning.
136
+ 2. `npm run rehash` (the index and manifest hashes), then `npm run previews` (its SVG preview).
137
+ 3. Run `npm test` and `npm run check:stability`. A new layout is a minor release; if the check reports a changed record,
138
+ restore it or make the release a major one.
139
+ 4. Open a pull request here with a `CHANGELOG.md` entry under `## Unreleased`.
140
+
141
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the checks, releases and the license.
142
+
143
+ ## License
144
+
145
+ [MIT](LICENSE). The records, the previews and the code are all under it; `npm run check:license` checks it.
@@ -0,0 +1,100 @@
1
+ // @openpresentation/gallery: the pptx.gallery catalog for OPF (RR-78).
2
+ //
3
+ // import { gallery } from "@openpresentation/gallery";
4
+ // validate(deck, { catalogs: [gallery] });
5
+ //
6
+ // The package has no dependency, not even for its types: core depends on it, so its declarations are self-contained.
7
+ // `GalleryCatalog` has the shape of core's `Catalog` (@openpresentation/opf), so `gallery` is assignable to it; the
8
+ // package's type test (test/types.ts) checks that against core's own declarations.
9
+
10
+ /** The source the gallery is registered under, and the `source` of a document's `catalogs.default`. */
11
+ export declare const GALLERY_SOURCE: "https://www.pptx.gallery";
12
+
13
+ /**
14
+ * The version of core's catalog record schemas these records target (package.json `opf.catalogSchema`). 2: the layouts
15
+ * are OPF 0.19 grid templates (`opf-layout/v2`); every other kind is unchanged from 1.
16
+ */
17
+ export declare const CATALOG_SCHEMA: 2;
18
+
19
+ /** Records of one kind, keyed by id (core's `CatalogRecordMap`). */
20
+ export type GalleryRecords = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
21
+
22
+ /** The gallery as a registered catalog: core's `Catalog` shape, `source` and the eight content kinds. */
23
+ export interface GalleryCatalog {
24
+ readonly source: typeof GALLERY_SOURCE;
25
+ readonly layouts: GalleryRecords;
26
+ readonly themes: GalleryRecords;
27
+ readonly colorSchemes: GalleryRecords;
28
+ readonly fontSchemes: GalleryRecords;
29
+ readonly narratives: GalleryRecords;
30
+ readonly audiences: GalleryRecords;
31
+ readonly purposes: GalleryRecords;
32
+ readonly tones: GalleryRecords;
33
+ }
34
+
35
+ /**
36
+ * The pptx.gallery catalog: every content record by kind and then by id, with no `$schema` or `id` (the key is the id)
37
+ * and no `x-*` display metadata. Register it with every entry point that resolves references: `{ catalogs: [gallery] }`.
38
+ */
39
+ export declare const gallery: GalleryCatalog;
40
+
41
+ /** Records of one display kind, keyed by id. */
42
+ export type CatalogDisplayRecords = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
43
+
44
+ /**
45
+ * Display metadata for pickers: chart types, languages and social platforms by id. Documents never reference these
46
+ * records; `chart.type`, the language tag and the `socials` keys are engine vocabularies.
47
+ */
48
+ export declare const catalogDisplay: {
49
+ readonly chartTypes: CatalogDisplayRecords;
50
+ readonly languages: CatalogDisplayRecords;
51
+ readonly socialPlatforms: CatalogDisplayRecords;
52
+ };
53
+
54
+ /** A summary entry of a kind's `index.json`. */
55
+ export interface CatalogIndexRecord {
56
+ readonly id: string;
57
+ readonly name?: string;
58
+ readonly summary?: string;
59
+ readonly file: string;
60
+ readonly [key: string]: unknown;
61
+ }
62
+
63
+ /** A kind's `index.json` (schema https://openpresentation.org/schema/opf-catalog-index/v1). */
64
+ export interface CatalogIndex {
65
+ readonly $schema?: string;
66
+ /** The kind as its URL segment, such as `color-schemes`. */
67
+ readonly kind: string;
68
+ readonly version: string;
69
+ readonly description?: string;
70
+ /** SHA-256 of the canonical JSON of the index-ordered records, `x-*` members removed. */
71
+ readonly contentSha256: string;
72
+ readonly records: readonly CatalogIndexRecord[];
73
+ readonly [key: string]: unknown;
74
+ }
75
+
76
+ /** The kinds the gallery publishes, keyed as in a document's `catalogs` group. */
77
+ export type GalleryKind =
78
+ | "layouts"
79
+ | "themes"
80
+ | "colorSchemes"
81
+ | "fontSchemes"
82
+ | "narratives"
83
+ | "audiences"
84
+ | "purposes"
85
+ | "tones"
86
+ | "chartTypes"
87
+ | "languages"
88
+ | "socialPlatforms";
89
+
90
+ /** Each kind's `index.json`. */
91
+ export declare const catalogIndexes: Readonly<Record<GalleryKind, CatalogIndex>>;
92
+
93
+ /** Where the records came from: the pptx.gallery commit and a content hash per kind (schema opf-catalog-manifest/v1). */
94
+ export declare const catalogManifest: {
95
+ readonly $schema: string;
96
+ readonly publisher: string;
97
+ readonly source: { readonly repository: string; readonly commit: string; readonly path: string };
98
+ readonly kinds: Readonly<Record<string, { readonly mode: string; readonly records: number; readonly contentSha256: string }>>;
99
+ readonly [key: string]: unknown;
100
+ };