@terra-symposium/docs 0.0.0-stage → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +72 -2
  3. package/lib-dist/assets/fonts/AUTHENTICSans-130.woff +0 -0
  4. package/lib-dist/assets/fonts/AUTHENTICSans-130.woff2 +0 -0
  5. package/lib-dist/assets/fonts/AUTHENTICSans-150.woff +0 -0
  6. package/lib-dist/assets/fonts/AUTHENTICSans-150.woff2 +0 -0
  7. package/lib-dist/assets/fonts/AUTHENTICSans-90.woff +0 -0
  8. package/lib-dist/assets/fonts/AUTHENTICSans-90.woff2 +0 -0
  9. package/lib-dist/assets/fonts/Avara-Bold.woff +0 -0
  10. package/lib-dist/assets/fonts/Avara-Bold.woff2 +0 -0
  11. package/lib-dist/assets/fonts/Avara-BoldItalic.woff +0 -0
  12. package/lib-dist/assets/fonts/Avara-BoldItalic.woff2 +0 -0
  13. package/lib-dist/assets/fonts/InterVariable-Italic-latin-20260728.woff2 +0 -0
  14. package/lib-dist/assets/fonts/InterVariable-latin-20260728.woff2 +0 -0
  15. package/lib-dist/assets/fonts/OFL-1.1.txt +93 -0
  16. package/lib-dist/assets/fonts/README.md +7 -0
  17. package/lib-dist/assets/fonts/licenses/Inter-OFL-1.1.txt +92 -0
  18. package/lib-dist/assets/fonts/licenses/OFL-1.1.txt +93 -0
  19. package/lib-dist/components/Docs.d.ts +22 -0
  20. package/lib-dist/components/Docs.d.ts.map +1 -0
  21. package/lib-dist/components/Docs.js +9 -0
  22. package/lib-dist/components/Docs.js.map +1 -0
  23. package/lib-dist/components/LocalDocsWorkspace.d.ts +37 -0
  24. package/lib-dist/components/LocalDocsWorkspace.d.ts.map +1 -0
  25. package/lib-dist/components/LocalDocsWorkspace.js +207 -0
  26. package/lib-dist/components/LocalDocsWorkspace.js.map +1 -0
  27. package/lib-dist/components/NotFound.d.ts +8 -0
  28. package/lib-dist/components/NotFound.d.ts.map +1 -0
  29. package/lib-dist/components/NotFound.js +6 -0
  30. package/lib-dist/components/NotFound.js.map +1 -0
  31. package/lib-dist/components/SiteLayout.d.ts +25 -0
  32. package/lib-dist/components/SiteLayout.d.ts.map +1 -0
  33. package/lib-dist/components/SiteLayout.js +12 -0
  34. package/lib-dist/components/SiteLayout.js.map +1 -0
  35. package/lib-dist/components/StaticWorkspace.d.ts +25 -0
  36. package/lib-dist/components/StaticWorkspace.d.ts.map +1 -0
  37. package/lib-dist/components/StaticWorkspace.js +245 -0
  38. package/lib-dist/components/StaticWorkspace.js.map +1 -0
  39. package/lib-dist/components/StrictLocalWorkspaceHarness.d.ts +10 -0
  40. package/lib-dist/components/StrictLocalWorkspaceHarness.d.ts.map +1 -0
  41. package/lib-dist/components/StrictLocalWorkspaceHarness.js +12 -0
  42. package/lib-dist/components/StrictLocalWorkspaceHarness.js.map +1 -0
  43. package/lib-dist/components/blocks.d.ts +23 -0
  44. package/lib-dist/components/blocks.d.ts.map +1 -0
  45. package/lib-dist/components/blocks.js +396 -0
  46. package/lib-dist/components/blocks.js.map +1 -0
  47. package/lib-dist/components/navigation.d.ts +18 -0
  48. package/lib-dist/components/navigation.d.ts.map +1 -0
  49. package/lib-dist/components/navigation.js +9 -0
  50. package/lib-dist/components/navigation.js.map +1 -0
  51. package/lib-dist/components/terra/Workspace.d.ts +5 -0
  52. package/lib-dist/components/terra/Workspace.d.ts.map +1 -0
  53. package/lib-dist/components/terra/Workspace.js +190 -0
  54. package/lib-dist/components/terra/Workspace.js.map +1 -0
  55. package/lib-dist/components/terra/editor/TerraContentEditor.d.ts +15 -0
  56. package/lib-dist/components/terra/editor/TerraContentEditor.d.ts.map +1 -0
  57. package/lib-dist/components/terra/editor/TerraContentEditor.js +358 -0
  58. package/lib-dist/components/terra/editor/TerraContentEditor.js.map +1 -0
  59. package/lib-dist/components/terra/editor/_blocks.d.ts +70 -0
  60. package/lib-dist/components/terra/editor/_blocks.d.ts.map +1 -0
  61. package/lib-dist/components/terra/editor/_blocks.js +120 -0
  62. package/lib-dist/components/terra/editor/_blocks.js.map +1 -0
  63. package/lib-dist/components/terra/editor/docs/BlockContext.d.ts +7 -0
  64. package/lib-dist/components/terra/editor/docs/BlockContext.d.ts.map +1 -0
  65. package/lib-dist/components/terra/editor/docs/BlockContext.js +60 -0
  66. package/lib-dist/components/terra/editor/docs/BlockContext.js.map +1 -0
  67. package/lib-dist/components/terra/editor/docs/DocsAttachmentPicker.d.ts +12 -0
  68. package/lib-dist/components/terra/editor/docs/DocsAttachmentPicker.d.ts.map +1 -0
  69. package/lib-dist/components/terra/editor/docs/DocsAttachmentPicker.js +66 -0
  70. package/lib-dist/components/terra/editor/docs/DocsAttachmentPicker.js.map +1 -0
  71. package/lib-dist/components/terra/editor/docs/TerraToolbar.d.ts +12 -0
  72. package/lib-dist/components/terra/editor/docs/TerraToolbar.d.ts.map +1 -0
  73. package/lib-dist/components/terra/editor/docs/TerraToolbar.js +169 -0
  74. package/lib-dist/components/terra/editor/docs/TerraToolbar.js.map +1 -0
  75. package/lib-dist/components/terra/editor/docs/_Callout.d.ts +14 -0
  76. package/lib-dist/components/terra/editor/docs/_Callout.d.ts.map +1 -0
  77. package/lib-dist/components/terra/editor/docs/_Callout.js +45 -0
  78. package/lib-dist/components/terra/editor/docs/_Callout.js.map +1 -0
  79. package/lib-dist/components/terra/editor/docs/_CodeBlock.d.ts +39 -0
  80. package/lib-dist/components/terra/editor/docs/_CodeBlock.d.ts.map +1 -0
  81. package/lib-dist/components/terra/editor/docs/_CodeBlock.js +560 -0
  82. package/lib-dist/components/terra/editor/docs/_CodeBlock.js.map +1 -0
  83. package/lib-dist/components/terra/editor/docs/_DocsCode.d.ts +14 -0
  84. package/lib-dist/components/terra/editor/docs/_DocsCode.d.ts.map +1 -0
  85. package/lib-dist/components/terra/editor/docs/_DocsCode.js +128 -0
  86. package/lib-dist/components/terra/editor/docs/_DocsCode.js.map +1 -0
  87. package/lib-dist/components/terra/editor/docs/_DocsImage.d.ts +18 -0
  88. package/lib-dist/components/terra/editor/docs/_DocsImage.d.ts.map +1 -0
  89. package/lib-dist/components/terra/editor/docs/_DocsImage.js +62 -0
  90. package/lib-dist/components/terra/editor/docs/_DocsImage.js.map +1 -0
  91. package/lib-dist/components/terra/editor/docs/_Embed.d.ts +17 -0
  92. package/lib-dist/components/terra/editor/docs/_Embed.d.ts.map +1 -0
  93. package/lib-dist/components/terra/editor/docs/_Embed.js +73 -0
  94. package/lib-dist/components/terra/editor/docs/_Embed.js.map +1 -0
  95. package/lib-dist/components/terra/editor/docs/_Math.d.ts +31 -0
  96. package/lib-dist/components/terra/editor/docs/_Math.d.ts.map +1 -0
  97. package/lib-dist/components/terra/editor/docs/_Math.js +138 -0
  98. package/lib-dist/components/terra/editor/docs/_Math.js.map +1 -0
  99. package/lib-dist/components/terra/editor/docs/_Nodes.d.ts +15 -0
  100. package/lib-dist/components/terra/editor/docs/_Nodes.d.ts.map +1 -0
  101. package/lib-dist/components/terra/editor/docs/_Nodes.js +62 -0
  102. package/lib-dist/components/terra/editor/docs/_Nodes.js.map +1 -0
  103. package/lib-dist/components/terra/editor/docs/_Raw.d.ts +15 -0
  104. package/lib-dist/components/terra/editor/docs/_Raw.d.ts.map +1 -0
  105. package/lib-dist/components/terra/editor/docs/_Raw.js +31 -0
  106. package/lib-dist/components/terra/editor/docs/_Raw.js.map +1 -0
  107. package/lib-dist/components/terra/editor/docs/_Table.d.ts +12 -0
  108. package/lib-dist/components/terra/editor/docs/_Table.d.ts.map +1 -0
  109. package/lib-dist/components/terra/editor/docs/_Table.js +99 -0
  110. package/lib-dist/components/terra/editor/docs/_Table.js.map +1 -0
  111. package/lib-dist/components/terra/editor/docs/_Tabs.d.ts +14 -0
  112. package/lib-dist/components/terra/editor/docs/_Tabs.d.ts.map +1 -0
  113. package/lib-dist/components/terra/editor/docs/_Tabs.js +125 -0
  114. package/lib-dist/components/terra/editor/docs/_Tabs.js.map +1 -0
  115. package/lib-dist/components/terra/editor/docs/_TsDocs.d.ts +15 -0
  116. package/lib-dist/components/terra/editor/docs/_TsDocs.d.ts.map +1 -0
  117. package/lib-dist/components/terra/editor/docs/_TsDocs.js +83 -0
  118. package/lib-dist/components/terra/editor/docs/_TsDocs.js.map +1 -0
  119. package/lib-dist/components/terra/editor/docs/_math_inline.d.ts +14 -0
  120. package/lib-dist/components/terra/editor/docs/_math_inline.d.ts.map +1 -0
  121. package/lib-dist/components/terra/editor/docs/_math_inline.js +30 -0
  122. package/lib-dist/components/terra/editor/docs/_math_inline.js.map +1 -0
  123. package/lib-dist/components/terra/editor/docs/heading.d.ts +23 -0
  124. package/lib-dist/components/terra/editor/docs/heading.d.ts.map +1 -0
  125. package/lib-dist/components/terra/editor/docs/heading.js +63 -0
  126. package/lib-dist/components/terra/editor/docs/heading.js.map +1 -0
  127. package/lib-dist/components/terra/editor/docs/index.d.ts +13 -0
  128. package/lib-dist/components/terra/editor/docs/index.d.ts.map +1 -0
  129. package/lib-dist/components/terra/editor/docs/index.js +14 -0
  130. package/lib-dist/components/terra/editor/docs/index.js.map +1 -0
  131. package/lib-dist/components/terra/editor/terra-content.styles.d.ts +3 -0
  132. package/lib-dist/components/terra/editor/terra-content.styles.d.ts.map +1 -0
  133. package/lib-dist/components/terra/editor/terra-content.styles.js +3 -0
  134. package/lib-dist/components/terra/editor/terra-content.styles.js.map +1 -0
  135. package/lib-dist/components/terra/editor/types.d.ts +40 -0
  136. package/lib-dist/components/terra/editor/types.d.ts.map +1 -0
  137. package/lib-dist/components/terra/editor/types.js +11 -0
  138. package/lib-dist/components/terra/editor/types.js.map +1 -0
  139. package/lib-dist/components/terra/flow/Nodes.d.ts +78 -0
  140. package/lib-dist/components/terra/flow/Nodes.d.ts.map +1 -0
  141. package/lib-dist/components/terra/flow/Nodes.js +1019 -0
  142. package/lib-dist/components/terra/flow/Nodes.js.map +1 -0
  143. package/lib-dist/components/terra/flow/_chrome.d.ts +267 -0
  144. package/lib-dist/components/terra/flow/_chrome.d.ts.map +1 -0
  145. package/lib-dist/components/terra/flow/_chrome.js +1009 -0
  146. package/lib-dist/components/terra/flow/_chrome.js.map +1 -0
  147. package/lib-dist/components/terra/flow/menuContext.d.ts +13 -0
  148. package/lib-dist/components/terra/flow/menuContext.d.ts.map +1 -0
  149. package/lib-dist/components/terra/flow/menuContext.js +10 -0
  150. package/lib-dist/components/terra/flow/menuContext.js.map +1 -0
  151. package/lib-dist/components/terra/pages/docs/_attachments.d.ts +20 -0
  152. package/lib-dist/components/terra/pages/docs/_attachments.d.ts.map +1 -0
  153. package/lib-dist/components/terra/pages/docs/_attachments.js +1148 -0
  154. package/lib-dist/components/terra/pages/docs/_attachments.js.map +1 -0
  155. package/lib-dist/components/terra/pages/docs/_blocks.d.ts +48 -0
  156. package/lib-dist/components/terra/pages/docs/_blocks.d.ts.map +1 -0
  157. package/lib-dist/components/terra/pages/docs/_blocks.js +203 -0
  158. package/lib-dist/components/terra/pages/docs/_blocks.js.map +1 -0
  159. package/lib-dist/components/terra/pages/docs/_editable.d.ts +61 -0
  160. package/lib-dist/components/terra/pages/docs/_editable.d.ts.map +1 -0
  161. package/lib-dist/components/terra/pages/docs/_editable.js +442 -0
  162. package/lib-dist/components/terra/pages/docs/_editable.js.map +1 -0
  163. package/lib-dist/components/terra/pages/docs/_export-dialog.d.ts +19 -0
  164. package/lib-dist/components/terra/pages/docs/_export-dialog.d.ts.map +1 -0
  165. package/lib-dist/components/terra/pages/docs/_export-dialog.js +78 -0
  166. package/lib-dist/components/terra/pages/docs/_export-dialog.js.map +1 -0
  167. package/lib-dist/components/terra/pages/docs/_icons.d.ts +20 -0
  168. package/lib-dist/components/terra/pages/docs/_icons.d.ts.map +1 -0
  169. package/lib-dist/components/terra/pages/docs/_icons.js +29 -0
  170. package/lib-dist/components/terra/pages/docs/_icons.js.map +1 -0
  171. package/lib-dist/components/terra/pages/docs/_main.d.ts +54 -0
  172. package/lib-dist/components/terra/pages/docs/_main.d.ts.map +1 -0
  173. package/lib-dist/components/terra/pages/docs/_main.js +710 -0
  174. package/lib-dist/components/terra/pages/docs/_main.js.map +1 -0
  175. package/lib-dist/components/terra/pages/docs/_manage-attachments-dialog.d.ts +10 -0
  176. package/lib-dist/components/terra/pages/docs/_manage-attachments-dialog.d.ts.map +1 -0
  177. package/lib-dist/components/terra/pages/docs/_manage-attachments-dialog.js +597 -0
  178. package/lib-dist/components/terra/pages/docs/_manage-attachments-dialog.js.map +1 -0
  179. package/lib-dist/components/terra/pages/docs/_sidebar.d.ts +33 -0
  180. package/lib-dist/components/terra/pages/docs/_sidebar.d.ts.map +1 -0
  181. package/lib-dist/components/terra/pages/docs/_sidebar.js +1437 -0
  182. package/lib-dist/components/terra/pages/docs/_sidebar.js.map +1 -0
  183. package/lib-dist/components/terra/pages/docs/_toc.d.ts +4 -0
  184. package/lib-dist/components/terra/pages/docs/_toc.d.ts.map +1 -0
  185. package/lib-dist/components/terra/pages/docs/_toc.js +212 -0
  186. package/lib-dist/components/terra/pages/docs/_toc.js.map +1 -0
  187. package/lib-dist/components/terra/pages/docs/_toolbar-find-replace.d.ts +15 -0
  188. package/lib-dist/components/terra/pages/docs/_toolbar-find-replace.d.ts.map +1 -0
  189. package/lib-dist/components/terra/pages/docs/_toolbar-find-replace.js +207 -0
  190. package/lib-dist/components/terra/pages/docs/_toolbar-find-replace.js.map +1 -0
  191. package/lib-dist/components/terra/pages/docs/_toolbar.d.ts +22 -0
  192. package/lib-dist/components/terra/pages/docs/_toolbar.d.ts.map +1 -0
  193. package/lib-dist/components/terra/pages/docs/_toolbar.js +1508 -0
  194. package/lib-dist/components/terra/pages/docs/_toolbar.js.map +1 -0
  195. package/lib-dist/components/terra/pages/docs/_tree.d.ts +178 -0
  196. package/lib-dist/components/terra/pages/docs/_tree.d.ts.map +1 -0
  197. package/lib-dist/components/terra/pages/docs/_tree.js +1123 -0
  198. package/lib-dist/components/terra/pages/docs/_tree.js.map +1 -0
  199. package/lib-dist/components/terra/pages/docs/use-block-nav.d.ts +5 -0
  200. package/lib-dist/components/terra/pages/docs/use-block-nav.d.ts.map +1 -0
  201. package/lib-dist/components/terra/pages/docs/use-block-nav.js +1306 -0
  202. package/lib-dist/components/terra/pages/docs/use-block-nav.js.map +1 -0
  203. package/lib-dist/components/terra/pages/docs/use-media-paste.d.ts +5 -0
  204. package/lib-dist/components/terra/pages/docs/use-media-paste.d.ts.map +1 -0
  205. package/lib-dist/components/terra/pages/docs/use-media-paste.js +391 -0
  206. package/lib-dist/components/terra/pages/docs/use-media-paste.js.map +1 -0
  207. package/lib-dist/components/terra/pages/docs/use-render-tripwire.d.ts +2 -0
  208. package/lib-dist/components/terra/pages/docs/use-render-tripwire.d.ts.map +1 -0
  209. package/lib-dist/components/terra/pages/docs/use-render-tripwire.js +25 -0
  210. package/lib-dist/components/terra/pages/docs/use-render-tripwire.js.map +1 -0
  211. package/lib-dist/components/terra/ui.d.ts +28 -0
  212. package/lib-dist/components/terra/ui.d.ts.map +1 -0
  213. package/lib-dist/components/terra/ui.js +20 -0
  214. package/lib-dist/components/terra/ui.js.map +1 -0
  215. package/lib-dist/components/workspace-demo-fixture.d.ts +35 -0
  216. package/lib-dist/components/workspace-demo-fixture.d.ts.map +1 -0
  217. package/lib-dist/components/workspace-demo-fixture.js +820 -0
  218. package/lib-dist/components/workspace-demo-fixture.js.map +1 -0
  219. package/lib-dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  220. package/lib-dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  221. package/lib-dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  222. package/lib-dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  223. package/lib-dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  224. package/lib-dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  225. package/lib-dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  226. package/lib-dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  227. package/lib-dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  228. package/lib-dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  229. package/lib-dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  230. package/lib-dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  231. package/lib-dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  232. package/lib-dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  233. package/lib-dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  234. package/lib-dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  235. package/lib-dist/fonts/KaTeX_Main-Bold.woff +0 -0
  236. package/lib-dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  237. package/lib-dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  238. package/lib-dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  239. package/lib-dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  240. package/lib-dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  241. package/lib-dist/fonts/KaTeX_Main-Italic.woff +0 -0
  242. package/lib-dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  243. package/lib-dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  244. package/lib-dist/fonts/KaTeX_Main-Regular.woff +0 -0
  245. package/lib-dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  246. package/lib-dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  247. package/lib-dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  248. package/lib-dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  249. package/lib-dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  250. package/lib-dist/fonts/KaTeX_Math-Italic.woff +0 -0
  251. package/lib-dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  252. package/lib-dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  253. package/lib-dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  254. package/lib-dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  255. package/lib-dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  256. package/lib-dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  257. package/lib-dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  258. package/lib-dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  259. package/lib-dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  260. package/lib-dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  261. package/lib-dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  262. package/lib-dist/fonts/KaTeX_Script-Regular.woff +0 -0
  263. package/lib-dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  264. package/lib-dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  265. package/lib-dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  266. package/lib-dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  267. package/lib-dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  268. package/lib-dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  269. package/lib-dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  270. package/lib-dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  271. package/lib-dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  272. package/lib-dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  273. package/lib-dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  274. package/lib-dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  275. package/lib-dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  276. package/lib-dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  277. package/lib-dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  278. package/lib-dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  279. package/lib-dist/lib/astro.d.ts +8 -0
  280. package/lib-dist/lib/astro.d.ts.map +1 -0
  281. package/lib-dist/lib/astro.js +27 -0
  282. package/lib-dist/lib/astro.js.map +1 -0
  283. package/lib-dist/lib/docs-catalog.d.ts +5 -0
  284. package/lib-dist/lib/docs-catalog.d.ts.map +1 -0
  285. package/lib-dist/lib/docs-catalog.js +75 -0
  286. package/lib-dist/lib/docs-catalog.js.map +1 -0
  287. package/lib-dist/lib/docs-theme.d.ts +7 -0
  288. package/lib-dist/lib/docs-theme.d.ts.map +1 -0
  289. package/lib-dist/lib/docs-theme.js +51 -0
  290. package/lib-dist/lib/docs-theme.js.map +1 -0
  291. package/lib-dist/lib/host-runtime.d.ts +5 -0
  292. package/lib-dist/lib/host-runtime.d.ts.map +1 -0
  293. package/lib-dist/lib/host-runtime.js +23 -0
  294. package/lib-dist/lib/host-runtime.js.map +1 -0
  295. package/lib-dist/lib/host.d.ts +190 -0
  296. package/lib-dist/lib/host.d.ts.map +1 -0
  297. package/lib-dist/lib/host.js +2 -0
  298. package/lib-dist/lib/host.js.map +1 -0
  299. package/lib-dist/lib/index.d.ts +34 -0
  300. package/lib-dist/lib/index.d.ts.map +1 -0
  301. package/lib-dist/lib/index.js +27 -0
  302. package/lib-dist/lib/index.js.map +1 -0
  303. package/lib-dist/lib/markdown-model.d.ts +7 -0
  304. package/lib-dist/lib/markdown-model.d.ts.map +1 -0
  305. package/lib-dist/lib/markdown-model.js +2031 -0
  306. package/lib-dist/lib/markdown-model.js.map +1 -0
  307. package/lib-dist/lib/markdown.d.ts +3 -0
  308. package/lib-dist/lib/markdown.d.ts.map +1 -0
  309. package/lib-dist/lib/markdown.js +222 -0
  310. package/lib-dist/lib/markdown.js.map +1 -0
  311. package/lib-dist/lib/schema.d.ts +167 -0
  312. package/lib-dist/lib/schema.d.ts.map +1 -0
  313. package/lib-dist/lib/schema.js +63 -0
  314. package/lib-dist/lib/schema.js.map +1 -0
  315. package/lib-dist/lib/terra/custom-components.d.ts +5 -0
  316. package/lib-dist/lib/terra/custom-components.d.ts.map +1 -0
  317. package/lib-dist/lib/terra/custom-components.js +6 -0
  318. package/lib-dist/lib/terra/custom-components.js.map +1 -0
  319. package/lib-dist/lib/terra/docs/archive.d.ts +3 -0
  320. package/lib-dist/lib/terra/docs/archive.d.ts.map +1 -0
  321. package/lib-dist/lib/terra/docs/archive.js +654 -0
  322. package/lib-dist/lib/terra/docs/archive.js.map +1 -0
  323. package/lib-dist/lib/terra/docs/assets.d.ts +26 -0
  324. package/lib-dist/lib/terra/docs/assets.d.ts.map +1 -0
  325. package/lib-dist/lib/terra/docs/assets.js +74 -0
  326. package/lib-dist/lib/terra/docs/assets.js.map +1 -0
  327. package/lib-dist/lib/terra/docs/attachments.d.ts +4 -0
  328. package/lib-dist/lib/terra/docs/attachments.d.ts.map +1 -0
  329. package/lib-dist/lib/terra/docs/attachments.js +5 -0
  330. package/lib-dist/lib/terra/docs/attachments.js.map +1 -0
  331. package/lib-dist/lib/terra/docs/editor-dom.d.ts +50 -0
  332. package/lib-dist/lib/terra/docs/editor-dom.d.ts.map +1 -0
  333. package/lib-dist/lib/terra/docs/editor-dom.js +236 -0
  334. package/lib-dist/lib/terra/docs/editor-dom.js.map +1 -0
  335. package/lib-dist/lib/terra/docs/mutations.d.ts +10 -0
  336. package/lib-dist/lib/terra/docs/mutations.d.ts.map +1 -0
  337. package/lib-dist/lib/terra/docs/mutations.js +105 -0
  338. package/lib-dist/lib/terra/docs/mutations.js.map +1 -0
  339. package/lib-dist/lib/terra/docs/navigation.d.ts +6 -0
  340. package/lib-dist/lib/terra/docs/navigation.d.ts.map +1 -0
  341. package/lib-dist/lib/terra/docs/navigation.js +21 -0
  342. package/lib-dist/lib/terra/docs/navigation.js.map +1 -0
  343. package/lib-dist/lib/terra/docs/state.d.ts +186 -0
  344. package/lib-dist/lib/terra/docs/state.d.ts.map +1 -0
  345. package/lib-dist/lib/terra/docs/state.js +255 -0
  346. package/lib-dist/lib/terra/docs/state.js.map +1 -0
  347. package/lib-dist/lib/terra/docs/toolbar.d.ts +11 -0
  348. package/lib-dist/lib/terra/docs/toolbar.d.ts.map +1 -0
  349. package/lib-dist/lib/terra/docs/toolbar.js +41 -0
  350. package/lib-dist/lib/terra/docs/toolbar.js.map +1 -0
  351. package/lib-dist/lib/terra/docs/tree.d.ts +15 -0
  352. package/lib-dist/lib/terra/docs/tree.d.ts.map +1 -0
  353. package/lib-dist/lib/terra/docs/tree.js +61 -0
  354. package/lib-dist/lib/terra/docs/tree.js.map +1 -0
  355. package/lib-dist/lib/terra/docs/workspace.d.ts +396 -0
  356. package/lib-dist/lib/terra/docs/workspace.d.ts.map +1 -0
  357. package/lib-dist/lib/terra/docs/workspace.js +923 -0
  358. package/lib-dist/lib/terra/docs/workspace.js.map +1 -0
  359. package/lib-dist/lib/terra/flow/_layout.d.ts +30 -0
  360. package/lib-dist/lib/terra/flow/_layout.d.ts.map +1 -0
  361. package/lib-dist/lib/terra/flow/_layout.js +63 -0
  362. package/lib-dist/lib/terra/flow/_layout.js.map +1 -0
  363. package/lib-dist/lib/terra/flow/powerSource.d.ts +16 -0
  364. package/lib-dist/lib/terra/flow/powerSource.d.ts.map +1 -0
  365. package/lib-dist/lib/terra/flow/powerSource.js +65 -0
  366. package/lib-dist/lib/terra/flow/powerSource.js.map +1 -0
  367. package/lib-dist/lib/terra/regex.mjs +403 -0
  368. package/lib-dist/lib/terra/runtime/action-proxy.d.ts +45 -0
  369. package/lib-dist/lib/terra/runtime/action-proxy.d.ts.map +1 -0
  370. package/lib-dist/lib/terra/runtime/action-proxy.js +19 -0
  371. package/lib-dist/lib/terra/runtime/action-proxy.js.map +1 -0
  372. package/lib-dist/lib/terra/runtime/content/block-jsx.d.ts +23 -0
  373. package/lib-dist/lib/terra/runtime/content/block-jsx.d.ts.map +1 -0
  374. package/lib-dist/lib/terra/runtime/content/block-jsx.js +225 -0
  375. package/lib-dist/lib/terra/runtime/content/block-jsx.js.map +1 -0
  376. package/lib-dist/lib/terra/runtime/content/document-markdown.d.ts +41 -0
  377. package/lib-dist/lib/terra/runtime/content/document-markdown.d.ts.map +1 -0
  378. package/lib-dist/lib/terra/runtime/content/document-markdown.js +536 -0
  379. package/lib-dist/lib/terra/runtime/content/document-markdown.js.map +1 -0
  380. package/lib-dist/lib/terra/runtime/content/markdown.d.ts +109 -0
  381. package/lib-dist/lib/terra/runtime/content/markdown.d.ts.map +1 -0
  382. package/lib-dist/lib/terra/runtime/content/markdown.js +428 -0
  383. package/lib-dist/lib/terra/runtime/content/markdown.js.map +1 -0
  384. package/lib-dist/lib/terra/runtime/content.d.ts +150 -0
  385. package/lib-dist/lib/terra/runtime/content.d.ts.map +1 -0
  386. package/lib-dist/lib/terra/runtime/content.js +1256 -0
  387. package/lib-dist/lib/terra/runtime/content.js.map +1 -0
  388. package/lib-dist/lib/terra/runtime/leaf.d.ts +5 -0
  389. package/lib-dist/lib/terra/runtime/leaf.d.ts.map +1 -0
  390. package/lib-dist/lib/terra/runtime/leaf.js +13 -0
  391. package/lib-dist/lib/terra/runtime/leaf.js.map +1 -0
  392. package/lib-dist/lib/terra/runtime/nodes.d.ts +112 -0
  393. package/lib-dist/lib/terra/runtime/nodes.d.ts.map +1 -0
  394. package/lib-dist/lib/terra/runtime/nodes.js +606 -0
  395. package/lib-dist/lib/terra/runtime/nodes.js.map +1 -0
  396. package/lib-dist/lib/terra/runtime/runtime.d.ts +31 -0
  397. package/lib-dist/lib/terra/runtime/runtime.d.ts.map +1 -0
  398. package/lib-dist/lib/terra/runtime/runtime.js +86 -0
  399. package/lib-dist/lib/terra/runtime/runtime.js.map +1 -0
  400. package/lib-dist/lib/terra/runtime/shared.d.ts +35 -0
  401. package/lib-dist/lib/terra/runtime/shared.d.ts.map +1 -0
  402. package/lib-dist/lib/terra/runtime/shared.js +124 -0
  403. package/lib-dist/lib/terra/runtime/shared.js.map +1 -0
  404. package/lib-dist/lib/terra/runtime/types.d.ts +529 -0
  405. package/lib-dist/lib/terra/runtime/types.d.ts.map +1 -0
  406. package/lib-dist/lib/terra/runtime/types.js +44 -0
  407. package/lib-dist/lib/terra/runtime/types.js.map +1 -0
  408. package/lib-dist/lib/workspace-types.d.ts +29 -0
  409. package/lib-dist/lib/workspace-types.d.ts.map +1 -0
  410. package/lib-dist/lib/workspace-types.js +2 -0
  411. package/lib-dist/lib/workspace-types.js.map +1 -0
  412. package/lib-dist/style.css +237 -0
  413. package/package.json +108 -3
  414. package/src/components/NotFound.astro +6 -0
  415. package/src/components/NotFound.tsx +48 -0
  416. package/src/components/SiteLayout.astro +42 -0
  417. package/src/components/navigation.tsx +48 -0
@@ -0,0 +1,923 @@
1
+ // @ts-nocheck -- source-preserving extraction; public host contracts are typed in src/host.ts.
2
+ /**
3
+ * astro/src/pages/docs/_helpers.ts
4
+ * Shared Docs state, browser coordination, and pure helpers used by multiple Docs surfaces.
5
+ * Folder boundary: cross-surface contracts only; page composition, sidebar UI, editor lifecycle, and visual blocks remain in their owners.
6
+ */
7
+ /*//////////////////////////////////////////////////
8
+ IMPORTS
9
+ //////////////////////////////////////////////////*/
10
+ // API
11
+ import { actions } from '../../runtime/action-proxy.js';
12
+ import { atom, map } from 'nanostores';
13
+ import { createContext, useEffect, useState, useSyncExternalStore } from 'react';
14
+ import { getHue } from '@terra-symposium/styling';
15
+ import { validateType, warn } from '../../runtime/runtime.js';
16
+ import { toast } from 'sonner';
17
+ // COMPONENTS
18
+ import * as TerraQualityRegex from '../../regex.mjs';
19
+ /*//////////////////////////////////////////////////
20
+ GENERAL
21
+ //////////////////////////////////////////////////*/
22
+ export const ASIDES = ['note', 'tip', 'info', 'example', 'caution', 'danger'];
23
+ const ASSET_CHUNK_SIZE_BYTES = 0.9 * 1024 * 1024;
24
+ export const document = typeof globalThis !== 'undefined' && typeof globalThis.document !== 'undefined'
25
+ ? globalThis.document
26
+ : undefined;
27
+ /**
28
+ * Handles sanitize name.
29
+ *
30
+ * @param name - Document name used to construct the canonical path.
31
+ */
32
+ export const sanitizeName = (name) => name.replace(/[^a-z0-9-]/gi, '-').toLowerCase();
33
+ /**
34
+ * Handles is index file.
35
+ *
36
+ * @param path - Docs path to normalize into a route-safe identifier.
37
+ */
38
+ export const isIndexFile = (path) => TerraQualityRegex.REGEX_INDEX_MD_MDX_I_REGEX().test(path || '');
39
+ /**
40
+ * Subscribes a React component to an external store and returns its current snapshot.
41
+ *
42
+ * @param store - External store that exposes the current value and a subscription function for change notifications.
43
+ *
44
+ * @return The latest value exposed by the store, kept in sync with its notifications.
45
+ */
46
+ export function useAtom(store) {
47
+ return useSyncExternalStore((n) => store.subscribe(() => {
48
+ n();
49
+ }), () => store.get(), () => store.get());
50
+ }
51
+ /**
52
+ * Client-side circuit breaker for mutation coordination.
53
+ *
54
+ * @remarks This utility combines three strategies to protect the browser's UI thread and network:
55
+ * 1. **Circuit Breaker:** Prevents excessive requests (>20/sec) or after consecutive 429/5xx errors. Opens to block new requests, then transitions to HALF_OPEN to retry after a cooldown.
56
+ * 2. **Debouncing/Throttling:** Controls input-triggered requests (e.g., keyboard, scroll) by delaying or limiting their frequency.
57
+ * 3. **Request Deduplication:** Reuses existing in-flight promises for identical requests, preventing redundant network calls.
58
+ */
59
+ class CircuitBreaker {
60
+ failures = 0;
61
+ requests = 0;
62
+ lastReqTime = typeof Date !== 'undefined' ? Date.now() : 0;
63
+ state = 'CLOSED';
64
+ nextAttempt = 0;
65
+ MAX_FAILURES = 5;
66
+ RESET_TIMEOUT_MS = 10000; // 10 seconds
67
+ MAX_REQS_PER_SEC = 20;
68
+ /**
69
+ * Checks check.
70
+ */
71
+ check() {
72
+ const now = Date.now();
73
+ // reset the volume counter every second
74
+ if (now - this.lastReqTime > 1000) {
75
+ this.requests = 0;
76
+ this.lastReqTime = now;
77
+ }
78
+ this.requests++;
79
+ if (this.state === 'OPEN') {
80
+ if (now > this.nextAttempt)
81
+ this.state = 'HALF_OPEN';
82
+ else
83
+ throw new Error('Circuit breaker tripped: Too many requests or consecutive failures. Please wait 10 seconds.');
84
+ }
85
+ else if (this.requests > this.MAX_REQS_PER_SEC) {
86
+ this.trip(now);
87
+ throw new Error('Circuit breaker tripped: Rate limit exceeded.');
88
+ }
89
+ }
90
+ /**
91
+ * Returns the trip.
92
+ *
93
+ * @param now - Timestamp consulted before trip mutates time-sensitive records.
94
+ */
95
+ trip(now) {
96
+ this.state = 'OPEN';
97
+ this.nextAttempt = now + this.RESET_TIMEOUT_MS;
98
+ warn('CircuitBreaker', 'Tripped OPEN. Network requests blocked.');
99
+ }
100
+ /**
101
+ * Record success.
102
+ */
103
+ recordSuccess() {
104
+ if (this.state === 'HALF_OPEN') {
105
+ this.state = 'CLOSED';
106
+ this.failures = 0;
107
+ }
108
+ }
109
+ /**
110
+ * Record failure.
111
+ */
112
+ recordFailure() {
113
+ this.failures++;
114
+ if (this.failures >= this.MAX_FAILURES)
115
+ this.trip(Date.now());
116
+ }
117
+ }
118
+ /**
119
+ * Describes the documented declaration.
120
+ *
121
+ * @remarks Caches the shared circuit breaker used for mutation helpers.
122
+ */
123
+ const breaker = new CircuitBreaker();
124
+ /**
125
+ * Executes an async action safely behind a circuit breaker and transition lock.
126
+ *
127
+ * @param action - Async action executed by the guarded operation.
128
+ * @param fallbackErr - Error value returned when the action cannot complete.
129
+ * @param onStart - Optional callback invoked before the action begins.
130
+ * @param onEnd - Optional callback invoked after the action settles.
131
+ */
132
+ export const runMutation = async (action, fallbackErr, onStart, onEnd) => {
133
+ breaker.check();
134
+ setTransition('local');
135
+ if (onStart)
136
+ onStart();
137
+ try {
138
+ await action();
139
+ breaker.recordSuccess();
140
+ }
141
+ catch (err) {
142
+ breaker.recordFailure();
143
+ toast.error(err instanceof Error ? err.message : fallbackErr);
144
+ }
145
+ finally {
146
+ if (onEnd)
147
+ onEnd();
148
+ clearTransition();
149
+ }
150
+ };
151
+ /*//////////////////////////////////////////////////
152
+ TREE UTILS
153
+ //////////////////////////////////////////////////*/
154
+ /**
155
+ * Handles get hue.
156
+ *
157
+ * @param title - Label displayed for the generated colour group.
158
+ * @param hue - Base hue used to derive the colour group.
159
+ */
160
+ export { getHue };
161
+ /**
162
+ * Handles get stable key.
163
+ *
164
+ * @param node - Docs tree node whose route should be resolved.
165
+ */
166
+ export const getStableKey = (node) => {
167
+ if (node.type === 'branch')
168
+ return node.origName;
169
+ if (node.type === 'leaf')
170
+ return node.origName;
171
+ return Math.random().toString();
172
+ };
173
+ /*//////////////////////////////////////////////////
174
+ FUNCTIONS
175
+ //////////////////////////////////////////////////*/
176
+ /**
177
+ * Uploads an asset in bounded chunks and reports progress while the server assembles it.
178
+ *
179
+ * @param file - Browser file to upload.
180
+ * @param dPath - Destination Docs path that owns the uploaded asset.
181
+ * @param opts - Optional image transforms, preview destination, and per-chunk progress callback.
182
+ *
183
+ * @return The saved asset path or URL and any available compression or filename metadata.
184
+ */
185
+ export async function uploadAssetChunked(file, dPath, opts) {
186
+ const totalChunks = Math.ceil(file.size / ASSET_CHUNK_SIZE_BYTES) || 1;
187
+ let finalAsset = null;
188
+ for (let c = 0; c < totalChunks; c++) {
189
+ const chunk = file.slice(c * ASSET_CHUNK_SIZE_BYTES, (c + 1) * ASSET_CHUNK_SIZE_BYTES);
190
+ const formData = new FormData();
191
+ formData.append('file', new File([chunk], file.name, { type: file.type }));
192
+ formData.append('path', dPath);
193
+ formData.append('fileId', `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`);
194
+ formData.append('chunkIndex', String(c));
195
+ formData.append('totalChunks', String(totalChunks));
196
+ if (opts?.resize)
197
+ formData.append('resize', 'true');
198
+ if (opts?.grayscale)
199
+ formData.append('grayscale', 'true');
200
+ if (opts?.previewAssetPath)
201
+ formData.append('assetPath', opts.previewAssetPath);
202
+ try {
203
+ // native Astro Actions client automatically handles multipart/form-data encoding and routing!
204
+ const { data, error } = await actions.write.asset.upload(formData);
205
+ if (error)
206
+ throw new Error(error.message || 'Action rejected the payload');
207
+ if (c === totalChunks - 1)
208
+ finalAsset = data;
209
+ if (opts?.onProgress)
210
+ opts.onProgress({ bytes: chunk.size, currentChunk: c + 1, totalChunks });
211
+ }
212
+ catch (err) {
213
+ console.error(`[uploadAssetChunked] Error on chunk ${c}:`, err);
214
+ throw err;
215
+ }
216
+ }
217
+ if (!finalAsset)
218
+ throw new Error('Upload failed to return final attachment.');
219
+ return finalAsset;
220
+ }
221
+ /**
222
+ * Handles download.
223
+ *
224
+ * @param filename - Filename input supplied to download's operation.
225
+ * @param content - Content input supplied to download's operation.
226
+ * @param type - Type input supplied to download's operation.
227
+ */
228
+ export function download(filename, content, type = 'text/plain') {
229
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
230
+ warn('download', 'Bypass requested execution; environment window context is dead.');
231
+ return;
232
+ }
233
+ let dlName = filename;
234
+ if (type === 'text/markdown' &&
235
+ !dlName.toLowerCase().endsWith('.md') &&
236
+ !dlName.toLowerCase().endsWith('.mdx'))
237
+ dlName += '.mdx';
238
+ const href = URL.createObjectURL(content instanceof Blob ? content : new Blob([content], { type }));
239
+ const link = document.createElement('a');
240
+ link.href = href;
241
+ link.download = dlName;
242
+ link.click();
243
+ URL.revokeObjectURL(href);
244
+ }
245
+ /**
246
+ * Reads the browser selection when it is a collapsed caret, such as the Docs editor insertion point.
247
+ *
248
+ * @return The active collapsed range, or `null` when there is no browser selection or the selection spans content.
249
+ */
250
+ export function getCollapsedRange() {
251
+ if (typeof window === 'undefined')
252
+ return null;
253
+ const sel = window.getSelection();
254
+ if (!sel?.rangeCount || !sel.isCollapsed)
255
+ return null;
256
+ return sel.getRangeAt(0);
257
+ }
258
+ /**
259
+ * Captures child-node indexes from a root node to a target so the target can be found after DOM updates.
260
+ *
261
+ * @param root - DOM node whose child tree defines the path origin.
262
+ * @param tgt - Descendant node to locate, or `null` when no selection node exists.
263
+ *
264
+ * @return The sequence of child indexes from the root, or `null` when the target is not inside it.
265
+ */
266
+ export function captureNodePath(root, tgt) {
267
+ if (!tgt)
268
+ return null;
269
+ const path = [];
270
+ let cur = tgt;
271
+ while (cur && cur !== root) {
272
+ if (!cur.parentNode)
273
+ return null;
274
+ const i = Array.from(cur.parentNode.childNodes).findIndex((c) => c === cur);
275
+ if (i === -1)
276
+ return null;
277
+ path.unshift(i);
278
+ cur = cur.parentNode;
279
+ }
280
+ return cur === root ? path : null;
281
+ }
282
+ /**
283
+ * Converts a DOM text position into its character offset within the editor's complete text flow.
284
+ *
285
+ * @param root - Editor element whose text nodes define the linear text flow.
286
+ * @param node - Selected DOM node whose position should be measured.
287
+ * @param offset - Character offset within a text node or child index within an element node.
288
+ *
289
+ * @return The character offset from the beginning of the editor, or `null` if the node is absent or outside it.
290
+ */
291
+ export function captureLinearOffset(root, node, offset = 0) {
292
+ if (!node)
293
+ return null;
294
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
295
+ let total = 0;
296
+ let cur = walker.nextNode();
297
+ while (cur) {
298
+ if (cur === (node instanceof Text ? node : (node.childNodes[offset] ?? node)))
299
+ return total + Math.min(offset, cur.textContent?.length ?? 0);
300
+ total += cur.textContent?.length ?? 0;
301
+ cur = walker.nextNode();
302
+ }
303
+ return null;
304
+ }
305
+ /**
306
+ * Finds the DOM caret range at a character offset in the editor's text flow.
307
+ *
308
+ * @param root - Editor element whose text nodes should be traversed.
309
+ * @param i - Character offset from the start of the editor.
310
+ *
311
+ * @return A collapsed range at the requested offset, or `null` for an invalid or out-of-range offset.
312
+ */
313
+ export function resolveLinearOffset(root, i) {
314
+ if (typeof i !== 'number' || i < 0)
315
+ return null;
316
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
317
+ let cur = walker.nextNode();
318
+ let remaining = i;
319
+ while (cur) {
320
+ const len = cur.textContent?.length ?? 0;
321
+ if (remaining <= len) {
322
+ const range = document.createRange();
323
+ range.setStart(cur, Math.min(remaining, len));
324
+ range.collapse(true);
325
+ return range;
326
+ }
327
+ remaining -= len;
328
+ cur = walker.nextNode();
329
+ }
330
+ return null;
331
+ }
332
+ /**
333
+ * Handles paste md.
334
+ *
335
+ * @param insert - Insert input supplied to paste md's operation.
336
+ * @param md - Md input supplied to paste md's operation.
337
+ * @param selection - Selection input supplied to paste md's operation.
338
+ */
339
+ export function pasteMd(insert, md, selection) {
340
+ if (typeof window !== 'undefined') {
341
+ window.requestAnimationFrame(() => window.requestAnimationFrame(() => {
342
+ insert(md, false, selection ?? null);
343
+ }));
344
+ return;
345
+ }
346
+ insert(md, false, selection ?? null);
347
+ }
348
+ /**
349
+ * Adds an import statement when equivalent syntax is not already present in the source text.
350
+ *
351
+ * @param md - Markdown or source text that should receive the import.
352
+ * @param statement - Complete import statement to add when no matching import exists.
353
+ *
354
+ * @return The original text when the import is already present, otherwise the text with the import prepended.
355
+ */
356
+ export function withImport(md, statement) {
357
+ if (md.includes(statement))
358
+ return md;
359
+ // Flexible duplicate protection
360
+ const baseStatementMatch = statement.match(/import\s+(.*?)\s+from\s+['"](.*?)['"]/);
361
+ if (baseStatementMatch) {
362
+ const [, cmp, path] = baseStatementMatch;
363
+ if (new RegExp(`import\\s+${cmp}\\s+from\\s+['"]${path}['"]`).test(md))
364
+ return md;
365
+ }
366
+ // Unconditionally append right at the very top of the evaluated string or just below fm boundaries
367
+ if (md.startsWith('---')) {
368
+ const parts = md.split('---');
369
+ // parts[0] is empty, parts[1] is fm, parts[2] is body
370
+ if (parts.length >= 3) {
371
+ parts[2] = `\n${statement}\n` + parts[2];
372
+ return parts.join('---');
373
+ }
374
+ }
375
+ return `${statement}\n\n${md}`;
376
+ }
377
+ /**
378
+ * Locates the CodeMirror view in the code block that currently has keyboard focus.
379
+ *
380
+ * @return The mounted editor view, or `null` during SSR or when the editor is not mounted.
381
+ */
382
+ export function codeViewOf() {
383
+ if (typeof document === 'undefined')
384
+ return null;
385
+ const active = document.activeElement instanceof Element
386
+ ? document.activeElement.closest('.docs-code-block .cm-editor')
387
+ : null;
388
+ return (active?.cmView?.view ?? null);
389
+ }
390
+ /**
391
+ * Converts raw HTML into structured md, maintaining basic formatting constraints.
392
+ *
393
+ * @param html - Raw HTML to convert into the editor's Markdown representation.
394
+ *
395
+ * @return Markdown text with supported block and inline formatting preserved.
396
+ */
397
+ export function htmlToMd(html) {
398
+ if (typeof window === 'undefined') {
399
+ warn('htmlToMd', 'Window context unavailable; returning raw markup.');
400
+ return html;
401
+ }
402
+ const root = new DOMParser().parseFromString(html, 'text/html').body;
403
+ const rendered = new Map();
404
+ const pending = [{ node: root, visited: false }];
405
+ while (pending.length > 0) {
406
+ const curr = pending.pop();
407
+ if (curr.node.nodeType === Node.TEXT_NODE) {
408
+ let text = curr.node.textContent || '';
409
+ // Preserve embedded leaf structure tokens as separate Markdown blocks.
410
+ if (text.includes('|||'))
411
+ text = text.replace(/\|\|\|/g, '\n\n|||\n\n');
412
+ rendered.set(curr.node, text);
413
+ continue;
414
+ }
415
+ if (curr.node.nodeType !== Node.ELEMENT_NODE) {
416
+ rendered.set(curr.node, '');
417
+ continue;
418
+ }
419
+ const element = curr.node;
420
+ if (!curr.visited) {
421
+ pending.push({ node: curr.node, visited: true });
422
+ for (let i = element.childNodes.length - 1; i >= 0; i--) {
423
+ const child = element.childNodes[i];
424
+ if (child)
425
+ pending.push({ node: child, visited: false });
426
+ }
427
+ continue;
428
+ }
429
+ const tag = element.tagName.toLowerCase();
430
+ const children = Array.from(element.childNodes)
431
+ .map((child) => rendered.get(child) || '')
432
+ .join('');
433
+ let text = children;
434
+ switch (tag) {
435
+ case 'table':
436
+ case 'thead':
437
+ case 'tbody':
438
+ case 'tfoot':
439
+ case 'tr':
440
+ text = `<${tag}${Array.from(element.attributes)
441
+ .map((attribute) => ` ${attribute.name}="${attribute.value}"`)
442
+ .join('')}>\n${children}\n</${tag}>`;
443
+ break;
444
+ case 'th':
445
+ case 'td':
446
+ text = `<${tag}${Array.from(element.attributes)
447
+ .map((attribute) => ` ${attribute.name}="${attribute.value}"`)
448
+ .join('')}>\n${children.trim()}\n</${tag}>`;
449
+ break;
450
+ case 'h1':
451
+ case 'h2':
452
+ text = `\n## ${children}\n\n`;
453
+ break;
454
+ case 'h3':
455
+ case 'h4':
456
+ case 'h5':
457
+ case 'h6':
458
+ text = `\n### ${children}\n\n`;
459
+ break;
460
+ case 'p':
461
+ case 'div':
462
+ text = element.closest('td, th') ? `\n${children}\n` : `\n${children}\n\n`;
463
+ break;
464
+ case 'strong':
465
+ case 'b':
466
+ text = `**${children}**`;
467
+ break;
468
+ case 'em':
469
+ case 'i':
470
+ text = `_${children}_`;
471
+ break;
472
+ case 'u':
473
+ text = `<u>${children}</u>`;
474
+ break;
475
+ case 'del':
476
+ case 's':
477
+ text = `~~${children}~~`;
478
+ break;
479
+ case 'a':
480
+ text = `[${children}](${element.getAttribute('href') || ''})`;
481
+ break;
482
+ case 'code':
483
+ text = element.closest('pre') ? children : `\`${children}\``;
484
+ break;
485
+ case 'pre': {
486
+ const match = element
487
+ .querySelector('code')
488
+ ?.className.match(TerraQualityRegex.REGEX_LANGUAGE_A_Z0_9_I_REGEX());
489
+ text = `\n\`\`\`${match ? match[1] : 'text'}\n${children.trim()}\n\`\`\`\n`;
490
+ break;
491
+ }
492
+ case 'blockquote':
493
+ text = `\n> ${children}\n\n`;
494
+ break;
495
+ case 'ul':
496
+ case 'ol':
497
+ text = `\n${children}\n`;
498
+ break;
499
+ case 'li':
500
+ text = `${element.closest('ul, ol')?.tagName.toLowerCase() === 'ol' ? '1. ' : '- '}${children.trim()}\n`;
501
+ break;
502
+ case 'br':
503
+ text = '\n';
504
+ break;
505
+ case 'img':
506
+ text = `![${element.getAttribute('alt') || 'image'}](${element.getAttribute('src') || ''})`;
507
+ break;
508
+ }
509
+ rendered.set(curr.node, text);
510
+ }
511
+ return (rendered.get(root) || '').replace(TerraQualityRegex.REGEX_N_3_G_REGEX(), '\n\n').trim();
512
+ }
513
+ /*//////////////////////////////////////////////////
514
+ STORAGE UTILS
515
+ //////////////////////////////////////////////////*/
516
+ // LOCAL STORAGE
517
+ /**
518
+ * Reads a persisted value from local storage when available.
519
+ *
520
+ * @param key - Local-storage key that identifies the persisted value to load.
521
+ * @param fallback - Value returned when storage is unavailable.
522
+ * @param valid - Type guard for the parsed value.
523
+ *
524
+ * @return read value.
525
+ *
526
+ * @template T - Expected value type.
527
+ *
528
+ * @remarks This is browser-only and falls back cleanly during SSR.
529
+ */
530
+ function readStorage(key, fallback, valid) {
531
+ if (validateType(['undefined'], globalThis.window))
532
+ return fallback;
533
+ try {
534
+ const v = window.localStorage.getItem(key);
535
+ if (!validateType(['string'], v))
536
+ return fallback;
537
+ try {
538
+ const parsed = JSON.parse(v);
539
+ return valid(parsed) ? parsed : fallback;
540
+ }
541
+ catch {
542
+ return fallback;
543
+ }
544
+ }
545
+ catch {
546
+ return fallback;
547
+ }
548
+ }
549
+ /**
550
+ * Writes a value to local storage when available.
551
+ *
552
+ * @param key - Local-storage key under which the serialized value should be saved.
553
+ * @param v - Value to serialise.
554
+ *
555
+ * @remarks Write failures are swallowed because persistence should never block editing.
556
+ */
557
+ function writeStorage(key, v) {
558
+ if (validateType(['undefined'], globalThis.window))
559
+ return;
560
+ try {
561
+ window.localStorage.setItem(key, JSON.stringify(v));
562
+ }
563
+ catch {
564
+ return;
565
+ }
566
+ }
567
+ /*//////////////////////////////////////////////////
568
+ STORES
569
+ //////////////////////////////////////////////////*/
570
+ // STATE ATOMS
571
+ /**
572
+ * Shared attachment types accepted by the docs editor.
573
+ *
574
+ * @returns supported attachment type literals.
575
+ *
576
+ * @remarks These types drive both filtering and export behavior.
577
+ */
578
+ export const ATTCH_TYPES = ['document', 'image', 'youtube', 'website', 'tsdocs', 'other'];
579
+ /**
580
+ * Persistent attachment filter state.
581
+ *
582
+ * @returns An atom holding the selected attachment types.
583
+ *
584
+ * @remarks The filter defaults to showing all supported types.
585
+ */
586
+ export const $attachmentFilter = atom([...ATTCH_TYPES]);
587
+ /**
588
+ * Current docs editor mode.
589
+ *
590
+ * @returns A persisted mode atom.
591
+ *
592
+ * @remarks The mode is restored from local storage so the editor reopens in the same state.
593
+ */
594
+ export const $mode = atom(readStorage('docs-mode', 'view', (i) => ['view', 'edit', 'attachments'].includes(i)));
595
+ /** Shares the active leaf title across Docs surfaces. */
596
+ export const $leafTitle = atom(null);
597
+ /**
598
+ * Global transition flag for docs navigation and mutations.
599
+ *
600
+ * @returns A boolean atom.
601
+ *
602
+ * @remarks This lets the UI disable inputs while a transition is active.
603
+ */
604
+ export const $transition = atom(false);
605
+ /**
606
+ * Current toolbar state.
607
+ *
608
+ * @returns A nullable toolbar atom.
609
+ *
610
+ * @remarks The toolbar is controlled centrally so overlays can share the same focus state.
611
+ */
612
+ export const $toolbar = atom(null);
613
+ /**
614
+ * Hydration counter for docs editor widgets.
615
+ *
616
+ * @returns A numeric atom tracking hydration depth.
617
+ *
618
+ * @remarks This is used to delay interactions until the editor tree is ready.
619
+ */
620
+ export const $hydrating = atom(0);
621
+ /**
622
+ * Surface readiness state for docs editing.
623
+ *
624
+ * @returns A nullable mode atom.
625
+ *
626
+ * @remarks The value flips once the interactive surface is available.
627
+ */
628
+ export const $surfaceReady = atom(null);
629
+ export const $editReadyPath = atom(null);
630
+ /** Shared cursor state so toolbar focus can preserve the last insertion point visibly. */
631
+ export const $cursor = atom(null);
632
+ /** Persisted caret snapshot used for the simulated cursor overlay when focus leaves the editor. */
633
+ export const $cursorGhost = atom(null);
634
+ /** Linear caret bookmark used to simulate the visible cursor without relying on DOM focus. */
635
+ export const $cursorTrack = atom(null);
636
+ /**
637
+ * Cursor position snapshot for the docs editor.
638
+ *
639
+ * @returns A nullable cursor atom.
640
+ *
641
+ * @remarks This duplicates the visible cursor state for consumers that need direct position access.
642
+ */
643
+ export const $cursorPosition = atom(null);
644
+ /**
645
+ * Unsaved docs draft flags.
646
+ *
647
+ * @returns A map store keyed by document id.
648
+ *
649
+ * @remarks This store only tracks presence, not draft content.
650
+ */
651
+ export const $unsavedDrafts = map({});
652
+ /**
653
+ * In-memory docs draft cache.
654
+ *
655
+ * @returns A map of draft payloads and metadata.
656
+ *
657
+ * @remarks This cache is process-local and intentionally not persisted.
658
+ */
659
+ export const memoryDrafts = new Map();
660
+ /**
661
+ * Sidebar visibility state for the docs editor.
662
+ *
663
+ * @returns A persisted boolean atom.
664
+ *
665
+ * @remarks The default keeps the sidebar open for discoverability.
666
+ */
667
+ export const $sidebar = atom(readStorage('docs-sidebar-open', true, (i) => validateType(['boolean'], i)));
668
+ // HELPERS
669
+ if (!validateType(['undefined'], globalThis.window)) {
670
+ $sidebar.listen((v) => {
671
+ writeStorage('docs-sidebar-open', v);
672
+ });
673
+ $mode.listen((v) => {
674
+ writeStorage('docs-mode', v);
675
+ });
676
+ $cursor.listen((v) => {
677
+ if (v)
678
+ $cursorGhost.set(v);
679
+ });
680
+ }
681
+ /*//////////////////////////////////////////////////
682
+ TRANSITION SYSTEM
683
+ //////////////////////////////////////////////////*/
684
+ /**
685
+ * Shared transition store for docs UI coordination.
686
+ *
687
+ * @returns transition store object.
688
+ *
689
+ * @remarks This is kept as a plain object so listeners can subscribe without extra abstractions.
690
+ */
691
+ export const transitionStore = {
692
+ transition: 'idle',
693
+ restore: null,
694
+ listeners: new Set(),
695
+ };
696
+ /**
697
+ * Sets the active docs transition state.
698
+ *
699
+ * @param transition - Next transition state.
700
+ *
701
+ * @remarks The boolean store mirrors the non-idle state for simpler UI consumers.
702
+ */
703
+ export function setTransition(transition) {
704
+ transitionStore.transition = transition;
705
+ $transition.set(transition !== 'idle');
706
+ transitionStore.listeners.forEach((l) => {
707
+ l();
708
+ });
709
+ }
710
+ /**
711
+ * Clears the active docs transition state.
712
+ *
713
+ *
714
+ * @remarks Idle is the only state that leaves the transition flag unset.
715
+ */
716
+ export function clearTransition() {
717
+ if (transitionStore.transition === 'idle')
718
+ return;
719
+ setTransition('idle');
720
+ }
721
+ /**
722
+ * Subscribes to the current docs transition state.
723
+ *
724
+ * @return use Transition State.
725
+ *
726
+ * @remarks This is used by components that need to react to local mutation states.
727
+ */
728
+ export function useTransitionState() {
729
+ const [transition, setTransitionState] = useState(transitionStore.transition);
730
+ useEffect(() => {
731
+ /**
732
+ * Handles update.
733
+ */
734
+ const update = () => {
735
+ setTransitionState(transitionStore.transition);
736
+ };
737
+ transitionStore.listeners.add(update);
738
+ return () => {
739
+ transitionStore.listeners.delete(update);
740
+ };
741
+ }, []);
742
+ return transition;
743
+ }
744
+ /**
745
+ * Shared editor transition context.
746
+ *
747
+ * @returns transition context object.
748
+ *
749
+ * @remarks The provider keeps layout and loading overlays in sync.
750
+ */
751
+ export const TransitionCtx = createContext(null);
752
+ /*//////////////////////////////////////////////////
753
+ CONFIG
754
+ //////////////////////////////////////////////////*/
755
+ // CONFIG
756
+ // REACT CONTEXT
757
+ /**
758
+ * Context for docs edit state.
759
+ *
760
+ * @returns edit state context object.
761
+ *
762
+ * @remarks The context carries the current editable document state through the editor tree.
763
+ */
764
+ export const EditStateCtx = createContext(null);
765
+ /**
766
+ * Context for the docs editor surface.
767
+ *
768
+ * @returns surface context object.
769
+ *
770
+ * @remarks This lets nested components reach the active editor surface without prop drilling.
771
+ */
772
+ export const EditorSurfaceCtx = createContext(null);
773
+ /*//////////////////////////////////////////////////
774
+ HELPERS
775
+ //////////////////////////////////////////////////*/
776
+ // UTILITIES
777
+ /**
778
+ * Handles extract all node ids.
779
+ *
780
+ * @param nodes - Graph nodes rendered and updated by extract all node ids.
781
+ *
782
+ * @return All unique ids discovered in the tree.
783
+ *
784
+ * @remarks Collects every node identifier from a tree of docs entries.
785
+ */
786
+ export function extractAllNodeIds(nodes) {
787
+ const ids = [];
788
+ const pending = [...nodes].reverse();
789
+ while (pending.length > 0) {
790
+ const node = pending.pop();
791
+ if (node.origName)
792
+ ids.push(node.origName);
793
+ if (node.type === 'leaf' && node.path)
794
+ ids.push(node.path);
795
+ if (node.type === 'branch' && node.children) {
796
+ for (let i = node.children.length - 1; i >= 0; i--) {
797
+ const child = node.children[i];
798
+ if (child)
799
+ pending.push(child);
800
+ }
801
+ }
802
+ }
803
+ return [...new Set(ids)];
804
+ }
805
+ /*//////////////////////////////////////////////////
806
+ READINESS
807
+ //////////////////////////////////////////////////*/
808
+ export const $editorMounts = atom({ expected: [], mounted: [], path: null });
809
+ const assignments = new Map();
810
+ /**
811
+ * Handles reset editor mounts.
812
+ *
813
+ * @param path - Source or route path resolved for reset editor mounts.
814
+ * @param expected - Expected input supplied to reset editor mounts's operation.
815
+ */
816
+ export function resetEditorMounts(path, expected) {
817
+ assignments.clear();
818
+ $editorMounts.set({ expected, mounted: [], path: path || null });
819
+ }
820
+ /**
821
+ * Handles set editor mount.
822
+ *
823
+ * @param path - Source or route path resolved for set editor mount.
824
+ * @param reporter - Reporter input supplied to set editor mount's operation.
825
+ * @param mounted - Mounted input supplied to set editor mount's operation.
826
+ * @param kind - Content kind that selects set editor mount's renderer.
827
+ */
828
+ export function setEditorMount(path, reporter, mounted, kind) {
829
+ if (!path || !reporter)
830
+ return;
831
+ const state = $editorMounts.get();
832
+ if (state.path !== path)
833
+ return;
834
+ if (mounted && !assignments.has(reporter)) {
835
+ const id = kind
836
+ ? state.expected.find((v) => v.startsWith(`${kind}:`) && !state.mounted.includes(v))
837
+ : reporter;
838
+ if (!id || !state.expected.includes(id))
839
+ return;
840
+ assignments.set(reporter, id);
841
+ }
842
+ const id = assignments.get(reporter) || reporter;
843
+ if (!mounted)
844
+ assignments.delete(reporter);
845
+ const n = mounted ? [...new Set([...state.mounted, id])] : state.mounted.filter((v) => v !== id);
846
+ if (n.length !== state.mounted.length || n.some((v, i) => v !== state.mounted[i]))
847
+ $editorMounts.set({ ...state, mounted: n });
848
+ }
849
+ /*//////////////////////////////////////////////////
850
+ NAVIGATION
851
+ //////////////////////////////////////////////////*/
852
+ /**
853
+ * Handles keep deep path.
854
+ *
855
+ * @param current - Current value before the update.
856
+ * @param next - Proposed value to compare with the current value.
857
+ */
858
+ export const keepDeepPath = (curr, n) => {
859
+ // prettier-ignore
860
+ const cur = curr.replace(TerraQualityRegex.REGEX_DOCS_REGEX(), '').replace(TerraQualityRegex.REGEX_PATTERN_REGEX_3(), '').split('/').filter(Boolean);
861
+ // prettier-ignore
862
+ const nxt = n.replace(TerraQualityRegex.REGEX_DOCS_REGEX(), '').replace(TerraQualityRegex.REGEX_PATTERN_REGEX_3(), '').split('/').filter(Boolean);
863
+ if (!nxt.length)
864
+ return n;
865
+ if (cur.length > nxt.length && cur.slice(cur.length - nxt.length).join('/') === nxt.join('/'))
866
+ return curr;
867
+ return n;
868
+ };
869
+ /**
870
+ * Handles is doc body.
871
+ *
872
+ * @param value - Value whose display label should be derived.
873
+ */
874
+ export const isDocBody = (val) => Array.isArray(val) && val.every((b) => b && typeof b === 'object' && '_type' in b);
875
+ /**
876
+ * Handles docs navigation state.
877
+ *
878
+ * @param prev - Previous state used as the base for the update.
879
+ * @param detail - Change detail merged into the next state.
880
+ */
881
+ /*//////////////////////////////////////////////////
882
+ TOOLBAR
883
+ //////////////////////////////////////////////////*/
884
+ const VAL_BY_KIND = {
885
+ Aside: 'aside',
886
+ DocsTable: 'table',
887
+ Nodes: 'nodes',
888
+ attachment: 'attachment',
889
+ callout: 'aside',
890
+ component: 'component',
891
+ math: 'math',
892
+ table: 'table',
893
+ tsdocs: 'tsdocs',
894
+ };
895
+ /**
896
+ * Determines which Docs toolbar block is active at the current editor selection.
897
+ *
898
+ * @param el - Focused element inside the active Docs editor.
899
+ * @param vals - Supported block kinds that may be returned for custom content.
900
+ *
901
+ * @return The active block kind, or `null` when the selection is outside a supported block.
902
+ */
903
+ export function toolbarFocusValue(el, vals) {
904
+ const text = el.closest('h1, h2, h3, h4, h5, h6, p');
905
+ if (text)
906
+ return text.tagName.toLowerCase();
907
+ if (el
908
+ .closest('td, th')
909
+ ?.closest('[data-docs-editor-block="DocsTable"], [data-terra-block="table"]'))
910
+ return 'p';
911
+ const block = el.closest('[data-docs-editor-block], [data-terra-block], .docs-math-wrapper, [data-math-code], [data-docs-view-root="true"]');
912
+ if (!block)
913
+ return null;
914
+ const kind = block.getAttribute('data-docs-editor-block') ?? block.getAttribute('data-terra-block') ?? '';
915
+ if (kind && VAL_BY_KIND[kind])
916
+ return VAL_BY_KIND[kind];
917
+ if (kind && vals.includes(kind.toLowerCase()))
918
+ return kind.toLowerCase();
919
+ if (block.matches('.docs-math-wrapper, [data-math-code]'))
920
+ return 'math';
921
+ return block.matches('[data-docs-view-root="true"]') ? 'component' : null;
922
+ }
923
+ //# sourceMappingURL=workspace.js.map