@openpresentation/opf 0.10.1 → 0.11.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/dist/{catalogs-DoVmvDr7.d.ts → catalogs-DJ-B5ZyD.d.ts} +79 -9
- package/dist/catalogs.d.ts +2 -2
- package/dist/catalogs.js +1 -1
- package/dist/{chunk-PQJRDNA6.js → chunk-6UPHKXI5.js} +381 -34
- package/dist/{chunk-TU7I3KSB.js → chunk-7LF37SG3.js} +7400 -5422
- package/dist/{chunk-EWJNRHXA.js → chunk-BP6WMSSS.js} +3 -3
- package/dist/{chunk-FHGJX5QK.js → chunk-KWIOQ3QR.js} +73 -32
- package/dist/{chunk-D3GQIREP.js → chunk-LTSDDBNW.js} +558 -52
- package/dist/{chunk-ZIL7MGZU.js → chunk-M4GTWRK7.js} +333 -102
- package/dist/chunk-NPYN4TZ5.js +3516 -0
- package/dist/{chunk-RS5GZ5RW.js → chunk-SDETQV7Y.js} +161 -0
- package/dist/composition-DzLwY-Mi.d.ts +887 -0
- package/dist/composition.d.ts +1 -676
- package/dist/composition.js +1 -1
- package/dist/docs.js +80 -20
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +11 -11
- package/dist/font-policy.d.ts +123 -0
- package/dist/font-policy.js +1 -0
- package/dist/index.d.ts +184 -4
- package/dist/index.js +473 -7
- package/dist/lint.d.ts +3 -3
- package/dist/lint.js +5 -5
- package/dist/pagination.d.ts +6 -2
- package/dist/pagination.js +5 -5
- package/dist/{presentation-BMTdX6O1.d.ts → presentation-bceTClm8.d.ts} +297 -30
- package/dist/repo-readme.js +1 -1
- package/dist/{schemas-BYe5y8-i.d.ts → schemas-X_NniU4A.d.ts} +8 -0
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/spec/catalogs/audiences/academic.json +24 -0
- package/dist/spec/catalogs/audiences/all-hands.json +3 -1
- package/dist/spec/catalogs/audiences/board.json +3 -1
- package/dist/spec/catalogs/audiences/customer.json +25 -0
- package/dist/spec/catalogs/audiences/executive.json +24 -0
- package/dist/spec/catalogs/audiences/general-public.json +25 -0
- package/dist/spec/catalogs/audiences/index.json +73 -1
- package/dist/spec/catalogs/audiences/internal-team.json +25 -0
- package/dist/spec/catalogs/audiences/investor.json +25 -0
- package/dist/spec/catalogs/audiences/marketing.json +25 -0
- package/dist/spec/catalogs/audiences/media.json +24 -0
- package/dist/spec/catalogs/audiences/partner.json +25 -0
- package/dist/spec/catalogs/audiences/regulatory.json +25 -0
- package/dist/spec/catalogs/audiences/sales.json +25 -0
- package/dist/spec/catalogs/audiences/technical.json +25 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-column-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-column-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-bullet-column.json +5 -0
- package/dist/spec/catalogs/chart-types/100pct-progress-bar.json +10 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-area-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-area-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/100pct-stacked-bar-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-bar-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/100pct-stacked-column-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-column-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/area.json +5 -0
- package/dist/spec/catalogs/chart-types/australia.json +10 -0
- package/dist/spec/catalogs/chart-types/bar.json +5 -0
- package/dist/spec/catalogs/chart-types/box-and-whisker-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/box-and-whisker-3x.json +10 -0
- package/dist/spec/catalogs/chart-types/box-and-whisker.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-bar-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-bar-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-bar.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-column-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-column-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/bullet-column.json +5 -0
- package/dist/spec/catalogs/chart-types/canada.json +10 -0
- package/dist/spec/catalogs/chart-types/clustered-bar-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/clustered-column.json +10 -0
- package/dist/spec/catalogs/chart-types/column.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot-4x.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot-5x.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot-6x.json +5 -0
- package/dist/spec/catalogs/chart-types/dot-plot.json +5 -0
- package/dist/spec/catalogs/chart-types/doughnut.json +5 -0
- package/dist/spec/catalogs/chart-types/dumbbell.json +5 -0
- package/dist/spec/catalogs/chart-types/filled-radar.json +5 -0
- package/dist/spec/catalogs/chart-types/funnel.json +5 -0
- package/dist/spec/catalogs/chart-types/histogram.json +5 -0
- package/dist/spec/catalogs/chart-types/index.json +333 -233
- package/dist/spec/catalogs/chart-types/line-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/line-3x.json +10 -0
- package/dist/spec/catalogs/chart-types/line-with-high-low-and-markers.json +5 -0
- package/dist/spec/catalogs/chart-types/line-with-high-low.json +5 -0
- package/dist/spec/catalogs/chart-types/line-with-markers-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/line-with-markers-3x.json +10 -0
- package/dist/spec/catalogs/chart-types/line-with-markers.json +5 -0
- package/dist/spec/catalogs/chart-types/line.json +5 -0
- package/dist/spec/catalogs/chart-types/pareto.json +9 -14
- package/dist/spec/catalogs/chart-types/pie.json +5 -0
- package/dist/spec/catalogs/chart-types/radar-with-markers.json +5 -0
- package/dist/spec/catalogs/chart-types/radar.json +5 -0
- package/dist/spec/catalogs/chart-types/scatter.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline-2x.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline-3x.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline-4x.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline-5x.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline-6x.json +5 -0
- package/dist/spec/catalogs/chart-types/sparkline.json +5 -0
- package/dist/spec/catalogs/chart-types/stacked-area-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/stacked-area-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/stacked-bar-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/stacked-bar-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/stacked-column-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/stacked-column-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/stacked-line-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/stacked-line-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/stacked-line-with-markers-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/stacked-line-with-markers-3x.json +6 -1
- package/dist/spec/catalogs/chart-types/treemap-2x.json +10 -0
- package/dist/spec/catalogs/chart-types/treemap-3x.json +10 -0
- package/dist/spec/catalogs/chart-types/treemap.json +5 -0
- package/dist/spec/catalogs/chart-types/united-kingdom.json +10 -0
- package/dist/spec/catalogs/chart-types/united-states.json +10 -0
- package/dist/spec/catalogs/chart-types/waterfall.json +5 -0
- package/dist/spec/catalogs/chart-types/world.json +6 -1
- package/dist/spec/catalogs/font-schemes/consolas.json +3 -0
- package/dist/spec/catalogs/font-schemes/courier-new.json +3 -0
- package/dist/spec/catalogs/languages/afrikaans.json +3 -0
- package/dist/spec/catalogs/languages/albanian.json +3 -0
- package/dist/spec/catalogs/languages/amharic.json +3 -0
- package/dist/spec/catalogs/languages/arabic.json +3 -0
- package/dist/spec/catalogs/languages/armenian.json +3 -0
- package/dist/spec/catalogs/languages/aymara.json +3 -0
- package/dist/spec/catalogs/languages/azerbaijani.json +3 -0
- package/dist/spec/catalogs/languages/bengali.json +3 -0
- package/dist/spec/catalogs/languages/berber-latin.json +3 -0
- package/dist/spec/catalogs/languages/bosnian-latin.json +3 -0
- package/dist/spec/catalogs/languages/bulgarian.json +3 -0
- package/dist/spec/catalogs/languages/catalan.json +3 -0
- package/dist/spec/catalogs/languages/cebuano.json +3 -0
- package/dist/spec/catalogs/languages/chinese-simplified.json +3 -0
- package/dist/spec/catalogs/languages/chinese-traditional.json +3 -0
- package/dist/spec/catalogs/languages/chittagonian.json +3 -0
- package/dist/spec/catalogs/languages/croatian.json +3 -0
- package/dist/spec/catalogs/languages/czech.json +3 -0
- package/dist/spec/catalogs/languages/danish.json +3 -0
- package/dist/spec/catalogs/languages/dutch.json +3 -0
- package/dist/spec/catalogs/languages/english-au.json +3 -0
- package/dist/spec/catalogs/languages/english-ca.json +3 -0
- package/dist/spec/catalogs/languages/english-gb.json +3 -0
- package/dist/spec/catalogs/languages/english-in.json +3 -0
- package/dist/spec/catalogs/languages/english-us.json +3 -0
- package/dist/spec/catalogs/languages/english.json +3 -0
- package/dist/spec/catalogs/languages/estonian.json +3 -0
- package/dist/spec/catalogs/languages/filipino.json +3 -0
- package/dist/spec/catalogs/languages/finnish.json +3 -0
- package/dist/spec/catalogs/languages/french.json +3 -0
- package/dist/spec/catalogs/languages/fulfulde.json +3 -0
- package/dist/spec/catalogs/languages/galician.json +3 -0
- package/dist/spec/catalogs/languages/georgian.json +3 -0
- package/dist/spec/catalogs/languages/german.json +3 -0
- package/dist/spec/catalogs/languages/greek.json +3 -0
- package/dist/spec/catalogs/languages/gujarati.json +3 -0
- package/dist/spec/catalogs/languages/hausa.json +3 -0
- package/dist/spec/catalogs/languages/hebrew.json +3 -0
- package/dist/spec/catalogs/languages/hindi.json +3 -0
- package/dist/spec/catalogs/languages/hungarian.json +3 -0
- package/dist/spec/catalogs/languages/igbo.json +3 -0
- package/dist/spec/catalogs/languages/indonesian.json +3 -0
- package/dist/spec/catalogs/languages/italian.json +3 -0
- package/dist/spec/catalogs/languages/japanese.json +3 -0
- package/dist/spec/catalogs/languages/kannada.json +3 -0
- package/dist/spec/catalogs/languages/kazakh.json +3 -0
- package/dist/spec/catalogs/languages/khmer.json +3 -0
- package/dist/spec/catalogs/languages/kinyarwanda.json +3 -0
- package/dist/spec/catalogs/languages/korean.json +3 -0
- package/dist/spec/catalogs/languages/kurmanji.json +3 -0
- package/dist/spec/catalogs/languages/latvian.json +3 -0
- package/dist/spec/catalogs/languages/lithuanian.json +3 -0
- package/dist/spec/catalogs/languages/macedonian.json +3 -0
- package/dist/spec/catalogs/languages/malagasy.json +3 -0
- package/dist/spec/catalogs/languages/malay.json +3 -0
- package/dist/spec/catalogs/languages/malayalam.json +3 -0
- package/dist/spec/catalogs/languages/maori.json +3 -0
- package/dist/spec/catalogs/languages/marathi.json +3 -0
- package/dist/spec/catalogs/languages/mongolian.json +3 -0
- package/dist/spec/catalogs/languages/nepali.json +3 -0
- package/dist/spec/catalogs/languages/norwegian.json +3 -0
- package/dist/spec/catalogs/languages/odia.json +3 -0
- package/dist/spec/catalogs/languages/oromo.json +3 -0
- package/dist/spec/catalogs/languages/pashto.json +3 -0
- package/dist/spec/catalogs/languages/persian.json +3 -0
- package/dist/spec/catalogs/languages/polish.json +3 -0
- package/dist/spec/catalogs/languages/portuguese.json +3 -0
- package/dist/spec/catalogs/languages/punjabi-gurmukhi.json +3 -0
- package/dist/spec/catalogs/languages/punjabi-shahmukhi.json +3 -0
- package/dist/spec/catalogs/languages/romanian.json +3 -0
- package/dist/spec/catalogs/languages/russian.json +3 -0
- package/dist/spec/catalogs/languages/serbian-cyrillic.json +3 -0
- package/dist/spec/catalogs/languages/serbian-latin.json +3 -0
- package/dist/spec/catalogs/languages/shona.json +3 -0
- package/dist/spec/catalogs/languages/slovak.json +3 -0
- package/dist/spec/catalogs/languages/slovenian.json +3 -0
- package/dist/spec/catalogs/languages/somali.json +3 -0
- package/dist/spec/catalogs/languages/spanish.json +3 -0
- package/dist/spec/catalogs/languages/swahili.json +3 -0
- package/dist/spec/catalogs/languages/swedish.json +3 -0
- package/dist/spec/catalogs/languages/tagalog.json +3 -0
- package/dist/spec/catalogs/languages/tajik.json +3 -0
- package/dist/spec/catalogs/languages/tamil.json +3 -0
- package/dist/spec/catalogs/languages/telugu.json +3 -0
- package/dist/spec/catalogs/languages/thai.json +3 -0
- package/dist/spec/catalogs/languages/turkish.json +3 -0
- package/dist/spec/catalogs/languages/ukrainian.json +3 -0
- package/dist/spec/catalogs/languages/urdu.json +3 -0
- package/dist/spec/catalogs/languages/uzbek-latin.json +3 -0
- package/dist/spec/catalogs/languages/vietnamese-quoc-ngu.json +3 -0
- package/dist/spec/catalogs/languages/xhosa.json +3 -0
- package/dist/spec/catalogs/languages/yoruba.json +3 -0
- package/dist/spec/catalogs/languages/zulu.json +3 -0
- package/dist/spec/catalogs/narratives/board-meeting.json +21 -21
- package/dist/spec/catalogs/narratives/business-narrative.json +8 -8
- package/dist/spec/catalogs/narratives/business-review.json +12 -12
- package/dist/spec/catalogs/narratives/capacity-planning.json +8 -8
- package/dist/spec/catalogs/narratives/challenge-resolution.json +7 -7
- package/dist/spec/catalogs/narratives/change-story.json +64 -0
- package/dist/spec/catalogs/narratives/classic-story.json +7 -7
- package/dist/spec/catalogs/narratives/company-intro.json +9 -9
- package/dist/spec/catalogs/narratives/conference-talk.json +1 -1
- package/dist/spec/catalogs/narratives/data-story.json +66 -0
- package/dist/spec/catalogs/narratives/early-startup-pitch.json +12 -12
- package/dist/spec/catalogs/narratives/educate.json +9 -9
- package/dist/spec/catalogs/narratives/employee-review.json +8 -8
- package/dist/spec/catalogs/narratives/failure-analysis.json +10 -10
- package/dist/spec/catalogs/narratives/focus.json +12 -12
- package/dist/spec/catalogs/narratives/golden-circle.json +1 -1
- package/dist/spec/catalogs/narratives/heros-journey.json +64 -0
- package/dist/spec/catalogs/narratives/index.json +81 -0
- package/dist/spec/catalogs/narratives/innovation.json +9 -9
- package/dist/spec/catalogs/narratives/justice.json +11 -11
- package/dist/spec/catalogs/narratives/marketing-strategy.json +11 -11
- package/dist/spec/catalogs/narratives/performance-improvement-plan.json +8 -8
- package/dist/spec/catalogs/narratives/performance-review.json +11 -11
- package/dist/spec/catalogs/narratives/persuade.json +7 -7
- package/dist/spec/catalogs/narratives/persuasive-sales.json +8 -8
- package/dist/spec/catalogs/narratives/pitch-deck.json +3 -3
- package/dist/spec/catalogs/narratives/problem-solution.json +2 -2
- package/dist/spec/catalogs/narratives/product-launch.json +10 -10
- package/dist/spec/catalogs/narratives/project-proposal.json +10 -10
- package/dist/spec/catalogs/narratives/pyramid-principle.json +48 -0
- package/dist/spec/catalogs/narratives/qbr.json +3 -3
- package/dist/spec/catalogs/narratives/rags-to-riches.json +7 -7
- package/dist/spec/catalogs/narratives/reveal.json +8 -8
- package/dist/spec/catalogs/narratives/scqa.json +1 -1
- package/dist/spec/catalogs/narratives/situation-complication-resolution.json +56 -0
- package/dist/spec/catalogs/narratives/sparkline.json +56 -0
- package/dist/spec/catalogs/narratives/star-method.json +56 -0
- package/dist/spec/catalogs/narratives/status-update.json +6 -6
- package/dist/spec/catalogs/narratives/strategic-advisory.json +7 -7
- package/dist/spec/catalogs/narratives/strategic-narrative.json +1 -1
- package/dist/spec/catalogs/narratives/survey-analysis.json +10 -10
- package/dist/spec/catalogs/narratives/survival-story.json +10 -10
- package/dist/spec/catalogs/narratives/transformation-arc.json +1 -1
- package/dist/spec/catalogs/narratives/trend-analysis.json +7 -7
- package/dist/spec/catalogs/narratives/underdog-victory.json +8 -8
- package/dist/spec/catalogs/narratives/venture-pitch.json +12 -12
- package/dist/spec/catalogs/narratives/vision-roadmap.json +65 -0
- package/dist/spec/catalogs/narratives/weekly-progress.json +10 -10
- package/dist/spec/catalogs/narratives/what-so-what-now-what.json +48 -0
- package/dist/spec/openapi.yaml +5 -0
- package/dist/spec/reference/engine-defaults.json +2 -2
- package/dist/spec/reference/font-policy.json +3435 -0
- package/dist/spec/reference/font-policy.schema.json +328 -0
- package/dist/spec/schemas/chart-type.schema.json +51 -11
- package/dist/spec/schemas/font-scheme.schema.json +91 -1
- package/dist/spec/schemas/language.schema.json +10 -5
- package/dist/spec/schemas/opf.schema.json +241 -32
- package/dist/spec-files.d.ts +1 -1
- package/dist/spec-files.js +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/validator.d.ts +7 -4
- package/dist/validator.js +4 -4
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,475 @@
|
|
|
1
|
-
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-
|
|
1
|
+
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-SDETQV7Y.js';
|
|
2
2
|
export { getLayoutPreview, hasLayoutPreview, layoutPreviewIndex, layoutPreviewSlugs, layoutPreviews } from './chunk-PIQXLBBJ.js';
|
|
3
|
-
export { lintPresentation, lintSource } from './chunk-
|
|
3
|
+
export { lintPresentation, lintSource } from './chunk-BP6WMSSS.js';
|
|
4
|
+
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-NPYN4TZ5.js';
|
|
4
5
|
export { OPFDataImportError, createDataContent, parseTabularData } from './chunk-SOSOBKQ2.js';
|
|
5
|
-
export { OPFPaginationError, paginatePresentation, paginateSlide } from './chunk-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
export {
|
|
6
|
+
export { OPFPaginationError, paginatePresentation, paginateSlide } from './chunk-KWIOQ3QR.js';
|
|
7
|
+
import { isRecord, visitContentPayloads, bareIdPattern } from './chunk-M4GTWRK7.js';
|
|
8
|
+
export { OPFValidationError, assertValid, assertValidCatalogRecord, assertValidPresentation, validate, validateCatalogRecord, validatePresentation } from './chunk-M4GTWRK7.js';
|
|
9
|
+
import { resolveFontSchemeReference, DEFAULT_FONT_SCHEME, resolveFontFamilies } from './chunk-6UPHKXI5.js';
|
|
10
|
+
export { DEFAULT_FONT_SCHEME, DEFAULT_FURNITURE_DATE_FORMAT, DEFAULT_SLIDE_NUMBER_FORMAT, MAX_COMPOSITION_DEPTH, OPFCompositionError, chartColorForFill, colorContrast, composeSlide, fitList, fitRichText, fitText, formatFurnitureDate, formatSlideNumber, layoutCode, layoutFurniture, layoutMetric, layoutQuote, layoutTimeline, measureText, measureTextOutline, normalizeHexColor, placeTextLines, resolveCanvasDimensions, resolveColorRef, resolveFontFamilies, resolveFontSchemeReference, resolveSocialProfile, resolveTextStyle, textColorForFill, textWidthMeasurer, wrapText } from './chunk-6UPHKXI5.js';
|
|
11
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-LTSDDBNW.js';
|
|
12
|
+
import { catalogs, catalogEntries } from './chunk-7LF37SG3.js';
|
|
13
|
+
export { audiences, catalogEntries, catalogIndexes, catalogKinds, catalogSchemaNames, catalogs, chartTypes, colorSchemes, fontSchemes, languages, layouts, narratives, purposes, socialPlatforms, themes, tones } from './chunk-7LF37SG3.js';
|
|
14
|
+
|
|
15
|
+
// src/bundle.ts
|
|
16
|
+
function reportKey(kind, id) {
|
|
17
|
+
return `${kind}:${id}`;
|
|
18
|
+
}
|
|
19
|
+
function referenceId(value) {
|
|
20
|
+
if (typeof value === "string" && bareIdPattern.test(value)) return value;
|
|
21
|
+
if (isRecord(value) && typeof value.id === "string" && bareIdPattern.test(value.id)) return value.id;
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function addReference(collector, kind, value, reportable) {
|
|
25
|
+
const id = referenceId(value);
|
|
26
|
+
if (!id) return;
|
|
27
|
+
if (reportable) collector.reportable.add(reportKey(kind, id));
|
|
28
|
+
let ids = collector.referenced.get(kind);
|
|
29
|
+
if (!ids) {
|
|
30
|
+
ids = /* @__PURE__ */ new Set();
|
|
31
|
+
collector.referenced.set(kind, ids);
|
|
32
|
+
}
|
|
33
|
+
if (ids.has(id)) return;
|
|
34
|
+
ids.add(id);
|
|
35
|
+
collector.queue.push({ kind, id });
|
|
36
|
+
}
|
|
37
|
+
function collectDesignReferences(collector, design) {
|
|
38
|
+
if (!isRecord(design)) return;
|
|
39
|
+
addReference(collector, "themes", design.theme, true);
|
|
40
|
+
addReference(collector, "colorSchemes", design.colorScheme, true);
|
|
41
|
+
addReference(collector, "fontSchemes", design.fontScheme, true);
|
|
42
|
+
if (isRecord(design.theme)) {
|
|
43
|
+
addReference(collector, "colorSchemes", design.theme.colorScheme, true);
|
|
44
|
+
addReference(collector, "fontSchemes", design.theme.fontScheme, true);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function collectChartReference(collector, payload) {
|
|
48
|
+
if (!isRecord(payload.chart)) return;
|
|
49
|
+
addReference(collector, "chartTypes", payload.chart.type, typeof payload.chart.type === "string");
|
|
50
|
+
}
|
|
51
|
+
function collectSocialReferences(collector, holder) {
|
|
52
|
+
const entries = Array.isArray(holder) ? holder : [holder];
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
if (!isRecord(entry) || !isRecord(entry.socials)) continue;
|
|
55
|
+
for (const key of Object.keys(entry.socials)) addReference(collector, "socialPlatforms", key, false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function collectBeatReferences(collector, narrative2) {
|
|
59
|
+
if (!isRecord(narrative2) || !Array.isArray(narrative2.beats)) return;
|
|
60
|
+
for (const beat of narrative2.beats) {
|
|
61
|
+
if (isRecord(beat)) addReference(collector, "layouts", beat.layoutHint, false);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function collectLanguageReferences(collector, language2) {
|
|
65
|
+
addReference(collector, "languages", language2, false);
|
|
66
|
+
if (!isRecord(language2)) return;
|
|
67
|
+
addReference(collector, "fontSchemes", language2.fontScheme, false);
|
|
68
|
+
addReference(collector, "fontSchemes", language2.googleFontScheme, false);
|
|
69
|
+
}
|
|
70
|
+
function collectDocumentReferences(collector, document) {
|
|
71
|
+
addReference(collector, "narratives", document.narrative, typeof document.narrative === "string");
|
|
72
|
+
collectBeatReferences(collector, document.narrative);
|
|
73
|
+
addReference(collector, "tones", document.tone, false);
|
|
74
|
+
addReference(collector, "purposes", document.purpose, false);
|
|
75
|
+
collectLanguageReferences(collector, document.language);
|
|
76
|
+
if (Array.isArray(document.audience)) {
|
|
77
|
+
for (const entry of document.audience) addReference(collector, "audiences", entry, true);
|
|
78
|
+
} else {
|
|
79
|
+
addReference(collector, "audiences", document.audience, typeof document.audience === "string");
|
|
80
|
+
}
|
|
81
|
+
collectDesignReferences(collector, document.design);
|
|
82
|
+
collectSocialReferences(collector, document.organization);
|
|
83
|
+
collectSocialReferences(collector, document.speaker);
|
|
84
|
+
if (!Array.isArray(document.slides)) return;
|
|
85
|
+
for (const slide of document.slides) {
|
|
86
|
+
if (!isRecord(slide)) continue;
|
|
87
|
+
addReference(collector, "layouts", slide.layout, false);
|
|
88
|
+
collectDesignReferences(collector, slide.design);
|
|
89
|
+
collectChartReference(collector, slide);
|
|
90
|
+
visitContentPayloads(slide, "", (payload) => {
|
|
91
|
+
collectChartReference(collector, payload);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function collectRecordReferences(collector, kind, record) {
|
|
96
|
+
if (kind === "themes") {
|
|
97
|
+
addReference(collector, "colorSchemes", record.colorScheme, false);
|
|
98
|
+
addReference(collector, "fontSchemes", record.fontScheme, false);
|
|
99
|
+
} else if (kind === "narratives") {
|
|
100
|
+
collectBeatReferences(collector, record);
|
|
101
|
+
} else if (kind === "languages") {
|
|
102
|
+
addReference(collector, "fontSchemes", record.fontScheme, false);
|
|
103
|
+
addReference(collector, "fontSchemes", record.googleFontScheme, false);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var bundledIndex;
|
|
107
|
+
function bundledCatalogIndex() {
|
|
108
|
+
if (bundledIndex) return bundledIndex;
|
|
109
|
+
const index = /* @__PURE__ */ new Map();
|
|
110
|
+
for (const entry of catalogEntries) {
|
|
111
|
+
const records = /* @__PURE__ */ new Map();
|
|
112
|
+
for (const record of entry.records) {
|
|
113
|
+
if (isRecord(record) && typeof record.id === "string") records.set(record.id, record);
|
|
114
|
+
}
|
|
115
|
+
index.set(entry.kind, records);
|
|
116
|
+
}
|
|
117
|
+
bundledIndex = index;
|
|
118
|
+
return index;
|
|
119
|
+
}
|
|
120
|
+
function bundledRecord(kind, id) {
|
|
121
|
+
const record = bundledCatalogIndex().get(kind)?.get(id);
|
|
122
|
+
if (!record) return void 0;
|
|
123
|
+
const clone = structuredClone(record);
|
|
124
|
+
delete clone.$schema;
|
|
125
|
+
return clone;
|
|
126
|
+
}
|
|
127
|
+
function readKindState(catalogsField, kind) {
|
|
128
|
+
const entry = catalogsField[kind];
|
|
129
|
+
const inline = /* @__PURE__ */ new Map();
|
|
130
|
+
if (!isRecord(entry)) return { customSource: false, inline };
|
|
131
|
+
if (Array.isArray(entry.records)) {
|
|
132
|
+
for (const record of entry.records) {
|
|
133
|
+
if (isRecord(record) && typeof record.id === "string") inline.set(record.id, record);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const customSource = typeof entry.source === "string" || Array.isArray(entry.source) && entry.source.length > 0;
|
|
137
|
+
return { customSource, inline };
|
|
138
|
+
}
|
|
139
|
+
function kindState(states, catalogsField, kind) {
|
|
140
|
+
const cached = states.get(kind);
|
|
141
|
+
if (cached) return cached;
|
|
142
|
+
const state = readKindState(catalogsField, kind);
|
|
143
|
+
states.set(kind, state);
|
|
144
|
+
return state;
|
|
145
|
+
}
|
|
146
|
+
function pushReportId(map, kind, id) {
|
|
147
|
+
const list = map[kind];
|
|
148
|
+
if (list) list.push(id);
|
|
149
|
+
else map[kind] = [id];
|
|
150
|
+
}
|
|
151
|
+
function bundlePresentation(value) {
|
|
152
|
+
const report = { added: {}, alreadyInline: {}, keptSources: [], unresolved: {} };
|
|
153
|
+
if (!isRecord(value)) {
|
|
154
|
+
return { presentation: value, report };
|
|
155
|
+
}
|
|
156
|
+
const presentation2 = structuredClone(value);
|
|
157
|
+
if (presentation2.catalogs !== void 0 && !isRecord(presentation2.catalogs)) {
|
|
158
|
+
return { presentation: presentation2, report };
|
|
159
|
+
}
|
|
160
|
+
const catalogsField = isRecord(presentation2.catalogs) ? presentation2.catalogs : {};
|
|
161
|
+
const collector = { queue: [], referenced: /* @__PURE__ */ new Map(), reportable: /* @__PURE__ */ new Set() };
|
|
162
|
+
collectDocumentReferences(collector, presentation2);
|
|
163
|
+
const states = /* @__PURE__ */ new Map();
|
|
164
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
165
|
+
for (let index = 0; index < collector.queue.length; index += 1) {
|
|
166
|
+
const pending = collector.queue[index];
|
|
167
|
+
if (!pending) continue;
|
|
168
|
+
const { kind, id } = pending;
|
|
169
|
+
const state = kindState(states, catalogsField, kind);
|
|
170
|
+
const inlineRecord = state.inline.get(id);
|
|
171
|
+
if (inlineRecord) {
|
|
172
|
+
collectRecordReferences(collector, kind, inlineRecord);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (state.customSource) continue;
|
|
176
|
+
const record = bundledRecord(kind, id);
|
|
177
|
+
if (!record) continue;
|
|
178
|
+
let kindRecords = resolved.get(kind);
|
|
179
|
+
if (!kindRecords) {
|
|
180
|
+
kindRecords = /* @__PURE__ */ new Map();
|
|
181
|
+
resolved.set(kind, kindRecords);
|
|
182
|
+
}
|
|
183
|
+
kindRecords.set(id, record);
|
|
184
|
+
collectRecordReferences(collector, kind, record);
|
|
185
|
+
}
|
|
186
|
+
for (const [kind, ids] of collector.referenced) {
|
|
187
|
+
const state = kindState(states, catalogsField, kind);
|
|
188
|
+
if (state.customSource) report.keptSources.push(kind);
|
|
189
|
+
const kindResolved = resolved.get(kind);
|
|
190
|
+
const addedIds = [];
|
|
191
|
+
for (const id of [...ids].sort()) {
|
|
192
|
+
if (state.inline.has(id)) pushReportId(report.alreadyInline, kind, id);
|
|
193
|
+
else if (kindResolved?.has(id)) addedIds.push(id);
|
|
194
|
+
else if (!state.customSource && collector.reportable.has(reportKey(kind, id))) {
|
|
195
|
+
pushReportId(report.unresolved, kind, id);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!addedIds.length) continue;
|
|
199
|
+
if (!isRecord(presentation2.catalogs)) presentation2.catalogs = {};
|
|
200
|
+
const catalogs2 = presentation2.catalogs;
|
|
201
|
+
if (!isRecord(catalogs2[kind])) catalogs2[kind] = {};
|
|
202
|
+
const entry = catalogs2[kind];
|
|
203
|
+
if (!Array.isArray(entry.records)) entry.records = [];
|
|
204
|
+
const records = entry.records;
|
|
205
|
+
for (const id of addedIds) records.push(kindResolved?.get(id));
|
|
206
|
+
report.added[kind] = addedIds;
|
|
207
|
+
}
|
|
208
|
+
report.keptSources.sort();
|
|
209
|
+
return { presentation: presentation2, report };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/script-fonts.ts
|
|
213
|
+
var eastAsianScripts = /* @__PURE__ */ new Set(["Hani", "Hans", "Hant", "Hanb", "Jpan", "Kore", "Hang", "Jamo", "Hira", "Kana", "Hrkt", "Bopo", "Yiii"]);
|
|
214
|
+
var complexScripts = /* @__PURE__ */ new Set([
|
|
215
|
+
"Arab",
|
|
216
|
+
"Hebr",
|
|
217
|
+
"Syrc",
|
|
218
|
+
"Thaa",
|
|
219
|
+
"Nkoo",
|
|
220
|
+
"Adlm",
|
|
221
|
+
"Rohg",
|
|
222
|
+
"Mand",
|
|
223
|
+
"Samr",
|
|
224
|
+
"Deva",
|
|
225
|
+
"Beng",
|
|
226
|
+
"Guru",
|
|
227
|
+
"Gujr",
|
|
228
|
+
"Orya",
|
|
229
|
+
"Taml",
|
|
230
|
+
"Telu",
|
|
231
|
+
"Knda",
|
|
232
|
+
"Mlym",
|
|
233
|
+
"Sinh",
|
|
234
|
+
"Thai",
|
|
235
|
+
"Laoo",
|
|
236
|
+
"Tibt",
|
|
237
|
+
"Mymr",
|
|
238
|
+
"Khmr",
|
|
239
|
+
"Mong",
|
|
240
|
+
"Bali",
|
|
241
|
+
"Java",
|
|
242
|
+
"Lana",
|
|
243
|
+
"Tale",
|
|
244
|
+
"Talu",
|
|
245
|
+
"Cakm",
|
|
246
|
+
"Olck"
|
|
247
|
+
]);
|
|
248
|
+
var rtlScripts = /* @__PURE__ */ new Set(["Arab", "Hebr", "Syrc", "Thaa", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
|
|
249
|
+
var latinSlotScripts = /* @__PURE__ */ new Set(["Latn", "Cyrl", "Grek", "Zyyy", "Zzzz"]);
|
|
250
|
+
var deprecatedLanguages = { iw: "he", in: "id", ji: "yi" };
|
|
251
|
+
var matchingLanguages = { ...deprecatedLanguages, no: "nb", zsm: "ms", ku: "kmr" };
|
|
252
|
+
var likelyScripts = {
|
|
253
|
+
zh: { script: "Hans", regions: { TW: "Hant", HK: "Hant", MO: "Hant" } },
|
|
254
|
+
sr: { script: "Cyrl", regions: { ME: "Latn" } },
|
|
255
|
+
pa: { script: "Guru", regions: { PK: "Arab" } },
|
|
256
|
+
az: { script: "Latn", regions: { IR: "Arab" } },
|
|
257
|
+
uz: { script: "Latn", regions: { AF: "Arab" } },
|
|
258
|
+
bs: { script: "Latn" },
|
|
259
|
+
mn: { script: "Cyrl", regions: { CN: "Mong" } },
|
|
260
|
+
ms: { script: "Latn" }
|
|
261
|
+
};
|
|
262
|
+
var bareLanguageId = /^[a-z][a-z0-9-]*$/;
|
|
263
|
+
var strongRtl = /[\u200F\u061C]|(?=\p{L})[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mandaic}\p{Script=Samaritan}\p{Script=Mende_Kikakui}\p{Script=Imperial_Aramaic}\p{Script=Phoenician}\p{Script=Kharoshthi}\p{Script=Old_South_Arabian}\p{Script=Old_North_Arabian}\p{Script=Avestan}\p{Script=Inscriptional_Parthian}\p{Script=Inscriptional_Pahlavi}\p{Script=Psalter_Pahlavi}\p{Script=Old_Turkic}\p{Script=Old_Hungarian}\p{Script=Nabataean}\p{Script=Palmyrene}\p{Script=Hatran}\p{Script=Manichaean}\p{Script=Sogdian}\p{Script=Old_Sogdian}\p{Script=Elymaic}\p{Script=Chorasmian}\p{Script=Yezidi}\p{Script=Cypriot}\p{Script=Lydian}\p{Script=Meroitic_Cursive}\p{Script=Meroitic_Hieroglyphs}\u{10F70}-\u{10FAF}\u{10D40}-\u{10D8F}]/u;
|
|
264
|
+
var strongLtr = /[\u200E\p{L}\p{Nl}]/u;
|
|
265
|
+
function paragraphDirection(text2, deckDirection) {
|
|
266
|
+
if (deckDirection !== "rtl") return "ltr";
|
|
267
|
+
let isolates = 0;
|
|
268
|
+
for (const char of String(text2 ?? "")) {
|
|
269
|
+
if (char === "\u2066" || char === "\u2067" || char === "\u2068") isolates += 1;
|
|
270
|
+
else if (char === "\u2069") isolates = Math.max(0, isolates - 1);
|
|
271
|
+
else if (isolates === 0) {
|
|
272
|
+
if (strongRtl.test(char)) return "rtl";
|
|
273
|
+
if (strongLtr.test(char)) return "ltr";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return "rtl";
|
|
277
|
+
}
|
|
278
|
+
function scriptFontRole(script) {
|
|
279
|
+
const code = normalizeScript(script);
|
|
280
|
+
if (code && eastAsianScripts.has(code)) return "eastAsian";
|
|
281
|
+
if (code && complexScripts.has(code)) return "complexScript";
|
|
282
|
+
return "latin";
|
|
283
|
+
}
|
|
284
|
+
function normalizeScript(value) {
|
|
285
|
+
if (typeof value !== "string" || !/^[A-Za-z]{4}$/.test(value)) return void 0;
|
|
286
|
+
return value.slice(0, 1).toUpperCase() + value.slice(1).toLowerCase();
|
|
287
|
+
}
|
|
288
|
+
function text(value) {
|
|
289
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
290
|
+
}
|
|
291
|
+
var tagSyntax = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
|
292
|
+
function splitTag(tag) {
|
|
293
|
+
if (!tagSyntax.test(tag)) return void 0;
|
|
294
|
+
const [first = "", ...rest] = tag.split("-");
|
|
295
|
+
const language2 = first.toLowerCase();
|
|
296
|
+
if (language2 === "und") return void 0;
|
|
297
|
+
let script;
|
|
298
|
+
let region;
|
|
299
|
+
for (const subtag of rest) {
|
|
300
|
+
if (subtag.length === 1) break;
|
|
301
|
+
if (!script && !region && /^[A-Za-z]{4}$/.test(subtag)) script = normalizeScript(subtag);
|
|
302
|
+
else if (!region && /^(?:[A-Za-z]{2}|\d{3})$/.test(subtag)) region = subtag.toUpperCase();
|
|
303
|
+
}
|
|
304
|
+
return { language: language2, script, region };
|
|
305
|
+
}
|
|
306
|
+
function canonicalTag(tag) {
|
|
307
|
+
let extension = false;
|
|
308
|
+
return tag.split("-").map((subtag, index) => {
|
|
309
|
+
const lower = subtag.toLowerCase();
|
|
310
|
+
if (index === 0) return deprecatedLanguages[lower] ?? lower;
|
|
311
|
+
if (extension) return lower;
|
|
312
|
+
if (subtag.length === 1) {
|
|
313
|
+
extension = true;
|
|
314
|
+
return lower;
|
|
315
|
+
}
|
|
316
|
+
if (/^[A-Za-z]{4}$/.test(subtag)) return normalizeScript(subtag);
|
|
317
|
+
if (/^[A-Za-z]{2}$/.test(subtag)) return subtag.toUpperCase();
|
|
318
|
+
return lower;
|
|
319
|
+
}).join("-");
|
|
320
|
+
}
|
|
321
|
+
function vendoredScript(language2, region) {
|
|
322
|
+
const entry = likelyScripts[language2];
|
|
323
|
+
return entry ? (region && entry.regions?.[region]) ?? entry.script : void 0;
|
|
324
|
+
}
|
|
325
|
+
function inferScript(tag) {
|
|
326
|
+
const parts = splitTag(tag);
|
|
327
|
+
if (!parts) return void 0;
|
|
328
|
+
const known = parts.script ?? vendoredScript(matchingLanguages[parts.language] ?? parts.language, parts.region);
|
|
329
|
+
if (known) return known;
|
|
330
|
+
try {
|
|
331
|
+
return normalizeScript(new Intl.Locale(tag).maximize().script);
|
|
332
|
+
} catch {
|
|
333
|
+
return void 0;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function inlineRecords(document, kind) {
|
|
337
|
+
const kinds = isRecord(document.catalogs) ? document.catalogs : {};
|
|
338
|
+
const entry = kinds[kind];
|
|
339
|
+
return isRecord(entry) && Array.isArray(entry.records) ? entry.records.filter(isRecord) : [];
|
|
340
|
+
}
|
|
341
|
+
function allRecords(document, kind) {
|
|
342
|
+
return [...inlineRecords(document, kind), ...catalogs[kind]];
|
|
343
|
+
}
|
|
344
|
+
function resolveReference(lookup, kind, reference) {
|
|
345
|
+
if (typeof reference === "string") return lookup(kind, reference);
|
|
346
|
+
if (!isRecord(reference)) return void 0;
|
|
347
|
+
const base = typeof reference.id === "string" ? lookup(kind, reference.id) : void 0;
|
|
348
|
+
return { ...base, ...reference };
|
|
349
|
+
}
|
|
350
|
+
function matchLanguageTag(document, tag) {
|
|
351
|
+
const wanted = splitTag(tag);
|
|
352
|
+
if (!wanted) return void 0;
|
|
353
|
+
const records = allRecords(document, "languages").filter((record) => typeof record.bcp47 === "string");
|
|
354
|
+
const key = canonicalTag(tag).toLowerCase();
|
|
355
|
+
const exact = records.find((record) => canonicalTag(record.bcp47).toLowerCase() === key);
|
|
356
|
+
if (exact) return exact;
|
|
357
|
+
const language2 = matchingLanguages[wanted.language] ?? wanted.language;
|
|
358
|
+
const script = wanted.script ?? vendoredScript(language2, wanted.region);
|
|
359
|
+
const candidates = records.flatMap((record) => {
|
|
360
|
+
const parts = splitTag(record.bcp47);
|
|
361
|
+
if (!parts || (matchingLanguages[parts.language] ?? parts.language) !== language2) return [];
|
|
362
|
+
const recordScript = normalizeScript(record.script) ?? parts.script ?? vendoredScript(language2, parts.region);
|
|
363
|
+
if (script && recordScript && script !== recordScript) return [];
|
|
364
|
+
return [{ record, region: parts.region }];
|
|
365
|
+
});
|
|
366
|
+
return candidates.find((candidate) => wanted.region && candidate.region === wanted.region)?.record ?? candidates.find((candidate) => !candidate.region)?.record ?? candidates[0]?.record;
|
|
367
|
+
}
|
|
368
|
+
function resolveLanguage(document, lookup, reference) {
|
|
369
|
+
if (typeof reference === "string") {
|
|
370
|
+
const value = reference.trim();
|
|
371
|
+
const byId = bareLanguageId.test(value) ? lookup("languages", value) : void 0;
|
|
372
|
+
if (byId) return { record: byId, languageId: value };
|
|
373
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(value) || !splitTag(value)) return void 0;
|
|
374
|
+
const matched = matchLanguageTag(document, value);
|
|
375
|
+
if (matched) return { record: matched, authoredTag: value, languageId: text(matched.id) };
|
|
376
|
+
return inferScript(value) ? { record: {}, authoredTag: value } : void 0;
|
|
377
|
+
}
|
|
378
|
+
if (!isRecord(reference)) return void 0;
|
|
379
|
+
const authoredTag = text(reference.bcp47);
|
|
380
|
+
if (authoredTag !== void 0 && !splitTag(authoredTag)) return void 0;
|
|
381
|
+
const base = typeof reference.id === "string" ? lookup("languages", reference.id) : authoredTag ? matchLanguageTag(document, authoredTag) : void 0;
|
|
382
|
+
const record = { ...base, ...reference };
|
|
383
|
+
const tag = text(record.bcp47);
|
|
384
|
+
if (!tag || !splitTag(tag)) return void 0;
|
|
385
|
+
return { record, authoredTag, authoredOoxmlLang: text(reference.ooxmlLang), languageId: text(base?.id) };
|
|
386
|
+
}
|
|
387
|
+
function pairFamilies(value) {
|
|
388
|
+
if (!isRecord(value)) return void 0;
|
|
389
|
+
const major = text(value.major);
|
|
390
|
+
const minor = text(value.minor);
|
|
391
|
+
const heading = major ?? minor;
|
|
392
|
+
const body = minor ?? major;
|
|
393
|
+
return heading && body ? { heading, body } : void 0;
|
|
394
|
+
}
|
|
395
|
+
function schemeServesLanguage(scheme, language2) {
|
|
396
|
+
const entries = Array.isArray(scheme.languages) ? scheme.languages.filter((entry) => typeof entry === "string") : [];
|
|
397
|
+
if (entries.length === 0) return true;
|
|
398
|
+
const name = text(language2.name)?.toLowerCase();
|
|
399
|
+
if (!name) return false;
|
|
400
|
+
const base = name.replace(/\s*\([^)]*\)\s*$/, "");
|
|
401
|
+
return entries.some((entry) => {
|
|
402
|
+
const value = entry.trim().toLowerCase();
|
|
403
|
+
return value === name || value === base;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function resolveScriptFonts(input, options = {}) {
|
|
407
|
+
const document = isRecord(input) ? input : {};
|
|
408
|
+
const lookup = (kind, id) => inlineRecords(document, kind).find((record2) => record2.id === id) ?? catalogs[kind].find((record2) => record2.id === id);
|
|
409
|
+
let design = isRecord(document.design) ? document.design : {};
|
|
410
|
+
if (options.slideIndex !== void 0) {
|
|
411
|
+
const slides = Array.isArray(document.slides) ? document.slides : [];
|
|
412
|
+
if (!Number.isInteger(options.slideIndex) || options.slideIndex < 0 || options.slideIndex >= slides.length) {
|
|
413
|
+
throw new RangeError(`slideIndex must be an integer between 0 and ${slides.length - 1}.`);
|
|
414
|
+
}
|
|
415
|
+
const slide = slides[options.slideIndex];
|
|
416
|
+
if (isRecord(slide) && isRecord(slide.design)) design = { ...design, ...slide.design };
|
|
417
|
+
}
|
|
418
|
+
const theme2 = resolveReference(lookup, "themes", design.theme ?? "minimal") ?? {};
|
|
419
|
+
const scheme = resolveFontSchemeReference(design.fontScheme ?? theme2.fontScheme ?? DEFAULT_FONT_SCHEME, (id) => lookup("fontSchemes", id)).scheme;
|
|
420
|
+
const latin = resolveFontFamilies(scheme);
|
|
421
|
+
const fromOption = options.language !== void 0 ? resolveLanguage(document, lookup, options.language) : void 0;
|
|
422
|
+
const fromDocument = fromOption ? void 0 : resolveLanguage(document, lookup, document.language);
|
|
423
|
+
const requestedDefault = text(options.defaultLanguage);
|
|
424
|
+
const fallbackTag = requestedDefault && splitTag(requestedDefault) ? requestedDefault : "en-US";
|
|
425
|
+
const language2 = fromOption ?? fromDocument ?? resolveLanguage(document, lookup, fallbackTag) ?? { record: {}, authoredTag: fallbackTag };
|
|
426
|
+
const languageSource = fromOption ? "option" : fromDocument ? "document" : "default";
|
|
427
|
+
const record = language2.record;
|
|
428
|
+
const bcp47 = canonicalTag(language2.authoredTag ?? text(record.bcp47) ?? fallbackTag);
|
|
429
|
+
const curated = text(record.ooxmlLang);
|
|
430
|
+
const lang = language2.authoredOoxmlLang ? canonicalTag(language2.authoredOoxmlLang) : language2.authoredTag && splitTag(language2.authoredTag)?.region ? canonicalTag(language2.authoredTag) : curated ? canonicalTag(curated) : bcp47;
|
|
431
|
+
const parts = splitTag(bcp47);
|
|
432
|
+
const script = normalizeScript(record.script) ?? (language2.languageId ? parts?.script ?? (parts ? vendoredScript(matchingLanguages[parts.language] ?? parts.language, parts.region) : void 0) ?? normalizeScript(matchLanguageTag({}, bcp47)?.script) : inferScript(bcp47)) ?? "Zzzz";
|
|
433
|
+
const scriptRole = scriptFontRole(script);
|
|
434
|
+
const declaredDirection = record.direction;
|
|
435
|
+
const direction = declaredDirection === "rtl" || declaredDirection === "ltr" ? declaredDirection : rtlScripts.has(script) ? "rtl" : "ltr";
|
|
436
|
+
const app = options.app ?? "PowerPoint";
|
|
437
|
+
const preferred = app === "Google Slides" ? record.googleFontScheme : record.fontScheme;
|
|
438
|
+
const alternate = app === "Google Slides" ? record.fontScheme : record.googleFontScheme;
|
|
439
|
+
const languageScheme = resolveReference(lookup, "fontSchemes", preferred) ?? resolveReference(lookup, "fontSchemes", alternate);
|
|
440
|
+
const languageFamilies = pairFamilies(languageScheme);
|
|
441
|
+
const schemeAdmitsLanguage = schemeServesLanguage(scheme, record);
|
|
442
|
+
const slot = (role, family) => {
|
|
443
|
+
const explicit = pairFamilies(scheme[role]);
|
|
444
|
+
if (explicit) return { ...explicit, source: "fontScheme" };
|
|
445
|
+
if (scheme.languageFamily === family && schemeAdmitsLanguage) return { ...latin, source: "schemeFamily" };
|
|
446
|
+
if (scriptRole === role && languageFamilies) return { ...languageFamilies, source: "language" };
|
|
447
|
+
return { heading: latin.heading, body: latin.body, source: "latin" };
|
|
448
|
+
};
|
|
449
|
+
const eastAsian = slot("eastAsian", "ea");
|
|
450
|
+
const complexScript = slot("complexScript", "cs");
|
|
451
|
+
const heading = { latin: latin.heading, eastAsian: eastAsian.heading, complexScript: complexScript.heading };
|
|
452
|
+
const body = { latin: latin.body, eastAsian: eastAsian.body, complexScript: complexScript.body };
|
|
453
|
+
let supplement;
|
|
454
|
+
if (!latinSlotScripts.has(script)) {
|
|
455
|
+
const families = scriptRole === "latin" ? languageFamilies : (scriptRole === "eastAsian" ? eastAsian : complexScript).source === "latin" ? void 0 : { heading: heading[scriptRole], body: body[scriptRole] };
|
|
456
|
+
if (families) supplement = { script: script === "Kore" ? "Hang" : script, heading: families.heading, body: families.body };
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
...body,
|
|
460
|
+
lang,
|
|
461
|
+
bcp47,
|
|
462
|
+
...language2.languageId ? { languageId: language2.languageId } : {},
|
|
463
|
+
languageSource,
|
|
464
|
+
script,
|
|
465
|
+
scriptRole,
|
|
466
|
+
direction,
|
|
467
|
+
rtl: direction === "rtl",
|
|
468
|
+
heading,
|
|
469
|
+
body,
|
|
470
|
+
...supplement ? { supplement } : {},
|
|
471
|
+
sources: { eastAsian: eastAsian.source, complexScript: complexScript.source }
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export { bundlePresentation, paragraphDirection, resolveScriptFonts, scriptFontRole };
|
package/dist/lint.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CatalogKind } from './catalogs-DJ-B5ZyD.js';
|
|
2
2
|
import { ValidationIssue } from './validator.js';
|
|
3
|
-
import { J as JsonPrimitive } from './schemas-
|
|
4
|
-
import './presentation-
|
|
3
|
+
import { J as JsonPrimitive } from './schemas-X_NniU4A.js';
|
|
4
|
+
import './presentation-bceTClm8.js';
|
|
5
5
|
|
|
6
6
|
type LintSeverity = 'error' | 'warning' | 'info';
|
|
7
7
|
interface LintLocation {
|
package/dist/lint.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { lintPresentation, lintSource } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
export { lintPresentation, lintSource } from './chunk-BP6WMSSS.js';
|
|
2
|
+
import './chunk-M4GTWRK7.js';
|
|
3
|
+
import './chunk-6UPHKXI5.js';
|
|
4
|
+
import './chunk-LTSDDBNW.js';
|
|
5
|
+
import './chunk-7LF37SG3.js';
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { LayoutDiagnostic, ComposeSlideOptions, TextMeasurement } from './composition.js';
|
|
1
|
+
import { L as LayoutDiagnostic, C as ComposeSlideOptions, T as TextMeasurement, F as FontSchemeDiagnostic } from './composition-DzLwY-Mi.js';
|
|
2
2
|
|
|
3
3
|
interface PaginationOptions extends ComposeSlideOptions {
|
|
4
4
|
/** Readability floor used while choosing page breaks. Default 24 reference pixels. */
|
|
5
5
|
minFontSize?: number;
|
|
6
6
|
/** All-or-nothing resource limit. Defaults to 100 output slides. */
|
|
7
7
|
maxSlides?: number;
|
|
8
|
-
/** Existing
|
|
8
|
+
/** Existing slide and content payload IDs to avoid when generating continuation IDs. */
|
|
9
9
|
reservedIds?: string[];
|
|
10
10
|
}
|
|
11
11
|
interface PaginationMapping {
|
|
@@ -41,8 +41,12 @@ interface PresentationPaginationOptions {
|
|
|
41
41
|
textRasterPadding?: number;
|
|
42
42
|
minFontSize?: number;
|
|
43
43
|
maxSlides?: number;
|
|
44
|
+
/** Host-supplied current calendar date (ISO YYYY-MM-DD) for `date: true` header/footer fields. */
|
|
45
|
+
date?: string;
|
|
44
46
|
/** Optional host-resolved layout/canvas overrides for each source slide. */
|
|
45
47
|
slideOptions?: (slide: Record<string, any>, index: number) => ComposeSlideOptions;
|
|
48
|
+
/** Receives `unresolved-font-scheme` once per reference path when a font-scheme id matches no record. */
|
|
49
|
+
onDiagnostic?: (diagnostic: FontSchemeDiagnostic) => void;
|
|
46
50
|
}
|
|
47
51
|
interface PresentationPaginationResult {
|
|
48
52
|
presentation: Record<string, any>;
|
package/dist/pagination.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { OPFPaginationError, paginatePresentation, paginateSlide } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
export { OPFPaginationError, paginatePresentation, paginateSlide } from './chunk-KWIOQ3QR.js';
|
|
2
|
+
import './chunk-M4GTWRK7.js';
|
|
3
|
+
import './chunk-6UPHKXI5.js';
|
|
4
|
+
import './chunk-LTSDDBNW.js';
|
|
5
|
+
import './chunk-7LF37SG3.js';
|