@scaffold-ui-kit/preview 0.0.0-stage → 2.3.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 (350) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1868 -2
  3. package/application/host/bootstrap.ts +43 -0
  4. package/application/host/main.ts +31 -0
  5. package/application/host/shell-host.ts +47 -0
  6. package/application/index.html +12 -0
  7. package/application/lib/base-url.ts +15 -0
  8. package/application/lib/no-code-block.ts +7 -0
  9. package/application/lib/no-setup.ts +3 -0
  10. package/application/lib/no-views.ts +6 -0
  11. package/application/preview/code/code.html +12 -0
  12. package/application/preview/code/main.ts +89 -0
  13. package/application/preview/globals.ts +254 -0
  14. package/application/preview/html/main.ts +93 -0
  15. package/application/preview/html/preview.html +12 -0
  16. package/application/preview/react/main.tsx +146 -0
  17. package/application/preview/react/preview.html +12 -0
  18. package/application/preview/svelte/Preview.svelte +104 -0
  19. package/application/preview/svelte/main.ts +13 -0
  20. package/application/preview/svelte/preview.html +12 -0
  21. package/application/preview/svelte/story-props.ts +172 -0
  22. package/application/preview/view/main.ts +124 -0
  23. package/application/preview/view/view.html +12 -0
  24. package/application/preview/vue/main.ts +145 -0
  25. package/application/preview/vue/preview.html +12 -0
  26. package/application/shells/charcell/components/Application/index.css +37 -0
  27. package/application/shells/charcell/components/Application/index.tsx +65 -0
  28. package/application/shells/charcell/components/Bar/index.css +68 -0
  29. package/application/shells/charcell/components/Bar/index.tsx +60 -0
  30. package/application/shells/charcell/components/CodePane/index.css +60 -0
  31. package/application/shells/charcell/components/CodePane/index.tsx +113 -0
  32. package/application/shells/charcell/components/ComponentStage/index.css +26 -0
  33. package/application/shells/charcell/components/ComponentStage/index.tsx +110 -0
  34. package/application/shells/charcell/components/Control/index.css +20 -0
  35. package/application/shells/charcell/components/Control/index.tsx +118 -0
  36. package/application/shells/charcell/components/CopyLink/index.tsx +35 -0
  37. package/application/shells/charcell/components/Description/index.css +6 -0
  38. package/application/shells/charcell/components/Description/index.tsx +24 -0
  39. package/application/shells/charcell/components/EditorAddDialog/index.css +9 -0
  40. package/application/shells/charcell/components/EditorAddDialog/index.tsx +158 -0
  41. package/application/shells/charcell/components/EditorPanel/index.css +48 -0
  42. package/application/shells/charcell/components/EditorPanel/index.tsx +496 -0
  43. package/application/shells/charcell/components/EventsRow/index.css +42 -0
  44. package/application/shells/charcell/components/EventsRow/index.tsx +68 -0
  45. package/application/shells/charcell/components/HeadingRow/index.css +11 -0
  46. package/application/shells/charcell/components/HeadingRow/index.tsx +16 -0
  47. package/application/shells/charcell/components/Hint/index.css +16 -0
  48. package/application/shells/charcell/components/Hint/index.tsx +81 -0
  49. package/application/shells/charcell/components/HtmlWarnings/index.tsx +45 -0
  50. package/application/shells/charcell/components/KeyHints/index.css +27 -0
  51. package/application/shells/charcell/components/KeyHints/index.tsx +106 -0
  52. package/application/shells/charcell/components/KitCodeBlock/index.css +55 -0
  53. package/application/shells/charcell/components/KitCodeBlock/index.tsx +18 -0
  54. package/application/shells/charcell/components/Markdown/index.tsx +16 -0
  55. package/application/shells/charcell/components/Navigation/index.css +13 -0
  56. package/application/shells/charcell/components/Navigation/index.tsx +98 -0
  57. package/application/shells/charcell/components/NavigationSplit/index.css +16 -0
  58. package/application/shells/charcell/components/NavigationSplit/index.tsx +82 -0
  59. package/application/shells/charcell/components/OptionControls/index.tsx +93 -0
  60. package/application/shells/charcell/components/PaneStatus/index.css +7 -0
  61. package/application/shells/charcell/components/PaneStatus/index.tsx +47 -0
  62. package/application/shells/charcell/components/PaneWidth/index.tsx +45 -0
  63. package/application/shells/charcell/components/PreviewGrid/index.css +39 -0
  64. package/application/shells/charcell/components/PreviewGrid/index.tsx +344 -0
  65. package/application/shells/charcell/components/PreviewPane/index.css +127 -0
  66. package/application/shells/charcell/components/PreviewPane/index.tsx +182 -0
  67. package/application/shells/charcell/components/PromptBar/index.tsx +133 -0
  68. package/application/shells/charcell/components/ScenarioRow/index.css +36 -0
  69. package/application/shells/charcell/components/ScenarioRow/index.tsx +71 -0
  70. package/application/shells/charcell/components/Select/index.tsx +48 -0
  71. package/application/shells/charcell/components/SlotOutlet/index.css +7 -0
  72. package/application/shells/charcell/components/SlotOutlet/index.tsx +25 -0
  73. package/application/shells/charcell/components/StageBar/index.css +7 -0
  74. package/application/shells/charcell/components/StageBar/index.tsx +109 -0
  75. package/application/shells/charcell/components/StageSplit/index.css +11 -0
  76. package/application/shells/charcell/components/StageSplit/index.tsx +99 -0
  77. package/application/shells/charcell/components/StatusBar/index.tsx +30 -0
  78. package/application/shells/charcell/components/ViewControls/index.css +15 -0
  79. package/application/shells/charcell/components/ViewControls/index.tsx +58 -0
  80. package/application/shells/charcell/components/ViewHeading/index.css +13 -0
  81. package/application/shells/charcell/components/ViewHeading/index.tsx +8 -0
  82. package/application/shells/charcell/components/ViewStage/index.css +9 -0
  83. package/application/shells/charcell/components/ViewStage/index.tsx +25 -0
  84. package/application/shells/charcell/components/WrapToggle/index.tsx +27 -0
  85. package/application/shells/charcell/configuration.ts +45 -0
  86. package/application/shells/charcell/controller-context.ts +27 -0
  87. package/application/shells/charcell/fit-labels.ts +42 -0
  88. package/application/shells/charcell/html-warnings.ts +18 -0
  89. package/application/shells/charcell/index.tsx +82 -0
  90. package/application/shells/charcell/page-loading.html +57 -0
  91. package/application/shells/charcell/placement.ts +24 -0
  92. package/application/shells/charcell/shell-options.ts +23 -0
  93. package/application/shells/charcell/shell.css +37 -0
  94. package/application/shells/charcell/shell.tsx +25 -0
  95. package/application/shells/charcell/split-reset.ts +47 -0
  96. package/application/shells/charcell/stacked-rows.ts +117 -0
  97. package/application/shells/charcell/stage-toggles.ts +93 -0
  98. package/application/types/manifest.d.ts +6 -0
  99. package/application/types/preview-configuration.d.ts +10 -0
  100. package/application/types/preview-shell.d.ts +7 -0
  101. package/application/types/react-registry.d.ts +15 -0
  102. package/application/types/vue-registry.d.ts +6 -0
  103. package/dist/build.d.ts +24 -0
  104. package/dist/build.js +34 -0
  105. package/dist/check.d.ts +48 -0
  106. package/dist/check.js +781 -0
  107. package/dist/cli.d.ts +2 -0
  108. package/dist/cli.js +88 -0
  109. package/dist/context.d.ts +179 -0
  110. package/dist/context.js +783 -0
  111. package/dist/controller/catalog.d.ts +339 -0
  112. package/dist/controller/catalog.js +367 -0
  113. package/dist/controller/create-preview-controller.d.ts +532 -0
  114. package/dist/controller/create-preview-controller.js +1707 -0
  115. package/dist/controller/editor-tree.d.ts +161 -0
  116. package/dist/controller/editor-tree.js +373 -0
  117. package/dist/controller/html-source.d.ts +62 -0
  118. package/dist/controller/html-source.js +61 -0
  119. package/dist/controller/index.d.ts +9 -0
  120. package/dist/controller/index.js +12 -0
  121. package/dist/controller/persistence.d.ts +191 -0
  122. package/dist/controller/persistence.js +315 -0
  123. package/dist/controller/regeneration.d.ts +30 -0
  124. package/dist/controller/regeneration.js +27 -0
  125. package/dist/controller/source.d.ts +80 -0
  126. package/dist/controller/source.js +236 -0
  127. package/dist/controller/store.d.ts +27 -0
  128. package/dist/controller/store.js +40 -0
  129. package/dist/declarations/application/shells/charcell/components/Application/index.d.ts +2 -0
  130. package/dist/declarations/application/shells/charcell/components/Bar/index.d.ts +11 -0
  131. package/dist/declarations/application/shells/charcell/components/CodePane/index.d.ts +5 -0
  132. package/dist/declarations/application/shells/charcell/components/ComponentStage/index.d.ts +2 -0
  133. package/dist/declarations/application/shells/charcell/components/Control/index.d.ts +9 -0
  134. package/dist/declarations/application/shells/charcell/components/CopyLink/index.d.ts +1 -0
  135. package/dist/declarations/application/shells/charcell/components/Description/index.d.ts +5 -0
  136. package/dist/declarations/application/shells/charcell/components/EditorAddDialog/index.d.ts +6 -0
  137. package/dist/declarations/application/shells/charcell/components/EditorPanel/index.d.ts +2 -0
  138. package/dist/declarations/application/shells/charcell/components/EventsRow/index.d.ts +4 -0
  139. package/dist/declarations/application/shells/charcell/components/HeadingRow/index.d.ts +6 -0
  140. package/dist/declarations/application/shells/charcell/components/Hint/index.d.ts +11 -0
  141. package/dist/declarations/application/shells/charcell/components/HtmlWarnings/index.d.ts +5 -0
  142. package/dist/declarations/application/shells/charcell/components/KeyHints/index.d.ts +2 -0
  143. package/dist/declarations/application/shells/charcell/components/KitCodeBlock/index.d.ts +5 -0
  144. package/dist/declarations/application/shells/charcell/components/Markdown/index.d.ts +3 -0
  145. package/dist/declarations/application/shells/charcell/components/Navigation/index.d.ts +8 -0
  146. package/dist/declarations/application/shells/charcell/components/NavigationSplit/index.d.ts +7 -0
  147. package/dist/declarations/application/shells/charcell/components/OptionControls/index.d.ts +7 -0
  148. package/dist/declarations/application/shells/charcell/components/PaneStatus/index.d.ts +2 -0
  149. package/dist/declarations/application/shells/charcell/components/PaneWidth/index.d.ts +4 -0
  150. package/dist/declarations/application/shells/charcell/components/PreviewGrid/index.d.ts +7 -0
  151. package/dist/declarations/application/shells/charcell/components/PreviewPane/index.d.ts +9 -0
  152. package/dist/declarations/application/shells/charcell/components/PromptBar/index.d.ts +1 -0
  153. package/dist/declarations/application/shells/charcell/components/ScenarioRow/index.d.ts +2 -0
  154. package/dist/declarations/application/shells/charcell/components/Select/index.d.ts +16 -0
  155. package/dist/declarations/application/shells/charcell/components/SlotOutlet/index.d.ts +5 -0
  156. package/dist/declarations/application/shells/charcell/components/StageBar/index.d.ts +2 -0
  157. package/dist/declarations/application/shells/charcell/components/StageSplit/index.d.ts +17 -0
  158. package/dist/declarations/application/shells/charcell/components/StatusBar/index.d.ts +1 -0
  159. package/dist/declarations/application/shells/charcell/components/ViewControls/index.d.ts +9 -0
  160. package/dist/declarations/application/shells/charcell/components/ViewHeading/index.d.ts +4 -0
  161. package/dist/declarations/application/shells/charcell/components/ViewStage/index.d.ts +4 -0
  162. package/dist/declarations/application/shells/charcell/components/WrapToggle/index.d.ts +1 -0
  163. package/dist/declarations/application/shells/charcell/configuration.d.ts +31 -0
  164. package/dist/declarations/application/shells/charcell/controller-context.d.ts +9 -0
  165. package/dist/declarations/application/shells/charcell/fit-labels.d.ts +18 -0
  166. package/dist/declarations/application/shells/charcell/html-warnings.d.ts +5 -0
  167. package/dist/declarations/application/shells/charcell/index.d.ts +39 -0
  168. package/dist/declarations/application/shells/charcell/placement.d.ts +7 -0
  169. package/dist/declarations/application/shells/charcell/shell-options.d.ts +15 -0
  170. package/dist/declarations/application/shells/charcell/shell.d.ts +9 -0
  171. package/dist/declarations/application/shells/charcell/split-reset.d.ts +30 -0
  172. package/dist/declarations/application/shells/charcell/stacked-rows.d.ts +58 -0
  173. package/dist/declarations/application/shells/charcell/stage-toggles.d.ts +28 -0
  174. package/dist/declarations/src/controller/catalog.d.ts +339 -0
  175. package/dist/declarations/src/controller/create-preview-controller.d.ts +532 -0
  176. package/dist/declarations/src/controller/editor-tree.d.ts +161 -0
  177. package/dist/declarations/src/controller/html-source.d.ts +62 -0
  178. package/dist/declarations/src/controller/index.d.ts +9 -0
  179. package/dist/declarations/src/controller/persistence.d.ts +191 -0
  180. package/dist/declarations/src/controller/regeneration.d.ts +30 -0
  181. package/dist/declarations/src/controller/source.d.ts +80 -0
  182. package/dist/declarations/src/controller/store.d.ts +27 -0
  183. package/dist/declarations/src/emit/common.d.ts +103 -0
  184. package/dist/declarations/src/emit/manifest.d.ts +138 -0
  185. package/dist/declarations/src/emit/source.d.ts +87 -0
  186. package/dist/declarations/src/lib/jsx-roots.d.ts +22 -0
  187. package/dist/declarations/src/lib/module-of-source.d.ts +18 -0
  188. package/dist/declarations/src/lib/naming.d.ts +29 -0
  189. package/dist/declarations/src/lib/react-spelling.d.ts +68 -0
  190. package/dist/declarations/src/lib/scenario-story.d.ts +41 -0
  191. package/dist/declarations/src/lib/slot-fill.d.ts +15 -0
  192. package/dist/declarations/src/lib/types.d.ts +741 -0
  193. package/dist/declarations/src/options.d.ts +224 -0
  194. package/dist/declarations/src/protocol.d.ts +541 -0
  195. package/dist/declarations/src/react-view.d.ts +22 -0
  196. package/dist/declarations/src/react.d.ts +17 -0
  197. package/dist/declarations/src/shell.d.ts +99 -0
  198. package/dist/declarations/src/views.d.ts +152 -0
  199. package/dist/development-server.d.ts +121 -0
  200. package/dist/development-server.js +331 -0
  201. package/dist/emit/common.d.ts +103 -0
  202. package/dist/emit/common.js +170 -0
  203. package/dist/emit/html-source.d.ts +46 -0
  204. package/dist/emit/html-source.js +322 -0
  205. package/dist/emit/manifest.d.ts +138 -0
  206. package/dist/emit/manifest.js +74 -0
  207. package/dist/emit/react.d.ts +16 -0
  208. package/dist/emit/react.js +210 -0
  209. package/dist/emit/scratch.d.ts +40 -0
  210. package/dist/emit/scratch.js +116 -0
  211. package/dist/emit/source.d.ts +87 -0
  212. package/dist/emit/source.js +789 -0
  213. package/dist/emit/svelte.d.ts +9 -0
  214. package/dist/emit/svelte.js +177 -0
  215. package/dist/emit/vue.d.ts +2 -0
  216. package/dist/emit/vue.js +152 -0
  217. package/dist/enumerate.d.ts +2 -0
  218. package/dist/enumerate.js +162 -0
  219. package/dist/generate.d.ts +43 -0
  220. package/dist/generate.js +302 -0
  221. package/dist/html-stylesheet.d.ts +43 -0
  222. package/dist/html-stylesheet.js +145 -0
  223. package/dist/index.d.ts +18 -0
  224. package/dist/index.js +21 -0
  225. package/dist/landing.d.ts +16 -0
  226. package/dist/landing.js +45 -0
  227. package/dist/lib/exported-types.d.ts +42 -0
  228. package/dist/lib/exported-types.js +86 -0
  229. package/dist/lib/html-attributes.d.ts +2 -0
  230. package/dist/lib/html-attributes.js +111 -0
  231. package/dist/lib/html-warnings.d.ts +19 -0
  232. package/dist/lib/html-warnings.js +79 -0
  233. package/dist/lib/jsx-roots.d.ts +22 -0
  234. package/dist/lib/jsx-roots.js +243 -0
  235. package/dist/lib/module-of-source.d.ts +18 -0
  236. package/dist/lib/module-of-source.js +24 -0
  237. package/dist/lib/naming.d.ts +29 -0
  238. package/dist/lib/naming.js +56 -0
  239. package/dist/lib/parse-type.d.ts +32 -0
  240. package/dist/lib/parse-type.js +103 -0
  241. package/dist/lib/react-spelling.d.ts +68 -0
  242. package/dist/lib/react-spelling.js +197 -0
  243. package/dist/lib/scenario-story.d.ts +41 -0
  244. package/dist/lib/scenario-story.js +84 -0
  245. package/dist/lib/slot-fill.d.ts +15 -0
  246. package/dist/lib/slot-fill.js +92 -0
  247. package/dist/lib/template-files.d.ts +14 -0
  248. package/dist/lib/template-files.js +25 -0
  249. package/dist/lib/types.d.ts +741 -0
  250. package/dist/lib/types.js +13 -0
  251. package/dist/lib/void-elements.d.ts +7 -0
  252. package/dist/lib/void-elements.js +13 -0
  253. package/dist/load.d.ts +37 -0
  254. package/dist/load.js +82 -0
  255. package/dist/model.d.ts +44 -0
  256. package/dist/model.js +464 -0
  257. package/dist/options.d.ts +224 -0
  258. package/dist/options.js +223 -0
  259. package/dist/prop-types.d.ts +26 -0
  260. package/dist/prop-types.js +102 -0
  261. package/dist/props-from.d.ts +84 -0
  262. package/dist/props-from.js +510 -0
  263. package/dist/protocol.d.ts +541 -0
  264. package/dist/protocol.js +819 -0
  265. package/dist/react-view.d.ts +22 -0
  266. package/dist/react-view.js +36 -0
  267. package/dist/react.d.ts +17 -0
  268. package/dist/react.js +23 -0
  269. package/dist/sass-importers.d.ts +26 -0
  270. package/dist/sass-importers.js +32 -0
  271. package/dist/shell-acceptance.d.ts +21 -0
  272. package/dist/shell-acceptance.js +37 -0
  273. package/dist/shell-page.d.ts +36 -0
  274. package/dist/shell-page.js +90 -0
  275. package/dist/shell-peers.d.ts +38 -0
  276. package/dist/shell-peers.js +61 -0
  277. package/dist/shell.d.ts +99 -0
  278. package/dist/shell.js +52 -0
  279. package/dist/shells/charcell/page.d.ts +8 -0
  280. package/dist/shells/charcell/page.js +69 -0
  281. package/dist/story-source.d.ts +113 -0
  282. package/dist/story-source.js +271 -0
  283. package/dist/story.d.ts +5 -0
  284. package/dist/story.js +28 -0
  285. package/dist/testing.d.ts +218 -0
  286. package/dist/testing.js +284 -0
  287. package/dist/views.d.ts +152 -0
  288. package/dist/views.js +7 -0
  289. package/dist/vite-configuration.d.ts +114 -0
  290. package/dist/vite-configuration.js +578 -0
  291. package/package.json +123 -3
  292. package/src/build.ts +51 -0
  293. package/src/check.ts +1062 -0
  294. package/src/cli.ts +123 -0
  295. package/src/context.ts +1168 -0
  296. package/src/controller/catalog.ts +719 -0
  297. package/src/controller/create-preview-controller.ts +2683 -0
  298. package/src/controller/editor-tree.ts +530 -0
  299. package/src/controller/html-source.ts +114 -0
  300. package/src/controller/index.ts +105 -0
  301. package/src/controller/persistence.ts +403 -0
  302. package/src/controller/regeneration.ts +55 -0
  303. package/src/controller/source.ts +333 -0
  304. package/src/controller/store.ts +55 -0
  305. package/src/development-server.ts +442 -0
  306. package/src/emit/common.ts +201 -0
  307. package/src/emit/html-source.ts +402 -0
  308. package/src/emit/manifest.ts +241 -0
  309. package/src/emit/react.ts +263 -0
  310. package/src/emit/scratch.ts +175 -0
  311. package/src/emit/source.ts +1094 -0
  312. package/src/emit/svelte.ts +230 -0
  313. package/src/emit/vue.ts +194 -0
  314. package/src/enumerate.ts +220 -0
  315. package/src/generate.ts +443 -0
  316. package/src/html-stylesheet.ts +173 -0
  317. package/src/index.ts +60 -0
  318. package/src/landing.ts +58 -0
  319. package/src/lib/exported-types.ts +114 -0
  320. package/src/lib/html-attributes.ts +113 -0
  321. package/src/lib/html-warnings.ts +81 -0
  322. package/src/lib/jsx-roots.ts +238 -0
  323. package/src/lib/module-of-source.ts +26 -0
  324. package/src/lib/naming.ts +65 -0
  325. package/src/lib/parse-type.ts +143 -0
  326. package/src/lib/react-spelling.ts +235 -0
  327. package/src/lib/scenario-story.ts +97 -0
  328. package/src/lib/slot-fill.ts +102 -0
  329. package/src/lib/template-files.ts +31 -0
  330. package/src/lib/types.ts +778 -0
  331. package/src/lib/void-elements.ts +15 -0
  332. package/src/load.ts +144 -0
  333. package/src/model.ts +568 -0
  334. package/src/options.ts +435 -0
  335. package/src/prop-types.ts +133 -0
  336. package/src/props-from.ts +678 -0
  337. package/src/protocol.ts +1135 -0
  338. package/src/react-view.ts +45 -0
  339. package/src/react.ts +34 -0
  340. package/src/sass-importers.ts +45 -0
  341. package/src/shell-acceptance.ts +45 -0
  342. package/src/shell-page.ts +133 -0
  343. package/src/shell-peers.ts +70 -0
  344. package/src/shell.ts +194 -0
  345. package/src/shells/charcell/page.ts +82 -0
  346. package/src/story-source.ts +391 -0
  347. package/src/story.ts +42 -0
  348. package/src/testing.ts +497 -0
  349. package/src/views.ts +183 -0
  350. package/src/vite-configuration.ts +675 -0
@@ -0,0 +1,56 @@
1
+ // Id / title helpers. The id algorithm (lowercase, non-alphanumerics → '-',
2
+ // collapse, trim) keeps component ids deterministic and identical across the
3
+ // per-target registries and the host manifest - which is what the
4
+ // nav ↔ render lookup and the side-by-side iframe panes depend on. Pinned by
5
+ // naming.test.ts.
6
+ export function sanitize(value) {
7
+ return value
8
+ .toLowerCase()
9
+ .replace(/[^a-z0-9]+/g, '-')
10
+ .replace(/^-+|-+$/g, '')
11
+ .replace(/-+/g, '-');
12
+ }
13
+ /** The id of the preview's own Empty scenario, which renders a component
14
+ * with its slots empty: no scenario of a story's takes it. */
15
+ export const EMPTY_SCENARIO_ID = 'empty';
16
+ /**
17
+ * The id a pane mounts the story of one scenario by, when the scenario has
18
+ * slot content of its own: the component's id and the scenario's, with two
19
+ * hyphens between, which no component id holds.
20
+ *
21
+ * @param componentId - The component's story id.
22
+ * @param scenarioId - The scenario's id.
23
+ * @returns The scenario story's id.
24
+ * @example
25
+ * ```ts
26
+ * scenarioStoryId('components-notice', 'warning'); // 'components-notice--warning'
27
+ * ```
28
+ */
29
+ export function scenarioStoryId(componentId, scenarioId) {
30
+ return `${componentId}--${scenarioId}`;
31
+ }
32
+ export function storyId(title, exportName) {
33
+ return `${sanitize(title)}--${sanitize(exportName)}`;
34
+ }
35
+ /**
36
+ * The name a kit's build gives a template without a component node, from its
37
+ * file: the stem's alphanumeric runs in PascalCase, `_` before a leading
38
+ * digit, `Component` when nothing is left (`theme-toggle.ts` → `ThemeToggle`,
39
+ * `2up.grid.ts` → `_2upGrid`). A copy of `componentNameFromFilePath` in
40
+ * scaffold-ui-kit's `template-sources.ts`, the source of truth, which this
41
+ * package cannot import; the two must agree, since the name namespaces the
42
+ * `data-jte-node` markers the kit's stylesheet selects.
43
+ */
44
+ export function componentNameFromFile(file) {
45
+ const base = file.slice(Math.max(file.lastIndexOf('/'), file.lastIndexOf('\\')) + 1);
46
+ const dot = base.lastIndexOf('.');
47
+ const stem = dot > 0 ? base.slice(0, dot) : base;
48
+ const name = stem
49
+ .split(/[^a-zA-Z0-9]+/)
50
+ .filter((segment) => segment.length > 0)
51
+ .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
52
+ .join('');
53
+ if (name === '')
54
+ return 'Component';
55
+ return /^[0-9]/.test(name) ? `_${name}` : name;
56
+ }
@@ -0,0 +1,32 @@
1
+ export type ParsedType = {
2
+ kind: 'boolean';
3
+ } | {
4
+ kind: 'number';
5
+ } | {
6
+ kind: 'string';
7
+ } | {
8
+ kind: 'stringOrNumber';
9
+ } | {
10
+ kind: 'enum';
11
+ /** The literals the select offers. */
12
+ options: (string | boolean)[];
13
+ /** Whether the type also takes any string (`string & {}` among its
14
+ * members), which a story file may set beside the literals. */
15
+ open?: boolean;
16
+ /** Whether the type also takes a structured value (an object, an
17
+ * array or a tuple among its members), which a story file may set
18
+ * beside the literals. */
19
+ structural?: boolean;
20
+ } | {
21
+ kind: 'complex';
22
+ raw: string;
23
+ };
24
+ /**
25
+ * Splits a type's text on its top-level `|`, leaving a `|` inside brackets,
26
+ * braces, parentheses, angle brackets or a template literal alone.
27
+ *
28
+ * @param type - The type as written.
29
+ * @returns Its union members, trimmed.
30
+ */
31
+ export declare function unionMembers(type: string): string[];
32
+ export declare function parseType(type: string): ParsedType;
@@ -0,0 +1,103 @@
1
+ // Parse the TypeScript-like `type` string a template's prop definition
2
+ // carries into a structured kind the propType mapper can switch on.
3
+ /**
4
+ * Splits a type's text on its top-level `|`, leaving a `|` inside brackets,
5
+ * braces, parentheses, angle brackets or a template literal alone.
6
+ *
7
+ * @param type - The type as written.
8
+ * @returns Its union members, trimmed.
9
+ */
10
+ export function unionMembers(type) {
11
+ const members = [];
12
+ let depth = 0;
13
+ let quote;
14
+ let current = '';
15
+ for (const character of type) {
16
+ if (quote) {
17
+ if (character === quote)
18
+ quote = undefined;
19
+ }
20
+ else if (character === "'" || character === '"' || character === '`') {
21
+ quote = character;
22
+ }
23
+ else if ('([{<'.includes(character)) {
24
+ depth += 1;
25
+ }
26
+ else if (')]}>'.includes(character)) {
27
+ depth -= 1;
28
+ }
29
+ else if (character === '|' && depth === 0) {
30
+ members.push(current.trim());
31
+ current = '';
32
+ continue;
33
+ }
34
+ current += character;
35
+ }
36
+ members.push(current.trim());
37
+ return members.filter(Boolean);
38
+ }
39
+ /** A string literal in either quote style. */
40
+ const STRING_LITERAL = /^(['"])[^'"]*\1$/;
41
+ /** An open string member, `string & {}`: any string, the literals suggested. */
42
+ function isOpenString(member) {
43
+ return /^\(?\s*string\s*&\s*\{\s*\}\s*\)?$/.test(member);
44
+ }
45
+ /** A member with structure a select cannot offer but need not: an object, an
46
+ * array or tuple, or a read-only array (a responsive value's breakpoint form). */
47
+ function isStructural(member) {
48
+ return (member.startsWith('{') ||
49
+ member.startsWith('[') ||
50
+ member.endsWith('[]') ||
51
+ member.startsWith('readonly ') ||
52
+ /^(Readonly)?Array</.test(member));
53
+ }
54
+ export function parseType(type) {
55
+ // An optional union (`'a' | 'b' | undefined`, `string | null`) is controlled as
56
+ // its non-nullish members: the control's unset state already covers the rest.
57
+ const parts = unionMembers(type).filter((part) => part !== 'undefined' && part !== 'null');
58
+ const t = parts.join(' | ');
59
+ if (t === 'boolean' || t === 'true | false' || t === 'false | true')
60
+ return { kind: 'boolean' };
61
+ if (t === 'number')
62
+ return { kind: 'number' };
63
+ if (t === 'string')
64
+ return { kind: 'string' };
65
+ // `string | number` (primitives only, any order)
66
+ if (parts.length > 1 &&
67
+ parts.every((part) => part === 'string' || part === 'number')) {
68
+ return { kind: 'stringOrNumber' };
69
+ }
70
+ // A union of string literals (either quote style, as a driver's source may
71
+ // spell it), e.g. 'soft' | 'solid', is a select of them. So is one that also
72
+ // takes any string (`string & {}`) or a structured form such as a responsive
73
+ // value's breakpoint list: the select offers the literals, and a story file sets
74
+ // the rest. Any other member - a plain `string`, `number`, `boolean` or `false`
75
+ // the select could not offer, or a name left unresolved - keeps it complex.
76
+ const literals = parts.filter((part) => STRING_LITERAL.test(part));
77
+ if (literals.length > 0 &&
78
+ parts.every((part) => STRING_LITERAL.test(part) || isOpenString(part) || isStructural(part))) {
79
+ return {
80
+ kind: 'enum',
81
+ options: literals.map((part) => part.slice(1, -1)),
82
+ ...(parts.some(isOpenString) ? { open: true } : {}),
83
+ ...(parts.some(isStructural) ? { structural: true } : {}),
84
+ };
85
+ }
86
+ // A finite union of string literals and booleans, e.g. boolean |
87
+ // 'indeterminate', is a select of each: true, false, then the literals.
88
+ const booleans = parts.filter((part) => part === 'boolean' || part === 'true' || part === 'false');
89
+ if (literals.length > 0 &&
90
+ booleans.length > 0 &&
91
+ parts.every((part) => STRING_LITERAL.test(part) || booleans.includes(part))) {
92
+ const values = new Set(booleans.flatMap((part) => part === 'boolean' ? [true, false] : [part === 'true']));
93
+ return {
94
+ kind: 'enum',
95
+ options: [
96
+ ...[true, false].filter((value) => values.has(value)),
97
+ ...literals.map((part) => part.slice(1, -1)),
98
+ ],
99
+ };
100
+ }
101
+ // Record<...>, SomeInterface[], SelectOption[], opaque bags, etc.
102
+ return { kind: 'complex', raw: t };
103
+ }
@@ -0,0 +1,68 @@
1
+ import type { SlotFill } from './types.js';
2
+ /**
3
+ * A plain-CSS `style` string's declarations, split at each `;` outside a
4
+ * quoted string and outside parentheses, so a `url("data:...;base64,...")`
5
+ * stays whole.
6
+ *
7
+ * @param css - The declarations as a `style` attribute holds them.
8
+ * @returns Each declaration's text, as written.
9
+ */
10
+ export declare function styleDeclarations(css: string): string[];
11
+ /**
12
+ * A plain-CSS `style` string as the properties of a React style object:
13
+ * each property camel-cased (a vendor prefix capitalized, `-ms-` as `ms`), a
14
+ * custom property (`--gap`) kept as written. A `;` inside a quoted string or
15
+ * parentheses stays in its value. A React style object has no
16
+ * `!important`, so a value marked with it is kept without the mark: the
17
+ * browser would drop the whole declaration otherwise.
18
+ *
19
+ * @param css - The declarations, `;`-separated.
20
+ * @returns The style object's properties, in their order.
21
+ * @example
22
+ * ```ts
23
+ * styleProperties('padding-inline: 1ch; --gap: 2px'); // { paddingInline: '1ch', '--gap': '2px' }
24
+ * ```
25
+ */
26
+ export declare function styleProperties(css: string): Record<string, string>;
27
+ /**
28
+ * A component's props as React takes them: `class` as `className`, a
29
+ * `style` string as a style object, and each attribute React renames by its
30
+ * React name, unless the component declares a prop by that exact name, which
31
+ * it takes as it is. Any other prop passes unchanged. A story that gives both
32
+ * `class` and `className` gets the two joined, in their order.
33
+ *
34
+ * @param props - The props, as the story gives them.
35
+ * @param declares - Whether the component declares a prop of a name.
36
+ * @param attributeNames - The React name of each attribute React renames,
37
+ * by its HTML name.
38
+ * @returns The props, spelled as React takes them, in their order.
39
+ * @example
40
+ * ```ts
41
+ * reactProps({ class: 'w-48', tabindex: 0 }, () => false, { tabindex: 'tabIndex' });
42
+ * // { className: 'w-48', tabIndex: 0 }
43
+ * ```
44
+ */
45
+ export declare function reactProps<Value>(props: Record<string, Value>, declares: (name: string) => boolean, attributeNames: Readonly<Record<string, string>>): Record<string, Value | Record<string, string> | string>;
46
+ /**
47
+ * A slot fill as React takes it: each component's props in it spelled by
48
+ * {@link reactProps}, and each attribute of an html element React renames by
49
+ * its React name (`for` as `htmlFor`). An html element's `class` and `style`
50
+ * stay as written, which the React emitters spell themselves, and opaque
51
+ * bodies stay as they are.
52
+ *
53
+ * @param fill - The fill.
54
+ * @param declares - Whether a component declares a prop of a name.
55
+ * @param attributeNames - The React name of each attribute React renames.
56
+ * @returns The fill, every component's attributes spelled as React takes them.
57
+ */
58
+ export declare function reactFill<Fill extends SlotFill | undefined>(fill: Fill, declares: (component: string, name: string) => boolean, attributeNames: Readonly<Record<string, string>>): Fill;
59
+ /**
60
+ * The names a component declares that {@link reactProps} would otherwise
61
+ * respell: `class`, `style` and the attributes React renames. A component
62
+ * keeps these as they are in React.
63
+ *
64
+ * @param declared - The component's declared prop names.
65
+ * @param attributeNames - The React name of each attribute React renames.
66
+ * @returns Those of `declared` React would otherwise respell.
67
+ */
68
+ export declare function declaredAttributes(declared: Iterable<string>, attributeNames: Readonly<Record<string, string>>): string[];
@@ -0,0 +1,197 @@
1
+ // How React takes the attributes a story gives a component. A story spells
2
+ // an attribute as HTML does, the form every other target takes as it is;
3
+ // React takes `class` as `className`, a `style` string as a style object and
4
+ // the attributes it renames by their React names (`tabindex` as `tabIndex`,
5
+ // `for` as `htmlFor`), unless the component declares a prop by that exact
6
+ // name. Browser-safe, with no imports of its own: the React pane, the React
7
+ // registry and the printed React source share it, and the names React gives
8
+ // the attributes it renames are handed in (the React extension's table).
9
+ /**
10
+ * A plain-CSS `style` string's declarations, split at each `;` outside a
11
+ * quoted string and outside parentheses, so a `url("data:...;base64,...")`
12
+ * stays whole.
13
+ *
14
+ * @param css - The declarations as a `style` attribute holds them.
15
+ * @returns Each declaration's text, as written.
16
+ */
17
+ export function styleDeclarations(css) {
18
+ const declarations = [];
19
+ let quote = '';
20
+ let depth = 0;
21
+ let start = 0;
22
+ for (let i = 0; i < css.length; i++) {
23
+ const character = css[i];
24
+ if (quote) {
25
+ if (character === '\\')
26
+ i++;
27
+ else if (character === quote)
28
+ quote = '';
29
+ }
30
+ else if (character === '"' || character === "'")
31
+ quote = character;
32
+ else if (character === '(')
33
+ depth++;
34
+ else if (character === ')')
35
+ depth = Math.max(0, depth - 1);
36
+ else if (character === ';' && depth === 0) {
37
+ declarations.push(css.slice(start, i));
38
+ start = i + 1;
39
+ }
40
+ }
41
+ declarations.push(css.slice(start));
42
+ return declarations;
43
+ }
44
+ /** A CSS property's name in a React style object: camel-cased, a vendor
45
+ * prefix capitalized (`WebkitLineClamp`) but for `-ms-` (`msOverflowStyle`),
46
+ * a custom property (`--gap`) as written. */
47
+ function stylePropertyName(property) {
48
+ if (property.startsWith('--'))
49
+ return property;
50
+ const unprefixed = property.startsWith('-ms-') ? property.slice(1) : property;
51
+ return unprefixed.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
52
+ }
53
+ /**
54
+ * A plain-CSS `style` string as the properties of a React style object:
55
+ * each property camel-cased (a vendor prefix capitalized, `-ms-` as `ms`), a
56
+ * custom property (`--gap`) kept as written. A `;` inside a quoted string or
57
+ * parentheses stays in its value. A React style object has no
58
+ * `!important`, so a value marked with it is kept without the mark: the
59
+ * browser would drop the whole declaration otherwise.
60
+ *
61
+ * @param css - The declarations, `;`-separated.
62
+ * @returns The style object's properties, in their order.
63
+ * @example
64
+ * ```ts
65
+ * styleProperties('padding-inline: 1ch; --gap: 2px'); // { paddingInline: '1ch', '--gap': '2px' }
66
+ * ```
67
+ */
68
+ export function styleProperties(css) {
69
+ const properties = {};
70
+ for (const declaration of styleDeclarations(css)) {
71
+ const colon = declaration.indexOf(':');
72
+ if (colon === -1)
73
+ continue;
74
+ const property = declaration.slice(0, colon).trim();
75
+ if (!property)
76
+ continue;
77
+ properties[stylePropertyName(property)] = declaration
78
+ .slice(colon + 1)
79
+ .trim()
80
+ .replace(/\s*!\s*important$/i, '');
81
+ }
82
+ return properties;
83
+ }
84
+ /** Two classes given under both `class` and `className`, joined. */
85
+ function joinedClassName(previous, next) {
86
+ if (previous === undefined || previous === null || previous === '')
87
+ return next;
88
+ if (next === undefined || next === null || next === '')
89
+ return previous;
90
+ return `${String(previous)} ${String(next)}`;
91
+ }
92
+ /**
93
+ * A component's props as React takes them: `class` as `className`, a
94
+ * `style` string as a style object, and each attribute React renames by its
95
+ * React name, unless the component declares a prop by that exact name, which
96
+ * it takes as it is. Any other prop passes unchanged. A story that gives both
97
+ * `class` and `className` gets the two joined, in their order.
98
+ *
99
+ * @param props - The props, as the story gives them.
100
+ * @param declares - Whether the component declares a prop of a name.
101
+ * @param attributeNames - The React name of each attribute React renames,
102
+ * by its HTML name.
103
+ * @returns The props, spelled as React takes them, in their order.
104
+ * @example
105
+ * ```ts
106
+ * reactProps({ class: 'w-48', tabindex: 0 }, () => false, { tabindex: 'tabIndex' });
107
+ * // { className: 'w-48', tabIndex: 0 }
108
+ * ```
109
+ */
110
+ export function reactProps(props, declares, attributeNames) {
111
+ const spelled = {};
112
+ for (const [name, value] of Object.entries(props)) {
113
+ if (declares(name))
114
+ spelled[name] = value;
115
+ else if (name === 'class' || name === 'className')
116
+ spelled.className = joinedClassName(spelled.className, value);
117
+ else if (name === 'style' && typeof value === 'string')
118
+ spelled.style = styleProperties(value);
119
+ else
120
+ spelled[Object.prototype.hasOwnProperty.call(attributeNames, name)
121
+ ? attributeNames[name]
122
+ : name] = value;
123
+ }
124
+ return spelled;
125
+ }
126
+ /**
127
+ * A slot fill as React takes it: each component's props in it spelled by
128
+ * {@link reactProps}, and each attribute of an html element React renames by
129
+ * its React name (`for` as `htmlFor`). An html element's `class` and `style`
130
+ * stay as written, which the React emitters spell themselves, and opaque
131
+ * bodies stay as they are.
132
+ *
133
+ * @param fill - The fill.
134
+ * @param declares - Whether a component declares a prop of a name.
135
+ * @param attributeNames - The React name of each attribute React renames.
136
+ * @returns The fill, every component's attributes spelled as React takes them.
137
+ */
138
+ export function reactFill(fill, declares, attributeNames) {
139
+ return fill && reactFillOf(fill, declares, attributeNames);
140
+ }
141
+ /** An html element's attributes, each React renames by its React name
142
+ * (`for` as `htmlFor`), in their order. `class` and `style` stay as
143
+ * written: the React emitters spell those on an element themselves. */
144
+ function renamedAttributes(attributes, attributeNames) {
145
+ return Object.fromEntries(Object.entries(attributes).map(([name, value]) => [
146
+ Object.prototype.hasOwnProperty.call(attributeNames, name)
147
+ ? attributeNames[name]
148
+ : name,
149
+ value,
150
+ ]));
151
+ }
152
+ function reactFillOf(fill, declares, attributeNames) {
153
+ const spell = (child) => reactFillOf(child, declares, attributeNames);
154
+ if (fill.kind === 'element')
155
+ return {
156
+ ...fill,
157
+ ...(fill.props
158
+ ? {
159
+ props: reactProps(fill.props, (name) => declares(fill.component, name), attributeNames),
160
+ }
161
+ : {}),
162
+ ...(fill.slots
163
+ ? {
164
+ slots: Object.fromEntries(Object.entries(fill.slots).map(([slot, slotFill]) => [
165
+ slot,
166
+ spell(slotFill),
167
+ ])),
168
+ }
169
+ : {}),
170
+ ...(fill.children ? { children: spell(fill.children) } : {}),
171
+ };
172
+ if (fill.kind === 'html')
173
+ return {
174
+ ...fill,
175
+ ...(fill.props
176
+ ? { props: renamedAttributes(fill.props, attributeNames) }
177
+ : {}),
178
+ ...(fill.children ? { children: spell(fill.children) } : {}),
179
+ };
180
+ if (fill.kind === 'fragment')
181
+ return { ...fill, children: fill.children.map(spell) };
182
+ return fill;
183
+ }
184
+ /**
185
+ * The names a component declares that {@link reactProps} would otherwise
186
+ * respell: `class`, `style` and the attributes React renames. A component
187
+ * keeps these as they are in React.
188
+ *
189
+ * @param declared - The component's declared prop names.
190
+ * @param attributeNames - The React name of each attribute React renames.
191
+ * @returns Those of `declared` React would otherwise respell.
192
+ */
193
+ export function declaredAttributes(declared, attributeNames) {
194
+ return [...declared].filter((name) => name === 'class' ||
195
+ name === 'style' ||
196
+ Object.prototype.hasOwnProperty.call(attributeNames, name));
197
+ }
@@ -0,0 +1,41 @@
1
+ import type { ResolvedStory, Scenario, SlotPlan } from './types.js';
2
+ /**
3
+ * The slot plan one scenario of a story shows: the scenario's own fills over
4
+ * the story's, slot by slot. A scenario with no slots of its own shows the
5
+ * story's plan.
6
+ *
7
+ * @param story - The story's plan, if it has one.
8
+ * @param scenario - The scenario's own plan, if it has one.
9
+ * @returns The plan the scenario shows, or `undefined` when neither has one.
10
+ */
11
+ export declare function scenarioSlotPlan(story: SlotPlan | undefined, scenario: SlotPlan | undefined): SlotPlan | undefined;
12
+ /**
13
+ * A resolved story as one of its scenarios shows it: with the scenario's
14
+ * slot plan over the story's. A scenario with no slots of its own, or no
15
+ * scenario, shows the story as it is.
16
+ *
17
+ * @param model - The component's resolved story.
18
+ * @param scenario - The scenario, when one is meant.
19
+ * @returns The story to print or render for that scenario.
20
+ */
21
+ export declare function storyOnScenario(model: ResolvedStory, scenario: Scenario | undefined): ResolvedStory;
22
+ /**
23
+ * The stories of a component's scenarios that have slot content of their
24
+ * own: one per such scenario, the component's story with the scenario's
25
+ * plan, under the id the panes mount it by. The panes render a story's slot
26
+ * content as it was generated, so a scenario that changes it is a story
27
+ * beside the component's.
28
+ *
29
+ * @param model - The component's resolved story.
30
+ * @returns The scenario stories, in the scenarios' order; none for a
31
+ * component whose scenarios set props alone.
32
+ */
33
+ export declare function scenarioStories(model: ResolvedStory): ResolvedStory[];
34
+ /**
35
+ * The id a pane mounts a resolved story by: a scenario story's own, or the
36
+ * one derived from the title.
37
+ *
38
+ * @param model - The resolved story.
39
+ * @returns Its id in every target's registry.
40
+ */
41
+ export declare function storyRegistryId(model: ResolvedStory): string;
@@ -0,0 +1,84 @@
1
+ // A scenario with slot content of its own: the plan it shows, and the story
2
+ // the generator renders for it beside the component's. The panes render a
3
+ // story's slot content as it was generated and take only props at run time,
4
+ // so such a scenario is a story of its own in every target's registry.
5
+ // Browser-safe: no node imports.
6
+ import { sanitize, scenarioStoryId } from './naming.js';
7
+ /**
8
+ * The slot plan one scenario of a story shows: the scenario's own fills over
9
+ * the story's, slot by slot. A scenario with no slots of its own shows the
10
+ * story's plan.
11
+ *
12
+ * @param story - The story's plan, if it has one.
13
+ * @param scenario - The scenario's own plan, if it has one.
14
+ * @returns The plan the scenario shows, or `undefined` when neither has one.
15
+ */
16
+ export function scenarioSlotPlan(story, scenario) {
17
+ if (scenario === undefined)
18
+ return story;
19
+ const named = { ...(story?.named ?? {}), ...(scenario.named ?? {}) };
20
+ const fill = scenario.default ?? story?.default;
21
+ return {
22
+ ...(fill === undefined ? {} : { default: fill }),
23
+ ...(Object.keys(named).length === 0 ? {} : { named }),
24
+ };
25
+ }
26
+ /**
27
+ * A resolved story as one of its scenarios shows it: with the scenario's
28
+ * slot plan over the story's. A scenario with no slots of its own, or no
29
+ * scenario, shows the story as it is.
30
+ *
31
+ * @param model - The component's resolved story.
32
+ * @param scenario - The scenario, when one is meant.
33
+ * @returns The story to print or render for that scenario.
34
+ */
35
+ export function storyOnScenario(model, scenario) {
36
+ return scenario?.slots === undefined
37
+ ? model
38
+ : { ...model, slots: scenarioSlotPlan(model.slots, scenario.slots) };
39
+ }
40
+ /**
41
+ * The stories of a component's scenarios that have slot content of their
42
+ * own: one per such scenario, the component's story with the scenario's
43
+ * plan, under the id the panes mount it by. The panes render a story's slot
44
+ * content as it was generated, so a scenario that changes it is a story
45
+ * beside the component's.
46
+ *
47
+ * @param model - The component's resolved story.
48
+ * @returns The scenario stories, in the scenarios' order; none for a
49
+ * component whose scenarios set props alone.
50
+ */
51
+ export function scenarioStories(model) {
52
+ const componentId = sanitize(model.title);
53
+ return model.scenarios.flatMap((scenario, index) => {
54
+ if (scenario.slots === undefined)
55
+ return [];
56
+ const slots = scenarioSlotPlan(model.slots, scenario.slots);
57
+ // The placeholder text a component with no plan starts from is the
58
+ // preview's own; a scenario that fills the default slot replaces it.
59
+ const withoutPlaceholder = Object.fromEntries(Object.entries(model.defaultProps).filter(([name]) => name !== 'children'));
60
+ const fillsDefault = slots?.default !== undefined &&
61
+ model.previewDefaults?.children !== undefined;
62
+ return [
63
+ {
64
+ ...model,
65
+ ...(fillsDefault ? { defaultProps: withoutPlaceholder } : {}),
66
+ slots,
67
+ scenarioStory: {
68
+ id: scenarioStoryId(componentId, scenario.id),
69
+ renderName: `${model.name}_scenario${index}`,
70
+ },
71
+ },
72
+ ];
73
+ });
74
+ }
75
+ /**
76
+ * The id a pane mounts a resolved story by: a scenario story's own, or the
77
+ * one derived from the title.
78
+ *
79
+ * @param model - The resolved story.
80
+ * @returns Its id in every target's registry.
81
+ */
82
+ export function storyRegistryId(model) {
83
+ return model.scenarioStory?.id ?? sanitize(model.title);
84
+ }
@@ -0,0 +1,15 @@
1
+ import type { PartFill, SlotFill } from './types.js';
2
+ /** Adds every component name a fill tree references to `into`: each `element`'s
3
+ * component, and the declared `imports` of an opaque `raw` or `scoped` body
4
+ * or a part's, unless `parts` is false. */
5
+ export declare function collectSlotComponents(fill: SlotFill | undefined, into: Set<string>, parts?: boolean): void;
6
+ /**
7
+ * The parts a story's slot content calls, by name, in the order first called.
8
+ * A part is called in the content's tree; a call inside a body is the body's
9
+ * own markup and declares nothing.
10
+ *
11
+ * @param fills - The story's slot fills: its default slot and named slots.
12
+ * @returns Each part's call, carrying its declaration.
13
+ * @throws When two calls of one name declare different parts.
14
+ */
15
+ export declare function collectParts(fills: Iterable<SlotFill | undefined>): Map<string, PartFill>;