@openpresentation/gallery 0.0.0-stage → 1.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 +5 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/dist/index.d.ts +97 -0
- package/dist/index.js +23 -0
- package/dist/previews.d.ts +34 -0
- package/dist/previews.js +16 -0
- package/package.json +70 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- 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,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gallery
|
|
2
2
|
|
|
3
|
-
|
|
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: "two-column"`, `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
|
+
## Use
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @openpresentation/gallery
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { validate } from "@openpresentation/opf";
|
|
20
|
+
import { gallery } from "@openpresentation/gallery";
|
|
21
|
+
|
|
22
|
+
validate(deck, { catalogs: [gallery] });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Pass `catalogs: [gallery]` to every entry point that resolves references: core's `validate`, `paginate`, `embed` and
|
|
26
|
+
`resolveSlideContext`, and opf-render, opf-pptx and opf-editor, which pass the option through to core. The first
|
|
27
|
+
registered catalog is the default for bare ids. From OPF 0.19, `@openpresentation/opf` depends on this package and its
|
|
28
|
+
Node functions (and the `opf` command) register `gallery` when a call names no catalogs; a browser host registers it
|
|
29
|
+
itself. Save decks with their records embedded (`embed`), so they draw the same whichever gallery version a host
|
|
30
|
+
registers later.
|
|
31
|
+
|
|
32
|
+
| Export | What it is |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `gallery` | The content records by kind and then by id, without `$schema`, `id` or `x-*` members, with `source: "https://www.pptx.gallery"` |
|
|
35
|
+
| `GALLERY_SOURCE` | `https://www.pptx.gallery`, the `source` of a document's `catalogs.default` |
|
|
36
|
+
| `CATALOG_SCHEMA` | The version of core's catalog record schemas these records target (also `opf.catalogSchema` in `package.json`) |
|
|
37
|
+
| `catalogDisplay` | Display metadata for pickers: `chartTypes`, `languages` and `socialPlatforms` by id |
|
|
38
|
+
| `catalogIndexes` | Each kind's `index.json`: the record summaries and their content hash |
|
|
39
|
+
| `catalogManifest` | The pptx.gallery commit the records were taken from, and a content hash per kind |
|
|
40
|
+
|
|
41
|
+
`@openpresentation/gallery/previews` exports static HTML layout previews (`layoutPreviews`, `layoutPreviewIndex`,
|
|
42
|
+
`layoutPreviewSlugs`, `getLayoutPreview`, `hasLayoutPreview`). The package has no dependency, not even for its types:
|
|
43
|
+
`GalleryCatalog` has the shape of core's `Catalog`, so `gallery` is assignable to it.
|
|
44
|
+
|
|
45
|
+
## Versions
|
|
46
|
+
|
|
47
|
+
The gallery has its own version line, independent of the OPF engine packages. Releases are tagged `vX.Y.Z`.
|
|
48
|
+
|
|
49
|
+
- **Minor:** new records. Every existing record draws exactly as in the previous release.
|
|
50
|
+
- **Major:** an id removed or renamed, a change to how an existing record draws, or a change that needs a newer record
|
|
51
|
+
schema (`CATALOG_SCHEMA`).
|
|
52
|
+
- **Patch:** fixes that change no record's drawing (text a drawing never shows, such as a name or a summary; the package
|
|
53
|
+
code; the declarations).
|
|
54
|
+
|
|
55
|
+
The pixel-stability check enforces the rule (`npm run check:stability`, `scripts/stability.mjs`). It runs on every pull
|
|
56
|
+
request and before every publish. It takes the highest published version at or below the candidate's, and for every
|
|
57
|
+
layout, theme, colour scheme and font scheme both releases have, it draws a fixture deck with the pinned published
|
|
58
|
+
`@openpresentation/opf` and `@openpresentation/opf-render`, once per release: a slide with sample content in every
|
|
59
|
+
region of a layout, a six-slide sample deck for a design record. SVG bytes are compared first; a mismatch is rasterized
|
|
60
|
+
to count the pixels that differ. A changed drawing or a removed id fails unless the major version goes up. New ids pass.
|
|
61
|
+
|
|
62
|
+
## Where the records come from
|
|
63
|
+
|
|
64
|
+
In 1.x the records are a pinned snapshot of the catalog pptx.gallery publishes at
|
|
65
|
+
`https://www.pptx.gallery/<kind>/index.json`; `catalog/manifest.json` names the pptx.gallery commit.
|
|
66
|
+
|
|
67
|
+
- Records are written in [Data-Advantage/pptx-gallery](https://github.com/Data-Advantage/pptx-gallery): its `data/`,
|
|
68
|
+
then `pnpm build:opf-catalog`, which publishes `public/<kind>/`.
|
|
69
|
+
- When pptx.gallery's main changes a published record, its `sync-gallery-package.yml` workflow opens or updates one
|
|
70
|
+
pull request here, from the branch `sync/pptx-gallery`, with the records, the version bump and the `CHANGELOG.md`
|
|
71
|
+
entry. A person reviews and merges it, then tags the release. See CONTRIBUTING.md, "Records from pptx.gallery".
|
|
72
|
+
- The records are taken by this repository's `scripts/sync-gallery-catalog.mjs --gallery <pptx-gallery checkout>`
|
|
73
|
+
(`npm run sync` with the checkout at `../pptx-gallery`). The sync validates every published index and record
|
|
74
|
+
against the published `@openpresentation/opf`, checks the published content hashes, drops `x-*` members, refuses a
|
|
75
|
+
publisher that stopped serving an id the snapshot holds (unless `--allow-removed <kind>:<id>` names it), and pins the
|
|
76
|
+
gallery commit.
|
|
77
|
+
|
|
78
|
+
The planned 2.0.0 release, with the OPF 0.19 layout redesign, makes this repository the place records are written, and
|
|
79
|
+
pptx.gallery then reads them from the package.
|
|
80
|
+
|
|
81
|
+
## Contributing a layout
|
|
82
|
+
|
|
83
|
+
1. Add the layout on pptx.gallery: its page data in `data/layouts.json` (placeholders, composition, design and display
|
|
84
|
+
fields) and its preview, then `pnpm build:opf-catalog` there. pptx.gallery's CI validates the record against OPF's
|
|
85
|
+
companion schema. A new layout gets a new id; an existing id never changes meaning.
|
|
86
|
+
2. Sync it here (`npm run sync`), then run `npm test` and `npm run check:stability`. A new layout is a minor release;
|
|
87
|
+
if the check reports a changed record, restore it or make the release a major one.
|
|
88
|
+
3. Open a pull request here with the synced files and a `CHANGELOG.md` entry under `## Unreleased`.
|
|
89
|
+
|
|
90
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the checks, releases and the license.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT](LICENSE). The records, the previews and the code are all under it; `npm run check:license` checks it.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
/** The version of core's catalog record schemas these records target (package.json `opf.catalogSchema`). */
|
|
14
|
+
export declare const CATALOG_SCHEMA: 1;
|
|
15
|
+
|
|
16
|
+
/** Records of one kind, keyed by id (core's `CatalogRecordMap`). */
|
|
17
|
+
export type GalleryRecords = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
18
|
+
|
|
19
|
+
/** The gallery as a registered catalog: core's `Catalog` shape, `source` and the eight content kinds. */
|
|
20
|
+
export interface GalleryCatalog {
|
|
21
|
+
readonly source: typeof GALLERY_SOURCE;
|
|
22
|
+
readonly layouts: GalleryRecords;
|
|
23
|
+
readonly themes: GalleryRecords;
|
|
24
|
+
readonly colorSchemes: GalleryRecords;
|
|
25
|
+
readonly fontSchemes: GalleryRecords;
|
|
26
|
+
readonly narratives: GalleryRecords;
|
|
27
|
+
readonly audiences: GalleryRecords;
|
|
28
|
+
readonly purposes: GalleryRecords;
|
|
29
|
+
readonly tones: GalleryRecords;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The pptx.gallery catalog: every content record by kind and then by id, with no `$schema` or `id` (the key is the id)
|
|
34
|
+
* and no `x-*` display metadata. Register it with every entry point that resolves references: `{ catalogs: [gallery] }`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const gallery: GalleryCatalog;
|
|
37
|
+
|
|
38
|
+
/** Records of one display kind, keyed by id. */
|
|
39
|
+
export type CatalogDisplayRecords = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Display metadata for pickers: chart types, languages and social platforms by id. Documents never reference these
|
|
43
|
+
* records; `chart.type`, the language tag and the `socials` keys are engine vocabularies.
|
|
44
|
+
*/
|
|
45
|
+
export declare const catalogDisplay: {
|
|
46
|
+
readonly chartTypes: CatalogDisplayRecords;
|
|
47
|
+
readonly languages: CatalogDisplayRecords;
|
|
48
|
+
readonly socialPlatforms: CatalogDisplayRecords;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** A summary entry of a kind's `index.json`. */
|
|
52
|
+
export interface CatalogIndexRecord {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly name?: string;
|
|
55
|
+
readonly summary?: string;
|
|
56
|
+
readonly file: string;
|
|
57
|
+
readonly [key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A kind's `index.json` (schema https://openpresentation.org/schema/opf-catalog-index/v1). */
|
|
61
|
+
export interface CatalogIndex {
|
|
62
|
+
readonly $schema?: string;
|
|
63
|
+
/** The kind as its URL segment, such as `color-schemes`. */
|
|
64
|
+
readonly kind: string;
|
|
65
|
+
readonly version: string;
|
|
66
|
+
readonly description?: string;
|
|
67
|
+
/** SHA-256 of the canonical JSON of the index-ordered records, `x-*` members removed. */
|
|
68
|
+
readonly contentSha256: string;
|
|
69
|
+
readonly records: readonly CatalogIndexRecord[];
|
|
70
|
+
readonly [key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The kinds the gallery publishes, keyed as in a document's `catalogs` group. */
|
|
74
|
+
export type GalleryKind =
|
|
75
|
+
| "layouts"
|
|
76
|
+
| "themes"
|
|
77
|
+
| "colorSchemes"
|
|
78
|
+
| "fontSchemes"
|
|
79
|
+
| "narratives"
|
|
80
|
+
| "audiences"
|
|
81
|
+
| "purposes"
|
|
82
|
+
| "tones"
|
|
83
|
+
| "chartTypes"
|
|
84
|
+
| "languages"
|
|
85
|
+
| "socialPlatforms";
|
|
86
|
+
|
|
87
|
+
/** Each kind's `index.json`. */
|
|
88
|
+
export declare const catalogIndexes: Readonly<Record<GalleryKind, CatalogIndex>>;
|
|
89
|
+
|
|
90
|
+
/** Where the records came from: the pptx.gallery commit and a content hash per kind (schema opf-catalog-manifest/v1). */
|
|
91
|
+
export declare const catalogManifest: {
|
|
92
|
+
readonly $schema: string;
|
|
93
|
+
readonly publisher: string;
|
|
94
|
+
readonly source: { readonly repository: string; readonly commit: string; readonly path: string };
|
|
95
|
+
readonly kinds: Readonly<Record<string, { readonly mode: string; readonly records: number; readonly contentSha256: string }>>;
|
|
96
|
+
readonly [key: string]: unknown;
|
|
97
|
+
};
|