@openpresentation/opf 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -23
- package/dist/{catalogs-BnI7JKcn.d.ts → catalogs-D-yyQWCQ.d.ts} +86 -208
- package/dist/catalogs.d.ts +2 -2
- package/dist/catalogs.js +1 -1
- package/dist/chart-data-B_3z9VTb.d.ts +188 -0
- package/dist/chunk-4LDGKLUC.js +192 -0
- package/dist/{chunk-V2537ENL.js → chunk-4VJDTF55.js} +2 -90
- package/dist/chunk-5ZU6JAPP.js +83 -0
- package/dist/{chunk-HOBSL7AJ.js → chunk-6OXY2CP3.js} +3604 -1644
- package/dist/{chunk-RUC7L5DJ.js → chunk-BFLVSVA7.js} +26 -26
- package/dist/chunk-CSQHPVGL.js +94 -0
- package/dist/{chunk-GJKJL4YY.js → chunk-D3TY4TT6.js} +34 -412
- package/dist/chunk-JDJBDYSR.js +4167 -0
- package/dist/{chunk-4LAM3N6S.js → chunk-LS2FMPI5.js} +1497 -1097
- package/dist/{chunk-SOSOBKQ2.js → chunk-Q2TCMN56.js} +6 -7
- package/dist/chunk-UPQQD7MA.js +1840 -0
- package/dist/{chunk-AUM5MXBR.js → chunk-XIZUK2XM.js} +36 -32
- package/dist/{chunk-E34DJ5LL.js → chunk-XOZ4KMSR.js} +2427 -10820
- package/dist/chunk-Z65B2B77.js +601 -0
- package/dist/{composition-DWbCiMwF.d.ts → composition-_WEwBe2a.d.ts} +744 -26
- package/dist/composition.d.ts +2 -1
- package/dist/composition.js +2 -2
- package/dist/convert.d.ts +9 -4
- package/dist/convert.js +57 -26
- package/dist/data.d.ts +5 -4
- package/dist/data.js +3 -1
- package/dist/diff.d.ts +5 -5
- package/dist/diff.js +6 -603
- package/dist/docs.js +70 -52
- package/dist/examples.d.ts +1 -1
- package/dist/examples.js +1466 -2963
- package/dist/finding-C_por275.d.ts +212 -0
- package/dist/format.d.ts +4 -4
- package/dist/format.js +2 -83
- package/dist/index.d.ts +318 -281
- package/dist/index.js +530 -943
- package/dist/markdown.d.ts +28 -25
- package/dist/markdown.js +8 -1940
- package/dist/pagination-BZpXLvFL.d.ts +119 -0
- package/dist/pagination.d.ts +5 -60
- package/dist/pagination.js +5 -5
- package/dist/patch.d.ts +12 -23
- package/dist/patch.js +5 -5
- package/dist/{presentation-DcF-MZcz.d.ts → presentation-C5eHkevA.d.ts} +516 -499
- package/dist/repo-readme.js +1 -1
- package/dist/{schemas-BSjlG8-R.d.ts → schemas-DDpqAgyS.d.ts} +49 -17
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/spec/README.md +10 -5
- package/dist/spec/catalogs/audiences/index.json +2 -50
- package/dist/spec/catalogs/chart-types/100pct-stacked-area.json +21 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-bar.json +22 -0
- package/dist/spec/catalogs/chart-types/100pct-stacked-column.json +22 -0
- package/dist/spec/catalogs/chart-types/area.json +2 -60
- package/dist/spec/catalogs/chart-types/bar.json +2 -48
- package/dist/spec/catalogs/chart-types/box-and-whisker.json +2 -132
- package/dist/spec/catalogs/chart-types/column.json +2 -52
- package/dist/spec/catalogs/chart-types/combo.json +37 -0
- package/dist/spec/catalogs/chart-types/doughnut.json +2 -40
- package/dist/spec/catalogs/chart-types/filled-radar.json +2 -52
- package/dist/spec/catalogs/chart-types/funnel.json +2 -46
- package/dist/spec/catalogs/chart-types/histogram.json +2 -149
- package/dist/spec/catalogs/chart-types/index.json +50 -520
- package/dist/spec/catalogs/chart-types/line-with-markers.json +2 -60
- package/dist/spec/catalogs/chart-types/line.json +2 -60
- package/dist/spec/catalogs/chart-types/pareto.json +2 -50
- package/dist/spec/catalogs/chart-types/pie.json +2 -40
- package/dist/spec/catalogs/chart-types/radar-with-markers.json +2 -52
- package/dist/spec/catalogs/chart-types/radar.json +2 -52
- package/dist/spec/catalogs/chart-types/scatter.json +2 -73
- package/dist/spec/catalogs/chart-types/stacked-area.json +21 -0
- package/dist/spec/catalogs/chart-types/stacked-bar.json +22 -0
- package/dist/spec/catalogs/chart-types/stacked-column.json +22 -0
- package/dist/spec/catalogs/chart-types/stacked-line-with-markers.json +22 -0
- package/dist/spec/catalogs/chart-types/stacked-line.json +21 -0
- package/dist/spec/catalogs/chart-types/treemap.json +2 -48
- package/dist/spec/catalogs/chart-types/waterfall.json +2 -52
- package/dist/spec/catalogs/chart-types/world.json +2 -64
- package/dist/spec/catalogs/font-schemes/angsana-new.json +2 -2
- package/dist/spec/catalogs/font-schemes/aparajita.json +3 -3
- package/dist/spec/catalogs/font-schemes/aptos.json +1 -1
- package/dist/spec/catalogs/font-schemes/arabic-typesetting.json +2 -2
- package/dist/spec/catalogs/font-schemes/arial.json +1 -1
- package/dist/spec/catalogs/font-schemes/batang.json +2 -2
- package/dist/spec/catalogs/font-schemes/bookman.json +1 -1
- package/dist/spec/catalogs/font-schemes/calibri.json +1 -1
- package/dist/spec/catalogs/font-schemes/century-schoolbook.json +1 -1
- package/dist/spec/catalogs/font-schemes/consolas.json +2 -4
- package/dist/spec/catalogs/font-schemes/constantia.json +1 -1
- package/dist/spec/catalogs/font-schemes/courier-new.json +2 -4
- package/dist/spec/catalogs/font-schemes/daunpenh.json +2 -2
- package/dist/spec/catalogs/font-schemes/david.json +2 -2
- package/dist/spec/catalogs/font-schemes/dilleniaupc.json +2 -2
- package/dist/spec/catalogs/font-schemes/fangsong.json +2 -2
- package/dist/spec/catalogs/font-schemes/garamond.json +1 -1
- package/dist/spec/catalogs/font-schemes/gautami.json +2 -2
- package/dist/spec/catalogs/font-schemes/georgia.json +1 -1
- package/dist/spec/catalogs/font-schemes/gisha.json +3 -3
- package/dist/spec/catalogs/font-schemes/grandview.json +1 -1
- package/dist/spec/catalogs/font-schemes/gungsuh.json +2 -2
- package/dist/spec/catalogs/font-schemes/impact.json +1 -1
- package/dist/spec/catalogs/font-schemes/index.json +1 -1
- package/dist/spec/catalogs/font-schemes/kalinga.json +2 -2
- package/dist/spec/catalogs/font-schemes/kartika.json +2 -2
- package/dist/spec/catalogs/font-schemes/khmer-ui.json +2 -2
- package/dist/spec/catalogs/font-schemes/latha.json +2 -2
- package/dist/spec/catalogs/font-schemes/lucida-sans.json +1 -1
- package/dist/spec/catalogs/font-schemes/malgun-gothic.json +2 -2
- package/dist/spec/catalogs/font-schemes/mangal.json +4 -5
- package/dist/spec/catalogs/font-schemes/meiryo.json +2 -2
- package/dist/spec/catalogs/font-schemes/microsoft-jhenghei.json +2 -2
- package/dist/spec/catalogs/font-schemes/microsoft-yahei.json +5 -5
- package/dist/spec/catalogs/font-schemes/mingliu.json +2 -2
- package/dist/spec/catalogs/font-schemes/miriam.json +2 -2
- package/dist/spec/catalogs/font-schemes/montserrat.json +1 -1
- package/dist/spec/catalogs/font-schemes/ms-mincho.json +2 -2
- package/dist/spec/catalogs/font-schemes/nirmala-ui.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-naksh-arabic.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-nastaliq-urdu.json +3 -3
- package/dist/spec/catalogs/font-schemes/noto-sans-arabic.json +4 -4
- package/dist/spec/catalogs/font-schemes/noto-sans-armenian.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-bengali.json +3 -3
- package/dist/spec/catalogs/font-schemes/noto-sans-devangari.json +3 -3
- package/dist/spec/catalogs/font-schemes/noto-sans-ethiopic.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-georgian.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-gujarati.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-gurmukhi.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-hebrew.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-jp.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-kannada.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-khmer.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-kr.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-malayalam.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-mongolian.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-oriya.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-sc.json +5 -5
- package/dist/spec/catalogs/font-schemes/noto-sans-tamil.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-tc.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-telugu.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans-thai.json +2 -2
- package/dist/spec/catalogs/font-schemes/noto-sans.json +5 -5
- package/dist/spec/catalogs/font-schemes/nyala.json +2 -2
- package/dist/spec/catalogs/font-schemes/open-sans.json +1 -1
- package/dist/spec/catalogs/font-schemes/pmingliu.json +2 -2
- package/dist/spec/catalogs/font-schemes/poppins.json +1 -1
- package/dist/spec/catalogs/font-schemes/pt-serif.json +1 -1
- package/dist/spec/catalogs/font-schemes/raavi.json +2 -2
- package/dist/spec/catalogs/font-schemes/raleway.json +1 -1
- package/dist/spec/catalogs/font-schemes/roboto.json +1 -1
- package/dist/spec/catalogs/font-schemes/rockwell.json +1 -1
- package/dist/spec/catalogs/font-schemes/sakkal-majalla.json +4 -4
- package/dist/spec/catalogs/font-schemes/seaford.json +1 -1
- package/dist/spec/catalogs/font-schemes/segoe-ui-light.json +1 -1
- package/dist/spec/catalogs/font-schemes/segoe-ui.json +1 -1
- package/dist/spec/catalogs/font-schemes/shonar-bangla.json +3 -3
- package/dist/spec/catalogs/font-schemes/shruti.json +2 -2
- package/dist/spec/catalogs/font-schemes/simsun.json +2 -2
- package/dist/spec/catalogs/font-schemes/skeena.json +1 -1
- package/dist/spec/catalogs/font-schemes/sylfaen.json +3 -3
- package/dist/spec/catalogs/font-schemes/tahoma.json +1 -1
- package/dist/spec/catalogs/font-schemes/tenorite.json +1 -1
- package/dist/spec/catalogs/font-schemes/times-new-roman.json +1 -1
- package/dist/spec/catalogs/font-schemes/traditional-arabic.json +4 -4
- package/dist/spec/catalogs/font-schemes/trebuchet-ms.json +1 -1
- package/dist/spec/catalogs/font-schemes/tunga.json +2 -2
- package/dist/spec/catalogs/font-schemes/verdana.json +1 -1
- package/dist/spec/catalogs/font-schemes/vrinda.json +2 -2
- package/dist/spec/catalogs/font-schemes/yu-gothic.json +2 -2
- package/dist/spec/catalogs/layouts/action-plan.json +9 -15
- package/dist/spec/catalogs/layouts/agenda.json +8 -15
- package/dist/spec/catalogs/layouts/appendix-index.json +7 -15
- package/dist/spec/catalogs/layouts/architecture-stack.json +9 -15
- package/dist/spec/catalogs/layouts/assumptions-dependencies.json +9 -15
- package/dist/spec/catalogs/layouts/before-after.json +9 -15
- package/dist/spec/catalogs/layouts/benchmark-target-table.json +9 -15
- package/dist/spec/catalogs/layouts/blank.json +11 -1
- package/dist/spec/catalogs/layouts/bullet-list.json +9 -15
- package/dist/spec/catalogs/layouts/business-model-canvas.json +9 -15
- package/dist/spec/catalogs/layouts/capability-map.json +14 -16
- package/dist/spec/catalogs/layouts/case-study.json +9 -15
- package/dist/spec/catalogs/layouts/chapter-recap.json +8 -15
- package/dist/spec/catalogs/layouts/chart-1x.json +15 -0
- package/dist/spec/catalogs/layouts/chart-2x.json +15 -0
- package/dist/spec/catalogs/layouts/chart-3x.json +15 -0
- package/dist/spec/catalogs/layouts/circular-lifecycle.json +9 -15
- package/dist/spec/catalogs/layouts/code-1x.json +10 -0
- package/dist/spec/catalogs/layouts/comparison.json +9 -15
- package/dist/spec/catalogs/layouts/competitive-landscape.json +14 -16
- package/dist/spec/catalogs/layouts/customer-journey.json +14 -16
- package/dist/spec/catalogs/layouts/customer-logos.json +9 -15
- package/dist/spec/catalogs/layouts/dashboard.json +9 -15
- package/dist/spec/catalogs/layouts/data-visualization.json +9 -15
- package/dist/spec/catalogs/layouts/decision-tree.json +14 -16
- package/dist/spec/catalogs/layouts/detailed-data-table.json +9 -15
- package/dist/spec/catalogs/layouts/ecosystem-map.json +14 -16
- package/dist/spec/catalogs/layouts/executive-decision.json +9 -15
- package/dist/spec/catalogs/layouts/executive-summary.json +9 -15
- package/dist/spec/catalogs/layouts/extract/canonical.json +8 -8
- package/dist/spec/catalogs/layouts/faq.json +9 -15
- package/dist/spec/catalogs/layouts/feature-comparison-matrix.json +9 -15
- package/dist/spec/catalogs/layouts/forecast-scenario.json +9 -15
- package/dist/spec/catalogs/layouts/funnel-pyramid.json +9 -15
- package/dist/spec/catalogs/layouts/gantt-project-plan.json +9 -15
- package/dist/spec/catalogs/layouts/geographic-map.json +13 -15
- package/dist/spec/catalogs/layouts/heatmap-cohort.json +9 -15
- package/dist/spec/catalogs/layouts/hub-and-spoke.json +9 -15
- package/dist/spec/catalogs/layouts/icon-grid.json +14 -16
- package/dist/spec/catalogs/layouts/image-1x.json +11 -1
- package/dist/spec/catalogs/layouts/image-2x.json +12 -2
- package/dist/spec/catalogs/layouts/image-3x.json +13 -3
- package/dist/spec/catalogs/layouts/image-bleed.json +12 -2
- package/dist/spec/catalogs/layouts/image-focus.json +14 -16
- package/dist/spec/catalogs/layouts/index.json +1 -1
- package/dist/spec/catalogs/layouts/key-takeaway.json +8 -15
- package/dist/spec/catalogs/layouts/kpi-scorecard.json +9 -15
- package/dist/spec/catalogs/layouts/list-1x.json +17 -1
- package/dist/spec/catalogs/layouts/list-2x.json +16 -0
- package/dist/spec/catalogs/layouts/list-3x.json +16 -0
- package/dist/spec/catalogs/layouts/list-4x.json +16 -0
- package/dist/spec/catalogs/layouts/list-5x.json +16 -0
- package/dist/spec/catalogs/layouts/list-6x.json +16 -0
- package/dist/spec/catalogs/layouts/logic-tree.json +9 -15
- package/dist/spec/catalogs/layouts/market-size.json +9 -15
- package/dist/spec/catalogs/layouts/matrix-quadrant.json +9 -15
- package/dist/spec/catalogs/layouts/media-1x.json +11 -1
- package/dist/spec/catalogs/layouts/network-dependency-map.json +13 -15
- package/dist/spec/catalogs/layouts/number-1x.json +16 -1
- package/dist/spec/catalogs/layouts/number-2x.json +15 -0
- package/dist/spec/catalogs/layouts/number-3x.json +15 -0
- package/dist/spec/catalogs/layouts/number-4x.json +15 -0
- package/dist/spec/catalogs/layouts/number-5x.json +15 -0
- package/dist/spec/catalogs/layouts/number-6x.json +15 -0
- package/dist/spec/catalogs/layouts/one-column-explainer.json +9 -15
- package/dist/spec/catalogs/layouts/org-chart.json +9 -15
- package/dist/spec/catalogs/layouts/persona-grid.json +14 -16
- package/dist/spec/catalogs/layouts/photo-grid.json +17 -19
- package/dist/spec/catalogs/layouts/pricing-table.json +9 -15
- package/dist/spec/catalogs/layouts/process-flow.json +9 -15
- package/dist/spec/catalogs/layouts/product-feature.json +14 -16
- package/dist/spec/catalogs/layouts/pros-cons.json +9 -15
- package/dist/spec/catalogs/layouts/qa-discussion.json +7 -15
- package/dist/spec/catalogs/layouts/quote-1x.json +11 -1
- package/dist/spec/catalogs/layouts/quote-highlight.json +9 -15
- package/dist/spec/catalogs/layouts/raci-matrix.json +9 -15
- package/dist/spec/catalogs/layouts/risk-heatmap.json +9 -15
- package/dist/spec/catalogs/layouts/roadmap.json +9 -15
- package/dist/spec/catalogs/layouts/screenshot-walkthrough.json +14 -16
- package/dist/spec/catalogs/layouts/section-divider.json +8 -15
- package/dist/spec/catalogs/layouts/single-message-statement.json +8 -15
- package/dist/spec/catalogs/layouts/stats-metrics.json +9 -15
- package/dist/spec/catalogs/layouts/status-rag.json +9 -15
- package/dist/spec/catalogs/layouts/swimlane-process.json +14 -16
- package/dist/spec/catalogs/layouts/swot-analysis.json +9 -15
- package/dist/spec/catalogs/layouts/table-1x.json +10 -0
- package/dist/spec/catalogs/layouts/team-bio.json +14 -16
- package/dist/spec/catalogs/layouts/testimonial-grid.json +9 -15
- package/dist/spec/catalogs/layouts/text-1x.json +11 -1
- package/dist/spec/catalogs/layouts/text-2x.json +10 -0
- package/dist/spec/catalogs/layouts/text-3x.json +10 -0
- package/dist/spec/catalogs/layouts/thank-you-cta.json +8 -15
- package/dist/spec/catalogs/layouts/three-column.json +9 -15
- package/dist/spec/catalogs/layouts/timeline-1x.json +11 -1
- package/dist/spec/catalogs/layouts/timeline.json +9 -15
- package/dist/spec/catalogs/layouts/title-slide.json +8 -15
- package/dist/spec/catalogs/layouts/title-subtitle.json +11 -1
- package/dist/spec/catalogs/layouts/title.json +11 -1
- package/dist/spec/catalogs/layouts/two-column.json +9 -15
- package/dist/spec/catalogs/layouts/venn-overlap.json +9 -15
- package/dist/spec/catalogs/layouts/waterfall-bridge.json +9 -15
- package/dist/spec/catalogs/layouts/wheel-radial.json +9 -15
- package/dist/spec/catalogs/manifest.json +11 -11
- package/dist/spec/catalogs/narratives/board-meeting.json +45 -45
- package/dist/spec/catalogs/narratives/business-narrative.json +19 -19
- package/dist/spec/catalogs/narratives/business-review.json +27 -27
- package/dist/spec/catalogs/narratives/capacity-planning.json +19 -19
- package/dist/spec/catalogs/narratives/challenge-resolution.json +17 -17
- package/dist/spec/catalogs/narratives/change-story.json +13 -13
- package/dist/spec/catalogs/narratives/classic-story.json +17 -17
- package/dist/spec/catalogs/narratives/company-intro.json +21 -21
- package/dist/spec/catalogs/narratives/conference-talk.json +4 -4
- package/dist/spec/catalogs/narratives/data-story.json +13 -14
- package/dist/spec/catalogs/narratives/early-startup-pitch.json +27 -27
- package/dist/spec/catalogs/narratives/educate.json +21 -21
- package/dist/spec/catalogs/narratives/employee-review.json +19 -19
- package/dist/spec/catalogs/narratives/failure-analysis.json +23 -23
- package/dist/spec/catalogs/narratives/focus.json +27 -27
- package/dist/spec/catalogs/narratives/golden-circle.json +4 -4
- package/dist/spec/catalogs/narratives/heros-journey.json +13 -13
- package/dist/spec/catalogs/narratives/index.json +145 -145
- package/dist/spec/catalogs/narratives/innovation.json +21 -21
- package/dist/spec/catalogs/narratives/justice.json +25 -25
- package/dist/spec/catalogs/narratives/marketing-strategy.json +25 -25
- package/dist/spec/catalogs/narratives/performance-improvement-plan.json +19 -19
- package/dist/spec/catalogs/narratives/performance-review.json +25 -25
- package/dist/spec/catalogs/narratives/persuade.json +17 -17
- package/dist/spec/catalogs/narratives/persuasive-sales.json +19 -19
- package/dist/spec/catalogs/narratives/pitch-deck.json +6 -6
- package/dist/spec/catalogs/narratives/problem-solution.json +5 -5
- package/dist/spec/catalogs/narratives/product-launch.json +23 -23
- package/dist/spec/catalogs/narratives/project-proposal.json +23 -23
- package/dist/spec/catalogs/narratives/pyramid-principle.json +9 -9
- package/dist/spec/catalogs/narratives/qbr.json +8 -8
- package/dist/spec/catalogs/narratives/rags-to-riches.json +17 -17
- package/dist/spec/catalogs/narratives/reveal.json +19 -19
- package/dist/spec/catalogs/narratives/scqa.json +4 -4
- package/dist/spec/catalogs/narratives/situation-complication-resolution.json +11 -11
- package/dist/spec/catalogs/narratives/sparkline.json +11 -11
- package/dist/spec/catalogs/narratives/star-method.json +11 -11
- package/dist/spec/catalogs/narratives/status-update.json +15 -15
- package/dist/spec/catalogs/narratives/strategic-advisory.json +17 -17
- package/dist/spec/catalogs/narratives/strategic-narrative.json +4 -4
- package/dist/spec/catalogs/narratives/survey-analysis.json +23 -23
- package/dist/spec/catalogs/narratives/survival-story.json +23 -23
- package/dist/spec/catalogs/narratives/transformation-arc.json +4 -4
- package/dist/spec/catalogs/narratives/trend-analysis.json +17 -17
- package/dist/spec/catalogs/narratives/underdog-victory.json +19 -19
- package/dist/spec/catalogs/narratives/venture-pitch.json +27 -27
- package/dist/spec/catalogs/narratives/vision-roadmap.json +13 -13
- package/dist/spec/catalogs/narratives/weekly-progress.json +23 -23
- package/dist/spec/catalogs/narratives/what-so-what-now-what.json +9 -9
- package/dist/spec/openapi.yaml +2 -5
- package/dist/spec/reference/engine-defaults.json +2 -2
- package/dist/spec/schemas/audience.schema.json +1 -1
- package/dist/spec/schemas/catalog-index.schema.json +2 -2
- package/dist/spec/schemas/chart-type.schema.json +19 -290
- package/dist/spec/schemas/color-scheme.schema.json +20 -12
- package/dist/spec/schemas/finding.schema.json +191 -0
- package/dist/spec/schemas/font-scheme.schema.json +19 -46
- package/dist/spec/schemas/layout.schema.json +100 -159
- package/dist/spec/schemas/narrative.schema.json +17 -25
- package/dist/spec/schemas/opf.schema.json +503 -339
- package/dist/spec/schemas/social-platform.schema.json +1 -26
- package/dist/spec/schemas/theme.schema.json +4 -1
- package/dist/spec-files.d.ts +1 -1
- package/dist/spec-files.js +1 -1
- package/dist/symbol-font-encodings.js +18448 -1
- package/dist/types.d.ts +4 -4
- package/dist/validation-types-zh03LeZy.d.ts +276 -0
- package/dist/validator.d.ts +60 -4
- package/dist/validator.js +4 -4
- package/dist/yaml.d.ts +87 -0
- package/dist/yaml.js +321 -0
- package/package.json +6 -10
- package/dist/audit.d.ts +0 -156
- package/dist/audit.js +0 -7
- package/dist/chunk-6LZK2IZB.js +0 -1690
- package/dist/chunk-FYLJVF7X.js +0 -18448
- package/dist/chunk-JKVKYVWL.js +0 -1332
- package/dist/chunk-MWPMJE6P.js +0 -622
- package/dist/lint.d.ts +0 -70
- package/dist/lint.js +0 -6
- package/dist/spec/catalogs/audiences/customers.json +0 -27
- package/dist/spec/catalogs/audiences/executives.json +0 -27
- package/dist/spec/catalogs/audiences/investors.json +0 -27
- package/dist/spec/catalogs/audiences/marketing-team.json +0 -27
- package/dist/spec/catalogs/audiences/regulators.json +0 -27
- package/dist/spec/catalogs/audiences/sales-team.json +0 -27
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar-2x.json +0 -91
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar-3x.json +0 -103
- package/dist/spec/catalogs/chart-types/100pct-bullet-bar.json +0 -79
- package/dist/spec/catalogs/chart-types/100pct-bullet-column-2x.json +0 -91
- package/dist/spec/catalogs/chart-types/100pct-bullet-column-3x.json +0 -103
- package/dist/spec/catalogs/chart-types/100pct-bullet-column.json +0 -79
- package/dist/spec/catalogs/chart-types/100pct-progress-bar.json +0 -105
- package/dist/spec/catalogs/chart-types/100pct-stacked-area-2x.json +0 -106
- package/dist/spec/catalogs/chart-types/100pct-stacked-area-3x.json +0 -123
- package/dist/spec/catalogs/chart-types/100pct-stacked-bar-2x.json +0 -89
- package/dist/spec/catalogs/chart-types/100pct-stacked-bar-3x.json +0 -100
- package/dist/spec/catalogs/chart-types/100pct-stacked-column-2x.json +0 -95
- package/dist/spec/catalogs/chart-types/100pct-stacked-column-3x.json +0 -108
- package/dist/spec/catalogs/chart-types/australia.json +0 -76
- package/dist/spec/catalogs/chart-types/box-and-whisker-2x.json +0 -136
- package/dist/spec/catalogs/chart-types/box-and-whisker-3x.json +0 -168
- package/dist/spec/catalogs/chart-types/bullet-bar-2x.json +0 -89
- package/dist/spec/catalogs/chart-types/bullet-bar-3x.json +0 -101
- package/dist/spec/catalogs/chart-types/bullet-bar.json +0 -77
- package/dist/spec/catalogs/chart-types/bullet-column-2x.json +0 -89
- package/dist/spec/catalogs/chart-types/bullet-column-3x.json +0 -101
- package/dist/spec/catalogs/chart-types/bullet-column.json +0 -77
- package/dist/spec/catalogs/chart-types/canada.json +0 -86
- package/dist/spec/catalogs/chart-types/clustered-bar-2x.json +0 -89
- package/dist/spec/catalogs/chart-types/clustered-column.json +0 -95
- package/dist/spec/catalogs/chart-types/dot-plot-2x.json +0 -99
- package/dist/spec/catalogs/chart-types/dot-plot-3x.json +0 -124
- package/dist/spec/catalogs/chart-types/dot-plot-4x.json +0 -149
- package/dist/spec/catalogs/chart-types/dot-plot-5x.json +0 -174
- package/dist/spec/catalogs/chart-types/dot-plot-6x.json +0 -199
- package/dist/spec/catalogs/chart-types/dot-plot.json +0 -74
- package/dist/spec/catalogs/chart-types/dumbbell.json +0 -120
- package/dist/spec/catalogs/chart-types/line-2x.json +0 -105
- package/dist/spec/catalogs/chart-types/line-3x.json +0 -127
- package/dist/spec/catalogs/chart-types/line-with-high-low-and-markers.json +0 -144
- package/dist/spec/catalogs/chart-types/line-with-high-low.json +0 -144
- package/dist/spec/catalogs/chart-types/line-with-markers-2x.json +0 -106
- package/dist/spec/catalogs/chart-types/line-with-markers-3x.json +0 -128
- package/dist/spec/catalogs/chart-types/sparkline-2x.json +0 -138
- package/dist/spec/catalogs/chart-types/sparkline-3x.json +0 -174
- package/dist/spec/catalogs/chart-types/sparkline-4x.json +0 -210
- package/dist/spec/catalogs/chart-types/sparkline-5x.json +0 -246
- package/dist/spec/catalogs/chart-types/sparkline-6x.json +0 -282
- package/dist/spec/catalogs/chart-types/sparkline.json +0 -102
- package/dist/spec/catalogs/chart-types/stacked-area-2x.json +0 -106
- package/dist/spec/catalogs/chart-types/stacked-area-3x.json +0 -123
- package/dist/spec/catalogs/chart-types/stacked-bar-2x.json +0 -89
- package/dist/spec/catalogs/chart-types/stacked-bar-3x.json +0 -100
- package/dist/spec/catalogs/chart-types/stacked-column-2x.json +0 -95
- package/dist/spec/catalogs/chart-types/stacked-column-3x.json +0 -108
- package/dist/spec/catalogs/chart-types/stacked-line-2x.json +0 -106
- package/dist/spec/catalogs/chart-types/stacked-line-3x.json +0 -123
- package/dist/spec/catalogs/chart-types/stacked-line-with-markers-2x.json +0 -107
- package/dist/spec/catalogs/chart-types/stacked-line-with-markers-3x.json +0 -124
- package/dist/spec/catalogs/chart-types/treemap-2x.json +0 -101
- package/dist/spec/catalogs/chart-types/treemap-3x.json +0 -122
- package/dist/spec/catalogs/chart-types/united-kingdom.json +0 -68
- package/dist/spec/catalogs/chart-types/united-states.json +0 -82
- package/dist/validator-DfG9yxba.d.ts +0 -172
package/dist/yaml.js
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { Ctx } from './chunk-4LDGKLUC.js';
|
|
2
|
+
import { sortPresentationKeys } from './chunk-5ZU6JAPP.js';
|
|
3
|
+
import { same } from './chunk-CSQHPVGL.js';
|
|
4
|
+
import { validate } from './chunk-JDJBDYSR.js';
|
|
5
|
+
import './chunk-6OXY2CP3.js';
|
|
6
|
+
import './chunk-S5W34SIJ.js';
|
|
7
|
+
import './chunk-XOZ4KMSR.js';
|
|
8
|
+
import { presentation } from './chunk-LS2FMPI5.js';
|
|
9
|
+
import { Parser, parseDocument, isMap, Document, visit, isScalar, isAlias, isSeq } from 'yaml';
|
|
10
|
+
|
|
11
|
+
var MAX_ALIAS_COUNT = 100;
|
|
12
|
+
var CORE_TAGS = new Set(["map", "seq", "str", "int", "float", "bool", "null"].map((name) => `tag:yaml.org,2002:${name}`));
|
|
13
|
+
var ALIAS_HELP = "Write each value out instead of using anchors (&name), aliases (*name) and merge keys (<<). Pass aliases: true (CLI: --aliases) to expand them.";
|
|
14
|
+
var TAG_HELP = "Custom tags are not accepted. Remove the tag; quote a value to keep it as text.";
|
|
15
|
+
var CYCLE_HELP = "An alias must not appear inside its own anchor. Write the nested value out.";
|
|
16
|
+
var decode = (part) => part.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
17
|
+
var encode = (part) => part.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
18
|
+
var pointerOf = (parts) => parts.length ? `/${parts.map(encode).join("/")}` : "";
|
|
19
|
+
function rangeOfPointer(doc, pointer) {
|
|
20
|
+
const root = doc?.contents;
|
|
21
|
+
if (!root?.range) return void 0;
|
|
22
|
+
const parts = pointer === "" ? [] : pointer.slice(1).split("/").map(decode);
|
|
23
|
+
let node = root;
|
|
24
|
+
let key;
|
|
25
|
+
for (const part of parts) {
|
|
26
|
+
if (isAlias(node)) break;
|
|
27
|
+
let child;
|
|
28
|
+
let childKey;
|
|
29
|
+
if (isMap(node)) {
|
|
30
|
+
const pairs = node.items;
|
|
31
|
+
const pair = pairs.find((item) => isScalar(item.key) && String(item.key.value) === part) ?? pairs.find((item) => isMergeKey(item.key) && item.value);
|
|
32
|
+
if (pair) {
|
|
33
|
+
childKey = pair.key;
|
|
34
|
+
child = pair.value ?? childKey;
|
|
35
|
+
}
|
|
36
|
+
} else if (isSeq(node)) child = node.items[/^(?:0|[1-9]\d*)$/.test(part) ? Number(part) : -1];
|
|
37
|
+
if (!child?.range) break;
|
|
38
|
+
node = child;
|
|
39
|
+
key = childKey;
|
|
40
|
+
}
|
|
41
|
+
const [start, end] = node.range;
|
|
42
|
+
if (key?.range && (isMap(node) || isSeq(node) || isAlias(node))) return { start: key.range[0], end };
|
|
43
|
+
return { start, end: Math.max(start, end) };
|
|
44
|
+
}
|
|
45
|
+
function isMergeKey(key) {
|
|
46
|
+
return isScalar(key) && (typeof key.value === "symbol" || key.value === "<<" && key.type === "PLAIN");
|
|
47
|
+
}
|
|
48
|
+
function describeError(error) {
|
|
49
|
+
const text = error.message.split("\n")[0] ?? error.message;
|
|
50
|
+
switch (error.code) {
|
|
51
|
+
case "DUPLICATE_KEY":
|
|
52
|
+
return { rule: "duplicate-key", message: `YAML: ${text}`, help: "Remove or rename one of the repeated keys. JSON-compatible YAML needs every key once in each mapping." };
|
|
53
|
+
case "MULTIPLE_DOCS":
|
|
54
|
+
return { rule: "multiple-documents", message: "The input holds more than one YAML document.", help: "An OPF file is exactly one document: remove the extra --- separators, or put each deck in its own file." };
|
|
55
|
+
case "TAG_RESOLVE_FAILED":
|
|
56
|
+
return { rule: "tag", message: `YAML: ${text}`, help: TAG_HELP };
|
|
57
|
+
case "BAD_ALIAS":
|
|
58
|
+
return { rule: "alias", message: `YAML: ${text}`, help: ALIAS_HELP };
|
|
59
|
+
default:
|
|
60
|
+
return { rule: "syntax", message: `YAML: ${text}`, help: "Fix the YAML syntax at this position. An OPF file holds JSON-compatible YAML 1.2: mappings, sequences and scalars." };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function keyRangeAt(doc, start) {
|
|
64
|
+
let found;
|
|
65
|
+
visit(doc, {
|
|
66
|
+
Pair(_key, pair) {
|
|
67
|
+
const key = pair.key;
|
|
68
|
+
if (!found && key?.range && key.range[0] === start) found = { start, end: key.range[1] };
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return found;
|
|
72
|
+
}
|
|
73
|
+
function readYamlDocument(source, aliases, rootKind = "mapping") {
|
|
74
|
+
const bom = source.startsWith("\uFEFF") ? 1 : 0;
|
|
75
|
+
const text = source.slice(bom);
|
|
76
|
+
const ctx = new Ctx(text);
|
|
77
|
+
const findings = [];
|
|
78
|
+
const locate = (range) => {
|
|
79
|
+
const location = ctx.location(range);
|
|
80
|
+
return { ...location, offset: location.offset + bom };
|
|
81
|
+
};
|
|
82
|
+
const add = (rule, message, help, range, path = "") => {
|
|
83
|
+
findings.push({ ruleId: `yaml/${rule}`, severity: "error", category: "format", scope: "document", path, message, help, location: locate(range) });
|
|
84
|
+
};
|
|
85
|
+
const doc = parseDocument(text, { schema: "core", uniqueKeys: true, merge: aliases, prettyErrors: false });
|
|
86
|
+
const finish = (value2) => ({
|
|
87
|
+
value: value2,
|
|
88
|
+
locatePointer: (pointer) => {
|
|
89
|
+
const range = rangeOfPointer(doc, pointer);
|
|
90
|
+
return range ? locate(range) : void 0;
|
|
91
|
+
},
|
|
92
|
+
findings,
|
|
93
|
+
errors: findings.length
|
|
94
|
+
});
|
|
95
|
+
for (const error of [...doc.errors, ...doc.warnings.filter((warning) => warning.code === "TAG_RESOLVE_FAILED")]) {
|
|
96
|
+
const described = describeError(error);
|
|
97
|
+
const [start, end] = error.pos;
|
|
98
|
+
add(described.rule, described.message, described.help, (error.code === "DUPLICATE_KEY" ? keyRangeAt(doc, start) : void 0) ?? { start, end: Math.max(start, end) });
|
|
99
|
+
}
|
|
100
|
+
if (findings.length) return finish({});
|
|
101
|
+
const root = doc.contents;
|
|
102
|
+
if (root === null || !root.range) {
|
|
103
|
+
add("empty", "The input holds no YAML document.", "An OPF file is one YAML mapping: write the deck properties (name, slides, ...) as key: value lines.", { start: 0, end: Math.min(1, text.length) });
|
|
104
|
+
return finish({});
|
|
105
|
+
}
|
|
106
|
+
const rootRange = { start: root.range[0], end: root.range[1] };
|
|
107
|
+
if (rootKind === "mapping" && !isMap(root)) {
|
|
108
|
+
add("not-mapping", "The document is not a mapping.", "An OPF deck is a YAML mapping of keys and values (name:, slides:, ...), not a list or a single value.", rootRange);
|
|
109
|
+
return finish({});
|
|
110
|
+
}
|
|
111
|
+
checkTree({ doc, text, aliases, add }, root, [], []);
|
|
112
|
+
if (findings.length) return finish({});
|
|
113
|
+
let value;
|
|
114
|
+
try {
|
|
115
|
+
value = doc.toJS({ maxAliasCount: aliases ? MAX_ALIAS_COUNT : 0 });
|
|
116
|
+
} catch (error) {
|
|
117
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
118
|
+
if (/excessive alias/i.test(message)) add("alias-limit", `The anchors and aliases expand beyond the limit of ${MAX_ALIAS_COUNT} aliases.`, "Aliases that contain aliases grow exponentially. Write the repeated values out, or reduce the aliasing.", rootRange);
|
|
119
|
+
else add("alias", `YAML: ${message}`, ALIAS_HELP, rootRange);
|
|
120
|
+
return finish({});
|
|
121
|
+
}
|
|
122
|
+
if (isCircular(value)) {
|
|
123
|
+
add("alias-cycle", "An alias refers to the value that contains it, so the document is infinitely deep.", CYCLE_HELP, rootRange);
|
|
124
|
+
return finish({});
|
|
125
|
+
}
|
|
126
|
+
const bad = nonJson(value);
|
|
127
|
+
if (bad) {
|
|
128
|
+
add("number", `The YAML holds ${bad}, which JSON cannot carry.`, "Quote it to keep it as text, or write a finite number.", rootRange);
|
|
129
|
+
return finish({});
|
|
130
|
+
}
|
|
131
|
+
return finish(value);
|
|
132
|
+
}
|
|
133
|
+
function propertyRange(text, nodeStart, token, fallback) {
|
|
134
|
+
const found = text.lastIndexOf(token, nodeStart);
|
|
135
|
+
return found >= 0 && found < nodeStart ? { start: found, end: found + token.length } : fallback;
|
|
136
|
+
}
|
|
137
|
+
function checkTree(env, node, trail, ancestors) {
|
|
138
|
+
const { doc, text, aliases, add } = env;
|
|
139
|
+
const path = pointerOf(trail);
|
|
140
|
+
const range = (target) => ({ start: target.range?.[0] ?? 0, end: Math.max(target.range?.[0] ?? 0, target.range?.[1] ?? 0) });
|
|
141
|
+
if (isAlias(node)) {
|
|
142
|
+
const name = node.source;
|
|
143
|
+
if (!aliases) add("alias", `The alias *${name} is not allowed.`, ALIAS_HELP, range(node), path);
|
|
144
|
+
else {
|
|
145
|
+
const target = node.resolve(doc);
|
|
146
|
+
if (target && ancestors.includes(target)) add("alias-cycle", `The alias *${name} refers to a value that contains it.`, CYCLE_HELP, range(node), path);
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const anchor = node.anchor;
|
|
151
|
+
if (anchor !== void 0 && !aliases) add("alias", `The anchor &${anchor} is not allowed.`, ALIAS_HELP, propertyRange(text, node.range?.[0] ?? 0, `&${anchor}`, range(node)), path);
|
|
152
|
+
const tag = node.tag;
|
|
153
|
+
if (tag !== void 0 && !CORE_TAGS.has(tag)) {
|
|
154
|
+
let start = text.lastIndexOf("!", node.range?.[0] ?? 0);
|
|
155
|
+
while (start > 0 && text[start - 1] === "!") start--;
|
|
156
|
+
const written = start >= 0 ? /^!\S*/.exec(text.slice(start))?.[0] : void 0;
|
|
157
|
+
add("tag", `The tag ${written ?? tag} is not allowed.`, TAG_HELP, written && start < (node.range?.[0] ?? 0) ? { start, end: start + written.length } : range(node), path);
|
|
158
|
+
}
|
|
159
|
+
if (isScalar(node)) {
|
|
160
|
+
const value = node.value;
|
|
161
|
+
if (typeof value === "number" && !Number.isFinite(value)) add("number", `${String(node.source ?? value)} is not a finite number, and JSON cannot carry it.`, 'Quote it (".inf", ".nan") to keep it as text, or write a finite number.', range(node), path);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const inside = [...ancestors, node];
|
|
165
|
+
if (isMap(node)) {
|
|
166
|
+
for (const pair of node.items) {
|
|
167
|
+
const key = pair.key;
|
|
168
|
+
if (key && isMergeKey(key)) {
|
|
169
|
+
if (!aliases) add("alias", "The merge key << is not allowed.", ALIAS_HELP, range(key), path);
|
|
170
|
+
else {
|
|
171
|
+
const source = pair.value;
|
|
172
|
+
if (source && isSeq(source)) for (const item of source.items) checkTree(env, item, [...trail, "<<"], inside);
|
|
173
|
+
else if (source) checkTree(env, source, [...trail, "<<"], inside);
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const resolved = key && isAlias(key) ? key.resolve(doc) : key;
|
|
178
|
+
const name = resolved && isScalar(resolved) && typeof resolved.value === "string" ? resolved.value : void 0;
|
|
179
|
+
if (key) checkTree(env, key, trail, inside);
|
|
180
|
+
if (name === void 0) {
|
|
181
|
+
add("key", "A mapping key is not a string.", 'JSON keys are always strings. Quote the key, for example "1": value.', key ? range(key) : range(node), path);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (pair.value) checkTree(env, pair.value, [...trail, name], inside);
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (isSeq(node)) {
|
|
189
|
+
const items = node.items;
|
|
190
|
+
for (let index = 0; index < items.length; index++) checkTree(env, items[index], [...trail, String(index)], inside);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function nonJson(value) {
|
|
194
|
+
if (typeof value === "number") return Number.isFinite(value) ? void 0 : "a number that is not finite";
|
|
195
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return void 0;
|
|
196
|
+
if (Array.isArray(value)) return value.map(nonJson).find(Boolean);
|
|
197
|
+
if (typeof value === "object") {
|
|
198
|
+
const prototype = Object.getPrototypeOf(value);
|
|
199
|
+
if (prototype !== Object.prototype && prototype !== null) return `a ${value.constructor?.name ?? "non-JSON"} value`;
|
|
200
|
+
return Object.values(value).map(nonJson).find(Boolean);
|
|
201
|
+
}
|
|
202
|
+
return `a ${typeof value}`;
|
|
203
|
+
}
|
|
204
|
+
function isCircular(value, stack = /* @__PURE__ */ new Set()) {
|
|
205
|
+
if (typeof value !== "object" || value === null) return false;
|
|
206
|
+
if (stack.has(value)) return true;
|
|
207
|
+
stack.add(value);
|
|
208
|
+
const found = Object.values(value).some((child) => isCircular(child, stack));
|
|
209
|
+
stack.delete(value);
|
|
210
|
+
return found;
|
|
211
|
+
}
|
|
212
|
+
function scanYamlComments(source) {
|
|
213
|
+
const text = source.startsWith("\uFEFF") ? source.slice(1) : source;
|
|
214
|
+
let count = 0;
|
|
215
|
+
let modeline;
|
|
216
|
+
const visit3 = (value) => {
|
|
217
|
+
if (Array.isArray(value)) value.forEach(visit3);
|
|
218
|
+
else if (value && typeof value === "object") {
|
|
219
|
+
const token = value;
|
|
220
|
+
if (token.type === "comment" && typeof token.source === "string") {
|
|
221
|
+
if (modeline === void 0 && token.offset === 0 && /^#\s*yaml-language-server:/.test(token.source)) modeline = token.source;
|
|
222
|
+
else count++;
|
|
223
|
+
} else for (const child of Object.values(value)) visit3(child);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
for (const token of new Parser().parse(text)) visit3(token);
|
|
227
|
+
return { count, ...modeline === void 0 ? {} : { modeline } };
|
|
228
|
+
}
|
|
229
|
+
var AMBIGUOUS = [
|
|
230
|
+
/^(?:y|n|yes|no|on|off|true|false|null|~|=|<<)$/i,
|
|
231
|
+
/^[-+]?(?:0[0-7_]+|0b[01_]+|0x[0-9a-f_]+|[0-9][0-9_]*(?:\.[0-9_]*)?(?:e[-+]?[0-9]+)?|\.[0-9_]+(?:e[-+]?[0-9]+)?|\.inf)$/i,
|
|
232
|
+
/^\.nan$/i,
|
|
233
|
+
/^\d{4}-\d{1,2}-\d{1,2}(?:[Tt ].*)?$/,
|
|
234
|
+
/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$/
|
|
235
|
+
];
|
|
236
|
+
var isAmbiguous = (text) => AMBIGUOUS.some((pattern) => pattern.test(text));
|
|
237
|
+
function writeCanonicalYaml(value, reads) {
|
|
238
|
+
const expected = JSON.stringify(value);
|
|
239
|
+
for (const blockQuote of [true, false]) {
|
|
240
|
+
const doc = new Document(value, { schema: "core" });
|
|
241
|
+
visit(doc, {
|
|
242
|
+
Scalar(_key, node) {
|
|
243
|
+
if (isScalar(node) && typeof node.value === "string" && isAmbiguous(node.value)) node.type = "QUOTE_DOUBLE";
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const text = doc.toString({ indent: 2, lineWidth: 0, minContentWidth: 0, blockQuote, defaultStringType: "PLAIN", defaultKeyType: "PLAIN" });
|
|
247
|
+
const out = text.endsWith("\n") ? text : `${text}
|
|
248
|
+
`;
|
|
249
|
+
let back;
|
|
250
|
+
try {
|
|
251
|
+
back = reads(out);
|
|
252
|
+
} catch {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (JSON.stringify(back) === expected) return out;
|
|
256
|
+
}
|
|
257
|
+
return void 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// src/yaml.ts
|
|
261
|
+
var YAML_SCHEMA_URL = presentation.$id;
|
|
262
|
+
var NOT_CHECKED = { syntax: "checked", schema: "not-run", references: "not-run", policy: "not-run", accessibility: "not-run", content: "not-run", layout: "not-run", backgroundPixels: "not-read", imageBytes: "embedded-only", nativeExport: "not-checked" };
|
|
263
|
+
function fromYaml(yaml, options = {}) {
|
|
264
|
+
if (typeof yaml !== "string") throw new TypeError("fromYaml expects a string.");
|
|
265
|
+
const parsed = readYamlDocument(yaml, options.aliases === true);
|
|
266
|
+
const findings = [...parsed.findings];
|
|
267
|
+
let report = { schemaValid: null, checks: NOT_CHECKED };
|
|
268
|
+
if (!parsed.errors && options.validate !== false) {
|
|
269
|
+
const checked = validate(parsed.value, options.validate === true || options.validate === void 0 ? { only: ["format", "references"] } : options.validate);
|
|
270
|
+
report = {
|
|
271
|
+
schemaValid: checked.schemaValid,
|
|
272
|
+
checks: { ...checked.checks, syntax: "checked" },
|
|
273
|
+
...checked.template === void 0 ? {} : { template: checked.template },
|
|
274
|
+
...checked.unfilledVariables === void 0 ? {} : { unfilledVariables: checked.unfilledVariables }
|
|
275
|
+
};
|
|
276
|
+
for (const found of checked.findings) {
|
|
277
|
+
const location = parsed.locatePointer(found.path) ?? parsed.locatePointer("") ?? { offset: 0, length: 0, line: 1, column: 1 };
|
|
278
|
+
findings.push({ ...found, location });
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
findings.sort((a, b) => a.location.offset - b.location.offset);
|
|
282
|
+
const counts = { error: 0, warning: 0, info: 0 };
|
|
283
|
+
for (const found of findings) counts[found.severity]++;
|
|
284
|
+
return { presentation: parsed.value, valid: counts.error === 0, findings, counts, ...report };
|
|
285
|
+
}
|
|
286
|
+
var OPFYamlError = class extends Error {
|
|
287
|
+
code;
|
|
288
|
+
details;
|
|
289
|
+
constructor(code, message, details = {}) {
|
|
290
|
+
super(message);
|
|
291
|
+
this.name = "OPFYamlError";
|
|
292
|
+
this.code = code;
|
|
293
|
+
this.details = details;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
function toYaml(document, options = {}) {
|
|
297
|
+
const checked = validate(document, { only: ["format"] });
|
|
298
|
+
if (!checked.valid) {
|
|
299
|
+
const errors = checked.findings.filter((found) => found.severity === "error");
|
|
300
|
+
const first = errors[0];
|
|
301
|
+
throw new OPFYamlError("invalid-document", `The document is not valid OPF: ${first?.message ?? "unknown error"}${first?.path ? ` (${first.path})` : ""}.`, { findings: errors });
|
|
302
|
+
}
|
|
303
|
+
const sorted = sortPresentationKeys(document);
|
|
304
|
+
const text = writeCanonicalYaml(sorted, (out) => {
|
|
305
|
+
const back = readYamlDocument(out, false);
|
|
306
|
+
if (back.errors) throw new Error("The YAML does not read back.");
|
|
307
|
+
return back.value;
|
|
308
|
+
});
|
|
309
|
+
if (text === void 0) throw new OPFYamlError("not-representable", "The document holds a value that YAML cannot carry exactly.");
|
|
310
|
+
if (!same(JSON.parse(JSON.stringify(sorted)), readYamlDocument(text, false).value)) throw new OPFYamlError("not-representable", "The document does not read back from its YAML.");
|
|
311
|
+
const schema = typeof sorted.$schema === "string" && !/[\r\n]/.test(sorted.$schema) ? sorted.$schema : YAML_SCHEMA_URL;
|
|
312
|
+
return { yaml: options.schemaComment ? `# yaml-language-server: $schema=${schema}
|
|
313
|
+
${text}` : text };
|
|
314
|
+
}
|
|
315
|
+
function parseYamlData(yaml, options = {}) {
|
|
316
|
+
if (typeof yaml !== "string") throw new TypeError("parseYamlData expects a string.");
|
|
317
|
+
const parsed = readYamlDocument(yaml, options.aliases === true, "any");
|
|
318
|
+
return { value: parsed.errors ? null : parsed.value, valid: parsed.errors === 0, findings: parsed.findings };
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { OPFYamlError, YAML_SCHEMA_URL, fromYaml, parseYamlData, scanYamlComments, toYaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpresentation/opf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Canonical Open Presentation Format schemas, catalogs, TypeScript types, and local validation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Open Presentation",
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
"types": "./dist/symbol-font-encodings.d.ts",
|
|
93
93
|
"import": "./dist/symbol-font-encodings.js"
|
|
94
94
|
},
|
|
95
|
-
"./lint": {
|
|
96
|
-
"types": "./dist/lint.d.ts",
|
|
97
|
-
"import": "./dist/lint.js"
|
|
98
|
-
},
|
|
99
95
|
"./markdown": {
|
|
100
96
|
"types": "./dist/markdown.d.ts",
|
|
101
97
|
"import": "./dist/markdown.js"
|
|
102
98
|
},
|
|
99
|
+
"./yaml": {
|
|
100
|
+
"types": "./dist/yaml.d.ts",
|
|
101
|
+
"import": "./dist/yaml.js"
|
|
102
|
+
},
|
|
103
103
|
"./patch": {
|
|
104
104
|
"types": "./dist/patch.d.ts",
|
|
105
105
|
"import": "./dist/patch.js"
|
|
@@ -115,10 +115,6 @@
|
|
|
115
115
|
"./convert": {
|
|
116
116
|
"types": "./dist/convert.d.ts",
|
|
117
117
|
"import": "./dist/convert.js"
|
|
118
|
-
},
|
|
119
|
-
"./audit": {
|
|
120
|
-
"types": "./dist/audit.d.ts",
|
|
121
|
-
"import": "./dist/audit.js"
|
|
122
118
|
}
|
|
123
119
|
},
|
|
124
120
|
"files": [
|
|
@@ -133,7 +129,7 @@
|
|
|
133
129
|
"scripts": {
|
|
134
130
|
"clean": "rm -rf dist src/generated",
|
|
135
131
|
"generate": "node scripts/generate.mjs && node scripts/generate-previews.mjs && node scripts/generate-content.mjs",
|
|
136
|
-
"build": "pnpm run generate && tsup && node scripts/copy-spec.mjs",
|
|
132
|
+
"build": "node ../../scripts/reuse-build.mjs check || (pnpm run generate && tsup && node scripts/copy-spec.mjs && node ../../scripts/reuse-build.mjs stamp)",
|
|
137
133
|
"typecheck": "pnpm run generate && node ../../scripts/typecheck.mjs --noEmit",
|
|
138
134
|
"test": "pnpm run build && node ../../scripts/run-tests.mjs",
|
|
139
135
|
"test:packed": "node test/packed-install-smoke.mjs",
|
package/dist/audit.d.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { C as CatalogKind } from './catalogs-BnI7JKcn.js';
|
|
2
|
-
import { T as TextMeasurement } from './composition-DWbCiMwF.js';
|
|
3
|
-
import { LintDiagnostic, LintSeverity } from './lint.js';
|
|
4
|
-
import './schemas-BSjlG8-R.js';
|
|
5
|
-
import './validator-DfG9yxba.js';
|
|
6
|
-
import './presentation-DcF-MZcz.js';
|
|
7
|
-
|
|
8
|
-
/** Same three levels as `lintSource`. */
|
|
9
|
-
type AuditSeverity = LintSeverity;
|
|
10
|
-
type AuditCategory = 'accessibility' | 'design' | 'content';
|
|
11
|
-
/** One JSON Patch operation (RFC 6902 subset) a quick fix applies. Paths are JSON Pointers into the audited document. */
|
|
12
|
-
interface AuditPatchOperation {
|
|
13
|
-
op: 'add' | 'replace' | 'remove';
|
|
14
|
-
path: string;
|
|
15
|
-
value?: unknown;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A suggested repair. Core never applies it: a host shows it and applies it through its own undoable edit path.
|
|
19
|
-
* `focus` fixes only name the field the author must fill in; `patch` fixes are small, deterministic and leave
|
|
20
|
-
* every unrelated field untouched.
|
|
21
|
-
*/
|
|
22
|
-
interface AuditFix {
|
|
23
|
-
/** Stable id within one diagnostic, such as `focus-alt` or `inherit-text-color`. */
|
|
24
|
-
id: string;
|
|
25
|
-
label: string;
|
|
26
|
-
kind: 'patch' | 'focus';
|
|
27
|
-
/** True when applying the fix cannot change the meaning of the content (a colour switched to a readable one, a field focused). */
|
|
28
|
-
safe: boolean;
|
|
29
|
-
patch?: AuditPatchOperation[];
|
|
30
|
-
/** For `focus`: the JSON Pointer of the field to edit and a hint of what it is. */
|
|
31
|
-
focus?: {
|
|
32
|
-
path: string;
|
|
33
|
-
field: 'alt' | 'title' | 'text' | 'link' | 'language' | 'fontSize';
|
|
34
|
-
value?: unknown;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
interface AuditDiagnostic extends LintDiagnostic {
|
|
38
|
-
/** `audit/<rule>`; ids are stable across releases. */
|
|
39
|
-
ruleId: string;
|
|
40
|
-
/** Zero-based slide index when the finding belongs to one slide. */
|
|
41
|
-
slide?: number;
|
|
42
|
-
slideId?: string;
|
|
43
|
-
category: AuditCategory;
|
|
44
|
-
/** Measured values behind the finding (ratios, sizes, counts), for reporters and tests. */
|
|
45
|
-
measured?: Record<string, number | string | boolean | null>;
|
|
46
|
-
fixes?: AuditFix[];
|
|
47
|
-
}
|
|
48
|
-
interface AuditThresholds {
|
|
49
|
-
/** Minimum WCAG contrast ratio for normal text. WCAG 2.x AA: 4.5. */
|
|
50
|
-
contrastNormal: number;
|
|
51
|
-
/** Minimum ratio for large text (at least 18 pt, or 14 pt bold). WCAG 2.x AA: 3. */
|
|
52
|
-
contrastLarge: number;
|
|
53
|
-
/** Smallest rendered text size, in points, before `audit/min-font-size` reports. */
|
|
54
|
-
minFontSizePt: number;
|
|
55
|
-
/** Words on one slide above which `audit/slide-word-count` reports. */
|
|
56
|
-
maxWordsPerSlide: number;
|
|
57
|
-
/** Distinct font families across the deck above which `audit/font-family-count` reports. */
|
|
58
|
-
maxFontFamilies: number;
|
|
59
|
-
/** Minimum effective pixels per inch of an embedded raster image at its displayed size. */
|
|
60
|
-
minImagePpi: number;
|
|
61
|
-
/** Largest title offset between slides of the same layout, as a fraction of the slide width/height. */
|
|
62
|
-
titlePositionTolerance: number;
|
|
63
|
-
/** Smallest CIE76 colour difference between two chart series (after colour-vision simulation) before they count as confusable. */
|
|
64
|
-
minSeriesColorDifference: number;
|
|
65
|
-
}
|
|
66
|
-
interface AuditOptions {
|
|
67
|
-
/** Per-rule severity, or `off`. Keys are full ids (`audit/text-contrast`) or the bare name (`text-contrast`). */
|
|
68
|
-
rules?: Record<string, AuditSeverity | 'off'>;
|
|
69
|
-
/** Rules not to run (full ids or bare names). */
|
|
70
|
-
ignore?: readonly string[];
|
|
71
|
-
/** When set, run only these rules (full ids or bare names). */
|
|
72
|
-
only?: readonly string[];
|
|
73
|
-
/**
|
|
74
|
-
* Suppress a rule below a JSON Pointer prefix, for one accepted exception, for example
|
|
75
|
-
* `{rule: 'audit/text-contrast', path: '/slides/3'}`. A prefix matches whole path segments.
|
|
76
|
-
*/
|
|
77
|
-
ignorePaths?: readonly {
|
|
78
|
-
rule: string;
|
|
79
|
-
path: string;
|
|
80
|
-
}[];
|
|
81
|
-
thresholds?: Partial<AuditThresholds>;
|
|
82
|
-
/** Loaded catalog records, consulted after the document's own `catalogs` and before the bundled ones. */
|
|
83
|
-
catalogs?: Partial<Record<CatalogKind, readonly unknown[]>>;
|
|
84
|
-
/**
|
|
85
|
-
* The host's measured fonts. Without it composition uses core's portable estimate; see docs/audit.md.
|
|
86
|
-
* A function receives the zero-based slide index, so a host can supply a script-aware measurement per slide.
|
|
87
|
-
*/
|
|
88
|
-
textMeasurement?: TextMeasurement | ((slideIndex: number) => TextMeasurement | undefined);
|
|
89
|
-
/** Chart series palette (opaque `#RRGGBB`), in the engine's order. Default: the palette opf-render and opf-pptx use. */
|
|
90
|
-
chartPalette?: readonly string[];
|
|
91
|
-
}
|
|
92
|
-
interface AuditRuleInfo {
|
|
93
|
-
/** Stable `audit/<name>` id. */
|
|
94
|
-
id: string;
|
|
95
|
-
name: string;
|
|
96
|
-
category: AuditCategory;
|
|
97
|
-
/** Default severity. */
|
|
98
|
-
severity: AuditSeverity;
|
|
99
|
-
summary: string;
|
|
100
|
-
/** Why the rule exists. */
|
|
101
|
-
rationale: string;
|
|
102
|
-
/** The accessibility or design standard it follows, when there is one. */
|
|
103
|
-
standard?: string;
|
|
104
|
-
/** What the check cannot see or approximates. */
|
|
105
|
-
approximations?: string;
|
|
106
|
-
/** Threshold names (`AuditThresholds`) the rule reads. */
|
|
107
|
-
thresholds?: (keyof AuditThresholds)[];
|
|
108
|
-
}
|
|
109
|
-
interface AuditReport {
|
|
110
|
-
/** True when no finding has severity `error` (the same meaning as lint's `valid`). */
|
|
111
|
-
valid: boolean;
|
|
112
|
-
/** False when the document failed schema validation, so no design rule was run. */
|
|
113
|
-
documentValid: boolean;
|
|
114
|
-
diagnostics: AuditDiagnostic[];
|
|
115
|
-
counts: Record<AuditSeverity, number>;
|
|
116
|
-
/** Rule ids that ran, in registry order. */
|
|
117
|
-
rulesRun: string[];
|
|
118
|
-
slideCount: number;
|
|
119
|
-
thresholds: AuditThresholds;
|
|
120
|
-
checks: {
|
|
121
|
-
/** `estimated` unless the host supplied `textMeasurement`. */
|
|
122
|
-
textMeasurement: 'estimated' | 'provided';
|
|
123
|
-
/** Text contrast is computed against solid, gradient and pattern backgrounds; picture pixels are never read. */
|
|
124
|
-
backgroundPixels: 'not-read';
|
|
125
|
-
/** Image resolution reads only embedded `data:` images; URLs are never fetched. */
|
|
126
|
-
imageBytes: 'embedded-only';
|
|
127
|
-
nativeExport: 'not-checked';
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* The series palette opf-render and opf-pptx draw charts with (`CHART_COLORS`), in series order. A host with
|
|
133
|
-
* its own palette passes `AuditOptions.chartPalette`.
|
|
134
|
-
*/
|
|
135
|
-
declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Design and accessibility audit of a presentation: contrast, overflow, minimum type size, alt text,
|
|
139
|
-
* reading order, titles, fonts, links, charts, placeholders and more. Read-only and deterministic; no
|
|
140
|
-
* network, clock or model. Each rule has a stable `audit/<name>` id (see docs/audit.md).
|
|
141
|
-
*/
|
|
142
|
-
declare const DEFAULT_AUDIT_THRESHOLDS: Readonly<AuditThresholds>;
|
|
143
|
-
/** Every rule the audit can report, with its default severity, rationale and approximations, in report order. */
|
|
144
|
-
declare const auditRules: readonly AuditRuleInfo[];
|
|
145
|
-
/** The rule a full id (`audit/text-contrast`) or bare name (`text-contrast`) names, or undefined. */
|
|
146
|
-
declare function findAuditRule(name: string): AuditRuleInfo | undefined;
|
|
147
|
-
/**
|
|
148
|
-
* Audit a parsed presentation. A document that fails schema validation is not audited; its validation
|
|
149
|
-
* errors come back as `audit/invalid-document` findings. Findings have lint's report shape (rule id,
|
|
150
|
-
* severity, JSON Pointer path, message, help) plus `slide`, `measured` and suggested `fixes`.
|
|
151
|
-
*/
|
|
152
|
-
declare function auditPresentation(document: unknown, options?: AuditOptions): AuditReport;
|
|
153
|
-
/** Audit JSON source text. Findings carry original-source UTF-16 ranges and one-based line/column, like `lintSource`. */
|
|
154
|
-
declare function auditSource(source: string, options?: AuditOptions): AuditReport;
|
|
155
|
-
|
|
156
|
-
export { type AuditCategory, type AuditDiagnostic, type AuditFix, type AuditOptions, type AuditPatchOperation, type AuditReport, type AuditRuleInfo, type AuditSeverity, type AuditThresholds, DEFAULT_AUDIT_THRESHOLDS, DEFAULT_CHART_PALETTE, auditPresentation, auditRules, auditSource, findAuditRule };
|
package/dist/audit.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { DEFAULT_AUDIT_THRESHOLDS, DEFAULT_CHART_PALETTE, auditPresentation, auditRules, auditSource, findAuditRule } from './chunk-6LZK2IZB.js';
|
|
2
|
-
import './chunk-MWPMJE6P.js';
|
|
3
|
-
import './chunk-JKVKYVWL.js';
|
|
4
|
-
import './chunk-HOBSL7AJ.js';
|
|
5
|
-
import './chunk-S5W34SIJ.js';
|
|
6
|
-
import './chunk-E34DJ5LL.js';
|
|
7
|
-
import './chunk-4LAM3N6S.js';
|