@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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/** A scalar data cell (chart data, dataset rows). */
|
|
2
|
+
type DataCellValue = string | number | boolean | null;
|
|
3
|
+
/** A named column with an optional number format. The string column form is `{ name }` with no format. */
|
|
4
|
+
interface DataColumn {
|
|
5
|
+
name: string;
|
|
6
|
+
format?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Provenance of inline data or a dataset. Engines never read, fetch or refresh it. */
|
|
9
|
+
interface DataSourceRef {
|
|
10
|
+
src: string;
|
|
11
|
+
sheet?: string;
|
|
12
|
+
range?: string;
|
|
13
|
+
fields?: string[];
|
|
14
|
+
retrieved?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
/** One shared data table in the top-level `datasets` map. */
|
|
18
|
+
interface Dataset {
|
|
19
|
+
title?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
columns: (string | DataColumn)[];
|
|
22
|
+
rows: DataCellValue[][];
|
|
23
|
+
source?: DataSourceRef;
|
|
24
|
+
}
|
|
25
|
+
/** Chart data (or, as `{ dataset, fields }`, a table) taken from a top-level dataset. */
|
|
26
|
+
interface DatasetRef {
|
|
27
|
+
dataset: string;
|
|
28
|
+
fields?: string[];
|
|
29
|
+
}
|
|
30
|
+
/** `chart.mapping`: the category, X and series columns by name (after any `fields` selection). */
|
|
31
|
+
interface ChartMapping {
|
|
32
|
+
category?: string;
|
|
33
|
+
x?: string;
|
|
34
|
+
series?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** One series of a combo chart: drawn as a clustered column or as a line with markers, against the primary (left) or secondary (right) value axis. */
|
|
37
|
+
interface ChartComboSeries {
|
|
38
|
+
role: 'bar' | 'line';
|
|
39
|
+
axis: 'primary' | 'secondary';
|
|
40
|
+
}
|
|
41
|
+
/** A text run as table cells and headers hold them (see the schema `TextRun`). */
|
|
42
|
+
type DataTextRun = string | {
|
|
43
|
+
text: string;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
/** A table cell's value: a scalar or rich runs. */
|
|
47
|
+
type DataTableValue = string | number | boolean | null | DataTextRun[];
|
|
48
|
+
/** A styled or spanning table cell, optionally with a number format. */
|
|
49
|
+
interface DataStyledCell {
|
|
50
|
+
value: DataTableValue;
|
|
51
|
+
style?: Record<string, unknown>;
|
|
52
|
+
colSpan?: number;
|
|
53
|
+
rowSpan?: number;
|
|
54
|
+
format?: string;
|
|
55
|
+
}
|
|
56
|
+
/** A table body cell. */
|
|
57
|
+
type DataTableCell = DataTableValue | DataStyledCell;
|
|
58
|
+
/** A table column header: a cell, or a DataColumn. */
|
|
59
|
+
type DataTableHeader = DataTableCell | DataColumn;
|
|
60
|
+
type DataDiagnosticCode = 'chart-value-not-numeric' | 'dataset-unknown' | 'dataset-field-unknown' | 'data-column-duplicate' | 'chart-mapping-unknown-column' | 'chart-mapping-adapted' | 'chart-highlight-unknown-name' | 'chart-highlight-adapted' | 'number-format-invalid';
|
|
61
|
+
interface DataDiagnostic {
|
|
62
|
+
code: DataDiagnosticCode;
|
|
63
|
+
severity: 'error' | 'warning';
|
|
64
|
+
/** JSON Pointer of the offending value: below the `path` option for the chart or table, or into `/datasets/<id>`. */
|
|
65
|
+
path: string;
|
|
66
|
+
message: string;
|
|
67
|
+
}
|
|
68
|
+
interface DataResolveOptions {
|
|
69
|
+
/** JSON Pointer of the chart or table object, used as the base of diagnostic paths. Default: "" (paths start at `/data` or `/rows`). */
|
|
70
|
+
path?: string;
|
|
71
|
+
}
|
|
72
|
+
type ResolvedChartData = {
|
|
73
|
+
ok: true;
|
|
74
|
+
/** Column names in canonical order: category, then (scatter only) X, then every series. */
|
|
75
|
+
columns: string[];
|
|
76
|
+
/**
|
|
77
|
+
* True when `columns[1]` is the X column: an XY chart with three or more resolved columns. An XY chart with two
|
|
78
|
+
* columns has no X column; its second column is the one series, plotted against row numbers (the legacy rule).
|
|
79
|
+
*/
|
|
80
|
+
hasX: boolean;
|
|
81
|
+
/** The number format of each column (from its DataColumn), aligned with `columns`. */
|
|
82
|
+
formats: (string | undefined)[];
|
|
83
|
+
/** Category cells as authored; X and series cells (and a lone column, which has no category) passed through `chartNumber` (null is a gap). */
|
|
84
|
+
rows: DataCellValue[][];
|
|
85
|
+
source?: DataSourceRef;
|
|
86
|
+
/** The dataset id when the chart references one. */
|
|
87
|
+
dataset?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Combo charts only (FA-15): how each series is drawn, aligned with the series columns (`columns.slice(1)`). The series
|
|
90
|
+
* are ordered column series first, then the line series on the primary axis, then those on the secondary axis, each in
|
|
91
|
+
* plotted order, so every engine draws, exports and lists them in the legend alike.
|
|
92
|
+
*/
|
|
93
|
+
combo?: ChartComboSeries[];
|
|
94
|
+
diagnostics: DataDiagnostic[];
|
|
95
|
+
} | {
|
|
96
|
+
ok: false;
|
|
97
|
+
reason: 'dataset-unknown' | 'no-rows' | 'no-columns';
|
|
98
|
+
message: string;
|
|
99
|
+
diagnostics: DataDiagnostic[];
|
|
100
|
+
};
|
|
101
|
+
interface ResolvedTableData {
|
|
102
|
+
/** Headers as authored (dataset tables: the dataset's columns after `fields`), or undefined for a table without headers. */
|
|
103
|
+
columns?: DataTableHeader[];
|
|
104
|
+
rows: DataTableCell[][];
|
|
105
|
+
/** The column number formats (DataColumn or header StyledTableCell `format`), by column index. */
|
|
106
|
+
formats: (string | undefined)[];
|
|
107
|
+
/** The dataset id when the table references one. */
|
|
108
|
+
dataset?: string;
|
|
109
|
+
diagnostics: DataDiagnostic[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Strict chart number: finite numbers, and strings in strict decimal syntax (trimmed). Everything else is null (a gap):
|
|
113
|
+
* `"12%"`, `"$5"`, `"(5)"`, `"1,234"`, `"1.234,5"`, `"Q1"`, `""`, booleans and null. A plain digit string beyond the safe
|
|
114
|
+
* integer range is a gap too, as in data import (it is usually an identifier that would lose digits); a decimal or exponent
|
|
115
|
+
* form such as `"1e20"` is a number.
|
|
116
|
+
*/
|
|
117
|
+
declare function chartNumber(value: unknown): number | null;
|
|
118
|
+
/** Why a NumberFormat is invalid, or undefined for a valid one. An absent format is valid (General). */
|
|
119
|
+
declare function numberFormatError(format: unknown): string | undefined;
|
|
120
|
+
/** Format a number with a NumberFormat; an absent or invalid format prints the General form (String(value)). */
|
|
121
|
+
declare function formatDataNumber(value: number, format?: string): string;
|
|
122
|
+
/** NumberFormat -> Excel format code ("General" when absent or invalid). Literal prefix/suffix text is quoted or escaped; placeholders are written '#' before '0' ("0#" -> "#0"). */
|
|
123
|
+
declare function toExcelNumberFormat(format?: string): string;
|
|
124
|
+
/** Excel format code -> NumberFormat, or undefined when the code has no exact NumberFormat equivalent (General, sections, scaling commas, and placeholder orders Excel reads by position such as "0#" or "0.#0"). */
|
|
125
|
+
declare function fromExcelNumberFormat(code: string): string | undefined;
|
|
126
|
+
/** True when the value is a dataset reference (`{ dataset: "<id>" }`). */
|
|
127
|
+
declare function isDatasetRef(value: unknown): value is DatasetRef;
|
|
128
|
+
/** Diagnostics of the top-level datasets themselves: duplicate column names and invalid column formats. */
|
|
129
|
+
declare function datasetDiagnostics(document: unknown): DataDiagnostic[];
|
|
130
|
+
/**
|
|
131
|
+
* Pure: a copy of the document where every chart and table DatasetRef is replaced by inline data (columns as
|
|
132
|
+
* DataColumn when a format applies, rows copied; a chart also takes the dataset's `source`). `datasets` stays in
|
|
133
|
+
* place. Unknown ids (and references naming an unknown field) are left as they are.
|
|
134
|
+
*/
|
|
135
|
+
declare function inlineDatasets<T>(document: T): T;
|
|
136
|
+
/** A table in inline form: a dataset-backed table is copied from the document's dataset; anything else is returned as is. */
|
|
137
|
+
declare function inlineTableData<T>(table: T, document?: unknown): T;
|
|
138
|
+
/** A chart in inline form: a dataset reference in `data` is copied from the document's dataset; anything else is returned as is. */
|
|
139
|
+
declare function inlineChartData<T>(chart: T, document?: unknown): T;
|
|
140
|
+
/** The ids of top-level datasets that no chart or table references, in declaration order. */
|
|
141
|
+
declare function unusedDatasets(document: unknown): string[];
|
|
142
|
+
/** True for a chart type with an X value axis (scatter; deprecated ids resolve through their replacement first). */
|
|
143
|
+
declare function isXYChartType(type: unknown): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Resolve a chart's data to the canonical positional table: [category, (x,) ...series].
|
|
146
|
+
* Category cells are kept as authored; X and series cells pass through chartNumber.
|
|
147
|
+
* Inline ChartData, a DatasetRef (needs the document) and mapping are resolved here.
|
|
148
|
+
*/
|
|
149
|
+
declare function resolveChartData(chart: unknown, document?: unknown, options?: DataResolveOptions): ResolvedChartData;
|
|
150
|
+
/** One JSON Patch `replace` operation of a ChartNumberFix. */
|
|
151
|
+
interface ChartNumberFixOperation {
|
|
152
|
+
op: 'replace';
|
|
153
|
+
path: string;
|
|
154
|
+
value: unknown;
|
|
155
|
+
}
|
|
156
|
+
/** A fix for a chart value column whose text cells all share one display style (`"12%"`, `"$1,234"`, `"1,234.5"`). */
|
|
157
|
+
interface ChartNumberFix {
|
|
158
|
+
/**
|
|
159
|
+
* JSON Patch: one `replace` per text cell (with its number), then one for the column (a DataColumn with `format`).
|
|
160
|
+
* Paths are those of the `chart-value-not-numeric` diagnostics: below `options.path` for inline data, or into
|
|
161
|
+
* `/datasets/<id>` for a dataset (which every chart and table that uses it shares; their text is unchanged).
|
|
162
|
+
*/
|
|
163
|
+
patches: ChartNumberFixOperation[];
|
|
164
|
+
/** Index of the column in the authored columns (`chart.data.columns`, or the dataset's columns). */
|
|
165
|
+
column: number;
|
|
166
|
+
/** The column name. */
|
|
167
|
+
name: string;
|
|
168
|
+
/** The NumberFormat that displays every number of the column exactly as its text was written. */
|
|
169
|
+
format: string;
|
|
170
|
+
}
|
|
171
|
+
interface ChartNumberFixOptions extends DataResolveOptions {
|
|
172
|
+
/** The column to fix, by authored index or name. Default: the first value column that has a fix. */
|
|
173
|
+
column?: number | string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Migration help for the strict number rule: when every text cell of a chart value column is written in one display
|
|
177
|
+
* style that a NumberFormat reproduces exactly (`"12%"`/`"8.5%"` -> 0.12/0.085 with `0.#%`; `"$1,234"` -> 1234 with
|
|
178
|
+
* `$#,##0`; `"1,234"` -> 1234 with `#,##0`), the patch that stores the numbers and gives the column that format.
|
|
179
|
+
* Undefined when there is nothing to fix or no exact fix: mixed styles, accounting negatives `(5)`, `1.234,5`, units,
|
|
180
|
+
* a column that already has a format, or any value the format would display differently (number cells included).
|
|
181
|
+
*/
|
|
182
|
+
declare function suggestChartNumberFix(chart: unknown, document?: unknown, options?: ChartNumberFixOptions): ChartNumberFix | undefined;
|
|
183
|
+
/** Resolve a table (inline or dataset-backed) to headers, rows and per-column formats. */
|
|
184
|
+
declare function resolveTableData(table: unknown, document?: unknown, options?: DataResolveOptions): ResolvedTableData;
|
|
185
|
+
/** Display value of a table cell: a number with a format (cell, else column) becomes formatted text; anything else is returned unchanged. */
|
|
186
|
+
declare function tableCellDisplayValue(cell: DataTableCell, columnFormat?: string): DataTableCell;
|
|
187
|
+
|
|
188
|
+
export { resolveChartData as A, resolveTableData as B, type ChartMapping as C, type DataCellValue as D, suggestChartNumberFix as E, tableCellDisplayValue as F, toExcelNumberFormat as G, unusedDatasets as H, type ChartComboSeries as I, type ResolvedChartData as R, type ChartNumberFix as a, type ChartNumberFixOperation as b, type ChartNumberFixOptions as c, type DataColumn as d, type DataDiagnostic as e, type DataDiagnosticCode as f, type DataResolveOptions as g, type DataSourceRef as h, type DataStyledCell as i, type DataTableCell as j, type DataTableHeader as k, type DataTableValue as l, type DataTextRun as m, type Dataset as n, type DatasetRef as o, type ResolvedTableData as p, chartNumber as q, datasetDiagnostics as r, formatDataNumber as s, fromExcelNumberFormat as t, inlineChartData as u, inlineDatasets as v, inlineTableData as w, isDatasetRef as x, isXYChartType as y, numberFormatError as z };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { isRecord, same } from './chunk-CSQHPVGL.js';
|
|
2
|
+
import { parseDocument, YAMLMap, Scalar, stringify } from 'yaml';
|
|
3
|
+
|
|
4
|
+
function splitLines(source) {
|
|
5
|
+
const lines = [];
|
|
6
|
+
let start = 0;
|
|
7
|
+
let no = 1;
|
|
8
|
+
let i = 0;
|
|
9
|
+
while (i < source.length) {
|
|
10
|
+
const c = source[i];
|
|
11
|
+
if (c === "\n" || c === "\r") {
|
|
12
|
+
lines.push({ text: source.slice(start, i), start, end: i, no: no++ });
|
|
13
|
+
if (c === "\r" && source[i + 1] === "\n") i++;
|
|
14
|
+
i++;
|
|
15
|
+
start = i;
|
|
16
|
+
} else i++;
|
|
17
|
+
}
|
|
18
|
+
if (start < source.length) lines.push({ text: source.slice(start), start, end: source.length, no });
|
|
19
|
+
return lines;
|
|
20
|
+
}
|
|
21
|
+
var Ctx = class {
|
|
22
|
+
constructor(source) {
|
|
23
|
+
this.source = source;
|
|
24
|
+
for (let i = 0; i < source.length; i++) {
|
|
25
|
+
if (source[i] === "\r") {
|
|
26
|
+
if (source[i + 1] === "\n") i++;
|
|
27
|
+
this.lineStarts.push(i + 1);
|
|
28
|
+
} else if (source[i] === "\n") this.lineStarts.push(i + 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
source;
|
|
32
|
+
findings = [];
|
|
33
|
+
/** JSON Pointer in the converted document to the source range that produced it. */
|
|
34
|
+
ranges = /* @__PURE__ */ new Map();
|
|
35
|
+
lineStarts = [0];
|
|
36
|
+
location(range) {
|
|
37
|
+
let lo = 0;
|
|
38
|
+
let hi = this.lineStarts.length;
|
|
39
|
+
while (lo + 1 < hi) {
|
|
40
|
+
const mid = lo + hi >> 1;
|
|
41
|
+
if ((this.lineStarts[mid] ?? 0) <= range.start) lo = mid;
|
|
42
|
+
else hi = mid;
|
|
43
|
+
}
|
|
44
|
+
return { offset: range.start, length: Math.max(0, range.end - range.start), line: lo + 1, column: range.start - (this.lineStarts[lo] ?? 0) + 1 };
|
|
45
|
+
}
|
|
46
|
+
report(ruleId, severity, message, help, range, path = "") {
|
|
47
|
+
this.findings.push({ ruleId, severity, category: "format", scope: "document", path, message, help, location: this.location(range) });
|
|
48
|
+
}
|
|
49
|
+
error(rule, message, help, range, path = "") {
|
|
50
|
+
this.report(`markdown/${rule}`, "error", message, help, range, path);
|
|
51
|
+
}
|
|
52
|
+
warn(rule, message, help, range, path = "") {
|
|
53
|
+
this.report(`markdown/${rule}`, "warning", message, help, range, path);
|
|
54
|
+
}
|
|
55
|
+
get errors() {
|
|
56
|
+
return this.findings.filter((d) => d.severity === "error").length;
|
|
57
|
+
}
|
|
58
|
+
/** The source range of a JSON Pointer, falling back to the nearest ancestor that has one. */
|
|
59
|
+
rangeOf(pointer) {
|
|
60
|
+
for (let path = pointer; ; path = path.slice(0, path.lastIndexOf("/"))) {
|
|
61
|
+
const found = this.ranges.get(path);
|
|
62
|
+
if (found) return found;
|
|
63
|
+
if (!path) return void 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var lineRange = (first, last = first) => ({ start: first.start, end: last.end });
|
|
68
|
+
function readYamlMapping(text, base, ctx, rule, context) {
|
|
69
|
+
const keys = /* @__PURE__ */ new Map();
|
|
70
|
+
const doc = parseDocument(text, { schema: "core", uniqueKeys: true, merge: false, prettyErrors: false });
|
|
71
|
+
let ok = true;
|
|
72
|
+
for (const error of doc.errors) {
|
|
73
|
+
ok = false;
|
|
74
|
+
const [start, end] = error.pos;
|
|
75
|
+
ctx.error(rule, `YAML: ${error.message.split("\n")[0]}`, "Fix the YAML syntax. Front matter and embedded blocks hold JSON-compatible YAML: mappings, sequences and scalars, no anchors or tags.", { start: base + start, end: base + Math.max(end, start) });
|
|
76
|
+
}
|
|
77
|
+
if (!ok) return { value: {}, keys, ok };
|
|
78
|
+
if (doc.contents === null) return { value: {}, keys, ok };
|
|
79
|
+
if (!(doc.contents instanceof YAMLMap)) {
|
|
80
|
+
ctx.error(`${rule}-not-mapping`, "Expected a YAML mapping of keys and values.", "Write `key: value` lines; a list or a bare value is not accepted here.", context);
|
|
81
|
+
return { value: {}, keys, ok: false };
|
|
82
|
+
}
|
|
83
|
+
for (const pair of doc.contents.items) {
|
|
84
|
+
const key = pair.key;
|
|
85
|
+
const name = key instanceof Scalar ? String(key.value) : void 0;
|
|
86
|
+
if (name !== void 0 && key?.range) keys.set(name, { start: base + key.range[0], end: base + (pair.value?.range?.[1] ?? key.range[1]) });
|
|
87
|
+
}
|
|
88
|
+
let value;
|
|
89
|
+
try {
|
|
90
|
+
value = doc.toJS({ maxAliasCount: 0 });
|
|
91
|
+
} catch (error) {
|
|
92
|
+
ctx.error(rule, `YAML: ${error.message}`, "Anchors and aliases are not accepted; write each value out.", context);
|
|
93
|
+
return { value: {}, keys, ok: false };
|
|
94
|
+
}
|
|
95
|
+
const bad = nonJson(value);
|
|
96
|
+
if (bad) {
|
|
97
|
+
ctx.error(rule, `YAML value is not JSON-compatible (${bad}).`, "Quote special numbers such as .inf or .nan to keep them as strings.", context);
|
|
98
|
+
return { value: {}, keys, ok: false };
|
|
99
|
+
}
|
|
100
|
+
return { value, keys, ok };
|
|
101
|
+
}
|
|
102
|
+
function nonJson(value) {
|
|
103
|
+
if (typeof value === "number") return Number.isFinite(value) ? void 0 : "a number that is not finite";
|
|
104
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return void 0;
|
|
105
|
+
if (Array.isArray(value)) return value.map(nonJson).find(Boolean);
|
|
106
|
+
if (isRecord(value)) return Object.values(value).map(nonJson).find(Boolean);
|
|
107
|
+
return `a ${typeof value}`;
|
|
108
|
+
}
|
|
109
|
+
function writeYaml(value) {
|
|
110
|
+
for (const blockQuote of [true, false]) {
|
|
111
|
+
const text = stringify(value, { indent: 2, lineWidth: 0, minContentWidth: 0, blockQuote, defaultStringType: "PLAIN", defaultKeyType: "PLAIN" });
|
|
112
|
+
const doc = parseDocument(text, { schema: "core", uniqueKeys: true, merge: false });
|
|
113
|
+
if (!doc.errors.length && same(doc.toJS({ maxAliasCount: 0 }), value)) return text.endsWith("\n") ? text : `${text}
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
return void 0;
|
|
117
|
+
}
|
|
118
|
+
var DECIMAL = /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
119
|
+
function scalarText(value) {
|
|
120
|
+
if (typeof value === "number") return DECIMAL.test(String(value)) ? String(value) : JSON.stringify(String(value));
|
|
121
|
+
const plain = value !== "" && value === value.trim() && !value.startsWith('"') && !/[\r\n]/.test(value) && !DECIMAL.test(value);
|
|
122
|
+
return plain ? value : JSON.stringify(value);
|
|
123
|
+
}
|
|
124
|
+
function readCsv(text) {
|
|
125
|
+
const rows = [];
|
|
126
|
+
let row = [];
|
|
127
|
+
let i = 0;
|
|
128
|
+
const n = text.length;
|
|
129
|
+
const endRecord = () => {
|
|
130
|
+
rows.push(row);
|
|
131
|
+
row = [];
|
|
132
|
+
};
|
|
133
|
+
while (i < n) {
|
|
134
|
+
while (text[i] === " " || text[i] === " ") i++;
|
|
135
|
+
if (text[i] === '"') {
|
|
136
|
+
let value = "";
|
|
137
|
+
i++;
|
|
138
|
+
for (; ; ) {
|
|
139
|
+
if (i >= n) return { rows, error: "A quoted field is not closed." };
|
|
140
|
+
if (text[i] === '"') {
|
|
141
|
+
if (text[i + 1] === '"') {
|
|
142
|
+
value += '"';
|
|
143
|
+
i += 2;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
i++;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
value += text[i++];
|
|
150
|
+
}
|
|
151
|
+
while (text[i] === " " || text[i] === " ") i++;
|
|
152
|
+
if (i < n && text[i] !== "," && text[i] !== "\n" && text[i] !== "\r") return { rows, error: "Text follows a closing quote." };
|
|
153
|
+
row.push({ value, quoted: true });
|
|
154
|
+
} else {
|
|
155
|
+
let j = i;
|
|
156
|
+
while (j < n && text[j] !== "," && text[j] !== "\n" && text[j] !== "\r") j++;
|
|
157
|
+
row.push({ value: text.slice(i, j).trim(), quoted: false });
|
|
158
|
+
i = j;
|
|
159
|
+
}
|
|
160
|
+
if (text[i] === ",") {
|
|
161
|
+
i++;
|
|
162
|
+
if (i >= n || text[i] === "\n" || text[i] === "\r") row.push({ value: "", quoted: false });
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (text[i] === "\r" && text[i + 1] === "\n") i++;
|
|
166
|
+
i++;
|
|
167
|
+
endRecord();
|
|
168
|
+
}
|
|
169
|
+
if (row.length) endRecord();
|
|
170
|
+
return { rows };
|
|
171
|
+
}
|
|
172
|
+
var needsQuotes = (value) => /[",\r\n]/.test(value) || value !== value.trim() || value === "";
|
|
173
|
+
function csvField(cell, header = false) {
|
|
174
|
+
if (cell === null) return "";
|
|
175
|
+
if (typeof cell === "number") return String(cell);
|
|
176
|
+
if (typeof cell === "boolean") return String(cell);
|
|
177
|
+
const text = String(cell);
|
|
178
|
+
const ambiguous = !header && (DECIMAL.test(text) || /^(?:true|false)$/.test(text));
|
|
179
|
+
return needsQuotes(text) || ambiguous ? `"${text.replaceAll('"', '""')}"` : text;
|
|
180
|
+
}
|
|
181
|
+
var OPFMarkdownError = class extends Error {
|
|
182
|
+
code;
|
|
183
|
+
details;
|
|
184
|
+
constructor(code, message, details = {}) {
|
|
185
|
+
super(message);
|
|
186
|
+
this.name = "OPFMarkdownError";
|
|
187
|
+
this.code = code;
|
|
188
|
+
this.details = details;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export { Ctx, DECIMAL, OPFMarkdownError, csvField, lineRange, readCsv, readYamlMapping, scalarText, splitLines, writeYaml };
|
|
@@ -1,92 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// src/convert/shared.ts
|
|
4
|
-
var CONTENT_KEYS = ["text", "items", "bullets", "image", "video", "chart", "table", "code", "metric", "quote", "timeline"];
|
|
5
|
-
var SLIDE_ONLY_KEYS = ["title", "subtitle", "tag", "layout", "design", "notes", "section", "hidden", "beat"];
|
|
6
|
-
var OPFConversionError = class extends Error {
|
|
7
|
-
code;
|
|
8
|
-
details;
|
|
9
|
-
constructor(code, message, details = {}) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "OPFConversionError";
|
|
12
|
-
this.code = code;
|
|
13
|
-
this.details = details;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var refuse = (message, details = {}) => new OPFConversionError("not-convertible", message, details);
|
|
17
|
-
var Loss = class {
|
|
18
|
-
list = [];
|
|
19
|
-
note(message) {
|
|
20
|
-
if (!this.list.includes(message)) this.list.push(message);
|
|
21
|
-
}
|
|
22
|
-
merge(other) {
|
|
23
|
-
for (const message of other) this.note(message);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var report = (loss) => ({ lossless: loss.length === 0, loss: [...loss] });
|
|
27
|
-
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
28
|
-
var clone = (value) => structuredClone(value);
|
|
29
|
-
var own = (value, key) => Object.hasOwn(value, key);
|
|
30
|
-
var same = (a, b) => JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
|
|
31
|
-
function canonical(value) {
|
|
32
|
-
if (Array.isArray(value)) return value.map(canonical);
|
|
33
|
-
if (isRecord(value)) return Object.fromEntries(Object.keys(value).sort().map((key) => [key, canonical(value[key])]));
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
var isSlideLike = (payload) => SLIDE_ONLY_KEYS.some((key) => own(payload, key));
|
|
37
|
-
var contentKeysOf = (payload) => CONTENT_KEYS.filter((key) => payload[key] !== void 0);
|
|
38
|
-
function assertValidOutput(value, as = "block") {
|
|
39
|
-
const slides = as === "slides" ? value : as === "slide" ? [value] : [{ blocks: [value] }];
|
|
40
|
-
const result = validatePresentation({ slides });
|
|
41
|
-
if (!result.valid) {
|
|
42
|
-
const first = result.errors[0];
|
|
43
|
-
throw new OPFConversionError("invalid-output", `The converted content is not valid OPF: ${first?.message ?? "unknown error"}${first?.path ? ` (${first.path})` : ""}.`, { issues: result.errors });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
var assertValidOwner = (owner) => assertValidOutput(owner, isSlideLike(owner) ? "slide" : "block");
|
|
47
|
-
var FORMATTING = ["bold", "italic", "underline", "strikethrough", "color", "fontSize", "fontFamily", "link", "superscript", "subscript"];
|
|
48
|
-
var isPlainRun = (run) => typeof run === "string" || isRecord(run) && !FORMATTING.some((key) => run[key] !== void 0);
|
|
49
|
-
var runText = (run) => typeof run === "string" ? run : run.text ?? "";
|
|
50
|
-
var runsOf = (value) => typeof value === "string" ? [value] : Array.isArray(value) ? value : [];
|
|
51
|
-
var plainOf = (value) => runsOf(value).map(runText).join("");
|
|
52
|
-
var hasFormatting = (value) => runsOf(value).some((run) => !isPlainRun(run));
|
|
53
|
-
var NEWLINE = /\r\n|\r|\n/;
|
|
54
|
-
function splitRuns(runs) {
|
|
55
|
-
const lines = [[]];
|
|
56
|
-
for (const run of runs) {
|
|
57
|
-
const parts = runText(run).split(NEWLINE);
|
|
58
|
-
parts.forEach((part, index) => {
|
|
59
|
-
if (index > 0) lines.push([]);
|
|
60
|
-
if (part === "") return;
|
|
61
|
-
lines[lines.length - 1].push(typeof run === "string" ? part : { ...run, text: part });
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return lines;
|
|
65
|
-
}
|
|
66
|
-
function mergeRuns(runs) {
|
|
67
|
-
const merged = [];
|
|
68
|
-
for (const run of runs) {
|
|
69
|
-
if (typeof run === "string" && typeof merged.at(-1) === "string") merged[merged.length - 1] += run;
|
|
70
|
-
else merged.push(run);
|
|
71
|
-
}
|
|
72
|
-
return merged;
|
|
73
|
-
}
|
|
74
|
-
var linePlain = (line) => line.map(runText).join("");
|
|
75
|
-
var lineIsPlain = (line) => line.every(isPlainRun);
|
|
76
|
-
var lineValue = (line) => lineIsPlain(line) ? linePlain(line) : mergeRuns(line);
|
|
77
|
-
function joinLines(lines) {
|
|
78
|
-
if (lines.every(lineIsPlain)) return lines.map(linePlain).join("\n");
|
|
79
|
-
const runs = [];
|
|
80
|
-
lines.forEach((line, index) => {
|
|
81
|
-
if (index > 0) runs.push("\n");
|
|
82
|
-
runs.push(...line);
|
|
83
|
-
});
|
|
84
|
-
return mergeRuns(runs);
|
|
85
|
-
}
|
|
86
|
-
function concatText(a, b) {
|
|
87
|
-
if (typeof a === "string" && typeof b === "string") return a + b;
|
|
88
|
-
return mergeRuns([...runsOf(a), ...runsOf(b)]);
|
|
89
|
-
}
|
|
1
|
+
import { runText } from './chunk-CSQHPVGL.js';
|
|
90
2
|
|
|
91
3
|
// src/convert/text-lines.ts
|
|
92
4
|
var LIST_PREFIX = /^([ \t]*)(?:([-*•+]|\d{1,3}[.)])[ \t]+)?/;
|
|
@@ -195,4 +107,4 @@ function fenceCode(source, language, filename) {
|
|
|
195
107
|
return [`${fence}${info}`, ...source.split(/\r\n|\r|\n/), fence];
|
|
196
108
|
}
|
|
197
109
|
|
|
198
|
-
export {
|
|
110
|
+
export { fenceCode, levelsFromIndents, parseCodeFence, parseListLine, parseQuoteLines, splitWhen };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { presentation } from './chunk-LS2FMPI5.js';
|
|
2
|
+
|
|
3
|
+
// src/format.ts
|
|
4
|
+
var OPFFormatError = class extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "OPFFormatError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var root = presentation;
|
|
11
|
+
var flattenCache = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
function collect(schema, seen) {
|
|
13
|
+
if (!schema || typeof schema !== "object" || seen.has(schema)) return [];
|
|
14
|
+
seen.add(schema);
|
|
15
|
+
const node = schema;
|
|
16
|
+
const out = [node];
|
|
17
|
+
if (typeof node.$ref === "string" && node.$ref.startsWith("#/$defs/")) out.push(...collect(root.$defs?.[node.$ref.slice("#/$defs/".length)], seen));
|
|
18
|
+
for (const list of [node.oneOf, node.anyOf, node.allOf]) for (const branch of list ?? []) out.push(...collect(branch, seen));
|
|
19
|
+
out.push(...collect(node.then, seen), ...collect(node.else, seen));
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
function flatten(schema) {
|
|
23
|
+
if (!schema || typeof schema !== "object") return [];
|
|
24
|
+
const cached = flattenCache.get(schema);
|
|
25
|
+
if (cached) return cached;
|
|
26
|
+
const nodes = collect(schema, /* @__PURE__ */ new Set());
|
|
27
|
+
flattenCache.set(schema, nodes);
|
|
28
|
+
return nodes;
|
|
29
|
+
}
|
|
30
|
+
var own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
31
|
+
function arrange(value, schemas) {
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
const itemSchemas = schemas.flatMap((node) => node.items && typeof node.items === "object" ? flatten(node.items) : []);
|
|
34
|
+
return value.map((item) => arrange(item, itemSchemas));
|
|
35
|
+
}
|
|
36
|
+
if (!value || typeof value !== "object") return value;
|
|
37
|
+
const record = value;
|
|
38
|
+
const declared = [];
|
|
39
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const node of schemas) for (const key of Object.keys(node.properties ?? {})) if (!seen.has(key)) {
|
|
41
|
+
seen.add(key);
|
|
42
|
+
declared.push(key);
|
|
43
|
+
}
|
|
44
|
+
const present = Object.keys(record);
|
|
45
|
+
const ordered = [...declared.filter((key) => own(record, key)), ...present.filter((key) => !seen.has(key))];
|
|
46
|
+
const out = {};
|
|
47
|
+
for (const key of ordered) {
|
|
48
|
+
let children = schemas.flatMap((node) => node.properties && own(node.properties, key) ? flatten(node.properties[key]) : []);
|
|
49
|
+
if (!children.length && !seen.has(key)) children = schemas.flatMap((node) => node.additionalProperties && typeof node.additionalProperties === "object" ? flatten(node.additionalProperties) : []);
|
|
50
|
+
Object.defineProperty(out, key, { value: arrange(record[key], children), enumerable: true, configurable: true, writable: true });
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
function sortPresentationKeys(document) {
|
|
55
|
+
return arrange(document, flatten(root));
|
|
56
|
+
}
|
|
57
|
+
function format(input, options = {}) {
|
|
58
|
+
let document = input;
|
|
59
|
+
if (typeof input === "string") {
|
|
60
|
+
try {
|
|
61
|
+
document = JSON.parse(input.replace(/^/u, ""));
|
|
62
|
+
} catch (error) {
|
|
63
|
+
throw new OPFFormatError(`Invalid JSON: ${error.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const indent = options.indent ?? 2;
|
|
67
|
+
if (!Number.isInteger(indent) || indent < 0 || indent > 8) throw new OPFFormatError("indent must be an integer from 0 to 8.");
|
|
68
|
+
if (options.eol !== void 0 && options.eol !== "lf" && options.eol !== "crlf") throw new OPFFormatError("eol must be lf or crlf.");
|
|
69
|
+
const text = JSON.stringify(sortPresentationKeys(document), null, indent);
|
|
70
|
+
if (text === void 0) throw new OPFFormatError("Nothing to format.");
|
|
71
|
+
return options.eol === "crlf" ? `${text.replaceAll("\n", "\r\n")}\r
|
|
72
|
+
` : `${text}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
function isFormatted(source, options = {}) {
|
|
76
|
+
try {
|
|
77
|
+
return format(source, options) === source;
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { OPFFormatError, format, isFormatted, sortPresentationKeys };
|