@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/index.js
CHANGED
|
@@ -1,19 +1,530 @@
|
|
|
1
|
-
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-
|
|
1
|
+
export { specFileEntries, specFileKinds, specFilePaths } from './chunk-D3TY4TT6.js';
|
|
2
2
|
export { getLayoutPreview, hasLayoutPreview, layoutPreviewIndex, layoutPreviewSlugs, layoutPreviews } from './chunk-PIQXLBBJ.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export { OPFDataImportError, importData, parseTabularData } from './chunk-Q2TCMN56.js';
|
|
4
|
+
export { fromMarkdown, toMarkdown } from './chunk-UPQQD7MA.js';
|
|
5
|
+
export { OPFMarkdownError } from './chunk-4LDGKLUC.js';
|
|
6
|
+
export { diff, merge } from './chunk-Z65B2B77.js';
|
|
7
|
+
export { OPFPatchError, OPFPatchValidationError, applyPatch } from './chunk-BFLVSVA7.js';
|
|
8
|
+
export { OPFFormatError, format } from './chunk-5ZU6JAPP.js';
|
|
9
|
+
export { OPFPaginationError, paginate, paginateSlide } from './chunk-XIZUK2XM.js';
|
|
10
|
+
import './chunk-4VJDTF55.js';
|
|
11
|
+
import './chunk-CSQHPVGL.js';
|
|
12
|
+
export { DEFAULT_CHART_PALETTE, DEFAULT_VALIDATION_THRESHOLDS, OPFValidationError, assertValid, assertValidCatalogRecord, findValidationRule, resolveSlideContext, validate, validateCatalogRecord, validationCategories, validationRules } from './chunk-JDJBDYSR.js';
|
|
13
|
+
import { isRecord, DEFAULT_FONT_SCHEME, visitContentPayloads, listVariables, resolveFontSchemeReference, resolveFontFamilies, resolveCanvasDimensions, bareIdPattern } from './chunk-6OXY2CP3.js';
|
|
14
|
+
export { DEFAULT_VARIABLE_DATE_FORMAT, OPFVariableError, VARIABLE_KINDS, chartNumber, coerceVariableValue, datasetDiagnostics, formatDataNumber, formatVariableNumber, fromExcelNumberFormat, hasContentVariables, inlineChartData, inlineDatasets, inlineTableData, isDatasetRef, isTemplate, isXYChartType, listBuiltinVariables, listVariables, normalizeLanguageFamily, numberFormatError, resolveChartData, resolveTableData, resolveVariables, suggestChartNumberFix, tableCellDisplayValue, toExcelNumberFormat, unusedDatasets, variableDeclarations } from './chunk-6OXY2CP3.js';
|
|
11
15
|
import './chunk-S5W34SIJ.js';
|
|
12
|
-
import { catalogEntries } from './chunk-
|
|
13
|
-
export { audiences, catalogEntries, catalogIndexes, catalogKinds, catalogSchemaNames, catalogs, chartTypes, colorSchemes, fontSchemes, languages, layouts, narratives, purposes, socialPlatforms, themes, tones } from './chunk-
|
|
14
|
-
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-
|
|
16
|
+
import { catalogs, catalogEntries } from './chunk-XOZ4KMSR.js';
|
|
17
|
+
export { audiences, catalogEntries, catalogIndexes, catalogKinds, catalogSchemaNames, catalogs, chartTypes, colorSchemes, fontSchemes, languages, layouts, narratives, purposes, socialPlatforms, themes, tones } from './chunk-XOZ4KMSR.js';
|
|
18
|
+
export { audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './chunk-LS2FMPI5.js';
|
|
15
19
|
export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-WXSPETQ6.js';
|
|
16
20
|
|
|
21
|
+
// src/stats.ts
|
|
22
|
+
var DEFAULT_WORDS_PER_MINUTE = 130;
|
|
23
|
+
var KIND_ORDER = ["text", "items", "bullets", "quote", "metric", "code", "timeline", "chart", "table", "image", "video"];
|
|
24
|
+
var FURNITURE_FIELDS = ["logo", "image", "text", "organization", "socials", "section", "slideNumber", "date"];
|
|
25
|
+
var ZONES = ["left", "center", "right"];
|
|
26
|
+
var LOGO_VARIANTS = ["default", "light", "dark", "stacked", "stackedLight", "stackedDark", "icon", "iconLight", "iconDark", "wordmark", "wordmarkLight", "wordmarkDark"];
|
|
27
|
+
var WORD = /[\p{L}\p{N}\p{M}]+(?:['’.,-][\p{L}\p{N}\p{M}]+)*/gu;
|
|
28
|
+
var UNSPACED = /[-က-႟ក--ヿ㐀-䶿一-鿿豈-]/gu;
|
|
29
|
+
var wordCount = (text) => {
|
|
30
|
+
let extra = 0;
|
|
31
|
+
const spaced = text.replace(UNSPACED, () => {
|
|
32
|
+
extra++;
|
|
33
|
+
return " ";
|
|
34
|
+
});
|
|
35
|
+
return (spaced.match(WORD)?.length ?? 0) + extra;
|
|
36
|
+
};
|
|
37
|
+
var sorted = (values) => [...new Set(values)].sort();
|
|
38
|
+
var sortedCounts = (counts) => Object.fromEntries([...counts].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
39
|
+
var bump = (counts, key) => counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
40
|
+
var str = (value) => typeof value === "string" ? value : null;
|
|
41
|
+
var decimals = (value, places) => Math.round(value * 10 ** places) / 10 ** places;
|
|
42
|
+
var reference = (value) => {
|
|
43
|
+
if (typeof value === "string") return { id: value, inline: false };
|
|
44
|
+
if (isRecord(value)) return { id: str(value.id), inline: true };
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
var list = (value) => Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
48
|
+
var assetForm = (src) => /^asset:/i.test(src) ? "reference" : /^data:/i.test(src) ? "embedded" : /^(https?:)?\/\//i.test(src) || /^pkg:/i.test(src) ? "remote" : "file";
|
|
49
|
+
var embeddedBytes = (src) => {
|
|
50
|
+
const comma = src.indexOf(",");
|
|
51
|
+
if (comma < 0) return 0;
|
|
52
|
+
const payload = src.slice(comma + 1);
|
|
53
|
+
if (!/;base64$/i.test(src.slice(0, comma))) return payload.length;
|
|
54
|
+
const padding = payload.endsWith("==") ? 2 : payload.endsWith("=") ? 1 : 0;
|
|
55
|
+
return Math.max(0, Math.floor(payload.length * 3 / 4) - padding);
|
|
56
|
+
};
|
|
57
|
+
var srcOf = (asset) => typeof asset === "string" ? asset : isRecord(asset) && typeof asset.src === "string" ? asset.src : void 0;
|
|
58
|
+
var lookup = (deck, kind, id) => {
|
|
59
|
+
const inline = deck.catalogs?.[kind]?.records;
|
|
60
|
+
const found = (Array.isArray(inline) ? inline : []).find((record) => record?.id === id) ?? catalogs[kind].find((record) => record.id === id);
|
|
61
|
+
return isRecord(found) ? found : void 0;
|
|
62
|
+
};
|
|
63
|
+
var themeRecord = (deck, value) => {
|
|
64
|
+
if (typeof value === "string") return lookup(deck, "themes", value) ?? {};
|
|
65
|
+
if (isRecord(value)) return { ...typeof value.id === "string" ? lookup(deck, "themes", value.id) : void 0, ...value };
|
|
66
|
+
return {};
|
|
67
|
+
};
|
|
68
|
+
function slideSize(deck) {
|
|
69
|
+
const design = isRecord(deck.design) ? deck.design : {};
|
|
70
|
+
const theme2 = themeRecord(deck, design.theme ?? "minimal");
|
|
71
|
+
const source = design.dimensions !== void 0 ? "design" : theme2.dimensions !== void 0 ? "theme" : "default";
|
|
72
|
+
const dimensions = design.dimensions ?? theme2.dimensions;
|
|
73
|
+
let width = 40 / 3, height = 7.5;
|
|
74
|
+
try {
|
|
75
|
+
const resolved = resolveCanvasDimensions(dimensions);
|
|
76
|
+
width = resolved.width / 96;
|
|
77
|
+
height = resolved.height / 96;
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
const preset = typeof dimensions === "string" ? dimensions : isRecord(dimensions) && typeof dimensions.preset === "string" && dimensions.widthInches === void 0 && dimensions.heightInches === void 0 ? dimensions.preset : null;
|
|
81
|
+
return { preset, widthInches: decimals(width, 4), heightInches: decimals(height, 4), aspectRatio: decimals(width / height, 3), source };
|
|
82
|
+
}
|
|
83
|
+
var furniture = (value) => {
|
|
84
|
+
const zones = [], fields = /* @__PURE__ */ new Set();
|
|
85
|
+
if (isRecord(value))
|
|
86
|
+
for (const zone of ZONES) {
|
|
87
|
+
const item = value[zone];
|
|
88
|
+
if (!isRecord(item)) continue;
|
|
89
|
+
const present = FURNITURE_FIELDS.filter((field) => item[field] !== void 0 && item[field] !== false);
|
|
90
|
+
if (present.length) {
|
|
91
|
+
zones.push(zone);
|
|
92
|
+
for (const field of present) fields.add(field);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { configured: isRecord(value), suppressed: value === false, zones, fields: FURNITURE_FIELDS.filter((field) => fields.has(field)) };
|
|
96
|
+
};
|
|
97
|
+
function visitRuns(value, visit) {
|
|
98
|
+
if (typeof value === "string") visit({ text: value });
|
|
99
|
+
else if (typeof value === "number") visit({ text: String(value) });
|
|
100
|
+
else if (Array.isArray(value)) for (const entry of value) visitRuns(entry, visit);
|
|
101
|
+
else if (isRecord(value)) {
|
|
102
|
+
if (typeof value.text === "string") {
|
|
103
|
+
visit(value);
|
|
104
|
+
if (value.description !== void 0) visitRuns(value.description, visit);
|
|
105
|
+
} else if (Array.isArray(value.text)) {
|
|
106
|
+
visitRuns(value.text, visit);
|
|
107
|
+
if (value.description !== void 0) visitRuns(value.description, visit);
|
|
108
|
+
} else if (value.value !== void 0) visitRuns(value.value, visit);
|
|
109
|
+
else if (typeof value.name === "string") visit({ text: value.name });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function stats(presentation2, options = {}) {
|
|
113
|
+
if (!isRecord(presentation2)) throw new TypeError("stats needs a presentation object.");
|
|
114
|
+
const deck = presentation2;
|
|
115
|
+
const wordsPerMinute = options.wordsPerMinute ?? DEFAULT_WORDS_PER_MINUTE;
|
|
116
|
+
if (!Number.isFinite(wordsPerMinute) || wordsPerMinute <= 0) throw new RangeError("wordsPerMinute must be a positive number.");
|
|
117
|
+
const slides = Array.isArray(deck.slides) ? deck.slides.filter(isRecord) : [];
|
|
118
|
+
const design = isRecord(deck.design) ? deck.design : {};
|
|
119
|
+
const registry = isRecord(deck.assets) ? deck.assets : {};
|
|
120
|
+
const uses = { total: 0, references: 0, embedded: 0, files: 0, remote: 0 };
|
|
121
|
+
let embeddedTotal = 0;
|
|
122
|
+
const useAsset = (asset) => {
|
|
123
|
+
const src = srcOf(asset);
|
|
124
|
+
if (src === void 0) return;
|
|
125
|
+
const form = assetForm(src);
|
|
126
|
+
uses.total++;
|
|
127
|
+
uses[form === "reference" ? "references" : form === "embedded" ? "embedded" : form === "remote" ? "remote" : "files"]++;
|
|
128
|
+
if (form === "embedded") embeddedTotal += embeddedBytes(src);
|
|
129
|
+
};
|
|
130
|
+
const registryFacts = { entries: 0, embedded: 0, files: 0, remote: 0 };
|
|
131
|
+
for (const entry of Object.values(registry)) {
|
|
132
|
+
const src = srcOf(entry);
|
|
133
|
+
if (src === void 0) continue;
|
|
134
|
+
registryFacts.entries++;
|
|
135
|
+
const form = assetForm(src);
|
|
136
|
+
if (form === "embedded") {
|
|
137
|
+
registryFacts.embedded++;
|
|
138
|
+
embeddedTotal += embeddedBytes(src);
|
|
139
|
+
} else if (form === "remote") registryFacts.remote++;
|
|
140
|
+
else if (form === "file") registryFacts.files++;
|
|
141
|
+
}
|
|
142
|
+
const altOf = (asset) => {
|
|
143
|
+
if (isRecord(asset) && typeof asset.alt === "string") return asset.alt;
|
|
144
|
+
const src = srcOf(asset);
|
|
145
|
+
if (src?.startsWith("asset:")) {
|
|
146
|
+
const entry = registry[src.slice("asset:".length)];
|
|
147
|
+
if (isRecord(entry) && typeof entry.alt === "string") return entry.alt;
|
|
148
|
+
}
|
|
149
|
+
return void 0;
|
|
150
|
+
};
|
|
151
|
+
const images = { content: { total: 0, withAlt: 0, decorative: 0, missingAlt: 0 }, logos: 0, watermarks: { deck: false, slides: 0 }, backgrounds: { deck: false, slides: 0 }, headerFooter: 0, speakerPhotos: 0, videos: 0 };
|
|
152
|
+
const contentImage = (asset) => {
|
|
153
|
+
if (srcOf(asset) === void 0) return 0;
|
|
154
|
+
useAsset(asset);
|
|
155
|
+
images.content.total++;
|
|
156
|
+
const alt = altOf(asset);
|
|
157
|
+
if (alt === void 0 || alt !== "" && alt.trim() === "") images.content.missingAlt++;
|
|
158
|
+
else if (alt === "") images.content.decorative++;
|
|
159
|
+
else images.content.withAlt++;
|
|
160
|
+
return 1;
|
|
161
|
+
};
|
|
162
|
+
const logoImages = (value) => {
|
|
163
|
+
if (srcOf(value) !== void 0) {
|
|
164
|
+
useAsset(value);
|
|
165
|
+
images.logos++;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (isRecord(value)) {
|
|
169
|
+
for (const variant of LOGO_VARIANTS) if (srcOf(value[variant]) !== void 0) {
|
|
170
|
+
useAsset(value[variant]);
|
|
171
|
+
images.logos++;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const watermarkOf = (value) => {
|
|
176
|
+
if (value === void 0 || value === false) return false;
|
|
177
|
+
if (srcOf(value) !== void 0) useAsset(value);
|
|
178
|
+
return srcOf(value) !== void 0;
|
|
179
|
+
};
|
|
180
|
+
const backgroundImage = (value) => {
|
|
181
|
+
if (!isRecord(value) || value.type !== "image" || !isRecord(value.image)) return false;
|
|
182
|
+
useAsset(value.image);
|
|
183
|
+
return true;
|
|
184
|
+
};
|
|
185
|
+
const furnitureImages = (value) => {
|
|
186
|
+
if (!isRecord(value)) return;
|
|
187
|
+
for (const zone of ZONES) {
|
|
188
|
+
const item = value[zone];
|
|
189
|
+
if (isRecord(item) && srcOf(item.image) !== void 0) {
|
|
190
|
+
useAsset(item.image);
|
|
191
|
+
images.headerFooter++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const designAssets = (value, scope) => {
|
|
196
|
+
if (!isRecord(value)) return 0;
|
|
197
|
+
logoImages(value.logo);
|
|
198
|
+
if (watermarkOf(value.watermark)) {
|
|
199
|
+
if (scope === "deck") images.watermarks.deck = true;
|
|
200
|
+
else images.watermarks.slides++;
|
|
201
|
+
}
|
|
202
|
+
if (backgroundImage(value.background)) {
|
|
203
|
+
if (scope === "deck") images.backgrounds.deck = true;
|
|
204
|
+
else images.backgrounds.slides++;
|
|
205
|
+
}
|
|
206
|
+
furnitureImages(value.header);
|
|
207
|
+
furnitureImages(value.footer);
|
|
208
|
+
return contentImage(value.slideImage);
|
|
209
|
+
};
|
|
210
|
+
const organizations = list(deck.organization).filter(isRecord).map((entry) => {
|
|
211
|
+
const hasLogo = srcOf(entry.logo) !== void 0;
|
|
212
|
+
if (hasLogo) {
|
|
213
|
+
useAsset(entry.logo);
|
|
214
|
+
images.logos++;
|
|
215
|
+
}
|
|
216
|
+
return { id: str(entry.id) ?? "", name: str(entry.name) ?? "", role: str(entry.role), hasLogo };
|
|
217
|
+
});
|
|
218
|
+
const speakers = list(deck.speaker).filter(isRecord).map((entry) => {
|
|
219
|
+
const hasPhoto = srcOf(entry.photo) !== void 0;
|
|
220
|
+
if (hasPhoto) {
|
|
221
|
+
useAsset(entry.photo);
|
|
222
|
+
images.speakerPhotos++;
|
|
223
|
+
}
|
|
224
|
+
return { id: str(entry.id) ?? "", name: str(entry.name) ?? "", title: str(entry.title), organizationId: str(entry.organizationId), hasPhoto };
|
|
225
|
+
});
|
|
226
|
+
designAssets(design, "deck");
|
|
227
|
+
for (const variable of Object.values(isRecord(deck.variables) ? deck.variables : {})) if (isRecord(variable) && variable.type === "image") useAsset(variable.value);
|
|
228
|
+
const narrative2 = reference(deck.narrative);
|
|
229
|
+
const deckFacts = {
|
|
230
|
+
name: str(deck.name),
|
|
231
|
+
description: typeof deck.description === "string" && deck.description !== "",
|
|
232
|
+
filename: str(deck.filename),
|
|
233
|
+
author: list(deck.author).filter((entry) => typeof entry === "string"),
|
|
234
|
+
language: reference(deck.language),
|
|
235
|
+
slideSize: slideSize(deck),
|
|
236
|
+
template: deck.template === true,
|
|
237
|
+
tags: Array.isArray(deck.tags) ? deck.tags.filter((tag) => typeof tag === "string") : [],
|
|
238
|
+
takeaways: list(deck.takeaway).filter((entry) => typeof entry === "string").length,
|
|
239
|
+
declaredMinutes: typeof deck.duration === "number" ? deck.duration : null,
|
|
240
|
+
design: { theme: reference(design.theme), colorScheme: reference(design.colorScheme), fontScheme: reference(design.fontScheme) },
|
|
241
|
+
audience: list(deck.audience).flatMap((entry) => reference(entry) ?? []),
|
|
242
|
+
purpose: reference(deck.purpose),
|
|
243
|
+
tone: reference(deck.tone),
|
|
244
|
+
narrative: narrative2 ? { ...narrative2, beats: isRecord(deck.narrative) && Array.isArray(deck.narrative.beats) ? deck.narrative.beats.length : 0 } : null
|
|
245
|
+
};
|
|
246
|
+
const datasetRecords = isRecord(deck.datasets) ? Object.entries(deck.datasets).filter(([, value]) => isRecord(value)) : [];
|
|
247
|
+
const datasetUse = /* @__PURE__ */ new Map();
|
|
248
|
+
const payloadCounts = { text: 0, items: 0, bullets: 0, quote: 0, metric: 0, code: 0, timeline: 0, chart: 0, table: 0, image: 0, video: 0, blocks: 0, regions: 0, groups: 0, maxDepth: 0 };
|
|
249
|
+
const layouts2 = /* @__PURE__ */ new Map(), chartTypes2 = /* @__PURE__ */ new Map(), extensions = /* @__PURE__ */ new Set();
|
|
250
|
+
const chartData = { inline: 0, dataset: 0, source: 0 };
|
|
251
|
+
const tableItems = [];
|
|
252
|
+
let tableRows = 0, tableColumns = 0, datasetBackedTables = 0, chartTotal = 0, captions = 0;
|
|
253
|
+
const hidden = [], withoutNotes = [], sections = [];
|
|
254
|
+
let withTitle = 0, withBeat = 0, unsectioned = 0, withoutLayout = 0, withOwnDesign = 0, withNotes = 0, contentWords = 0, notesWords = 0;
|
|
255
|
+
const headerOverrides = { header: 0, headerSuppressed: 0, footer: 0, footerSuppressed: 0 };
|
|
256
|
+
const total = { citations: 0, footnotes: 0, links: 0, cited: /* @__PURE__ */ new Set(), families: /* @__PURE__ */ new Set() };
|
|
257
|
+
const perSlide = [];
|
|
258
|
+
const contentPerSlide = [];
|
|
259
|
+
const schemeReferences = [];
|
|
260
|
+
const deckTheme = themeRecord(deck, design.theme ?? "minimal");
|
|
261
|
+
schemeReferences.push(design.fontScheme ?? deckTheme.fontScheme ?? DEFAULT_FONT_SCHEME);
|
|
262
|
+
slides.forEach((slide, index) => {
|
|
263
|
+
const id = str(slide.id);
|
|
264
|
+
const ref = { index, id };
|
|
265
|
+
const slideDesign = isRecord(slide.design) ? slide.design : void 0;
|
|
266
|
+
const slideTally = { words: 0, citations: 0, footnotes: 0, links: 0, cited: /* @__PURE__ */ new Set(), families: /* @__PURE__ */ new Set() };
|
|
267
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
268
|
+
let slideImages = 0, slideCharts = 0, slideTables = 0;
|
|
269
|
+
const count = (text) => {
|
|
270
|
+
slideTally.words += wordCount(text);
|
|
271
|
+
};
|
|
272
|
+
const run = (value) => visitRuns(value, (entry) => {
|
|
273
|
+
count(entry.text);
|
|
274
|
+
if (typeof entry.link === "string" && entry.link !== "") slideTally.links++;
|
|
275
|
+
if (entry.cite !== void 0) {
|
|
276
|
+
slideTally.citations++;
|
|
277
|
+
for (const cite of list(entry.cite)) if (typeof cite === "string") slideTally.cited.add(cite);
|
|
278
|
+
}
|
|
279
|
+
if (entry.footnote !== void 0) slideTally.footnotes++;
|
|
280
|
+
if (typeof entry.fontFamily === "string" && entry.fontFamily !== "") slideTally.families.add(entry.fontFamily);
|
|
281
|
+
});
|
|
282
|
+
const caption = (node) => {
|
|
283
|
+
if (node.caption !== void 0) {
|
|
284
|
+
captions++;
|
|
285
|
+
run(node.caption);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
const visitNode = (node, path, depth, kind) => {
|
|
289
|
+
if (kind === "block") payloadCounts.blocks++;
|
|
290
|
+
if (kind === "region") payloadCounts.regions++;
|
|
291
|
+
if (kind !== "root" && Array.isArray(node.blocks)) payloadCounts.groups++;
|
|
292
|
+
if (depth > payloadCounts.maxDepth) payloadCounts.maxDepth = depth;
|
|
293
|
+
for (const key of KIND_ORDER) if (node[key] !== void 0) {
|
|
294
|
+
payloadCounts[key]++;
|
|
295
|
+
kinds.add(key);
|
|
296
|
+
}
|
|
297
|
+
if (isRecord(node.extensions)) for (const key of Object.keys(node.extensions)) extensions.add(key);
|
|
298
|
+
run(node.text);
|
|
299
|
+
run(node.items);
|
|
300
|
+
run(node.bullets);
|
|
301
|
+
caption(node);
|
|
302
|
+
if (node.quote !== void 0) {
|
|
303
|
+
const quote = node.quote;
|
|
304
|
+
if (isRecord(quote)) {
|
|
305
|
+
run(quote.text);
|
|
306
|
+
run(quote.attribution);
|
|
307
|
+
run(quote.source);
|
|
308
|
+
} else run(quote);
|
|
309
|
+
}
|
|
310
|
+
if (isRecord(node.metric)) {
|
|
311
|
+
run(node.metric.value);
|
|
312
|
+
run(node.metric.label);
|
|
313
|
+
run(node.metric.description);
|
|
314
|
+
run(node.metric.unit);
|
|
315
|
+
run(node.metric.delta);
|
|
316
|
+
}
|
|
317
|
+
if (node.timeline !== void 0) {
|
|
318
|
+
const timeline = node.timeline, events = Array.isArray(timeline) ? timeline : isRecord(timeline) && Array.isArray(timeline.events) ? timeline.events : [];
|
|
319
|
+
if (isRecord(timeline)) {
|
|
320
|
+
run(timeline.name);
|
|
321
|
+
run(timeline.description);
|
|
322
|
+
}
|
|
323
|
+
for (const event of events) if (isRecord(event)) {
|
|
324
|
+
run(event.when);
|
|
325
|
+
run(event.what);
|
|
326
|
+
run(event.description);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (node.image !== void 0) slideImages += contentImage(node.image);
|
|
330
|
+
if (node.video !== void 0) {
|
|
331
|
+
useAsset(node.video);
|
|
332
|
+
images.videos++;
|
|
333
|
+
}
|
|
334
|
+
if (isRecord(node.chart)) {
|
|
335
|
+
chartTotal++;
|
|
336
|
+
slideCharts++;
|
|
337
|
+
bump(chartTypes2, str(node.chart.type) ?? "unknown");
|
|
338
|
+
const data = node.chart.data;
|
|
339
|
+
if (isRecord(data)) {
|
|
340
|
+
if (typeof data.dataset === "string") {
|
|
341
|
+
chartData.dataset++;
|
|
342
|
+
bump(datasetUse, data.dataset);
|
|
343
|
+
} else if (Array.isArray(data.columns) || Array.isArray(data.rows)) chartData.inline++;
|
|
344
|
+
else if (typeof data.src === "string") {
|
|
345
|
+
chartData.source++;
|
|
346
|
+
useAsset(data.src);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (isRecord(node.table)) {
|
|
351
|
+
slideTables++;
|
|
352
|
+
const table = node.table;
|
|
353
|
+
let rows = 0, columns = 0, dataset = null;
|
|
354
|
+
if (typeof table.dataset === "string") {
|
|
355
|
+
dataset = table.dataset;
|
|
356
|
+
datasetBackedTables++;
|
|
357
|
+
bump(datasetUse, dataset);
|
|
358
|
+
const source = isRecord(deck.datasets) && isRecord(deck.datasets[dataset]) ? deck.datasets[dataset] : void 0;
|
|
359
|
+
rows = Array.isArray(source?.rows) ? source.rows.length : 0;
|
|
360
|
+
columns = Array.isArray(table.fields) ? table.fields.length : Array.isArray(source?.columns) ? source.columns.length : 0;
|
|
361
|
+
} else {
|
|
362
|
+
const body = Array.isArray(table.rows) ? table.rows : [];
|
|
363
|
+
rows = body.length;
|
|
364
|
+
columns = Array.isArray(table.columns) ? table.columns.length : body.reduce((widest, row) => Math.max(widest, Array.isArray(row) ? row.length : 0), 0);
|
|
365
|
+
run(table.columns);
|
|
366
|
+
for (const row of body) run(row);
|
|
367
|
+
}
|
|
368
|
+
tableRows += rows;
|
|
369
|
+
tableColumns += columns;
|
|
370
|
+
tableItems.push({ slide: index, path: `${path}/table`, rows, columns, dataset });
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
run(slide.title);
|
|
374
|
+
run(slide.subtitle);
|
|
375
|
+
run(slide.tag);
|
|
376
|
+
const slidePath = `/slides/${index}`;
|
|
377
|
+
visitNode(slide, slidePath, 0, "root");
|
|
378
|
+
visitContentPayloads(slide, slidePath, (node, path) => {
|
|
379
|
+
const relative = path.slice(slidePath.length + 1);
|
|
380
|
+
visitNode(node, path, (relative.match(/(^|\/)blocks\//g) ?? []).length, /(^|\/)blocks\/\d+$/.test(relative) ? "block" : "region");
|
|
381
|
+
});
|
|
382
|
+
const notes = typeof slide.notes === "string" ? slide.notes : "";
|
|
383
|
+
const noteWords = wordCount(notes);
|
|
384
|
+
const hasNotes = notes.trim() !== "";
|
|
385
|
+
if (hasNotes) withNotes++;
|
|
386
|
+
else withoutNotes.push(ref);
|
|
387
|
+
notesWords += noteWords;
|
|
388
|
+
contentWords += slideTally.words;
|
|
389
|
+
contentPerSlide.push(slideTally.words);
|
|
390
|
+
total.citations += slideTally.citations;
|
|
391
|
+
total.footnotes += slideTally.footnotes;
|
|
392
|
+
total.links += slideTally.links;
|
|
393
|
+
for (const cite of slideTally.cited) total.cited.add(cite);
|
|
394
|
+
for (const family of slideTally.families) total.families.add(family);
|
|
395
|
+
const title = typeof slide.title === "string" && slide.title.trim() !== "" ? slide.title : null;
|
|
396
|
+
if (title) withTitle++;
|
|
397
|
+
if (slide.beat !== void 0) withBeat++;
|
|
398
|
+
if (slide.hidden === true) hidden.push(ref);
|
|
399
|
+
const layout2 = str(slide.layout);
|
|
400
|
+
if (layout2) bump(layouts2, layout2);
|
|
401
|
+
else withoutLayout++;
|
|
402
|
+
const section = str(slide.section);
|
|
403
|
+
if (section !== null && section !== "") {
|
|
404
|
+
const last = sections.at(-1);
|
|
405
|
+
if (last && last.name === section && last.firstSlide + last.slides === index) last.slides++;
|
|
406
|
+
else sections.push({ name: section, slides: 1, firstSlide: index });
|
|
407
|
+
} else unsectioned++;
|
|
408
|
+
if (slideDesign) {
|
|
409
|
+
withOwnDesign++;
|
|
410
|
+
slideImages += designAssets(slideDesign, "slide");
|
|
411
|
+
for (const kind of ["header", "footer"]) {
|
|
412
|
+
if (slideDesign[kind] === false) headerOverrides[`${kind}Suppressed`]++;
|
|
413
|
+
else if (isRecord(slideDesign[kind])) headerOverrides[kind]++;
|
|
414
|
+
}
|
|
415
|
+
if (slideDesign.fontScheme !== void 0) schemeReferences.push(slideDesign.fontScheme);
|
|
416
|
+
else if (slideDesign.theme !== void 0 && design.fontScheme === void 0) schemeReferences.push(themeRecord(deck, slideDesign.theme).fontScheme ?? DEFAULT_FONT_SCHEME);
|
|
417
|
+
}
|
|
418
|
+
if (options.perSlide)
|
|
419
|
+
perSlide.push({
|
|
420
|
+
index,
|
|
421
|
+
id,
|
|
422
|
+
title,
|
|
423
|
+
layout: layout2,
|
|
424
|
+
section: section === "" ? null : section,
|
|
425
|
+
hidden: slide.hidden === true,
|
|
426
|
+
payloads: KIND_ORDER.filter((kind) => kinds.has(kind)),
|
|
427
|
+
words: { content: slideTally.words, notes: noteWords },
|
|
428
|
+
hasNotes,
|
|
429
|
+
speakingSeconds: Math.round(noteWords / wordsPerMinute * 60),
|
|
430
|
+
images: slideImages,
|
|
431
|
+
charts: slideCharts,
|
|
432
|
+
tables: slideTables,
|
|
433
|
+
citations: slideTally.citations
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
if (isRecord(deck.extensions)) for (const key of Object.keys(deck.extensions)) extensions.add(key);
|
|
437
|
+
const datasetItems = datasetRecords.map(([id, value]) => ({
|
|
438
|
+
id,
|
|
439
|
+
title: str(value.title),
|
|
440
|
+
columns: Array.isArray(value.columns) ? value.columns.length : 0,
|
|
441
|
+
rows: Array.isArray(value.rows) ? value.rows.length : 0,
|
|
442
|
+
source: isRecord(value.source) ? str(value.source.src) : null,
|
|
443
|
+
referencedBy: datasetUse.get(id) ?? 0
|
|
444
|
+
}));
|
|
445
|
+
const references = Array.isArray(deck.references) ? deck.references.filter(isRecord) : [];
|
|
446
|
+
const referenceIds = references.map((entry) => str(entry.id)).filter((entry) => entry !== null);
|
|
447
|
+
const cited = referenceIds.filter((entry) => total.cited.has(entry));
|
|
448
|
+
const variables = listVariables(deck, isRecord(options.values) ? options.values : {});
|
|
449
|
+
const byKind = /* @__PURE__ */ new Map();
|
|
450
|
+
for (const variable of variables) bump(byKind, variable.kind);
|
|
451
|
+
const variableFacts = {
|
|
452
|
+
declared: variables.length,
|
|
453
|
+
byKind: sortedCounts(byKind),
|
|
454
|
+
required: variables.filter((variable) => variable.required).length,
|
|
455
|
+
optional: variables.filter((variable) => !variable.required).length,
|
|
456
|
+
filled: variables.filter((variable) => variable.filled).length,
|
|
457
|
+
unfilled: variables.filter((variable) => !variable.filled).map((variable) => variable.id),
|
|
458
|
+
unfilledRequired: variables.filter((variable) => !variable.filled && variable.required).map((variable) => variable.id),
|
|
459
|
+
unused: variables.filter((variable) => variable.uses.length === 0).map((variable) => variable.id)
|
|
460
|
+
};
|
|
461
|
+
const families = new Set(total.families), schemeIds = /* @__PURE__ */ new Set(), unresolved = /* @__PURE__ */ new Set();
|
|
462
|
+
const addScheme = (value) => {
|
|
463
|
+
const resolved = resolveFontSchemeReference(value, (id2) => lookup(deck, "fontSchemes", id2));
|
|
464
|
+
if (resolved.diagnostic) unresolved.add(resolved.diagnostic.id);
|
|
465
|
+
const id = typeof value === "string" ? value : isRecord(value) && typeof value.id === "string" ? value.id : void 0;
|
|
466
|
+
if (id !== void 0) schemeIds.add(id);
|
|
467
|
+
const scheme = resolved.scheme;
|
|
468
|
+
const named = resolveFontFamilies(scheme);
|
|
469
|
+
families.add(named.heading);
|
|
470
|
+
families.add(named.body);
|
|
471
|
+
if (scheme.code !== void 0) families.add(named.code);
|
|
472
|
+
if (named.accent) families.add(named.accent);
|
|
473
|
+
};
|
|
474
|
+
for (const entry of schemeReferences) addScheme(entry);
|
|
475
|
+
const catalogOverrides = {};
|
|
476
|
+
if (isRecord(deck.catalogs))
|
|
477
|
+
for (const kind of Object.keys(deck.catalogs).sort()) {
|
|
478
|
+
const entry = deck.catalogs[kind];
|
|
479
|
+
if (isRecord(entry)) catalogOverrides[kind] = { records: Array.isArray(entry.records) ? entry.records.length : 0, source: str(entry.source) };
|
|
480
|
+
}
|
|
481
|
+
const colorVariables = variables.filter((variable) => variable.kind === "color").map((variable) => ({ id: variable.id, value: typeof variable.value === "string" ? variable.value : null, uses: variable.uses.length }));
|
|
482
|
+
const contentMean = slides.length ? decimals(contentWords / slides.length, 1) : 0;
|
|
483
|
+
const result = {
|
|
484
|
+
deck: deckFacts,
|
|
485
|
+
people: { organizations, speakers },
|
|
486
|
+
slides: {
|
|
487
|
+
total: slides.length,
|
|
488
|
+
hidden,
|
|
489
|
+
withTitle,
|
|
490
|
+
withoutTitle: slides.length - withTitle,
|
|
491
|
+
withBeat,
|
|
492
|
+
sections,
|
|
493
|
+
unsectioned,
|
|
494
|
+
layouts: sortedCounts(layouts2),
|
|
495
|
+
withoutLayout,
|
|
496
|
+
withOwnDesign
|
|
497
|
+
},
|
|
498
|
+
payloads: payloadCounts,
|
|
499
|
+
words: {
|
|
500
|
+
content: contentWords,
|
|
501
|
+
notes: notesWords,
|
|
502
|
+
total: contentWords + notesWords,
|
|
503
|
+
perSlide: { min: contentPerSlide.length ? Math.min(...contentPerSlide) : 0, max: contentPerSlide.length ? Math.max(...contentPerSlide) : 0, mean: contentMean }
|
|
504
|
+
},
|
|
505
|
+
notes: { withNotes, withoutNotes },
|
|
506
|
+
speakingTime: { basis: "estimate", wordsPerMinute, notesWords, minutes: decimals(notesWords / wordsPerMinute, 1), declaredMinutes: deckFacts.declaredMinutes },
|
|
507
|
+
images,
|
|
508
|
+
charts: { total: chartTotal, byType: sortedCounts(chartTypes2), data: chartData },
|
|
509
|
+
tables: { total: tableItems.length, datasetBacked: datasetBackedTables, rows: tableRows, columns: tableColumns, items: tableItems },
|
|
510
|
+
datasets: { count: datasetItems.length, withSource: datasetItems.filter((item) => item.source !== null).length, items: datasetItems },
|
|
511
|
+
citations: { references: references.length, cited, citations: total.citations, footnotes: total.footnotes, captions, links: total.links },
|
|
512
|
+
variables: variableFacts,
|
|
513
|
+
assets: { registry: registryFacts, uses, embeddedBytes: embeddedTotal },
|
|
514
|
+
headerFooter: {
|
|
515
|
+
header: furniture(design.header),
|
|
516
|
+
footer: furniture(design.footer),
|
|
517
|
+
slides: { headerOverrides: headerOverrides.header, headerSuppressed: headerOverrides.headerSuppressed, footerOverrides: headerOverrides.footer, footerSuppressed: headerOverrides.footerSuppressed }
|
|
518
|
+
},
|
|
519
|
+
fonts: { families: sorted(families), schemeIds: sorted(schemeIds), unresolvedSchemeIds: sorted(unresolved), runOverrides: sorted(total.families) },
|
|
520
|
+
colors: { variables: colorVariables },
|
|
521
|
+
extensions: sorted(extensions),
|
|
522
|
+
catalogOverrides
|
|
523
|
+
};
|
|
524
|
+
if (options.perSlide) result.perSlide = perSlide;
|
|
525
|
+
return result;
|
|
526
|
+
}
|
|
527
|
+
|
|
17
528
|
// src/bundle.ts
|
|
18
529
|
function reportKey(kind, id) {
|
|
19
530
|
return `${kind}:${id}`;
|
|
@@ -60,7 +571,7 @@ function collectSocialReferences(collector, holder) {
|
|
|
60
571
|
function collectBeatReferences(collector, narrative2) {
|
|
61
572
|
if (!isRecord(narrative2) || !Array.isArray(narrative2.beats)) return;
|
|
62
573
|
for (const beat of narrative2.beats) {
|
|
63
|
-
if (isRecord(beat)) addReference(collector, "layouts", beat.
|
|
574
|
+
if (isRecord(beat)) addReference(collector, "layouts", beat.layout, false);
|
|
64
575
|
}
|
|
65
576
|
}
|
|
66
577
|
function collectLanguageReferences(collector, language2) {
|
|
@@ -71,12 +582,13 @@ function collectLanguageReferences(collector, language2) {
|
|
|
71
582
|
}
|
|
72
583
|
function collectDocumentReferences(collector, document) {
|
|
73
584
|
addReference(collector, "narratives", document.narrative, typeof document.narrative === "string");
|
|
74
|
-
collectBeatReferences(collector, document.narrative);
|
|
75
585
|
addReference(collector, "tones", document.tone, false);
|
|
76
586
|
addReference(collector, "purposes", document.purpose, false);
|
|
77
587
|
collectLanguageReferences(collector, document.language);
|
|
78
588
|
if (Array.isArray(document.audience)) {
|
|
79
589
|
for (const entry of document.audience) addReference(collector, "audiences", entry, true);
|
|
590
|
+
} else if (isRecord(document.audience)) {
|
|
591
|
+
addReference(collector, "audiences", document.audience, true);
|
|
80
592
|
} else {
|
|
81
593
|
addReference(collector, "audiences", document.audience, typeof document.audience === "string");
|
|
82
594
|
}
|
|
@@ -146,11 +658,11 @@ function kindState(states, catalogsField, kind) {
|
|
|
146
658
|
return state;
|
|
147
659
|
}
|
|
148
660
|
function pushReportId(map, kind, id) {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
661
|
+
const list2 = map[kind];
|
|
662
|
+
if (list2) list2.push(id);
|
|
151
663
|
else map[kind] = [id];
|
|
152
664
|
}
|
|
153
|
-
function
|
|
665
|
+
function bundle(value) {
|
|
154
666
|
const report = { added: {}, alreadyInline: {}, keptSources: [], unresolved: {} };
|
|
155
667
|
if (!isRecord(value)) {
|
|
156
668
|
return { presentation: value, report };
|
|
@@ -211,929 +723,4 @@ function bundlePresentation(value) {
|
|
|
211
723
|
return { presentation: presentation2, report };
|
|
212
724
|
}
|
|
213
725
|
|
|
214
|
-
|
|
215
|
-
var channels = (hex) => [1, 3, 5].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
|
|
216
|
-
var toHex = (values) => `#${values.map((value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
|
|
217
|
-
var linear = (value) => {
|
|
218
|
-
const n = value / 255;
|
|
219
|
-
return n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
220
|
-
};
|
|
221
|
-
var luminance = (hex) => {
|
|
222
|
-
const [r, g, b] = channels(hex);
|
|
223
|
-
return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
|
|
224
|
-
};
|
|
225
|
-
var contrast = (a, b) => {
|
|
226
|
-
const x = luminance(a), y = luminance(b);
|
|
227
|
-
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
|
228
|
-
};
|
|
229
|
-
var normalize = (value) => {
|
|
230
|
-
if (typeof value !== "string") return void 0;
|
|
231
|
-
const text = value.trim();
|
|
232
|
-
if (/^#[0-9a-f]{3}$/i.test(text)) return `#${[...text.slice(1)].map((c) => c + c).join("")}`.toUpperCase();
|
|
233
|
-
return /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(text) ? text.slice(0, 7).toUpperCase() : void 0;
|
|
234
|
-
};
|
|
235
|
-
function toHsl(hex) {
|
|
236
|
-
const [r, g, b] = channels(hex).map((value) => value / 255);
|
|
237
|
-
const max = Math.max(r, g, b), min = Math.min(r, g, b), l = (max + min) / 2, d = max - min;
|
|
238
|
-
if (d === 0) return [0, 0, l];
|
|
239
|
-
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
240
|
-
const h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
|
241
|
-
return [h * 60, s, l];
|
|
242
|
-
}
|
|
243
|
-
function fromHsl(h, s, l) {
|
|
244
|
-
const hue = (h % 360 + 360) % 360, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hue / 60 % 2 - 1)), m = l - c / 2;
|
|
245
|
-
const [r, g, b] = hue < 60 ? [c, x, 0] : hue < 120 ? [x, c, 0] : hue < 180 ? [0, c, x] : hue < 240 ? [0, x, c] : hue < 300 ? [x, 0, c] : [c, 0, x];
|
|
246
|
-
return toHex([(r + m) * 255, (g + m) * 255, (b + m) * 255]);
|
|
247
|
-
}
|
|
248
|
-
function legible(foreground, background, minimum) {
|
|
249
|
-
if (contrast(foreground, background) >= minimum) return foreground;
|
|
250
|
-
const [h, s, l] = toHsl(foreground), preferred = luminance(background) < 0.5 ? 1 : -1;
|
|
251
|
-
for (const direction of [preferred, -preferred]) {
|
|
252
|
-
for (let step = 1; step <= 100; step++) {
|
|
253
|
-
const lightness = l + direction * step / 100;
|
|
254
|
-
if (lightness < 0 || lightness > 1) break;
|
|
255
|
-
const candidate = fromHsl(h, s, lightness);
|
|
256
|
-
if (contrast(candidate, background) >= minimum) return candidate;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return contrast("#FFFFFF", background) >= contrast("#000000", background) ? "#FFFFFF" : "#000000";
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// src/code-syntax.ts
|
|
263
|
-
var CODE_HIGHLIGHT_MAX_LENGTH = 2e5;
|
|
264
|
-
var CODE_SYNTAX_MIN_CONTRAST = 4.5;
|
|
265
|
-
var CODE_PANEL_BACKGROUND = "#111827";
|
|
266
|
-
var CODE_PANEL_FOREGROUND = "#E5E7EB";
|
|
267
|
-
var set = (words) => new Set((words ?? "").split(/\s+/).filter(Boolean));
|
|
268
|
-
var JS_KEYWORDS = "break case catch class const continue debugger default delete do else enum export extends finally for from function if import in instanceof let new of return static super switch this throw try typeof var void while with yield async await as get set declare namespace module abstract implements interface private protected public readonly override keyof satisfies type is infer";
|
|
269
|
-
var JS = { line: ["//"], block: [["/*", "*/"]], strings: "'\"`", keywords: JS_KEYWORDS, literals: "true false null undefined NaN Infinity", types: "string number boolean object symbol bigint never unknown any void", defs: { function: "function", class: "type", interface: "type", enum: "type", type: "type" }, capsTypes: true, calls: true, decorators: true };
|
|
270
|
-
var C_LIKE_KEYWORDS = "auto break case catch char class const constexpr continue default delete do double else enum explicit extern false final float for friend goto if inline int long mutable namespace new noexcept nullptr operator override private protected public register return short signed sizeof static struct switch template this throw true try typedef typename union unsigned using virtual void volatile while";
|
|
271
|
-
var LANGUAGES = {
|
|
272
|
-
javascript: JS,
|
|
273
|
-
typescript: JS,
|
|
274
|
-
python: { line: ["#"], strings: `'"`, triple: ['"""', "'''"], keywords: "and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case self cls", literals: "True False None", types: "int float str bool bytes list dict set tuple object type", defs: { def: "function", class: "type" }, capsTypes: true, calls: true, decorators: true },
|
|
275
|
-
rust: { line: ["//"], block: [["/*", "*/"]], strings: '"', rawStrings: "r", keywords: "as async await break const continue crate dyn else enum extern fn for if impl in let loop match mod move mut pub ref return self Self static struct super trait type unsafe use where while", literals: "true false", types: "i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 bool char str String Vec Option Result Box", defs: { fn: "function", struct: "type", enum: "type", trait: "type", type: "type", mod: "type" }, capsTypes: true, calls: true, macros: true },
|
|
276
|
-
go: { line: ["//"], block: [["/*", "*/"]], strings: "\"'`", noEscapes: "`", keywords: "break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var", literals: "true false nil iota", types: "int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 uintptr float32 float64 complex64 complex128 string bool byte rune error any", defs: { func: "function", type: "type" }, capsTypes: true, calls: true },
|
|
277
|
-
bash: { line: ["#"], strings: `'"`, noEscapes: "'", keywords: "if then else elif fi for while until do done case esac in function select time return exit break continue export local readonly declare unset set shift source alias trap eval exec", literals: "true false", variables: true, calls: false },
|
|
278
|
-
json: { line: ["//"], block: [["/*", "*/"]], strings: '"', literals: "true false null", quotedKeys: true },
|
|
279
|
-
yaml: { kind: "yaml" },
|
|
280
|
-
toml: { kind: "ini", line: ["#"] },
|
|
281
|
-
ini: { kind: "ini", line: ["#", ";"] },
|
|
282
|
-
markup: { kind: "markup" },
|
|
283
|
-
css: { kind: "css" },
|
|
284
|
-
sql: { line: ["--"], block: [["/*", "*/"]], strings: `'"`, ci: true, keywords: "add all alter and any as asc between by case check column commit constraint create cross database default delete desc distinct drop else end exists foreign from full group having if in index inner insert into is join key left like limit not null offset on or order outer primary references replace right rollback select set table then top union unique update values view when where with", literals: "true false", types: "int integer bigint smallint decimal numeric float real double varchar char text date time timestamp boolean serial uuid json" },
|
|
285
|
-
java: { line: ["//"], block: [["/*", "*/"]], strings: `"'`, keywords: "abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try var volatile while record sealed permits", literals: "true false null", types: "boolean byte char double float int long short void String Object", defs: { class: "type", interface: "type", enum: "type", record: "type" }, capsTypes: true, calls: true, decorators: true },
|
|
286
|
-
csharp: { line: ["//"], block: [["/*", "*/"]], strings: `"'`, keywords: "abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using var virtual volatile while record init required", literals: "true false null", types: "bool byte char decimal double float int long object sbyte short string uint ulong ushort void dynamic", defs: { class: "type", interface: "type", struct: "type", enum: "type", record: "type" }, capsTypes: true, calls: true, decorators: false },
|
|
287
|
-
kotlin: { line: ["//"], block: [["/*", "*/"]], strings: `"'`, triple: ['"""'], keywords: "abstract actual annotation as break by catch class companion const constructor continue crossinline data do else enum expect external final finally for fun get if import in infix init inline inner interface internal is it lateinit lazy noinline object open operator out override package private protected public reified return sealed set super suspend tailrec this throw try typealias val var vararg when where while", literals: "true false null", types: "Int Long Short Byte Float Double Boolean Char String Unit Any Nothing", defs: { fun: "function", class: "type", interface: "type", object: "type" }, capsTypes: true, calls: true, decorators: true },
|
|
288
|
-
swift: { line: ["//"], block: [["/*", "*/"]], strings: '"', triple: ['"""'], keywords: "actor as associatedtype async await break case catch class continue default defer deinit do else enum extension fallthrough fileprivate for func guard if import in init inout internal is let nonisolated open operator private protocol public repeat rethrows return self Self static struct subscript super switch throw throws try typealias var where while", literals: "true false nil", types: "Int Double Float Bool String Character Array Dictionary Set Optional Any", defs: { func: "function", class: "type", struct: "type", enum: "type", protocol: "type", extension: "type" }, capsTypes: true, calls: true, decorators: true },
|
|
289
|
-
ruby: { line: ["#"], strings: `'"`, keywords: "alias and begin break case class def defined do else elsif end ensure for if in module next not or redo rescue retry return self super then undef unless until when while yield require require_relative include extend attr_accessor attr_reader attr_writer private protected public", literals: "true false nil", defs: { def: "function", class: "type", module: "type" }, capsTypes: true, calls: true },
|
|
290
|
-
php: { line: ["//", "#"], block: [["/*", "*/"]], strings: `'"`, keywords: "abstract and array as break callable case catch class clone const continue declare default do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends final finally fn for foreach function global goto if implements include include_once instanceof insteadof interface isset list match namespace new or print private protected public readonly require require_once return static switch throw trait try unset use var while xor yield", literals: "true false null TRUE FALSE NULL", defs: { function: "function", class: "type", interface: "type", trait: "type" }, capsTypes: true, calls: true, variables: true },
|
|
291
|
-
c: { line: ["//"], block: [["/*", "*/"]], strings: `"'`, keywords: C_LIKE_KEYWORDS, literals: "true false NULL nullptr", types: "size_t ssize_t int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t bool FILE", calls: true, capsTypes: false, directives: true, defs: { struct: "type", enum: "type", union: "type", class: "type" } },
|
|
292
|
-
hcl: { line: ["#", "//"], block: [["/*", "*/"]], strings: '"', keywords: "resource data variable output locals module provider terraform for in if else dynamic content backend required_providers lifecycle", literals: "true false null", types: "string number bool list map set object tuple any", calls: true },
|
|
293
|
-
dockerfile: { line: ["#"], strings: `'"`, keywords: "FROM RUN CMD LABEL MAINTAINER EXPOSE ENV ADD COPY ENTRYPOINT VOLUME USER WORKDIR ARG ONBUILD STOPSIGNAL HEALTHCHECK SHELL AS", variables: true }
|
|
294
|
-
};
|
|
295
|
-
var ALIASES = {
|
|
296
|
-
js: "javascript",
|
|
297
|
-
javascript: "javascript",
|
|
298
|
-
mjs: "javascript",
|
|
299
|
-
cjs: "javascript",
|
|
300
|
-
jsx: "javascript",
|
|
301
|
-
node: "javascript",
|
|
302
|
-
nodejs: "javascript",
|
|
303
|
-
ts: "typescript",
|
|
304
|
-
typescript: "typescript",
|
|
305
|
-
tsx: "typescript",
|
|
306
|
-
mts: "typescript",
|
|
307
|
-
cts: "typescript",
|
|
308
|
-
python: "python",
|
|
309
|
-
py: "python",
|
|
310
|
-
python3: "python",
|
|
311
|
-
py3: "python",
|
|
312
|
-
rust: "rust",
|
|
313
|
-
rs: "rust",
|
|
314
|
-
go: "go",
|
|
315
|
-
golang: "go",
|
|
316
|
-
bash: "bash",
|
|
317
|
-
sh: "bash",
|
|
318
|
-
shell: "bash",
|
|
319
|
-
zsh: "bash",
|
|
320
|
-
console: "bash",
|
|
321
|
-
shellscript: "bash",
|
|
322
|
-
fish: "bash",
|
|
323
|
-
json: "json",
|
|
324
|
-
jsonc: "json",
|
|
325
|
-
json5: "json",
|
|
326
|
-
yaml: "yaml",
|
|
327
|
-
yml: "yaml",
|
|
328
|
-
toml: "toml",
|
|
329
|
-
ini: "ini",
|
|
330
|
-
conf: "ini",
|
|
331
|
-
cfg: "ini",
|
|
332
|
-
properties: "ini",
|
|
333
|
-
env: "ini",
|
|
334
|
-
markup: "markup",
|
|
335
|
-
html: "markup",
|
|
336
|
-
xml: "markup",
|
|
337
|
-
svg: "markup",
|
|
338
|
-
xhtml: "markup",
|
|
339
|
-
vue: "markup",
|
|
340
|
-
plist: "markup",
|
|
341
|
-
css: "css",
|
|
342
|
-
scss: "css",
|
|
343
|
-
less: "css",
|
|
344
|
-
sass: "css",
|
|
345
|
-
sql: "sql",
|
|
346
|
-
postgres: "sql",
|
|
347
|
-
postgresql: "sql",
|
|
348
|
-
mysql: "sql",
|
|
349
|
-
sqlite: "sql",
|
|
350
|
-
pgsql: "sql",
|
|
351
|
-
java: "java",
|
|
352
|
-
csharp: "csharp",
|
|
353
|
-
cs: "csharp",
|
|
354
|
-
"c#": "csharp",
|
|
355
|
-
kotlin: "kotlin",
|
|
356
|
-
kt: "kotlin",
|
|
357
|
-
swift: "swift",
|
|
358
|
-
ruby: "ruby",
|
|
359
|
-
rb: "ruby",
|
|
360
|
-
php: "php",
|
|
361
|
-
c: "c",
|
|
362
|
-
h: "c",
|
|
363
|
-
cpp: "c",
|
|
364
|
-
"c++": "c",
|
|
365
|
-
cc: "c",
|
|
366
|
-
cxx: "c",
|
|
367
|
-
hpp: "c",
|
|
368
|
-
hh: "c",
|
|
369
|
-
objc: "c",
|
|
370
|
-
hcl: "hcl",
|
|
371
|
-
terraform: "hcl",
|
|
372
|
-
tf: "hcl",
|
|
373
|
-
tfvars: "hcl",
|
|
374
|
-
dockerfile: "dockerfile",
|
|
375
|
-
docker: "dockerfile"
|
|
376
|
-
};
|
|
377
|
-
var CODE_HIGHLIGHT_LANGUAGES = Object.freeze(Object.keys(LANGUAGES));
|
|
378
|
-
function resolveCodeLanguage(language2) {
|
|
379
|
-
if (typeof language2 !== "string") return void 0;
|
|
380
|
-
const key = language2.trim().toLowerCase().replace(/^(?:language|lang)[-:]/, "").replace(/^\./, "");
|
|
381
|
-
return Object.hasOwn(ALIASES, key) ? ALIASES[key] : void 0;
|
|
382
|
-
}
|
|
383
|
-
var IDENT = /[\p{L}_$][\p{L}\p{N}_$]*/uy;
|
|
384
|
-
var NUMBER = /(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)[a-zA-Z]{0,4}/y;
|
|
385
|
-
var isIdentChar = (character) => character !== void 0 && /[\p{L}\p{N}_$]/u.test(character);
|
|
386
|
-
function endOfLine(source, from) {
|
|
387
|
-
const index = source.slice(from).search(/\r\n|\r|\n/);
|
|
388
|
-
return index < 0 ? source.length : from + index;
|
|
389
|
-
}
|
|
390
|
-
function pushToken(tokens, start, end, kind) {
|
|
391
|
-
if (end <= start) return;
|
|
392
|
-
const last = tokens[tokens.length - 1];
|
|
393
|
-
if (last && last.kind === kind && last.end === start && kind !== "function" && kind !== "property") last.end = end;
|
|
394
|
-
else tokens.push({ start, end, kind });
|
|
395
|
-
}
|
|
396
|
-
function scanQuoted(source, from, quote, escapes, multiline) {
|
|
397
|
-
let index = from + 1;
|
|
398
|
-
while (index < source.length) {
|
|
399
|
-
const character = source[index];
|
|
400
|
-
if (escapes && character === "\\") {
|
|
401
|
-
index += 2;
|
|
402
|
-
continue;
|
|
403
|
-
}
|
|
404
|
-
if (character === quote) return index + 1;
|
|
405
|
-
if (!multiline && (character === "\n" || character === "\r")) return index;
|
|
406
|
-
index++;
|
|
407
|
-
}
|
|
408
|
-
return source.length;
|
|
409
|
-
}
|
|
410
|
-
function scanGeneric(source, def) {
|
|
411
|
-
const tokens = [];
|
|
412
|
-
const keywords = set(def.keywords), literals = set(def.literals), types = set(def.types);
|
|
413
|
-
const fold = (word) => def.ci ? word.toLowerCase() : word;
|
|
414
|
-
if (def.ci) for (const list of [keywords, literals, types]) for (const word of [...list]) {
|
|
415
|
-
list.delete(word);
|
|
416
|
-
list.add(word.toLowerCase());
|
|
417
|
-
}
|
|
418
|
-
const strings = def.strings ?? "", lineComments = def.line ?? [], blocks = def.block ?? [], triples = def.triple ?? [];
|
|
419
|
-
let index = 0, pendingDef;
|
|
420
|
-
const atLineStart = (position) => {
|
|
421
|
-
let at = position - 1;
|
|
422
|
-
while (at >= 0 && (source[at] === " " || source[at] === " ")) at--;
|
|
423
|
-
return at < 0 || source[at] === "\n" || source[at] === "\r";
|
|
424
|
-
};
|
|
425
|
-
while (index < source.length) {
|
|
426
|
-
const character = source[index];
|
|
427
|
-
if (/\s/.test(character)) {
|
|
428
|
-
index++;
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
const lineComment = lineComments.find((opener) => source.startsWith(opener, index));
|
|
432
|
-
if (lineComment && !(lineComment === "#" && def.directives) && !(lineComment === "#" && def.variables && source[index - 1] === "$") && !(def.variables && lineComment === "#" && index > 0 && !/[\s;&|(]/.test(source[index - 1]))) {
|
|
433
|
-
const end = endOfLine(source, index);
|
|
434
|
-
pushToken(tokens, index, end, "comment");
|
|
435
|
-
index = end;
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
const block = blocks.find(([opener]) => source.startsWith(opener, index));
|
|
439
|
-
if (block) {
|
|
440
|
-
const close = source.indexOf(block[1], index + block[0].length);
|
|
441
|
-
const end = close < 0 ? source.length : close + block[1].length;
|
|
442
|
-
pushToken(tokens, index, end, "comment");
|
|
443
|
-
index = end;
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
if (def.directives && character === "#" && atLineStart(index)) {
|
|
447
|
-
const match = /#[ \t]*\w+/y;
|
|
448
|
-
match.lastIndex = index;
|
|
449
|
-
const found = match.exec(source);
|
|
450
|
-
if (found) {
|
|
451
|
-
pushToken(tokens, index, index + found[0].length, "keyword");
|
|
452
|
-
index += found[0].length;
|
|
453
|
-
if (/include/.test(found[0])) {
|
|
454
|
-
const header = /[ \t]*(<[^>\n]*>)/y;
|
|
455
|
-
header.lastIndex = index;
|
|
456
|
-
const matched = header.exec(source);
|
|
457
|
-
if (matched) {
|
|
458
|
-
const start = index + matched[0].length - matched[1].length;
|
|
459
|
-
pushToken(tokens, start, start + matched[1].length, "string");
|
|
460
|
-
index += matched[0].length;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
continue;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
const triple = triples.find((opener) => source.startsWith(opener, index));
|
|
467
|
-
if (triple) {
|
|
468
|
-
const close = source.indexOf(triple, index + 3);
|
|
469
|
-
const end = close < 0 ? source.length : close + 3;
|
|
470
|
-
pushToken(tokens, index, end, "string");
|
|
471
|
-
index = end;
|
|
472
|
-
pendingDef = void 0;
|
|
473
|
-
continue;
|
|
474
|
-
}
|
|
475
|
-
if (def.rawStrings && character === def.rawStrings && /^r#*"/.test(source.slice(index, index + 8)) && !isIdentChar(source[index - 1])) {
|
|
476
|
-
const hashes = /^r(#*)"/.exec(source.slice(index, index + 8))[1];
|
|
477
|
-
const close = source.indexOf(`"${hashes}`, index + 2 + hashes.length);
|
|
478
|
-
const end = close < 0 ? source.length : close + 1 + hashes.length;
|
|
479
|
-
pushToken(tokens, index, end, "string");
|
|
480
|
-
index = end;
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
if (strings.includes(character)) {
|
|
484
|
-
if (def === LANGUAGES.rust && character === "'" && !/^'(?:\\.[^']*|[^\\'])'/.test(source.slice(index, index + 12))) {
|
|
485
|
-
const match = /'[\p{L}_][\p{L}\p{N}_]*/uy;
|
|
486
|
-
match.lastIndex = index;
|
|
487
|
-
const found = match.exec(source);
|
|
488
|
-
const end2 = index + (found ? found[0].length : 1);
|
|
489
|
-
if (found) pushToken(tokens, index, end2, "type");
|
|
490
|
-
index = end2;
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
const escapes = !(def.noEscapes ?? "").includes(character);
|
|
494
|
-
const multiline = character === "`";
|
|
495
|
-
const end = scanQuoted(source, index, character, escapes, multiline);
|
|
496
|
-
let kind = "string";
|
|
497
|
-
if (def.quotedKeys) {
|
|
498
|
-
const after = /^[ \t]*:/.exec(source.slice(end, end + 40));
|
|
499
|
-
if (after) kind = "property";
|
|
500
|
-
}
|
|
501
|
-
pushToken(tokens, index, end, kind);
|
|
502
|
-
index = end;
|
|
503
|
-
pendingDef = void 0;
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
if (def.variables && character === "$") {
|
|
507
|
-
const match = /\$(?:\{[^}\n]*\}|[A-Za-z_]\w*|[0-9@#?!$*-])/y;
|
|
508
|
-
match.lastIndex = index;
|
|
509
|
-
const found = match.exec(source);
|
|
510
|
-
if (found) {
|
|
511
|
-
pushToken(tokens, index, index + found[0].length, "property");
|
|
512
|
-
index += found[0].length;
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
if (def.decorators && character === "@" && /[\p{L}_]/u.test(source[index + 1] ?? "")) {
|
|
517
|
-
const match = /@[\p{L}_][\p{L}\p{N}_$.]*/uy;
|
|
518
|
-
match.lastIndex = index;
|
|
519
|
-
const found = match.exec(source);
|
|
520
|
-
pushToken(tokens, index, index + found[0].length, "function");
|
|
521
|
-
index += found[0].length;
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
if (/\d/.test(character) && !isIdentChar(source[index - 1])) {
|
|
525
|
-
NUMBER.lastIndex = index;
|
|
526
|
-
const found = NUMBER.exec(source);
|
|
527
|
-
if (found) {
|
|
528
|
-
pushToken(tokens, index, index + found[0].length, "number");
|
|
529
|
-
index += found[0].length;
|
|
530
|
-
pendingDef = void 0;
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
if (def === LANGUAGES.python && /[rRbBfFuU]/.test(character) && /^[rRbBfFuU]{1,2}['"]/.test(source.slice(index, index + 3)) && !isIdentChar(source[index - 1])) {
|
|
535
|
-
const prefix = /^[rRbBfFuU]{1,2}/.exec(source.slice(index, index + 3))[0].length;
|
|
536
|
-
const quote = source[index + prefix];
|
|
537
|
-
const triple2 = source.startsWith(quote.repeat(3), index + prefix);
|
|
538
|
-
let end;
|
|
539
|
-
if (triple2) {
|
|
540
|
-
const close = source.indexOf(quote.repeat(3), index + prefix + 3);
|
|
541
|
-
end = close < 0 ? source.length : close + 3;
|
|
542
|
-
} else end = scanQuoted(source, index + prefix, quote, !/[rR]/.test(source.slice(index, index + prefix)), false);
|
|
543
|
-
pushToken(tokens, index, end, "string");
|
|
544
|
-
index = end;
|
|
545
|
-
pendingDef = void 0;
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
IDENT.lastIndex = index;
|
|
549
|
-
const identifier = IDENT.exec(source);
|
|
550
|
-
if (identifier) {
|
|
551
|
-
const word = identifier[0], end = index + word.length, folded = fold(word);
|
|
552
|
-
let kind;
|
|
553
|
-
if (pendingDef && !keywords.has(folded)) kind = pendingDef;
|
|
554
|
-
else if (keywords.has(folded)) {
|
|
555
|
-
kind = "keyword";
|
|
556
|
-
pendingDef = def.defs && Object.hasOwn(def.defs, folded) ? def.defs[folded] : void 0;
|
|
557
|
-
pushToken(tokens, index, end, kind);
|
|
558
|
-
index = end;
|
|
559
|
-
continue;
|
|
560
|
-
} else if (literals.has(word) || literals.has(folded)) kind = "number";
|
|
561
|
-
else if (types.has(folded)) kind = "type";
|
|
562
|
-
else if (def.calls && source[end] === "(") kind = "function";
|
|
563
|
-
else if (def.macros && source[end] === "!" && /[([{]/.test(source[end + 1] ?? "")) kind = "function";
|
|
564
|
-
else if (def.capsTypes && /^[A-Z]/.test(word) && /[a-z]/.test(word)) kind = "type";
|
|
565
|
-
pendingDef = void 0;
|
|
566
|
-
if (kind) pushToken(tokens, index, end, kind);
|
|
567
|
-
index = end;
|
|
568
|
-
continue;
|
|
569
|
-
}
|
|
570
|
-
pendingDef = void 0;
|
|
571
|
-
index++;
|
|
572
|
-
}
|
|
573
|
-
return tokens;
|
|
574
|
-
}
|
|
575
|
-
var YAML_LITERALS = /* @__PURE__ */ new Set(["true", "false", "null", "yes", "no", "on", "off", "~", "True", "False", "Null", "TRUE", "FALSE", "NULL"]);
|
|
576
|
-
function scanYamlValue(source, start, end, tokens, comments) {
|
|
577
|
-
let index = start;
|
|
578
|
-
while (index < end) {
|
|
579
|
-
const character = source[index];
|
|
580
|
-
if (character === "#" && (index === start || /\s/.test(source[index - 1])) && comments.includes("#")) {
|
|
581
|
-
pushToken(tokens, index, end, "comment");
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
if (character === ";" && comments.includes(";") && (index === start || /\s/.test(source[index - 1]))) {
|
|
585
|
-
pushToken(tokens, index, end, "comment");
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
if (character === '"' || character === "'") {
|
|
589
|
-
const close = scanQuoted(source, index, character, character === '"', false);
|
|
590
|
-
pushToken(tokens, index, Math.min(close, end), "string");
|
|
591
|
-
index = Math.min(close, end);
|
|
592
|
-
continue;
|
|
593
|
-
}
|
|
594
|
-
if ((character === "&" || character === "*") && /[\w-]/.test(source[index + 1] ?? "")) {
|
|
595
|
-
const match = /[&*][\w-]+/y;
|
|
596
|
-
match.lastIndex = index;
|
|
597
|
-
const found2 = match.exec(source);
|
|
598
|
-
pushToken(tokens, index, index + found2[0].length, "type");
|
|
599
|
-
index += found2[0].length;
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
if (!isIdentChar(source[index - 1]) && /[\d-]/.test(character)) {
|
|
603
|
-
const match = /-?\d[\d_]*(?:\.\d+)?(?:[eE][+-]?\d+)?(?=[\s,\]}]|$)/y;
|
|
604
|
-
match.lastIndex = index;
|
|
605
|
-
const found2 = match.exec(source);
|
|
606
|
-
if (found2 && index + found2[0].length <= end) {
|
|
607
|
-
pushToken(tokens, index, index + found2[0].length, "number");
|
|
608
|
-
index += found2[0].length;
|
|
609
|
-
continue;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
const word = /[\w.~-]+/y;
|
|
613
|
-
word.lastIndex = index;
|
|
614
|
-
const found = word.exec(source);
|
|
615
|
-
if (found) {
|
|
616
|
-
if (YAML_LITERALS.has(found[0]) && !/[\w.-]/.test(source[index + found[0].length] ?? "")) pushToken(tokens, index, index + found[0].length, "number");
|
|
617
|
-
index += found[0].length;
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
index++;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
function lineRanges(source) {
|
|
624
|
-
const ranges = [];
|
|
625
|
-
let cursor = 0;
|
|
626
|
-
const pattern = /\r\n|\r|\n/g;
|
|
627
|
-
for (let match = pattern.exec(source); match; match = pattern.exec(source)) {
|
|
628
|
-
ranges.push({ start: cursor, end: match.index });
|
|
629
|
-
cursor = match.index + match[0].length;
|
|
630
|
-
}
|
|
631
|
-
ranges.push({ start: cursor, end: source.length });
|
|
632
|
-
return ranges;
|
|
633
|
-
}
|
|
634
|
-
function yamlKey(source, from, to) {
|
|
635
|
-
const first = source[from];
|
|
636
|
-
if (first === void 0 || from >= to) return void 0;
|
|
637
|
-
let index = from;
|
|
638
|
-
if (first === '"' || first === "'") {
|
|
639
|
-
index = Math.min(scanQuoted(source, from, first, first === '"', false), to);
|
|
640
|
-
let at = index;
|
|
641
|
-
while (at < to && (source[at] === " " || source[at] === " ")) at++;
|
|
642
|
-
return source[index - 1] === first && source[at] === ":" && (at + 1 >= to || /\s/.test(source[at + 1])) ? { nameEnd: index, colon: at } : void 0;
|
|
643
|
-
}
|
|
644
|
-
if (/[\s#:{}[\],&*!|>%@`]/.test(first) || first === "-" && /[\s#:]/.test(source[from + 1] ?? " ")) return void 0;
|
|
645
|
-
for (; index < to; index++) {
|
|
646
|
-
const character = source[index];
|
|
647
|
-
if (character === "#" && /\s/.test(source[index - 1])) return void 0;
|
|
648
|
-
if (character === ":" && (index + 1 >= to || /\s/.test(source[index + 1]))) {
|
|
649
|
-
let nameEnd = index;
|
|
650
|
-
while (nameEnd > from && /\s/.test(source[nameEnd - 1])) nameEnd--;
|
|
651
|
-
return nameEnd > from ? { nameEnd, colon: index } : void 0;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
return void 0;
|
|
655
|
-
}
|
|
656
|
-
function scanYaml(source) {
|
|
657
|
-
const tokens = [];
|
|
658
|
-
let blockIndent = -1;
|
|
659
|
-
for (const { start, end } of lineRanges(source)) {
|
|
660
|
-
const text = source.slice(start, end), indent = /^ */.exec(text)[0].length;
|
|
661
|
-
if (blockIndent >= 0) {
|
|
662
|
-
if (text.trim() === "" || indent > blockIndent) {
|
|
663
|
-
if (text.trim() !== "") pushToken(tokens, start + indent, end, "string");
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
blockIndent = -1;
|
|
667
|
-
}
|
|
668
|
-
if (/^\s*#/.test(text)) {
|
|
669
|
-
pushToken(tokens, start + indent, end, "comment");
|
|
670
|
-
continue;
|
|
671
|
-
}
|
|
672
|
-
if (/^(?:---|\.\.\.)(?:\s|$)/.test(text)) {
|
|
673
|
-
pushToken(tokens, start, start + 3, "keyword");
|
|
674
|
-
scanYamlValue(source, start + 3, end, tokens, "#");
|
|
675
|
-
continue;
|
|
676
|
-
}
|
|
677
|
-
let cursor = start + indent;
|
|
678
|
-
const dash = /^(?:-\s+)+/.exec(text.slice(indent));
|
|
679
|
-
if (dash) cursor += dash[0].length;
|
|
680
|
-
let valueStart = cursor;
|
|
681
|
-
const key = yamlKey(source, cursor, end);
|
|
682
|
-
if (key) {
|
|
683
|
-
pushToken(tokens, cursor, key.nameEnd, "property");
|
|
684
|
-
valueStart = key.colon + 1;
|
|
685
|
-
}
|
|
686
|
-
scanYamlValue(source, valueStart, end, tokens, "#");
|
|
687
|
-
if (/(?:^|\s)[|>][+-]?\d?\s*(?:#.*)?$/.test(text.slice(valueStart - start))) blockIndent = indent;
|
|
688
|
-
}
|
|
689
|
-
return tokens;
|
|
690
|
-
}
|
|
691
|
-
function scanIni(source, def) {
|
|
692
|
-
const tokens = [], comments = (def.line ?? []).join("");
|
|
693
|
-
for (const { start, end } of lineRanges(source)) {
|
|
694
|
-
const text = source.slice(start, end), indent = /^\s*/.exec(text)[0].length, first = text[indent];
|
|
695
|
-
if (first === void 0) continue;
|
|
696
|
-
if (comments.includes(first)) {
|
|
697
|
-
pushToken(tokens, start + indent, end, "comment");
|
|
698
|
-
continue;
|
|
699
|
-
}
|
|
700
|
-
if (first === "[") {
|
|
701
|
-
const close = text.indexOf("]", indent);
|
|
702
|
-
const stop = close < 0 ? end : start + close + 1;
|
|
703
|
-
pushToken(tokens, start + indent, stop, "type");
|
|
704
|
-
scanYamlValue(source, stop, end, tokens, comments);
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
const key = /^("[^"\n]*"|'[^'\n]*'|[^\s=:#;"']+(?:\s+[^\s=:#;"']+)*)\s*[=:]/.exec(text.slice(indent));
|
|
708
|
-
let valueStart = start + indent;
|
|
709
|
-
if (key) {
|
|
710
|
-
pushToken(tokens, start + indent, start + indent + key[1].length, "property");
|
|
711
|
-
valueStart = start + indent + key[0].length;
|
|
712
|
-
}
|
|
713
|
-
scanYamlValue(source, valueStart, end, tokens, comments);
|
|
714
|
-
}
|
|
715
|
-
return tokens;
|
|
716
|
-
}
|
|
717
|
-
function scanMarkup(source) {
|
|
718
|
-
const tokens = [];
|
|
719
|
-
let index = 0;
|
|
720
|
-
while (index < source.length) {
|
|
721
|
-
const open = source.indexOf("<", index);
|
|
722
|
-
if (open < 0) break;
|
|
723
|
-
if (source.startsWith("<!--", open)) {
|
|
724
|
-
const close = source.indexOf("-->", open + 4);
|
|
725
|
-
const end = close < 0 ? source.length : close + 3;
|
|
726
|
-
pushToken(tokens, open, end, "comment");
|
|
727
|
-
index = end;
|
|
728
|
-
continue;
|
|
729
|
-
}
|
|
730
|
-
if (source.startsWith("<![CDATA[", open)) {
|
|
731
|
-
const close = source.indexOf("]]>", open);
|
|
732
|
-
const end = close < 0 ? source.length : close + 3;
|
|
733
|
-
pushToken(tokens, open, end, "string");
|
|
734
|
-
index = end;
|
|
735
|
-
continue;
|
|
736
|
-
}
|
|
737
|
-
const name = /<([/?!]?)([A-Za-z][\w:.-]*|DOCTYPE)?/y;
|
|
738
|
-
name.lastIndex = open;
|
|
739
|
-
const found = name.exec(source);
|
|
740
|
-
if (!found || !found[2]) {
|
|
741
|
-
index = open + 1;
|
|
742
|
-
continue;
|
|
743
|
-
}
|
|
744
|
-
pushToken(tokens, open + 1, open + found[0].length, "keyword");
|
|
745
|
-
index = open + found[0].length;
|
|
746
|
-
while (index < source.length && source[index] !== ">") {
|
|
747
|
-
const character = source[index];
|
|
748
|
-
if (character === '"' || character === "'") {
|
|
749
|
-
const close = source.indexOf(character, index + 1);
|
|
750
|
-
const end = close < 0 ? source.length : close + 1;
|
|
751
|
-
pushToken(tokens, index, end, "string");
|
|
752
|
-
index = end;
|
|
753
|
-
continue;
|
|
754
|
-
}
|
|
755
|
-
const attribute = /[A-Za-z_:@#][\w:.@#-]*/y;
|
|
756
|
-
attribute.lastIndex = index;
|
|
757
|
-
const matched = attribute.exec(source);
|
|
758
|
-
if (matched) {
|
|
759
|
-
pushToken(tokens, index, index + matched[0].length, "property");
|
|
760
|
-
index += matched[0].length;
|
|
761
|
-
continue;
|
|
762
|
-
}
|
|
763
|
-
index++;
|
|
764
|
-
}
|
|
765
|
-
if (source[index] === ">") index++;
|
|
766
|
-
}
|
|
767
|
-
return tokens;
|
|
768
|
-
}
|
|
769
|
-
function scanCss(source) {
|
|
770
|
-
const tokens = [];
|
|
771
|
-
let index = 0, depth = 0;
|
|
772
|
-
while (index < source.length) {
|
|
773
|
-
const character = source[index];
|
|
774
|
-
if (/\s/.test(character)) {
|
|
775
|
-
index++;
|
|
776
|
-
continue;
|
|
777
|
-
}
|
|
778
|
-
if (source.startsWith("/*", index)) {
|
|
779
|
-
const close = source.indexOf("*/", index + 2);
|
|
780
|
-
const end = close < 0 ? source.length : close + 2;
|
|
781
|
-
pushToken(tokens, index, end, "comment");
|
|
782
|
-
index = end;
|
|
783
|
-
continue;
|
|
784
|
-
}
|
|
785
|
-
if (character === '"' || character === "'") {
|
|
786
|
-
const end = scanQuoted(source, index, character, true, false);
|
|
787
|
-
pushToken(tokens, index, end, "string");
|
|
788
|
-
index = end;
|
|
789
|
-
continue;
|
|
790
|
-
}
|
|
791
|
-
if (character === "{") {
|
|
792
|
-
depth++;
|
|
793
|
-
index++;
|
|
794
|
-
continue;
|
|
795
|
-
}
|
|
796
|
-
if (character === "}") {
|
|
797
|
-
depth = Math.max(0, depth - 1);
|
|
798
|
-
index++;
|
|
799
|
-
continue;
|
|
800
|
-
}
|
|
801
|
-
if (character === "@") {
|
|
802
|
-
const match = /@[\w-]+/y;
|
|
803
|
-
match.lastIndex = index;
|
|
804
|
-
const found2 = match.exec(source);
|
|
805
|
-
if (found2) {
|
|
806
|
-
pushToken(tokens, index, index + found2[0].length, "keyword");
|
|
807
|
-
index += found2[0].length;
|
|
808
|
-
continue;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
if (character === "!") {
|
|
812
|
-
const match = /!\s*important/y;
|
|
813
|
-
match.lastIndex = index;
|
|
814
|
-
const found2 = match.exec(source);
|
|
815
|
-
if (found2) {
|
|
816
|
-
pushToken(tokens, index, index + found2[0].length, "keyword");
|
|
817
|
-
index += found2[0].length;
|
|
818
|
-
continue;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
if (character === "#" && depth > 0) {
|
|
822
|
-
const match = /#[\da-fA-F]{3,8}\b/y;
|
|
823
|
-
match.lastIndex = index;
|
|
824
|
-
const found2 = match.exec(source);
|
|
825
|
-
if (found2) {
|
|
826
|
-
pushToken(tokens, index, index + found2[0].length, "number");
|
|
827
|
-
index += found2[0].length;
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if (depth > 0 && (/\d/.test(character) || (character === "-" || character === "." || character === "+") && /\d/.test(source[index + 1] ?? ""))) {
|
|
832
|
-
const match = /[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:%|[a-zA-Z]+)?/y;
|
|
833
|
-
match.lastIndex = index;
|
|
834
|
-
const found2 = match.exec(source);
|
|
835
|
-
if (found2 && !isIdentChar(source[index - 1])) {
|
|
836
|
-
pushToken(tokens, index, index + found2[0].length, "number");
|
|
837
|
-
index += found2[0].length;
|
|
838
|
-
continue;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
const word = /-?[\p{L}_][\p{L}\p{N}_-]*/uy;
|
|
842
|
-
word.lastIndex = index;
|
|
843
|
-
const found = word.exec(source);
|
|
844
|
-
if (found) {
|
|
845
|
-
const end = index + found[0].length;
|
|
846
|
-
let back = index - 1;
|
|
847
|
-
while (back >= 0 && /\s/.test(source[back])) back--;
|
|
848
|
-
const before = back >= 0 ? source[back] : "";
|
|
849
|
-
if (depth > 0 && /^\s*:(?!:)/.test(source.slice(end, end + 8)) && (before === "{" || before === ";" || before === "")) pushToken(tokens, index, end, "property");
|
|
850
|
-
else if (source[end] === "(") pushToken(tokens, index, end, "function");
|
|
851
|
-
index = end;
|
|
852
|
-
continue;
|
|
853
|
-
}
|
|
854
|
-
if (depth === 0 && (character === "." || character === "#")) {
|
|
855
|
-
const match = /[.#][\p{L}_-][\p{L}\p{N}_-]*/uy;
|
|
856
|
-
match.lastIndex = index;
|
|
857
|
-
const matched = match.exec(source);
|
|
858
|
-
if (matched) {
|
|
859
|
-
pushToken(tokens, index, index + matched[0].length, "type");
|
|
860
|
-
index += matched[0].length;
|
|
861
|
-
continue;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
index++;
|
|
865
|
-
}
|
|
866
|
-
return tokens;
|
|
867
|
-
}
|
|
868
|
-
function tokenizeCode(source, language2) {
|
|
869
|
-
const id = resolveCodeLanguage(language2);
|
|
870
|
-
if (id === void 0 || typeof source !== "string" || source.length === 0 || source.length > CODE_HIGHLIGHT_MAX_LENGTH) return [];
|
|
871
|
-
const def = LANGUAGES[id];
|
|
872
|
-
let tokens;
|
|
873
|
-
switch (def.kind) {
|
|
874
|
-
case "yaml":
|
|
875
|
-
tokens = scanYaml(source);
|
|
876
|
-
break;
|
|
877
|
-
case "ini":
|
|
878
|
-
tokens = scanIni(source, def);
|
|
879
|
-
break;
|
|
880
|
-
case "markup":
|
|
881
|
-
tokens = scanMarkup(source);
|
|
882
|
-
break;
|
|
883
|
-
case "css":
|
|
884
|
-
tokens = scanCss(source);
|
|
885
|
-
break;
|
|
886
|
-
default:
|
|
887
|
-
tokens = scanGeneric(source, def);
|
|
888
|
-
}
|
|
889
|
-
return tokens.filter((token) => token.end > token.start).sort((a, b) => a.start - b.start);
|
|
890
|
-
}
|
|
891
|
-
function codeLineRuns(tokens, start, end, source) {
|
|
892
|
-
const runs = [];
|
|
893
|
-
const push = (from, to, kind) => {
|
|
894
|
-
if (kind === void 0 || source === void 0 || !source.slice(from, to).includes(" ")) {
|
|
895
|
-
runs.push(kind === void 0 ? { start: from, end: to } : { start: from, end: to, kind });
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
898
|
-
let at = from;
|
|
899
|
-
for (let index = from; index < to; index++) {
|
|
900
|
-
if (source[index] !== " ") continue;
|
|
901
|
-
if (index > at) runs.push({ start: at, end: index, kind });
|
|
902
|
-
runs.push({ start: index, end: index + 1 });
|
|
903
|
-
at = index + 1;
|
|
904
|
-
}
|
|
905
|
-
if (at < to) runs.push({ start: at, end: to, kind });
|
|
906
|
-
};
|
|
907
|
-
let cursor = start;
|
|
908
|
-
for (const token of tokens) {
|
|
909
|
-
if (token.end <= start) continue;
|
|
910
|
-
if (token.start >= end) break;
|
|
911
|
-
const from = Math.max(token.start, start), to = Math.min(token.end, end);
|
|
912
|
-
if (from > cursor) push(cursor, from);
|
|
913
|
-
push(from, to, token.kind);
|
|
914
|
-
cursor = to;
|
|
915
|
-
}
|
|
916
|
-
if (cursor < end) push(cursor, end);
|
|
917
|
-
return runs;
|
|
918
|
-
}
|
|
919
|
-
var distance = (a, b) => Math.hypot(...channels(a).map((value, index) => value - channels(b)[index]));
|
|
920
|
-
var FALLBACK = { keyword: "#C4B5FD", string: "#86EFAC", number: "#FCD34D", function: "#93C5FD", type: "#67E8F9", property: "#F9A8D4", comment: "#94A3B8" };
|
|
921
|
-
function codeSyntaxPalette(theme2 = {}, options = {}) {
|
|
922
|
-
const background = normalize(options.background) ?? CODE_PANEL_BACKGROUND, plain = normalize(options.foreground) ?? CODE_PANEL_FOREGROUND;
|
|
923
|
-
const minimum = options.minimumContrast ?? CODE_SYNTAX_MIN_CONTRAST;
|
|
924
|
-
const palette = { plain: legible(plain, background, minimum) };
|
|
925
|
-
const taken = [palette.plain];
|
|
926
|
-
const slots = [["keyword", theme2.primary], ["string", theme2.accent], ["number", theme2.secondary], ["comment", theme2.mutedText], ["function", void 0], ["type", void 0], ["property", void 0]];
|
|
927
|
-
for (const [kind, themed] of slots) {
|
|
928
|
-
const candidates = [normalize(themed), FALLBACK[kind]].filter((value) => value !== void 0).map((value) => legible(value, background, minimum));
|
|
929
|
-
let [h, s, l] = toHsl(FALLBACK[kind]);
|
|
930
|
-
let pick = candidates.find((candidate) => taken.every((other) => distance(candidate, other) >= 48));
|
|
931
|
-
for (let turn = 0; pick === void 0 && turn < 9; turn++) {
|
|
932
|
-
h += 40;
|
|
933
|
-
const candidate = legible(fromHsl(h, s, l), background, minimum);
|
|
934
|
-
if (taken.every((other) => distance(candidate, other) >= 48)) pick = candidate;
|
|
935
|
-
}
|
|
936
|
-
palette[kind] = pick ?? candidates[candidates.length - 1];
|
|
937
|
-
taken.push(palette[kind]);
|
|
938
|
-
}
|
|
939
|
-
return palette;
|
|
940
|
-
}
|
|
941
|
-
function codeSyntaxPaletteForScheme(scheme, options = {}) {
|
|
942
|
-
const record = scheme && typeof scheme === "object" ? scheme : {};
|
|
943
|
-
const pick = (role, slot, fallback) => normalize(record[role]) ?? normalize(record[slot]) ?? fallback;
|
|
944
|
-
return codeSyntaxPalette({ primary: pick("primary", "accent1", "#2563EB"), secondary: pick("secondary", "accent2", "#0F766E"), accent: pick("accent", "accent3", "#F59E0B") }, options);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// src/metric-trend.ts
|
|
948
|
-
var METRIC_TREND_SHAPES = Object.freeze({ up: "upArrow", down: "downArrow", flat: "rightArrow" });
|
|
949
|
-
var METRIC_TREND_MIN_CONTRAST = 4.5;
|
|
950
|
-
var SEMANTIC = {
|
|
951
|
-
up: { light: "#15803D", dark: "#4ADE80" },
|
|
952
|
-
down: { light: "#B91C1C", dark: "#F87171" }
|
|
953
|
-
};
|
|
954
|
-
function metricTrendColor(trend, options) {
|
|
955
|
-
const background = normalize(options.background) ?? "#FFFFFF";
|
|
956
|
-
if (trend === "flat") return legible(normalize(options.neutral) ?? (luminance(background) < 0.5 ? "#CBD5E1" : "#475569"), background, METRIC_TREND_MIN_CONTRAST);
|
|
957
|
-
const pair = SEMANTIC[trend];
|
|
958
|
-
return legible(luminance(background) < 0.5 ? pair.dark : pair.light, background, METRIC_TREND_MIN_CONTRAST);
|
|
959
|
-
}
|
|
960
|
-
function metricTrendPoints(shape, box) {
|
|
961
|
-
const { x: l, y: t, width: w, height: h } = box, r = l + w, b = t + h, hc = l + w / 2, vc = t + h / 2, ss = Math.min(w, h);
|
|
962
|
-
if (shape === "rightArrow") {
|
|
963
|
-
const x12 = r - ss * 0.5, y1 = vc - h * 0.25, y22 = vc + h * 0.25;
|
|
964
|
-
return [[l, y1], [x12, y1], [x12, t], [r, vc], [x12, b], [x12, y22], [l, y22]];
|
|
965
|
-
}
|
|
966
|
-
const dy = ss * 0.5, x1 = hc - w * 0.25, x2 = hc + w * 0.25;
|
|
967
|
-
if (shape === "upArrow") {
|
|
968
|
-
const y22 = t + dy;
|
|
969
|
-
return [[l, y22], [hc, t], [r, y22], [x2, y22], [x2, b], [x1, b], [x1, y22]];
|
|
970
|
-
}
|
|
971
|
-
const y2 = b - dy;
|
|
972
|
-
return [[l, y2], [x1, y2], [x1, t], [x2, t], [x2, y2], [r, y2], [hc, b]];
|
|
973
|
-
}
|
|
974
|
-
function metricTrendMark(layout2, options) {
|
|
975
|
-
const part = layout2.parts.find((candidate) => candidate.role === "trend");
|
|
976
|
-
if (!part || !part.visible || !part.fit || part.fit.sourceLines.length === 0) return void 0;
|
|
977
|
-
const trend = part.text.trim();
|
|
978
|
-
if (!Object.hasOwn(METRIC_TREND_SHAPES, trend)) return void 0;
|
|
979
|
-
const line = part.fit.sourceLines[0], origin = part.linePositions[0];
|
|
980
|
-
if (!origin || line.width <= 0) return void 0;
|
|
981
|
-
const size = part.fit.fontSize * 0.72, gap = part.fit.fontSize * 0.3, left = part.box.x, right = part.box.x + part.box.width;
|
|
982
|
-
const after = origin.x + line.width + gap, before = origin.x - gap - size;
|
|
983
|
-
const fitsAfter = after + size <= right + 0.01, fitsBefore = before >= left - 0.01;
|
|
984
|
-
const x = layout2.alignment === "left" ? fitsAfter ? after : fitsBefore ? before : void 0 : fitsBefore ? before : fitsAfter ? after : void 0;
|
|
985
|
-
if (x === void 0) return void 0;
|
|
986
|
-
const shape = METRIC_TREND_SHAPES[trend], box = { x, y: origin.baseline - size, width: size, height: size };
|
|
987
|
-
return { trend, shape, box, points: metricTrendPoints(shape, box), color: metricTrendColor(trend, options), ariaLabel: `Trend: ${trend}`, path: part.path };
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
// src/pattern-fills.ts
|
|
991
|
-
var PATTERN_PRESETS = Object.freeze([
|
|
992
|
-
"pct5",
|
|
993
|
-
"pct10",
|
|
994
|
-
"pct20",
|
|
995
|
-
"pct25",
|
|
996
|
-
"pct30",
|
|
997
|
-
"pct40",
|
|
998
|
-
"pct50",
|
|
999
|
-
"pct60",
|
|
1000
|
-
"pct70",
|
|
1001
|
-
"pct75",
|
|
1002
|
-
"pct80",
|
|
1003
|
-
"pct90",
|
|
1004
|
-
"horz",
|
|
1005
|
-
"vert",
|
|
1006
|
-
"ltHorz",
|
|
1007
|
-
"ltVert",
|
|
1008
|
-
"dkHorz",
|
|
1009
|
-
"dkVert",
|
|
1010
|
-
"narHorz",
|
|
1011
|
-
"narVert",
|
|
1012
|
-
"dashHorz",
|
|
1013
|
-
"dashVert",
|
|
1014
|
-
"cross",
|
|
1015
|
-
"dnDiag",
|
|
1016
|
-
"upDiag",
|
|
1017
|
-
"ltDnDiag",
|
|
1018
|
-
"ltUpDiag",
|
|
1019
|
-
"dkDnDiag",
|
|
1020
|
-
"dkUpDiag",
|
|
1021
|
-
"wdDnDiag",
|
|
1022
|
-
"wdUpDiag",
|
|
1023
|
-
"dashDnDiag",
|
|
1024
|
-
"dashUpDiag",
|
|
1025
|
-
"diagCross",
|
|
1026
|
-
"smCheck",
|
|
1027
|
-
"lgCheck",
|
|
1028
|
-
"smGrid",
|
|
1029
|
-
"lgGrid",
|
|
1030
|
-
"dotGrid",
|
|
1031
|
-
"smConfetti",
|
|
1032
|
-
"lgConfetti",
|
|
1033
|
-
"horzBrick",
|
|
1034
|
-
"diagBrick",
|
|
1035
|
-
"solidDmnd",
|
|
1036
|
-
"openDmnd",
|
|
1037
|
-
"dotDmnd",
|
|
1038
|
-
"plaid",
|
|
1039
|
-
"sphere",
|
|
1040
|
-
"weave",
|
|
1041
|
-
"divot",
|
|
1042
|
-
"shingle",
|
|
1043
|
-
"wave",
|
|
1044
|
-
"trellis",
|
|
1045
|
-
"zigZag"
|
|
1046
|
-
]);
|
|
1047
|
-
var PATTERN_PRESET_ALIASES = Object.freeze({ diagStripe: "wdUpDiag" });
|
|
1048
|
-
var PATTERN_TILE_SIZE = 8;
|
|
1049
|
-
var MEASURED = {
|
|
1050
|
-
pct5: "#......./......../......../......../....#.../......../......../........",
|
|
1051
|
-
pct10: "#......./......../....#.../......../#......./......../....#.../........",
|
|
1052
|
-
pct20: "#...#.../......../..#...#./......../#...#.../......../..#...#./........",
|
|
1053
|
-
pct25: "#...#.../..#...#./#...#.../..#...#./#...#.../..#...#./#...#.../..#...#.",
|
|
1054
|
-
pct30: "#.#.#.#./.#...#../#.#.#.#./...#...#/#.#.#.#./.#...#../#.#.#.#./...#...#",
|
|
1055
|
-
pct40: "#.#.#.#./.#.#.#.#/#.#.#.#./.#.#...#/#.#.#.#./.#.#.#.#/#.#.#.#./...#.#.#",
|
|
1056
|
-
pct50: "#.#.#.#./.#.#.#.#/#.#.#.#./.#.#.#.#/#.#.#.#./.#.#.#.#/#.#.#.#./.#.#.#.#",
|
|
1057
|
-
pct60: "###.###./.#.#.#.#/#.###.##/.#.#.#.#/###.###./.#.#.#.#/#.###.##/.#.#.#.#",
|
|
1058
|
-
pct70: ".###.###/##.###.#/.###.###/##.###.#/.###.###/##.###.#/.###.###/##.###.#",
|
|
1059
|
-
pct75: ".###.###/########/##.###.#/########/.###.###/########/##.###.#/########",
|
|
1060
|
-
pct80: "###.####/########/#######./########/###.####/########/#######./########",
|
|
1061
|
-
pct90: "########/########/########/####.###/########/########/########/.#######",
|
|
1062
|
-
horz: "########/......../......../......../......../......../......../........",
|
|
1063
|
-
vert: "#......./#......./#......./#......./#......./#......./#......./#.......",
|
|
1064
|
-
ltHorz: "########/......../......../......../########/......../......../........",
|
|
1065
|
-
ltVert: "#...#.../#...#.../#...#.../#...#.../#...#.../#...#.../#...#.../#...#...",
|
|
1066
|
-
dkHorz: "########/########/......../......../########/########/......../........",
|
|
1067
|
-
dkVert: "##..##../##..##../##..##../##..##../##..##../##..##../##..##../##..##..",
|
|
1068
|
-
narHorz: "########/......../########/......../########/......../########/........",
|
|
1069
|
-
narVert: ".#.#.#.#/.#.#.#.#/.#.#.#.#/.#.#.#.#/.#.#.#.#/.#.#.#.#/.#.#.#.#/.#.#.#.#",
|
|
1070
|
-
dashHorz: "####..../......../......../......../....####/......../......../........",
|
|
1071
|
-
dashVert: "#......./#......./#......./#......./....#.../....#.../....#.../....#...",
|
|
1072
|
-
cross: "########/#......./#......./#......./#......./#......./#......./#.......",
|
|
1073
|
-
dnDiag: "#......./.#....../..#...../...#..../....#.../.....#../......#./.......#",
|
|
1074
|
-
upDiag: ".......#/......#./.....#../....#.../...#..../..#...../.#....../#.......",
|
|
1075
|
-
ltDnDiag: "#...#.../.#...#../..#...#./...#...#/#...#.../.#...#../..#...#./...#...#",
|
|
1076
|
-
ltUpDiag: "...#...#/..#...#./.#...#../#...#.../...#...#/..#...#./.#...#../#...#...",
|
|
1077
|
-
dkDnDiag: "##..##../.##..##./..##..##/#..##..#/##..##../.##..##./..##..##/#..##..#",
|
|
1078
|
-
dkUpDiag: "..##..##/.##..##./##..##../#..##..#/..##..##/.##..##./##..##../#..##..#",
|
|
1079
|
-
wdDnDiag: "##.....#/###...../.###..../..###.../...###../....###./.....###/#.....##",
|
|
1080
|
-
wdUpDiag: "#.....##/.....###/....###./...###../..###.../.###..../###...../##.....#",
|
|
1081
|
-
dashDnDiag: "......../......../#...#.../.#...#../..#...#./...#...#/......../........",
|
|
1082
|
-
dashUpDiag: "......../......../...#...#/..#...#./.#...#../#...#.../......../........",
|
|
1083
|
-
diagCross: "#......#/.#....#./..#..#../...##.../...##.../..#..#../.#....#./#......#",
|
|
1084
|
-
smCheck: "#..##..#/.##..##./.##..##./#..##..#/#..##..#/.##..##./.##..##./#..##..#",
|
|
1085
|
-
lgCheck: "####..../####..../####..../####..../....####/....####/....####/....####",
|
|
1086
|
-
smGrid: "########/#...#.../#...#.../#...#.../########/#...#.../#...#.../#...#...",
|
|
1087
|
-
lgGrid: "########/#......./#......./#......./#......./#......./#......./#.......",
|
|
1088
|
-
dotGrid: "#.#.#.#./......../#......./......../#......./......../#......./........",
|
|
1089
|
-
smConfetti: "#......./....#.../.#....../......#./...#..../.......#/..#...../.....#..",
|
|
1090
|
-
lgConfetti: "#.##...#/..##..../......##/...##.##/##.##.../##....../....##../#...##.#",
|
|
1091
|
-
horzBrick: "########/#......./#......./#......./########/....#.../....#.../....#...",
|
|
1092
|
-
diagBrick: ".......#/......#./.....#../....#.../...##.../..#..#../.#....#./#......#",
|
|
1093
|
-
solidDmnd: "...#..../..###.../.#####../#######./.#####../..###.../...#..../........",
|
|
1094
|
-
openDmnd: "#.....#./.#...#../..#.#.../...#..../..#.#.../.#...#../#.....#./.......#",
|
|
1095
|
-
dotDmnd: "#......./......../..#...#./......../....#.../......../..#...#./........",
|
|
1096
|
-
plaid: "#.#.#.#./.#.#.#.#/#.#.#.#./.#.#.#.#/####..../####..../####..../####....",
|
|
1097
|
-
sphere: ".###.###/#...#..#/#...####/#...####/.###.###/#..##.../#####.../#####...",
|
|
1098
|
-
weave: "#...#.../.#.#.#../..#...#./.#...#.#/#...#.../...#.#../..#...#./.#.#...#",
|
|
1099
|
-
divot: "......../...#..../....#.../...#..../......../#......./.......#/#.......",
|
|
1100
|
-
shingle: "......##/#....#../.#..#.../..##..../....##../......#./.......#/.......#",
|
|
1101
|
-
wave: "......../...##.../..#..#.#/##....../......../...##.../..#..#.#/##......",
|
|
1102
|
-
trellis: "########/.##..##./########/#..##..#/########/.##..##./########/#..##..#",
|
|
1103
|
-
zigZag: "#......#/.#....#./..#..#../...##.../#......#/.#....#./..#..#../...##..."
|
|
1104
|
-
};
|
|
1105
|
-
function rows(preset) {
|
|
1106
|
-
const art = MEASURED[preset];
|
|
1107
|
-
if (!art) return void 0;
|
|
1108
|
-
return art.split("/").map((row) => [...row].reduce((bits, cell, index) => cell === "#" ? bits | 128 >> index : bits, 0));
|
|
1109
|
-
}
|
|
1110
|
-
var BITMAPS = /* @__PURE__ */ new Map();
|
|
1111
|
-
for (const preset of PATTERN_PRESETS) {
|
|
1112
|
-
const bitmap = rows(preset);
|
|
1113
|
-
if (bitmap) BITMAPS.set(preset, Object.freeze(bitmap));
|
|
1114
|
-
}
|
|
1115
|
-
function resolvePatternPreset(preset) {
|
|
1116
|
-
if (typeof preset !== "string") return void 0;
|
|
1117
|
-
if (BITMAPS.has(preset)) return preset;
|
|
1118
|
-
return Object.hasOwn(PATTERN_PRESET_ALIASES, preset) ? PATTERN_PRESET_ALIASES[preset] : void 0;
|
|
1119
|
-
}
|
|
1120
|
-
function patternBitmap(preset) {
|
|
1121
|
-
const resolved = resolvePatternPreset(preset);
|
|
1122
|
-
return resolved === void 0 ? void 0 : BITMAPS.get(resolved);
|
|
1123
|
-
}
|
|
1124
|
-
function patternRuns(preset) {
|
|
1125
|
-
const bitmap = patternBitmap(preset);
|
|
1126
|
-
if (!bitmap) return void 0;
|
|
1127
|
-
const runs = [];
|
|
1128
|
-
bitmap.forEach((row, y) => {
|
|
1129
|
-
for (let x = 0; x < 8; x++) {
|
|
1130
|
-
if (!(row & 128 >> x)) continue;
|
|
1131
|
-
const start = x;
|
|
1132
|
-
while (x + 1 < 8 && row & 128 >> x + 1) x++;
|
|
1133
|
-
runs.push({ x: start, y, width: x - start + 1 });
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
return runs;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
export { CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, bundlePresentation, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForScheme, metricTrendColor, metricTrendMark, metricTrendPoints, patternBitmap, patternRuns, resolveCodeLanguage, resolvePatternPreset, tokenizeCode };
|
|
726
|
+
export { bundle, stats };
|