@openpresentation/opf 0.13.0 → 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.
Files changed (417) hide show
  1. package/README.md +28 -23
  2. package/dist/{catalogs-ywCamd8C.d.ts → catalogs-D-yyQWCQ.d.ts} +86 -208
  3. package/dist/catalogs.d.ts +2 -2
  4. package/dist/catalogs.js +1 -1
  5. package/dist/{chart-data-Cdr6rRVV.d.ts → chart-data-B_3z9VTb.d.ts} +16 -5
  6. package/dist/chunk-4LDGKLUC.js +192 -0
  7. package/dist/{chunk-II5EYKZU.js → chunk-4VJDTF55.js} +2 -92
  8. package/dist/chunk-5ZU6JAPP.js +83 -0
  9. package/dist/{chunk-MPM7NRG7.js → chunk-6OXY2CP3.js} +1716 -744
  10. package/dist/{chunk-IS2CPNVJ.js → chunk-BFLVSVA7.js} +26 -26
  11. package/dist/chunk-CSQHPVGL.js +94 -0
  12. package/dist/{chunk-GJKJL4YY.js → chunk-D3TY4TT6.js} +34 -412
  13. package/dist/chunk-JDJBDYSR.js +4167 -0
  14. package/dist/{chunk-7QBCWNWL.js → chunk-LS2FMPI5.js} +1086 -1092
  15. package/dist/{chunk-ATGDDJPX.js → chunk-Q2TCMN56.js} +3 -3
  16. package/dist/chunk-UPQQD7MA.js +1840 -0
  17. package/dist/{chunk-RAYB46AB.js → chunk-XIZUK2XM.js} +32 -30
  18. package/dist/{chunk-E34DJ5LL.js → chunk-XOZ4KMSR.js} +2427 -10820
  19. package/dist/chunk-Z65B2B77.js +601 -0
  20. package/dist/{composition-D7we69Tr.d.ts → composition-_WEwBe2a.d.ts} +738 -27
  21. package/dist/composition.d.ts +2 -2
  22. package/dist/composition.js +2 -2
  23. package/dist/convert.d.ts +9 -7
  24. package/dist/convert.js +33 -19
  25. package/dist/data.d.ts +4 -4
  26. package/dist/data.js +3 -3
  27. package/dist/diff.d.ts +4 -4
  28. package/dist/diff.js +6 -604
  29. package/dist/docs.js +54 -42
  30. package/dist/examples.d.ts +1 -1
  31. package/dist/examples.js +1366 -2908
  32. package/dist/finding-C_por275.d.ts +212 -0
  33. package/dist/format.d.ts +4 -4
  34. package/dist/format.js +2 -83
  35. package/dist/index.d.ts +318 -284
  36. package/dist/index.js +530 -943
  37. package/dist/markdown.d.ts +28 -27
  38. package/dist/markdown.js +8 -1940
  39. package/dist/pagination-BZpXLvFL.d.ts +119 -0
  40. package/dist/pagination.d.ts +5 -61
  41. package/dist/pagination.js +5 -5
  42. package/dist/patch.d.ts +12 -23
  43. package/dist/patch.js +5 -5
  44. package/dist/{presentation-mG-IYErQ.d.ts → presentation-C5eHkevA.d.ts} +350 -506
  45. package/dist/repo-readme.js +1 -1
  46. package/dist/{schemas-BbPonsTz.d.ts → schemas-DDpqAgyS.d.ts} +31 -17
  47. package/dist/schemas.d.ts +1 -1
  48. package/dist/schemas.js +1 -1
  49. package/dist/spec/README.md +10 -5
  50. package/dist/spec/catalogs/audiences/index.json +2 -50
  51. package/dist/spec/catalogs/chart-types/100pct-stacked-area.json +21 -0
  52. package/dist/spec/catalogs/chart-types/100pct-stacked-bar.json +22 -0
  53. package/dist/spec/catalogs/chart-types/100pct-stacked-column.json +22 -0
  54. package/dist/spec/catalogs/chart-types/area.json +2 -60
  55. package/dist/spec/catalogs/chart-types/bar.json +2 -48
  56. package/dist/spec/catalogs/chart-types/box-and-whisker.json +2 -132
  57. package/dist/spec/catalogs/chart-types/column.json +2 -52
  58. package/dist/spec/catalogs/chart-types/combo.json +37 -0
  59. package/dist/spec/catalogs/chart-types/doughnut.json +2 -40
  60. package/dist/spec/catalogs/chart-types/filled-radar.json +2 -52
  61. package/dist/spec/catalogs/chart-types/funnel.json +2 -46
  62. package/dist/spec/catalogs/chart-types/histogram.json +2 -149
  63. package/dist/spec/catalogs/chart-types/index.json +50 -520
  64. package/dist/spec/catalogs/chart-types/line-with-markers.json +2 -60
  65. package/dist/spec/catalogs/chart-types/line.json +2 -60
  66. package/dist/spec/catalogs/chart-types/pareto.json +2 -50
  67. package/dist/spec/catalogs/chart-types/pie.json +2 -40
  68. package/dist/spec/catalogs/chart-types/radar-with-markers.json +2 -52
  69. package/dist/spec/catalogs/chart-types/radar.json +2 -52
  70. package/dist/spec/catalogs/chart-types/scatter.json +2 -73
  71. package/dist/spec/catalogs/chart-types/stacked-area.json +21 -0
  72. package/dist/spec/catalogs/chart-types/stacked-bar.json +22 -0
  73. package/dist/spec/catalogs/chart-types/stacked-column.json +22 -0
  74. package/dist/spec/catalogs/chart-types/stacked-line-with-markers.json +22 -0
  75. package/dist/spec/catalogs/chart-types/stacked-line.json +21 -0
  76. package/dist/spec/catalogs/chart-types/treemap.json +2 -48
  77. package/dist/spec/catalogs/chart-types/waterfall.json +2 -52
  78. package/dist/spec/catalogs/chart-types/world.json +2 -64
  79. package/dist/spec/catalogs/font-schemes/angsana-new.json +2 -2
  80. package/dist/spec/catalogs/font-schemes/aparajita.json +3 -3
  81. package/dist/spec/catalogs/font-schemes/aptos.json +1 -1
  82. package/dist/spec/catalogs/font-schemes/arabic-typesetting.json +2 -2
  83. package/dist/spec/catalogs/font-schemes/arial.json +1 -1
  84. package/dist/spec/catalogs/font-schemes/batang.json +2 -2
  85. package/dist/spec/catalogs/font-schemes/bookman.json +1 -1
  86. package/dist/spec/catalogs/font-schemes/calibri.json +1 -1
  87. package/dist/spec/catalogs/font-schemes/century-schoolbook.json +1 -1
  88. package/dist/spec/catalogs/font-schemes/consolas.json +2 -4
  89. package/dist/spec/catalogs/font-schemes/constantia.json +1 -1
  90. package/dist/spec/catalogs/font-schemes/courier-new.json +2 -4
  91. package/dist/spec/catalogs/font-schemes/daunpenh.json +2 -2
  92. package/dist/spec/catalogs/font-schemes/david.json +2 -2
  93. package/dist/spec/catalogs/font-schemes/dilleniaupc.json +2 -2
  94. package/dist/spec/catalogs/font-schemes/fangsong.json +2 -2
  95. package/dist/spec/catalogs/font-schemes/garamond.json +1 -1
  96. package/dist/spec/catalogs/font-schemes/gautami.json +2 -2
  97. package/dist/spec/catalogs/font-schemes/georgia.json +1 -1
  98. package/dist/spec/catalogs/font-schemes/gisha.json +3 -3
  99. package/dist/spec/catalogs/font-schemes/grandview.json +1 -1
  100. package/dist/spec/catalogs/font-schemes/gungsuh.json +2 -2
  101. package/dist/spec/catalogs/font-schemes/impact.json +1 -1
  102. package/dist/spec/catalogs/font-schemes/index.json +1 -1
  103. package/dist/spec/catalogs/font-schemes/kalinga.json +2 -2
  104. package/dist/spec/catalogs/font-schemes/kartika.json +2 -2
  105. package/dist/spec/catalogs/font-schemes/khmer-ui.json +2 -2
  106. package/dist/spec/catalogs/font-schemes/latha.json +2 -2
  107. package/dist/spec/catalogs/font-schemes/lucida-sans.json +1 -1
  108. package/dist/spec/catalogs/font-schemes/malgun-gothic.json +2 -2
  109. package/dist/spec/catalogs/font-schemes/mangal.json +4 -5
  110. package/dist/spec/catalogs/font-schemes/meiryo.json +2 -2
  111. package/dist/spec/catalogs/font-schemes/microsoft-jhenghei.json +2 -2
  112. package/dist/spec/catalogs/font-schemes/microsoft-yahei.json +5 -5
  113. package/dist/spec/catalogs/font-schemes/mingliu.json +2 -2
  114. package/dist/spec/catalogs/font-schemes/miriam.json +2 -2
  115. package/dist/spec/catalogs/font-schemes/montserrat.json +1 -1
  116. package/dist/spec/catalogs/font-schemes/ms-mincho.json +2 -2
  117. package/dist/spec/catalogs/font-schemes/nirmala-ui.json +2 -2
  118. package/dist/spec/catalogs/font-schemes/noto-naksh-arabic.json +2 -2
  119. package/dist/spec/catalogs/font-schemes/noto-nastaliq-urdu.json +3 -3
  120. package/dist/spec/catalogs/font-schemes/noto-sans-arabic.json +4 -4
  121. package/dist/spec/catalogs/font-schemes/noto-sans-armenian.json +2 -2
  122. package/dist/spec/catalogs/font-schemes/noto-sans-bengali.json +3 -3
  123. package/dist/spec/catalogs/font-schemes/noto-sans-devangari.json +3 -3
  124. package/dist/spec/catalogs/font-schemes/noto-sans-ethiopic.json +2 -2
  125. package/dist/spec/catalogs/font-schemes/noto-sans-georgian.json +2 -2
  126. package/dist/spec/catalogs/font-schemes/noto-sans-gujarati.json +2 -2
  127. package/dist/spec/catalogs/font-schemes/noto-sans-gurmukhi.json +2 -2
  128. package/dist/spec/catalogs/font-schemes/noto-sans-hebrew.json +2 -2
  129. package/dist/spec/catalogs/font-schemes/noto-sans-jp.json +2 -2
  130. package/dist/spec/catalogs/font-schemes/noto-sans-kannada.json +2 -2
  131. package/dist/spec/catalogs/font-schemes/noto-sans-khmer.json +2 -2
  132. package/dist/spec/catalogs/font-schemes/noto-sans-kr.json +2 -2
  133. package/dist/spec/catalogs/font-schemes/noto-sans-malayalam.json +2 -2
  134. package/dist/spec/catalogs/font-schemes/noto-sans-mongolian.json +2 -2
  135. package/dist/spec/catalogs/font-schemes/noto-sans-oriya.json +2 -2
  136. package/dist/spec/catalogs/font-schemes/noto-sans-sc.json +5 -5
  137. package/dist/spec/catalogs/font-schemes/noto-sans-tamil.json +2 -2
  138. package/dist/spec/catalogs/font-schemes/noto-sans-tc.json +2 -2
  139. package/dist/spec/catalogs/font-schemes/noto-sans-telugu.json +2 -2
  140. package/dist/spec/catalogs/font-schemes/noto-sans-thai.json +2 -2
  141. package/dist/spec/catalogs/font-schemes/noto-sans.json +5 -5
  142. package/dist/spec/catalogs/font-schemes/nyala.json +2 -2
  143. package/dist/spec/catalogs/font-schemes/open-sans.json +1 -1
  144. package/dist/spec/catalogs/font-schemes/pmingliu.json +2 -2
  145. package/dist/spec/catalogs/font-schemes/poppins.json +1 -1
  146. package/dist/spec/catalogs/font-schemes/pt-serif.json +1 -1
  147. package/dist/spec/catalogs/font-schemes/raavi.json +2 -2
  148. package/dist/spec/catalogs/font-schemes/raleway.json +1 -1
  149. package/dist/spec/catalogs/font-schemes/roboto.json +1 -1
  150. package/dist/spec/catalogs/font-schemes/rockwell.json +1 -1
  151. package/dist/spec/catalogs/font-schemes/sakkal-majalla.json +4 -4
  152. package/dist/spec/catalogs/font-schemes/seaford.json +1 -1
  153. package/dist/spec/catalogs/font-schemes/segoe-ui-light.json +1 -1
  154. package/dist/spec/catalogs/font-schemes/segoe-ui.json +1 -1
  155. package/dist/spec/catalogs/font-schemes/shonar-bangla.json +3 -3
  156. package/dist/spec/catalogs/font-schemes/shruti.json +2 -2
  157. package/dist/spec/catalogs/font-schemes/simsun.json +2 -2
  158. package/dist/spec/catalogs/font-schemes/skeena.json +1 -1
  159. package/dist/spec/catalogs/font-schemes/sylfaen.json +3 -3
  160. package/dist/spec/catalogs/font-schemes/tahoma.json +1 -1
  161. package/dist/spec/catalogs/font-schemes/tenorite.json +1 -1
  162. package/dist/spec/catalogs/font-schemes/times-new-roman.json +1 -1
  163. package/dist/spec/catalogs/font-schemes/traditional-arabic.json +4 -4
  164. package/dist/spec/catalogs/font-schemes/trebuchet-ms.json +1 -1
  165. package/dist/spec/catalogs/font-schemes/tunga.json +2 -2
  166. package/dist/spec/catalogs/font-schemes/verdana.json +1 -1
  167. package/dist/spec/catalogs/font-schemes/vrinda.json +2 -2
  168. package/dist/spec/catalogs/font-schemes/yu-gothic.json +2 -2
  169. package/dist/spec/catalogs/layouts/action-plan.json +9 -15
  170. package/dist/spec/catalogs/layouts/agenda.json +8 -15
  171. package/dist/spec/catalogs/layouts/appendix-index.json +7 -15
  172. package/dist/spec/catalogs/layouts/architecture-stack.json +9 -15
  173. package/dist/spec/catalogs/layouts/assumptions-dependencies.json +9 -15
  174. package/dist/spec/catalogs/layouts/before-after.json +9 -15
  175. package/dist/spec/catalogs/layouts/benchmark-target-table.json +9 -15
  176. package/dist/spec/catalogs/layouts/blank.json +11 -1
  177. package/dist/spec/catalogs/layouts/bullet-list.json +9 -15
  178. package/dist/spec/catalogs/layouts/business-model-canvas.json +9 -15
  179. package/dist/spec/catalogs/layouts/capability-map.json +14 -16
  180. package/dist/spec/catalogs/layouts/case-study.json +9 -15
  181. package/dist/spec/catalogs/layouts/chapter-recap.json +8 -15
  182. package/dist/spec/catalogs/layouts/chart-1x.json +15 -0
  183. package/dist/spec/catalogs/layouts/chart-2x.json +15 -0
  184. package/dist/spec/catalogs/layouts/chart-3x.json +15 -0
  185. package/dist/spec/catalogs/layouts/circular-lifecycle.json +9 -15
  186. package/dist/spec/catalogs/layouts/code-1x.json +10 -0
  187. package/dist/spec/catalogs/layouts/comparison.json +9 -15
  188. package/dist/spec/catalogs/layouts/competitive-landscape.json +14 -16
  189. package/dist/spec/catalogs/layouts/customer-journey.json +14 -16
  190. package/dist/spec/catalogs/layouts/customer-logos.json +9 -15
  191. package/dist/spec/catalogs/layouts/dashboard.json +9 -15
  192. package/dist/spec/catalogs/layouts/data-visualization.json +9 -15
  193. package/dist/spec/catalogs/layouts/decision-tree.json +14 -16
  194. package/dist/spec/catalogs/layouts/detailed-data-table.json +9 -15
  195. package/dist/spec/catalogs/layouts/ecosystem-map.json +14 -16
  196. package/dist/spec/catalogs/layouts/executive-decision.json +9 -15
  197. package/dist/spec/catalogs/layouts/executive-summary.json +9 -15
  198. package/dist/spec/catalogs/layouts/extract/canonical.json +8 -8
  199. package/dist/spec/catalogs/layouts/faq.json +9 -15
  200. package/dist/spec/catalogs/layouts/feature-comparison-matrix.json +9 -15
  201. package/dist/spec/catalogs/layouts/forecast-scenario.json +9 -15
  202. package/dist/spec/catalogs/layouts/funnel-pyramid.json +9 -15
  203. package/dist/spec/catalogs/layouts/gantt-project-plan.json +9 -15
  204. package/dist/spec/catalogs/layouts/geographic-map.json +13 -15
  205. package/dist/spec/catalogs/layouts/heatmap-cohort.json +9 -15
  206. package/dist/spec/catalogs/layouts/hub-and-spoke.json +9 -15
  207. package/dist/spec/catalogs/layouts/icon-grid.json +14 -16
  208. package/dist/spec/catalogs/layouts/image-1x.json +11 -1
  209. package/dist/spec/catalogs/layouts/image-2x.json +12 -2
  210. package/dist/spec/catalogs/layouts/image-3x.json +13 -3
  211. package/dist/spec/catalogs/layouts/image-bleed.json +12 -2
  212. package/dist/spec/catalogs/layouts/image-focus.json +14 -16
  213. package/dist/spec/catalogs/layouts/index.json +1 -1
  214. package/dist/spec/catalogs/layouts/key-takeaway.json +8 -15
  215. package/dist/spec/catalogs/layouts/kpi-scorecard.json +9 -15
  216. package/dist/spec/catalogs/layouts/list-1x.json +17 -1
  217. package/dist/spec/catalogs/layouts/list-2x.json +16 -0
  218. package/dist/spec/catalogs/layouts/list-3x.json +16 -0
  219. package/dist/spec/catalogs/layouts/list-4x.json +16 -0
  220. package/dist/spec/catalogs/layouts/list-5x.json +16 -0
  221. package/dist/spec/catalogs/layouts/list-6x.json +16 -0
  222. package/dist/spec/catalogs/layouts/logic-tree.json +9 -15
  223. package/dist/spec/catalogs/layouts/market-size.json +9 -15
  224. package/dist/spec/catalogs/layouts/matrix-quadrant.json +9 -15
  225. package/dist/spec/catalogs/layouts/media-1x.json +11 -1
  226. package/dist/spec/catalogs/layouts/network-dependency-map.json +13 -15
  227. package/dist/spec/catalogs/layouts/number-1x.json +16 -1
  228. package/dist/spec/catalogs/layouts/number-2x.json +15 -0
  229. package/dist/spec/catalogs/layouts/number-3x.json +15 -0
  230. package/dist/spec/catalogs/layouts/number-4x.json +15 -0
  231. package/dist/spec/catalogs/layouts/number-5x.json +15 -0
  232. package/dist/spec/catalogs/layouts/number-6x.json +15 -0
  233. package/dist/spec/catalogs/layouts/one-column-explainer.json +9 -15
  234. package/dist/spec/catalogs/layouts/org-chart.json +9 -15
  235. package/dist/spec/catalogs/layouts/persona-grid.json +14 -16
  236. package/dist/spec/catalogs/layouts/photo-grid.json +17 -19
  237. package/dist/spec/catalogs/layouts/pricing-table.json +9 -15
  238. package/dist/spec/catalogs/layouts/process-flow.json +9 -15
  239. package/dist/spec/catalogs/layouts/product-feature.json +14 -16
  240. package/dist/spec/catalogs/layouts/pros-cons.json +9 -15
  241. package/dist/spec/catalogs/layouts/qa-discussion.json +7 -15
  242. package/dist/spec/catalogs/layouts/quote-1x.json +11 -1
  243. package/dist/spec/catalogs/layouts/quote-highlight.json +9 -15
  244. package/dist/spec/catalogs/layouts/raci-matrix.json +9 -15
  245. package/dist/spec/catalogs/layouts/risk-heatmap.json +9 -15
  246. package/dist/spec/catalogs/layouts/roadmap.json +9 -15
  247. package/dist/spec/catalogs/layouts/screenshot-walkthrough.json +14 -16
  248. package/dist/spec/catalogs/layouts/section-divider.json +8 -15
  249. package/dist/spec/catalogs/layouts/single-message-statement.json +8 -15
  250. package/dist/spec/catalogs/layouts/stats-metrics.json +9 -15
  251. package/dist/spec/catalogs/layouts/status-rag.json +9 -15
  252. package/dist/spec/catalogs/layouts/swimlane-process.json +14 -16
  253. package/dist/spec/catalogs/layouts/swot-analysis.json +9 -15
  254. package/dist/spec/catalogs/layouts/table-1x.json +10 -0
  255. package/dist/spec/catalogs/layouts/team-bio.json +14 -16
  256. package/dist/spec/catalogs/layouts/testimonial-grid.json +9 -15
  257. package/dist/spec/catalogs/layouts/text-1x.json +11 -1
  258. package/dist/spec/catalogs/layouts/text-2x.json +10 -0
  259. package/dist/spec/catalogs/layouts/text-3x.json +10 -0
  260. package/dist/spec/catalogs/layouts/thank-you-cta.json +8 -15
  261. package/dist/spec/catalogs/layouts/three-column.json +9 -15
  262. package/dist/spec/catalogs/layouts/timeline-1x.json +11 -1
  263. package/dist/spec/catalogs/layouts/timeline.json +9 -15
  264. package/dist/spec/catalogs/layouts/title-slide.json +8 -15
  265. package/dist/spec/catalogs/layouts/title-subtitle.json +11 -1
  266. package/dist/spec/catalogs/layouts/title.json +11 -1
  267. package/dist/spec/catalogs/layouts/two-column.json +9 -15
  268. package/dist/spec/catalogs/layouts/venn-overlap.json +9 -15
  269. package/dist/spec/catalogs/layouts/waterfall-bridge.json +9 -15
  270. package/dist/spec/catalogs/layouts/wheel-radial.json +9 -15
  271. package/dist/spec/catalogs/manifest.json +8 -8
  272. package/dist/spec/catalogs/narratives/board-meeting.json +45 -45
  273. package/dist/spec/catalogs/narratives/business-narrative.json +19 -19
  274. package/dist/spec/catalogs/narratives/business-review.json +27 -27
  275. package/dist/spec/catalogs/narratives/capacity-planning.json +19 -19
  276. package/dist/spec/catalogs/narratives/challenge-resolution.json +17 -17
  277. package/dist/spec/catalogs/narratives/change-story.json +13 -13
  278. package/dist/spec/catalogs/narratives/classic-story.json +17 -17
  279. package/dist/spec/catalogs/narratives/company-intro.json +21 -21
  280. package/dist/spec/catalogs/narratives/conference-talk.json +4 -4
  281. package/dist/spec/catalogs/narratives/data-story.json +13 -14
  282. package/dist/spec/catalogs/narratives/early-startup-pitch.json +27 -27
  283. package/dist/spec/catalogs/narratives/educate.json +21 -21
  284. package/dist/spec/catalogs/narratives/employee-review.json +19 -19
  285. package/dist/spec/catalogs/narratives/failure-analysis.json +23 -23
  286. package/dist/spec/catalogs/narratives/focus.json +27 -27
  287. package/dist/spec/catalogs/narratives/golden-circle.json +4 -4
  288. package/dist/spec/catalogs/narratives/heros-journey.json +13 -13
  289. package/dist/spec/catalogs/narratives/index.json +145 -145
  290. package/dist/spec/catalogs/narratives/innovation.json +21 -21
  291. package/dist/spec/catalogs/narratives/justice.json +25 -25
  292. package/dist/spec/catalogs/narratives/marketing-strategy.json +25 -25
  293. package/dist/spec/catalogs/narratives/performance-improvement-plan.json +19 -19
  294. package/dist/spec/catalogs/narratives/performance-review.json +25 -25
  295. package/dist/spec/catalogs/narratives/persuade.json +17 -17
  296. package/dist/spec/catalogs/narratives/persuasive-sales.json +19 -19
  297. package/dist/spec/catalogs/narratives/pitch-deck.json +6 -6
  298. package/dist/spec/catalogs/narratives/problem-solution.json +5 -5
  299. package/dist/spec/catalogs/narratives/product-launch.json +23 -23
  300. package/dist/spec/catalogs/narratives/project-proposal.json +23 -23
  301. package/dist/spec/catalogs/narratives/pyramid-principle.json +9 -9
  302. package/dist/spec/catalogs/narratives/qbr.json +8 -8
  303. package/dist/spec/catalogs/narratives/rags-to-riches.json +17 -17
  304. package/dist/spec/catalogs/narratives/reveal.json +19 -19
  305. package/dist/spec/catalogs/narratives/scqa.json +4 -4
  306. package/dist/spec/catalogs/narratives/situation-complication-resolution.json +11 -11
  307. package/dist/spec/catalogs/narratives/sparkline.json +11 -11
  308. package/dist/spec/catalogs/narratives/star-method.json +11 -11
  309. package/dist/spec/catalogs/narratives/status-update.json +15 -15
  310. package/dist/spec/catalogs/narratives/strategic-advisory.json +17 -17
  311. package/dist/spec/catalogs/narratives/strategic-narrative.json +4 -4
  312. package/dist/spec/catalogs/narratives/survey-analysis.json +23 -23
  313. package/dist/spec/catalogs/narratives/survival-story.json +23 -23
  314. package/dist/spec/catalogs/narratives/transformation-arc.json +4 -4
  315. package/dist/spec/catalogs/narratives/trend-analysis.json +17 -17
  316. package/dist/spec/catalogs/narratives/underdog-victory.json +19 -19
  317. package/dist/spec/catalogs/narratives/venture-pitch.json +27 -27
  318. package/dist/spec/catalogs/narratives/vision-roadmap.json +13 -13
  319. package/dist/spec/catalogs/narratives/weekly-progress.json +23 -23
  320. package/dist/spec/catalogs/narratives/what-so-what-now-what.json +9 -9
  321. package/dist/spec/openapi.yaml +2 -5
  322. package/dist/spec/reference/engine-defaults.json +2 -2
  323. package/dist/spec/schemas/audience.schema.json +1 -1
  324. package/dist/spec/schemas/catalog-index.schema.json +2 -2
  325. package/dist/spec/schemas/chart-type.schema.json +19 -290
  326. package/dist/spec/schemas/color-scheme.schema.json +20 -12
  327. package/dist/spec/schemas/finding.schema.json +191 -0
  328. package/dist/spec/schemas/font-scheme.schema.json +19 -46
  329. package/dist/spec/schemas/layout.schema.json +100 -159
  330. package/dist/spec/schemas/narrative.schema.json +17 -25
  331. package/dist/spec/schemas/opf.schema.json +286 -340
  332. package/dist/spec/schemas/social-platform.schema.json +1 -26
  333. package/dist/spec/schemas/theme.schema.json +4 -1
  334. package/dist/spec-files.d.ts +1 -1
  335. package/dist/spec-files.js +1 -1
  336. package/dist/symbol-font-encodings.js +18448 -1
  337. package/dist/types.d.ts +4 -4
  338. package/dist/validation-types-zh03LeZy.d.ts +276 -0
  339. package/dist/validator.d.ts +60 -4
  340. package/dist/validator.js +4 -4
  341. package/dist/yaml.d.ts +87 -0
  342. package/dist/yaml.js +321 -0
  343. package/package.json +5 -9
  344. package/dist/audit.d.ts +0 -35
  345. package/dist/audit.js +0 -7
  346. package/dist/chunk-7N4VMAT4.js +0 -1694
  347. package/dist/chunk-FYLJVF7X.js +0 -18448
  348. package/dist/chunk-INU7ZNSB.js +0 -670
  349. package/dist/chunk-IYCJUKWD.js +0 -951
  350. package/dist/lint-B7azdiuE.d.ts +0 -197
  351. package/dist/lint.d.ts +0 -7
  352. package/dist/lint.js +0 -6
  353. package/dist/spec/catalogs/audiences/customers.json +0 -27
  354. package/dist/spec/catalogs/audiences/executives.json +0 -27
  355. package/dist/spec/catalogs/audiences/investors.json +0 -27
  356. package/dist/spec/catalogs/audiences/marketing-team.json +0 -27
  357. package/dist/spec/catalogs/audiences/regulators.json +0 -27
  358. package/dist/spec/catalogs/audiences/sales-team.json +0 -27
  359. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-2x.json +0 -91
  360. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-3x.json +0 -103
  361. package/dist/spec/catalogs/chart-types/100pct-bullet-bar.json +0 -79
  362. package/dist/spec/catalogs/chart-types/100pct-bullet-column-2x.json +0 -91
  363. package/dist/spec/catalogs/chart-types/100pct-bullet-column-3x.json +0 -103
  364. package/dist/spec/catalogs/chart-types/100pct-bullet-column.json +0 -79
  365. package/dist/spec/catalogs/chart-types/100pct-progress-bar.json +0 -105
  366. package/dist/spec/catalogs/chart-types/100pct-stacked-area-2x.json +0 -106
  367. package/dist/spec/catalogs/chart-types/100pct-stacked-area-3x.json +0 -123
  368. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-2x.json +0 -89
  369. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-3x.json +0 -100
  370. package/dist/spec/catalogs/chart-types/100pct-stacked-column-2x.json +0 -95
  371. package/dist/spec/catalogs/chart-types/100pct-stacked-column-3x.json +0 -108
  372. package/dist/spec/catalogs/chart-types/australia.json +0 -76
  373. package/dist/spec/catalogs/chart-types/box-and-whisker-2x.json +0 -136
  374. package/dist/spec/catalogs/chart-types/box-and-whisker-3x.json +0 -168
  375. package/dist/spec/catalogs/chart-types/bullet-bar-2x.json +0 -89
  376. package/dist/spec/catalogs/chart-types/bullet-bar-3x.json +0 -101
  377. package/dist/spec/catalogs/chart-types/bullet-bar.json +0 -77
  378. package/dist/spec/catalogs/chart-types/bullet-column-2x.json +0 -89
  379. package/dist/spec/catalogs/chart-types/bullet-column-3x.json +0 -101
  380. package/dist/spec/catalogs/chart-types/bullet-column.json +0 -77
  381. package/dist/spec/catalogs/chart-types/canada.json +0 -86
  382. package/dist/spec/catalogs/chart-types/clustered-bar-2x.json +0 -89
  383. package/dist/spec/catalogs/chart-types/clustered-column.json +0 -95
  384. package/dist/spec/catalogs/chart-types/dot-plot-2x.json +0 -99
  385. package/dist/spec/catalogs/chart-types/dot-plot-3x.json +0 -124
  386. package/dist/spec/catalogs/chart-types/dot-plot-4x.json +0 -149
  387. package/dist/spec/catalogs/chart-types/dot-plot-5x.json +0 -174
  388. package/dist/spec/catalogs/chart-types/dot-plot-6x.json +0 -199
  389. package/dist/spec/catalogs/chart-types/dot-plot.json +0 -74
  390. package/dist/spec/catalogs/chart-types/dumbbell.json +0 -120
  391. package/dist/spec/catalogs/chart-types/line-2x.json +0 -105
  392. package/dist/spec/catalogs/chart-types/line-3x.json +0 -127
  393. package/dist/spec/catalogs/chart-types/line-with-high-low-and-markers.json +0 -144
  394. package/dist/spec/catalogs/chart-types/line-with-high-low.json +0 -144
  395. package/dist/spec/catalogs/chart-types/line-with-markers-2x.json +0 -106
  396. package/dist/spec/catalogs/chart-types/line-with-markers-3x.json +0 -128
  397. package/dist/spec/catalogs/chart-types/sparkline-2x.json +0 -138
  398. package/dist/spec/catalogs/chart-types/sparkline-3x.json +0 -174
  399. package/dist/spec/catalogs/chart-types/sparkline-4x.json +0 -210
  400. package/dist/spec/catalogs/chart-types/sparkline-5x.json +0 -246
  401. package/dist/spec/catalogs/chart-types/sparkline-6x.json +0 -282
  402. package/dist/spec/catalogs/chart-types/sparkline.json +0 -102
  403. package/dist/spec/catalogs/chart-types/stacked-area-2x.json +0 -106
  404. package/dist/spec/catalogs/chart-types/stacked-area-3x.json +0 -123
  405. package/dist/spec/catalogs/chart-types/stacked-bar-2x.json +0 -89
  406. package/dist/spec/catalogs/chart-types/stacked-bar-3x.json +0 -100
  407. package/dist/spec/catalogs/chart-types/stacked-column-2x.json +0 -95
  408. package/dist/spec/catalogs/chart-types/stacked-column-3x.json +0 -108
  409. package/dist/spec/catalogs/chart-types/stacked-line-2x.json +0 -106
  410. package/dist/spec/catalogs/chart-types/stacked-line-3x.json +0 -123
  411. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-2x.json +0 -107
  412. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-3x.json +0 -124
  413. package/dist/spec/catalogs/chart-types/treemap-2x.json +0 -101
  414. package/dist/spec/catalogs/chart-types/treemap-3x.json +0 -122
  415. package/dist/spec/catalogs/chart-types/united-kingdom.json +0 -68
  416. package/dist/spec/catalogs/chart-types/united-states.json +0 -82
  417. package/dist/validator-CIylxoIm.d.ts +0 -172
@@ -1,670 +0,0 @@
1
- import { validatePresentation, unusedReferenceWarnings, validationDefinition, validateCatalogRecord } from './chunk-IYCJUKWD.js';
2
- import { unusedDatasets, isRecord, visitContentPayloads, chartNumberFixesByCell, pathFor } from './chunk-MPM7NRG7.js';
3
- import { catalogKinds, catalogEntries, catalogSchemaNames } from './chunk-E34DJ5LL.js';
4
- import { schemas, schemaEntries } from './chunk-7QBCWNWL.js';
5
- import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
6
-
7
- var DATA_WARNING_CODES = /* @__PURE__ */ new Set(["chart-value-not-numeric", "chart-data-source-unresolved", "chart-mapping-adapted"]);
8
- var own = (value, key) => Object.hasOwn(value, key);
9
- var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10
- var primitive = (value) => value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
11
- var pointer = (parts2) => parts2.length ? "/" + parts2.map((part) => String(part).replaceAll("~", "~0").replaceAll("/", "~1")).join("/") : "";
12
- function parts(path) {
13
- if (path === "") return [];
14
- if (!path.startsWith("/") || /~(?![01])/.test(path))
15
- throw new TypeError(`Invalid lint contract JSON Pointer: ${path}`);
16
- return path.slice(1).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
17
- }
18
- function at(value, path) {
19
- return parts(path).reduce(
20
- (current, key) => object(current) || Array.isArray(current) ? own(current, key) ? current[key] : void 0 : void 0,
21
- value
22
- );
23
- }
24
- function optionsChecked(options) {
25
- if (!object(options) || Object.keys(options).some((key) => !["catalogs", "contracts"].includes(key)))
26
- throw new TypeError("Lint options accept only catalogs and contracts.");
27
- if (options.catalogs !== void 0 && (!object(options.catalogs) || Object.entries(options.catalogs).some(
28
- ([kind, records]) => !catalogKinds.includes(kind) || !Array.isArray(records)
29
- )))
30
- throw new TypeError(
31
- "Lint catalogs must map known catalog kinds to arrays of loaded records."
32
- );
33
- if (options.contracts !== void 0 && !Array.isArray(options.contracts))
34
- throw new TypeError("Lint contracts must be an array.");
35
- for (const contract of options.contracts ?? []) {
36
- if (!object(contract) || Object.keys(contract).some(
37
- (key) => ![
38
- "path",
39
- "allowedValues",
40
- "severity",
41
- "message",
42
- "documentation"
43
- ].includes(key)
44
- ) || typeof contract.path !== "string" || !Array.isArray(contract.allowedValues) || !contract.allowedValues.every(primitive) || contract.severity !== void 0 && (typeof contract.severity !== "string" || !["error", "warning", "info"].includes(contract.severity)) || contract.message !== void 0 && typeof contract.message !== "string" || contract.documentation !== void 0 && typeof contract.documentation !== "string")
45
- throw new TypeError(
46
- "Invalid lint contract: provide a path and primitive allowedValues, with optional severity, message and documentation."
47
- );
48
- parts(contract.path);
49
- }
50
- }
51
- function report(diagnostics, schemaValid, syntax) {
52
- const counts = { error: 0, warning: 0, info: 0 };
53
- for (const diagnostic of diagnostics) counts[diagnostic.severity]++;
54
- return {
55
- valid: counts.error === 0,
56
- schemaValid,
57
- diagnostics,
58
- counts,
59
- checks: {
60
- syntax,
61
- schema: schemaValid === null ? "not-run" : "checked",
62
- catalogReferences: schemaValid === null ? "not-run" : "local-context",
63
- assetReferences: schemaValid === null ? "not-run" : "registry-only",
64
- contracts: schemaValid === null ? "not-run" : "checked",
65
- layout: "not-checked",
66
- fonts: "not-checked",
67
- nativeExport: "not-checked"
68
- }
69
- };
70
- }
71
- function schemaDiagnostic(issue, schemaName = "presentation", prefix = "", scope = "document") {
72
- const path = prefix + (issue.path === "/" ? "" : issue.path) + (issue.keyword === "additionalProperties" && typeof issue.params.additionalProperty === "string" ? pointer([issue.params.additionalProperty]) : ""), entry = schemaEntries.find((entry2) => entry2.name === schemaName);
73
- if (!entry) throw new TypeError(`Unknown schema ${schemaName}`);
74
- const precise = validationDefinition(issue);
75
- const definition = precise?.uri ?? (issue.keyword === "opf" ? "packages/javascript/src/validator.ts" : issue.schemaPath.startsWith("#") ? entry.schema.$id + issue.schemaPath : issue.schemaPath);
76
- const lookup = [
77
- "opf",
78
- "schema",
79
- precise?.schemaName ?? schemaName,
80
- precise?.pointer ?? (issue.keyword !== "opf" && issue.schemaPath.startsWith("#") ? issue.schemaPath.slice(1) : "")
81
- ];
82
- let help = "Inspect this schema constraint and preserve unrelated content. Errors inside oneOf/anyOf branches may describe alternatives; retain the intended form.";
83
- if (issue.keyword === "required")
84
- help = `Add the required ${JSON.stringify(issue.params.missingProperty)} field in this object, using the intended schema form.`;
85
- else if (issue.keyword === "additionalProperties")
86
- help = `Review ${JSON.stringify(issue.params.additionalProperty)} against this object's schema. Preserve custom metadata in document.extensions where appropriate; do not delete authored content to clear this error.`;
87
- else if (issue.keyword === "enum")
88
- help = "Choose one of this schema branch\u2019s allowed values; inspect the other alternatives if the field uses another form.";
89
- else if (issue.keyword === "opf")
90
- help = "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
91
- const allowed = Array.isArray(issue.params.allowedValues) ? issue.params.allowedValues.filter(primitive) : [];
92
- return {
93
- ruleId: "opf/schema",
94
- severity: "error",
95
- path,
96
- scope,
97
- message: issue.message,
98
- help,
99
- definition,
100
- lookup,
101
- validation: issue,
102
- ...allowed.length ? {
103
- suggestions: allowed.map((value) => ({
104
- value,
105
- label: String(value),
106
- origin: "schema",
107
- definition
108
- }))
109
- } : {}
110
- };
111
- }
112
- function resolve(cursor, seen = /* @__PURE__ */ new Set()) {
113
- const ref = cursor.schema.$ref;
114
- if (typeof ref !== "string") return cursor;
115
- const id = String(cursor.root.$id ?? "") + ref;
116
- if (seen.has(id)) return { ...cursor, schema: {} };
117
- seen.add(id);
118
- const [base, fragment = ""] = ref.split("#"), root = base ? schemaEntries.find((entry) => entry.schema.$id === base)?.schema : cursor.root;
119
- if (!root) return { ...cursor, schema: {} };
120
- const target = at(root, fragment);
121
- if (!object(target)) return { ...cursor, schema: {} };
122
- const resolved = resolve(
123
- { schema: target, root, path: fragment },
124
- seen
125
- );
126
- const { $ref, ...rest } = cursor.schema;
127
- return { ...resolved, schema: { ...resolved.schema, ...rest } };
128
- }
129
- function score(schema, value) {
130
- const type = schema.type;
131
- if (typeof type === "string" && (type === "array" ? !Array.isArray(value) : type === "object" ? !object(value) : type === "null" ? value !== null : type === "integer" ? !Number.isInteger(value) : typeof value !== type))
132
- return -1e4;
133
- if (own(schema, "const")) return schema.const === value ? 100 : -1e4;
134
- let result = 1;
135
- if (object(value) && object(schema.properties)) {
136
- for (const [key, child] of Object.entries(schema.properties))
137
- if (own(value, key) && object(child))
138
- result += own(child, "const") ? child.const === value[key] ? 100 : -1e3 : 1;
139
- }
140
- if (Array.isArray(schema.required)) {
141
- for (const key of schema.required)
142
- if (typeof key === "string" && (!object(value) || !own(value, key)))
143
- result -= 2;
144
- }
145
- return result;
146
- }
147
- function active(cursor, value) {
148
- const resolved = resolve(cursor), alternatives = resolved.schema.oneOf ?? resolved.schema.anyOf;
149
- if (!Array.isArray(alternatives)) return resolved;
150
- const keyword = resolved.schema.oneOf ? "oneOf" : "anyOf";
151
- const candidates = alternatives.filter(object).map(
152
- (schema, index) => active(
153
- {
154
- schema,
155
- root: resolved.root,
156
- path: `${resolved.path}/${keyword}/${index}`
157
- },
158
- value
159
- )
160
- );
161
- const selected = candidates.sort((a, b) => score(b.schema, value) - score(a.schema, value))[0];
162
- return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved] } : resolved;
163
- }
164
- function catalogIn(schema) {
165
- const text = String(schema.description ?? "");
166
- if (/\bfont-scheme id\b/.test(text)) return "fontSchemes";
167
- return catalogKinds.find(
168
- (kind) => text.includes(`catalogs.${kind}`) || new RegExp(`\\b${kind}['\u2019]? catalog`).test(text)
169
- );
170
- }
171
- var languageTagSyntax = new RegExp(
172
- "^(?:(?:[a-z]{2,3}(?:-[a-z]{3}){0,3}|[a-z]{4}|[a-z]{5,8})(?:-[a-z]{4})?(?:-(?:[a-z]{2}|[0-9]{3}))?(?:-(?:[a-z0-9]{5,8}|[0-9][a-z0-9]{3}))*(?:-[0-9a-wy-z](?:-[a-z0-9]{2,8})+)*(?:-x(?:-[a-z0-9]{1,8})+)?|x(?:-[a-z0-9]{1,8})+)$",
173
- "i"
174
- );
175
- var irregularLanguageTags = /* @__PURE__ */ new Set([
176
- "en-gb-oed",
177
- "i-ami",
178
- "i-bnn",
179
- "i-default",
180
- "i-enochian",
181
- "i-hak",
182
- "i-klingon",
183
- "i-lux",
184
- "i-mingo",
185
- "i-navajo",
186
- "i-pwn",
187
- "i-tao",
188
- "i-tay",
189
- "i-tsu",
190
- "sgn-be-fr",
191
- "sgn-be-nl",
192
- "sgn-ch-de"
193
- ]);
194
- function childCursor(cursors, key) {
195
- for (const keyword of [
196
- "properties",
197
- "patternProperties",
198
- "additionalProperties"
199
- ]) {
200
- for (const cursor of cursors) {
201
- const declarations = cursor.schema[keyword];
202
- if (!object(declarations)) continue;
203
- const name = keyword === "properties" ? key : keyword === "patternProperties" ? Object.keys(declarations).find(
204
- (pattern) => new RegExp(pattern).test(key)
205
- ) : void 0;
206
- const schema = keyword === "additionalProperties" ? declarations : name === void 0 ? void 0 : declarations[name];
207
- if (object(schema))
208
- return {
209
- schema,
210
- root: cursor.root,
211
- path: `${cursor.path}/${keyword}${name === void 0 ? "" : pointer([name])}`
212
- };
213
- }
214
- }
215
- return void 0;
216
- }
217
- function fields(document) {
218
- const result = [], stack = [
219
- {
220
- value: document,
221
- path: [],
222
- cursor: {
223
- schema: schemas.presentation,
224
- root: schemas.presentation,
225
- path: ""
226
- },
227
- ancestors: []
228
- }
229
- ];
230
- while (stack.length) {
231
- const entry = stack.pop();
232
- if (!entry) break;
233
- if (entry.ancestors.includes(entry.value)) continue;
234
- const resolved = resolve(entry.cursor), selected = active(entry.cursor, entry.value), description = String(resolved.schema.description ?? "");
235
- const assetReference = [resolved, selected].some(
236
- (cursor) => cursor.root.$id === schemas.presentation.$id && (cursor.path === "/$defs/Asset" || cursor.path === "/$defs/Asset/oneOf/0" || cursor.path === "/$defs/Watermark/properties/src") || String(cursor.schema.description ?? "").includes("asset:") || Array.isArray(cursor.schema.examples) && cursor.schema.examples.some(
237
- (example) => typeof example === "string" && example.startsWith("asset:")
238
- )
239
- );
240
- result.push({
241
- path: pointer(entry.path),
242
- value: entry.value,
243
- cursor: resolved,
244
- kind: catalogIn(resolved.schema),
245
- description,
246
- assetReference
247
- });
248
- const ancestors = [...entry.ancestors, entry.value];
249
- const cursors = [selected, ...selected.baseSchemas ?? [], resolved];
250
- const arrayCursor = cursors.find((cursor) => object(cursor.schema.items));
251
- if (Array.isArray(entry.value) && arrayCursor)
252
- entry.value.forEach((value, index) => {
253
- stack.push({
254
- value,
255
- path: [...entry.path, index],
256
- cursor: {
257
- schema: arrayCursor.schema.items,
258
- root: arrayCursor.root,
259
- path: `${arrayCursor.path}/items`
260
- },
261
- ancestors
262
- });
263
- });
264
- else if (object(entry.value))
265
- for (const [key, value] of Object.entries(entry.value)) {
266
- if (entry.path.length === 0 && key === "catalogs") continue;
267
- const cursor = childCursor(cursors, key);
268
- if (!cursor) continue;
269
- stack.push({
270
- value,
271
- path: [...entry.path, key],
272
- cursor,
273
- ancestors
274
- });
275
- }
276
- }
277
- return result;
278
- }
279
- function catalogContext(document, options, diagnostics) {
280
- const result = /* @__PURE__ */ new Map();
281
- for (const entry of catalogEntries) {
282
- const kind = entry.kind, map = /* @__PURE__ */ new Map();
283
- result.set(kind, map);
284
- for (const record of entry.records)
285
- map.set(record.id, {
286
- value: record.id,
287
- label: String(
288
- record.name ?? record.id
289
- ),
290
- origin: "built-in",
291
- definition: `spec/${entry.dir}/${entry.index.records.find((item) => item.id === record.id)?.file ?? `${record.id}.json`}`
292
- });
293
- const local = object(document) && object(document.catalogs) && object(document.catalogs[kind]) ? document.catalogs[kind] : {};
294
- if (local.source !== void 0)
295
- diagnostics.push({
296
- ruleId: "opf/catalog-source",
297
- severity: "info",
298
- scope: "document",
299
- path: `/catalogs/${kind}/source`,
300
- message: "External catalog source was not fetched.",
301
- help: "This lint run checks built-in, supplied and inline records only. Load external catalogs in the host and pass their records explicitly to verify that context."
302
- });
303
- for (const group of [
304
- {
305
- records: options.catalogs?.[kind] ?? [],
306
- origin: "loaded",
307
- scope: "context",
308
- path: `/catalogs/${kind}`
309
- },
310
- {
311
- records: Array.isArray(local.records) ? local.records : [],
312
- origin: "document",
313
- scope: "document",
314
- path: `/catalogs/${kind}/records`
315
- }
316
- ]) {
317
- const seen = /* @__PURE__ */ new Set();
318
- group.records.forEach((value, index) => {
319
- const path = `${group.path}/${index}`, schemaName = catalogSchemaNames[kind], record = object(value) ? { $schema: schemas[schemaName].$id, ...value } : value;
320
- const validation = validateCatalogRecord(kind, record);
321
- for (const issue of validation.errors)
322
- diagnostics.push({
323
- ...schemaDiagnostic(issue, schemaName, path, group.scope),
324
- ruleId: "opf/catalog-record"
325
- });
326
- if (!object(value) || typeof value.id !== "string") return;
327
- if (seen.has(value.id))
328
- diagnostics.push({
329
- ruleId: "opf/catalog-record",
330
- severity: "error",
331
- scope: group.scope,
332
- path: `${path}/id`,
333
- message: `Duplicate ${kind} record id ${JSON.stringify(value.id)} in this catalog.`,
334
- help: "Give distinct records distinct IDs, or combine the intended override explicitly. Preserve their authored content."
335
- });
336
- seen.add(value.id);
337
- if (!validation.valid) {
338
- map.delete(value.id);
339
- return;
340
- }
341
- map.set(value.id, {
342
- value: value.id,
343
- label: typeof value.name === "string" ? value.name : value.id,
344
- origin: group.origin,
345
- definition: `${group.scope}#${path}`
346
- });
347
- });
348
- }
349
- }
350
- return result;
351
- }
352
- function distance(a, b) {
353
- a = a.slice(0, 128);
354
- b = b.slice(0, 128);
355
- let row = Array.from({ length: b.length + 1 }, (_, i) => i);
356
- for (let i = 0; i < a.length; i++) {
357
- const next = [i + 1];
358
- for (let j = 0; j < b.length; j++)
359
- next.push(
360
- Math.min(
361
- (next[j] ?? Infinity) + 1,
362
- (row[j + 1] ?? Infinity) + 1,
363
- (row[j] ?? Infinity) + (a[i] === b[j] ? 0 : 1)
364
- )
365
- );
366
- row = next;
367
- }
368
- return row[b.length] ?? Math.max(a.length, b.length);
369
- }
370
- function chartNumberFixPaths(document) {
371
- const byCell = /* @__PURE__ */ new Map();
372
- if (!isRecord(document) || !Array.isArray(document.slides)) return byCell;
373
- const payload = (node, path) => {
374
- if (isRecord(node.chart))
375
- for (const [cell, fix] of chartNumberFixesByCell(node.chart, document, { path: pathFor(path, "chart") })) byCell.set(cell, fix);
376
- };
377
- document.slides.forEach((slide, index) => {
378
- if (!isRecord(slide)) return;
379
- payload(slide, `/slides/${index}`);
380
- visitContentPayloads(slide, `/slides/${index}`, payload);
381
- });
382
- return byCell;
383
- }
384
- function lintPresentation(document, options = {}) {
385
- optionsChecked(options);
386
- const validation = validatePresentation(document), diagnostics = validation.errors.map(
387
- (issue) => typeof issue.params.code === "string" && issue.keyword === "opf" ? { ...schemaDiagnostic(issue), ruleId: `opf/${issue.params.code}` } : schemaDiagnostic(issue)
388
- );
389
- const catalogs = catalogContext(document, options, diagnostics), seen = /* @__PURE__ */ new Set();
390
- const assetValues = object(document) && object(document.assets) ? document.assets : {};
391
- for (const field of fields(document)) {
392
- if (typeof field.value === "string" && field.value.startsWith("asset:") && field.assetReference) {
393
- const id = field.value.slice(6);
394
- if (!own(assetValues, id))
395
- diagnostics.push({
396
- ruleId: "opf/asset-reference",
397
- severity: "error",
398
- scope: "document",
399
- path: field.path,
400
- message: `Asset ${JSON.stringify(id)} is missing from the document registry.`,
401
- help: "Supply the intended asset in document.assets or choose the correct existing asset ID. External files and URLs are not fetched or verified.",
402
- definition: schemas.presentation.$id + "#/$defs/Assets",
403
- lookup: ["opf", "schema", "presentation", "/$defs/Assets"],
404
- suggestions: Object.keys(assetValues).sort(
405
- (a, b) => distance(id, a) - distance(id, b) || (a < b ? -1 : a > b ? 1 : 0)
406
- ).slice(0, 5).map((id2) => ({
407
- value: `asset:${id2}`,
408
- label: id2,
409
- origin: "document",
410
- definition: `document#${pointer(["assets", id2])}`
411
- }))
412
- });
413
- }
414
- if (!field.path || !field.kind) continue;
415
- const { kind } = field;
416
- if (kind === "languages" && field.path === "/language" && typeof field.value === "string" && (languageTagSyntax.test(field.value) || irregularLanguageTags.has(field.value.toLowerCase())))
417
- continue;
418
- if (kind !== "layouts" && /free-form/i.test(field.description)) continue;
419
- if (kind === "narratives" && (object(field.value) || field.cursor.root.$id === schemas.presentation.$id && field.cursor.path === "/$defs/Narrative/properties/id"))
420
- continue;
421
- const value = object(field.value) ? field.value.id : field.value, path = object(field.value) ? `${field.path}/id` : field.path;
422
- if (typeof value !== "string" || !value || /^(?:https?:|pkg:)/i.test(value) || catalogs.get(kind)?.has(value) || seen.has(path))
423
- continue;
424
- seen.add(path);
425
- const suggestions = [...catalogs.get(kind)?.values() ?? []].sort(
426
- (a, b) => distance(value, String(a.value)) - distance(value, String(b.value)) || (String(a.value) < String(b.value) ? -1 : String(a.value) > String(b.value) ? 1 : 0)
427
- ).slice(0, 5);
428
- const definition = String(field.cursor.root.$id) + `#${field.cursor.path}`;
429
- diagnostics.push({
430
- ruleId: "opf/catalog-reference",
431
- severity: "warning",
432
- scope: "document",
433
- path,
434
- message: `Unknown ${kind} catalog id ${JSON.stringify(value)} in the available local context.`,
435
- help: kind === "layouts" ? "Choose an available layout or supply the intended custom record. Engine-defined layouts may be valid; preview with the target renderer before changing content." : "Choose an available record or supply the intended custom catalog context. External references and native rendering are not verified by this check.",
436
- definition,
437
- lookup: ["opf", "catalog", kind],
438
- suggestions
439
- });
440
- }
441
- const reportedCycles = /* @__PURE__ */ new Set();
442
- for (const id of Object.keys(assetValues)) {
443
- const chain = [], seenIds = /* @__PURE__ */ new Set();
444
- let current = id;
445
- while (current !== void 0 && own(assetValues, current)) {
446
- if (seenIds.has(current)) {
447
- const cycle = chain.slice(chain.indexOf(current));
448
- if (!cycle.some((id2) => reportedCycles.has(id2))) {
449
- for (const id2 of cycle) reportedCycles.add(id2);
450
- diagnostics.push({
451
- ruleId: "opf/asset-cycle",
452
- severity: "error",
453
- scope: "document",
454
- path: pointer(["assets", current]),
455
- message: `Asset references form a cycle: ${[...cycle, current].map((id2) => JSON.stringify(id2)).join(" \u2192 ")}.`,
456
- help: "Replace one link with the intended concrete source. Preserve the original asset metadata; no files or URLs were fetched."
457
- });
458
- }
459
- break;
460
- }
461
- seenIds.add(current);
462
- chain.push(current);
463
- const value = assetValues[current], source = object(value) ? value.src : value;
464
- current = typeof source === "string" && source.startsWith("asset:") ? source.slice(6) : void 0;
465
- }
466
- }
467
- const numberFixes = validation.warnings.some((issue) => issue.params.code === "chart-value-not-numeric") ? chartNumberFixPaths(document) : /* @__PURE__ */ new Map();
468
- for (const issue of validation.warnings) {
469
- if (typeof issue.params.code === "string" && DATA_WARNING_CODES.has(issue.params.code)) {
470
- const fix = issue.params.code === "chart-value-not-numeric" ? numberFixes.get(issue.path) : void 0;
471
- if (fix) {
472
- diagnostics.push({
473
- ...schemaDiagnostic(issue),
474
- ruleId: "opf/chart-value-not-numeric",
475
- severity: "warning",
476
- help: `Every text value of column ${JSON.stringify(fix.name)} is written in one display style. Store the numbers and give the column the format ${JSON.stringify(fix.format)}, which shows the same text: apply fixes[0] (core suggestChartNumberFix). Until then the value is plotted as a gap.`,
477
- fixes: [{ id: "store-chart-numbers", label: `Store ${JSON.stringify(fix.name)} as numbers with the format ${JSON.stringify(fix.format)}`, kind: "patch", safe: false, patch: fix.patches }]
478
- });
479
- continue;
480
- }
481
- diagnostics.push({
482
- ...schemaDiagnostic(issue),
483
- ruleId: `opf/${issue.params.code}`,
484
- severity: "warning",
485
- help: issue.params.code === "chart-value-not-numeric" ? 'Write chart values as numbers (or strict decimal strings such as "12.5" or "1e6"); put currency, percent and units in the column format ({ "name": "Revenue", "format": "$#,##0" }). The value is plotted as a gap.' : issue.params.code === "chart-data-source-unresolved" ? "No engine loads chart data sources. Import the data inline (columns and rows, recording the origin in data.source) or reference a top-level dataset." : "The mapping entry is ignored. Remove it, or name a different column."
486
- });
487
- continue;
488
- }
489
- const kind = issue.params.kind, id = issue.params.id, replacedBy = issue.params.replacedBy;
490
- if (typeof replacedBy === "string" && typeof id === "string") {
491
- const target = catalogs.get(kind)?.get(replacedBy);
492
- diagnostics.push({
493
- ...schemaDiagnostic(issue),
494
- ruleId: "opf/deprecated-catalog-id",
495
- severity: "warning",
496
- message: `Deprecated ${kind} catalog id ${JSON.stringify(id)}; use ${JSON.stringify(replacedBy)} instead.`,
497
- help: "The deprecated id still resolves to its original record, so nothing breaks. Switch to the replacement when you next edit this reference.",
498
- lookup: ["opf", "catalog", kind],
499
- ...target ? { suggestions: [target] } : {}
500
- });
501
- continue;
502
- }
503
- if (seen.has(issue.path) || typeof id === "string" && catalogs.get(kind)?.has(id))
504
- continue;
505
- diagnostics.push({
506
- ...schemaDiagnostic(issue),
507
- ruleId: "opf/catalog-reference",
508
- severity: "warning",
509
- help: "Inspect the referenced catalog and supply the intended record if this is a custom context."
510
- });
511
- }
512
- for (const [index, contract] of (options.contracts ?? []).entries()) {
513
- const pattern = parts(contract.path), stack = [{ value: document, path: [], depth: 0 }];
514
- while (stack.length) {
515
- const entry = stack.pop();
516
- if (!entry) break;
517
- if (entry.depth === pattern.length) {
518
- if (contract.allowedValues.some((value) => Object.is(value, entry.value)))
519
- continue;
520
- const path = pointer(entry.path), definition = contract.documentation ?? `context#/contracts/${index}`, values = {
521
- path,
522
- value: JSON.stringify(entry.value),
523
- allowed: contract.allowedValues.map((value) => JSON.stringify(value)).join(", "),
524
- file: definition
525
- };
526
- const message = (contract.message ?? "This value is outside the allowed values for {{path}}.").replace(
527
- /\{\{(path|value|allowed|file)\}\}/g,
528
- (_, key) => values[key] ?? ""
529
- );
530
- diagnostics.push({
531
- ruleId: "opf/contract",
532
- severity: contract.severity ?? "error",
533
- scope: "document",
534
- path,
535
- message,
536
- help: `Use one of the configured values: ${values.allowed}. This is an explicit host policy; no source was changed.`,
537
- definition,
538
- suggestions: contract.allowedValues.map((value) => ({
539
- value,
540
- label: String(value),
541
- origin: "contract",
542
- definition
543
- }))
544
- });
545
- } else if (object(entry.value) || Array.isArray(entry.value)) {
546
- const key = pattern[entry.depth];
547
- for (const [name, value] of Object.entries(entry.value))
548
- if (key === "*" || key === name)
549
- stack.push({
550
- value,
551
- path: [...entry.path, name],
552
- depth: entry.depth + 1
553
- });
554
- }
555
- }
556
- }
557
- for (const issue of unusedReferenceWarnings(document))
558
- diagnostics.push({
559
- ruleId: "opf/unused-reference",
560
- severity: "warning",
561
- scope: "document",
562
- path: issue.path,
563
- message: issue.message,
564
- help: "Cite the reference from a text, bullet or list item run ({ text, cite: id }) so it is listed in that slide's footnote area, or remove the entry. Nothing is drawn for an uncited reference.",
565
- definition: schemas.presentation.$id + "#/$defs/Reference",
566
- lookup: ["opf", "schema", "presentation", "/$defs/Reference"],
567
- validation: issue
568
- });
569
- for (const id of unusedDatasets(document))
570
- diagnostics.push({
571
- ruleId: "opf/unused-dataset",
572
- severity: "warning",
573
- scope: "document",
574
- path: `/datasets/${id.replaceAll("~", "~0").replaceAll("/", "~1")}`,
575
- message: `Dataset ${JSON.stringify(id)} is never referenced; reference it from a chart ("data": { "dataset": ${JSON.stringify(id)} }) or a table ({ "dataset": ${JSON.stringify(id)} }), or remove it.`,
576
- help: "Reference the dataset from chart.data or a table so it is drawn, or remove the entry. Nothing is drawn for an unreferenced dataset.",
577
- definition: schemas.presentation.$id + "#/$defs/Dataset",
578
- lookup: ["opf", "schema", "presentation", "/$defs/Dataset"]
579
- });
580
- return report(diagnostics, validation.valid, "not-applicable");
581
- }
582
- function lintSource(source, options = {}) {
583
- optionsChecked(options);
584
- const errors = [], tree = parseTree(
585
- source.startsWith("\uFEFF") ? " " + source.slice(1) : source,
586
- errors,
587
- {
588
- disallowComments: true,
589
- allowTrailingComma: false,
590
- allowEmptyContent: false
591
- }
592
- );
593
- const lineStarts = [0];
594
- for (let i = 0; i < source.length; i++) {
595
- if (source[i] === "\r") {
596
- if (source[i + 1] === "\n") i++;
597
- lineStarts.push(i + 1);
598
- } else if (source[i] === "\n") lineStarts.push(i + 1);
599
- }
600
- const location = (offset, length) => {
601
- let lo = 0, hi = lineStarts.length;
602
- while (lo + 1 < hi) {
603
- const mid = lo + hi >> 1;
604
- if ((lineStarts[mid] ?? 0) <= offset) lo = mid;
605
- else hi = mid;
606
- }
607
- return {
608
- offset,
609
- length,
610
- line: lo + 1,
611
- column: offset - (lineStarts[lo] ?? 0) + 1
612
- };
613
- };
614
- if (errors.length || !tree)
615
- return report(
616
- errors.map((error) => ({
617
- ruleId: "json/syntax",
618
- severity: "error",
619
- scope: "document",
620
- path: "",
621
- message: printParseErrorCode(error.error),
622
- help: "Repair the JSON syntax at this source range. No content or whitespace has been rewritten.",
623
- location: location(error.offset, error.length)
624
- })),
625
- null,
626
- "checked"
627
- );
628
- const diagnostics = [], stack = [tree];
629
- while (stack.length) {
630
- const node = stack.pop();
631
- if (!node) break;
632
- if (node.type === "object") {
633
- const keys = /* @__PURE__ */ new Set();
634
- for (const property of node.children ?? []) {
635
- const key = property.children?.[0];
636
- if (!key) continue;
637
- if (keys.has(key.value))
638
- diagnostics.push({
639
- ruleId: "json/duplicate-key",
640
- severity: "error",
641
- scope: "document",
642
- path: pointer(getNodePath(key)),
643
- message: `Duplicate JSON property ${JSON.stringify(key.value)}.`,
644
- help: "Resolve the duplicate explicitly, preserving the intended content from both occurrences. JSON.parse would otherwise hide an earlier value.",
645
- location: location(key.offset, key.length)
646
- });
647
- keys.add(key.value);
648
- }
649
- }
650
- stack.push(...node.children ?? []);
651
- }
652
- const result = lintPresentation(
653
- JSON.parse(source.replace(/^\uFEFF/, "")),
654
- options
655
- );
656
- for (const diagnostic of result.diagnostics) {
657
- if (diagnostic.scope === "document") {
658
- let node = tree;
659
- for (const part of parts(diagnostic.path))
660
- node = node?.type === "array" ? node.children?.[Number(part)] : node?.type === "object" ? node.children?.find(
661
- (property) => property.children?.[0]?.value === part
662
- )?.children?.[1] : void 0;
663
- if (node) diagnostic.location = location(node.offset, node.length);
664
- }
665
- diagnostics.push(diagnostic);
666
- }
667
- return report(diagnostics, result.schemaValid, "checked");
668
- }
669
-
670
- export { lintPresentation, lintSource };