@g9tm/lynxcontrols 2.5.6 → 2.5.8

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 (337) hide show
  1. package/catalog/cards/G9AppBar.md +1 -1
  2. package/catalog/cards/G9AppearancePage.md +17 -0
  3. package/catalog/cards/G9Badge.md +1 -1
  4. package/catalog/cards/G9Button.md +2 -2
  5. package/catalog/cards/G9Card.md +1 -1
  6. package/catalog/cards/G9CarryContexts.md +10 -0
  7. package/catalog/cards/G9CheckBox.md +1 -1
  8. package/catalog/cards/G9Chip.md +1 -1
  9. package/catalog/cards/G9ChipStrip.md +16 -0
  10. package/catalog/cards/G9CodeBlock.md +17 -0
  11. package/catalog/cards/G9CommandPalette.md +3 -1
  12. package/catalog/cards/G9ConnectionBanner.md +1 -1
  13. package/catalog/cards/G9ContrastPanel.md +15 -0
  14. package/catalog/cards/G9DashboardCustomizeSheet.md +17 -0
  15. package/catalog/cards/G9DashboardGrid.md +17 -0
  16. package/catalog/cards/G9DragList.md +4 -2
  17. package/catalog/cards/G9Editor.md +1 -1
  18. package/catalog/cards/G9ErrorBoundary.md +3 -2
  19. package/catalog/cards/G9FormField.md +2 -2
  20. package/catalog/cards/G9ListRow.md +1 -1
  21. package/catalog/cards/G9Menu.md +1 -1
  22. package/catalog/cards/G9MenuList.md +2 -0
  23. package/catalog/cards/G9NotificationCenter.md +17 -0
  24. package/catalog/cards/G9NotificationCenterPanel.md +17 -0
  25. package/catalog/cards/G9PathNavigator.md +13 -0
  26. package/catalog/cards/G9PersonalThemeSheet.md +17 -0
  27. package/catalog/cards/G9Popover.md +1 -1
  28. package/catalog/cards/G9Provider.md +1 -1
  29. package/catalog/cards/G9RangeSlider.md +2 -2
  30. package/catalog/cards/G9ReaderSheet.md +17 -0
  31. package/catalog/cards/G9ReaderView.md +17 -0
  32. package/catalog/cards/G9SafeButton.md +2 -2
  33. package/catalog/cards/G9SearchEntry.md +1 -1
  34. package/catalog/cards/G9SecretValue.md +17 -0
  35. package/catalog/cards/G9ShortcutList.md +4 -0
  36. package/catalog/cards/G9ShortcutsSheet.md +3 -1
  37. package/catalog/cards/G9StatusPill.md +1 -1
  38. package/catalog/cards/G9Stepper.md +1 -1
  39. package/catalog/cards/G9SwitchRow.md +1 -1
  40. package/catalog/cards/G9Tag.md +1 -1
  41. package/catalog/cards/G9TextEntry.md +1 -1
  42. package/catalog/cards/G9UpdateBar.md +2 -1
  43. package/catalog/cards/G9VirtualList.md +1 -1
  44. package/catalog/cards/G9WallpaperSwatch.md +16 -0
  45. package/catalog/cards/G9WidgetSkeleton.md +9 -0
  46. package/catalog/cards/G9WidgetSlot.md +13 -0
  47. package/catalog/cards/PopupFrame.md +2 -2
  48. package/catalog/catalog.json +9460 -2155
  49. package/catalog/index.md +20 -3
  50. package/dist/.tsbuildinfo +1 -1
  51. package/dist/appearance/appearance.css +264 -0
  52. package/dist/appearance/appearance.css.map +1 -0
  53. package/dist/appearance/appearance.d.ts +148 -0
  54. package/dist/appearance/appearance.d.ts.map +1 -0
  55. package/dist/appearance/appearance.jsx +604 -0
  56. package/dist/appearance/index.d.ts +2 -0
  57. package/dist/appearance/index.d.ts.map +1 -0
  58. package/dist/appearance/index.jsx +1 -0
  59. package/dist/base/control.d.ts +15 -0
  60. package/dist/base/control.d.ts.map +1 -1
  61. package/dist/base/control.jsx +13 -1
  62. package/dist/base/index.d.ts +1 -1
  63. package/dist/base/index.d.ts.map +1 -1
  64. package/dist/base/index.jsx +1 -1
  65. package/dist/base/selection-item.d.ts +5 -0
  66. package/dist/base/selection-item.d.ts.map +1 -1
  67. package/dist/button/button.css +4 -0
  68. package/dist/button/button.css.map +1 -1
  69. package/dist/cascade/cascade.css +2 -0
  70. package/dist/cascade/cascade.css.map +1 -1
  71. package/dist/commands/commands.css +46 -0
  72. package/dist/commands/commands.css.map +1 -1
  73. package/dist/commands/index.d.ts +2 -2
  74. package/dist/commands/index.d.ts.map +1 -1
  75. package/dist/commands/index.jsx +2 -2
  76. package/dist/commands/keys.d.ts +15 -1
  77. package/dist/commands/keys.d.ts.map +1 -1
  78. package/dist/commands/keys.jsx +20 -1
  79. package/dist/commands/palette.d.ts +73 -7
  80. package/dist/commands/palette.d.ts.map +1 -1
  81. package/dist/commands/palette.jsx +174 -20
  82. package/dist/dashboard/dashboard.css +101 -0
  83. package/dist/dashboard/dashboard.css.map +1 -0
  84. package/dist/dashboard/dashboard.d.ts +73 -0
  85. package/dist/dashboard/dashboard.d.ts.map +1 -0
  86. package/dist/dashboard/dashboard.jsx +297 -0
  87. package/dist/dashboard/index.d.ts +3 -0
  88. package/dist/dashboard/index.d.ts.map +1 -0
  89. package/dist/dashboard/index.jsx +2 -0
  90. package/dist/dashboard/model.d.ts +53 -0
  91. package/dist/dashboard/model.d.ts.map +1 -0
  92. package/dist/dashboard/model.jsx +76 -0
  93. package/dist/display/code.css +109 -0
  94. package/dist/display/code.css.map +1 -0
  95. package/dist/display/code.d.ts +43 -0
  96. package/dist/display/code.d.ts.map +1 -0
  97. package/dist/display/code.jsx +101 -0
  98. package/dist/display/extras.d.ts +7 -2
  99. package/dist/display/extras.d.ts.map +1 -1
  100. package/dist/display/extras.jsx +13 -4
  101. package/dist/display/figures.d.ts.map +1 -1
  102. package/dist/display/figures.jsx +10 -2
  103. package/dist/display/index.d.ts +1 -0
  104. package/dist/display/index.d.ts.map +1 -1
  105. package/dist/display/index.jsx +1 -0
  106. package/dist/display/motion-figures.css +2 -0
  107. package/dist/display/motion-figures.css.map +1 -1
  108. package/dist/display/motion-figures.d.ts.map +1 -1
  109. package/dist/display/motion-figures.jsx +14 -7
  110. package/dist/display/status.d.ts +1 -1
  111. package/dist/display/status.d.ts.map +1 -1
  112. package/dist/display/status.jsx +15 -3
  113. package/dist/display/theme-preview.css +4 -0
  114. package/dist/display/theme-preview.css.map +1 -1
  115. package/dist/effects/effects.d.ts.map +1 -1
  116. package/dist/effects/effects.jsx +8 -1
  117. package/dist/fields/extra-entries.css +1 -0
  118. package/dist/fields/extra-entries.css.map +1 -1
  119. package/dist/fields/extra-entries.d.ts +4 -1
  120. package/dist/fields/extra-entries.d.ts.map +1 -1
  121. package/dist/fields/extra-entries.jsx +54 -19
  122. package/dist/fields/fields.css +21 -0
  123. package/dist/fields/fields.css.map +1 -1
  124. package/dist/fields/outlined-field.d.ts +9 -0
  125. package/dist/fields/outlined-field.d.ts.map +1 -1
  126. package/dist/fields/outlined-field.jsx +6 -1
  127. package/dist/fields/pin-entry.d.ts.map +1 -1
  128. package/dist/fields/pin-entry.jsx +36 -3
  129. package/dist/fields/text-entry.d.ts +4 -0
  130. package/dist/fields/text-entry.d.ts.map +1 -1
  131. package/dist/fields/text-entry.jsx +32 -25
  132. package/dist/fields/use-text-input.d.ts +3 -2
  133. package/dist/fields/use-text-input.d.ts.map +1 -1
  134. package/dist/fields/use-text-input.jsx +3 -0
  135. package/dist/header/app-bar.d.ts +6 -0
  136. package/dist/header/app-bar.d.ts.map +1 -1
  137. package/dist/header/app-bar.jsx +22 -8
  138. package/dist/header/header.css +14 -0
  139. package/dist/header/header.css.map +1 -1
  140. package/dist/host/bottom-overlays.d.ts +5 -0
  141. package/dist/host/bottom-overlays.d.ts.map +1 -1
  142. package/dist/host/bottom-overlays.jsx +17 -1
  143. package/dist/host/carry-contexts.d.ts +28 -0
  144. package/dist/host/carry-contexts.d.ts.map +1 -0
  145. package/dist/host/carry-contexts.jsx +76 -0
  146. package/dist/host/host.d.ts.map +1 -1
  147. package/dist/host/host.jsx +5 -1
  148. package/dist/host/index.d.ts +2 -0
  149. package/dist/host/index.d.ts.map +1 -1
  150. package/dist/host/index.jsx +2 -0
  151. package/dist/icon/icon.d.ts.map +1 -1
  152. package/dist/icon/icon.jsx +13 -9
  153. package/dist/index.d.ts +4 -0
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/layout/containers.d.ts.map +1 -1
  156. package/dist/layout/containers.jsx +2 -1
  157. package/dist/layout/layout.css +7 -0
  158. package/dist/layout/layout.css.map +1 -1
  159. package/dist/list/gestures.d.ts +39 -6
  160. package/dist/list/gestures.d.ts.map +1 -1
  161. package/dist/list/gestures.jsx +284 -89
  162. package/dist/list/index.d.ts +3 -2
  163. package/dist/list/index.d.ts.map +1 -1
  164. package/dist/list/index.jsx +2 -1
  165. package/dist/list/keyboard.d.ts +50 -0
  166. package/dist/list/keyboard.d.ts.map +1 -0
  167. package/dist/list/keyboard.jsx +117 -0
  168. package/dist/list/list.css +50 -5
  169. package/dist/list/list.css.map +1 -1
  170. package/dist/list/rows.d.ts +13 -1
  171. package/dist/list/rows.d.ts.map +1 -1
  172. package/dist/list/rows.jsx +42 -23
  173. package/dist/list/virtual-list.d.ts +27 -1
  174. package/dist/list/virtual-list.d.ts.map +1 -1
  175. package/dist/list/virtual-list.jsx +49 -4
  176. package/dist/notifications/index.d.ts +3 -0
  177. package/dist/notifications/index.d.ts.map +1 -0
  178. package/dist/notifications/index.jsx +2 -0
  179. package/dist/notifications/model.d.ts +47 -0
  180. package/dist/notifications/model.d.ts.map +1 -0
  181. package/dist/notifications/model.jsx +51 -0
  182. package/dist/notifications/notification-center.d.ts +98 -0
  183. package/dist/notifications/notification-center.d.ts.map +1 -0
  184. package/dist/notifications/notification-center.jsx +424 -0
  185. package/dist/notifications/notifications.css +266 -0
  186. package/dist/notifications/notifications.css.map +1 -0
  187. package/dist/orb/orb.css +2 -0
  188. package/dist/orb/orb.css.map +1 -1
  189. package/dist/pickers/pickers.css +15 -0
  190. package/dist/pickers/pickers.css.map +1 -1
  191. package/dist/plus-button/plus-button.css +2 -0
  192. package/dist/plus-button/plus-button.css.map +1 -1
  193. package/dist/plus-button/plus-button.d.ts.map +1 -1
  194. package/dist/plus-button/plus-button.jsx +2 -1
  195. package/dist/popover/popover.css +23 -1
  196. package/dist/popover/popover.css.map +1 -1
  197. package/dist/popover/popover.d.ts +14 -0
  198. package/dist/popover/popover.d.ts.map +1 -1
  199. package/dist/popover/popover.jsx +73 -12
  200. package/dist/popover/position.d.ts +6 -2
  201. package/dist/popover/position.d.ts.map +1 -1
  202. package/dist/popover/position.jsx +15 -4
  203. package/dist/popup/popup.css +3 -0
  204. package/dist/popup/popup.css.map +1 -1
  205. package/dist/provider/direction-scope.d.ts +8 -0
  206. package/dist/provider/direction-scope.d.ts.map +1 -1
  207. package/dist/provider/direction-scope.jsx +13 -2
  208. package/dist/provider/index.d.ts +1 -1
  209. package/dist/provider/index.d.ts.map +1 -1
  210. package/dist/provider/provider.css +7 -0
  211. package/dist/provider/provider.css.map +1 -1
  212. package/dist/provider/provider.d.ts +6 -1
  213. package/dist/provider/provider.d.ts.map +1 -1
  214. package/dist/provider/provider.jsx +22 -2
  215. package/dist/provider/settings.d.ts +14 -0
  216. package/dist/provider/settings.d.ts.map +1 -1
  217. package/dist/provider/settings.jsx +4 -1
  218. package/dist/range-slider/index.d.ts +1 -1
  219. package/dist/range-slider/index.d.ts.map +1 -1
  220. package/dist/range-slider/range-slider.css +69 -0
  221. package/dist/range-slider/range-slider.css.map +1 -1
  222. package/dist/range-slider/range-slider.d.ts +22 -0
  223. package/dist/range-slider/range-slider.d.ts.map +1 -1
  224. package/dist/range-slider/range-slider.jsx +34 -5
  225. package/dist/reader/index.d.ts +2 -0
  226. package/dist/reader/index.d.ts.map +1 -0
  227. package/dist/reader/index.jsx +1 -0
  228. package/dist/reader/reader.css +74 -0
  229. package/dist/reader/reader.css.map +1 -0
  230. package/dist/reader/reader.d.ts +76 -0
  231. package/dist/reader/reader.d.ts.map +1 -0
  232. package/dist/reader/reader.jsx +149 -0
  233. package/dist/route/index.d.ts +2 -0
  234. package/dist/route/index.d.ts.map +1 -1
  235. package/dist/route/index.jsx +2 -0
  236. package/dist/route/path-navigator.css +42 -0
  237. package/dist/route/path-navigator.css.map +1 -0
  238. package/dist/route/path-navigator.d.ts +25 -0
  239. package/dist/route/path-navigator.d.ts.map +1 -0
  240. package/dist/route/path-navigator.jsx +98 -0
  241. package/dist/route/path-router.d.ts +162 -0
  242. package/dist/route/path-router.d.ts.map +1 -0
  243. package/dist/route/path-router.jsx +327 -0
  244. package/dist/selection/selection-sheet.d.ts.map +1 -1
  245. package/dist/selection/selection-sheet.jsx +23 -10
  246. package/dist/selection/selection.css +18 -1
  247. package/dist/selection/selection.css.map +1 -1
  248. package/dist/sheet/frame.d.ts.map +1 -1
  249. package/dist/sheet/frame.jsx +9 -8
  250. package/dist/sheet/options.d.ts +6 -1
  251. package/dist/sheet/options.d.ts.map +1 -1
  252. package/dist/sheet/options.jsx +2 -1
  253. package/dist/sheet/panel-frame.d.ts.map +1 -1
  254. package/dist/sheet/panel-frame.jsx +5 -4
  255. package/dist/sheet/sizing.d.ts +3 -3
  256. package/dist/sheet/sizing.d.ts.map +1 -1
  257. package/dist/sheet/sizing.jsx +1 -0
  258. package/dist/shell/shell.css +18 -1
  259. package/dist/shell/shell.css.map +1 -1
  260. package/dist/shell/shell.d.ts +10 -1
  261. package/dist/shell/shell.d.ts.map +1 -1
  262. package/dist/shell/shell.jsx +13 -9
  263. package/dist/survey/survey.css +15 -0
  264. package/dist/survey/survey.css.map +1 -1
  265. package/dist/survey/survey.d.ts +6 -0
  266. package/dist/survey/survey.d.ts.map +1 -1
  267. package/dist/survey/survey.jsx +24 -6
  268. package/dist/swipe/swipe.css +2 -0
  269. package/dist/swipe/swipe.css.map +1 -1
  270. package/dist/tab-bar/flat.d.ts.map +1 -1
  271. package/dist/tab-bar/flat.jsx +53 -38
  272. package/dist/tab-bar/tab-bar.css +2 -0
  273. package/dist/tab-bar/tab-bar.css.map +1 -1
  274. package/dist/tab-bar/tab-bar.d.ts.map +1 -1
  275. package/dist/tab-bar/tab-bar.jsx +28 -6
  276. package/dist/tabs/tab-view.jsx +10 -3
  277. package/dist/tabs/tabs.css +5 -0
  278. package/dist/tabs/tabs.css.map +1 -1
  279. package/dist/toast/index.d.ts +1 -1
  280. package/dist/toast/index.d.ts.map +1 -1
  281. package/dist/toast/service.d.ts.map +1 -1
  282. package/dist/toast/service.jsx +18 -5
  283. package/dist/toast/store.d.ts +22 -0
  284. package/dist/toast/store.d.ts.map +1 -1
  285. package/dist/toast/store.jsx +35 -3
  286. package/dist/toast/toast.css +22 -0
  287. package/dist/toast/toast.css.map +1 -1
  288. package/dist/toggle/checkbox.d.ts +5 -0
  289. package/dist/toggle/checkbox.d.ts.map +1 -1
  290. package/dist/toggle/checkbox.jsx +7 -2
  291. package/dist/toggle/choice.css +35 -0
  292. package/dist/toggle/choice.css.map +1 -1
  293. package/dist/toggle/choice.d.ts +45 -0
  294. package/dist/toggle/choice.d.ts.map +1 -1
  295. package/dist/toggle/choice.jsx +97 -23
  296. package/dist/toggle/index.d.ts +1 -1
  297. package/dist/toggle/index.d.ts.map +1 -1
  298. package/dist/toggle/index.jsx +1 -1
  299. package/package.json +22 -2
  300. package/skills/g9-lynx-app/references/catalog-index.md +24 -8
  301. package/skills/g9-lynx-app/references/components/appearance.md +70 -0
  302. package/skills/g9-lynx-app/references/components/barcode.md +1 -1
  303. package/skills/g9-lynx-app/references/components/button.md +4 -4
  304. package/skills/g9-lynx-app/references/components/calendar-1.md +205 -0
  305. package/skills/g9-lynx-app/references/components/calendar-2.md +36 -0
  306. package/skills/g9-lynx-app/references/components/canvas.md +33 -0
  307. package/skills/g9-lynx-app/references/components/chat-1.md +199 -0
  308. package/skills/g9-lynx-app/references/components/chat-2.md +119 -0
  309. package/skills/g9-lynx-app/references/components/commands.md +10 -2
  310. package/skills/g9-lynx-app/references/components/commerce.md +1 -1
  311. package/skills/g9-lynx-app/references/components/dashboard.md +61 -0
  312. package/skills/g9-lynx-app/references/components/display-1.md +22 -21
  313. package/skills/g9-lynx-app/references/components/display-2.md +36 -39
  314. package/skills/g9-lynx-app/references/components/display-3.md +41 -2
  315. package/skills/g9-lynx-app/references/components/fields.md +5 -5
  316. package/skills/g9-lynx-app/references/components/header.md +1 -1
  317. package/skills/g9-lynx-app/references/components/host.md +11 -0
  318. package/skills/g9-lynx-app/references/components/layout-1.md +1 -1
  319. package/skills/g9-lynx-app/references/components/list.md +7 -5
  320. package/skills/g9-lynx-app/references/components/map.md +19 -1
  321. package/skills/g9-lynx-app/references/components/media-1.md +203 -0
  322. package/skills/g9-lynx-app/references/components/media-2.md +66 -0
  323. package/skills/g9-lynx-app/references/components/notifications.md +37 -0
  324. package/skills/g9-lynx-app/references/components/popover.md +4 -2
  325. package/skills/g9-lynx-app/references/components/popup.md +2 -2
  326. package/skills/g9-lynx-app/references/components/projects.md +73 -0
  327. package/skills/g9-lynx-app/references/components/provider.md +1 -1
  328. package/skills/g9-lynx-app/references/components/range-slider.md +2 -2
  329. package/skills/g9-lynx-app/references/components/reader.md +37 -0
  330. package/skills/g9-lynx-app/references/components/richtext.md +54 -0
  331. package/skills/g9-lynx-app/references/components/route.md +14 -0
  332. package/skills/g9-lynx-app/references/components/shell.md +3 -2
  333. package/skills/g9-lynx-app/references/components/toggle.md +20 -3
  334. package/skills/g9-lynx-app/references/provider-and-host.md +4 -3
  335. package/skills/g9-lynx-app/references/components/calendar.md +0 -128
  336. package/skills/g9-lynx-app/references/components/chat.md +0 -98
  337. package/skills/g9-lynx-app/references/components/media.md +0 -115
@@ -0,0 +1,297 @@
1
+ import { useEffect, useState } from "@lynx-js/react";
2
+ import { g9IdProps, g9SafeId } from "../base/control.jsx";
3
+ import { G9Button } from "../button/button.jsx";
4
+ import { G9IconButton } from "../button/icon-button.jsx";
5
+ import { G9ErrorBoundary } from "../display/extras.jsx";
6
+ import { G9Skeleton } from "../display/motion-figures.jsx";
7
+ import { G9DragList } from "../list/gestures.jsx";
8
+ import { useG9Direction, useG9Layout } from "../provider/hooks.jsx";
9
+ import { G9Sheet } from "../sheet/sheet.jsx";
10
+ import { G9Segmented } from "../toggle/choice.jsx";
11
+ import { G9Switch } from "../toggle/switch.jsx";
12
+ import { g9ArrangeWidgets, g9DashboardSegments, g9MoveWidget } from "./model.jsx";
13
+ import "./dashboard.css";
14
+ function G9WidgetSkeleton() {
15
+ return <view className="g9-dash__skeleton">
16
+ <G9Skeleton width="45%" height={14}/>
17
+ <G9Skeleton width="100%" height={12}/>
18
+ <G9Skeleton width="85%" height={12}/>
19
+ <G9Skeleton width="60%" height={12}/>
20
+ </view>;
21
+ }
22
+ function G9WidgetSlot(props) {
23
+ var _props_skeleton;
24
+ const { widget } = props;
25
+ const [loaded, setLoaded] = useState(void 0);
26
+ const [failure, setFailure] = useState({
27
+ error: null,
28
+ attempt: 0
29
+ });
30
+ useEffect(()=>{
31
+ if (widget.render || !widget.load) return;
32
+ let alive = true;
33
+ widget.load().then((module)=>{
34
+ const view1 = 'function' == typeof module ? module : module.default;
35
+ if (alive) setLoaded(()=>view1);
36
+ }, (error)=>{
37
+ var _props_onError;
38
+ null == (_props_onError = props.onError) || _props_onError.call(props, widget.id, error);
39
+ if (alive) {
40
+ setFailure((f)=>({
41
+ ...f,
42
+ error
43
+ }));
44
+ setLoaded(null);
45
+ }
46
+ });
47
+ return ()=>{
48
+ alive = false;
49
+ };
50
+ }, [
51
+ widget.id,
52
+ failure.attempt
53
+ ]);
54
+ const boundary = (child)=><G9ErrorBoundary resetKey={widget.id} onError={(error)=>{
55
+ var _props_onError;
56
+ return null == (_props_onError = props.onError) ? void 0 : _props_onError.call(props, widget.id, error);
57
+ }} fallback={props.fallback}>
58
+ {child}
59
+ </G9ErrorBoundary>;
60
+ if (widget.render) return boundary(<Rendered render={widget.render}/>);
61
+ if (void 0 === loaded) return widget.load ? null != (_props_skeleton = props.skeleton) ? _props_skeleton : <G9WidgetSkeleton/> : null;
62
+ if (null === loaded) {
63
+ const fallback = props.fallback;
64
+ const retry = ()=>{
65
+ setLoaded(void 0);
66
+ setFailure((f)=>({
67
+ error: null,
68
+ attempt: f.attempt + 1
69
+ }));
70
+ };
71
+ return 'function' == typeof fallback ? fallback(failure.error, retry) : null != fallback ? fallback : null;
72
+ }
73
+ const View = loaded;
74
+ return boundary(<View/>);
75
+ }
76
+ function Rendered(props) {
77
+ return props.render();
78
+ }
79
+ function G9DashboardGrid(props) {
80
+ var _props_gap, _props_empty;
81
+ const { wide } = useG9Layout();
82
+ const two = 2 === props.columns || 1 !== props.columns && wide;
83
+ const gap = null != (_props_gap = props.gap) ? _props_gap : 12;
84
+ const columnsRow = 'rtl' === useG9Direction() ? 'row-reverse' : 'row';
85
+ const { shown } = g9ArrangeWidgets(props.widgets, props.layout);
86
+ const card = (placed)=>{
87
+ const content = <G9WidgetSlot widget={placed.widget} {...props.skeleton ? {
88
+ skeleton: props.skeleton
89
+ } : {}} {...props.onWidgetError ? {
90
+ onError: props.onWidgetError
91
+ } : {}} {...void 0 !== props.fallback ? {
92
+ fallback: props.fallback
93
+ } : {}}/>;
94
+ return <view key={placed.widget.id} className={'full' === placed.size ? 'g9-dash__card g9-dash__card--full' : 'g9-dash__card'} {...g9IdProps(props.id ? `${props.id}_${g9SafeId(placed.widget.id)}` : null)}>
95
+ {props.renderCard ? props.renderCard(placed, content) : content}
96
+ </view>;
97
+ };
98
+ if (!shown.length) return <view className="g9-dash" {...g9IdProps(props.id)}>
99
+ {null != (_props_empty = props.empty) ? _props_empty : null}
100
+ </view>;
101
+ if (!two) return <view className="g9-dash" {...g9IdProps(props.id)} style={{
102
+ rowGap: `${gap}px`
103
+ }}>
104
+ {shown.map(card)}
105
+ </view>;
106
+ return <view className="g9-dash" {...g9IdProps(props.id)} style={{
107
+ rowGap: `${gap}px`
108
+ }}>
109
+ {g9DashboardSegments(shown).map((segment, i)=>'full' === segment.kind ? card(segment.item) : <view key={`run${i}`} className="g9-dash__columns" style={{
110
+ columnGap: `${gap}px`,
111
+ flexDirection: columnsRow,
112
+ direction: 'ltr'
113
+ }}>
114
+ {segment.columns.map((column, c)=><view key={`c${c}`} className="g9-dash__column" style={{
115
+ rowGap: `${gap}px`
116
+ }}>
117
+ {column.map(card)}
118
+ </view>)}
119
+ </view>)}
120
+ </view>;
121
+ }
122
+ const EN = {
123
+ title: 'Customize',
124
+ hint: 'Drag to reorder; choose what shows and how wide.',
125
+ half: 'Half',
126
+ full: 'Full',
127
+ reset: 'Reset',
128
+ close: 'Close',
129
+ moveUp: (name)=>`Move ${name} up`,
130
+ moveDown: (name)=>`Move ${name} down`,
131
+ drag: 'Reorder',
132
+ show: (name)=>`Show ${name}`
133
+ };
134
+ function G9DashboardCustomizeSheet(props) {
135
+ var _props_id;
136
+ const w = {
137
+ ...EN,
138
+ ...props.words
139
+ };
140
+ const rtl = 'rtl' === useG9Direction();
141
+ const { wide } = useG9Layout();
142
+ const byId = new Map(props.widgets.map((widget)=>[
143
+ widget.id,
144
+ widget
145
+ ]));
146
+ const base = null != (_props_id = props.id) ? _props_id : 'G9Customize';
147
+ const start = ()=>{
148
+ var _ref, _ref1;
149
+ var _props_layout, _props_layout1;
150
+ const sizes = {};
151
+ for (const [id, size] of Object.entries(null != (_ref = null == (_props_layout = props.layout) ? void 0 : _props_layout.sizes) ? _ref : {}))if ('half' === size || 'full' === size) sizes[id] = size;
152
+ return {
153
+ order: g9ArrangeWidgets(props.widgets, {
154
+ ...props.layout,
155
+ hidden: []
156
+ }).shown.map((p)=>p.widget.id),
157
+ hidden: [
158
+ ...null != (_ref1 = null == (_props_layout1 = props.layout) ? void 0 : _props_layout1.hidden) ? _ref1 : []
159
+ ],
160
+ sizes
161
+ };
162
+ };
163
+ const [state, setState] = useState(start);
164
+ useEffect(()=>{
165
+ if (props.open) setState(start());
166
+ }, [
167
+ props.open
168
+ ]);
169
+ const commit = (next)=>{
170
+ setState(next);
171
+ props.onChange(next);
172
+ };
173
+ const sizeOf = (id)=>{
174
+ var _ref, _state_sizes_id;
175
+ var _byId_get;
176
+ return null != (_ref = null != (_state_sizes_id = state.sizes[id]) ? _state_sizes_id : null == (_byId_get = byId.get(id)) ? void 0 : _byId_get.size) ? _ref : 'half';
177
+ };
178
+ const setSize = (id, size)=>{
179
+ var _ref;
180
+ var _byId_get;
181
+ const sizes = {
182
+ ...state.sizes
183
+ };
184
+ if ((null != (_ref = null == (_byId_get = byId.get(id)) ? void 0 : _byId_get.size) ? _ref : 'half') === size) delete sizes[id];
185
+ else sizes[id] = size;
186
+ commit({
187
+ ...state,
188
+ sizes
189
+ });
190
+ };
191
+ const setShown = (id, shown)=>commit({
192
+ ...state,
193
+ hidden: shown ? state.hidden.filter((h)=>h !== id) : state.hidden.includes(id) ? state.hidden : [
194
+ ...state.hidden,
195
+ id
196
+ ]
197
+ });
198
+ const reset = ()=>commit({
199
+ order: props.widgets.map((x)=>x.id),
200
+ hidden: [],
201
+ sizes: {}
202
+ });
203
+ const items = state.order.filter((id)=>byId.has(id));
204
+ const row = rtl ? 'row-reverse' : 'row';
205
+ const footer = <view className="g9-dash__footer" style={{
206
+ flexDirection: row,
207
+ direction: 'ltr'
208
+ }}>
209
+ <G9Button {...props.id ? {
210
+ id: `${props.id}_Reset`
211
+ } : {}} text={w.reset} variant="ghost" onPress={reset}/>
212
+ <G9Button {...props.id ? {
213
+ id: `${props.id}_Close`
214
+ } : {}} text={w.close} variant="primary" onPress={props.onClose}/>
215
+ </view>;
216
+ return <G9Sheet open={props.open} onOpenChange={(open)=>{
217
+ if (!open) props.onClose();
218
+ }} options={{
219
+ title: w.title,
220
+ footerView: footer,
221
+ ...props.options
222
+ }}>
223
+ <view className="g9-dash__sheet">
224
+ <text className="g9-dash__hint" style={{
225
+ textAlign: rtl ? 'right' : 'left'
226
+ }}>
227
+ {w.hint}
228
+ </text>
229
+ <G9DragList id={`${base}_List`} items={items} getKey={(id)=>id} handle handleLabel={w.drag} onReorder={(order)=>commit({
230
+ ...state,
231
+ order
232
+ })} renderItem={(id, dragging, controls)=>{
233
+ var _widget_title;
234
+ const widget = byId.get(id);
235
+ const name = null != (_widget_title = widget.title) ? _widget_title : id;
236
+ const shown = !state.hidden.includes(id);
237
+ const safe = g9SafeId(id);
238
+ const tools = <view className="g9-dash__tools" style={{
239
+ flexDirection: row,
240
+ direction: 'ltr'
241
+ }}>
242
+ {false === props.sizes ? null : <G9Segmented id={`${base}_Size_${safe}`} size="sm" value={sizeOf(id)} items={[
243
+ {
244
+ key: 'half',
245
+ label: w.half
246
+ },
247
+ {
248
+ key: 'full',
249
+ label: w.full
250
+ }
251
+ ]} onChange={(size)=>setSize(id, size)}/>}
252
+ <G9IconButton id={`${base}_Up_${safe}`} icon="chevronUp" size="sm" isGhost pressGuardMs={0} disabled={!controls.canMoveUp} accessibilityText={w.moveUp(name)} onPress={()=>{
253
+ const order = g9MoveWidget(state.order, id, -1);
254
+ commit({
255
+ ...state,
256
+ order
257
+ });
258
+ }}/>
259
+ <G9IconButton id={`${base}_Down_${safe}`} icon="chevronDown" size="sm" isGhost pressGuardMs={0} disabled={!controls.canMoveDown} accessibilityText={w.moveDown(name)} onPress={()=>{
260
+ const order = g9MoveWidget(state.order, id, 1);
261
+ commit({
262
+ ...state,
263
+ order
264
+ });
265
+ }}/>
266
+ <G9Switch id={`${base}_Show_${safe}`} checked={shown} accessibilityLabel={w.show(name)} onCheckedChange={(on)=>setShown(id, on)}/>
267
+ </view>;
268
+ return <view className={dragging ? 'g9-dash__row g9-dash__row--dragging' : 'g9-dash__row'} style={{
269
+ flexDirection: row,
270
+ direction: 'ltr',
271
+ opacity: shown ? 1 : 0.6
272
+ }} {...g9IdProps(`${base}_Row_${safe}`)}>
273
+ {controls.handle}
274
+ {wide ? <view className="g9-dash__row-body" style={{
275
+ flexDirection: row,
276
+ direction: 'ltr'
277
+ }}>
278
+ <text className="g9-dash__name g9-dash__name--flex" text-maxline="1" style={{
279
+ textAlign: rtl ? 'right' : 'left'
280
+ }}>
281
+ {name}
282
+ </text>
283
+ {tools}
284
+ </view> : <view className="g9-dash__row-body g9-dash__row-body--stack">
285
+ <text className="g9-dash__name" text-maxline="1" style={{
286
+ textAlign: rtl ? 'right' : 'left'
287
+ }}>
288
+ {name}
289
+ </text>
290
+ {tools}
291
+ </view>}
292
+ </view>;
293
+ }}/>
294
+ </view>
295
+ </G9Sheet>;
296
+ }
297
+ export { G9DashboardCustomizeSheet, G9DashboardGrid, G9WidgetSkeleton, G9WidgetSlot };
@@ -0,0 +1,3 @@
1
+ export { G9DashboardCustomizeSheet, type G9DashboardCustomizeSheetProps, type G9DashboardCustomizeWords, G9DashboardGrid, type G9DashboardGridProps, G9WidgetSkeleton, G9WidgetSlot, type G9WidgetSlotProps, } from './dashboard.js';
2
+ export { type G9DashboardLayout, type G9DashboardSegment, type G9DashboardWidget, type G9PlacedWidget, type G9WidgetSize, g9ArrangeWidgets, g9DashboardSegments, g9DropWidget, g9MoveWidget, g9PartOfDay, } from './model.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,eAAe,EACf,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { G9DashboardCustomizeSheet, G9DashboardGrid, G9WidgetSkeleton, G9WidgetSlot } from "./dashboard.jsx";
2
+ export { g9ArrangeWidgets, g9DashboardSegments, g9DropWidget, g9MoveWidget, g9PartOfDay } from "./model.jsx";
@@ -0,0 +1,53 @@
1
+ import type { ComponentType, ReactNode } from '@lynx-js/react';
2
+ /** A card's width on a two-column grid. */
3
+ export type G9WidgetSize = 'half' | 'full';
4
+ /** A widget the app offers. */
5
+ export interface G9DashboardWidget {
6
+ readonly id: string;
7
+ /** Its name in the customize sheet (default the id). */
8
+ readonly title?: string;
9
+ /** Its own width (default half). */
10
+ readonly size?: G9WidgetSize;
11
+ /** Draws it now. */
12
+ readonly render?: () => ReactNode;
13
+ /** Loads its code first (a skeleton card meanwhile); a module with a default component, or the component. */
14
+ readonly load?: () => Promise<{
15
+ readonly default: ComponentType;
16
+ } | ComponentType>;
17
+ }
18
+ /** What the person chose (saved by the app, on the server or the device). */
19
+ export interface G9DashboardLayout {
20
+ readonly order?: readonly string[];
21
+ readonly hidden?: readonly string[];
22
+ readonly sizes?: Readonly<Record<string, G9WidgetSize | string>>;
23
+ }
24
+ /** A shown widget with its width. */
25
+ export interface G9PlacedWidget {
26
+ readonly widget: G9DashboardWidget;
27
+ readonly size: G9WidgetSize;
28
+ }
29
+ /** The widgets in the person's order (unknown ids ignored; new widgets after the known ones, in the app's order). */
30
+ export declare function g9ArrangeWidgets(widgets: readonly G9DashboardWidget[], layout: G9DashboardLayout | null | undefined): {
31
+ readonly shown: G9PlacedWidget[];
32
+ readonly hidden: G9DashboardWidget[];
33
+ };
34
+ /** The order after moving `id` by `delta` places (clamped). */
35
+ export declare function g9MoveWidget(ids: readonly string[], id: string, delta: number): string[];
36
+ /** The order after dropping `id` before `beforeId` (at the end when null or unknown). */
37
+ export declare function g9DropWidget(ids: readonly string[], id: string, beforeId: string | null): string[];
38
+ /** A row of the grid. */
39
+ export type G9DashboardSegment = {
40
+ readonly kind: 'full';
41
+ readonly item: G9PlacedWidget;
42
+ } | {
43
+ readonly kind: 'columns';
44
+ readonly columns: readonly [G9PlacedWidget[], G9PlacedWidget[]];
45
+ };
46
+ /**
47
+ * The grid's rows: a full-width card is a row of its own; consecutive half-width cards fill two columns, alternating
48
+ * (the reading order stays close to the chosen one and the columns stay balanced).
49
+ */
50
+ export declare function g9DashboardSegments(items: readonly G9PlacedWidget[]): G9DashboardSegment[];
51
+ /** A greeting's part of the day: morning 05–12, afternoon 12–17, evening 17–22, night otherwise. */
52
+ export declare function g9PartOfDay(hour: number): 'morning' | 'afternoon' | 'evening' | 'night';
53
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/dashboard/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/D,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,+BAA+B;AAC/B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,SAAS,CAAC;IAClC,6GAA6G;IAC7G,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;KAAE,GAAG,aAAa,CAAC,CAAC;CACpF;AAED,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC;CAClE;AAED,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAQD,qHAAqH;AACrH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC3C;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAa5E;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQxF;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAKlG;AAED,yBAAyB;AACzB,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,cAAc,EAAE,EAAE,cAAc,EAAE,CAAC,CAAA;CAAE,CAAC;AAElG;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,GAAG,kBAAkB,EAAE,CAgB1F;AAED,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAKvF"}
@@ -0,0 +1,76 @@
1
+ function sizeOf(widget, sizes) {
2
+ var _widget_size;
3
+ const chosen = sizes[widget.id];
4
+ if ('half' === chosen || 'full' === chosen) return chosen;
5
+ return null != (_widget_size = widget.size) ? _widget_size : 'half';
6
+ }
7
+ function g9ArrangeWidgets(widgets, layout) {
8
+ var _ref, _ref1, _ref2;
9
+ const order = null != (_ref = null == layout ? void 0 : layout.order) ? _ref : [];
10
+ const hidden = new Set(null != (_ref1 = null == layout ? void 0 : layout.hidden) ? _ref1 : []);
11
+ const sizes = null != (_ref2 = null == layout ? void 0 : layout.sizes) ? _ref2 : {};
12
+ const position = (widget)=>{
13
+ const index = order.indexOf(widget.id);
14
+ return index < 0 ? order.length + widgets.indexOf(widget) : index;
15
+ };
16
+ const sorted = [
17
+ ...widgets
18
+ ].sort((a, b)=>position(a) - position(b));
19
+ return {
20
+ shown: sorted.filter((w)=>!hidden.has(w.id)).map((widget)=>({
21
+ widget,
22
+ size: sizeOf(widget, sizes)
23
+ })),
24
+ hidden: sorted.filter((w)=>hidden.has(w.id))
25
+ };
26
+ }
27
+ function g9MoveWidget(ids, id, delta) {
28
+ const from = ids.indexOf(id);
29
+ if (from < 0) return [
30
+ ...ids
31
+ ];
32
+ const to = Math.max(0, Math.min(ids.length - 1, from + delta));
33
+ const next = [
34
+ ...ids
35
+ ];
36
+ next.splice(from, 1);
37
+ next.splice(to, 0, id);
38
+ return next;
39
+ }
40
+ function g9DropWidget(ids, id, beforeId) {
41
+ const next = ids.filter((entry)=>entry !== id);
42
+ const at = null === beforeId ? next.length : next.indexOf(beforeId);
43
+ next.splice(at < 0 ? next.length : at, 0, id);
44
+ return next;
45
+ }
46
+ function g9DashboardSegments(items) {
47
+ const result = [];
48
+ let run = [];
49
+ const flush = ()=>{
50
+ if (!run.length) return;
51
+ result.push({
52
+ kind: 'columns',
53
+ columns: [
54
+ run.filter((_, i)=>i % 2 === 0),
55
+ run.filter((_, i)=>i % 2 === 1)
56
+ ]
57
+ });
58
+ run = [];
59
+ };
60
+ for (const item of items)if ('full' === item.size) {
61
+ flush();
62
+ result.push({
63
+ kind: 'full',
64
+ item
65
+ });
66
+ } else run.push(item);
67
+ flush();
68
+ return result;
69
+ }
70
+ function g9PartOfDay(hour) {
71
+ if (hour >= 5 && hour < 12) return 'morning';
72
+ if (hour >= 12 && hour < 17) return 'afternoon';
73
+ if (hour >= 17 && hour < 22) return 'evening';
74
+ return 'night';
75
+ }
76
+ export { g9ArrangeWidgets, g9DashboardSegments, g9DropWidget, g9MoveWidget, g9PartOfDay };
@@ -0,0 +1,109 @@
1
+ .g9-code {
2
+ flex-direction: column;
3
+ row-gap: 4px;
4
+ min-width: 0;
5
+ display: flex;
6
+ }
7
+
8
+ .g9-code__caption {
9
+ font-size: 11px;
10
+ font-family: var(--g9-font-text);
11
+ color: var(--g9-text-tertiary);
12
+ direction: ltr;
13
+ }
14
+
15
+ .g9-code__frame {
16
+ background-color: var(--g9-surface-container);
17
+ direction: ltr;
18
+ border-radius: 12px;
19
+ min-width: 0;
20
+ display: flex;
21
+ }
22
+
23
+ .g9-code__scroll {
24
+ flex: 1;
25
+ min-width: 0;
26
+ }
27
+
28
+ .g9-code__body {
29
+ flex-direction: column;
30
+ padding: 12px;
31
+ display: flex;
32
+ }
33
+
34
+ .g9-code__lines {
35
+ flex-direction: row;
36
+ column-gap: 12px;
37
+ display: flex;
38
+ }
39
+
40
+ .g9-code__numbers {
41
+ font-size: 12px;
42
+ line-height: 19px;
43
+ font-family: var(--g9-font-text);
44
+ text-align: right;
45
+ color: var(--g9-text-tertiary);
46
+ }
47
+
48
+ .g9-code__text {
49
+ font-size: 12px;
50
+ line-height: 19px;
51
+ font-family: var(--g9-font-text);
52
+ text-align: left;
53
+ color: var(--g9-text-primary);
54
+ white-space: pre;
55
+ }
56
+
57
+ .g9-code__text--wrap {
58
+ white-space: pre-wrap;
59
+ word-break: break-all;
60
+ }
61
+
62
+ .g9-code__copy {
63
+ position: absolute;
64
+ top: 4px;
65
+ right: 4px;
66
+ }
67
+
68
+ .g9-secret {
69
+ flex-direction: column;
70
+ row-gap: 4px;
71
+ display: flex;
72
+ }
73
+
74
+ .g9-secret__label {
75
+ font-size: 12px;
76
+ font-weight: 600;
77
+ font-family: var(--g9-font-text-600);
78
+ color: var(--g9-text-secondary);
79
+ }
80
+
81
+ .g9-secret__box {
82
+ background-color: var(--g9-surface-container);
83
+ border-radius: 10px;
84
+ align-items: center;
85
+ padding: 4px 4px 4px 12px;
86
+ display: flex;
87
+ }
88
+
89
+ .g9-secret__value {
90
+ flex-direction: column;
91
+ flex: 1;
92
+ min-width: 0;
93
+ display: flex;
94
+ }
95
+
96
+ .g9-secret__text {
97
+ font-size: 12px;
98
+ font-family: var(--g9-font-text);
99
+ text-align: left;
100
+ color: var(--g9-text-primary);
101
+ word-break: break-all;
102
+ }
103
+
104
+ .g9-secret__text--mono, .g9-code__mono {
105
+ font-family: monospace;
106
+ }
107
+
108
+
109
+ /*# sourceMappingURL=code.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://./src/display/code.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,YAAY;EACZ,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,8BAA8B;EAC9B,cAAc;AAChB;;AAGA;EAAE,6CAA6C;EAC7C,cAAc;EACd,mBAAmB;EACnB,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,OAAO;EACP,YAAY;AACd;;AAGA;EAAE,sBAAsB;EACtB,aAAa;EACb,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,gBAAgB;EAChB,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,iBAAiB;EACjB,gCAAgC;EAChC,iBAAiB;EACjB,8BAA8B;AAChC;;AAGA;EAAE,eAAe;EACf,iBAAiB;EACjB,gCAAgC;EAChC,gBAAgB;EAChB,6BAA6B;EAC7B,gBAAgB;AAClB;;AAGA;EAAE,qBAAqB;EACrB,qBAAqB;AACvB;;AAGA;EAAE,kBAAkB;EAClB,QAAQ;EACR,UAAU;AACZ;;AAGA;EAAE,sBAAsB;EACtB,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gBAAgB;EAChB,oCAAoC;EACpC,+BAA+B;AACjC;;AAGA;EAAE,6CAA6C;EAC7C,mBAAmB;EACnB,mBAAmB;EACnB,yBAAyB;EACzB,aAAa;AACf;;AAGA;EAAE,sBAAsB;EACtB,OAAO;EACP,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,gBAAgB;EAChB,6BAA6B;EAC7B,qBAAqB;AACvB;;AAGA;EAAE,sBAAsB;AACxB","sourcesContent":["/* G9CodeBlock and G9SecretValue (2.5.8). */\n.g9-code {\n display: flex;\n flex-direction: column;\n row-gap: 4px;\n min-width: 0px;\n}\n\n.g9-code__caption {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-tertiary);\n direction: ltr;\n}\n\n.g9-code__frame {\n display: flex;\n min-width: 0px;\n border-radius: 12px;\n background-color: var(--g9-surface-container);\n direction: ltr;\n}\n\n.g9-code__scroll {\n flex: 1;\n min-width: 0px;\n}\n\n.g9-code__body {\n display: flex;\n flex-direction: column;\n padding: 12px;\n}\n\n.g9-code__lines {\n display: flex;\n flex-direction: row;\n column-gap: 12px;\n}\n\n.g9-code__numbers {\n font-size: 12px;\n line-height: 19px;\n font-family: var(--g9-font-text);\n text-align: right;\n color: var(--g9-text-tertiary);\n}\n\n.g9-code__text {\n font-size: 12px;\n line-height: 19px;\n font-family: var(--g9-font-text);\n text-align: left;\n color: var(--g9-text-primary);\n white-space: pre;\n}\n\n.g9-code__text--wrap {\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.g9-code__copy {\n position: absolute;\n top: 4px;\n right: 4px;\n}\n\n.g9-secret {\n display: flex;\n flex-direction: column;\n row-gap: 4px;\n}\n\n.g9-secret__label {\n font-size: 12px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-secondary);\n}\n\n.g9-secret__box {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 12px;\n border-radius: 10px;\n background-color: var(--g9-surface-container);\n}\n\n.g9-secret__value {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-width: 0px;\n}\n\n.g9-secret__text {\n font-size: 12px;\n font-family: var(--g9-font-text);\n text-align: left;\n color: var(--g9-text-primary);\n word-break: break-all;\n}\n\n.g9-secret__text--mono {\n font-family: monospace;\n}\n\n/* Code reads in a monospace face (the size and the theme font stay on the text's own class). */\n.g9-code__mono {\n font-family: monospace;\n}\n"],"sourceRoot":""}
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from '@lynx-js/react';
2
+ import './code.css';
3
+ /** Props of {@link G9CodeBlock}. */
4
+ export interface G9CodeBlockProps {
5
+ readonly id?: string;
6
+ readonly text: string;
7
+ /** Copies the text (the platform's clipboard); without it there is no copy button. */
8
+ readonly onCopy?: (text: string) => void;
9
+ readonly copyLabel?: string;
10
+ /** Spoken (and shown as ✓) for a moment after a copy. */
11
+ readonly copiedLabel?: string;
12
+ /** Scrolls down past this height (dp). */
13
+ readonly maxHeight?: number;
14
+ /** Wrap long lines instead of scrolling sideways. */
15
+ readonly wrap?: boolean;
16
+ /** A small caption over the code (the language, a file name). */
17
+ readonly caption?: string;
18
+ /** Line numbers at the start. */
19
+ readonly lineNumbers?: boolean;
20
+ }
21
+ /** A code sample: monospace, left to right, scrolled sideways (or wrapped), with line numbers and a copy button. */
22
+ export declare const G9CodeBlock: import("react").NamedExoticComponent<G9CodeBlockProps>;
23
+ /** Props of {@link G9SecretValue}. */
24
+ export interface G9SecretValueProps {
25
+ readonly id?: string;
26
+ readonly value: string;
27
+ readonly onCopy?: (value: string) => void;
28
+ readonly copyLabel?: string;
29
+ readonly copiedLabel?: string;
30
+ /** Monospace (a token, a key). Default true. */
31
+ readonly mono?: boolean;
32
+ /** Hidden behind dots until the eye is pressed (`revealLabel` / `hideLabel`). Default shown. */
33
+ readonly hidden?: boolean;
34
+ readonly revealLabel?: string;
35
+ readonly hideLabel?: string;
36
+ /** Wraps the value (G9PilotMask, so a support screenshot blacks it out). */
37
+ readonly wrap?: (value: ReactNode) => ReactNode;
38
+ /** A label over the box. */
39
+ readonly label?: string;
40
+ }
41
+ /** A secret (an API token, a webhook address) in a box with its copy button; dots until revealed when asked. */
42
+ export declare function G9SecretValue(props: G9SecretValueProps): ReactNode;
43
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/display/code.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAQ,KAAK,SAAS,EAA+B,MAAM,gBAAgB,CAAC;AAInF,OAAO,YAAY,CAAC;AAqBpB,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,oHAAoH;AACpH,eAAO,MAAM,WAAW,wDA8DtB,CAAC;AAEH,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,CAAC;IAChD,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gHAAgH;AAChH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA0ClE"}