@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.
Files changed (416) hide show
  1. package/README.md +28 -23
  2. package/dist/{catalogs-BnI7JKcn.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-B_3z9VTb.d.ts +188 -0
  6. package/dist/chunk-4LDGKLUC.js +192 -0
  7. package/dist/{chunk-V2537ENL.js → chunk-4VJDTF55.js} +2 -90
  8. package/dist/chunk-5ZU6JAPP.js +83 -0
  9. package/dist/{chunk-HOBSL7AJ.js → chunk-6OXY2CP3.js} +3604 -1644
  10. package/dist/{chunk-RUC7L5DJ.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-4LAM3N6S.js → chunk-LS2FMPI5.js} +1497 -1097
  15. package/dist/{chunk-SOSOBKQ2.js → chunk-Q2TCMN56.js} +6 -7
  16. package/dist/chunk-UPQQD7MA.js +1840 -0
  17. package/dist/{chunk-AUM5MXBR.js → chunk-XIZUK2XM.js} +36 -32
  18. package/dist/{chunk-E34DJ5LL.js → chunk-XOZ4KMSR.js} +2427 -10820
  19. package/dist/chunk-Z65B2B77.js +601 -0
  20. package/dist/{composition-DWbCiMwF.d.ts → composition-_WEwBe2a.d.ts} +744 -26
  21. package/dist/composition.d.ts +2 -1
  22. package/dist/composition.js +2 -2
  23. package/dist/convert.d.ts +9 -4
  24. package/dist/convert.js +57 -26
  25. package/dist/data.d.ts +5 -4
  26. package/dist/data.js +3 -1
  27. package/dist/diff.d.ts +5 -5
  28. package/dist/diff.js +6 -603
  29. package/dist/docs.js +70 -52
  30. package/dist/examples.d.ts +1 -1
  31. package/dist/examples.js +1466 -2963
  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 -281
  36. package/dist/index.js +530 -943
  37. package/dist/markdown.d.ts +28 -25
  38. package/dist/markdown.js +8 -1940
  39. package/dist/pagination-BZpXLvFL.d.ts +119 -0
  40. package/dist/pagination.d.ts +5 -60
  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-DcF-MZcz.d.ts → presentation-C5eHkevA.d.ts} +516 -499
  45. package/dist/repo-readme.js +1 -1
  46. package/dist/{schemas-BSjlG8-R.d.ts → schemas-DDpqAgyS.d.ts} +49 -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 +11 -11
  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 +503 -339
  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 +6 -10
  344. package/dist/audit.d.ts +0 -156
  345. package/dist/audit.js +0 -7
  346. package/dist/chunk-6LZK2IZB.js +0 -1690
  347. package/dist/chunk-FYLJVF7X.js +0 -18448
  348. package/dist/chunk-JKVKYVWL.js +0 -1332
  349. package/dist/chunk-MWPMJE6P.js +0 -622
  350. package/dist/lint.d.ts +0 -70
  351. package/dist/lint.js +0 -6
  352. package/dist/spec/catalogs/audiences/customers.json +0 -27
  353. package/dist/spec/catalogs/audiences/executives.json +0 -27
  354. package/dist/spec/catalogs/audiences/investors.json +0 -27
  355. package/dist/spec/catalogs/audiences/marketing-team.json +0 -27
  356. package/dist/spec/catalogs/audiences/regulators.json +0 -27
  357. package/dist/spec/catalogs/audiences/sales-team.json +0 -27
  358. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-2x.json +0 -91
  359. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-3x.json +0 -103
  360. package/dist/spec/catalogs/chart-types/100pct-bullet-bar.json +0 -79
  361. package/dist/spec/catalogs/chart-types/100pct-bullet-column-2x.json +0 -91
  362. package/dist/spec/catalogs/chart-types/100pct-bullet-column-3x.json +0 -103
  363. package/dist/spec/catalogs/chart-types/100pct-bullet-column.json +0 -79
  364. package/dist/spec/catalogs/chart-types/100pct-progress-bar.json +0 -105
  365. package/dist/spec/catalogs/chart-types/100pct-stacked-area-2x.json +0 -106
  366. package/dist/spec/catalogs/chart-types/100pct-stacked-area-3x.json +0 -123
  367. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-2x.json +0 -89
  368. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-3x.json +0 -100
  369. package/dist/spec/catalogs/chart-types/100pct-stacked-column-2x.json +0 -95
  370. package/dist/spec/catalogs/chart-types/100pct-stacked-column-3x.json +0 -108
  371. package/dist/spec/catalogs/chart-types/australia.json +0 -76
  372. package/dist/spec/catalogs/chart-types/box-and-whisker-2x.json +0 -136
  373. package/dist/spec/catalogs/chart-types/box-and-whisker-3x.json +0 -168
  374. package/dist/spec/catalogs/chart-types/bullet-bar-2x.json +0 -89
  375. package/dist/spec/catalogs/chart-types/bullet-bar-3x.json +0 -101
  376. package/dist/spec/catalogs/chart-types/bullet-bar.json +0 -77
  377. package/dist/spec/catalogs/chart-types/bullet-column-2x.json +0 -89
  378. package/dist/spec/catalogs/chart-types/bullet-column-3x.json +0 -101
  379. package/dist/spec/catalogs/chart-types/bullet-column.json +0 -77
  380. package/dist/spec/catalogs/chart-types/canada.json +0 -86
  381. package/dist/spec/catalogs/chart-types/clustered-bar-2x.json +0 -89
  382. package/dist/spec/catalogs/chart-types/clustered-column.json +0 -95
  383. package/dist/spec/catalogs/chart-types/dot-plot-2x.json +0 -99
  384. package/dist/spec/catalogs/chart-types/dot-plot-3x.json +0 -124
  385. package/dist/spec/catalogs/chart-types/dot-plot-4x.json +0 -149
  386. package/dist/spec/catalogs/chart-types/dot-plot-5x.json +0 -174
  387. package/dist/spec/catalogs/chart-types/dot-plot-6x.json +0 -199
  388. package/dist/spec/catalogs/chart-types/dot-plot.json +0 -74
  389. package/dist/spec/catalogs/chart-types/dumbbell.json +0 -120
  390. package/dist/spec/catalogs/chart-types/line-2x.json +0 -105
  391. package/dist/spec/catalogs/chart-types/line-3x.json +0 -127
  392. package/dist/spec/catalogs/chart-types/line-with-high-low-and-markers.json +0 -144
  393. package/dist/spec/catalogs/chart-types/line-with-high-low.json +0 -144
  394. package/dist/spec/catalogs/chart-types/line-with-markers-2x.json +0 -106
  395. package/dist/spec/catalogs/chart-types/line-with-markers-3x.json +0 -128
  396. package/dist/spec/catalogs/chart-types/sparkline-2x.json +0 -138
  397. package/dist/spec/catalogs/chart-types/sparkline-3x.json +0 -174
  398. package/dist/spec/catalogs/chart-types/sparkline-4x.json +0 -210
  399. package/dist/spec/catalogs/chart-types/sparkline-5x.json +0 -246
  400. package/dist/spec/catalogs/chart-types/sparkline-6x.json +0 -282
  401. package/dist/spec/catalogs/chart-types/sparkline.json +0 -102
  402. package/dist/spec/catalogs/chart-types/stacked-area-2x.json +0 -106
  403. package/dist/spec/catalogs/chart-types/stacked-area-3x.json +0 -123
  404. package/dist/spec/catalogs/chart-types/stacked-bar-2x.json +0 -89
  405. package/dist/spec/catalogs/chart-types/stacked-bar-3x.json +0 -100
  406. package/dist/spec/catalogs/chart-types/stacked-column-2x.json +0 -95
  407. package/dist/spec/catalogs/chart-types/stacked-column-3x.json +0 -108
  408. package/dist/spec/catalogs/chart-types/stacked-line-2x.json +0 -106
  409. package/dist/spec/catalogs/chart-types/stacked-line-3x.json +0 -123
  410. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-2x.json +0 -107
  411. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-3x.json +0 -124
  412. package/dist/spec/catalogs/chart-types/treemap-2x.json +0 -101
  413. package/dist/spec/catalogs/chart-types/treemap-3x.json +0 -122
  414. package/dist/spec/catalogs/chart-types/united-kingdom.json +0 -68
  415. package/dist/spec/catalogs/chart-types/united-states.json +0 -82
  416. package/dist/validator-DfG9yxba.d.ts +0 -172
@@ -1,622 +0,0 @@
1
- import { validatePresentation, unusedReferenceWarnings, validationDefinition, validateCatalogRecord } from './chunk-JKVKYVWL.js';
2
- import { catalogKinds, catalogEntries, catalogSchemaNames } from './chunk-E34DJ5LL.js';
3
- import { schemas, schemaEntries } from './chunk-4LAM3N6S.js';
4
- import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
5
-
6
- var own = (value, key) => Object.hasOwn(value, key);
7
- var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8
- var primitive = (value) => value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
9
- var pointer = (parts2) => parts2.length ? "/" + parts2.map((part) => String(part).replaceAll("~", "~0").replaceAll("/", "~1")).join("/") : "";
10
- function parts(path) {
11
- if (path === "") return [];
12
- if (!path.startsWith("/") || /~(?![01])/.test(path))
13
- throw new TypeError(`Invalid lint contract JSON Pointer: ${path}`);
14
- return path.slice(1).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
15
- }
16
- function at(value, path) {
17
- return parts(path).reduce(
18
- (current, key) => object(current) || Array.isArray(current) ? own(current, key) ? current[key] : void 0 : void 0,
19
- value
20
- );
21
- }
22
- function optionsChecked(options) {
23
- if (!object(options) || Object.keys(options).some((key) => !["catalogs", "contracts"].includes(key)))
24
- throw new TypeError("Lint options accept only catalogs and contracts.");
25
- if (options.catalogs !== void 0 && (!object(options.catalogs) || Object.entries(options.catalogs).some(
26
- ([kind, records]) => !catalogKinds.includes(kind) || !Array.isArray(records)
27
- )))
28
- throw new TypeError(
29
- "Lint catalogs must map known catalog kinds to arrays of loaded records."
30
- );
31
- if (options.contracts !== void 0 && !Array.isArray(options.contracts))
32
- throw new TypeError("Lint contracts must be an array.");
33
- for (const contract of options.contracts ?? []) {
34
- if (!object(contract) || Object.keys(contract).some(
35
- (key) => ![
36
- "path",
37
- "allowedValues",
38
- "severity",
39
- "message",
40
- "documentation"
41
- ].includes(key)
42
- ) || 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")
43
- throw new TypeError(
44
- "Invalid lint contract: provide a path and primitive allowedValues, with optional severity, message and documentation."
45
- );
46
- parts(contract.path);
47
- }
48
- }
49
- function report(diagnostics, schemaValid, syntax) {
50
- const counts = { error: 0, warning: 0, info: 0 };
51
- for (const diagnostic of diagnostics) counts[diagnostic.severity]++;
52
- return {
53
- valid: counts.error === 0,
54
- schemaValid,
55
- diagnostics,
56
- counts,
57
- checks: {
58
- syntax,
59
- schema: schemaValid === null ? "not-run" : "checked",
60
- catalogReferences: schemaValid === null ? "not-run" : "local-context",
61
- assetReferences: schemaValid === null ? "not-run" : "registry-only",
62
- contracts: schemaValid === null ? "not-run" : "checked",
63
- layout: "not-checked",
64
- fonts: "not-checked",
65
- nativeExport: "not-checked"
66
- }
67
- };
68
- }
69
- function schemaDiagnostic(issue, schemaName = "presentation", prefix = "", scope = "document") {
70
- 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);
71
- if (!entry) throw new TypeError(`Unknown schema ${schemaName}`);
72
- const precise = validationDefinition(issue);
73
- const definition = precise?.uri ?? (issue.keyword === "opf" ? "packages/javascript/src/validator.ts" : issue.schemaPath.startsWith("#") ? entry.schema.$id + issue.schemaPath : issue.schemaPath);
74
- const lookup = [
75
- "opf",
76
- "schema",
77
- precise?.schemaName ?? schemaName,
78
- precise?.pointer ?? (issue.keyword !== "opf" && issue.schemaPath.startsWith("#") ? issue.schemaPath.slice(1) : "")
79
- ];
80
- let help = "Inspect this schema constraint and preserve unrelated content. Errors inside oneOf/anyOf branches may describe alternatives; retain the intended form.";
81
- if (issue.keyword === "required")
82
- help = `Add the required ${JSON.stringify(issue.params.missingProperty)} field in this object, using the intended schema form.`;
83
- else if (issue.keyword === "additionalProperties")
84
- 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.`;
85
- else if (issue.keyword === "enum")
86
- help = "Choose one of this schema branch\u2019s allowed values; inspect the other alternatives if the field uses another form.";
87
- else if (issue.keyword === "opf")
88
- help = "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
89
- const allowed = Array.isArray(issue.params.allowedValues) ? issue.params.allowedValues.filter(primitive) : [];
90
- return {
91
- ruleId: "opf/schema",
92
- severity: "error",
93
- path,
94
- scope,
95
- message: issue.message,
96
- help,
97
- definition,
98
- lookup,
99
- validation: issue,
100
- ...allowed.length ? {
101
- suggestions: allowed.map((value) => ({
102
- value,
103
- label: String(value),
104
- origin: "schema",
105
- definition
106
- }))
107
- } : {}
108
- };
109
- }
110
- function resolve(cursor, seen = /* @__PURE__ */ new Set()) {
111
- const ref = cursor.schema.$ref;
112
- if (typeof ref !== "string") return cursor;
113
- const id = String(cursor.root.$id ?? "") + ref;
114
- if (seen.has(id)) return { ...cursor, schema: {} };
115
- seen.add(id);
116
- const [base, fragment = ""] = ref.split("#"), root = base ? schemaEntries.find((entry) => entry.schema.$id === base)?.schema : cursor.root;
117
- if (!root) return { ...cursor, schema: {} };
118
- const target = at(root, fragment);
119
- if (!object(target)) return { ...cursor, schema: {} };
120
- const resolved = resolve(
121
- { schema: target, root, path: fragment },
122
- seen
123
- );
124
- const { $ref, ...rest } = cursor.schema;
125
- return { ...resolved, schema: { ...resolved.schema, ...rest } };
126
- }
127
- function score(schema, value) {
128
- const type = schema.type;
129
- 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))
130
- return -1e4;
131
- if (own(schema, "const")) return schema.const === value ? 100 : -1e4;
132
- let result = 1;
133
- if (object(value) && object(schema.properties)) {
134
- for (const [key, child] of Object.entries(schema.properties))
135
- if (own(value, key) && object(child))
136
- result += own(child, "const") ? child.const === value[key] ? 100 : -1e3 : 1;
137
- }
138
- if (Array.isArray(schema.required)) {
139
- for (const key of schema.required)
140
- if (typeof key === "string" && (!object(value) || !own(value, key)))
141
- result -= 2;
142
- }
143
- return result;
144
- }
145
- function active(cursor, value) {
146
- const resolved = resolve(cursor), alternatives = resolved.schema.oneOf ?? resolved.schema.anyOf;
147
- if (!Array.isArray(alternatives)) return resolved;
148
- const keyword = resolved.schema.oneOf ? "oneOf" : "anyOf";
149
- const candidates = alternatives.filter(object).map(
150
- (schema, index) => active(
151
- {
152
- schema,
153
- root: resolved.root,
154
- path: `${resolved.path}/${keyword}/${index}`
155
- },
156
- value
157
- )
158
- );
159
- const selected = candidates.sort((a, b) => score(b.schema, value) - score(a.schema, value))[0];
160
- return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved] } : resolved;
161
- }
162
- function catalogIn(schema) {
163
- const text = String(schema.description ?? "");
164
- if (/\bfont-scheme id\b/.test(text)) return "fontSchemes";
165
- return catalogKinds.find(
166
- (kind) => text.includes(`catalogs.${kind}`) || new RegExp(`\\b${kind}['\u2019]? catalog`).test(text)
167
- );
168
- }
169
- var languageTagSyntax = new RegExp(
170
- "^(?:(?:[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})+)$",
171
- "i"
172
- );
173
- var irregularLanguageTags = /* @__PURE__ */ new Set([
174
- "en-gb-oed",
175
- "i-ami",
176
- "i-bnn",
177
- "i-default",
178
- "i-enochian",
179
- "i-hak",
180
- "i-klingon",
181
- "i-lux",
182
- "i-mingo",
183
- "i-navajo",
184
- "i-pwn",
185
- "i-tao",
186
- "i-tay",
187
- "i-tsu",
188
- "sgn-be-fr",
189
- "sgn-be-nl",
190
- "sgn-ch-de"
191
- ]);
192
- function childCursor(cursors, key) {
193
- for (const keyword of [
194
- "properties",
195
- "patternProperties",
196
- "additionalProperties"
197
- ]) {
198
- for (const cursor of cursors) {
199
- const declarations = cursor.schema[keyword];
200
- if (!object(declarations)) continue;
201
- const name = keyword === "properties" ? key : keyword === "patternProperties" ? Object.keys(declarations).find(
202
- (pattern) => new RegExp(pattern).test(key)
203
- ) : void 0;
204
- const schema = keyword === "additionalProperties" ? declarations : name === void 0 ? void 0 : declarations[name];
205
- if (object(schema))
206
- return {
207
- schema,
208
- root: cursor.root,
209
- path: `${cursor.path}/${keyword}${name === void 0 ? "" : pointer([name])}`
210
- };
211
- }
212
- }
213
- return void 0;
214
- }
215
- function fields(document) {
216
- const result = [], stack = [
217
- {
218
- value: document,
219
- path: [],
220
- cursor: {
221
- schema: schemas.presentation,
222
- root: schemas.presentation,
223
- path: ""
224
- },
225
- ancestors: []
226
- }
227
- ];
228
- while (stack.length) {
229
- const entry = stack.pop();
230
- if (!entry) break;
231
- if (entry.ancestors.includes(entry.value)) continue;
232
- const resolved = resolve(entry.cursor), selected = active(entry.cursor, entry.value), description = String(resolved.schema.description ?? "");
233
- const assetReference = [resolved, selected].some(
234
- (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(
235
- (example) => typeof example === "string" && example.startsWith("asset:")
236
- )
237
- );
238
- result.push({
239
- path: pointer(entry.path),
240
- value: entry.value,
241
- cursor: resolved,
242
- kind: catalogIn(resolved.schema),
243
- description,
244
- assetReference
245
- });
246
- const ancestors = [...entry.ancestors, entry.value];
247
- const cursors = [selected, ...selected.baseSchemas ?? [], resolved];
248
- const arrayCursor = cursors.find((cursor) => object(cursor.schema.items));
249
- if (Array.isArray(entry.value) && arrayCursor)
250
- entry.value.forEach((value, index) => {
251
- stack.push({
252
- value,
253
- path: [...entry.path, index],
254
- cursor: {
255
- schema: arrayCursor.schema.items,
256
- root: arrayCursor.root,
257
- path: `${arrayCursor.path}/items`
258
- },
259
- ancestors
260
- });
261
- });
262
- else if (object(entry.value))
263
- for (const [key, value] of Object.entries(entry.value)) {
264
- if (entry.path.length === 0 && key === "catalogs") continue;
265
- const cursor = childCursor(cursors, key);
266
- if (!cursor) continue;
267
- stack.push({
268
- value,
269
- path: [...entry.path, key],
270
- cursor,
271
- ancestors
272
- });
273
- }
274
- }
275
- return result;
276
- }
277
- function catalogContext(document, options, diagnostics) {
278
- const result = /* @__PURE__ */ new Map();
279
- for (const entry of catalogEntries) {
280
- const kind = entry.kind, map = /* @__PURE__ */ new Map();
281
- result.set(kind, map);
282
- for (const record of entry.records)
283
- map.set(record.id, {
284
- value: record.id,
285
- label: String(
286
- record.name ?? record.id
287
- ),
288
- origin: "built-in",
289
- definition: `spec/${entry.dir}/${entry.index.records.find((item) => item.id === record.id)?.file ?? `${record.id}.json`}`
290
- });
291
- const local = object(document) && object(document.catalogs) && object(document.catalogs[kind]) ? document.catalogs[kind] : {};
292
- if (local.source !== void 0)
293
- diagnostics.push({
294
- ruleId: "opf/catalog-source",
295
- severity: "info",
296
- scope: "document",
297
- path: `/catalogs/${kind}/source`,
298
- message: "External catalog source was not fetched.",
299
- 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."
300
- });
301
- for (const group of [
302
- {
303
- records: options.catalogs?.[kind] ?? [],
304
- origin: "loaded",
305
- scope: "context",
306
- path: `/catalogs/${kind}`
307
- },
308
- {
309
- records: Array.isArray(local.records) ? local.records : [],
310
- origin: "document",
311
- scope: "document",
312
- path: `/catalogs/${kind}/records`
313
- }
314
- ]) {
315
- const seen = /* @__PURE__ */ new Set();
316
- group.records.forEach((value, index) => {
317
- const path = `${group.path}/${index}`, schemaName = catalogSchemaNames[kind], record = object(value) ? { $schema: schemas[schemaName].$id, ...value } : value;
318
- const validation = validateCatalogRecord(kind, record);
319
- for (const issue of validation.errors)
320
- diagnostics.push({
321
- ...schemaDiagnostic(issue, schemaName, path, group.scope),
322
- ruleId: "opf/catalog-record"
323
- });
324
- if (!object(value) || typeof value.id !== "string") return;
325
- if (seen.has(value.id))
326
- diagnostics.push({
327
- ruleId: "opf/catalog-record",
328
- severity: "error",
329
- scope: group.scope,
330
- path: `${path}/id`,
331
- message: `Duplicate ${kind} record id ${JSON.stringify(value.id)} in this catalog.`,
332
- help: "Give distinct records distinct IDs, or combine the intended override explicitly. Preserve their authored content."
333
- });
334
- seen.add(value.id);
335
- if (!validation.valid) {
336
- map.delete(value.id);
337
- return;
338
- }
339
- map.set(value.id, {
340
- value: value.id,
341
- label: typeof value.name === "string" ? value.name : value.id,
342
- origin: group.origin,
343
- definition: `${group.scope}#${path}`
344
- });
345
- });
346
- }
347
- }
348
- return result;
349
- }
350
- function distance(a, b) {
351
- a = a.slice(0, 128);
352
- b = b.slice(0, 128);
353
- let row = Array.from({ length: b.length + 1 }, (_, i) => i);
354
- for (let i = 0; i < a.length; i++) {
355
- const next = [i + 1];
356
- for (let j = 0; j < b.length; j++)
357
- next.push(
358
- Math.min(
359
- (next[j] ?? Infinity) + 1,
360
- (row[j + 1] ?? Infinity) + 1,
361
- (row[j] ?? Infinity) + (a[i] === b[j] ? 0 : 1)
362
- )
363
- );
364
- row = next;
365
- }
366
- return row[b.length] ?? Math.max(a.length, b.length);
367
- }
368
- function lintPresentation(document, options = {}) {
369
- optionsChecked(options);
370
- const validation = validatePresentation(document), diagnostics = validation.errors.map(
371
- (issue) => typeof issue.params.code === "string" && issue.keyword === "opf" ? { ...schemaDiagnostic(issue), ruleId: `opf/${issue.params.code}` } : schemaDiagnostic(issue)
372
- );
373
- const catalogs = catalogContext(document, options, diagnostics), seen = /* @__PURE__ */ new Set();
374
- const assetValues = object(document) && object(document.assets) ? document.assets : {};
375
- for (const field of fields(document)) {
376
- if (typeof field.value === "string" && field.value.startsWith("asset:") && field.assetReference) {
377
- const id = field.value.slice(6);
378
- if (!own(assetValues, id))
379
- diagnostics.push({
380
- ruleId: "opf/asset-reference",
381
- severity: "error",
382
- scope: "document",
383
- path: field.path,
384
- message: `Asset ${JSON.stringify(id)} is missing from the document registry.`,
385
- help: "Supply the intended asset in document.assets or choose the correct existing asset ID. External files and URLs are not fetched or verified.",
386
- definition: schemas.presentation.$id + "#/$defs/Assets",
387
- lookup: ["opf", "schema", "presentation", "/$defs/Assets"],
388
- suggestions: Object.keys(assetValues).sort(
389
- (a, b) => distance(id, a) - distance(id, b) || (a < b ? -1 : a > b ? 1 : 0)
390
- ).slice(0, 5).map((id2) => ({
391
- value: `asset:${id2}`,
392
- label: id2,
393
- origin: "document",
394
- definition: `document#${pointer(["assets", id2])}`
395
- }))
396
- });
397
- }
398
- if (!field.path || !field.kind) continue;
399
- const { kind } = field;
400
- if (kind === "languages" && field.path === "/language" && typeof field.value === "string" && (languageTagSyntax.test(field.value) || irregularLanguageTags.has(field.value.toLowerCase())))
401
- continue;
402
- if (kind !== "layouts" && /free-form/i.test(field.description)) continue;
403
- if (kind === "narratives" && (object(field.value) || field.cursor.root.$id === schemas.presentation.$id && field.cursor.path === "/$defs/Narrative/properties/id"))
404
- continue;
405
- const value = object(field.value) ? field.value.id : field.value, path = object(field.value) ? `${field.path}/id` : field.path;
406
- if (typeof value !== "string" || !value || /^(?:https?:|pkg:)/i.test(value) || catalogs.get(kind)?.has(value) || seen.has(path))
407
- continue;
408
- seen.add(path);
409
- const suggestions = [...catalogs.get(kind)?.values() ?? []].sort(
410
- (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)
411
- ).slice(0, 5);
412
- const definition = String(field.cursor.root.$id) + `#${field.cursor.path}`;
413
- diagnostics.push({
414
- ruleId: "opf/catalog-reference",
415
- severity: "warning",
416
- scope: "document",
417
- path,
418
- message: `Unknown ${kind} catalog id ${JSON.stringify(value)} in the available local context.`,
419
- 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.",
420
- definition,
421
- lookup: ["opf", "catalog", kind],
422
- suggestions
423
- });
424
- }
425
- const reportedCycles = /* @__PURE__ */ new Set();
426
- for (const id of Object.keys(assetValues)) {
427
- const chain = [], seenIds = /* @__PURE__ */ new Set();
428
- let current = id;
429
- while (current !== void 0 && own(assetValues, current)) {
430
- if (seenIds.has(current)) {
431
- const cycle = chain.slice(chain.indexOf(current));
432
- if (!cycle.some((id2) => reportedCycles.has(id2))) {
433
- for (const id2 of cycle) reportedCycles.add(id2);
434
- diagnostics.push({
435
- ruleId: "opf/asset-cycle",
436
- severity: "error",
437
- scope: "document",
438
- path: pointer(["assets", current]),
439
- message: `Asset references form a cycle: ${[...cycle, current].map((id2) => JSON.stringify(id2)).join(" \u2192 ")}.`,
440
- help: "Replace one link with the intended concrete source. Preserve the original asset metadata; no files or URLs were fetched."
441
- });
442
- }
443
- break;
444
- }
445
- seenIds.add(current);
446
- chain.push(current);
447
- const value = assetValues[current], source = object(value) ? value.src : value;
448
- current = typeof source === "string" && source.startsWith("asset:") ? source.slice(6) : void 0;
449
- }
450
- }
451
- for (const issue of validation.warnings) {
452
- const kind = issue.params.kind, id = issue.params.id, replacedBy = issue.params.replacedBy;
453
- if (typeof replacedBy === "string" && typeof id === "string") {
454
- const target = catalogs.get(kind)?.get(replacedBy);
455
- diagnostics.push({
456
- ...schemaDiagnostic(issue),
457
- ruleId: "opf/deprecated-catalog-id",
458
- severity: "warning",
459
- message: `Deprecated ${kind} catalog id ${JSON.stringify(id)}; use ${JSON.stringify(replacedBy)} instead.`,
460
- help: "The deprecated id still resolves to its original record, so nothing breaks. Switch to the replacement when you next edit this reference.",
461
- lookup: ["opf", "catalog", kind],
462
- ...target ? { suggestions: [target] } : {}
463
- });
464
- continue;
465
- }
466
- if (seen.has(issue.path) || typeof id === "string" && catalogs.get(kind)?.has(id))
467
- continue;
468
- diagnostics.push({
469
- ...schemaDiagnostic(issue),
470
- ruleId: "opf/catalog-reference",
471
- severity: "warning",
472
- help: "Inspect the referenced catalog and supply the intended record if this is a custom context."
473
- });
474
- }
475
- for (const [index, contract] of (options.contracts ?? []).entries()) {
476
- const pattern = parts(contract.path), stack = [{ value: document, path: [], depth: 0 }];
477
- while (stack.length) {
478
- const entry = stack.pop();
479
- if (!entry) break;
480
- if (entry.depth === pattern.length) {
481
- if (contract.allowedValues.some((value) => Object.is(value, entry.value)))
482
- continue;
483
- const path = pointer(entry.path), definition = contract.documentation ?? `context#/contracts/${index}`, values = {
484
- path,
485
- value: JSON.stringify(entry.value),
486
- allowed: contract.allowedValues.map((value) => JSON.stringify(value)).join(", "),
487
- file: definition
488
- };
489
- const message = (contract.message ?? "This value is outside the allowed values for {{path}}.").replace(
490
- /\{\{(path|value|allowed|file)\}\}/g,
491
- (_, key) => values[key] ?? ""
492
- );
493
- diagnostics.push({
494
- ruleId: "opf/contract",
495
- severity: contract.severity ?? "error",
496
- scope: "document",
497
- path,
498
- message,
499
- help: `Use one of the configured values: ${values.allowed}. This is an explicit host policy; no source was changed.`,
500
- definition,
501
- suggestions: contract.allowedValues.map((value) => ({
502
- value,
503
- label: String(value),
504
- origin: "contract",
505
- definition
506
- }))
507
- });
508
- } else if (object(entry.value) || Array.isArray(entry.value)) {
509
- const key = pattern[entry.depth];
510
- for (const [name, value] of Object.entries(entry.value))
511
- if (key === "*" || key === name)
512
- stack.push({
513
- value,
514
- path: [...entry.path, name],
515
- depth: entry.depth + 1
516
- });
517
- }
518
- }
519
- }
520
- for (const issue of unusedReferenceWarnings(document))
521
- diagnostics.push({
522
- ruleId: "opf/unused-reference",
523
- severity: "warning",
524
- scope: "document",
525
- path: issue.path,
526
- message: issue.message,
527
- 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.",
528
- definition: schemas.presentation.$id + "#/$defs/Reference",
529
- lookup: ["opf", "schema", "presentation", "/$defs/Reference"],
530
- validation: issue
531
- });
532
- return report(diagnostics, validation.valid, "not-applicable");
533
- }
534
- function lintSource(source, options = {}) {
535
- optionsChecked(options);
536
- const errors = [], tree = parseTree(
537
- source.startsWith("\uFEFF") ? " " + source.slice(1) : source,
538
- errors,
539
- {
540
- disallowComments: true,
541
- allowTrailingComma: false,
542
- allowEmptyContent: false
543
- }
544
- );
545
- const lineStarts = [0];
546
- for (let i = 0; i < source.length; i++) {
547
- if (source[i] === "\r") {
548
- if (source[i + 1] === "\n") i++;
549
- lineStarts.push(i + 1);
550
- } else if (source[i] === "\n") lineStarts.push(i + 1);
551
- }
552
- const location = (offset, length) => {
553
- let lo = 0, hi = lineStarts.length;
554
- while (lo + 1 < hi) {
555
- const mid = lo + hi >> 1;
556
- if ((lineStarts[mid] ?? 0) <= offset) lo = mid;
557
- else hi = mid;
558
- }
559
- return {
560
- offset,
561
- length,
562
- line: lo + 1,
563
- column: offset - (lineStarts[lo] ?? 0) + 1
564
- };
565
- };
566
- if (errors.length || !tree)
567
- return report(
568
- errors.map((error) => ({
569
- ruleId: "json/syntax",
570
- severity: "error",
571
- scope: "document",
572
- path: "",
573
- message: printParseErrorCode(error.error),
574
- help: "Repair the JSON syntax at this source range. No content or whitespace has been rewritten.",
575
- location: location(error.offset, error.length)
576
- })),
577
- null,
578
- "checked"
579
- );
580
- const diagnostics = [], stack = [tree];
581
- while (stack.length) {
582
- const node = stack.pop();
583
- if (!node) break;
584
- if (node.type === "object") {
585
- const keys = /* @__PURE__ */ new Set();
586
- for (const property of node.children ?? []) {
587
- const key = property.children?.[0];
588
- if (!key) continue;
589
- if (keys.has(key.value))
590
- diagnostics.push({
591
- ruleId: "json/duplicate-key",
592
- severity: "error",
593
- scope: "document",
594
- path: pointer(getNodePath(key)),
595
- message: `Duplicate JSON property ${JSON.stringify(key.value)}.`,
596
- help: "Resolve the duplicate explicitly, preserving the intended content from both occurrences. JSON.parse would otherwise hide an earlier value.",
597
- location: location(key.offset, key.length)
598
- });
599
- keys.add(key.value);
600
- }
601
- }
602
- stack.push(...node.children ?? []);
603
- }
604
- const result = lintPresentation(
605
- JSON.parse(source.replace(/^\uFEFF/, "")),
606
- options
607
- );
608
- for (const diagnostic of result.diagnostics) {
609
- if (diagnostic.scope === "document") {
610
- let node = tree;
611
- for (const part of parts(diagnostic.path))
612
- node = node?.type === "array" ? node.children?.[Number(part)] : node?.type === "object" ? node.children?.find(
613
- (property) => property.children?.[0]?.value === part
614
- )?.children?.[1] : void 0;
615
- if (node) diagnostic.location = location(node.offset, node.length);
616
- }
617
- diagnostics.push(diagnostic);
618
- }
619
- return report(diagnostics, result.schemaValid, "checked");
620
- }
621
-
622
- export { lintPresentation, lintSource };
package/dist/lint.d.ts DELETED
@@ -1,70 +0,0 @@
1
- import { C as CatalogKind } from './catalogs-BnI7JKcn.js';
2
- import { V as ValidationIssue } from './validator-DfG9yxba.js';
3
- import { J as JsonPrimitive } from './schemas-BSjlG8-R.js';
4
- import './presentation-DcF-MZcz.js';
5
-
6
- type LintSeverity = 'error' | 'warning' | 'info';
7
- interface LintLocation {
8
- offset: number;
9
- length: number;
10
- line: number;
11
- column: number;
12
- }
13
- interface LintSuggestion {
14
- value: JsonPrimitive;
15
- label: string;
16
- origin: 'schema' | 'built-in' | 'loaded' | 'document' | 'contract';
17
- definition: string;
18
- }
19
- interface LintDiagnostic {
20
- ruleId: string;
21
- severity: LintSeverity;
22
- /** JSON Pointer into the document, or the explicitly supplied lint context. */
23
- path: string;
24
- scope: 'document' | 'context';
25
- message: string;
26
- help: string;
27
- definition?: string;
28
- lookup?: string[];
29
- suggestions?: LintSuggestion[];
30
- /** Full validation issue retained, including errors inside union alternatives. */
31
- validation?: ValidationIssue;
32
- /** Original-source UTF-16 offsets and one-based line/column. */
33
- location?: LintLocation;
34
- }
35
- interface LintContract {
36
- /** JSON Pointer pattern; a complete '*' segment matches one path segment. */
37
- path: string;
38
- allowedValues: JsonPrimitive[];
39
- severity?: LintSeverity;
40
- message?: string;
41
- documentation?: string;
42
- }
43
- interface LintOptions {
44
- /** Records already loaded by the host. This API never fetches catalog URLs. */
45
- catalogs?: Partial<Record<CatalogKind, readonly unknown[]>>;
46
- /** Explicit host policy. Document metadata is never interpreted as policy. */
47
- contracts?: readonly LintContract[];
48
- }
49
- interface LintReport {
50
- valid: boolean;
51
- schemaValid: boolean | null;
52
- diagnostics: LintDiagnostic[];
53
- counts: Record<LintSeverity, number>;
54
- checks: {
55
- syntax: 'checked' | 'not-applicable';
56
- schema: 'checked' | 'not-run';
57
- catalogReferences: 'local-context' | 'not-run';
58
- assetReferences: 'registry-only' | 'not-run';
59
- contracts: 'checked' | 'not-run';
60
- layout: 'not-checked';
61
- fonts: 'not-checked';
62
- nativeExport: 'not-checked';
63
- };
64
- }
65
- /** Read-only lint with actionable schema, local catalog and explicit policy context. */
66
- declare function lintPresentation(document: unknown, options?: LintOptions): LintReport;
67
- /** Lint strict JSON source without normalizing whitespace or duplicate keys. */
68
- declare function lintSource(source: string, options?: LintOptions): LintReport;
69
-
70
- export { type LintContract, type LintDiagnostic, type LintLocation, type LintOptions, type LintReport, type LintSeverity, type LintSuggestion, lintPresentation, lintSource };