@openpresentation/opf 0.34.2 → 0.35.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/README.md +6 -6
- package/dist/browser.js +19 -19
- package/dist/{catalog-refs-wtuudZTe.d.ts → catalog-refs-BgotJhR5.d.ts} +105 -95
- package/dist/{catalog-schemas-CSxuFtsu.d.ts → catalog-schemas-BX-VEc5Q.d.ts} +1 -1
- package/dist/{chunk-RM4Z7ZSW.js → chunk-2GCTKQDD.js} +4 -4
- package/dist/{chunk-VI7VWDTN.js → chunk-3KPTVK77.js} +75 -283
- package/dist/{chunk-AQ3WR3H7.js → chunk-3ZTKRX7F.js} +4 -6
- package/dist/{chunk-IDYYLJCQ.js → chunk-4UMZDDJG.js} +11 -29
- package/dist/{chunk-NLJFNCZ4.js → chunk-6JHV2K67.js} +6 -6
- package/dist/{chunk-FK5XG742.js → chunk-6VGLE7C5.js} +114 -2
- package/dist/{chunk-V4G3BYPY.js → chunk-7KUUIL7W.js} +7 -7
- package/dist/{chunk-PHOSM2RA.js → chunk-ARPMSD7V.js} +1 -1
- package/dist/{chunk-UKI43JE6.js → chunk-GGN3NQDK.js} +1 -1
- package/dist/{chunk-XLXCXEVF.js → chunk-GKUAVSXU.js} +3 -10
- package/dist/{chunk-HX4HEJB4.js → chunk-HORPH6O7.js} +7 -6
- package/dist/{chunk-KJFCHCWV.js → chunk-JQNT37IO.js} +4 -13
- package/dist/{chunk-WBPXRUZT.js → chunk-KNMMEE67.js} +795 -467
- package/dist/{chunk-IGT4523S.js → chunk-LDLLZQPP.js} +706 -432
- package/dist/{chunk-6MSH3KCZ.js → chunk-MS2LPR7F.js} +1 -5
- package/dist/{chunk-NMZCPZ3R.js → chunk-MVPQEMCP.js} +97 -15
- package/dist/{chunk-P2X4BBW2.js → chunk-NPRNWPP4.js} +1 -1
- package/dist/{chunk-EQCZ2SFD.js → chunk-P2ACZJUL.js} +6 -6
- package/dist/chunk-SEC4IOOS.js +1 -0
- package/dist/{chunk-VVPPMHP6.js → chunk-VMPOCXTE.js} +5 -17
- package/dist/{chunk-MDAXXFAY.js → chunk-ZZWX4W2G.js} +2 -2
- package/dist/{composition-DF07Ha4R.d.ts → composition-BmJfljJl.d.ts} +198 -114
- package/dist/composition.d.ts +2 -2
- package/dist/composition.js +1 -1
- package/dist/{conversion-52ki0lfZ.d.ts → conversion-BbXhlurO.d.ts} +7 -7
- package/dist/conversion-VWCH3NKR.js +25 -0
- package/dist/convert.d.ts +11 -11
- package/dist/convert.js +61 -86
- package/dist/data.d.ts +1 -1
- package/dist/data.js +2 -2
- package/dist/{deck-report-C3EsoHC3.d.ts → deck-report-BYkbL7uT.d.ts} +3 -3
- package/dist/deck.d.ts +6 -6
- package/dist/deck.js +11 -11
- package/dist/diagram-engine-eager.js +1 -1
- package/dist/diagram-engine-lazy.js +1 -1
- package/dist/{diagram-plantuml-XRZ6VAOL.js → diagram-plantuml-GWXGKY7R.js} +1 -1
- package/dist/diff.d.ts +2 -2
- package/dist/diff.js +4 -4
- package/dist/docs.js +39 -39
- package/dist/examples.js +6336 -8170
- package/dist/{finding-l9dlQ2NF.d.ts → finding-mcHslZLA.d.ts} +6 -2
- package/dist/font-policy.d.ts +16 -2
- package/dist/font-policy.js +1 -1
- package/dist/format.js +2 -2
- package/dist/ids.d.ts +2 -2
- package/dist/ids.js +4 -4
- package/dist/index.d.ts +125 -27
- package/dist/index.js +24 -23
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +8 -8
- package/dist/node-engine.d.ts +6 -6
- package/dist/node-engine.js +21 -21
- package/dist/{pagination-Do7vNgU-.d.ts → pagination-C0FPjO29.d.ts} +4 -4
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +4 -4
- package/dist/patch.d.ts +4 -4
- package/dist/patch.js +3 -3
- package/dist/precompiled.js +2 -2
- package/dist/{presentation-ANs2WkaS.d.ts → presentation-Dx-kZC8Y.d.ts} +25 -81
- package/dist/repo-readme.js +1 -1
- package/dist/schema-engine-ajv.js +1 -1
- package/dist/schema-engine-precompiled.js +2 -2
- package/dist/schema.d.ts +5 -7
- package/dist/schema.js +3 -3
- package/dist/schemas.js +1 -1
- package/dist/source.js +10 -10
- package/dist/spec/reference/engine-defaults.json +1 -1
- package/dist/spec/reference/engine-vocabularies.json +43 -43
- package/dist/spec/reference/font-policy.json +114 -2
- package/dist/spec/reference/font-policy.schema.json +45 -1
- package/dist/spec/schemas/color-scheme.schema.json +2 -2
- package/dist/spec/schemas/finding.schema.json +2 -1
- package/dist/spec/schemas/layout.schema.json +27 -85
- package/dist/spec/schemas/opf.schema.json +26 -175
- package/dist/spec/schemas/theme.schema.json +10 -10
- package/dist/symbol-font-encodings.d.ts +2 -2
- package/dist/types.d.ts +74 -86
- package/dist/{validation-types-BNS41nzb.d.ts → validation-types-DKIe1RQW.d.ts} +5 -5
- package/dist/validator.d.ts +5 -7
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +1 -1
- package/dist/yaml.js +7 -7
- package/package.json +5 -5
- package/dist/chunk-HSXWDXKM.js +0 -1
- package/dist/conversion-F3HSCFOV.js +0 -25
package/README.md
CHANGED
|
@@ -40,8 +40,8 @@ const deck: Presentation = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
console.log(presentation.$id);
|
|
43
|
-
// Register the catalogs your host trusts; core ships no records. In Node, validate, stats, paginate, embed and
|
|
44
|
-
// register the gallery (@openpresentation/gallery, a dependency of core) when a call names none.
|
|
43
|
+
// Register the catalogs your host trusts; core ships no records. In Node, validate, stats, paginate, embed, fix and
|
|
44
|
+
// edit register the gallery (@openpresentation/gallery, a dependency of core) when a call names none.
|
|
45
45
|
const catalogs = [gallery];
|
|
46
46
|
console.log(validate({ ...deck, design: { theme: "classic" } }, { catalogs }).valid);
|
|
47
47
|
// Save with every record the deck uses embedded, so it renders the same with no catalog registered.
|
|
@@ -77,7 +77,7 @@ import type { Presentation, Audience, Tone } from "@openpresentation/opf/types";
|
|
|
77
77
|
|
|
78
78
|
The root entry holds the application-level API: schemas, catalog references and their resolution (`resolveReference`, `embed`, `copySlides`, `updateFromCatalog`), validation, variables, pagination, data helpers, font policy, `stats`, `resolveSlideContext` and `resolveSlideVariables`. Engines compose and draw `context.slide` from `resolveSlideContext(deck, index, { slideNumber, slideCount })`: the slide with the slide-scoped built-ins `{{slide.number}}`, `{{slide.section}}` and `{{deck.slideCount}}` substituted for the same numbers its `options` carry (`resolveSlideVariables(slide, { slideNumber, slideCount })` does that substitution alone). Header and footer text is substituted by `layoutFurniture`, which records each slide number in `FurnitureTextPart.fields`. See [templates and variables](../../docs/templates-and-variables.md#slide-scoped-built-ins). It carries no catalog records: the pptx.gallery catalog is the package `@openpresentation/gallery` (`gallery`, `catalogDisplay`, and the layout previews of `@openpresentation/gallery/previews`), a dependency of core released on its own version line, which the Node build registers when a call names no catalogs (OPF 0.19 removed `@openpresentation/opf/catalog` and `defaultCatalog`, with no alias). Every entry point that resolves references takes `{ catalogs }`, the catalogs the host registered; the first one is the default for documents that omit `catalogs.default`. See [catalogs and the default catalog](../../docs/default-catalog.md).
|
|
79
79
|
|
|
80
|
-
The layout engine's names are not on the root. `composeSlide`, `fitText`, `layoutQuote` and the other `layoutX`/`fitX` functions, numbering, footnotes and citations,
|
|
80
|
+
The layout engine's names are not on the root. `composeSlide`, `fitText`, `layoutQuote` and the other `layoutX`/`fitX` functions, numbering, footnotes and citations, color contrast, code syntax, pattern fills, metric trends, chart options, script fonts and text direction come from `@openpresentation/opf/composition`; the symbol-font tables come from `@openpresentation/opf/symbol-font-encodings`.
|
|
81
81
|
|
|
82
82
|
### Facts, slide context and the fonts handle
|
|
83
83
|
|
|
@@ -101,7 +101,7 @@ The layout engine's names are not on the root. `composeSlide`, `fitText`, `layou
|
|
|
101
101
|
|
|
102
102
|
### Source editing: schema field queries, text addressing and syntax recovery
|
|
103
103
|
|
|
104
|
-
Two browser-safe subpaths for source editors, the CLI and agents. `@openpresentation/opf/schema` reads the field model of a document from the JSON Schemas: `describeField(path, document?)` returns the types, description, enum values, default, examples, whether the parent requires it, the `oneOf` variants (and `primary`, the form a template should use), the ranked `children` of an object (required first, then the curated `COMMON_KEYS` order, then alphabetical;
|
|
104
|
+
Two browser-safe subpaths for source editors, the CLI and agents. `@openpresentation/opf/schema` reads the field model of a document from the JSON Schemas: `describeField(path, document?)` returns the types, description, enum values, default, examples, whether the parent requires it, the `oneOf` variants (and `primary`, the form a template should use), the ranked `children` of an object (required first, then the curated `COMMON_KEYS` order, then alphabetical; `extensions` and `$schema` are `advanced`), the item schema of an array (`itemInfo`) or map (`entryInfo`), `requiredChildren` and `freeText`, and `{ known: false }` for a path the schema does not describe; `catalogKindAt(path, document?)` names the catalog a reference field points into (`layouts`, `themes`, `colorSchemes`, `fontSchemes`, `narratives`, `audiences`, `purposes`, `tones`) from `schemaCatalogKinds` (also exported), core-side metadata keyed by schema name and JSON Pointer; the published schemas carry no vendor keyword and compile under strict Ajv, so a new reference field is one entry there and needs no editor change. The navigation helpers it is built on are exported too (`resolveSchema`, `schemaVariants`, `activeSchema`, `schemaAtPath`, `createSchemaValue`, `listSchemaFields`, `splitOpfPath`). `@openpresentation/opf/source` turns text into positions and back: `locate(text, format, pointer, { part })` is the range of a JSON Pointer in JSON, YAML or Markdown (`value`, `key`, `entry`, `open` or `colon`; the nearest ancestor with `exact: false` when the node is missing; a Markdown slide field is located by the same ranges its findings use: the `layout=` token of an options comment, the text after `# ` or `- `), `pathAt(text, format, offset)` the path under a caret, `scanMarkdown(text)` the regions of a Markdown deck (front matter, slides, option comments, fences, notes) with the dialect's vocabulary (`SLIDE_OPTION_KEYS`, `BLOCK_OPTION_KEYS`, `FENCE_KINDS`, `METRIC_KEYS`), and `analyzeJsonSyntax(text, { limit })` the root cause of each JSON syntax error, once, in position order (at most five), with a range, a message, a hint and the fixes that repair it (`Insert comma`, `Add { }`, `Remove "design"`, `Insert }`, `Use double quotes`, ...); `validate(text)` reports the same causes as `opf/json-syntax` findings. See [validate](../../docs/validate.md).
|
|
105
105
|
|
|
106
106
|
### Validate (0.14.0)
|
|
107
107
|
|
|
@@ -123,13 +123,13 @@ A slide can draw more than text, pictures and charts, with no extra package:
|
|
|
123
123
|
|
|
124
124
|
- **Shapes.** A `shape` block takes one of PowerPoint's 187 presets (`{ "shape": "chevron", "text": "Plan" }`) or a custom `path`, with fills, strokes and six effects; a slide's `shapes` list adds overlays and connectors between blocks. The preset table is `PRESET_SHAPES` of `@openpresentation/opf/shape-geometry`. See [shapes](https://github.com/OpenPresentation/opf/blob/main/docs/shapes.md) and [shape effects](https://github.com/OpenPresentation/opf/blob/main/docs/shape-effects.md).
|
|
125
125
|
- **Icons.** `icon` on a list entry, a metric or a group (`"lucide:truck"`, `"tabler:rocket"`) draws a chip, and a list of short icon entries draws icon cards. The sets live in `@openpresentation/gallery/icon-sets` as static files read one icon at a time: register `galleryIconSets()` beside `gallery` (in a browser, `galleryIconSets(fetchIcons("/opf-icons/"))` over the files you serve; in a Worker, an absolute URL and `env.ASSETS`) and await `ensureIcons(deck, { catalogs })` before synchronous drawing (`@openpresentation/opf/composition`). The Node build's defaults (`convert`, `open`, the CLI) register them with no setup, also in a bundled server deployed with its `node_modules`, and no bundle carries the icon data. An icon that cannot be loaded is an `opf/icon-unknown` finding; it never blocks drawing. See [icons](https://github.com/OpenPresentation/opf/blob/main/docs/icons.md).
|
|
126
|
-
- **SmartArt layouts.** The `pyramid`, `matrix`, `cycle`, `chevrons`, `
|
|
126
|
+
- **SmartArt layouts.** The `pyramid`, `matrix`, `cycle`, `chevrons`, `process` (a short list) and `vertical-process` layouts draw one diagram from a list; PowerPoint export writes live SmartArt where it holds the text, and native shapes elsewhere. See [SmartArt layouts](https://github.com/OpenPresentation/opf/blob/main/docs/smartart.md).
|
|
127
127
|
- **Diagrams.** A `diagram` payload accepts Mermaid (the string shorthand), Graphviz DOT (`syntax: "dot"`) or PlantUML (`syntax: "plantuml"`), is drawn in the deck's design and exports as native PowerPoint shapes by default (`--diagrams picture` for a picture). See [diagrams](https://github.com/OpenPresentation/opf/blob/main/docs/diagrams.md).
|
|
128
128
|
|
|
129
129
|
### Layout previews
|
|
130
130
|
|
|
131
131
|
`@openpresentation/gallery/previews` ships pre-rendered SVG thumbnails for the
|
|
132
|
-
slide layouts
|
|
132
|
+
slide layouts cataloged at pptx.gallery. Each preview is a self-contained SVG
|
|
133
133
|
sized to fill a 16:9 container, with its colors and layout already rendered.
|
|
134
134
|
|
|
135
135
|
```tsx
|
package/dist/browser.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { OPFApiError } from './chunk-
|
|
2
|
-
export { OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-
|
|
1
|
+
import { OPFApiError } from './chunk-MVPQEMCP.js';
|
|
2
|
+
export { DEFAULT_FIX_ROUNDS, FIX_REPAIR_CATEGORIES, OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, fill, fillRecords, fix, isSafePatch, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-MVPQEMCP.js';
|
|
3
3
|
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-W4DYDRV2.js';
|
|
4
|
-
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-
|
|
5
|
-
export { OPFDataImportError, ingest, parseTabularData } from './chunk-
|
|
6
|
-
export { OPFPaginationError, blockUnits, continuationPages, continueOverfull, paginate, paginateSlide } from './chunk-
|
|
7
|
-
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-
|
|
8
|
-
export { fromMarkdown, toMarkdown } from './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
export { OPFFormatError, format } from './chunk-
|
|
4
|
+
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-6VGLE7C5.js';
|
|
5
|
+
export { OPFDataImportError, ingest, parseTabularData } from './chunk-GGN3NQDK.js';
|
|
6
|
+
export { OPFPaginationError, blockUnits, continuationPages, continueOverfull, paginate, paginateSlide } from './chunk-GKUAVSXU.js';
|
|
7
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-2GCTKQDD.js';
|
|
8
|
+
export { fromMarkdown, toMarkdown } from './chunk-4UMZDDJG.js';
|
|
9
|
+
import './chunk-P2ACZJUL.js';
|
|
10
|
+
export { OPFFormatError, format } from './chunk-MS2LPR7F.js';
|
|
11
11
|
import './chunk-RYZPBJLB.js';
|
|
12
|
-
export { explain } from './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
export { OPFMarkdownError } from './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
export { OPFIdError, assignIds, touches } from './chunk-
|
|
18
|
-
export { diff, merge } from './chunk-
|
|
19
|
-
export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogSchemaNames, createValidator, documentHash, findValidationRule, idToken, isIdToken, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-
|
|
12
|
+
export { explain } from './chunk-7KUUIL7W.js';
|
|
13
|
+
import './chunk-VMPOCXTE.js';
|
|
14
|
+
import './chunk-NPRNWPP4.js';
|
|
15
|
+
export { OPFMarkdownError } from './chunk-ZZWX4W2G.js';
|
|
16
|
+
import './chunk-ARPMSD7V.js';
|
|
17
|
+
export { OPFIdError, assignIds, touches } from './chunk-JQNT37IO.js';
|
|
18
|
+
export { diff, merge } from './chunk-3ZTKRX7F.js';
|
|
19
|
+
export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogSchemaNames, createValidator, documentHash, findValidationRule, idToken, isIdToken, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-KNMMEE67.js';
|
|
20
20
|
import './chunk-JBARNYFR.js';
|
|
21
|
-
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-
|
|
22
|
-
export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, asciiDigits, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartDrawDiagnostics, chartDrawPlan, chartNumber, coerceVariableValue, datasetDiagnostics, diagramsPending, embedIcons, ensureDiagrams, ensureIcons, ensureShapes, formatDataNumber, formatNumber, formatPercentNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, iconsPending, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isPlaceLabel, isSupportedNumberingSystem, isTemplate, isXYChartType, languageInEffect, listBuiltinVariables, listVariables, localizeDigits, markLabelColor, nearIconNames, normalizeLanguageFamily, numberFormatError, numberLocale, numberingSystemExtension, numberingSystemOf, numeralScripts, parseIconReference, parseReference, plainLanguageTag, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveIcon, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, shapesPending, suggestChartNumberFix, supportedNumberingSystems, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-
|
|
21
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-3KPTVK77.js';
|
|
22
|
+
export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, asciiDigits, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartDrawDiagnostics, chartDrawPlan, chartNumber, coerceVariableValue, datasetDiagnostics, diagramsPending, embedIcons, ensureDiagrams, ensureIcons, ensureShapes, formatDataNumber, formatNumber, formatPercentNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, iconsPending, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isPlaceLabel, isSupportedNumberingSystem, isTemplate, isXYChartType, languageInEffect, listBuiltinVariables, listVariables, localizeDigits, markLabelColor, nearIconNames, normalizeLanguageFamily, numberFormatError, numberLocale, numberingSystemExtension, numberingSystemOf, numeralScripts, parseIconReference, parseReference, plainLanguageTag, resolveChartData, resolveDesignRecords, resolveFontScheme, resolveIcon, resolveReference, resolveSlideVariables, resolveTableData, resolveVariables, shapesPending, suggestChartNumberFix, supportedNumberingSystems, tableCellDisplayValue, toExcelNumberFormat, unresolvedReference, unusedDatasets, variableDeclarations } from './chunk-LDLLZQPP.js';
|
|
23
23
|
import './chunk-BLCDUM7B.js';
|
|
24
24
|
import './chunk-PRXZD2II.js';
|
|
25
25
|
|
|
@@ -43,9 +43,9 @@ type ColorAccentSlot = 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5'
|
|
|
43
43
|
/** The slots a variant can use as the slide background: the four light and dark slots, or an accent (LH-01). */
|
|
44
44
|
type ColorVariantBackground = ColorBaseSlot | ColorAccentSlot;
|
|
45
45
|
/**
|
|
46
|
-
* A variant of the deck's single
|
|
46
|
+
* A variant of the deck's single color scheme: which slot is the background (and so which are the text and the alternate surface),
|
|
47
47
|
* and optionally the order of the accents. It is a mapping over the scheme's twelve slots, as PowerPoint's `clrMap` is, never a second
|
|
48
|
-
* scheme: nothing in it is a
|
|
48
|
+
* scheme: nothing in it is a color.
|
|
49
49
|
*/
|
|
50
50
|
interface ColorVariant {
|
|
51
51
|
background: ColorVariantBackground;
|
|
@@ -118,7 +118,7 @@ declare function layoutVariantApplies(slideDesign: unknown, layout: unknown, dec
|
|
|
118
118
|
*
|
|
119
119
|
* LH-01: an accent background is both bg1 and bg2, as light2 and dark2 are, with the text of the family whose tx1 reads better on that
|
|
120
120
|
* accent in `colorScheme` (light1 and light2 when light1 has the higher contrast, else dark1 and dark2), so the scheme's own slots carry
|
|
121
|
-
* the text and no
|
|
121
|
+
* the text and no color is invented; tx2 maps to tx1's slot where the family's tx2 is under {@link ACCENT_SECONDARY_MIN_CONTRAST} on the
|
|
122
122
|
* accent. Without a scheme the accent counts as dark.
|
|
123
123
|
*/
|
|
124
124
|
declare function colorMapFor(variant?: ColorVariantInput, colorScheme?: Record<string, unknown>): ColorMap;
|
|
@@ -128,10 +128,10 @@ declare function colorMapFor(variant?: ColorVariantInput, colorScheme?: Record<s
|
|
|
128
128
|
*/
|
|
129
129
|
declare function clrMapAttributes(map: ColorMap): Record<string, string>;
|
|
130
130
|
/**
|
|
131
|
-
* A scheme
|
|
131
|
+
* A scheme color as the PPTX export writes it and the preview draws it: `slot` is the color role or slot (`tx1`, `bg1`, `bg2`, `tx2`,
|
|
132
132
|
* `accent1` ...), `lumMod` and `lumOff` are DrawingML luminance transforms in thousandths of a percent (`lumMod 15000, lumOff 85000` is
|
|
133
|
-
* 15% of the slot's luminance plus 85%), `alpha` an opacity in the same unit, and `hex` is the
|
|
134
|
-
* resolved scheme, so a preview that draws `hex` and a PPTX that writes `<a:schemeClr val={slot}>` with the transforms show the same
|
|
133
|
+
* 15% of the slot's luminance plus 85%), `alpha` an opacity in the same unit, and `hex` is the color the transforms give for the
|
|
134
|
+
* resolved scheme, so a preview that draws `hex` and a PPTX that writes `<a:schemeClr val={slot}>` with the transforms show the same color.
|
|
135
135
|
*/
|
|
136
136
|
interface SchemeColor {
|
|
137
137
|
slot: string;
|
|
@@ -140,9 +140,9 @@ interface SchemeColor {
|
|
|
140
140
|
lumOff?: number;
|
|
141
141
|
alpha?: number;
|
|
142
142
|
}
|
|
143
|
-
/** The
|
|
143
|
+
/** The color a `lumMod`/`lumOff` pair (thousandths of a percent) makes of `hex`: its HSL luminance times `lumMod`, plus `lumOff`. */
|
|
144
144
|
declare function applyLuminance(hex: string, lumMod?: number, lumOff?: number): string;
|
|
145
|
-
/** Shares of the text
|
|
145
|
+
/** Shares of the text color (tx1) mixed into the background (bg1) for the neutrals, PowerPoint's chart-style values. */
|
|
146
146
|
declare const NEUTRAL_SHARES: {
|
|
147
147
|
readonly border: 0.2;
|
|
148
148
|
readonly gridline: 0.15;
|
|
@@ -150,19 +150,19 @@ declare const NEUTRAL_SHARES: {
|
|
|
150
150
|
readonly chartText: 0.65;
|
|
151
151
|
readonly codeComment: 0.65;
|
|
152
152
|
};
|
|
153
|
-
/** LH-54: the share of the text
|
|
153
|
+
/** LH-54: the share of the text color (light1 on a dark slide) a dark card starts from, mixed into the background. */
|
|
154
154
|
declare const CARD_SURFACE_MIX = 0.07;
|
|
155
155
|
/** LH-54: the contrast a mixed dark card reaches against the background, stepping the mix up from {@link CARD_SURFACE_MIX} (Claude Design's #0B2A5C on #011842 is 1.25:1). */
|
|
156
156
|
declare const CARD_SURFACE_MIN_CONTRAST = 1.25;
|
|
157
157
|
/** Wave 8: the contrast the slide's text keeps on a mixed card (WCAG AA for body text); the mix towards the text stops before it falls under it. */
|
|
158
158
|
declare const CARD_TEXT_MIN_CONTRAST = 4.5;
|
|
159
|
-
/** LH-54: the share of the text
|
|
159
|
+
/** LH-54: the share of the text color mixed into a mixed dark card for its 1 px stroke (about 12% white over the card). */
|
|
160
160
|
declare const CARD_BORDER_MIX = 0.12;
|
|
161
161
|
/** LH-79: a dark variant's code panel is bg1 at this share of its HSL lightness (`lumMod`; Claude Design's #001030 on #011842). */
|
|
162
162
|
declare const CODE_PANEL_DARK_SHADE = 0.7;
|
|
163
163
|
/**
|
|
164
|
-
* The
|
|
165
|
-
* gets light lines and a change of variant or background style in PowerPoint
|
|
164
|
+
* The colors OPF draws that are neither text nor an accent, all derived from the scheme through the variant's map, so a dark variant
|
|
165
|
+
* gets light lines and a change of variant or background style in PowerPoint recolors them.
|
|
166
166
|
*/
|
|
167
167
|
interface SchemeNeutrals {
|
|
168
168
|
/** Quiet structural rules, card borders and table borders: tx1 at {@link NEUTRAL_SHARES}.border over bg1. */
|
|
@@ -171,7 +171,7 @@ interface SchemeNeutrals {
|
|
|
171
171
|
gridline: SchemeColor;
|
|
172
172
|
/** Chart axis lines: tx1 at 25%. */
|
|
173
173
|
axisLine: SchemeColor;
|
|
174
|
-
/** Chart axis labels and legend text where the chart does not use the slide text
|
|
174
|
+
/** Chart axis labels and legend text where the chart does not use the slide text color: tx1 at 65%. */
|
|
175
175
|
chartText: SchemeColor;
|
|
176
176
|
/** Pie and treemap outlines, the video play icon and anything drawn on top of a mark: bg1. */
|
|
177
177
|
outline: SchemeColor;
|
|
@@ -192,10 +192,10 @@ interface SchemeNeutrals {
|
|
|
192
192
|
* The fill of a card (a composed item's `frameBox`), LH-54: the `surface` role wherever it stands off the background, and on a dark slide
|
|
193
193
|
* where it does not (the dark2 variant, whose bg2 is the background itself) the background mixed towards tx1 from {@link CARD_SURFACE_MIX}
|
|
194
194
|
* until it reaches {@link CARD_SURFACE_MIN_CONTRAST}, so a dark card reads as a filled surface rather than a hairline outline. A mixed card is
|
|
195
|
-
* a literal
|
|
195
|
+
* a literal color (no single luminance transform of a slot reproduces it), as `surfaceAlt` is.
|
|
196
196
|
*/
|
|
197
197
|
card: SchemeColor;
|
|
198
|
-
/** The 1 px stroke of a card: `border`, or on a mixed dark card that card mixed {@link CARD_BORDER_MIX} towards tx1 (a literal
|
|
198
|
+
/** The 1 px stroke of a card: `border`, or on a mixed dark card that card mixed {@link CARD_BORDER_MIX} towards tx1 (a literal color). */
|
|
199
199
|
cardBorder: SchemeColor;
|
|
200
200
|
}
|
|
201
201
|
interface ResolvedColorRoles {
|
|
@@ -227,7 +227,7 @@ interface ResolvedColorRoles {
|
|
|
227
227
|
variant: ColorVariant;
|
|
228
228
|
/** The map behind the roles (bg1, tx1, bg2, tx2 and the accent order), for PPTX `clrMap` and `clrMapOvr` ({@link clrMapAttributes}). */
|
|
229
229
|
map: ColorMap;
|
|
230
|
-
/** The six accent
|
|
230
|
+
/** The six accent colors in the variant's order (primary, secondary and accent are the first three unless overridden). */
|
|
231
231
|
accents: string[];
|
|
232
232
|
/** Every neutral derived from the scheme, with its slot and luminance transform for `schemeClr` export. */
|
|
233
233
|
neutrals: SchemeNeutrals;
|
|
@@ -298,11 +298,11 @@ declare function textColorForFill(fill: string, preferred: string): string;
|
|
|
298
298
|
* Explicit mark overrides belong to the caller; unresolved alpha is preserved.
|
|
299
299
|
*/
|
|
300
300
|
declare function chartColorForFill(fill: string, preferred: string): string;
|
|
301
|
-
/** Smallest CIE L* step kept between
|
|
301
|
+
/** Smallest CIE L* step kept between neighboring series (a printed or grayscale chart tells them apart by lightness alone). */
|
|
302
302
|
declare const CHART_SERIES_MIN_LIGHTNESS_STEP = 11;
|
|
303
|
-
/** Smallest CIE76
|
|
303
|
+
/** Smallest CIE76 color difference kept between any two series that were at least that far apart before the surface adjustment. */
|
|
304
304
|
declare const CHART_SERIES_MIN_DIFFERENCE = 12;
|
|
305
|
-
/** Series are placed in tiers of this many: a
|
|
305
|
+
/** Series are placed in tiers of this many: a color is kept apart from the colors of its own and earlier tiers only (see {@link chartPaletteForFill}). */
|
|
306
306
|
declare const CHART_SERIES_TIER_SIZE = 6;
|
|
307
307
|
/** WI-5 (P18, D3) and LH-55: the contrast every series from the scheme reaches on a dark chart surface (see {@link ChartPaletteOptions.legible}). */
|
|
308
308
|
declare const CHART_DARK_SERIES_MIN_CONTRAST = 4.5;
|
|
@@ -317,42 +317,42 @@ interface ChartPaletteOptions {
|
|
|
317
317
|
legible?: readonly boolean[];
|
|
318
318
|
/**
|
|
319
319
|
* LH-105: soften the series `legible` lists (the scheme's): each is mixed up to {@link CHART_SERIES_SOFT_MIX} of the way towards `fill`
|
|
320
|
-
* after the contrast placement, as far as it keeps its contrast floor and its lightness step from its
|
|
321
|
-
* Ordinary data then reads in soft
|
|
320
|
+
* after the contrast placement, as far as it keeps its contrast floor and its lightness step from its neighbors ({@link softenChartPalette}).
|
|
321
|
+
* Ordinary data then reads in soft colors and the full-strength color is left for emphasis (Few). An authored color is never softened.
|
|
322
322
|
*/
|
|
323
323
|
soften?: boolean;
|
|
324
324
|
}
|
|
325
|
-
/** Series
|
|
325
|
+
/** Series colors for a chart drawn on `fill`: the palette in order, each color adjusted for contrast
|
|
326
326
|
* (`chartColorForFill`) without letting the adjustment merge series.
|
|
327
327
|
*
|
|
328
|
-
* Lifting or darkening a
|
|
329
|
-
* few lightness values, so two blues that differ on white can end up identical on a dark card.
|
|
330
|
-
* already have >= 3:1 contrast against `fill` are kept exactly. A
|
|
328
|
+
* Lifting or darkening a color for a dark or mid-tone surface moves every failing color towards the same
|
|
329
|
+
* few lightness values, so two blues that differ on white can end up identical on a dark card. Colors that
|
|
330
|
+
* already have >= 3:1 contrast against `fill` are kept exactly. A color the contrast adjustment would move is
|
|
331
331
|
* placed again on the lightness axis, keeping its hue and as much of its chroma as sRGB allows, subject to
|
|
332
332
|
* >= 3:1 contrast against `fill` and these separations from the other series (each capped at the separation
|
|
333
333
|
* that pair had in `palette`, so a pair the palette itself made close is not asked to be far apart):
|
|
334
334
|
*
|
|
335
|
-
* - a
|
|
336
|
-
* - a lightness step of at least {@link CHART_SERIES_MIN_LIGHTNESS_STEP} (CIE L*) from the
|
|
337
|
-
* series, which is what keeps
|
|
335
|
+
* - a color difference (CIE76) of at least {@link CHART_SERIES_MIN_DIFFERENCE} from every other series;
|
|
336
|
+
* - a lightness step of at least {@link CHART_SERIES_MIN_LIGHTNESS_STEP} (CIE L*) from the neighboring
|
|
337
|
+
* series, which is what keeps neighbors apart on a grayscale print;
|
|
338
338
|
* - the same lightness step from the remaining series, as a weaker aim.
|
|
339
339
|
*
|
|
340
|
-
* Series are placed in order against the kept
|
|
341
|
-
* {@link CHART_SERIES_TIER_SIZE} (series 1 to 6, 7 to 12, ...): a
|
|
340
|
+
* Series are placed in order against the kept colors and the colors placed before them. The palette is read in tiers of
|
|
341
|
+
* {@link CHART_SERIES_TIER_SIZE} (series 1 to 6, 7 to 12, ...): a color is separated from the colors of its own and earlier tiers only,
|
|
342
342
|
* so the later tiers (the tints of `chartSeriesPalette`) are placed around the first six without ever pulling them towards a lightness
|
|
343
|
-
* the tints already hold. A palette of six
|
|
344
|
-
* with the lowest cost wins: its distance (in L*) from the contrast-adjusted
|
|
345
|
-
* every point it falls short of those separations, so a
|
|
346
|
-
* simply the adjusted
|
|
343
|
+
* the tints already hold. A palette of six colors or fewer is one tier. The placement
|
|
344
|
+
* with the lowest cost wins: its distance (in L*) from the contrast-adjusted color plus a penalty for
|
|
345
|
+
* every point it falls short of those separations, so a color that is already clear of the others is
|
|
346
|
+
* simply the adjusted color, a near miss is not worth a large change, and a collision is resolved at the
|
|
347
347
|
* nearest lightness that clears it. The result is deterministic and in series order. An unresolved or
|
|
348
|
-
* translucent fill or
|
|
348
|
+
* translucent fill or color is passed through, like `chartColorForFill`.
|
|
349
349
|
*
|
|
350
350
|
* On a dark `fill` the series `options.legible` lists (the scheme's, {@link chartSchemeSeries}) take {@link CHART_DARK_SERIES_MIN_CONTRAST}
|
|
351
351
|
* (4.5:1) in place of 3:1 throughout: series 1 is lifted to it first (with {@link legible}, keeping its hue) and kept, the others are adjusted
|
|
352
352
|
* and placed against that floor, and series 2 keeps {@link CHART_LEAD_LIGHTNESS_STEP} (L*) from series 1 even where it already had the
|
|
353
353
|
* contrast (LH-55: the second default blue on navy was 3.0:1 and nine L* from the first).
|
|
354
354
|
*
|
|
355
|
-
* It depends only on the surface and the palette, so every chart on a surface gets the same series
|
|
355
|
+
* It depends only on the surface and the palette, so every chart on a surface gets the same series colors,
|
|
356
356
|
* and preview and export (which both call this function) draw the same ones.
|
|
357
357
|
*/
|
|
358
358
|
declare function chartPaletteForFill(fill: string, palette: readonly string[], options?: ChartPaletteOptions): string[];
|
|
@@ -380,9 +380,9 @@ interface ChartSlicePlan {
|
|
|
380
380
|
declare function chartSlicePlan(fill: string, palette: readonly string[], count: number, options?: {
|
|
381
381
|
legible?: readonly boolean[];
|
|
382
382
|
}): ChartSlicePlan;
|
|
383
|
-
/** LH-105: the share of the backdrop mixed into an ordinary series
|
|
383
|
+
/** LH-105: the share of the backdrop mixed into an ordinary series color from the scheme (Few: soft colors for ordinary data, strong for emphasis). */
|
|
384
384
|
declare const CHART_SERIES_SOFT_MIX = 0.25;
|
|
385
|
-
/** LH-105: a softened series
|
|
385
|
+
/** LH-105: a softened series color and the DrawingML HSL transforms (thousandths of a percent) that make it of its full-strength color. */
|
|
386
386
|
interface ChartSoftColor {
|
|
387
387
|
hex: string;
|
|
388
388
|
satMod: number;
|
|
@@ -390,8 +390,8 @@ interface ChartSoftColor {
|
|
|
390
390
|
lumOff?: number;
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
|
-
* LH-105: the
|
|
394
|
-
* (thousandths of a percent, each clamped to 0 to 1), as PowerPoint applies `<a:satMod>`, `<a:lumMod>` and `<a:lumOff>` to a scheme
|
|
393
|
+
* LH-105: the color DrawingML's HSL transforms make of `hex`: its saturation times `satMod`, its lightness times `lumMod` plus `lumOff`
|
|
394
|
+
* (thousandths of a percent, each clamped to 0 to 1), as PowerPoint applies `<a:satMod>`, `<a:lumMod>` and `<a:lumOff>` to a scheme color.
|
|
395
395
|
*/
|
|
396
396
|
declare function applyHslTransforms(hex: string, transforms: {
|
|
397
397
|
satMod?: number;
|
|
@@ -399,13 +399,13 @@ declare function applyHslTransforms(hex: string, transforms: {
|
|
|
399
399
|
lumOff?: number;
|
|
400
400
|
}): string;
|
|
401
401
|
/**
|
|
402
|
-
* LH-105: the soft series
|
|
403
|
-
* scheme's; an authored
|
|
404
|
-
* backdrop's (a DrawingML lumMod/lumOff pair on the
|
|
402
|
+
* LH-105: the soft series colors of a palette already placed for `fill` ({@link chartPaletteForFill}). Each series `legible` lists (the
|
|
403
|
+
* scheme's; an authored color stays as written) has its HSL lightness moved {@link CHART_SERIES_SOFT_MIX} of the way towards the
|
|
404
|
+
* backdrop's (a DrawingML lumMod/lumOff pair on the color, which keeps its hue and saturation), or less (in steps of 1%) when the full
|
|
405
405
|
* move would take it under its contrast floor against `fill` (`floor`: 3:1, or 4.5:1 for a scheme series on a dark fill) or closer in
|
|
406
|
-
* lightness to a
|
|
407
|
-
* of a dark scheme chart: {@link CHART_LEAD_LIGHTNESS_STEP}, `lead`). The
|
|
408
|
-
* (still placed). A
|
|
406
|
+
* lightness to a neighboring series than the placed palette had them, capped at {@link CHART_SERIES_MIN_LIGHTNESS_STEP} (series 1 and 2
|
|
407
|
+
* of a dark scheme chart: {@link CHART_LEAD_LIGHTNESS_STEP}, `lead`). The neighbors are the series before (already softened) and after
|
|
408
|
+
* (still placed). A color no move keeps within those bounds stays at full strength. In series order and deterministic.
|
|
409
409
|
*/
|
|
410
410
|
declare function softenChartPalette(fill: string, palette: readonly string[], options?: {
|
|
411
411
|
legible?: readonly boolean[];
|
|
@@ -418,39 +418,39 @@ declare function softenChartPalette(fill: string, palette: readonly string[], op
|
|
|
418
418
|
*/
|
|
419
419
|
declare function chartSoftColors(fill: string, palette: readonly string[], options?: ChartPaletteOptions): (ChartSoftColor | undefined)[];
|
|
420
420
|
/**
|
|
421
|
-
* LH-105: the
|
|
421
|
+
* LH-105: the color of a series' direct label (its name at the end of its line): the series color at full strength, made legible as
|
|
422
422
|
* text on `backdrop` (4.5:1, WCAG 1.4.3) by moving its lightness only, so the label keeps the hue of its line.
|
|
423
423
|
*/
|
|
424
424
|
declare function chartSeriesLabelColor(backdrop: string, color: string): string;
|
|
425
425
|
/** Share of white mixed into each accent to make the extended tints of {@link chartSeriesPalette} (series 7 to 12). */
|
|
426
426
|
declare const CHART_SERIES_TINT_MIX = 0.4;
|
|
427
427
|
/**
|
|
428
|
-
* The series
|
|
429
|
-
* resolved
|
|
428
|
+
* The series colors of a chart before the per-surface adjustment: twelve opaque #RRGGBB colors in series order, taken from the deck's
|
|
429
|
+
* resolved color scheme (`design.colorScheme` after the theme, the record and any inline overrides are applied).
|
|
430
430
|
*
|
|
431
431
|
* - 1 to 6: `accent1` to `accent6`. A slot the scheme leaves out takes the engine default scheme's slot.
|
|
432
432
|
* - 7 to 12: the same six accents mixed {@link CHART_SERIES_TINT_MIX} of the way towards white, in the same order (a tint of `accent1`
|
|
433
433
|
* is series 7), for charts with more than six series.
|
|
434
434
|
*
|
|
435
|
-
* Pass the result to {@link chartPaletteForFill} with the chart panel
|
|
436
|
-
* the panel without letting two series merge. Series `i` takes
|
|
437
|
-
* category `i`. The
|
|
435
|
+
* Pass the result to {@link chartPaletteForFill} with the chart panel color for the colors a chart draws and writes: contrast against
|
|
436
|
+
* the panel without letting two series merge. Series `i` takes color `i`; a pie, doughnut, treemap or funnel takes color `i` for
|
|
437
|
+
* category `i`. The colors depend on the scheme only, so the preview, the PPTX export and the color-blind rule draw the same ones.
|
|
438
438
|
* The role overrides (`primary`, `secondary`, `accent`) do not change the list: series 1 to 3 are always `accent1` to `accent3`, the
|
|
439
439
|
* theme slots the PPTX export writes as `schemeClr accentN`.
|
|
440
440
|
*
|
|
441
|
-
* RR-89: `colors` is the chart's own `chart.colors` (positional ColorRefs). Entry `i` replaces palette
|
|
442
|
-
* be resolved ({@link resolveChartColors}) keeps the scheme
|
|
441
|
+
* RR-89: `colors` is the chart's own `chart.colors` (positional ColorRefs). Entry `i` replaces palette color `i`; an entry that cannot
|
|
442
|
+
* be resolved ({@link resolveChartColors}) keeps the scheme color, and entries past the twelfth extend the list. `context` carries the
|
|
443
443
|
* deck's roles and `variables` for entries that name them.
|
|
444
444
|
*/
|
|
445
445
|
declare function chartSeriesPalette(colorScheme?: Record<string, unknown>, colors?: unknown, context?: ChartColorContext): string[];
|
|
446
446
|
/**
|
|
447
447
|
* Which series of a chart come from the deck scheme rather than from an authored `chart.colors` entry, in series order: entry `i` is true
|
|
448
|
-
* when `colors[i]` is absent or cannot be resolved, so the series keeps the scheme
|
|
448
|
+
* when `colors[i]` is absent or cannot be resolved, so the series keeps the scheme color of its position. These are the series
|
|
449
449
|
* {@link chartPaletteForFill} lifts to 4.5:1 on a dark surface (`options.legible`). The list covers the palette {@link chartSeriesPalette}
|
|
450
450
|
* returns for the same arguments (twelve entries, more when `colors` is longer).
|
|
451
451
|
*/
|
|
452
452
|
declare function chartSchemeSeries(colors: unknown, colorScheme?: Record<string, unknown>, context?: ChartColorContext): boolean[];
|
|
453
|
-
/** What a `chart.colors` entry resolves against: the deck's role
|
|
453
|
+
/** What a `chart.colors` entry resolves against: the deck's role colors and `variables`, as for any ColorRef. */
|
|
454
454
|
interface ChartColorContext {
|
|
455
455
|
/** RR-96: the variant's accent order (`roles.map.accents`): series 1 to 6 take these slots in this order. Default: accent1 to accent6. */
|
|
456
456
|
accents?: readonly ColorAccentSlot[];
|
|
@@ -458,42 +458,42 @@ interface ChartColorContext {
|
|
|
458
458
|
variables?: Record<string, unknown>;
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
|
-
* The opaque #RRGGBB
|
|
462
|
-
* order; undefined for an entry that is not a string or cannot be resolved (an unknown variable, a name that is not a
|
|
461
|
+
* The opaque #RRGGBB color of each `chart.colors` entry (a hex color, a color-scheme slot or role, or a `var:<id>` variable), in
|
|
462
|
+
* order; undefined for an entry that is not a string or cannot be resolved (an unknown variable, a name that is not a color). Alpha is
|
|
463
463
|
* dropped. `colors` that is not an array resolves to an empty list.
|
|
464
464
|
*/
|
|
465
465
|
declare function resolveChartColors(colors: unknown, colorScheme?: Record<string, unknown>, context?: ChartColorContext): (string | undefined)[];
|
|
466
|
-
/** Share of the text
|
|
466
|
+
/** Share of the text color mixed into the surface to make the muted color of a highlighted chart. */
|
|
467
467
|
declare const CHART_HIGHLIGHT_MUTED_MIX = 0.3;
|
|
468
|
-
/** Smallest contrast the muted
|
|
468
|
+
/** Smallest contrast the muted color keeps against the surface: recessive, but still a visible mark. */
|
|
469
469
|
declare const CHART_HIGHLIGHT_MUTED_MIN_CONTRAST = 1.6;
|
|
470
|
-
/** LH-105: the
|
|
470
|
+
/** LH-105: the color difference (CIE76) a context gray keeps from every focused color. */
|
|
471
471
|
declare const CHART_CONTEXT_FOCUS_DIFFERENCE = 20;
|
|
472
|
-
/** LH-105: the contrast the context
|
|
472
|
+
/** LH-105: the contrast the context color of a focused chart keeps against its backdrop (a mark is a graphical object, WCAG 1.4.11). */
|
|
473
473
|
declare const CHART_CONTEXT_MIN_CONTRAST = 3;
|
|
474
474
|
/**
|
|
475
|
-
* LH-105: the contrast the context
|
|
475
|
+
* LH-105: the contrast the context color keeps when every context mark carries its value or name as text (a small chart's value labels,
|
|
476
476
|
* the names at the line ends, the names on the slices): WCAG 1.4.11 does not ask 3:1 of a graphic whose information the text gives, so the
|
|
477
477
|
* context can be the light neutral Few draws, still clearly visible.
|
|
478
478
|
*/
|
|
479
479
|
declare const CHART_CONTEXT_LABELED_MIN_CONTRAST = 1.6;
|
|
480
480
|
/**
|
|
481
481
|
* LH-105: the neutral of the marks a chart does not focus on (the title names other series or categories, chart-focus.ts): the backdrop
|
|
482
|
-
* mixed towards the text
|
|
483
|
-
* {@link CHART_CONTEXT_MIN_CONTRAST} against the backdrop. A
|
|
482
|
+
* mixed towards the text color (tx1), from {@link CHART_HIGHLIGHT_MUTED_MIX} in 2% steps until it reaches
|
|
483
|
+
* {@link CHART_CONTEXT_MIN_CONTRAST} against the backdrop. A gray in the backdrop's own hue, quieter than the text, visible as a mark.
|
|
484
484
|
* The first of {@link chartContextColors}.
|
|
485
485
|
*/
|
|
486
486
|
declare function chartContextColor(surface: string, text: string): string;
|
|
487
487
|
/**
|
|
488
488
|
* LH-105: the neutrals of `count` context series (or slices) of a focused chart, in the order the context series come: grays in the
|
|
489
|
-
* backdrop's hue, the backdrop mixed towards the text
|
|
489
|
+
* backdrop's hue, the backdrop mixed towards the text color. The lightest step is the first mix (from {@link CHART_HIGHLIGHT_MUTED_MIX}, or from the backdrop when `labeled`, in
|
|
490
490
|
* 1% steps) that reaches the contrast floor against the backdrop ({@link CHART_CONTEXT_MIN_CONTRAST}, or
|
|
491
|
-
* {@link CHART_CONTEXT_LABELED_MIN_CONTRAST} when `labeled`: every context mark carries its text) and keeps a
|
|
492
|
-
* {@link CHART_CONTEXT_FOCUS_DIFFERENCE} (CIE76) from each `avoid`
|
|
491
|
+
* {@link CHART_CONTEXT_LABELED_MIN_CONTRAST} when `labeled`: every context mark carries its text) and keeps a color difference of
|
|
492
|
+
* {@link CHART_CONTEXT_FOCUS_DIFFERENCE} (CIE76) from each `avoid` color (the focused colors: a gray stands apart from a colored focus by
|
|
493
493
|
* its chroma); each further step is the next mix that stands {@link CHART_SERIES_MIN_LIGHTNESS_STEP} L* from the one before and keeps that
|
|
494
|
-
* difference from the `avoid`
|
|
495
|
-
* so
|
|
496
|
-
* runs out of room (a dark text
|
|
494
|
+
* difference from the `avoid` colors. The first context series takes the strongest step and the last the lightest,
|
|
495
|
+
* so neighboring context series (stacked segments, slices) are told apart by lightness, as the focused series are by hue. When the mix
|
|
496
|
+
* runs out of room (a dark text color close to the backdrop), the remaining series repeat the strongest step.
|
|
497
497
|
*/
|
|
498
498
|
declare function chartContextColors(surface: string, text: string, count: number, options?: {
|
|
499
499
|
labeled?: boolean;
|
|
@@ -535,59 +535,59 @@ declare function chartWaterfallColors(surface: string, accent: string, text: str
|
|
|
535
535
|
decrease: string;
|
|
536
536
|
};
|
|
537
537
|
/**
|
|
538
|
-
* The two
|
|
538
|
+
* The two colors of a chart that highlights marks (`chart.highlight`), derived from the theme only: `accent` for the highlighted
|
|
539
539
|
* marks, `muted` for every other mark.
|
|
540
540
|
*
|
|
541
|
-
* - `accent` is the deck's primary
|
|
541
|
+
* - `accent` is the deck's primary color, kept at >= 3:1 against the surface by `chartColorForFill` (a primary that already has
|
|
542
542
|
* that contrast is returned unchanged).
|
|
543
|
-
* - `muted` is the surface mixed {@link CHART_HIGHLIGHT_MUTED_MIX} of the way towards the text
|
|
544
|
-
* and a dim
|
|
545
|
-
* the surface (a surface and text that are close together) the mix moves towards the text
|
|
543
|
+
* - `muted` is the surface mixed {@link CHART_HIGHLIGHT_MUTED_MIX} of the way towards the text color: a light gray on a light surface
|
|
544
|
+
* and a dim gray on a dark one, in the surface's own hue. When that falls below {@link CHART_HIGHLIGHT_MUTED_MIN_CONTRAST} against
|
|
545
|
+
* the surface (a surface and text that are close together) the mix moves towards the text color until it holds.
|
|
546
546
|
*
|
|
547
|
-
* Pure arithmetic on opaque
|
|
548
|
-
*
|
|
547
|
+
* Pure arithmetic on opaque colors: the preview and the PPTX export both call it with the chart panel, the primary and the label
|
|
548
|
+
* color, so they draw and write the same two colors. An unresolved color is replaced by white (surface), the surface's own
|
|
549
549
|
* best contrast partner (text) or black (primary).
|
|
550
550
|
*/
|
|
551
551
|
declare function chartHighlightColors(surface: string, primary: string, text: string): {
|
|
552
552
|
accent: string;
|
|
553
553
|
muted: string;
|
|
554
554
|
};
|
|
555
|
-
/** LH-03: smallest contrast every mark of an
|
|
555
|
+
/** LH-03: smallest contrast every mark of an emphasized small chart keeps against its backdrop: a bar is a graphical object (WCAG 1.4.11, 3:1). */
|
|
556
556
|
declare const CHART_EMPHASIS_MIN_CONTRAST = 3;
|
|
557
|
-
/** LH-03: smallest CIE L* step between the
|
|
557
|
+
/** LH-03: smallest CIE L* step between the emphasized mark and the other marks, so the emphasis is visible. */
|
|
558
558
|
declare const CHART_EMPHASIS_MIN_LIGHTNESS_STEP = 15;
|
|
559
559
|
/**
|
|
560
|
-
* LH-03, LH-95: the two
|
|
561
|
-
* every other point. The other points keep the series
|
|
562
|
-
* the
|
|
560
|
+
* LH-03, LH-95: the two colors of a small chart's emphasis, in the shape of a highlight: `accent` for the emphasized point, `muted` for
|
|
561
|
+
* every other point. The other points keep the series color (`color`, already adjusted for the backdrop by `chartPaletteForFill`), and
|
|
562
|
+
* the emphasized point takes a stronger shade of it: the series color mixed away from the backdrop (towards black on a light backdrop,
|
|
563
563
|
* towards white on a dark one) just far enough to stand {@link CHART_EMPHASIS_MIN_LIGHTNESS_STEP} L* from it. Moving away from the
|
|
564
|
-
* backdrop only raises the contrast, so the shade keeps the series
|
|
564
|
+
* backdrop only raises the contrast, so the shade keeps the series color's. A series color too close to black (or white) for that
|
|
565
565
|
* step is shaded the other way instead, while the shade keeps {@link CHART_EMPHASIS_MIN_CONTRAST} against the backdrop.
|
|
566
566
|
*
|
|
567
|
-
* LH-105: `strong` is the series
|
|
568
|
-
* then takes the full-strength
|
|
569
|
-
* strong
|
|
567
|
+
* LH-105: `strong` is the series color at full strength when `color` is its soft form ({@link softenChartPalette}). The emphasized point
|
|
568
|
+
* then takes the full-strength color itself when that already stands the step from the soft one, and a shade of it otherwise, so the
|
|
569
|
+
* strong color is kept for the emphasis.
|
|
570
570
|
*
|
|
571
|
-
* A faded tint of the other points (LH-03's first rule) needed room between the series
|
|
572
|
-
* of the 84 gallery theme x scheme x variant charts; a stronger shade has room in all of them. Undefined only for an unresolved
|
|
571
|
+
* A faded tint of the other points (LH-03's first rule) needed room between the series color and the backdrop, and emphasized only 36
|
|
572
|
+
* of the 84 gallery theme x scheme x variant charts; a stronger shade has room in all of them. Undefined only for an unresolved color or
|
|
573
573
|
* when neither direction keeps both floors. The preview and the PPTX export call it with the same pair.
|
|
574
574
|
*/
|
|
575
575
|
declare function chartEmphasisColors(surface: string, color: string, strong?: string): {
|
|
576
576
|
accent: string;
|
|
577
577
|
muted: string;
|
|
578
578
|
} | undefined;
|
|
579
|
-
/** Share of the text
|
|
579
|
+
/** Share of the text color mixed into the surface for the `surfaceAlt` role. */
|
|
580
580
|
declare const SURFACE_ALT_MIX = 0.1;
|
|
581
581
|
/** Smallest contrast `surfaceAlt` keeps against `surface`, so a band is visible next to a plain row. */
|
|
582
582
|
declare const SURFACE_ALT_MIN_CONTRAST = 1.1;
|
|
583
583
|
/**
|
|
584
|
-
* The `surfaceAlt`
|
|
585
|
-
* mixed {@link SURFACE_ALT_MIX} of the way towards the text
|
|
584
|
+
* The `surfaceAlt` color role: the fill of the banded rows of a table whose other body rows take `surface`. It is the surface
|
|
585
|
+
* mixed {@link SURFACE_ALT_MIX} of the way towards the text color (a slightly darker band on a light table, a slightly lighter one
|
|
586
586
|
* on a dark table), moved further until it differs from the surface by {@link SURFACE_ALT_MIN_CONTRAST}, while the text keeps
|
|
587
587
|
* 4.5:1 on it. When mixing towards the text cannot keep both (a surface and text that are close together), the band moves the
|
|
588
|
-
* other way, away from the text, which only raises the text contrast. Pure arithmetic on opaque
|
|
588
|
+
* other way, away from the text, which only raises the text contrast. Pure arithmetic on opaque colors, so the preview and
|
|
589
589
|
* the PPTX export, which both resolve the `surfaceAlt` ColorRef from their own `surface` and `text` roles, draw and write the
|
|
590
|
-
* same
|
|
590
|
+
* same color. An unresolved surface is white; an unresolved text color is the surface's best contrast partner.
|
|
591
591
|
*/
|
|
592
592
|
declare function surfaceAltColor(surface: string, text: string): string;
|
|
593
593
|
/** LH-113: share of the accent mixed into the table surface for a highlighted row. */
|
|
@@ -918,6 +918,16 @@ declare function catalogGroupSource(document: unknown, name: string, options?: C
|
|
|
918
918
|
declare function resolveReference(document: unknown, kind: CatalogKind, reference: unknown, options?: CatalogOptions & {
|
|
919
919
|
group?: string;
|
|
920
920
|
}): ResolvedReference | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* The `design.titlePosition` a slide needs on the layout that replaced a removed gallery layout to draw as before: `start` for `agenda-split`
|
|
923
|
+
* (bare or `default:`); undefined for any other reference.
|
|
924
|
+
*/
|
|
925
|
+
declare function renamedLayoutTitlePosition(kind: CatalogKind, reference: string): 'start' | undefined;
|
|
926
|
+
/**
|
|
927
|
+
* The reference that replaced a bare or `default:` reference to a gallery layout OPF 0.35 removed (`flow` is `process`, `vertical-flow`
|
|
928
|
+
* is `vertical-process`, `agenda-split` is `agenda`), with the same group prefix; undefined for any other reference.
|
|
929
|
+
*/
|
|
930
|
+
declare function renamedLayout(kind: CatalogKind, reference: string): string | undefined;
|
|
921
931
|
/** The diagnostic for a reference that resolves nowhere, naming the reference and the source it was looked for in. */
|
|
922
932
|
declare function unresolvedReference(document: unknown, kind: CatalogKind, reference: string, path: string, options?: CatalogOptions): UnresolvedReferenceDiagnostic;
|
|
923
933
|
/** One place a document writes a content reference. */
|
|
@@ -942,5 +952,5 @@ declare function catalogReferenceSites(document: unknown, options?: {
|
|
|
942
952
|
/** Records a picker can offer for `kind`: the document's embedded records, then those of the registered catalogs its groups name, with the reference to write for each. */
|
|
943
953
|
declare function catalogRecords(document: unknown, kind: CatalogKind, options?: CatalogOptions): ResolvedReference[];
|
|
944
954
|
|
|
945
|
-
export { CHART_SERIES_TINT_MIX as $, resolveReference as A, unresolvedReference as B, CARD_BORDER_MIX as G, CARD_SURFACE_MIN_CONTRAST as H, CARD_SURFACE_MIX as J, CARD_TEXT_MIN_CONTRAST as K, CHART_CONTEXT_FOCUS_DIFFERENCE as L, CHART_CONTEXT_LABELED_MIN_CONTRAST as M, CHART_CONTEXT_MIN_CONTRAST as N, OPFCatalogsOptionError as O, CHART_DARK_SERIES_MIN_CONTRAST as P, CHART_EMPHASIS_MIN_CONTRAST as Q, CHART_EMPHASIS_MIN_LIGHTNESS_STEP as S, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST as T, CHART_HIGHLIGHT_MUTED_MIX as V, CHART_LEAD_LIGHTNESS_STEP as W, CHART_SERIES_MIN_DIFFERENCE as X, CHART_SERIES_MIN_LIGHTNESS_STEP as Y, CHART_SERIES_SOFT_MIX as Z, CHART_SERIES_TIER_SIZE as _, isFixedBackground as a$, CHART_SLICE_MAX_SHIFT as a0, CHART_SLICE_SEPARATOR_PX as a1, CODE_PANEL_DARK_SHADE as a2, chartContextColor as aA, chartContextColors as aB, chartEmphasisColors as aC, chartFocusContextColors as aD, chartHighlightColors as aE, chartPaletteForFill as aF, chartSchemeSeries as aG, chartSeriesLabelColor as aH, chartSeriesPalette as aI, chartSeriesStrokes as aJ, chartSlicePlan as aK, chartSoftColors as aL, chartWaterfallColors as aM, clrMapAttributes as aN, colorContrast as aO, colorMapFor as aP, colorTransform as aQ, deckBackgroundIsFixed as aR, defaultSlideBackground as aS, documentIcons as aT, emphasisSurface as aU, iconColors as aV, iconFromSvg as aW, iconPathCommands as aX, iconPathData as aY, isColorVariant as aZ, isDarkColor as a_, DARK_BACKGROUND_LUMINANCE as ab, EMPHASIS_SURFACE_MIN_CONTRAST as ac, EMPHASIS_TEXT_MIN_CONTRAST as ad, ICON_CHIP_TINT as af, ICON_MIN_CONTRAST as ag, ICON_VIEWBOX as ah, NEUTRAL_SHARES as an, SURFACE_ALT_MIN_CONTRAST as ar, SURFACE_ALT_MIX as as, TABLE_HIGHLIGHT_MIX as av, applyColorTransform as aw, applyHslTransforms as ax, applyLuminance as ay, chartColorForFill as az, layoutColorVariant as b0, layoutVariantApplies as b1, normalizeColorVariant as b2, normalizeHexColor as b3, placeIconCommands as b4, readableSchemeColor as b5,
|
|
955
|
+
export { CHART_SERIES_TINT_MIX as $, resolveReference as A, unresolvedReference as B, CARD_BORDER_MIX as G, CARD_SURFACE_MIN_CONTRAST as H, CARD_SURFACE_MIX as J, CARD_TEXT_MIN_CONTRAST as K, CHART_CONTEXT_FOCUS_DIFFERENCE as L, CHART_CONTEXT_LABELED_MIN_CONTRAST as M, CHART_CONTEXT_MIN_CONTRAST as N, OPFCatalogsOptionError as O, CHART_DARK_SERIES_MIN_CONTRAST as P, CHART_EMPHASIS_MIN_CONTRAST as Q, CHART_EMPHASIS_MIN_LIGHTNESS_STEP as S, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST as T, CHART_HIGHLIGHT_MUTED_MIX as V, CHART_LEAD_LIGHTNESS_STEP as W, CHART_SERIES_MIN_DIFFERENCE as X, CHART_SERIES_MIN_LIGHTNESS_STEP as Y, CHART_SERIES_SOFT_MIX as Z, CHART_SERIES_TIER_SIZE as _, isFixedBackground as a$, CHART_SLICE_MAX_SHIFT as a0, CHART_SLICE_SEPARATOR_PX as a1, CODE_PANEL_DARK_SHADE as a2, chartContextColor as aA, chartContextColors as aB, chartEmphasisColors as aC, chartFocusContextColors as aD, chartHighlightColors as aE, chartPaletteForFill as aF, chartSchemeSeries as aG, chartSeriesLabelColor as aH, chartSeriesPalette as aI, chartSeriesStrokes as aJ, chartSlicePlan as aK, chartSoftColors as aL, chartWaterfallColors as aM, clrMapAttributes as aN, colorContrast as aO, colorMapFor as aP, colorTransform as aQ, deckBackgroundIsFixed as aR, defaultSlideBackground as aS, documentIcons as aT, emphasisSurface as aU, iconColors as aV, iconFromSvg as aW, iconPathCommands as aX, iconPathData as aY, isColorVariant as aZ, isDarkColor as a_, DARK_BACKGROUND_LUMINANCE as ab, EMPHASIS_SURFACE_MIN_CONTRAST as ac, EMPHASIS_TEXT_MIN_CONTRAST as ad, ICON_CHIP_TINT as af, ICON_MIN_CONTRAST as ag, ICON_VIEWBOX as ah, NEUTRAL_SHARES as an, SURFACE_ALT_MIN_CONTRAST as ar, SURFACE_ALT_MIX as as, TABLE_HIGHLIGHT_MIX as av, applyColorTransform as aw, applyHslTransforms as ax, applyLuminance as ay, chartColorForFill as az, layoutColorVariant as b0, layoutVariantApplies as b1, normalizeColorVariant as b2, normalizeHexColor as b3, placeIconCommands as b4, readableSchemeColor as b5, renamedLayout as b6, renamedLayoutTitlePosition as b7, resolveChartColors as b8, resolveColorRef as b9, resolveColorRoles as ba, softenChartPalette as bb, surfaceAltColor as bc, tableHighlightColor as bd, textColorForFill as be, CATALOG_GROUP_PATTERN as e, CATALOG_REFERENCE_PATTERN as f, OPFUnresolvedReferenceError as m, catalogGroupSource as p, catalogKinds as q, catalogRecords as r, catalogReferenceSites as s, embedIcons as t, ensureIcons as u, iconsPending as v, nearIconNames as w, parseIconReference as x, parseReference as y, resolveIcon as z };
|
|
946
956
|
export type { Catalog as C, ChartColorContext as D, IconPart as E, IconPaint as F, IconOptions as I, ResolvedColorRoles as R, UnresolvedReferenceDiagnostic as U, CatalogKind as a, ChartPaletteOptions as a3, ChartSlicePlan as a4, ChartSoftColor as a5, ColorAccentSlot as a6, ColorBaseSlot as a7, ColorMap as a8, ColorVariantBackground as a9, ColorVariantInput as aa, EmphasisSurface as ae, IconCommand as ai, IconSetIcon as aj, IconSetLoader as ak, LayoutVariantDeck as al, LayoutVariantRole as am, ResolveColorRefOptions as ao, ResolveColorRefRoles as ap, ResolveColorRolesOptions as aq, SchemeColor as at, SchemeNeutrals as au, ColorVariant as b, RecordProvenance as c, CatalogOptions as d, CatalogRecordMap as g, CatalogRecords as h, CatalogReferenceSite as i, IconReference as j, IconResolution as k, IconSetRecord as l, ResolvedIcon as n, ResolvedReference as o };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fromMarkdown, toMarkdown } from './chunk-
|
|
2
|
-
import { fromYaml, toYaml } from './chunk-
|
|
1
|
+
import { fromMarkdown, toMarkdown } from './chunk-4UMZDDJG.js';
|
|
2
|
+
import { fromYaml, toYaml } from './chunk-P2ACZJUL.js';
|
|
3
3
|
import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
|
|
4
|
-
import { parseSource, validate, OPFValidationError } from './chunk-
|
|
5
|
-
import { checkCatalogsOption } from './chunk-
|
|
4
|
+
import { parseSource, validate, OPFValidationError } from './chunk-KNMMEE67.js';
|
|
5
|
+
import { checkCatalogsOption } from './chunk-LDLLZQPP.js';
|
|
6
6
|
|
|
7
7
|
// src/deck-report.ts
|
|
8
8
|
var DECK_FORMATS = ["json", "yaml", "markdown"];
|