@openpresentation/opf 0.36.0 → 0.37.1
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/THIRD-PARTY-NOTICES.md +99 -0
- package/dist/browser.js +19 -19
- package/dist/{catalog-refs-BgotJhR5.d.ts → catalog-refs-BeRgtpZS.d.ts} +4 -4
- package/dist/{catalog-schemas-BX-VEc5Q.d.ts → catalog-schemas-CwY-3cCP.d.ts} +1 -1
- package/dist/{chunk-6WVPFWPD.js → chunk-434E2RWO.js} +4 -4
- package/dist/{chunk-OFL3WY6F.js → chunk-63Y75CCK.js} +77 -15
- package/dist/{chunk-O65COLKF.js → chunk-BPILTZUJ.js} +118 -19
- package/dist/{chunk-4FA4AZXY.js → chunk-DDD4WUEH.js} +2375 -825
- package/dist/{chunk-MS2LPR7F.js → chunk-DMV3G65U.js} +1 -1
- package/dist/{chunk-AZELWKG2.js → chunk-EHYAVRL3.js} +5 -4
- package/dist/{chunk-7JE3XTL7.js → chunk-HBO64RWP.js} +4 -4
- package/dist/{chunk-J7FUSZZ5.js → chunk-HOK3DZA6.js} +6 -6
- package/dist/chunk-I4NQP7Z4.js +1 -0
- package/dist/{chunk-2NIID3QD.js → chunk-ITGR2RW2.js} +6 -6
- package/dist/chunk-IW4TXMJY.js +646 -0
- package/dist/{chunk-SER6GJTT.js → chunk-KB7TPZQI.js} +23 -6
- package/dist/{chunk-VDZXNNZF.js → chunk-M4IPCFDV.js} +1 -1
- package/dist/{chunk-F5SY7MSA.js → chunk-MNJ4JV7I.js} +1 -1
- package/dist/{chunk-XRMYP4JD.js → chunk-ORVMHVOS.js} +86 -2
- package/dist/{chunk-BPSZ7OWD.js → chunk-PDBZN7EJ.js} +26 -21
- package/dist/{chunk-3KPTVK77.js → chunk-Q2L5ERNK.js} +1248 -120
- package/dist/{chunk-HHQROUYC.js → chunk-QFT4R2IL.js} +4405 -2808
- package/dist/chunk-QQBOI5XI.js +86 -0
- package/dist/{chunk-TJMESSBQ.js → chunk-SIF5JDZC.js} +109 -9
- package/dist/{chunk-GNKOQ6NA.js → chunk-XY332BQP.js} +4 -4
- package/dist/{chunk-APCNAAA7.js → chunk-ZB427MLO.js} +2 -2
- package/dist/{composition-CSM7YfBl.d.ts → composition-DiKC371V.d.ts} +707 -134
- package/dist/composition.d.ts +3 -3
- package/dist/composition.js +1 -1
- package/dist/{conversion-CL7ipVGO.d.ts → conversion-DBkC9Y2e.d.ts} +6 -6
- package/dist/conversion-P56LOOE2.js +25 -0
- package/dist/convert.d.ts +5 -5
- package/dist/convert.js +63 -23
- package/dist/data.d.ts +41 -3
- package/dist/data.js +2 -2
- package/dist/{deck-report-DhsB0SUz.d.ts → deck-report-BwgsIRAf.d.ts} +3 -3
- package/dist/deck.d.ts +6 -6
- package/dist/deck.js +11 -11
- package/dist/diff.js +4 -4
- package/dist/docs.js +43 -31
- package/dist/examples.js +2338 -392
- package/dist/font-policy.js +1 -1
- package/dist/format.js +2 -2
- package/dist/ids.d.ts +17 -4
- package/dist/ids.js +4 -4
- package/dist/index.d.ts +140 -23
- package/dist/index.js +22 -22
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +8 -8
- package/dist/metric-data-B4Q8RFRR.d.ts +382 -0
- package/dist/node-engine.d.ts +6 -6
- package/dist/node-engine.js +21 -21
- package/dist/{pagination-BSqq32xt.d.ts → pagination-C9qnH_n-.d.ts} +5 -5
- package/dist/pagination.d.ts +4 -4
- package/dist/pagination.js +4 -4
- package/dist/patch.js +3 -3
- package/dist/precompiled.js +2 -2
- package/dist/{presentation-Dx-kZC8Y.d.ts → presentation-DmOhusrX.d.ts} +541 -110
- package/dist/schema-engine-ajv.js +1 -1
- package/dist/schema-engine-precompiled.js +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +3 -3
- package/dist/schemas.d.ts +46 -2
- package/dist/schemas.js +1 -1
- package/dist/shape-engine-eager.js +2 -2
- package/dist/shape-engine-lazy.js +1 -1
- package/dist/{shape-engine-module-N74FCHGY.js → shape-engine-module-YU2XGIQN.js} +2 -2
- package/dist/shape-geometry.js +1 -1
- package/dist/source.js +10 -11
- package/dist/spec/reference/engine-defaults.json +1 -1
- package/dist/spec/reference/engine-vocabularies.json +1 -0
- package/dist/spec/schemas/font-scheme.schema.json +9 -7
- package/dist/spec/schemas/layout.schema.json +5 -4
- package/dist/spec/schemas/narrative.schema.json +1 -0
- package/dist/spec/schemas/opf.schema.json +661 -98
- package/dist/types.d.ts +16 -12
- package/dist/{validation-types-bnrso0JL.d.ts → validation-types-CV-ngACL.d.ts} +49 -6
- package/dist/validator.d.ts +5 -5
- package/dist/validator.js +3 -3
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +7 -7
- package/package.json +7 -6
- package/dist/chart-data-B_k-WTex.d.ts +0 -194
- package/dist/chunk-6VGLE7C5.js +0 -3983
- package/dist/chunk-SEC4IOOS.js +0 -1
- package/dist/chunk-WCPDN7AY.js +0 -642
- package/dist/conversion-FTGQLJK7.js +0 -25
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
@openpresentation/opf is MIT (LICENSE). Its build includes parts of these packages, which are therefore not installed beside it. Each notice is the package's own license file.
|
|
4
|
+
|
|
5
|
+
## jsonc-parser
|
|
6
|
+
|
|
7
|
+
- Package: [jsonc-parser](https://www.npmjs.com/package/jsonc-parser) 3.3.1
|
|
8
|
+
- Homepage: https://github.com/microsoft/node-jsonc-parser
|
|
9
|
+
- License: MIT
|
|
10
|
+
- Copyright (c) Microsoft
|
|
11
|
+
- Included: the parser, scanner and string interning behind the source locator and the source checks (dist/source.js and the validator chunk)
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
The MIT License (MIT)
|
|
15
|
+
|
|
16
|
+
Copyright (c) Microsoft
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
SOFTWARE.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## ajv
|
|
38
|
+
|
|
39
|
+
- Package: [ajv](https://www.npmjs.com/package/ajv) 8.20.0
|
|
40
|
+
- Homepage: https://ajv.js.org
|
|
41
|
+
- License: MIT
|
|
42
|
+
- Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
43
|
+
- Included: two runtime helpers of the precompiled validators (ajv/dist/runtime/*)
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
The MIT License (MIT)
|
|
47
|
+
|
|
48
|
+
Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
49
|
+
|
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
51
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
52
|
+
in the Software without restriction, including without limitation the rights
|
|
53
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
54
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
55
|
+
furnished to do so, subject to the following conditions:
|
|
56
|
+
|
|
57
|
+
The above copyright notice and this permission notice shall be included in all
|
|
58
|
+
copies or substantial portions of the Software.
|
|
59
|
+
|
|
60
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
61
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
62
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
63
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
64
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
65
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
66
|
+
SOFTWARE.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## ajv-formats
|
|
70
|
+
|
|
71
|
+
- Package: [ajv-formats](https://www.npmjs.com/package/ajv-formats) 3.0.1
|
|
72
|
+
- Homepage: https://github.com/ajv-validator/ajv-formats
|
|
73
|
+
- License: MIT
|
|
74
|
+
- Copyright (c) 2020 Evgeny Poberezkin
|
|
75
|
+
- Included: the format checks of the precompiled validators (ajv-formats/dist/formats)
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
MIT License
|
|
79
|
+
|
|
80
|
+
Copyright (c) 2020 Evgeny Poberezkin
|
|
81
|
+
|
|
82
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
83
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
84
|
+
in the Software without restriction, including without limitation the rights
|
|
85
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
86
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
87
|
+
furnished to do so, subject to the following conditions:
|
|
88
|
+
|
|
89
|
+
The above copyright notice and this permission notice shall be included in all
|
|
90
|
+
copies or substantial portions of the Software.
|
|
91
|
+
|
|
92
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
93
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
94
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
95
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
96
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
97
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
98
|
+
SOFTWARE.
|
|
99
|
+
```
|
package/dist/browser.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { OPFApiError } from './chunk-
|
|
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-
|
|
1
|
+
import { OPFApiError } from './chunk-BPILTZUJ.js';
|
|
2
|
+
export { DEFAULT_FIX_ROUNDS, FIX_REPAIR_CATEGORIES, OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, copySlides, edit, embed, embedArrowPoints, embedCardLayout, fill, fillRecords, fix, isSafePatch, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog } from './chunk-BPILTZUJ.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-QQBOI5XI.js';
|
|
5
|
+
export { OPFDataImportError, declareColumns, inferColumnDeclaration, ingest, parseTabularData, storeCell, updateMetricLiterals } from './chunk-ORVMHVOS.js';
|
|
6
|
+
export { OPFPaginationError, blockUnits, continuationPages, continueOverfull, paginate, paginateSlide } from './chunk-PDBZN7EJ.js';
|
|
7
|
+
export { DECK_FORMATS, deckFormatOf, parse, stringify } from './chunk-XY332BQP.js';
|
|
8
|
+
export { fromMarkdown, toMarkdown } from './chunk-ITGR2RW2.js';
|
|
9
|
+
import './chunk-HOK3DZA6.js';
|
|
10
|
+
export { OPFFormatError, format } from './chunk-DMV3G65U.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-SIF5JDZC.js';
|
|
13
|
+
import './chunk-HBO64RWP.js';
|
|
14
|
+
import './chunk-MNJ4JV7I.js';
|
|
15
|
+
export { OPFMarkdownError } from './chunk-ZB427MLO.js';
|
|
16
|
+
import './chunk-EHYAVRL3.js';
|
|
17
|
+
export { OPFIdError, assignIds, touches } from './chunk-63Y75CCK.js';
|
|
18
|
+
export { diff, merge } from './chunk-434E2RWO.js';
|
|
19
|
+
export { CATALOG_SCHEMA, DEFAULT_VALIDATION_THRESHOLDS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, applyPatch, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogSchemaNames, collectSlideLinks, createValidator, credentialInSrc, documentHash, findValidationRule, idToken, isIdToken, parseInstant, renameRecordKeys, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSlideContext, slideLink, slideLinkId, toIdPatch, toIdPointer, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-DDD4WUEH.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,
|
|
21
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-Q2L5ERNK.js';
|
|
22
|
+
export { CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_TYPES, DEFAULT_VARIABLE_DATE_FORMAT, EMBED_DEFAULT_ASPECT, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, LANGUAGES, LOGO_SHAPES, OPFCatalogsOptionError, OPFUnresolvedReferenceError, OPFVariableError, SCHEME_COLOR_NAMES, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, VARIABLE_KINDS, asciiDigits, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, cellMatchesType, chartDrawDiagnostics, chartDrawPlan, chartNumber, coerceVariableValue, dataProvenance, dataSourcesOf, datasetColumnDeclaration, datasetDiagnostics, dateNamesOf, diagramsPending, embedAspect, embedIcons, embedSite, embedTitle, embedValue, ensureDiagrams, ensureIcons, ensureShapes, formatDataNumber, formatNumber, formatPercentNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, iconsPending, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isPlaceLabel, isSupportedNumberingSystem, isTemplate, isXYChartType, languageInEffect, listBuiltinVariables, listVariables, localizeDigits, longDatePattern, markLabelColor, mixOklab, nearIconNames, normalizeScriptGroup, numberFormatError, numberLocale, numberingSystemExtension, numberingSystemOf, numeralScripts, oklabToSrgb, parseIconReference, parseReference, pickTranslation, pinTableColorScale, plainLanguageTag, resolveChartData, resolveDataSource, resolveDesignRecords, resolveFontScheme, resolveIcon, resolveMetric, resolveReference, resolveSlideVariables, resolveTableColorScale, resolveTableData, resolveVariables, rowCells, rowId, shapesPending, srgbToOklab, suggestCellTypeFix, suggestChartNumberFix, supportedNumberingSystems, tableCellDisplayValue, tableColorScaleDiagnostics, tableColorScaleOf, tableColorScaleText, tableRows, toExcelNumberFormat, translationAt, translationLanguageAt, unresolvedReference, unusedDatasets, variableDeclarations, visibleLength } from './chunk-QFT4R2IL.js';
|
|
23
23
|
import './chunk-BLCDUM7B.js';
|
|
24
24
|
import './chunk-PRXZD2II.js';
|
|
25
25
|
|
|
@@ -235,10 +235,10 @@ interface ResolvedColorRoles {
|
|
|
235
235
|
interface ResolveColorRolesOptions {
|
|
236
236
|
/** The slide's resolved single-color background (solid, theme-slot or pattern background color). Omit for a gradient, picture or no background. */
|
|
237
237
|
background?: string | null;
|
|
238
|
-
/** The slide's variant (RR-96), as authored (`"dark1"` or the object form). It sets the map; without it the background's luminance (or `
|
|
238
|
+
/** The slide's variant (RR-96), as authored (`"dark1"` or the object form). It sets the map; without it the background's luminance (or `appearance`) chooses light1 or dark1. */
|
|
239
239
|
variant?: ColorVariantInput;
|
|
240
|
-
/** `dark` or `light` for a picture or gradient background that names its
|
|
241
|
-
|
|
240
|
+
/** `dark` or `light` for a picture or gradient background that names its appearance: it chooses dark1 or light1 when there is no `variant`. */
|
|
241
|
+
appearance?: 'dark' | 'light';
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* Resolve a color scheme's abstract roles for one slide: the single definition the opf-render preview, the
|
|
@@ -246,7 +246,7 @@ interface ResolveColorRolesOptions {
|
|
|
246
246
|
*
|
|
247
247
|
* RR-96: the roles come from the variant's map over the scheme's slots, as PowerPoint's roles do: background is bg1, text tx1,
|
|
248
248
|
* textSecondary tx2, surface bg2, and primary, secondary and accent the first three accents in the variant's order. Without
|
|
249
|
-
* `options.variant` the map is chosen from the slide: `options.
|
|
249
|
+
* `options.variant` the map is chosen from the slide: `options.appearance` for a picture or gradient that names one, else the luminance of
|
|
250
250
|
* `options.background` ({@link isDarkColor}; dark1 when dark, light1 otherwise), which is the earlier behavior. Role overrides on the
|
|
251
251
|
* scheme (`primary`, `secondary`, `accent`, `background`, `surface`, `text`, `textSecondary`) win over the slots they default to; a
|
|
252
252
|
* `text` override applies only on a light background, so a dark slide always gets readable light text. `roles.neutrals` holds every
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsonEqual, formatPointer } from './chunk-
|
|
2
|
-
import { annotationText } from './chunk-
|
|
1
|
+
import { jsonEqual, formatPointer } from './chunk-DDD4WUEH.js';
|
|
2
|
+
import { annotationText } from './chunk-QFT4R2IL.js';
|
|
3
3
|
|
|
4
4
|
// src/diff-match.ts
|
|
5
5
|
var DEFAULT_MATCH_THRESHOLD = 0.5;
|
|
@@ -372,7 +372,7 @@ function merge(base, ours, theirs, options = {}) {
|
|
|
372
372
|
|
|
373
373
|
// src/diff.ts
|
|
374
374
|
var isObject3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
375
|
-
var ROOT_CATEGORIES = { design: "design", assets: "assets", datasets: "datasets", catalogs: "catalogs", variables: "variables", narrative: "narrative", extensions: "extensions" };
|
|
375
|
+
var ROOT_CATEGORIES = { design: "design", assets: "assets", datasets: "datasets", datasources: "datasets", catalogs: "catalogs", variables: "variables", narrative: "narrative", extensions: "extensions" };
|
|
376
376
|
function categoryOf(tokens) {
|
|
377
377
|
const [root] = tokens;
|
|
378
378
|
if (root === void 0) return "metadata";
|
|
@@ -497,7 +497,7 @@ function diff(a, b, options = {}) {
|
|
|
497
497
|
diffValue(a, b, [], [], ctx);
|
|
498
498
|
return { equal: ctx.patch.length === 0, changes: ctx.changes, patch: ctx.patch, slides: ctx.slides, summary: summarize(ctx.changes, ctx.slides) };
|
|
499
499
|
}
|
|
500
|
-
var CONTENT_KINDS = ["blocks", "chart", "table", "code", "metric", "quote", "timeline", "diagram", "image", "video", "items", "bullets", "text"];
|
|
500
|
+
var CONTENT_KINDS = ["blocks", "chart", "table", "code", "metric", "quote", "timeline", "diagram", "image", "video", "embed", "items", "bullets", "text"];
|
|
501
501
|
function shorten(text, max = 60) {
|
|
502
502
|
const flat = text.replace(/\s+/gu, " ");
|
|
503
503
|
return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { applyPatch, normalizePatch, walkPatch, toIdPointer, resolveIdPointer, parsePointer, readPointer, idToken, formatPointer, isIdToken } from './chunk-
|
|
2
|
-
import { isRecord, visitContentPayloads } from './chunk-
|
|
1
|
+
import { applyPatch, normalizePatch, walkPatch, toIdPointer, resolveIdPointer, parsePointer, readPointer, idToken, formatPointer, isIdToken } from './chunk-DDD4WUEH.js';
|
|
2
|
+
import { isRecord, visitContentPayloads, visitPayloadItems, entryId } from './chunk-QFT4R2IL.js';
|
|
3
3
|
|
|
4
4
|
// src/ids.ts
|
|
5
5
|
var INDEX_TOKEN = /^(0|[1-9][0-9]*)$/;
|
|
@@ -21,16 +21,23 @@ function assignIds(document, options = {}) {
|
|
|
21
21
|
const known = (node) => {
|
|
22
22
|
if (typeof node.id === "string") taken.add(node.id);
|
|
23
23
|
};
|
|
24
|
+
const knownEntries = (node, path) => visitPayloadItems(node, path, (_kind, value) => {
|
|
25
|
+
if (isRecord(value) && typeof value.id === "string") taken.add(value.id);
|
|
26
|
+
});
|
|
24
27
|
slides.forEach((slide, index) => {
|
|
25
28
|
if (!isRecord(slide)) return;
|
|
26
29
|
known(slide);
|
|
27
|
-
|
|
30
|
+
knownEntries(slide, `/slides/${index}`);
|
|
31
|
+
visitContentPayloads(slide, `/slides/${index}`, (payload, path) => {
|
|
32
|
+
known(payload);
|
|
33
|
+
knownEntries(payload, path);
|
|
34
|
+
});
|
|
28
35
|
});
|
|
29
|
-
const counters = { slide: 0, block: 0 };
|
|
36
|
+
const counters = { slide: 0, block: 0, item: 0, bullet: 0, event: 0, row: 0 };
|
|
30
37
|
const byDefault = (kind) => {
|
|
31
38
|
let id;
|
|
32
39
|
do {
|
|
33
|
-
counters[kind]
|
|
40
|
+
counters[kind] = (counters[kind] ?? 0) + 1;
|
|
34
41
|
id = `${kind}-${counters[kind]}`;
|
|
35
42
|
} while (taken.has(id));
|
|
36
43
|
return id;
|
|
@@ -45,29 +52,57 @@ function assignIds(document, options = {}) {
|
|
|
45
52
|
};
|
|
46
53
|
const patch = [];
|
|
47
54
|
const assigned = [];
|
|
48
|
-
const
|
|
49
|
-
if (typeof node.id === "string") {
|
|
50
|
-
idOf.set(pointer, node.id);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (Object.hasOwn(node, "id")) return;
|
|
55
|
+
const mint = (kind, node, pointer) => {
|
|
54
56
|
let id;
|
|
55
57
|
if (options.generate) {
|
|
56
58
|
const parentId = parentIdOf(pointer);
|
|
57
59
|
id = options.generate({ kind, pointer, node, ...parentId !== void 0 ? { parentId } : {} });
|
|
58
60
|
if (typeof id !== "string" || id === "") throw new OPFIdError("invalid-id", `generate returned ${JSON.stringify(id)} for ${pointer}; an id is a non-empty string.`, pointer);
|
|
59
|
-
if (taken.has(id)) throw new OPFIdError("duplicate-id", `generate returned '${id}' for ${pointer}, which another slide or
|
|
61
|
+
if (taken.has(id)) throw new OPFIdError("duplicate-id", `generate returned '${id}' for ${pointer}, which another slide, block, item, event or row already has.`, pointer);
|
|
60
62
|
} else id = byDefault(kind);
|
|
61
63
|
taken.add(id);
|
|
62
64
|
idOf.set(pointer, id);
|
|
63
|
-
patch.push({ op: "add", path: `${pointer}/id`, value: id });
|
|
64
65
|
assigned.push({ pointer, kind, id });
|
|
66
|
+
return id;
|
|
67
|
+
};
|
|
68
|
+
const visit = (kind, node, pointer) => {
|
|
69
|
+
if (typeof node.id === "string") {
|
|
70
|
+
idOf.set(pointer, node.id);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (Object.hasOwn(node, "id")) return;
|
|
74
|
+
patch.push({ op: "add", path: `${pointer}/id`, value: mint(kind, node, pointer) });
|
|
75
|
+
};
|
|
76
|
+
const visitEntries = (payload, path) => {
|
|
77
|
+
if (!options.items) return;
|
|
78
|
+
visitPayloadItems(payload, path, (kind, value, pointer) => {
|
|
79
|
+
if (isRecord(value)) {
|
|
80
|
+
const id = entryId(value);
|
|
81
|
+
if (id !== void 0) {
|
|
82
|
+
idOf.set(pointer, id);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (Object.hasOwn(value, "id")) return;
|
|
86
|
+
patch.push({ op: "add", path: `${pointer}/id`, value: mint(kind, value, pointer) });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (kind === "row") {
|
|
90
|
+
if (!Array.isArray(value)) return;
|
|
91
|
+
patch.push({ op: "replace", path: pointer, value: { id: mint(kind, { cells: value }, pointer), cells: value } });
|
|
92
|
+
} else if (typeof value === "string" || Array.isArray(value)) {
|
|
93
|
+
patch.push({ op: "replace", path: pointer, value: { id: mint(kind, { text: value }, pointer), text: value } });
|
|
94
|
+
}
|
|
95
|
+
});
|
|
65
96
|
};
|
|
66
97
|
slides.forEach((slide, index) => {
|
|
67
98
|
if (!isRecord(slide)) return;
|
|
68
99
|
const pointer = `/slides/${index}`;
|
|
69
100
|
visit("slide", slide, pointer);
|
|
70
|
-
|
|
101
|
+
visitEntries(slide, pointer);
|
|
102
|
+
visitContentPayloads(slide, pointer, (payload, path) => {
|
|
103
|
+
visit("block", payload, path);
|
|
104
|
+
visitEntries(payload, path);
|
|
105
|
+
});
|
|
71
106
|
});
|
|
72
107
|
return { document: applyPatch(document, patch), patch, assigned };
|
|
73
108
|
}
|
|
@@ -100,7 +135,8 @@ function locate(tokens, document, readOnlyOrReplace) {
|
|
|
100
135
|
if (tokens[2] === "design") return out("design", "other");
|
|
101
136
|
let kind = "slide", shape = "other";
|
|
102
137
|
let node = slide.node;
|
|
103
|
-
|
|
138
|
+
let i = 2;
|
|
139
|
+
while (i < tokens.length) {
|
|
104
140
|
const token = tokens[i];
|
|
105
141
|
if (token === "blocks") {
|
|
106
142
|
kind = "block";
|
|
@@ -116,6 +152,26 @@ function locate(tokens, document, readOnlyOrReplace) {
|
|
|
116
152
|
shape = i === tokens.length ? "payload" : "other";
|
|
117
153
|
} else break;
|
|
118
154
|
}
|
|
155
|
+
if (shape === "other" && node) {
|
|
156
|
+
const name = tokens[i];
|
|
157
|
+
let list, at = i + 1;
|
|
158
|
+
if (name === "items" || name === "bullets") list = node[name];
|
|
159
|
+
else if (name === "table" && tokens[i + 1] === "rows" && isRecord(node.table)) {
|
|
160
|
+
list = node.table.rows;
|
|
161
|
+
at = i + 2;
|
|
162
|
+
} else if (name === "timeline") {
|
|
163
|
+
const timeline = node.timeline;
|
|
164
|
+
if (Array.isArray(timeline)) list = timeline;
|
|
165
|
+
else if (isRecord(timeline) && tokens[i + 1] === "events") {
|
|
166
|
+
list = timeline.events;
|
|
167
|
+
at = i + 2;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (list !== void 0 && tokens[at] !== void 0) {
|
|
171
|
+
const entry = elementAt(list, tokens[at]);
|
|
172
|
+
if (entry.id !== void 0) ids.push(entry.id);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
119
175
|
return out(kind, shape);
|
|
120
176
|
}
|
|
121
177
|
function idsWithin(shape, value, into) {
|
|
@@ -125,8 +181,14 @@ function idsWithin(shape, value, into) {
|
|
|
125
181
|
into.ids.push(node.id);
|
|
126
182
|
if (slide) into.slideIds.push(node.id);
|
|
127
183
|
}
|
|
184
|
+
const entries = (owner) => visitPayloadItems(owner, "", (_kind, entry) => {
|
|
185
|
+
const id = entryId(entry);
|
|
186
|
+
if (id !== void 0) into.ids.push(id);
|
|
187
|
+
});
|
|
188
|
+
entries(node);
|
|
128
189
|
visitContentPayloads(node, "", (child) => {
|
|
129
190
|
if (typeof child.id === "string") into.ids.push(child.id);
|
|
191
|
+
entries(child);
|
|
130
192
|
});
|
|
131
193
|
};
|
|
132
194
|
if (shape === "document") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OPFDataImportError, parseTabularData } from './chunk-
|
|
2
|
-
import { refreshStaleLayouts, applyPatchWithInverse, validate, OPFValidationError, createValidator, documentHash, applyPatch, OPFPatchError, parsePointer } from './chunk-
|
|
3
|
-
import { embeddedCopy, checkCatalogsOption, catalogReferenceSites, parseReference, catalogGroupDeclared, resolveReference, dottedPath, unresolvedReference, recordReferenceSites, catalogGroupSource, registeredCatalog, catalogKinds, CATALOG_GROUP_PATTERN, isRecord, visitContentPayloads, cellBlocks, annotationText, listVariables, resolveVariables, LOGO_SHAPES, resolveDesignRecords, resolveFontFamilies, resolveCanvasDimensions, imageBackground } from './chunk-
|
|
1
|
+
import { OPFDataImportError, parseTabularData, updateMetricLiterals } from './chunk-ORVMHVOS.js';
|
|
2
|
+
import { refreshStaleLayouts, applyPatchWithInverse, validate, OPFValidationError, createValidator, documentHash, applyPatch, OPFPatchError, parsePointer } from './chunk-DDD4WUEH.js';
|
|
3
|
+
import { embeddedCopy, checkCatalogsOption, catalogReferenceSites, parseReference, catalogGroupDeclared, resolveReference, dottedPath, unresolvedReference, recordReferenceSites, catalogGroupSource, registeredCatalog, catalogKinds, CATALOG_GROUP_PATTERN, isRecord, visitContentPayloads, cellBlocks, annotationText, listVariables, resolveTextStyle, textWidthMeasurer, resolveVariables, snapFontSizeDown, LOGO_SHAPES, embedValue, tableRows, resolveDesignRecords, resolveFontFamilies, resolveCanvasDimensions, fitText, imageBackground } from './chunk-QFT4R2IL.js';
|
|
4
4
|
|
|
5
5
|
// src/api-errors.ts
|
|
6
6
|
var OPFApiError = class extends Error {
|
|
@@ -348,7 +348,7 @@ function moveToCustom(document, ref, options = {}) {
|
|
|
348
348
|
|
|
349
349
|
// src/stats.ts
|
|
350
350
|
var DEFAULT_WORDS_PER_MINUTE = 130;
|
|
351
|
-
var KIND_ORDER = ["text", "items", "bullets", "quote", "metric", "code", "timeline", "diagram", "chart", "table", "image", "video"];
|
|
351
|
+
var KIND_ORDER = ["text", "items", "bullets", "quote", "metric", "code", "timeline", "diagram", "chart", "table", "image", "video", "embed"];
|
|
352
352
|
var FURNITURE_FIELDS = ["image", "text", "socials", "date"];
|
|
353
353
|
var ZONES = ["start", "center", "end"];
|
|
354
354
|
var WORD = /[\p{L}\p{N}\p{M}]+(?:['’.,-][\p{L}\p{N}\p{M}]+)*/gu;
|
|
@@ -549,7 +549,7 @@ function compute(presentation2, options, onFile) {
|
|
|
549
549
|
useAsset(entry.photo);
|
|
550
550
|
images.speakerPhotos++;
|
|
551
551
|
}
|
|
552
|
-
return { id: str(entry.id) ?? "", name: str(entry.name) ?? "", title: str(entry.title),
|
|
552
|
+
return { id: str(entry.id) ?? "", name: str(entry.name) ?? "", title: str(entry.title), organization: str(entry.organization), hasPhoto };
|
|
553
553
|
});
|
|
554
554
|
designAssets(design, "deck");
|
|
555
555
|
for (const variable of Object.values(isRecord(deck.variables) ? deck.variables : {})) if (isRecord(variable) && variable.type === "image") useAsset(variable.value);
|
|
@@ -573,11 +573,11 @@ function compute(presentation2, options, onFile) {
|
|
|
573
573
|
};
|
|
574
574
|
const datasetRecords = isRecord(deck.datasets) ? Object.entries(deck.datasets).filter(([, value]) => isRecord(value)) : [];
|
|
575
575
|
const datasetUse = /* @__PURE__ */ new Map();
|
|
576
|
-
const payloadCounts = { text: 0, items: 0, bullets: 0, quote: 0, metric: 0, code: 0, timeline: 0, diagram: 0, chart: 0, table: 0, image: 0, video: 0, blocks: 0, cells: 0, groups: 0, maxDepth: 0 };
|
|
576
|
+
const payloadCounts = { text: 0, items: 0, bullets: 0, quote: 0, metric: 0, code: 0, timeline: 0, diagram: 0, chart: 0, table: 0, image: 0, video: 0, embed: 0, blocks: 0, cells: 0, groups: 0, maxDepth: 0 };
|
|
577
577
|
const layouts = /* @__PURE__ */ new Map(), chartTypes = /* @__PURE__ */ new Map(), extensions = /* @__PURE__ */ new Set();
|
|
578
|
-
const chartData = { inline: 0, dataset: 0,
|
|
578
|
+
const chartData = { inline: 0, dataset: 0, withDatasource: 0 };
|
|
579
579
|
const tableItems = [];
|
|
580
|
-
let
|
|
580
|
+
let tableRows2 = 0, tableColumns = 0, datasetBackedTables = 0, chartTotal = 0, captions = 0;
|
|
581
581
|
const hidden = [], withoutNotes = [], sections = [];
|
|
582
582
|
let withTitle = 0, withBeat = 0, unsectioned = 0, withoutLayout = 0, withOwnDesign = 0, withNotes = 0, contentWords = 0, notesWords = 0;
|
|
583
583
|
const headerOverrides = { header: 0, headerSuppressed: 0, footer: 0, footerSuppressed: 0 };
|
|
@@ -656,6 +656,10 @@ function compute(presentation2, options, onFile) {
|
|
|
656
656
|
useAsset(node.video, true);
|
|
657
657
|
images.videos++;
|
|
658
658
|
}
|
|
659
|
+
if (node.embed !== void 0) {
|
|
660
|
+
const preview = embedValue(node.embed)?.preview;
|
|
661
|
+
if (preview !== void 0) useAsset(preview);
|
|
662
|
+
}
|
|
659
663
|
if (isRecord(node.chart)) {
|
|
660
664
|
chartTotal++;
|
|
661
665
|
slideCharts++;
|
|
@@ -666,7 +670,7 @@ function compute(presentation2, options, onFile) {
|
|
|
666
670
|
chartData.dataset++;
|
|
667
671
|
bump(datasetUse, data.dataset);
|
|
668
672
|
} else if (Array.isArray(data.columns) || Array.isArray(data.rows)) chartData.inline++;
|
|
669
|
-
if (
|
|
673
|
+
if (data.datasource !== void 0) chartData.withDatasource++;
|
|
670
674
|
}
|
|
671
675
|
}
|
|
672
676
|
if (isRecord(node.table)) {
|
|
@@ -681,13 +685,13 @@ function compute(presentation2, options, onFile) {
|
|
|
681
685
|
rows = Array.isArray(source?.rows) ? source.rows.length : 0;
|
|
682
686
|
columns = Array.isArray(table.fields) ? table.fields.length : Array.isArray(source?.columns) ? source.columns.length : 0;
|
|
683
687
|
} else {
|
|
684
|
-
const body =
|
|
685
|
-
rows =
|
|
686
|
-
columns = Array.isArray(table.columns) ? table.columns.length : body.reduce((widest, row) => Math.max(widest,
|
|
688
|
+
const body = tableRows(table).map((row) => row.cells);
|
|
689
|
+
rows = Array.isArray(table.rows) ? table.rows.length : 0;
|
|
690
|
+
columns = Array.isArray(table.columns) ? table.columns.length : body.reduce((widest, row) => Math.max(widest, row.length), 0);
|
|
687
691
|
run(table.columns);
|
|
688
692
|
for (const row of body) run(row);
|
|
689
693
|
}
|
|
690
|
-
|
|
694
|
+
tableRows2 += rows;
|
|
691
695
|
tableColumns += columns;
|
|
692
696
|
tableItems.push({ slide: index, path: `${path}/table`, rows, columns, dataset });
|
|
693
697
|
}
|
|
@@ -761,7 +765,7 @@ function compute(presentation2, options, onFile) {
|
|
|
761
765
|
title: str(value.title),
|
|
762
766
|
columns: Array.isArray(value.columns) ? value.columns.length : 0,
|
|
763
767
|
rows: Array.isArray(value.rows) ? value.rows.length : 0,
|
|
764
|
-
|
|
768
|
+
datasource: typeof value.datasource === "string" ? value.datasource : isRecord(value.datasource) ? str(value.datasource.src) : null,
|
|
765
769
|
referencedBy: datasetUse.get(id) ?? 0
|
|
766
770
|
}));
|
|
767
771
|
const references = Array.isArray(deck.references) ? deck.references.filter(isRecord) : [];
|
|
@@ -830,8 +834,8 @@ function compute(presentation2, options, onFile) {
|
|
|
830
834
|
speakingTime: { basis: "estimate", wordsPerMinute, notesWords, minutes: decimals(notesWords / wordsPerMinute, 1), declaredMinutes: deckFacts.declaredMinutes },
|
|
831
835
|
images,
|
|
832
836
|
charts: { total: chartTotal, byType: sortedCounts(chartTypes), data: chartData },
|
|
833
|
-
tables: { total: tableItems.length, datasetBacked: datasetBackedTables, rows:
|
|
834
|
-
datasets: { count: datasetItems.length,
|
|
837
|
+
tables: { total: tableItems.length, datasetBacked: datasetBackedTables, rows: tableRows2, columns: tableColumns, items: tableItems },
|
|
838
|
+
datasets: { count: datasetItems.length, withDatasource: datasetRecords.filter(([, value]) => value.datasource !== void 0).length, items: datasetItems },
|
|
835
839
|
citations: { references: references.length, cited, citations: total.citations, footnotes: total.footnotes, captions, links: total.links },
|
|
836
840
|
variables: variableFacts,
|
|
837
841
|
assets: { registry: registryFacts, uses, embeddedBytes: embeddedTotal },
|
|
@@ -849,6 +853,93 @@ function compute(presentation2, options, onFile) {
|
|
|
849
853
|
return result;
|
|
850
854
|
}
|
|
851
855
|
|
|
856
|
+
// src/embed-card.ts
|
|
857
|
+
function embedArrowPoints(box) {
|
|
858
|
+
const size = Math.min(box.width, box.height), left = box.x + (box.width - size) / 2, top = box.y + (box.height - size) / 2;
|
|
859
|
+
const local = [[0, 0.25], [0.5, 0.25], [0.5, 0], [1, 0.5], [0.5, 1], [0.5, 0.75], [0, 0.75]];
|
|
860
|
+
const cx = left + size / 2, cy = top + size / 2, cos = Math.SQRT1_2, sin = -Math.SQRT1_2;
|
|
861
|
+
return local.map(([u, v]) => {
|
|
862
|
+
const dx = left + u * size - cx, dy = top + v * size - cy;
|
|
863
|
+
return [round(cx + dx * cos - dy * sin), round(cy + dx * sin + dy * cos)];
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
var round = (value) => Math.round(value * 1e3) / 1e3;
|
|
867
|
+
var TITLE_SIZE = 28;
|
|
868
|
+
var TITLE_CEILING = 40;
|
|
869
|
+
var TITLE_SHARE = 0.1;
|
|
870
|
+
var SITE_SIZE = 18;
|
|
871
|
+
var MAX_TITLE_LINES = 3;
|
|
872
|
+
function embedCardTitleSize(short, scale) {
|
|
873
|
+
return snapFontSizeDown(Math.min(TITLE_CEILING * scale, Math.max(TITLE_SIZE * scale, TITLE_SHARE * short)));
|
|
874
|
+
}
|
|
875
|
+
function embedCardLayout(input) {
|
|
876
|
+
const { frame, scale: s } = input, floor = (input.minFontSizePx ?? 16) * s;
|
|
877
|
+
const short = Math.min(frame.width, frame.height);
|
|
878
|
+
const pad = Math.max(Math.min(6 * s, short / 4), Math.min(24 * s, short * 0.08));
|
|
879
|
+
const centerX = frame.x + frame.width / 2, centerY = frame.y + frame.height / 2;
|
|
880
|
+
const radius = Math.min(12 * s, short / 6);
|
|
881
|
+
const sizes = (grow) => {
|
|
882
|
+
const badge = Math.max(Math.min(short - 2 * pad, 40 * s * grow), Math.min(short / 2, 12 * s));
|
|
883
|
+
return { badge, gap: 10 * s * grow, siteGap: 6 * s * grow, siteSize: Math.max(floor, snapFontSizeDown(SITE_SIZE * s * grow)) };
|
|
884
|
+
};
|
|
885
|
+
const badgeLayout = (size, top2) => {
|
|
886
|
+
const badge = { x: round(centerX - size / 2), y: round(top2), width: round(size), height: round(size) };
|
|
887
|
+
const glyph = size * 0.56, arrow = { x: round(centerX - glyph / 2), y: round(top2 + (size - glyph) / 2), width: round(glyph), height: round(glyph) };
|
|
888
|
+
return { frame, radius, icon: { badge, arrow, points: embedArrowPoints(arrow) } };
|
|
889
|
+
};
|
|
890
|
+
const only = sizes(1).badge;
|
|
891
|
+
const badgeOnly = badgeLayout(only, centerY - only / 2);
|
|
892
|
+
const width = frame.width - 2 * pad, room = frame.height - 2 * pad;
|
|
893
|
+
if (!(width > 0) || !(room > 0)) return badgeOnly;
|
|
894
|
+
const headingStyle = resolveTextStyle({ fontFamily: input.headingFamily, fontWeight: 700 }, input.measurement);
|
|
895
|
+
const bodyStyle = resolveTextStyle({ fontFamily: input.bodyFamily, fontWeight: 400 }, input.measurement);
|
|
896
|
+
const measureTitle = textWidthMeasurer(headingStyle, input.measurement), measureSite = textWidthMeasurer(bodyStyle, input.measurement);
|
|
897
|
+
const left = frame.x + pad;
|
|
898
|
+
const clip = (text2, size, measure) => {
|
|
899
|
+
if (measure(text2, size) <= width) return text2;
|
|
900
|
+
let end = text2.length;
|
|
901
|
+
while (end > 0 && measure(`${text2.slice(0, end).trimEnd()}\u2026`, size) > width) end--;
|
|
902
|
+
return `${text2.slice(0, end).trimEnd()}\u2026`;
|
|
903
|
+
};
|
|
904
|
+
const text = (lines, size, lineHeight, clipped, style, measure) => ({ box: { x: left, y: 0, width, height: round(lines.length * lineHeight) }, lines, lineWidths: lines.map((line) => round(measure(line, size))), align: "center", fontSize: size, lineHeight, clipped, style });
|
|
905
|
+
const titleAt = (size, avail) => {
|
|
906
|
+
const fit = fitText(input.title, { x: left, y: 0, width, height: 1e6 }, size, size, measureTitle);
|
|
907
|
+
if (fit.lines.length <= MAX_TITLE_LINES && fit.lines.length * fit.lineHeight <= avail + 1e-6) return text(fit.lines, fit.fontSize, fit.lineHeight, false, headingStyle, measureTitle);
|
|
908
|
+
if (size > floor + 1e-9) return void 0;
|
|
909
|
+
const allowed = Math.min(MAX_TITLE_LINES, Math.floor((avail + 1e-6) / fit.lineHeight));
|
|
910
|
+
if (allowed < 1) return void 0;
|
|
911
|
+
const lines = fit.lines.slice(0, allowed);
|
|
912
|
+
lines[allowed - 1] = clip(fit.lines.slice(allowed - 1).join(" "), fit.fontSize, measureTitle);
|
|
913
|
+
return text(lines, fit.fontSize, fit.lineHeight, true, headingStyle, measureTitle);
|
|
914
|
+
};
|
|
915
|
+
const nominal = embedCardTitleSize(short, s);
|
|
916
|
+
const block = (withSite2) => {
|
|
917
|
+
for (let size = nominal; ; size = Math.max(floor, snapFontSizeDown(size - s))) {
|
|
918
|
+
const grow = Math.max(1, size / (TITLE_SIZE * s)), p2 = sizes(grow), siteLine2 = p2.siteSize * 1.3;
|
|
919
|
+
const title2 = titleAt(size, room - p2.badge - p2.gap - (withSite2 ? siteLine2 + p2.siteGap : 0));
|
|
920
|
+
if (title2 && (!title2.clipped || size <= floor + 1e-9)) return { title: title2, p: p2, siteLine: siteLine2, size };
|
|
921
|
+
if (size <= floor + 1e-9) return void 0;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
let chosen = input.site === input.title ? void 0 : block(true), withSite = true;
|
|
925
|
+
if (!chosen || chosen.title.clipped) {
|
|
926
|
+
chosen = block(false);
|
|
927
|
+
withSite = false;
|
|
928
|
+
}
|
|
929
|
+
if (!chosen) return badgeOnly;
|
|
930
|
+
const { title, p, siteLine } = chosen;
|
|
931
|
+
const height = p.badge + p.gap + title.box.height + (withSite ? p.siteGap + siteLine : 0), top = centerY - height / 2;
|
|
932
|
+
const layout2 = badgeLayout(p.badge, top);
|
|
933
|
+
title.box.y = round(top + p.badge + p.gap);
|
|
934
|
+
layout2.title = title;
|
|
935
|
+
if (withSite) {
|
|
936
|
+
const site = text([clip(input.site, p.siteSize, measureSite)], p.siteSize, siteLine, false, bodyStyle, measureSite);
|
|
937
|
+
site.box.y = round(title.box.y + title.box.height + p.siteGap);
|
|
938
|
+
layout2.site = site;
|
|
939
|
+
}
|
|
940
|
+
return layout2;
|
|
941
|
+
}
|
|
942
|
+
|
|
852
943
|
// src/edit.ts
|
|
853
944
|
function edit(deck, patch, options = {}) {
|
|
854
945
|
const result = applyPatchWithInverse(deck, patch, options.expectHash === void 0 ? {} : { expectHash: options.expectHash });
|
|
@@ -965,13 +1056,21 @@ function fill(template, data, options = {}) {
|
|
|
965
1056
|
const records = data === void 0 ? [{}] : typeof data === "string" ? fillRecords(data, options) : Array.isArray(data) ? [...data] : [data];
|
|
966
1057
|
if (!records.length) throw new OPFDataImportError("Data contains no records.");
|
|
967
1058
|
if (!records.every(isRecord2)) throw new OPFDataImportError("Each record must be an object keyed by variable id.");
|
|
968
|
-
const decks = records.map((record, offset) =>
|
|
1059
|
+
const decks = records.map((record, offset) => {
|
|
1060
|
+
const resolved = resolveVariables(template, record, { template: false, partial: options.partial === true, examples: options.examples === true });
|
|
1061
|
+
const { id: _template, ...filled } = resolved.presentation;
|
|
1062
|
+
const presentation2 = updateMetricLiterals(filled);
|
|
1063
|
+
return { index: offset + 1, record, ...resolved, presentation: presentation2 };
|
|
1064
|
+
});
|
|
1065
|
+
const removed = /* @__PURE__ */ new Map();
|
|
1066
|
+
for (const deck of decks) for (const entry of deck.diagnostics) if (entry.code === "variable-translations-removed") removed.set(entry.id, [...removed.get(entry.id) ?? [], deck.index]);
|
|
969
1067
|
return {
|
|
970
1068
|
decks: decks.map(({ index, record, presentation: presentation2, diagnostics, unfilled, complete }) => ({ index, record, presentation: presentation2, diagnostics, unfilled, complete })),
|
|
971
1069
|
...options.combine ? { presentation: combine(decks) } : {},
|
|
972
1070
|
complete: decks.every((deck) => deck.complete),
|
|
973
1071
|
unfilled: [...new Set(decks.flatMap((deck) => deck.unfilled))],
|
|
974
|
-
diagnostics: summarize(decks)
|
|
1072
|
+
diagnostics: summarize(decks),
|
|
1073
|
+
...removed.size ? { translationsRemoved: [...removed].map(([id, records2]) => ({ id, records: records2 })) } : {}
|
|
975
1074
|
};
|
|
976
1075
|
}
|
|
977
1076
|
function combine(decks) {
|
|
@@ -1011,4 +1110,4 @@ function summarize(decks) {
|
|
|
1011
1110
|
return [...merged.values()];
|
|
1012
1111
|
}
|
|
1013
1112
|
|
|
1014
|
-
export { DEFAULT_FIX_ROUNDS, FIX_REPAIR_CATEGORIES, OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, asApiError, copySlides, edit, embed, fill, fillRecords, fix, isSafePatch, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog };
|
|
1113
|
+
export { DEFAULT_FIX_ROUNDS, FIX_REPAIR_CATEGORIES, OPFApiError, OPFExportError, OPFImportError, OPFMoveToCustomError, asApiError, copySlides, edit, embed, embedArrowPoints, embedCardLayout, fill, fillRecords, fix, isSafePatch, localAssetSources, moveToCustom, parseSlideSelection, sameRecord, stats, updateFromCatalog };
|