@daisu-ui/ui 0.0.0-stage → 0.1.0-beta.3

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 (401) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +93 -2
  4. package/THIRD_PARTY_NOTICES.md +19 -0
  5. package/dist/ActionSheet.d.ts +45 -0
  6. package/dist/ActionSheet.jsx +37 -0
  7. package/dist/AnchoredBubble.d.ts +36 -0
  8. package/dist/AnchoredBubble.jsx +120 -0
  9. package/dist/Avatar.d.ts +35 -0
  10. package/dist/Avatar.jsx +29 -0
  11. package/dist/Backtop.d.ts +22 -0
  12. package/dist/Backtop.jsx +18 -0
  13. package/dist/Badge.d.ts +19 -0
  14. package/dist/Badge.jsx +11 -0
  15. package/dist/BarCode.d.ts +20 -0
  16. package/dist/BarCode.jsx +38 -0
  17. package/dist/Button.d.ts +21 -0
  18. package/dist/Button.jsx +19 -0
  19. package/dist/Calendar.d.ts +90 -0
  20. package/dist/Calendar.jsx +164 -0
  21. package/dist/CalendarView.d.ts +51 -0
  22. package/dist/CalendarView.jsx +136 -0
  23. package/dist/Card.d.ts +21 -0
  24. package/dist/Card.jsx +21 -0
  25. package/dist/Cascader.d.ts +75 -0
  26. package/dist/Cascader.jsx +212 -0
  27. package/dist/Cell.d.ts +34 -0
  28. package/dist/Cell.jsx +37 -0
  29. package/dist/Checkbox.d.ts +50 -0
  30. package/dist/Checkbox.jsx +74 -0
  31. package/dist/Circle.d.ts +19 -0
  32. package/dist/Circle.jsx +35 -0
  33. package/dist/Collapse.d.ts +31 -0
  34. package/dist/Collapse.jsx +61 -0
  35. package/dist/ConfigProvider.d.ts +15 -0
  36. package/dist/ConfigProvider.jsx +20 -0
  37. package/dist/CountDown.d.ts +20 -0
  38. package/dist/CountDown.jsx +15 -0
  39. package/dist/CountTo.d.ts +28 -0
  40. package/dist/CountTo.jsx +27 -0
  41. package/dist/Curtain.d.ts +29 -0
  42. package/dist/Curtain.jsx +51 -0
  43. package/dist/DatetimePicker.d.ts +46 -0
  44. package/dist/DatetimePicker.jsx +138 -0
  45. package/dist/DatetimePickerView.d.ts +38 -0
  46. package/dist/DatetimePickerView.jsx +36 -0
  47. package/dist/Dialog.d.ts +64 -0
  48. package/dist/Dialog.jsx +105 -0
  49. package/dist/Divider.d.ts +16 -0
  50. package/dist/Divider.jsx +9 -0
  51. package/dist/DropMenu.d.ts +55 -0
  52. package/dist/DropMenu.jsx +210 -0
  53. package/dist/Empty.d.ts +14 -0
  54. package/dist/Empty.jsx +14 -0
  55. package/dist/EmptyState.d.ts +6 -0
  56. package/dist/EmptyState.jsx +9 -0
  57. package/dist/Fab.d.ts +30 -0
  58. package/dist/Fab.jsx +127 -0
  59. package/dist/FloatingPanel.d.ts +21 -0
  60. package/dist/FloatingPanel.jsx +102 -0
  61. package/dist/Form.d.ts +63 -0
  62. package/dist/Form.jsx +108 -0
  63. package/dist/FormFieldRow.d.ts +56 -0
  64. package/dist/FormFieldRow.jsx +63 -0
  65. package/dist/Gap.d.ts +10 -0
  66. package/dist/Gap.jsx +14 -0
  67. package/dist/Grid.d.ts +47 -0
  68. package/dist/Grid.jsx +31 -0
  69. package/dist/Icon.d.ts +11 -0
  70. package/dist/Icon.jsx +12 -0
  71. package/dist/ImagePreview.d.ts +62 -0
  72. package/dist/ImagePreview.jsx +78 -0
  73. package/dist/Img.d.ts +28 -0
  74. package/dist/Img.jsx +59 -0
  75. package/dist/ImgCropper.d.ts +74 -0
  76. package/dist/ImgCropper.jsx +114 -0
  77. package/dist/IndexBar.d.ts +36 -0
  78. package/dist/IndexBar.jsx +149 -0
  79. package/dist/Input.d.ts +11 -0
  80. package/dist/Input.jsx +3 -0
  81. package/dist/InputNumber.d.ts +32 -0
  82. package/dist/InputNumber.jsx +165 -0
  83. package/dist/Keyboard.d.ts +37 -0
  84. package/dist/Keyboard.jsx +130 -0
  85. package/dist/Layout.d.ts +31 -0
  86. package/dist/Layout.jsx +14 -0
  87. package/dist/Loading.d.ts +18 -0
  88. package/dist/Loading.jsx +15 -0
  89. package/dist/Loadmore.d.ts +18 -0
  90. package/dist/Loadmore.jsx +16 -0
  91. package/dist/Navbar.d.ts +35 -0
  92. package/dist/Navbar.jsx +50 -0
  93. package/dist/NoticeBar.d.ts +30 -0
  94. package/dist/NoticeBar.jsx +86 -0
  95. package/dist/Notify.d.ts +34 -0
  96. package/dist/Notify.jsx +52 -0
  97. package/dist/NumberStepper.d.ts +11 -0
  98. package/dist/NumberStepper.jsx +41 -0
  99. package/dist/Overlay.d.ts +16 -0
  100. package/dist/Overlay.jsx +12 -0
  101. package/dist/PagedList.d.ts +13 -0
  102. package/dist/PagedList.jsx +36 -0
  103. package/dist/Pagination.d.ts +29 -0
  104. package/dist/Pagination.jsx +33 -0
  105. package/dist/PasswordInput.d.ts +16 -0
  106. package/dist/PasswordInput.jsx +20 -0
  107. package/dist/Picker.d.ts +61 -0
  108. package/dist/Picker.jsx +80 -0
  109. package/dist/PickerView.d.ts +43 -0
  110. package/dist/PickerView.jsx +142 -0
  111. package/dist/Popover.d.ts +23 -0
  112. package/dist/Popover.jsx +35 -0
  113. package/dist/Popup.d.ts +30 -0
  114. package/dist/Popup.jsx +32 -0
  115. package/dist/Progress.d.ts +17 -0
  116. package/dist/Progress.jsx +45 -0
  117. package/dist/QrCode.d.ts +46 -0
  118. package/dist/QrCode.jsx +67 -0
  119. package/dist/Radio.d.ts +21 -0
  120. package/dist/Radio.jsx +34 -0
  121. package/dist/Rate.d.ts +25 -0
  122. package/dist/Rate.jsx +39 -0
  123. package/dist/Resize.d.ts +17 -0
  124. package/dist/Resize.jsx +17 -0
  125. package/dist/RichText.d.ts +133 -0
  126. package/dist/RichText.jsx +288 -0
  127. package/dist/RootPortal.d.ts +11 -0
  128. package/dist/RootPortal.jsx +19 -0
  129. package/dist/Search.d.ts +39 -0
  130. package/dist/Search.jsx +94 -0
  131. package/dist/Segmented.d.ts +18 -0
  132. package/dist/Segmented.jsx +35 -0
  133. package/dist/SelectPicker.d.ts +54 -0
  134. package/dist/SelectPicker.jsx +136 -0
  135. package/dist/Sidebar.d.ts +34 -0
  136. package/dist/Sidebar.jsx +43 -0
  137. package/dist/Signature.d.ts +46 -0
  138. package/dist/Signature.jsx +203 -0
  139. package/dist/Skeleton.d.ts +27 -0
  140. package/dist/Skeleton.jsx +29 -0
  141. package/dist/SlideVerify.d.ts +27 -0
  142. package/dist/SlideVerify.jsx +138 -0
  143. package/dist/Slider.d.ts +21 -0
  144. package/dist/Slider.jsx +131 -0
  145. package/dist/SortButton.d.ts +16 -0
  146. package/dist/SortButton.jsx +19 -0
  147. package/dist/Steps.d.ts +23 -0
  148. package/dist/Steps.jsx +25 -0
  149. package/dist/Sticky.d.ts +17 -0
  150. package/dist/Sticky.jsx +69 -0
  151. package/dist/SwipeAction.d.ts +27 -0
  152. package/dist/SwipeAction.jsx +187 -0
  153. package/dist/Swiper.d.ts +54 -0
  154. package/dist/Swiper.jsx +94 -0
  155. package/dist/SwiperNav.d.ts +18 -0
  156. package/dist/SwiperNav.jsx +10 -0
  157. package/dist/Switch.d.ts +31 -0
  158. package/dist/Switch.jsx +46 -0
  159. package/dist/SyncedInput.d.ts +12 -0
  160. package/dist/SyncedInput.jsx +18 -0
  161. package/dist/SyncedTextarea.d.ts +11 -0
  162. package/dist/SyncedTextarea.jsx +18 -0
  163. package/dist/Tabbar.d.ts +37 -0
  164. package/dist/Tabbar.jsx +46 -0
  165. package/dist/Table.d.ts +51 -0
  166. package/dist/Table.jsx +125 -0
  167. package/dist/Tabs.d.ts +65 -0
  168. package/dist/Tabs.jsx +132 -0
  169. package/dist/Tag.d.ts +33 -0
  170. package/dist/Tag.jsx +63 -0
  171. package/dist/Text.d.ts +19 -0
  172. package/dist/Text.jsx +7 -0
  173. package/dist/TextField.d.ts +89 -0
  174. package/dist/TextField.jsx +149 -0
  175. package/dist/Textarea.d.ts +22 -0
  176. package/dist/Textarea.jsx +3 -0
  177. package/dist/Toast.d.ts +36 -0
  178. package/dist/Toast.jsx +30 -0
  179. package/dist/Tooltip.d.ts +8 -0
  180. package/dist/Tooltip.jsx +5 -0
  181. package/dist/Tour.d.ts +85 -0
  182. package/dist/Tour.jsx +150 -0
  183. package/dist/Transition.d.ts +32 -0
  184. package/dist/Transition.jsx +43 -0
  185. package/dist/Upload.d.ts +64 -0
  186. package/dist/Upload.jsx +163 -0
  187. package/dist/VideoPreview.d.ts +47 -0
  188. package/dist/VideoPreview.jsx +59 -0
  189. package/dist/Watermark.d.ts +36 -0
  190. package/dist/Watermark.jsx +18 -0
  191. package/dist/action-sheet.css +19 -0
  192. package/dist/avatar.css +23 -0
  193. package/dist/avatarModel.d.ts +8 -0
  194. package/dist/avatarModel.js +17 -0
  195. package/dist/backtop.css +6 -0
  196. package/dist/badge.css +15 -0
  197. package/dist/badgeModel.d.ts +2 -0
  198. package/dist/badgeModel.js +18 -0
  199. package/dist/bar-code.css +5 -0
  200. package/dist/barCodeModel.d.ts +80 -0
  201. package/dist/barCodeModel.js +99 -0
  202. package/dist/bubble.css +14 -0
  203. package/dist/bubblePosition.d.ts +19 -0
  204. package/dist/bubblePosition.js +41 -0
  205. package/dist/button.css +56 -0
  206. package/dist/calendar.css +56 -0
  207. package/dist/calendarModel.d.ts +62 -0
  208. package/dist/calendarModel.js +141 -0
  209. package/dist/card.css +8 -0
  210. package/dist/cascader.css +16 -0
  211. package/dist/cascaderModel.d.ts +21 -0
  212. package/dist/cascaderModel.js +32 -0
  213. package/dist/cell.css +41 -0
  214. package/dist/choice.css +27 -0
  215. package/dist/choice.d.ts +28 -0
  216. package/dist/choice.jsx +16 -0
  217. package/dist/circle.css +4 -0
  218. package/dist/circleModel.d.ts +15 -0
  219. package/dist/circleModel.js +31 -0
  220. package/dist/config-provider.css +2 -0
  221. package/dist/configContext.d.ts +23 -0
  222. package/dist/configContext.js +24 -0
  223. package/dist/configTheme.d.ts +3 -0
  224. package/dist/configTheme.js +22 -0
  225. package/dist/count-down.css +2 -0
  226. package/dist/count-to.css +8 -0
  227. package/dist/countDownModel.d.ts +11 -0
  228. package/dist/countDownModel.js +7 -0
  229. package/dist/countToModel.d.ts +3 -0
  230. package/dist/countToModel.js +3 -0
  231. package/dist/curtain.css +10 -0
  232. package/dist/datetime-picker.css +11 -0
  233. package/dist/datetimePickerModel.d.ts +47 -0
  234. package/dist/datetimePickerModel.js +128 -0
  235. package/dist/dialog.css +23 -0
  236. package/dist/divider.css +14 -0
  237. package/dist/drop-menu.css +28 -0
  238. package/dist/empty.css +7 -0
  239. package/dist/fab.css +23 -0
  240. package/dist/fabModel.d.ts +26 -0
  241. package/dist/fabModel.js +16 -0
  242. package/dist/floating-panel.css +6 -0
  243. package/dist/floatingPanelModel.d.ts +3 -0
  244. package/dist/floatingPanelModel.js +10 -0
  245. package/dist/form.css +10 -0
  246. package/dist/formContext.d.ts +7 -0
  247. package/dist/formContext.js +2 -0
  248. package/dist/formModel.d.ts +38 -0
  249. package/dist/formModel.js +16 -0
  250. package/dist/gap.css +1 -0
  251. package/dist/grid.css +17 -0
  252. package/dist/icon.css +8 -0
  253. package/dist/icons/LICENSE.tabler +21 -0
  254. package/dist/icons/paths.d.ts +309 -0
  255. package/dist/icons/paths.js +310 -0
  256. package/dist/icons/render.d.ts +2 -0
  257. package/dist/icons/render.js +5 -0
  258. package/dist/image-preview.css +8 -0
  259. package/dist/img-cropper.css +1 -0
  260. package/dist/img.css +5 -0
  261. package/dist/imgCropperModel.d.ts +55 -0
  262. package/dist/imgCropperModel.js +41 -0
  263. package/dist/imgModel.d.ts +13 -0
  264. package/dist/imgModel.js +22 -0
  265. package/dist/index-bar.css +12 -0
  266. package/dist/index.d.ts +200 -0
  267. package/dist/index.js +99 -0
  268. package/dist/indexBarModel.d.ts +19 -0
  269. package/dist/indexBarModel.js +37 -0
  270. package/dist/input-number.css +24 -0
  271. package/dist/inputNumberModel.d.ts +23 -0
  272. package/dist/inputNumberModel.js +40 -0
  273. package/dist/keyboard.css +26 -0
  274. package/dist/keyboardModel.d.ts +11 -0
  275. package/dist/keyboardModel.js +34 -0
  276. package/dist/layout.css +2 -0
  277. package/dist/legacy/RadioGroup.d.ts +13 -0
  278. package/dist/legacy/RadioGroup.jsx +13 -0
  279. package/dist/legacy-controls.css +87 -0
  280. package/dist/loading.css +31 -0
  281. package/dist/loadingModel.d.ts +2 -0
  282. package/dist/loadingModel.js +21 -0
  283. package/dist/loadmore.css +5 -0
  284. package/dist/navbar.css +16 -0
  285. package/dist/notice-bar.css +19 -0
  286. package/dist/notify.css +14 -0
  287. package/dist/overlay.css +2 -0
  288. package/dist/pagination.css +12 -0
  289. package/dist/paginationModel.d.ts +6 -0
  290. package/dist/paginationModel.js +7 -0
  291. package/dist/password-input.css +14 -0
  292. package/dist/passwordInputModel.d.ts +6 -0
  293. package/dist/passwordInputModel.js +11 -0
  294. package/dist/picker.css +42 -0
  295. package/dist/pickerModel.d.ts +32 -0
  296. package/dist/pickerModel.js +49 -0
  297. package/dist/popover.css +5 -0
  298. package/dist/popup.css +17 -0
  299. package/dist/progress.css +16 -0
  300. package/dist/progressModel.d.ts +12 -0
  301. package/dist/progressModel.js +19 -0
  302. package/dist/qr-code.css +4 -0
  303. package/dist/qrCodeModel.d.ts +36 -0
  304. package/dist/qrCodeModel.js +61 -0
  305. package/dist/rate.css +20 -0
  306. package/dist/rateModel.d.ts +4 -0
  307. package/dist/rateModel.js +38 -0
  308. package/dist/resize.css +2 -0
  309. package/dist/rich-text.css +19 -0
  310. package/dist/richTextMedia.d.ts +28 -0
  311. package/dist/richTextMedia.js +3 -0
  312. package/dist/richTextModel.d.ts +52 -0
  313. package/dist/richTextModel.js +195 -0
  314. package/dist/root-portal.css +1 -0
  315. package/dist/router/RouterView.d.ts +21 -0
  316. package/dist/router/RouterView.jsx +120 -0
  317. package/dist/router/core.d.ts +85 -0
  318. package/dist/router/core.js +255 -0
  319. package/dist/router/hooks.d.ts +17 -0
  320. package/dist/router/hooks.jsx +71 -0
  321. package/dist/router/index.d.ts +5 -0
  322. package/dist/router/index.js +3 -0
  323. package/dist/router/location.d.ts +8 -0
  324. package/dist/router/location.js +46 -0
  325. package/dist/router/router.css +7 -0
  326. package/dist/router/runtime.d.ts +1 -0
  327. package/dist/router/runtime.js +25 -0
  328. package/dist/search.css +23 -0
  329. package/dist/segmented.css +19 -0
  330. package/dist/segmentedModel.d.ts +10 -0
  331. package/dist/segmentedModel.js +8 -0
  332. package/dist/sidebar.css +18 -0
  333. package/dist/sidebarModel.d.ts +8 -0
  334. package/dist/sidebarModel.js +27 -0
  335. package/dist/signature.css +5 -0
  336. package/dist/signatureModel.d.ts +23 -0
  337. package/dist/signatureModel.js +80 -0
  338. package/dist/skeleton.css +16 -0
  339. package/dist/slide-verify.css +7 -0
  340. package/dist/slider.css +49 -0
  341. package/dist/sliderModel.d.ts +10 -0
  342. package/dist/sliderModel.js +27 -0
  343. package/dist/sort-button.css +12 -0
  344. package/dist/steps.css +35 -0
  345. package/dist/sticky.css +7 -0
  346. package/dist/styles.css +136 -0
  347. package/dist/styles.d.ts +1 -0
  348. package/dist/swipe-action.css +6 -0
  349. package/dist/swiper.css +27 -0
  350. package/dist/swiperAnimation.d.ts +3 -0
  351. package/dist/swiperAnimation.js +6 -0
  352. package/dist/swiperModel.d.ts +2 -0
  353. package/dist/swiperModel.js +3 -0
  354. package/dist/switch.css +12 -0
  355. package/dist/tabbar.css +17 -0
  356. package/dist/tabbarModel.d.ts +8 -0
  357. package/dist/tabbarModel.js +27 -0
  358. package/dist/table.css +21 -0
  359. package/dist/tableModel.d.ts +10 -0
  360. package/dist/tableModel.js +17 -0
  361. package/dist/tabs.css +31 -0
  362. package/dist/tabsModel.d.ts +7 -0
  363. package/dist/tabsModel.js +14 -0
  364. package/dist/tag.css +66 -0
  365. package/dist/text-field.css +15 -0
  366. package/dist/text.css +7 -0
  367. package/dist/textModel.d.ts +3 -0
  368. package/dist/textModel.js +24 -0
  369. package/dist/toast.css +13 -0
  370. package/dist/tokens.d.ts +34 -0
  371. package/dist/tokens.js +10 -0
  372. package/dist/tour.css +8 -0
  373. package/dist/transition.css +12 -0
  374. package/dist/upload.css +11 -0
  375. package/dist/useCountDown.d.ts +14 -0
  376. package/dist/useCountDown.js +73 -0
  377. package/dist/useDialog.d.ts +9 -0
  378. package/dist/useDialog.js +33 -0
  379. package/dist/useImagePreview.d.ts +7 -0
  380. package/dist/useImagePreview.js +17 -0
  381. package/dist/useNotify.d.ts +9 -0
  382. package/dist/useNotify.js +26 -0
  383. package/dist/usePressState.d.ts +6 -0
  384. package/dist/usePressState.js +17 -0
  385. package/dist/useToast.d.ts +11 -0
  386. package/dist/useToast.js +23 -0
  387. package/dist/useVideoPreview.d.ts +7 -0
  388. package/dist/useVideoPreview.js +17 -0
  389. package/dist/utils.d.ts +4 -0
  390. package/dist/utils.js +4 -0
  391. package/dist/video-preview.css +7 -0
  392. package/dist/watermark.css +6 -0
  393. package/dist/web/imgCropperElement.d.ts +2 -0
  394. package/dist/web/imgCropperElement.js +309 -0
  395. package/dist/web/index.d.ts +6 -0
  396. package/dist/web/index.js +6 -0
  397. package/dist/web/qrCodeExportElement.d.ts +4 -0
  398. package/dist/web/qrCodeExportElement.js +70 -0
  399. package/dist/web/richTextMediaElement.d.ts +2 -0
  400. package/dist/web/richTextMediaElement.js +276 -0
  401. package/package.json +98 -4
@@ -0,0 +1,85 @@
1
+ import './runtime.js';
2
+ import 'url-search-params-polyfill';
3
+ import type { AnyRoute, AnyRouteMatch, NavigateOptions, Router as TanStackRouter } from '@tanstack/react-router';
4
+ export type RouteQuery = Record<string, string | number | boolean | null | undefined>;
5
+ export type NavigationAction = 'push' | 'replace' | 'back' | 'reset' | 'restore';
6
+ export type NavigationResult = Promise<boolean>;
7
+ export type SceneNavigateOptions<TTree extends AnyRoute, TTo extends string | undefined, TFrom extends string = string> = NavigateOptions<TanStackRouter<TTree>, TFrom, TTo> & {
8
+ hash?: never;
9
+ state?: never;
10
+ href?: never;
11
+ reloadDocument?: never;
12
+ mask?: never;
13
+ hashScrollIntoView?: never;
14
+ resetScroll?: never;
15
+ startTransition?: never;
16
+ viewTransition?: never;
17
+ ignoreBlocker?: never;
18
+ publicHref?: never;
19
+ };
20
+ export type RouterHistoryState = {
21
+ entries: {
22
+ key: string;
23
+ path: string;
24
+ }[];
25
+ };
26
+ export type RouterEntry<R> = {
27
+ key: string;
28
+ route: R;
29
+ matches: readonly AnyRouteMatch[];
30
+ };
31
+ export type RouterSnapshot<R> = {
32
+ entries: readonly RouterEntry<R>[];
33
+ action: NavigationAction;
34
+ direction: 'forward' | 'back' | 'none';
35
+ revision: number;
36
+ };
37
+ export type Navigation<R> = {
38
+ to: R;
39
+ from: R;
40
+ action: NavigationAction;
41
+ source: 'app' | 'history';
42
+ };
43
+ export type NavigationGuard<R> = (navigation: Navigation<R>) => boolean | void | Promise<boolean | void>;
44
+ export type RouterOptions<R, TTree extends AnyRoute = AnyRoute> = {
45
+ routeTree: TTree;
46
+ initial: string;
47
+ /** Normalize host path aliases. Matching belongs to TanStack. */
48
+ toPath(location: string): string | null;
49
+ fromMatch(match: AnyRouteMatch): R | null;
50
+ stringify(route: R): string;
51
+ initialRoutes?(route: R): R[];
52
+ historyState?: RouterHistoryState;
53
+ };
54
+ export type Router<R, TTree extends AnyRoute = AnyRoute> = ReturnType<typeof createRouter<R, TTree>>;
55
+ export { parseRoutePath, routePath, parseRouterHistoryState } from './location.js';
56
+ /** TanStack owns route matching, validation, loading and memory history.
57
+ * This adapter owns scene identities, keepalive and guards for every host entry point.
58
+ * Construction is pure; load/navigation is started only on the background thread.
59
+ */
60
+ export declare function createRouter<R, TTree extends AnyRoute = AnyRoute>(options: RouterOptions<R, TTree>): {
61
+ /** Diagnostic/advanced TanStack access. Route changes must use the guarded facade. */
62
+ engine: TanStackRouter<AnyRoute, "never", false, import("@tanstack/history").RouterHistory, Record<string, any>>;
63
+ navigate: <const TTo extends string | undefined, const TFrom extends string = string>(navigation: SceneNavigateOptions<TTree, TTo, TFrom>) => Promise<boolean>;
64
+ readonly route: R;
65
+ readonly routes: R[];
66
+ readonly snapshot: RouterSnapshot<R>;
67
+ href: (route: R) => string;
68
+ serialize(): RouterHistoryState;
69
+ /** Wait for an openBusiness navigation, whose return value means "handled". */
70
+ whenIdle(): Promise<boolean>;
71
+ load(): Promise<boolean>;
72
+ push: (location: string, replace?: boolean) => NavigationResult;
73
+ replace(location: string): NavigationResult;
74
+ back(): NavigationResult;
75
+ reset(location: string): NavigationResult;
76
+ restore(state: RouterHistoryState): NavigationResult;
77
+ subscribe(listener: (snapshot: RouterSnapshot<R>, navigation: Navigation<R>) => void): () => void;
78
+ beforeEach(guard: NavigationGuard<R>): () => void;
79
+ afterEach(listener: (navigation: Navigation<R>) => void): () => void;
80
+ };
81
+ export type RouterHistoryAdapter = {
82
+ write(state: RouterHistoryState, action: NavigationAction | 'sync'): void;
83
+ subscribe(listener: (state: RouterHistoryState) => void): () => void;
84
+ };
85
+ export declare function connectRouterHistory<R>(router: Router<R>, adapter: RouterHistoryAdapter): () => void;
@@ -0,0 +1,255 @@
1
+ import './runtime.js';
2
+ import 'url-search-params-polyfill';
3
+ import { parseRoutePath, routePath, parseRouterHistoryState } from './location.js';
4
+ import { createMemoryHistory, createRouter as createTanStackRouter } from '@tanstack/react-router';
5
+ export { parseRoutePath, routePath, parseRouterHistoryState } from './location.js';
6
+ /** TanStack owns route matching, validation, loading and memory history.
7
+ * This adapter owns scene identities, keepalive and guards for every host entry point.
8
+ * Construction is pure; load/navigation is started only on the background thread.
9
+ */
10
+ export function createRouter(options) {
11
+ const engine = createTanStackRouter({
12
+ routeTree: options.routeTree,
13
+ history: createMemoryHistory({ initialEntries: ['/'] }),
14
+ isServer: false,
15
+ origin: 'http://localhost',
16
+ // IDs must remain strings: TanStack's default JSON search parser coerces numbers.
17
+ parseSearch: search => parseRoutePath(`/${search}`).query,
18
+ stringifySearch: search => routePath('', search),
19
+ defaultPendingMinMs: 0,
20
+ });
21
+ let sequence = 0;
22
+ let attempt = 0;
23
+ let pending = Promise.resolve(true);
24
+ const listeners = new Set();
25
+ const guards = new Set();
26
+ const after = new Set();
27
+ let resolveError;
28
+ const resolveEntry = (location, key) => {
29
+ resolveError = undefined;
30
+ const path = options.toPath(location);
31
+ if (!path || !path.startsWith('/') || path.startsWith('//'))
32
+ return null;
33
+ try {
34
+ const parsed = parseRoutePath(path);
35
+ const matches = engine.matchRoutes(parsed.path, parsed.query, { throwOnError: true });
36
+ if (matches.some(match => match._notFound))
37
+ return null;
38
+ const match = matches[matches.length - 1];
39
+ const route = match && options.fromMatch(match);
40
+ if (!route)
41
+ return null;
42
+ return { key: key || `route-${++sequence}`, route, matches };
43
+ }
44
+ catch (error) {
45
+ resolveError = error;
46
+ return null;
47
+ }
48
+ };
49
+ const makeInitial = (route) => {
50
+ const routes = options.initialRoutes?.(route);
51
+ return (routes?.length ? routes : [route]).map(item => {
52
+ const entry = resolveEntry(options.stringify(item));
53
+ if (!entry)
54
+ throw new Error('Router initial scene is invalid');
55
+ return entry;
56
+ });
57
+ };
58
+ const initial = resolveEntry(options.initial);
59
+ if (!initial) {
60
+ const reason = resolveError instanceof Error ? `${resolveError.name}: ${resolveError.message}` : String(resolveError ?? 'no matching route');
61
+ throw new Error(`Router initial location is invalid (${options.initial}): ${reason}`);
62
+ }
63
+ let entries = makeInitial(initial.route);
64
+ const decode = (value) => {
65
+ const state = parseRouterHistoryState(value);
66
+ if (!state)
67
+ return null;
68
+ const restored = [];
69
+ for (const item of state.entries) {
70
+ const next = resolveEntry(item.path, item.key);
71
+ if (!next)
72
+ return null;
73
+ const existing = entries.find(old => old.key === item.key && options.stringify(old.route) === options.stringify(next.route));
74
+ restored.push(existing || next);
75
+ const id = /^route-(\d+)$/.exec(item.key);
76
+ if (id && Number.isSafeInteger(Number(id[1])))
77
+ sequence = Math.max(sequence, Number(id[1]));
78
+ }
79
+ return restored;
80
+ };
81
+ if (options.historyState)
82
+ entries = decode(options.historyState) || entries;
83
+ const installHistory = (next) => {
84
+ engine.update({ history: createMemoryHistory({ initialEntries: next.map(item => options.stringify(item.route)) }) });
85
+ engine.updateLatestLocation();
86
+ };
87
+ installHistory(entries);
88
+ let snapshot = { entries, action: 'reset', direction: 'none', revision: 0 };
89
+ const run = (next, action, source = 'app') => {
90
+ 'background only';
91
+ const ticket = ++attempt;
92
+ const navigation = { to: next[next.length - 1].route, from: entries[entries.length - 1].route, action, source };
93
+ const checks = [...guards];
94
+ pending = (async () => {
95
+ for (const guard of checks) {
96
+ try {
97
+ if (await guard(navigation) === false)
98
+ return false;
99
+ }
100
+ catch {
101
+ return false;
102
+ }
103
+ if (ticket !== attempt)
104
+ return false;
105
+ }
106
+ if (ticket !== attempt)
107
+ return false;
108
+ const previousTop = entries[entries.length - 1].key;
109
+ const goingBack = action === 'back' || action === 'restore' && !next.some(item => item.key === previousTop) && next.length < entries.length;
110
+ const goingForward = action === 'push' || action === 'restore' && next.length > entries.length;
111
+ const top = next[next.length - 1];
112
+ let loading;
113
+ if (action === 'push' || action === 'replace') {
114
+ const { path, query } = parseRoutePath(options.stringify(top.route));
115
+ // Unique state deliberately allows pushing the same URL as a new scene.
116
+ loading = engine.navigate({ to: path, search: query, state: { sceneKey: top.key }, replace: action === 'replace' });
117
+ }
118
+ else {
119
+ if (action === 'back')
120
+ engine.history.back();
121
+ else
122
+ installHistory(next);
123
+ loading = engine.load();
124
+ }
125
+ const publish = () => {
126
+ entries = next;
127
+ snapshot = { entries, action, direction: goingForward ? 'forward' : goingBack ? 'back' : 'none', revision: snapshot.revision + 1 };
128
+ [...listeners].forEach(listener => listener(snapshot, navigation));
129
+ };
130
+ // History commits synchronously. Publish the accepted scenes now so a second
131
+ // navigation sees the same stack/index as TanStack while loaders are pending.
132
+ publish();
133
+ await loading;
134
+ if (ticket !== attempt)
135
+ return false;
136
+ const resolved = resolveEntry(engine.history.location.href, top.key);
137
+ if (!resolved)
138
+ return false;
139
+ const matches = engine.state.matches;
140
+ next = [...next.slice(0, -1), options.stringify(top.route) === options.stringify(resolved.route)
141
+ ? { ...top, matches } : { ...resolved, matches }];
142
+ navigation.to = next[next.length - 1].route;
143
+ publish();
144
+ [...after].forEach(listener => listener(navigation));
145
+ return true;
146
+ })();
147
+ return pending;
148
+ };
149
+ const push = (location, replace = false) => {
150
+ 'background only';
151
+ if (!replace && entries.length >= 100)
152
+ return Promise.resolve(false);
153
+ const next = resolveEntry(location);
154
+ return next ? run([...(replace ? entries.slice(0, -1) : entries), next], replace ? 'replace' : 'push') : Promise.resolve(false);
155
+ };
156
+ const navigate = async (navigation) => {
157
+ 'background only';
158
+ // A single typed entry point; external/document navigation belongs to the host.
159
+ if (typeof navigation.to === 'string' && (navigation.to.includes('://') || navigation.to.startsWith('//')))
160
+ throw new Error('Use the host to open external URLs');
161
+ const location = engine.buildLocation(navigation);
162
+ return push(location.href, navigation.replace);
163
+ };
164
+ return {
165
+ /** Diagnostic/advanced TanStack access. Route changes must use the guarded facade. */
166
+ engine,
167
+ navigate,
168
+ get route() { return entries[entries.length - 1].route; },
169
+ get routes() { return entries.map(item => item.route); },
170
+ get snapshot() { return snapshot; },
171
+ href: options.stringify,
172
+ serialize() { return { entries: entries.map(item => ({ key: item.key, path: options.stringify(item.route) })) }; },
173
+ /** Wait for an openBusiness navigation, whose return value means "handled". */
174
+ whenIdle() {
175
+ 'background only';
176
+ return pending;
177
+ },
178
+ async load() {
179
+ 'background only';
180
+ const ticket = attempt;
181
+ await engine.load();
182
+ if (ticket !== attempt)
183
+ return false;
184
+ const top = entries[entries.length - 1];
185
+ const resolved = resolveEntry(engine.history.location.href, top.key);
186
+ if (!resolved)
187
+ return false;
188
+ entries = [...entries.slice(0, -1), { ...top, route: options.stringify(top.route) === options.stringify(resolved.route) ? top.route : resolved.route, matches: engine.state.matches }];
189
+ snapshot = { ...snapshot, entries, revision: snapshot.revision + 1 };
190
+ const navigation = { to: entries[entries.length - 1].route, from: top.route, action: 'restore', source: 'app' };
191
+ [...listeners].forEach(listener => listener(snapshot, navigation));
192
+ return true;
193
+ },
194
+ push,
195
+ replace(location) {
196
+ 'background only';
197
+ return push(location, true);
198
+ },
199
+ back() {
200
+ 'background only';
201
+ return entries.length > 1 ? run(entries.slice(0, -1), 'back') : Promise.resolve(false);
202
+ },
203
+ reset(location) {
204
+ 'background only';
205
+ const route = resolveEntry(location)?.route;
206
+ return route ? run(makeInitial(route), 'reset') : Promise.resolve(false);
207
+ },
208
+ restore(state) {
209
+ 'background only';
210
+ const next = decode(state);
211
+ return next ? run(next, 'restore', 'history') : Promise.resolve(false);
212
+ },
213
+ subscribe(listener) {
214
+ 'background only';
215
+ listeners.add(listener);
216
+ return () => { listeners.delete(listener); };
217
+ },
218
+ beforeEach(guard) {
219
+ 'background only';
220
+ guards.add(guard);
221
+ return () => { guards.delete(guard); };
222
+ },
223
+ afterEach(listener) {
224
+ 'background only';
225
+ after.add(listener);
226
+ return () => { after.delete(listener); };
227
+ },
228
+ };
229
+ }
230
+ export function connectRouterHistory(router, adapter) {
231
+ 'background only';
232
+ let disposed = false;
233
+ let historyAttempt = 0;
234
+ let previous = JSON.stringify(router.serialize());
235
+ const unsubscribeRouter = router.subscribe((snapshot, navigation) => {
236
+ const state = router.serialize();
237
+ const serialized = JSON.stringify(state);
238
+ if (navigation.source === 'app' && serialized !== previous) {
239
+ const before = JSON.parse(previous);
240
+ const sameKeys = before.entries.length === state.entries.length && before.entries.every((entry, index) => entry.key === state.entries[index].key);
241
+ // Loading/redirect completion can canonicalize an already committed entry.
242
+ adapter.write(state, sameKeys ? 'sync' : snapshot.action);
243
+ }
244
+ previous = serialized;
245
+ });
246
+ const unsubscribeHistory = adapter.subscribe(state => {
247
+ const ticket = ++historyAttempt;
248
+ void router.restore(state).then(() => {
249
+ if (!disposed && ticket === historyAttempt)
250
+ adapter.write(router.serialize(), 'sync');
251
+ });
252
+ });
253
+ adapter.write(router.serialize(), 'sync');
254
+ return () => { disposed = true; unsubscribeRouter(); unsubscribeHistory(); };
255
+ }
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from '@lynx-js/react';
2
+ import type { AnyRoute, AnyRouteMatch } from '@tanstack/react-router';
3
+ import type { Router, RouterSnapshot } from './core.js';
4
+ export declare const MatchContext: import("react").Context<readonly AnyRouteMatch[]>;
5
+ export declare const RouteContext: import("react").Context<unknown>;
6
+ export declare function RouterProvider<R, TTree extends AnyRoute>({ router, children }: {
7
+ router: Router<R, TTree>;
8
+ children?: ReactNode;
9
+ }): import("@lynx-js/react").JSX.Element;
10
+ export declare function useRouter<R = unknown, TTree extends AnyRoute = AnyRoute>(): Router<R, TTree>;
11
+ export declare function useRouterSnapshot<R, TTree extends AnyRoute = AnyRoute>(router: Router<R, TTree>): RouterSnapshot<R>;
12
+ /** Kept-alive pages receive their own route, even while a different page is on top. */
13
+ export declare function useRoute<R = unknown>(): R;
14
+ /** Each keepalive scene owns its match data; covered pages never read top-page params. */
15
+ export declare function useRouteMatch(): AnyRouteMatch;
16
+ /** Render the leaf component registered on the TanStack route tree. */
17
+ export declare function RouteScreen(): import("@lynx-js/react").JSX.Element | null;
@@ -0,0 +1,71 @@
1
+ import { createContext, useContext, useEffect, useState } from '@lynx-js/react';
2
+ import { RouterContextProvider as TanStackProvider } from '@tanstack/react-router';
3
+ const RouterContext = createContext(null);
4
+ export const MatchContext = createContext([]);
5
+ export const RouteContext = createContext(undefined);
6
+ export function RouterProvider({ router, children }) {
7
+ useEffect(() => { void router.load(); }, [router]);
8
+ return <RouterContext.Provider value={router}>
9
+ <TanStackProvider router={router.engine}>{children}</TanStackProvider>
10
+ </RouterContext.Provider>;
11
+ }
12
+ export function useRouter() {
13
+ const router = useContext(RouterContext);
14
+ if (!router)
15
+ throw new Error('useRouter requires a RouterProvider or RouterView');
16
+ return router;
17
+ }
18
+ export function useRouterSnapshot(router) {
19
+ const [snapshot, setSnapshot] = useState(router.snapshot);
20
+ useEffect(() => {
21
+ const unsubscribe = router.subscribe(next => {
22
+ 'background only';
23
+ setSnapshot(next);
24
+ });
25
+ setSnapshot(router.snapshot);
26
+ return unsubscribe;
27
+ }, [router]);
28
+ return snapshot;
29
+ }
30
+ /** Kept-alive pages receive their own route, even while a different page is on top. */
31
+ export function useRoute() {
32
+ const router = useRouter();
33
+ const snapshot = useRouterSnapshot(router);
34
+ const route = useContext(RouteContext);
35
+ return (route === undefined ? snapshot.entries[snapshot.entries.length - 1].route : route);
36
+ }
37
+ /** Each keepalive scene owns its match data; covered pages never read top-page params. */
38
+ export function useRouteMatch() {
39
+ const matches = useContext(MatchContext);
40
+ if (!matches.length)
41
+ throw new Error('useRouteMatch requires a RouterView scene');
42
+ return matches[matches.length - 1];
43
+ }
44
+ /** Render the leaf component registered on the TanStack route tree. */
45
+ export function RouteScreen() {
46
+ const router = useRouter();
47
+ const leaf = useRouteMatch();
48
+ const matches = useContext(MatchContext);
49
+ const match = matches.find(match => match.status === 'error' || match.status === 'notFound') || leaf;
50
+ const route = router.engine.routesById[match.routeId];
51
+ const Component = route.options.component;
52
+ const ErrorComponent = route.options.errorComponent;
53
+ if (match.status === 'pending') {
54
+ const Pending = route.options.pendingComponent;
55
+ return Pending ? <Pending /> : <view className="page"><text>正在加载页面…</text></view>;
56
+ }
57
+ if (match.status === 'notFound')
58
+ return <view className="page"><text>页面不存在</text></view>;
59
+ if (match.status === 'error') {
60
+ if (ErrorComponent)
61
+ return <ErrorComponent error={match.error} reset={() => {
62
+ 'background only';
63
+ void router.load();
64
+ }} info={{ componentStack: '' }}/>;
65
+ return <view className="page"><text bindtap={() => {
66
+ 'background only';
67
+ void router.load();
68
+ }}>页面加载失败,点击重试</text></view>;
69
+ }
70
+ return Component ? <Component /> : null;
71
+ }
@@ -0,0 +1,5 @@
1
+ export { createRouter, connectRouterHistory, parseRoutePath, routePath, parseRouterHistoryState } from './core.js';
2
+ export type { Router, RouterOptions, RouterEntry, RouterSnapshot, RouteQuery, Navigation, NavigationAction, NavigationGuard, NavigationResult, SceneNavigateOptions, RouterHistoryState, RouterHistoryAdapter } from './core.js';
3
+ export { RouterProvider, useRouter, useRoute, useRouterSnapshot, useRouteMatch, RouteScreen } from "./hooks.jsx";
4
+ export { RouterView, shouldFinishBack } from "./RouterView.jsx";
5
+ export type { RouterViewProps, RouterViewController } from "./RouterView.jsx";
@@ -0,0 +1,3 @@
1
+ export { createRouter, connectRouterHistory, parseRoutePath, routePath, parseRouterHistoryState } from './core.js';
2
+ export { RouterProvider, useRouter, useRoute, useRouterSnapshot, useRouteMatch, RouteScreen } from "./hooks.jsx";
3
+ export { RouterView, shouldFinishBack } from "./RouterView.jsx";
@@ -0,0 +1,8 @@
1
+ export type { RouteQuery, RouterHistoryState, NavigationAction } from './core.js';
2
+ import type { RouteQuery, RouterHistoryState } from './core.js';
3
+ export declare function parseRoutePath(value: string): {
4
+ path: string;
5
+ query: Record<string, string>;
6
+ };
7
+ export declare function routePath(path: string, query?: RouteQuery): string;
8
+ export declare function parseRouterHistoryState(value: unknown): RouterHistoryState | null;
@@ -0,0 +1,46 @@
1
+ export function parseRoutePath(value) {
2
+ const source = value.replace(/^#/, '').split('#', 1)[0] || '/';
3
+ const separator = source.indexOf('?');
4
+ const path = separator < 0 ? source : source.slice(0, separator);
5
+ const query = {};
6
+ for (const pair of (separator < 0 ? '' : source.slice(separator + 1)).split('&')) {
7
+ if (!pair)
8
+ continue;
9
+ const index = pair.indexOf('=');
10
+ try {
11
+ const key = decodeURIComponent((index < 0 ? pair : pair.slice(0, index)).replace(/\+/g, ' '));
12
+ const entry = decodeURIComponent((index < 0 ? '' : pair.slice(index + 1)).replace(/\+/g, ' '));
13
+ Object.defineProperty(query, key, { value: entry, enumerable: true, configurable: true, writable: true });
14
+ }
15
+ catch { /* Ignore malformed URL parameters. */ }
16
+ }
17
+ return { path: path.startsWith('/') ? path : `/${path}`, query };
18
+ }
19
+ export function routePath(path, query = {}) {
20
+ const search = Object.keys(query).filter(key => query[key] !== undefined && query[key] !== null)
21
+ .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join('&');
22
+ return `${path}${search ? `?${search}` : ''}`;
23
+ }
24
+ export function parseRouterHistoryState(value) {
25
+ if (typeof value === 'string') {
26
+ try {
27
+ value = JSON.parse(value);
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ if (!value || typeof value !== 'object')
34
+ return null;
35
+ const entries = value.entries;
36
+ if (!Array.isArray(entries) || entries.length === 0 || entries.length > 100)
37
+ return null;
38
+ const keys = new Set();
39
+ for (const entry of entries) {
40
+ if (!entry || typeof entry.key !== 'string' || !entry.key || entry.key.length > 150 || keys.has(entry.key) ||
41
+ typeof entry.path !== 'string' || !entry.path.startsWith('/') || entry.path.startsWith('//') || entry.path.length > 16000)
42
+ return null;
43
+ keys.add(entry.key);
44
+ }
45
+ return { entries: entries.map(({ key, path }) => ({ key, path })) };
46
+ }
@@ -0,0 +1,7 @@
1
+ .route-scene{position:absolute;top:0;left:0;width:100%;height:100%;}
2
+ .route-back-edge{position:absolute;left:0;top:0;bottom:0;width:24px;z-index:100;}
3
+ .route-back-inset{top:40%;bottom:auto;height:160px;display:flex;align-items:center;justify-content:center;}
4
+ .route-forward{animation:route-forward-in 280ms cubic-bezier(.22,1,.36,1);}
5
+ .route-back{animation:route-back-in 240ms cubic-bezier(.22,1,.36,1);}
6
+ @keyframes route-forward-in{from{transform:translateX(100%);opacity:.8;}to{transform:translateX(0%);opacity:1;}}
7
+ @keyframes route-back-in{from{transform:translateX(-25%);opacity:.8;}to{transform:translateX(0%);opacity:1;}}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { AbortController, AbortSignal } from 'abort-controller';
2
+ if (typeof globalThis.AbortController !== 'function') {
3
+ Object.defineProperty(globalThis, 'AbortController', {
4
+ value: AbortController,
5
+ writable: true,
6
+ configurable: true,
7
+ });
8
+ }
9
+ if (typeof globalThis.AbortSignal !== 'function') {
10
+ Object.defineProperty(globalThis, 'AbortSignal', {
11
+ value: AbortSignal,
12
+ writable: true,
13
+ configurable: true,
14
+ });
15
+ }
16
+ // TanStack's client build writes self.__TSR_ROUTER__ during construction.
17
+ // Lynx has globalThis on both threads, but the main thread has no browser self.
18
+ // Keep existing browser/worker globals intact and do not introduce DOM globals.
19
+ if (typeof globalThis.self === 'undefined') {
20
+ Object.defineProperty(globalThis, 'self', {
21
+ value: globalThis,
22
+ writable: true,
23
+ configurable: true,
24
+ });
25
+ }
@@ -0,0 +1,23 @@
1
+ .ui-search{--ui-search-field-bg:var(--cso-ui-surface);display:flex;flex-direction:row;align-items:center;width:100%;padding:8px 12px;background-color:var(--cso-ui-surface);}
2
+ .ui-search-block{position:relative;flex:1;min-width:0;margin-right:6px;border-radius:9999px;background-color:var(--ui-search-field-bg);display:flex;flex-direction:row;align-items:center;}
3
+ .ui-search-filled{--ui-search-field-bg:var(--cso-ui-canvas);}
4
+ .ui-search-light{background-color:var(--cso-ui-canvas);}
5
+ .ui-search-outline{position:absolute;z-index:1;pointer-events:none;left:0;top:0;width:100%;height:100%;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--cso-ui-surface-muted);}
6
+ .ui-search-field{position:relative;flex:1;min-width:0;height:36px;padding:0 12px;display:flex;flex-direction:row;align-items:center;}
7
+ .ui-search-edit-area{position:relative;flex:1;min-width:0;height:36px;}
8
+ .ui-search-editor{height:36px;}
9
+ .ui-search-editor .ui-textfield-body,.ui-search-editor .ui-textfield-native{height:36px;}
10
+ .ui-search-cover{position:absolute;left:0;top:0;width:100%;height:36px;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:var(--ui-search-field-bg);border-radius:9999px;}
11
+ .ui-search-glyph{position:relative;display:flex;align-items:center;justify-content:center;margin-right:4px;flex-shrink:0;}
12
+
13
+
14
+
15
+ .ui-search-placeholder{font-size:14px;line-height:20px;color:var(--cso-ui-text-placeholder,#a9acb8);}
16
+ .ui-search-clear{margin-left:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
17
+ .ui-search-clear-glyph{margin-right:0;}
18
+ .ui-search-cancel{font-size:14px;line-height:20px;color:var(--cso-ui-primary);flex-shrink:0;}
19
+ .ui-search-input-suffix{margin-left:8px;display:flex;flex-direction:row;align-items:center;flex-shrink:0;}
20
+ .ui-search-prefix,.ui-search-suffix{display:flex;flex-direction:row;align-items:center;flex-shrink:0;}
21
+
22
+ .ui-search-glyph-light{display:var(--cso-ui-light-display,flex);}
23
+ .ui-search-glyph-dark{display:var(--cso-ui-dark-display,none);}
@@ -0,0 +1,19 @@
1
+ .ui-segmented { width: 100%; border-radius: 4px; padding: 4px; background-color: var(--cso-ui-surface-muted); box-sizing: border-box; }
2
+ .ui-segmented-track { position: relative; display: flex; flex-direction: row; align-items: stretch; }
3
+ .ui-segmented-item { flex-shrink: 0; min-width: 0; box-sizing: border-box; position: relative; padding: 2px 12px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
4
+ .ui-segmented-label { color: var(--cso-ui-text-muted); font-size: 16px; line-height: 24px; text-align: center; }
5
+ .ui-segmented-item-active .ui-segmented-label { color: var(--cso-ui-primary); font-weight: 600; }
6
+ .ui-segmented-item-disabled { opacity: .4; }
7
+ .ui-segmented-slider { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background-color: var(--cso-ui-surface); transition: transform 200ms cubic-bezier(.645,.045,.355,1); }
8
+ .ui-segmented-outline { padding: 0; background-color: transparent; }
9
+ .ui-segmented-outline .ui-segmented-item { padding: 6px 16px; border-radius: 0; }
10
+ .ui-segmented-outline .ui-segmented-item-first { border-radius: 4px 0 0 4px; }
11
+ .ui-segmented-outline .ui-segmented-item-last { border-radius: 0 4px 4px 0; }
12
+ .ui-segmented-outline .ui-segmented-item-first.ui-segmented-item-last { border-radius: 4px; }
13
+ .ui-segmented-outline .ui-segmented-item-active { background-color: var(--cso-ui-primary); }
14
+ .ui-segmented-outline .ui-segmented-item-active .ui-segmented-label { color: #fff; }
15
+ .ui-segmented-outline-border { position: absolute; left: 0; right: 0; top: 0; bottom: 0; border-top: .5px solid var(--cso-ui-line); border-bottom: .5px solid var(--cso-ui-line); border-right: .5px solid var(--cso-ui-line); }
16
+ .ui-segmented-item-first .ui-segmented-outline-border { border-left: .5px solid var(--cso-ui-line); border-radius: 4px 0 0 4px; }
17
+ .ui-segmented-item-last .ui-segmented-outline-border { border-radius: 0 4px 4px 0; }
18
+ .ui-segmented-item-first.ui-segmented-item-last .ui-segmented-outline-border { border-radius: 4px; }
19
+ .ui-segmented-item-active .ui-segmented-outline-border { border-color: var(--cso-ui-primary); }
@@ -0,0 +1,10 @@
1
+ export type SegmentedValue = string | number;
2
+ export type SegmentedOption<T = unknown> = {
3
+ value: SegmentedValue;
4
+ disabled?: boolean;
5
+ payload?: T;
6
+ };
7
+ export type SegmentedInput<T = unknown> = SegmentedValue | SegmentedOption<T>;
8
+ export declare function segmentedOptions<T>(options: readonly SegmentedInput<T>[]): SegmentedOption<T>[];
9
+ /** Invalid or absent values display the first option, without emitting a change. */
10
+ export declare function segmentedIndex(options: readonly SegmentedOption[], value: SegmentedValue | undefined): number;
@@ -0,0 +1,8 @@
1
+ export function segmentedOptions(options) {
2
+ return options.map(option => typeof option === 'object' ? option : { value: option });
3
+ }
4
+ /** Invalid or absent values display the first option, without emitting a change. */
5
+ export function segmentedIndex(options, value) {
6
+ const index = options.findIndex(option => option.value === value);
7
+ return index >= 0 ? index : options.length ? 0 : -1;
8
+ }
@@ -0,0 +1,18 @@
1
+ .ui-sidebar { width: 114px; flex-shrink: 0; display: flex; flex-direction: column; background-color: var(--cso-ui-surface); }
2
+ .ui-sidebar-item { position: relative; min-height: 52px; padding: 6px 16px; display: flex; flex-direction: row; align-items: center; justify-content: center; flex-shrink: 0; box-sizing: border-box; background-color: var(--cso-ui-canvas); }
3
+ .ui-sidebar-label-wrap { position: relative; min-width: 0; }
4
+ .ui-sidebar-label { font-size: 14px; line-height: 20px; color: var(--cso-ui-text); }
5
+ .ui-sidebar-active { background-color: var(--cso-ui-surface); }
6
+ .ui-sidebar-active .ui-sidebar-label { color: var(--cso-ui-primary); font-weight: 700; }
7
+ .ui-sidebar-disabled .ui-sidebar-label { color: var(--cso-ui-line-strong, #c9cbd4); }
8
+ .ui-sidebar-prefix { border-bottom-right-radius: 8px; }
9
+ .ui-sidebar-suffix { border-top-right-radius: 8px; }
10
+ .ui-sidebar-indicator { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 2px; height: 20px; background-color: var(--cso-ui-primary); }
11
+ .ui-sidebar-icon { width: 18px; height: 20px; margin-right: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
12
+
13
+
14
+
15
+ .ui-badge.ui-sidebar-label-wrap { align-self: center; }
16
+
17
+ .ui-sidebar-icon-light{display:var(--cso-ui-light-display,flex);}
18
+ .ui-sidebar-icon-dark{display:var(--cso-ui-dark-display,none);}
@@ -0,0 +1,8 @@
1
+ export type SidebarValue = string | number;
2
+ export type SidebarBeforeChange = (value: SidebarValue) => boolean | Promise<boolean>;
3
+ /** Confirmation is invalidated by another tap, new props or unmounting. */
4
+ export declare function createSidebarGuard(): {
5
+ cancel(): void;
6
+ request(value: SidebarValue, before: SidebarBeforeChange | undefined, commit: () => void): Promise<void>;
7
+ };
8
+ export declare function sidebarBadge(value: string | number | undefined, max?: number): string;