@deck.gl-community/widgets 9.2.8 → 9.3.0-beta.1

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 (295) hide show
  1. package/README.md +9 -1
  2. package/dist/graph-widgets/_deprecate/long-press-button.d.ts.map +1 -0
  3. package/dist/graph-widgets/_deprecate/long-press-button.js.map +1 -0
  4. package/dist/graph-widgets/_deprecate/view-control-widget.d.ts.map +1 -0
  5. package/dist/graph-widgets/_deprecate/view-control-widget.js.map +1 -0
  6. package/dist/{widgets → graph-widgets}/long-press-button.d.ts +1 -0
  7. package/dist/graph-widgets/long-press-button.d.ts.map +1 -0
  8. package/dist/{widgets → graph-widgets}/long-press-button.js +1 -0
  9. package/dist/graph-widgets/long-press-button.js.map +1 -0
  10. package/dist/graph-widgets/long-press-controller.d.ts.map +1 -0
  11. package/dist/graph-widgets/long-press-controller.js.map +1 -0
  12. package/dist/{widgets → graph-widgets}/pan-widget.d.ts +3 -2
  13. package/dist/graph-widgets/pan-widget.d.ts.map +1 -0
  14. package/dist/{widgets → graph-widgets}/pan-widget.js +19 -15
  15. package/dist/graph-widgets/pan-widget.js.map +1 -0
  16. package/dist/{widgets → graph-widgets}/zoom-range-widget.d.ts +3 -3
  17. package/dist/graph-widgets/zoom-range-widget.d.ts.map +1 -0
  18. package/dist/{widgets → graph-widgets}/zoom-range-widget.js +24 -23
  19. package/dist/graph-widgets/zoom-range-widget.js.map +1 -0
  20. package/dist/html-overlay-widgets/html-cluster-widget.d.ts.map +1 -0
  21. package/dist/html-overlay-widgets/html-cluster-widget.js.map +1 -0
  22. package/dist/{widgets → html-overlay-widgets}/html-overlay-item.d.ts +1 -0
  23. package/dist/html-overlay-widgets/html-overlay-item.d.ts.map +1 -0
  24. package/dist/html-overlay-widgets/html-overlay-item.js.map +1 -0
  25. package/dist/{widgets → html-overlay-widgets}/html-overlay-widget.d.ts +1 -1
  26. package/dist/html-overlay-widgets/html-overlay-widget.d.ts.map +1 -0
  27. package/dist/{widgets → html-overlay-widgets}/html-overlay-widget.js +2 -2
  28. package/dist/html-overlay-widgets/html-overlay-widget.js.map +1 -0
  29. package/dist/{widgets → html-overlay-widgets}/html-tooltip-widget.d.ts +1 -0
  30. package/dist/html-overlay-widgets/html-tooltip-widget.d.ts.map +1 -0
  31. package/dist/html-overlay-widgets/html-tooltip-widget.js.map +1 -0
  32. package/dist/index.cjs +5102 -82
  33. package/dist/index.cjs.map +4 -4
  34. package/dist/index.d.ts +33 -12
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +27 -6
  37. package/dist/index.js.map +1 -1
  38. package/dist/keyboard-shortcuts/keyboard-shortcuts-manager.d.ts +18 -0
  39. package/dist/keyboard-shortcuts/keyboard-shortcuts-manager.d.ts.map +1 -0
  40. package/dist/keyboard-shortcuts/keyboard-shortcuts-manager.js +47 -0
  41. package/dist/keyboard-shortcuts/keyboard-shortcuts-manager.js.map +1 -0
  42. package/dist/keyboard-shortcuts/keyboard-shortcuts.d.ts +22 -0
  43. package/dist/keyboard-shortcuts/keyboard-shortcuts.d.ts.map +1 -0
  44. package/dist/keyboard-shortcuts/keyboard-shortcuts.js +83 -0
  45. package/dist/keyboard-shortcuts/keyboard-shortcuts.js.map +1 -0
  46. package/dist/lib/settings/settings.d.ts +17 -0
  47. package/dist/lib/settings/settings.d.ts.map +1 -0
  48. package/dist/lib/settings/settings.js +140 -0
  49. package/dist/lib/settings/settings.js.map +1 -0
  50. package/dist/ready-to-upstream-widgets/reset-view-widget.d.ts +21 -0
  51. package/dist/ready-to-upstream-widgets/reset-view-widget.d.ts.map +1 -0
  52. package/dist/ready-to-upstream-widgets/reset-view-widget.js +29 -0
  53. package/dist/ready-to-upstream-widgets/reset-view-widget.js.map +1 -0
  54. package/dist/widget-components/icon-button.d.ts +12 -0
  55. package/dist/widget-components/icon-button.d.ts.map +1 -0
  56. package/dist/widget-components/icon-button.js +12 -0
  57. package/dist/widget-components/icon-button.js.map +1 -0
  58. package/dist/widget-components/select-widget-component.d.ts +15 -0
  59. package/dist/widget-components/select-widget-component.d.ts.map +1 -0
  60. package/dist/widget-components/select-widget-component.js +229 -0
  61. package/dist/widget-components/select-widget-component.js.map +1 -0
  62. package/dist/widget-panels/box-widget.d.ts +43 -0
  63. package/dist/widget-panels/box-widget.d.ts.map +1 -0
  64. package/dist/widget-panels/box-widget.js +191 -0
  65. package/dist/widget-panels/box-widget.js.map +1 -0
  66. package/dist/widget-panels/box-widget.test.d.ts +2 -0
  67. package/dist/widget-panels/box-widget.test.d.ts.map +1 -0
  68. package/dist/widget-panels/box-widget.test.js +41 -0
  69. package/dist/widget-panels/box-widget.test.js.map +1 -0
  70. package/dist/widget-panels/full-screen-panel-widget.d.ts +33 -0
  71. package/dist/widget-panels/full-screen-panel-widget.d.ts.map +1 -0
  72. package/dist/widget-panels/full-screen-panel-widget.js +153 -0
  73. package/dist/widget-panels/full-screen-panel-widget.js.map +1 -0
  74. package/dist/widget-panels/full-screen-panel-widget.test.d.ts +2 -0
  75. package/dist/widget-panels/full-screen-panel-widget.test.d.ts.map +1 -0
  76. package/dist/widget-panels/full-screen-panel-widget.test.js +40 -0
  77. package/dist/widget-panels/full-screen-panel-widget.test.js.map +1 -0
  78. package/dist/widget-panels/heap-memory-widget.d.ts +26 -0
  79. package/dist/widget-panels/heap-memory-widget.d.ts.map +1 -0
  80. package/dist/widget-panels/heap-memory-widget.js +156 -0
  81. package/dist/widget-panels/heap-memory-widget.js.map +1 -0
  82. package/dist/widget-panels/keyboard-shortcuts-widget.d.ts +46 -0
  83. package/dist/widget-panels/keyboard-shortcuts-widget.d.ts.map +1 -0
  84. package/dist/widget-panels/keyboard-shortcuts-widget.js +301 -0
  85. package/dist/widget-panels/keyboard-shortcuts-widget.js.map +1 -0
  86. package/dist/widget-panels/modal-widget.d.ts +62 -0
  87. package/dist/widget-panels/modal-widget.d.ts.map +1 -0
  88. package/dist/widget-panels/modal-widget.js +309 -0
  89. package/dist/widget-panels/modal-widget.js.map +1 -0
  90. package/dist/widget-panels/modal-widget.test.d.ts +2 -0
  91. package/dist/widget-panels/modal-widget.test.d.ts.map +1 -0
  92. package/dist/widget-panels/modal-widget.test.js +103 -0
  93. package/dist/widget-panels/modal-widget.test.js.map +1 -0
  94. package/dist/widget-panels/omni-box-widget.d.ts +59 -0
  95. package/dist/widget-panels/omni-box-widget.d.ts.map +1 -0
  96. package/dist/widget-panels/omni-box-widget.js +562 -0
  97. package/dist/widget-panels/omni-box-widget.js.map +1 -0
  98. package/dist/widget-panels/omni-box-widget.test.d.ts +2 -0
  99. package/dist/widget-panels/omni-box-widget.test.d.ts.map +1 -0
  100. package/dist/widget-panels/omni-box-widget.test.js +49 -0
  101. package/dist/widget-panels/omni-box-widget.test.js.map +1 -0
  102. package/dist/widget-panels/reset-view-widget.d.ts +20 -0
  103. package/dist/widget-panels/reset-view-widget.d.ts.map +1 -0
  104. package/dist/widget-panels/reset-view-widget.js +28 -0
  105. package/dist/widget-panels/reset-view-widget.js.map +1 -0
  106. package/dist/widget-panels/settings-panel.d.ts +49 -0
  107. package/dist/widget-panels/settings-panel.d.ts.map +1 -0
  108. package/dist/widget-panels/settings-panel.js +263 -0
  109. package/dist/widget-panels/settings-panel.js.map +1 -0
  110. package/dist/widget-panels/settings-panel.test.d.ts +2 -0
  111. package/dist/widget-panels/settings-panel.test.d.ts.map +1 -0
  112. package/dist/widget-panels/settings-panel.test.js +217 -0
  113. package/dist/widget-panels/settings-panel.test.js.map +1 -0
  114. package/dist/widget-panels/sidebar-widget.d.ts +65 -0
  115. package/dist/widget-panels/sidebar-widget.d.ts.map +1 -0
  116. package/dist/widget-panels/sidebar-widget.js +339 -0
  117. package/dist/widget-panels/sidebar-widget.js.map +1 -0
  118. package/dist/widget-panels/sidebar-widget.test.d.ts +2 -0
  119. package/dist/widget-panels/sidebar-widget.test.d.ts.map +1 -0
  120. package/dist/widget-panels/sidebar-widget.test.js +175 -0
  121. package/dist/widget-panels/sidebar-widget.test.js.map +1 -0
  122. package/dist/widget-panels/stats-panel.d.ts +34 -0
  123. package/dist/widget-panels/stats-panel.d.ts.map +1 -0
  124. package/dist/widget-panels/stats-panel.js +61 -0
  125. package/dist/widget-panels/stats-panel.js.map +1 -0
  126. package/dist/widget-panels/stats-panel.test.d.ts +2 -0
  127. package/dist/widget-panels/stats-panel.test.d.ts.map +1 -0
  128. package/dist/widget-panels/stats-panel.test.js +36 -0
  129. package/dist/widget-panels/stats-panel.test.js.map +1 -0
  130. package/dist/widget-panels/text-editor-panel-monaco-runtime.d.ts +17 -0
  131. package/dist/widget-panels/text-editor-panel-monaco-runtime.d.ts.map +1 -0
  132. package/dist/widget-panels/text-editor-panel-monaco-runtime.js +69 -0
  133. package/dist/widget-panels/text-editor-panel-monaco-runtime.js.map +1 -0
  134. package/dist/widget-panels/text-editor-panel.d.ts +42 -0
  135. package/dist/widget-panels/text-editor-panel.d.ts.map +1 -0
  136. package/dist/widget-panels/text-editor-panel.js +249 -0
  137. package/dist/widget-panels/text-editor-panel.js.map +1 -0
  138. package/dist/widget-panels/text-editor-panel.test.d.ts +2 -0
  139. package/dist/widget-panels/text-editor-panel.test.d.ts.map +1 -0
  140. package/dist/widget-panels/text-editor-panel.test.js +393 -0
  141. package/dist/widget-panels/text-editor-panel.test.js.map +1 -0
  142. package/dist/widget-panels/time-measure-widget.d.ts +49 -0
  143. package/dist/widget-panels/time-measure-widget.d.ts.map +1 -0
  144. package/dist/widget-panels/time-measure-widget.js +351 -0
  145. package/dist/widget-panels/time-measure-widget.js.map +1 -0
  146. package/dist/widget-panels/toast-manager.d.ts +24 -0
  147. package/dist/widget-panels/toast-manager.d.ts.map +1 -0
  148. package/dist/widget-panels/toast-manager.js +96 -0
  149. package/dist/widget-panels/toast-manager.js.map +1 -0
  150. package/dist/widget-panels/toast-manager.test.d.ts +2 -0
  151. package/dist/widget-panels/toast-manager.test.d.ts.map +1 -0
  152. package/dist/widget-panels/toast-manager.test.js +75 -0
  153. package/dist/widget-panels/toast-manager.test.js.map +1 -0
  154. package/dist/widget-panels/toast-widget.d.ts +20 -0
  155. package/dist/widget-panels/toast-widget.d.ts.map +1 -0
  156. package/dist/widget-panels/toast-widget.js +207 -0
  157. package/dist/widget-panels/toast-widget.js.map +1 -0
  158. package/dist/widget-panels/toast-widget.test.d.ts +2 -0
  159. package/dist/widget-panels/toast-widget.test.d.ts.map +1 -0
  160. package/dist/widget-panels/toast-widget.test.js +81 -0
  161. package/dist/widget-panels/toast-widget.test.js.map +1 -0
  162. package/dist/widget-panels/toggle-widget.d.ts +34 -0
  163. package/dist/widget-panels/toggle-widget.d.ts.map +1 -0
  164. package/dist/widget-panels/toggle-widget.js +46 -0
  165. package/dist/widget-panels/toggle-widget.js.map +1 -0
  166. package/dist/widget-panels/toolbar-widget.d.ts +53 -0
  167. package/dist/widget-panels/toolbar-widget.d.ts.map +1 -0
  168. package/dist/widget-panels/toolbar-widget.js +160 -0
  169. package/dist/widget-panels/toolbar-widget.js.map +1 -0
  170. package/dist/widget-panels/toolbar-widget.test.d.ts +2 -0
  171. package/dist/widget-panels/toolbar-widget.test.d.ts.map +1 -0
  172. package/dist/widget-panels/toolbar-widget.test.js +105 -0
  173. package/dist/widget-panels/toolbar-widget.test.js.map +1 -0
  174. package/dist/widget-panels/widget-containers.d.ts +275 -0
  175. package/dist/widget-panels/widget-containers.d.ts.map +1 -0
  176. package/dist/widget-panels/widget-containers.js +761 -0
  177. package/dist/widget-panels/widget-containers.js.map +1 -0
  178. package/dist/widget-panels/widget-containers.test.d.ts +2 -0
  179. package/dist/widget-panels/widget-containers.test.d.ts.map +1 -0
  180. package/dist/widget-panels/widget-containers.test.js +337 -0
  181. package/dist/widget-panels/widget-containers.test.js.map +1 -0
  182. package/dist/widget-panels/y-zoom-widget.d.ts +66 -0
  183. package/dist/widget-panels/y-zoom-widget.d.ts.map +1 -0
  184. package/dist/widget-panels/y-zoom-widget.js +264 -0
  185. package/dist/widget-panels/y-zoom-widget.js.map +1 -0
  186. package/dist/widget-panels/y-zoom-widget.test.d.ts +2 -0
  187. package/dist/widget-panels/y-zoom-widget.test.d.ts.map +1 -0
  188. package/dist/widget-panels/y-zoom-widget.test.js +71 -0
  189. package/dist/widget-panels/y-zoom-widget.test.js.map +1 -0
  190. package/dist/widgets/heap-memory-widget.d.ts +26 -0
  191. package/dist/widgets/heap-memory-widget.d.ts.map +1 -0
  192. package/dist/widgets/heap-memory-widget.js +158 -0
  193. package/dist/widgets/heap-memory-widget.js.map +1 -0
  194. package/dist/widgets/keyboard-shortcuts-widget.d.ts +28 -0
  195. package/dist/widgets/keyboard-shortcuts-widget.d.ts.map +1 -0
  196. package/dist/widgets/keyboard-shortcuts-widget.js +125 -0
  197. package/dist/widgets/keyboard-shortcuts-widget.js.map +1 -0
  198. package/dist/widgets/omni-box-widget.d.ts +59 -0
  199. package/dist/widgets/omni-box-widget.d.ts.map +1 -0
  200. package/dist/widgets/omni-box-widget.js +493 -0
  201. package/dist/widgets/omni-box-widget.js.map +1 -0
  202. package/dist/widgets/settings-widget.d.ts +64 -0
  203. package/dist/widgets/settings-widget.d.ts.map +1 -0
  204. package/dist/widgets/settings-widget.js +148 -0
  205. package/dist/widgets/settings-widget.js.map +1 -0
  206. package/dist/widgets/view-manager-utils.d.ts +1 -1
  207. package/dist/widgets/view-manager-utils.d.ts.map +1 -1
  208. package/dist/widgets/view-manager-utils.js.map +1 -1
  209. package/package.json +4 -3
  210. package/src/{widgets → graph-widgets}/long-press-button.tsx +1 -0
  211. package/src/{widgets → graph-widgets}/pan-widget.tsx +30 -23
  212. package/src/{widgets → graph-widgets}/zoom-range-widget.tsx +36 -34
  213. package/src/{widgets → html-overlay-widgets}/html-overlay-item.tsx +1 -0
  214. package/src/{widgets → html-overlay-widgets}/html-overlay-widget.tsx +2 -2
  215. package/src/{widgets → html-overlay-widgets}/html-tooltip-widget.tsx +1 -0
  216. package/src/index.ts +109 -12
  217. package/src/keyboard-shortcuts/keyboard-shortcuts-manager.ts +58 -0
  218. package/src/keyboard-shortcuts/keyboard-shortcuts.ts +113 -0
  219. package/src/keyboard-shortcuts/keyboard-shortcuts.ts.disabled +107 -0
  220. package/src/lib/settings/settings.ts +203 -0
  221. package/src/ready-to-upstream-widgets/reset-view-widget.tsx +57 -0
  222. package/src/widget-components/icon-button.tsx +38 -0
  223. package/src/widget-components/select-widget-component.tsx +354 -0
  224. package/src/widget-panels/box-widget.test.tsx +50 -0
  225. package/src/widget-panels/box-widget.tsx +284 -0
  226. package/src/widget-panels/full-screen-panel-widget.test.tsx +49 -0
  227. package/src/widget-panels/full-screen-panel-widget.tsx +223 -0
  228. package/src/widget-panels/heap-memory-widget.tsx +221 -0
  229. package/src/widget-panels/keyboard-shortcuts-widget.tsx +511 -0
  230. package/src/widget-panels/modal-widget.test.tsx +124 -0
  231. package/src/widget-panels/modal-widget.tsx +464 -0
  232. package/src/widget-panels/omni-box-widget.test.tsx +59 -0
  233. package/src/widget-panels/omni-box-widget.tsx +849 -0
  234. package/src/widget-panels/reset-view-widget.tsx +56 -0
  235. package/src/widget-panels/settings-panel.test.tsx +286 -0
  236. package/src/widget-panels/settings-panel.tsx +619 -0
  237. package/src/widget-panels/sidebar-widget.test.tsx +215 -0
  238. package/src/widget-panels/sidebar-widget.tsx +525 -0
  239. package/src/widget-panels/stats-panel.test.tsx +41 -0
  240. package/src/widget-panels/stats-panel.tsx +108 -0
  241. package/src/widget-panels/text-editor-panel-monaco-runtime.ts +97 -0
  242. package/src/widget-panels/text-editor-panel.test.tsx +618 -0
  243. package/src/widget-panels/text-editor-panel.tsx +375 -0
  244. package/src/widget-panels/time-measure-widget.tsx +445 -0
  245. package/src/widget-panels/toast-manager.test.ts +98 -0
  246. package/src/widget-panels/toast-manager.ts +134 -0
  247. package/src/widget-panels/toast-widget.test.tsx +105 -0
  248. package/src/widget-panels/toast-widget.tsx +293 -0
  249. package/src/widget-panels/toggle-widget.tsx +93 -0
  250. package/src/widget-panels/toolbar-widget.test.ts +129 -0
  251. package/src/widget-panels/toolbar-widget.tsx +293 -0
  252. package/src/widget-panels/widget-containers.test.tsx +453 -0
  253. package/src/widget-panels/widget-containers.tsx +1330 -0
  254. package/src/widget-panels/worker-modules.d.ts +7 -0
  255. package/src/widget-panels/y-zoom-widget.test.tsx +101 -0
  256. package/src/widget-panels/y-zoom-widget.tsx +376 -0
  257. package/src/widgets/heap-memory-widget.tsx +223 -0
  258. package/src/widgets/keyboard-shortcuts-widget.tsx +245 -0
  259. package/src/widgets/omni-box-widget.tsx +768 -0
  260. package/src/widgets/settings-widget.tsx +277 -0
  261. package/src/widgets/view-manager-utils.ts +1 -1
  262. package/dist/_deprecate/long-press-button.d.ts.map +0 -1
  263. package/dist/_deprecate/long-press-button.js.map +0 -1
  264. package/dist/_deprecate/view-control-widget.d.ts.map +0 -1
  265. package/dist/_deprecate/view-control-widget.js.map +0 -1
  266. package/dist/widgets/html-cluster-widget.d.ts.map +0 -1
  267. package/dist/widgets/html-cluster-widget.js.map +0 -1
  268. package/dist/widgets/html-overlay-item.d.ts.map +0 -1
  269. package/dist/widgets/html-overlay-item.js.map +0 -1
  270. package/dist/widgets/html-overlay-widget.d.ts.map +0 -1
  271. package/dist/widgets/html-overlay-widget.js.map +0 -1
  272. package/dist/widgets/html-tooltip-widget.d.ts.map +0 -1
  273. package/dist/widgets/html-tooltip-widget.js.map +0 -1
  274. package/dist/widgets/long-press-button.d.ts.map +0 -1
  275. package/dist/widgets/long-press-button.js.map +0 -1
  276. package/dist/widgets/long-press-controller.d.ts.map +0 -1
  277. package/dist/widgets/long-press-controller.js.map +0 -1
  278. package/dist/widgets/pan-widget.d.ts.map +0 -1
  279. package/dist/widgets/pan-widget.js.map +0 -1
  280. package/dist/widgets/zoom-range-widget.d.ts.map +0 -1
  281. package/dist/widgets/zoom-range-widget.js.map +0 -1
  282. /package/dist/{_deprecate → graph-widgets/_deprecate}/long-press-button.d.ts +0 -0
  283. /package/dist/{_deprecate → graph-widgets/_deprecate}/long-press-button.js +0 -0
  284. /package/dist/{_deprecate → graph-widgets/_deprecate}/view-control-widget.d.ts +0 -0
  285. /package/dist/{_deprecate → graph-widgets/_deprecate}/view-control-widget.js +0 -0
  286. /package/dist/{widgets → graph-widgets}/long-press-controller.d.ts +0 -0
  287. /package/dist/{widgets → graph-widgets}/long-press-controller.js +0 -0
  288. /package/dist/{widgets → html-overlay-widgets}/html-cluster-widget.d.ts +0 -0
  289. /package/dist/{widgets → html-overlay-widgets}/html-cluster-widget.js +0 -0
  290. /package/dist/{widgets → html-overlay-widgets}/html-overlay-item.js +0 -0
  291. /package/dist/{widgets → html-overlay-widgets}/html-tooltip-widget.js +0 -0
  292. /package/src/{_deprecate → graph-widgets/_deprecate}/long-press-button.tsx +0 -0
  293. /package/src/{_deprecate → graph-widgets/_deprecate}/view-control-widget.tsx +0 -0
  294. /package/src/{widgets → graph-widgets}/long-press-controller.ts +0 -0
  295. /package/src/{widgets → html-overlay-widgets}/html-cluster-widget.ts +0 -0
@@ -0,0 +1,761 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ /** @jsxImportSource preact */
3
+ import { createContext } from 'preact';
4
+ import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'preact/hooks';
5
+ import { DarkTheme, LightTheme } from '@deck.gl/widgets';
6
+ /**
7
+ * Normalizes an object map of panels into an array in insertion order.
8
+ */
9
+ function normalizePanelRecordPanels(panels) {
10
+ return Object.keys(panels).map((panelId) => {
11
+ const panel = panels[panelId];
12
+ return {
13
+ ...panel,
14
+ id: panelId
15
+ };
16
+ });
17
+ }
18
+ /**
19
+ * Mounts an imperative HTML host for custom widget panels.
20
+ */
21
+ function CustomPanelContent({ className, onRenderHTML }) {
22
+ const rootElementRef = useRef(null);
23
+ useLayoutEffect(() => {
24
+ const rootElement = rootElementRef.current;
25
+ if (!rootElement) {
26
+ return undefined;
27
+ }
28
+ const cleanup = onRenderHTML(rootElement);
29
+ return () => {
30
+ if (typeof cleanup === 'function') {
31
+ cleanup();
32
+ }
33
+ };
34
+ }, [onRenderHTML]);
35
+ return _jsx("div", { ref: rootElementRef, className: className });
36
+ }
37
+ /**
38
+ * A wrapper panel that renders child panels in an accordion layout.
39
+ */
40
+ export class AccordeonPanel {
41
+ id;
42
+ title;
43
+ content;
44
+ theme;
45
+ constructor({ panels, id = 'accordeon-widgets', title = 'Panels', theme = 'inherit' }) {
46
+ this.id = id;
47
+ this.title = title;
48
+ this.theme = theme;
49
+ this.content = _jsx(AccordeonWidgetContainer, { panels: normalizePanelRecordPanels(panels) });
50
+ }
51
+ }
52
+ /**
53
+ * A wrapper panel that renders child panels in a tabbed layout.
54
+ */
55
+ export class TabbedPanel {
56
+ id;
57
+ title;
58
+ content;
59
+ theme;
60
+ constructor({ panels, id = 'tabbed-widgets', title = 'Panels', tabListLayout = 'wrap', theme = 'inherit' }) {
61
+ this.id = id;
62
+ this.title = title;
63
+ this.theme = theme;
64
+ this.content = (_jsx(TabbedWidgetContainer, { panels: normalizePanelRecordPanels(panels), tabListLayout: tabListLayout }));
65
+ }
66
+ }
67
+ /**
68
+ * A wrapper panel that renders child panels in a vertical column.
69
+ */
70
+ export class ColumnPanel {
71
+ id;
72
+ title;
73
+ content;
74
+ theme;
75
+ constructor({ panels, id = 'column-widgets', title = 'Panels', theme = 'inherit' }) {
76
+ this.id = id;
77
+ this.title = title;
78
+ this.theme = theme;
79
+ this.content = _jsx(ColumnWidgetContainer, { panels: normalizePanelRecordPanels(panels) });
80
+ }
81
+ }
82
+ /**
83
+ * A wrapper panel that renders imperative HTML content into a managed host element.
84
+ */
85
+ export class CustomPanel {
86
+ id;
87
+ title;
88
+ content;
89
+ theme;
90
+ disabled;
91
+ keepMounted;
92
+ constructor({ id, title, onRenderHTML, disabled, keepMounted, className, theme = 'inherit' }) {
93
+ this.id = id;
94
+ this.title = title;
95
+ this.theme = theme;
96
+ this.disabled = disabled;
97
+ this.keepMounted = keepMounted;
98
+ this.content = _jsx(CustomPanelContent, { className: className, onRenderHTML: onRenderHTML });
99
+ }
100
+ }
101
+ /**
102
+ * A wrapper panel that renders a minimal built-in Markdown subset without external parsers.
103
+ */
104
+ export class MarkdownPanel {
105
+ id;
106
+ title;
107
+ content;
108
+ theme;
109
+ disabled;
110
+ keepMounted;
111
+ constructor({ id, title, markdown, disabled, keepMounted, className, theme = 'inherit' }) {
112
+ this.id = id;
113
+ this.title = title;
114
+ this.theme = theme;
115
+ this.disabled = disabled;
116
+ this.keepMounted = keepMounted;
117
+ this.content = (_jsx("div", { className: className, style: MARKDOWN_PANEL_STYLE, children: renderMarkdownBlocks(markdown) }));
118
+ }
119
+ }
120
+ /**
121
+ * Builds a direct-content container for modal-style and sidebar panel shorthands.
122
+ */
123
+ export function asPanelContainer(panel) {
124
+ return {
125
+ kind: 'panel',
126
+ props: {
127
+ panel
128
+ }
129
+ };
130
+ }
131
+ /**
132
+ * Renders an accordion-style widget panel stack.
133
+ */
134
+ export function AccordeonWidgetContainer({ panels, className, defaultExpandedPanelIds = [], expandedPanelIds, onExpandedPanelIdsChange, allowMultipleExpanded = true }) {
135
+ const [currentExpandedPanelIds, setCurrentExpandedPanelIds] = useControlledStringListState(expandedPanelIds, defaultExpandedPanelIds);
136
+ const expandedPanelIdSet = useMemo(() => new Set(currentExpandedPanelIds), [currentExpandedPanelIds]);
137
+ const effectivePanels = useMemo(() => [...panels], [panels]);
138
+ const handleTogglePanel = useCallback((panelId) => {
139
+ const nextPanelIds = new Set(allowMultipleExpanded ? currentExpandedPanelIds : []);
140
+ if (nextPanelIds.has(panelId)) {
141
+ nextPanelIds.delete(panelId);
142
+ }
143
+ else {
144
+ if (!allowMultipleExpanded) {
145
+ nextPanelIds.clear();
146
+ }
147
+ nextPanelIds.add(panelId);
148
+ }
149
+ const next = [...nextPanelIds];
150
+ setCurrentExpandedPanelIds(next);
151
+ onExpandedPanelIdsChange?.(next);
152
+ }, [allowMultipleExpanded, currentExpandedPanelIds, onExpandedPanelIdsChange]);
153
+ return (_jsx("div", { className: className, style: ACCORDEON_CONTAINER_STYLE, children: effectivePanels.map((panel) => {
154
+ const isExpanded = expandedPanelIdSet.has(panel.id);
155
+ const shouldRenderContent = panel.keepMounted || isExpanded;
156
+ return (_jsxs("section", { style: ACCORDION_PANEL_STYLE, children: [_jsxs("button", { type: "button", style: {
157
+ ...ACCORDION_HEADING_STYLE,
158
+ cursor: panel.disabled ? 'not-allowed' : 'pointer',
159
+ opacity: panel.disabled ? 0.55 : 1
160
+ }, disabled: panel.disabled, onPointerDown: (event) => {
161
+ if (panel.disabled) {
162
+ event.stopPropagation();
163
+ return;
164
+ }
165
+ event.preventDefault();
166
+ handleTogglePanel(panel.id);
167
+ }, children: [_jsx("span", { children: panel.title }), _jsx("span", { style: {
168
+ transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
169
+ transition: 'transform 160ms ease'
170
+ }, children: "\u25B8" })] }), _jsx("div", { style: {
171
+ ...ACCORDION_CONTENT_STYLE,
172
+ display: isExpanded ? 'block' : 'none'
173
+ }, children: shouldRenderContent ? (_jsx(WidgetPanelThemeScope, { panel: panel, children: panel.content })) : null })] }, panel.id));
174
+ }) }));
175
+ }
176
+ /**
177
+ * Renders a tabbed widget panel switcher.
178
+ */
179
+ export function TabbedWidgetContainer({ panels, className, defaultActivePanelId, activePanelId, onActivePanelIdChange, tabListLayout = 'wrap' }) {
180
+ const [currentActivePanelId, setCurrentActivePanelId] = useControlledStringState(activePanelId, defaultActivePanelId);
181
+ const enabledPanels = useMemo(() => panels.filter((panel) => !panel.disabled), [panels]);
182
+ const initialActivePanelId = useMemo(() => {
183
+ const isActivePanelEnabled = currentActivePanelId
184
+ ? enabledPanels.some((panel) => panel.id === currentActivePanelId)
185
+ : false;
186
+ return isActivePanelEnabled ? currentActivePanelId : enabledPanels[0]?.id;
187
+ }, [currentActivePanelId, enabledPanels]);
188
+ useEffect(() => {
189
+ const shouldSyncActivePanel = currentActivePanelId !== initialActivePanelId;
190
+ if (!shouldSyncActivePanel || !initialActivePanelId) {
191
+ return;
192
+ }
193
+ setCurrentActivePanelId(initialActivePanelId);
194
+ onActivePanelIdChange?.(initialActivePanelId);
195
+ }, [currentActivePanelId, initialActivePanelId, onActivePanelIdChange, setCurrentActivePanelId]);
196
+ return (_jsxs("div", { className: className, style: TABBED_CONTAINER_STYLE, children: [_jsx("div", { "data-widget-tabs": "", style: getTabListStyle(tabListLayout), children: panels.map((panel) => {
197
+ const isActive = panel.id === initialActivePanelId;
198
+ return (_jsx("button", { type: "button", style: {
199
+ ...TAB_BUTTON_STYLE,
200
+ opacity: panel.disabled ? 0.55 : 1,
201
+ backgroundColor: isActive
202
+ ? 'var(--button-background, rgba(255, 255, 255, 0.96))'
203
+ : 'transparent',
204
+ borderColor: isActive
205
+ ? 'var(--menu-border, rgba(148, 163, 184, 0.35))'
206
+ : 'transparent',
207
+ color: isActive
208
+ ? 'var(--button-text, rgb(24, 24, 26))'
209
+ : 'var(--button-icon-idle, rgb(71, 85, 105))',
210
+ boxShadow: isActive ? '0 1px 2px rgba(15, 23, 42, 0.08)' : 'none'
211
+ }, disabled: panel.disabled, onPointerDown: (event) => {
212
+ if (panel.disabled) {
213
+ event.stopPropagation();
214
+ return;
215
+ }
216
+ event.preventDefault();
217
+ setCurrentActivePanelId(panel.id);
218
+ onActivePanelIdChange?.(panel.id);
219
+ }, children: panel.title }, panel.id));
220
+ }) }), _jsx("div", { style: TAB_PANEL_STYLE, children: panels.map((panel) => {
221
+ const isActive = panel.id === initialActivePanelId;
222
+ return (_jsx("div", { "aria-hidden": !isActive, style: {
223
+ ...TAB_PANEL_CONTENT_STYLE,
224
+ visibility: isActive ? 'visible' : 'hidden',
225
+ pointerEvents: isActive ? 'auto' : 'none'
226
+ }, children: _jsx(WidgetPanelThemeScope, { panel: panel, children: panel.content }) }, panel.id));
227
+ }) })] }));
228
+ }
229
+ /**
230
+ * Renders child panels in a simple vertical column.
231
+ */
232
+ export function ColumnWidgetContainer({ panels, className }) {
233
+ const effectivePanels = useMemo(() => [...panels], [panels]);
234
+ return (_jsx("div", { className: className, style: COLUMN_CONTAINER_STYLE, children: effectivePanels.map((panel, panelIndex) => (_jsxs("section", { style: {
235
+ ...COLUMN_PANEL_STYLE,
236
+ borderTop: panelIndex > 0 ? '1px solid var(--menu-border, rgba(148, 163, 184, 0.25))' : 'none',
237
+ opacity: panel.disabled ? 0.55 : 1
238
+ }, children: [panel.title ? _jsx("header", { style: COLUMN_PANEL_HEADER_STYLE, children: panel.title }) : null, _jsx("div", { style: COLUMN_PANEL_CONTENT_STYLE, children: _jsx(WidgetPanelThemeScope, { panel: panel, children: panel.content }) })] }, panel.id))) }));
239
+ }
240
+ /**
241
+ * Renders the requested container based on descriptor kind.
242
+ */
243
+ export function WidgetContainerRenderer({ container }) {
244
+ if (container.kind === 'accordeon') {
245
+ return _jsx(AccordeonWidgetContainer, { ...container.props });
246
+ }
247
+ if (container.kind === 'panel') {
248
+ return (_jsx("div", { className: container.props.className, children: _jsx(WidgetPanelThemeScope, { panel: container.props.panel, children: container.props.panel.content }) }));
249
+ }
250
+ return _jsx(TabbedWidgetContainer, { ...container.props });
251
+ }
252
+ const PanelThemeModeContext = createContext(undefined);
253
+ /**
254
+ * Returns the effective light/dark theme mode for the current panel subtree.
255
+ */
256
+ export function useEffectiveWidgetPanelThemeMode() {
257
+ return useContext(PanelThemeModeContext) ?? 'light';
258
+ }
259
+ /**
260
+ * Applies a panel-level theme override and exposes the resolved mode to descendants.
261
+ */
262
+ function WidgetPanelThemeScope({ panel, children }) {
263
+ const inheritedMode = useContext(PanelThemeModeContext);
264
+ const hostElementRef = useRef(null);
265
+ const [rootMode, setRootMode] = useState('light');
266
+ const parentMode = inheritedMode ?? rootMode;
267
+ const resolvedMode = resolveWidgetPanelThemeMode(parentMode, panel.theme);
268
+ useLayoutEffect(() => {
269
+ if (!inheritedMode) {
270
+ const hostElement = hostElementRef.current;
271
+ if (!hostElement) {
272
+ return undefined;
273
+ }
274
+ const parentHostElement = hostElement.parentElement instanceof HTMLElement ? hostElement.parentElement : hostElement;
275
+ const updateRootMode = () => {
276
+ const inferredMode = inferWidgetPanelThemeMode(parentHostElement);
277
+ setRootMode((previousMode) => previousMode === inferredMode ? previousMode : inferredMode);
278
+ };
279
+ updateRootMode();
280
+ const themedContainer = parentHostElement.closest('.deck-widget-container');
281
+ const mutationObserver = new MutationObserver(() => {
282
+ updateRootMode();
283
+ });
284
+ mutationObserver.observe(parentHostElement, {
285
+ attributes: true,
286
+ attributeFilter: ['style', 'class']
287
+ });
288
+ if (themedContainer && themedContainer !== parentHostElement) {
289
+ mutationObserver.observe(themedContainer, {
290
+ attributes: true,
291
+ attributeFilter: ['style', 'class']
292
+ });
293
+ }
294
+ return () => {
295
+ mutationObserver.disconnect();
296
+ };
297
+ }
298
+ return undefined;
299
+ }, [inheritedMode]);
300
+ return (_jsx(PanelThemeModeContext.Provider, { value: resolvedMode, children: _jsx("div", { ref: hostElementRef, "data-panel-theme-mode": resolvedMode, style: getWidgetPanelThemeScopeStyle(resolvedMode), children: children }) }));
301
+ }
302
+ /**
303
+ * Resolves one local panel theme override against its parent effective mode.
304
+ */
305
+ function resolveWidgetPanelThemeMode(parentMode, theme) {
306
+ if (theme === 'dark') {
307
+ return 'dark';
308
+ }
309
+ if (theme === 'light') {
310
+ return 'light';
311
+ }
312
+ if (theme === 'invert') {
313
+ return parentMode === 'dark' ? 'light' : 'dark';
314
+ }
315
+ return parentMode;
316
+ }
317
+ /**
318
+ * Builds the inline CSS variable scope for one resolved panel theme mode.
319
+ */
320
+ function getWidgetPanelThemeScopeStyle(mode) {
321
+ const themeVariables = mode === 'dark' ? DarkTheme : LightTheme;
322
+ return { ...themeVariables };
323
+ }
324
+ /**
325
+ * Infers the surrounding widget theme mode from resolved CSS variables.
326
+ */
327
+ function inferWidgetPanelThemeMode(hostElement) {
328
+ const ownerWindow = hostElement.ownerDocument.defaultView;
329
+ if (!ownerWindow) {
330
+ return 'light';
331
+ }
332
+ const computedStyle = ownerWindow.getComputedStyle(hostElement);
333
+ const menuBackground = computedStyle.getPropertyValue('--menu-background').trim();
334
+ const parsedColor = parseThemeColor(menuBackground);
335
+ if (!parsedColor) {
336
+ return 'light';
337
+ }
338
+ return getRelativeLuminance(parsedColor) < 0.5 ? 'dark' : 'light';
339
+ }
340
+ /**
341
+ * Parses a CSS rgb/rgba/hex color string into numeric channels.
342
+ */
343
+ function parseThemeColor(value) {
344
+ if (!value) {
345
+ return null;
346
+ }
347
+ if (value.startsWith('#')) {
348
+ const hex = value.slice(1);
349
+ if (hex.length === 3) {
350
+ return [
351
+ parseInt(hex[0] + hex[0], 16),
352
+ parseInt(hex[1] + hex[1], 16),
353
+ parseInt(hex[2] + hex[2], 16)
354
+ ];
355
+ }
356
+ if (hex.length >= 6) {
357
+ return [
358
+ parseInt(hex.slice(0, 2), 16),
359
+ parseInt(hex.slice(2, 4), 16),
360
+ parseInt(hex.slice(4, 6), 16)
361
+ ];
362
+ }
363
+ return null;
364
+ }
365
+ const channelMatches = value.match(/[\d.]+/g);
366
+ if (!channelMatches || channelMatches.length < 3) {
367
+ return null;
368
+ }
369
+ return [Number(channelMatches[0]), Number(channelMatches[1]), Number(channelMatches[2])];
370
+ }
371
+ /**
372
+ * Computes relative luminance for an RGB color.
373
+ */
374
+ function getRelativeLuminance([red, green, blue]) {
375
+ return (0.2126 * red + 0.7152 * green + 0.0722 * blue) / 255;
376
+ }
377
+ /**
378
+ * Keeps local string-state in sync with controlled/uncontrolled props.
379
+ */
380
+ function useControlledStringState(controlledValue, defaultValue) {
381
+ const [internalValue, setInternalValue] = useState(defaultValue);
382
+ const isControlled = controlledValue !== undefined;
383
+ const resolvedValue = isControlled ? controlledValue : internalValue;
384
+ useEffect(() => {
385
+ if (!isControlled) {
386
+ return;
387
+ }
388
+ setInternalValue(controlledValue);
389
+ }, [isControlled, controlledValue]);
390
+ const setValue = useCallback((next) => {
391
+ if (!isControlled) {
392
+ setInternalValue(next);
393
+ }
394
+ }, [isControlled]);
395
+ return [resolvedValue, setValue];
396
+ }
397
+ /**
398
+ * Renders a Markdown document into a safe built-in subset of block elements.
399
+ */
400
+ /* eslint-disable max-statements, no-continue */
401
+ function renderMarkdownBlocks(markdown) {
402
+ const normalizedMarkdown = markdown.replace(/\r\n?/g, '\n');
403
+ const lines = normalizedMarkdown.split('\n');
404
+ const blocks = [];
405
+ const paragraphLines = [];
406
+ const unorderedListItems = [];
407
+ const orderedListItems = [];
408
+ let fencedCodeLines;
409
+ let blockIndex = 0;
410
+ const flushParagraph = () => {
411
+ if (paragraphLines.length === 0) {
412
+ return;
413
+ }
414
+ const paragraphText = paragraphLines.join(' ');
415
+ const currentBlockKey = `paragraph-${blockIndex++}`;
416
+ blocks.push(_jsx("p", { style: MARKDOWN_PARAGRAPH_STYLE, children: renderInlineMarkdown(paragraphText, currentBlockKey) }, currentBlockKey));
417
+ paragraphLines.length = 0;
418
+ };
419
+ const flushUnorderedList = () => {
420
+ if (unorderedListItems.length === 0) {
421
+ return;
422
+ }
423
+ const currentBlockIndex = blockIndex++;
424
+ blocks.push(_jsx("ul", { style: MARKDOWN_LIST_STYLE, children: unorderedListItems.map((item, itemIndex) => (_jsx("li", { style: MARKDOWN_LIST_ITEM_STYLE, children: renderInlineMarkdown(item, `unordered-item-${currentBlockIndex}-${itemIndex}`) }, `unordered-item-${currentBlockIndex}-${itemIndex}`))) }, `unordered-list-${currentBlockIndex}`));
425
+ unorderedListItems.length = 0;
426
+ };
427
+ const flushOrderedList = () => {
428
+ if (orderedListItems.length === 0) {
429
+ return;
430
+ }
431
+ const currentBlockIndex = blockIndex++;
432
+ blocks.push(_jsx("ol", { style: MARKDOWN_LIST_STYLE, children: orderedListItems.map((item, itemIndex) => (_jsx("li", { style: MARKDOWN_LIST_ITEM_STYLE, children: renderInlineMarkdown(item, `ordered-item-${currentBlockIndex}-${itemIndex}`) }, `ordered-item-${currentBlockIndex}-${itemIndex}`))) }, `ordered-list-${currentBlockIndex}`));
433
+ orderedListItems.length = 0;
434
+ };
435
+ const flushFencedCodeBlock = () => {
436
+ if (fencedCodeLines === undefined) {
437
+ return;
438
+ }
439
+ blocks.push(_jsx("pre", { style: MARKDOWN_CODE_BLOCK_STYLE, children: _jsx("code", { children: fencedCodeLines.join('\n') }) }, `code-${blockIndex++}`));
440
+ fencedCodeLines = undefined;
441
+ };
442
+ for (const line of lines) {
443
+ const trimmedLine = line.trim();
444
+ if (fencedCodeLines !== undefined) {
445
+ if (trimmedLine.startsWith('```')) {
446
+ flushFencedCodeBlock();
447
+ }
448
+ else {
449
+ fencedCodeLines.push(line);
450
+ }
451
+ continue;
452
+ }
453
+ if (trimmedLine.startsWith('```')) {
454
+ flushParagraph();
455
+ flushUnorderedList();
456
+ flushOrderedList();
457
+ fencedCodeLines = [];
458
+ continue;
459
+ }
460
+ if (trimmedLine.length === 0) {
461
+ flushParagraph();
462
+ flushUnorderedList();
463
+ flushOrderedList();
464
+ continue;
465
+ }
466
+ const headingMatch = trimmedLine.match(/^(#{1,6})\s+(.+)$/);
467
+ if (headingMatch) {
468
+ flushParagraph();
469
+ flushUnorderedList();
470
+ flushOrderedList();
471
+ const headingLevel = headingMatch[1].length;
472
+ const headingText = headingMatch[2];
473
+ const HeadingTag = `h${headingLevel}`;
474
+ const currentBlockKey = `heading-${blockIndex++}`;
475
+ blocks.push(_jsx(HeadingTag, { style: getMarkdownHeadingStyle(headingLevel), children: renderInlineMarkdown(headingText, currentBlockKey) }, currentBlockKey));
476
+ continue;
477
+ }
478
+ const unorderedListMatch = trimmedLine.match(/^[-*]\s+(.+)$/);
479
+ if (unorderedListMatch) {
480
+ flushParagraph();
481
+ flushOrderedList();
482
+ unorderedListItems.push(unorderedListMatch[1]);
483
+ continue;
484
+ }
485
+ const orderedListMatch = trimmedLine.match(/^\d+\.\s+(.+)$/);
486
+ if (orderedListMatch) {
487
+ flushParagraph();
488
+ flushUnorderedList();
489
+ orderedListItems.push(orderedListMatch[1]);
490
+ continue;
491
+ }
492
+ paragraphLines.push(trimmedLine);
493
+ }
494
+ flushParagraph();
495
+ flushUnorderedList();
496
+ flushOrderedList();
497
+ flushFencedCodeBlock();
498
+ return blocks;
499
+ }
500
+ /**
501
+ * Renders a minimal inline Markdown subset into safe text and inline elements.
502
+ */
503
+ // eslint-disable-next-line complexity
504
+ function renderInlineMarkdown(source, keyPrefix) {
505
+ const inlineTokenPattern = /(\[([^\]]+)\]\(([^)\s]+)\)|`([^`]+)`|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*]+)\*|_([^_]+)_)/g;
506
+ const children = [];
507
+ let match;
508
+ let previousIndex = 0;
509
+ let tokenIndex = 0;
510
+ for (match = inlineTokenPattern.exec(source); match; match = inlineTokenPattern.exec(source)) {
511
+ if (match.index > previousIndex) {
512
+ children.push(source.slice(previousIndex, match.index));
513
+ }
514
+ if (match[2] !== undefined && match[3] !== undefined) {
515
+ children.push(_jsx("a", { href: match[3], target: "_blank", rel: "noreferrer", style: MARKDOWN_LINK_STYLE, children: match[2] }, `${keyPrefix}-link-${tokenIndex}`));
516
+ }
517
+ else if (match[4] !== undefined) {
518
+ children.push(_jsx("code", { style: MARKDOWN_INLINE_CODE_STYLE, children: match[4] }, `${keyPrefix}-code-${tokenIndex}`));
519
+ }
520
+ else if (match[5] !== undefined || match[6] !== undefined) {
521
+ children.push(_jsx("strong", { children: match[5] ?? match[6] }, `${keyPrefix}-strong-${tokenIndex}`));
522
+ }
523
+ else if (match[7] !== undefined || match[8] !== undefined) {
524
+ children.push(_jsx("em", { children: match[7] ?? match[8] }, `${keyPrefix}-em-${tokenIndex}`));
525
+ }
526
+ previousIndex = match.index + match[0].length;
527
+ tokenIndex += 1;
528
+ }
529
+ if (previousIndex < source.length) {
530
+ children.push(source.slice(previousIndex));
531
+ }
532
+ if (children.length === 0) {
533
+ return [source];
534
+ }
535
+ return children;
536
+ }
537
+ /* eslint-enable max-statements, no-continue */
538
+ /**
539
+ * Returns the heading style for one Markdown heading level.
540
+ */
541
+ function getMarkdownHeadingStyle(level) {
542
+ if (level === 1) {
543
+ return MARKDOWN_HEADING_1_STYLE;
544
+ }
545
+ if (level === 2) {
546
+ return MARKDOWN_HEADING_2_STYLE;
547
+ }
548
+ if (level === 3) {
549
+ return MARKDOWN_HEADING_3_STYLE;
550
+ }
551
+ return MARKDOWN_HEADING_4_TO_6_STYLE;
552
+ }
553
+ /**
554
+ * Normalizes panel id collections for deterministic membership checks and stable state.
555
+ */
556
+ function normalizePanelIds(values) {
557
+ if (!values || values.length === 0) {
558
+ return [];
559
+ }
560
+ const deduped = [];
561
+ const seen = new Set();
562
+ for (const value of values) {
563
+ const trimmed = String(value);
564
+ if (!seen.has(trimmed)) {
565
+ seen.add(trimmed);
566
+ deduped.push(trimmed);
567
+ }
568
+ }
569
+ return deduped;
570
+ }
571
+ /**
572
+ * Keeps local list state in sync with controlled/uncontrolled props.
573
+ */
574
+ function useControlledStringListState(controlledValue, defaultValue) {
575
+ const [internalValue, setInternalValue] = useState(() => normalizePanelIds(controlledValue ?? defaultValue));
576
+ const isControlled = controlledValue !== undefined;
577
+ const resolvedValue = isControlled ? normalizePanelIds(controlledValue) : internalValue;
578
+ useEffect(() => {
579
+ if (!isControlled) {
580
+ return;
581
+ }
582
+ setInternalValue(normalizePanelIds(controlledValue));
583
+ }, [isControlled, controlledValue]);
584
+ const setValue = useCallback((next) => {
585
+ if (!isControlled) {
586
+ setInternalValue(normalizePanelIds(next));
587
+ }
588
+ }, [isControlled]);
589
+ return [resolvedValue, setValue];
590
+ }
591
+ /**
592
+ * Shared accordion/tab layout styles.
593
+ */
594
+ const ACCORDEON_CONTAINER_STYLE = {
595
+ display: 'flex',
596
+ flexDirection: 'column',
597
+ gap: '8px'
598
+ };
599
+ const ACCORDION_PANEL_STYLE = {
600
+ border: 'var(--menu-border, 1px solid rgba(148, 163, 184, 0.35))',
601
+ borderRadius: 'var(--button-corner-radius, 8px)',
602
+ overflow: 'hidden'
603
+ };
604
+ const ACCORDION_HEADING_STYLE = {
605
+ width: '100%',
606
+ border: '0',
607
+ margin: '0',
608
+ padding: '10px 12px',
609
+ display: 'flex',
610
+ alignItems: 'center',
611
+ justifyContent: 'space-between',
612
+ gap: '8px',
613
+ backgroundColor: 'var(--menu-background, #fff)',
614
+ color: 'var(--menu-text, rgb(24, 24, 26))',
615
+ fontSize: '12px',
616
+ lineHeight: 1.2,
617
+ fontWeight: 700
618
+ };
619
+ const ACCORDION_CONTENT_STYLE = {
620
+ padding: '8px 10px 10px 12px',
621
+ borderTop: 'var(--menu-divider, var(--menu-border, 1px solid rgba(148, 163, 184, 0.25)))',
622
+ backgroundColor: 'var(--menu-background, #fff)',
623
+ color: 'var(--menu-text, rgb(24, 24, 26))'
624
+ };
625
+ const TABBED_CONTAINER_STYLE = {
626
+ display: 'flex',
627
+ flexDirection: 'column',
628
+ minWidth: '220px',
629
+ border: 'var(--menu-border, 1px solid rgba(148, 163, 184, 0.35))',
630
+ borderRadius: 'var(--button-corner-radius, 8px)',
631
+ overflow: 'hidden',
632
+ backgroundColor: 'var(--menu-background, #fff)',
633
+ color: 'var(--menu-text, rgb(24, 24, 26))'
634
+ };
635
+ function getTabListStyle(tabListLayout) {
636
+ return {
637
+ display: 'flex',
638
+ alignItems: 'flex-start',
639
+ flexWrap: tabListLayout === 'wrap' ? 'wrap' : 'nowrap',
640
+ gap: '4px',
641
+ overflowX: tabListLayout === 'scroll' ? 'auto' : 'hidden',
642
+ overflowY: 'hidden',
643
+ background: 'var(--menu-weak-background, var(--button-background, var(--menu-background, #fff)))',
644
+ padding: '4px 6px',
645
+ borderBottom: 'var(--menu-divider, var(--menu-border, 1px solid rgba(148, 163, 184, 0.2)))',
646
+ position: 'sticky',
647
+ top: 0,
648
+ zIndex: 1
649
+ };
650
+ }
651
+ const TAB_BUTTON_STYLE = {
652
+ flex: '0 0 auto',
653
+ border: '1px solid transparent',
654
+ borderRadius: '4px',
655
+ margin: 0,
656
+ padding: '4px 8px',
657
+ fontSize: '12px',
658
+ fontWeight: 600,
659
+ lineHeight: 1.25,
660
+ cursor: 'pointer',
661
+ color: 'var(--menu-text, rgb(24, 24, 26))',
662
+ backgroundColor: 'rgba(255, 255, 255, 0.35)',
663
+ whiteSpace: 'nowrap',
664
+ transition: 'background-color 120ms ease, border-color 120ms ease, color 120ms ease'
665
+ };
666
+ const TAB_PANEL_STYLE = {
667
+ display: 'grid',
668
+ alignItems: 'start',
669
+ padding: '10px',
670
+ overflow: 'auto'
671
+ };
672
+ const TAB_PANEL_CONTENT_STYLE = {
673
+ gridArea: '1 / 1',
674
+ minWidth: 0
675
+ };
676
+ const COLUMN_CONTAINER_STYLE = {
677
+ display: 'grid',
678
+ gap: '0'
679
+ };
680
+ const COLUMN_PANEL_STYLE = {
681
+ display: 'grid',
682
+ gap: '10px',
683
+ padding: '12px 0'
684
+ };
685
+ const COLUMN_PANEL_HEADER_STYLE = {
686
+ fontSize: '12px',
687
+ fontWeight: 700,
688
+ color: 'var(--button-text, currentColor)',
689
+ padding: '0 2px'
690
+ };
691
+ const COLUMN_PANEL_CONTENT_STYLE = {
692
+ minWidth: 0
693
+ };
694
+ const MARKDOWN_PANEL_STYLE = {
695
+ display: 'flex',
696
+ flexDirection: 'column',
697
+ gap: '12px',
698
+ color: 'var(--menu-text, rgb(24, 24, 26))',
699
+ fontSize: '13px',
700
+ lineHeight: '1.5'
701
+ };
702
+ const MARKDOWN_PARAGRAPH_STYLE = {
703
+ margin: '0'
704
+ };
705
+ const MARKDOWN_LIST_STYLE = {
706
+ margin: '0',
707
+ paddingLeft: '18px',
708
+ display: 'flex',
709
+ flexDirection: 'column',
710
+ gap: '6px'
711
+ };
712
+ const MARKDOWN_LIST_ITEM_STYLE = {
713
+ margin: '0'
714
+ };
715
+ const MARKDOWN_CODE_BLOCK_STYLE = {
716
+ margin: '0',
717
+ padding: '10px 12px',
718
+ borderRadius: '8px',
719
+ overflowX: 'auto',
720
+ background: 'var(--menu-weak-background, var(--button-background, var(--menu-background, #fff)))',
721
+ border: '1px solid var(--menu-border, rgba(148, 163, 184, 0.2))',
722
+ color: 'var(--menu-text, rgb(24, 24, 26))',
723
+ fontSize: '12px',
724
+ lineHeight: '1.45'
725
+ };
726
+ const MARKDOWN_INLINE_CODE_STYLE = {
727
+ padding: '1px 5px',
728
+ borderRadius: '4px',
729
+ background: 'var(--menu-weak-background, var(--button-background, var(--menu-background, #fff)))',
730
+ border: '1px solid var(--menu-border, rgba(148, 163, 184, 0.2))',
731
+ color: 'var(--menu-text, rgb(24, 24, 26))',
732
+ fontSize: '12px'
733
+ };
734
+ const MARKDOWN_LINK_STYLE = {
735
+ color: 'var(--button-text, rgb(29, 78, 216))'
736
+ };
737
+ const MARKDOWN_HEADING_1_STYLE = {
738
+ margin: '0',
739
+ fontSize: '20px',
740
+ fontWeight: 700,
741
+ lineHeight: '1.25'
742
+ };
743
+ const MARKDOWN_HEADING_2_STYLE = {
744
+ margin: '0',
745
+ fontSize: '17px',
746
+ fontWeight: 700,
747
+ lineHeight: '1.3'
748
+ };
749
+ const MARKDOWN_HEADING_3_STYLE = {
750
+ margin: '0',
751
+ fontSize: '15px',
752
+ fontWeight: 700,
753
+ lineHeight: '1.35'
754
+ };
755
+ const MARKDOWN_HEADING_4_TO_6_STYLE = {
756
+ margin: '0',
757
+ fontSize: '13px',
758
+ fontWeight: 700,
759
+ lineHeight: '1.4'
760
+ };
761
+ //# sourceMappingURL=widget-containers.js.map