@fibrae/semi-ui-svelte 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/LICENSE +0 -62
  2. package/README.md +40 -38
  3. package/README.zh-CN.md +91 -0
  4. package/dist/_base/create-context.js +0 -1
  5. package/dist/_base/css-animation.js +0 -1
  6. package/dist/_base/group-role.d.ts +0 -1
  7. package/dist/_base/group-role.js +0 -1
  8. package/dist/_base/slot-kind.d.ts +0 -1
  9. package/dist/_base/slot-kind.js +0 -1
  10. package/dist/_base/teleport.d.ts +0 -2
  11. package/dist/_base/teleport.js +0 -2
  12. package/dist/_base/use-click-outside.svelte.d.ts +2 -2
  13. package/dist/_base/use-click-outside.svelte.js +2 -2
  14. package/dist/_base/use-foundation.svelte.js +2 -5
  15. package/dist/_base/virtual-list.svelte +2 -3
  16. package/dist/_base/virtual-list.svelte.d.ts +0 -1
  17. package/dist/_sortable/interface.d.ts +0 -1
  18. package/dist/anchor/interface.d.ts +0 -3
  19. package/dist/anchor/link-item.svelte +0 -1
  20. package/dist/anchor/links.d.ts +0 -1
  21. package/dist/anchor/links.js +0 -1
  22. package/dist/audio-player/audio-player.svelte +0 -2
  23. package/dist/audio-player/audio-slider.svelte +0 -3
  24. package/dist/auto-complete/auto-complete.svelte +0 -5
  25. package/dist/auto-complete/interface.d.ts +0 -9
  26. package/dist/avatar/avatar-group-more.svelte +0 -1
  27. package/dist/avatar/avatar.svelte +0 -4
  28. package/dist/avatar/context.d.ts +0 -1
  29. package/dist/avatar/interface.d.ts +0 -4
  30. package/dist/backtop/backtop.svelte +0 -2
  31. package/dist/backtop/interface.d.ts +0 -1
  32. package/dist/badge/interface.d.ts +0 -1
  33. package/dist/banner/banner.svelte +1 -1
  34. package/dist/banner/interface.d.ts +1 -3
  35. package/dist/breadcrumb/breadcrumb-item.svelte +0 -1
  36. package/dist/breadcrumb/breadcrumb.svelte +0 -1
  37. package/dist/breadcrumb/interface.d.ts +0 -7
  38. package/dist/calendar/calendar.svelte +0 -1
  39. package/dist/calendar/day-calendar.svelte +0 -3
  40. package/dist/calendar/interface.d.ts +0 -8
  41. package/dist/calendar/month-calendar.svelte +0 -4
  42. package/dist/calendar/time-grid.svelte +0 -2
  43. package/dist/calendar/time-grid.svelte.d.ts +0 -1
  44. package/dist/calendar/use-today.svelte.d.ts +0 -1
  45. package/dist/calendar/use-today.svelte.js +0 -1
  46. package/dist/card/index.js +0 -1
  47. package/dist/card/interface.d.ts +0 -3
  48. package/dist/carousel/carousel.svelte +0 -4
  49. package/dist/carousel/interface.d.ts +0 -3
  50. package/dist/cascader/cascader.svelte +0 -6
  51. package/dist/cascader/interface.d.ts +0 -19
  52. package/dist/cascader/item.svelte +0 -4
  53. package/dist/cascader/item.svelte.d.ts +0 -4
  54. package/dist/checkbox/checkbox-group.svelte +0 -3
  55. package/dist/checkbox/checkbox.svelte +0 -4
  56. package/dist/checkbox/index.js +0 -1
  57. package/dist/checkbox/interface.d.ts +0 -1
  58. package/dist/code-highlight/interface.d.ts +0 -1
  59. package/dist/collapse/collapse.svelte +0 -2
  60. package/dist/collapse/index.js +0 -1
  61. package/dist/collapse/interface.d.ts +0 -2
  62. package/dist/collapse/panel.svelte +0 -1
  63. package/dist/collapsible/collapsible.svelte +0 -2
  64. package/dist/color-picker/alpha-slider.svelte +0 -1
  65. package/dist/color-picker/color-choose-area.svelte +0 -1
  66. package/dist/color-picker/color-slider.svelte +0 -1
  67. package/dist/color-picker/data-part.svelte +0 -1
  68. package/dist/cropper/cropper.svelte +0 -1
  69. package/dist/cropper/interface.d.ts +0 -6
  70. package/dist/date-picker/date-input.svelte +0 -4
  71. package/dist/date-picker/date-picker.svelte +0 -7
  72. package/dist/date-picker/inset-input.svelte +0 -1
  73. package/dist/date-picker/interface.d.ts +0 -7
  74. package/dist/date-picker/internal.d.ts +0 -7
  75. package/dist/date-picker/month.svelte +0 -1
  76. package/dist/date-picker/months-grid.svelte +0 -6
  77. package/dist/date-picker/navigation.svelte +0 -1
  78. package/dist/descriptions/interface.d.ts +0 -1
  79. package/dist/divider/divider.svelte +0 -1
  80. package/dist/divider/interface.d.ts +0 -4
  81. package/dist/drag-move/drag-move.js +0 -1
  82. package/dist/drag-move/interface.d.ts +0 -3
  83. package/dist/dropdown/context.d.ts +0 -6
  84. package/dist/dropdown/context.js +0 -1
  85. package/dist/dropdown/dropdown-item.svelte +0 -1
  86. package/dist/dropdown/dropdown.svelte +0 -7
  87. package/dist/dropdown/interface.d.ts +0 -4
  88. package/dist/empty/empty.svelte +0 -1
  89. package/dist/empty/interface.d.ts +0 -3
  90. package/dist/feedback/feedback.svelte +0 -1
  91. package/dist/feedback/interface.d.ts +0 -8
  92. package/dist/float-button/float-button-action.svelte +0 -2
  93. package/dist/float-button/interface.d.ts +0 -2
  94. package/dist/form/array-field.svelte +0 -2
  95. package/dist/form/context.d.ts +0 -2
  96. package/dist/form/error-message.svelte +0 -1
  97. package/dist/form/field-grid.svelte +0 -2
  98. package/dist/form/field-grid.svelte.d.ts +0 -2
  99. package/dist/form/field-inner.svelte +0 -2
  100. package/dist/form/field.svelte +0 -1
  101. package/dist/form/form.svelte +0 -1
  102. package/dist/form/hooks.d.ts +1 -2
  103. package/dist/form/hooks.js +1 -2
  104. package/dist/form/interface.d.ts +0 -7
  105. package/dist/form/utils.d.ts +0 -1
  106. package/dist/form/utils.js +0 -2
  107. package/dist/highlight/interface.d.ts +0 -1
  108. package/dist/hot-keys/interface.d.ts +0 -1
  109. package/dist/image/context.d.ts +0 -1
  110. package/dist/image/footer.d.ts +0 -1
  111. package/dist/image/interface.d.ts +0 -8
  112. package/dist/image/preview-image.svelte +0 -3
  113. package/dist/image/preview-image.svelte.d.ts +0 -1
  114. package/dist/image/preview-inner.svelte +0 -3
  115. package/dist/image/preview-inner.svelte.d.ts +0 -1
  116. package/dist/input/context.d.ts +0 -1
  117. package/dist/input/interface.d.ts +0 -3
  118. package/dist/input/textarea.svelte +0 -3
  119. package/dist/input-number/input-number.svelte +0 -2
  120. package/dist/input-number/interface.d.ts +0 -1
  121. package/dist/json-viewer/interface.d.ts +0 -4
  122. package/dist/json-viewer/json-viewer.svelte +0 -3
  123. package/dist/layout/interface.d.ts +0 -2
  124. package/dist/list/interface.d.ts +0 -2
  125. package/dist/lottie/interface.d.ts +1 -1
  126. package/dist/markdown-render/code-text.js +0 -1
  127. package/dist/markdown-render/components/code.svelte +0 -1
  128. package/dist/markdown-render/components/heading.svelte +0 -1
  129. package/dist/markdown-render/components/p.svelte +0 -1
  130. package/dist/markdown-render/components/table.svelte +0 -1
  131. package/dist/markdown-render/components/tree.d.ts +0 -4
  132. package/dist/markdown-render/components/tree.js +0 -2
  133. package/dist/markdown-render/interface.d.ts +0 -1
  134. package/dist/markdown-render/markdown-children.svelte +0 -2
  135. package/dist/markdown-render/markdown-render.svelte +0 -1
  136. package/dist/markdown-render/runtime.js +0 -1
  137. package/dist/modal/confirm-modal.svelte +0 -1
  138. package/dist/modal/confirm.svelte.d.ts +0 -1
  139. package/dist/modal/confirm.svelte.js +0 -1
  140. package/dist/modal/index.js +0 -1
  141. package/dist/modal/interface.d.ts +0 -6
  142. package/dist/modal/modal-content.svelte +0 -4
  143. package/dist/modal/modal.svelte +0 -1
  144. package/dist/modal/use-show-hide.svelte.d.ts +0 -2
  145. package/dist/modal/use-show-hide.svelte.js +0 -4
  146. package/dist/navigation/context.d.ts +0 -2
  147. package/dist/navigation/index.js +0 -1
  148. package/dist/navigation/interface.d.ts +1 -17
  149. package/dist/navigation/item-shell.svelte +0 -4
  150. package/dist/navigation/item-shell.svelte.d.ts +0 -3
  151. package/dist/navigation/nav-footer.svelte +0 -2
  152. package/dist/navigation/nav-items.svelte +0 -1
  153. package/dist/navigation/nav.svelte +0 -1
  154. package/dist/navigation/sub-nav.svelte +0 -5
  155. package/dist/navigation/wrapper-outlet.svelte +0 -1
  156. package/dist/notification/context.d.ts +0 -3
  157. package/dist/notification/interface.d.ts +0 -5
  158. package/dist/notification/notice-list.svelte +0 -2
  159. package/dist/notification/notice-list.svelte.d.ts +0 -1
  160. package/dist/notification/notice.svelte +0 -2
  161. package/dist/notification/notification-list.svelte +0 -1
  162. package/dist/notification/static-api.js +0 -1
  163. package/dist/overflow-list/interface.d.ts +0 -2
  164. package/dist/overflow-list/overflow-list.svelte +0 -2
  165. package/dist/pagination/interface.d.ts +0 -1
  166. package/dist/pagination/pagination.svelte +0 -2
  167. package/dist/pagination/step-button.svelte +0 -3
  168. package/dist/pagination/step-button.svelte.d.ts +0 -1
  169. package/dist/pincode/interface.d.ts +0 -1
  170. package/dist/pincode/pincode.svelte +0 -3
  171. package/dist/popconfirm/interface.d.ts +0 -1
  172. package/dist/popconfirm/popconfirm.svelte +0 -2
  173. package/dist/popover/interface.d.ts +0 -1
  174. package/dist/popover/popover.svelte +0 -1
  175. package/dist/radio/index.js +0 -1
  176. package/dist/radio/radio-group.svelte +0 -1
  177. package/dist/radio/radio.svelte +0 -1
  178. package/dist/rating/interface.d.ts +0 -2
  179. package/dist/rating/item.svelte +0 -1
  180. package/dist/rating/rating.svelte +0 -7
  181. package/dist/resizable/interface.d.ts +0 -2
  182. package/dist/resizable/resizable.svelte +0 -1
  183. package/dist/resizable/resize-group.svelte +0 -1
  184. package/dist/resizable/resize-handler.svelte +0 -1
  185. package/dist/resize-observer/observe-resize.d.ts +1 -5
  186. package/dist/resize-observer/observe-resize.js +1 -5
  187. package/dist/scroll-list/index.js +0 -1
  188. package/dist/scroll-list/interface.d.ts +0 -2
  189. package/dist/scroll-list/scroll-item.svelte +0 -2
  190. package/dist/select/interface.d.ts +0 -14
  191. package/dist/select/option.svelte +0 -5
  192. package/dist/select/option.svelte.d.ts +0 -5
  193. package/dist/select/select.svelte +0 -14
  194. package/dist/side-sheet/interface.d.ts +0 -1
  195. package/dist/side-sheet/side-sheet.svelte +0 -9
  196. package/dist/skeleton/index.js +0 -1
  197. package/dist/skeleton/interface.d.ts +0 -2
  198. package/dist/skeleton/skeleton-item.svelte +0 -1
  199. package/dist/slider/interface.d.ts +0 -5
  200. package/dist/slider/slider.svelte +0 -7
  201. package/dist/space/interface.d.ts +0 -1
  202. package/dist/space/space.svelte +0 -1
  203. package/dist/steps/context.d.ts +0 -1
  204. package/dist/steps/interface.d.ts +0 -2
  205. package/dist/steps/step.svelte +0 -3
  206. package/dist/switch/switch.svelte +0 -2
  207. package/dist/table/body/base-row.svelte +0 -4
  208. package/dist/table/body/base-row.svelte.d.ts +0 -4
  209. package/dist/table/body/body.svelte +0 -7
  210. package/dist/table/body/body.svelte.d.ts +0 -5
  211. package/dist/table/body/expanded-row.svelte +0 -1
  212. package/dist/table/body/expanded-row.svelte.d.ts +0 -1
  213. package/dist/table/body/section-row.svelte +0 -2
  214. package/dist/table/body/section-row.svelte.d.ts +0 -2
  215. package/dist/table/column-filter-menu.svelte +0 -3
  216. package/dist/table/column-filter-menu.svelte.d.ts +0 -3
  217. package/dist/table/column-filter.svelte +0 -2
  218. package/dist/table/column-filter.svelte.d.ts +0 -2
  219. package/dist/table/column-selection.svelte +1 -2
  220. package/dist/table/column-selection.svelte.d.ts +0 -1
  221. package/dist/table/column-sorter.svelte +1 -6
  222. package/dist/table/column-sorter.svelte.d.ts +1 -6
  223. package/dist/table/context.d.ts +0 -10
  224. package/dist/table/context.js +0 -1
  225. package/dist/table/custom-expand-icon.svelte +0 -2
  226. package/dist/table/custom-expand-icon.svelte.d.ts +0 -2
  227. package/dist/table/head-table.svelte +0 -1
  228. package/dist/table/head-table.svelte.d.ts +0 -1
  229. package/dist/table/interface.d.ts +2 -21
  230. package/dist/table/table-cell.svelte +0 -7
  231. package/dist/table/table-cell.svelte.d.ts +0 -7
  232. package/dist/table/table-header-row.svelte +0 -2
  233. package/dist/table/table-header-row.svelte.d.ts +0 -2
  234. package/dist/table/table-pagination.svelte +0 -2
  235. package/dist/table/table-pagination.svelte.d.ts +0 -2
  236. package/dist/table/table.svelte +0 -5
  237. package/dist/table/utils.d.ts +1 -13
  238. package/dist/table/utils.js +1 -11
  239. package/dist/tabs/index.js +0 -1
  240. package/dist/tabs/interface.d.ts +0 -13
  241. package/dist/tabs/tab-bar.svelte +0 -3
  242. package/dist/tabs/tab-bar.svelte.d.ts +0 -1
  243. package/dist/tabs/tab-pane.svelte +0 -2
  244. package/dist/tabs/tabs.svelte +0 -1
  245. package/dist/tag-input/interface.d.ts +0 -5
  246. package/dist/tag-input/tag-input.svelte +0 -3
  247. package/dist/tag-input/tag-item.svelte +0 -1
  248. package/dist/tag-input/tag-item.svelte.d.ts +0 -1
  249. package/dist/time-picker/combobox.svelte +0 -1
  250. package/dist/time-picker/interface.d.ts +0 -9
  251. package/dist/time-picker/time-picker.svelte +0 -2
  252. package/dist/timeline/interface.d.ts +0 -4
  253. package/dist/timeline/timeline.svelte +0 -1
  254. package/dist/toast/context.d.ts +0 -2
  255. package/dist/toast/interface.d.ts +0 -2
  256. package/dist/toast/static-api.js +0 -1
  257. package/dist/toast/toast.svelte +0 -1
  258. package/dist/toast/use-toast.js +0 -1
  259. package/dist/tooltip/context.d.ts +0 -2
  260. package/dist/tooltip/interface.d.ts +0 -2
  261. package/dist/tooltip/tooltip.svelte +0 -5
  262. package/dist/transfer/interface.d.ts +1 -8
  263. package/dist/transfer/transfer-selected-item.svelte +0 -1
  264. package/dist/transfer/transfer-selected-item.svelte.d.ts +0 -1
  265. package/dist/transfer/transfer.svelte +0 -1
  266. package/dist/tree/auto-sizer.svelte +0 -1
  267. package/dist/tree/context.d.ts +0 -1
  268. package/dist/tree/interface.d.ts +0 -9
  269. package/dist/tree/node-collapsible.svelte +0 -1
  270. package/dist/tree/node-list.svelte +0 -4
  271. package/dist/tree/tree-node.svelte +0 -1
  272. package/dist/tree/tree.svelte +0 -3
  273. package/dist/tree/use-tree-keyboard.svelte.d.ts +1 -8
  274. package/dist/tree/use-tree-keyboard.svelte.js +1 -6
  275. package/dist/tree-select/interface.d.ts +0 -11
  276. package/dist/tree-select/tree-select.svelte +0 -2
  277. package/dist/typography/base.svelte +0 -2
  278. package/dist/typography/index.js +0 -1
  279. package/dist/typography/interface.d.ts +0 -1
  280. package/dist/typography/internal.d.ts +0 -2
  281. package/dist/upload/file-card.svelte +0 -1
  282. package/dist/upload/index.js +0 -1
  283. package/dist/upload/interface.d.ts +0 -4
  284. package/dist/upload/upload.svelte +0 -1
  285. package/dist/user-guide/interface.d.ts +0 -1
  286. package/dist/user-guide/user-guide.svelte +0 -1
  287. package/dist/video-player/video-progress.svelte +0 -2
  288. package/package.json +4 -4
@@ -87,8 +87,6 @@
87
87
 
88
88
  const prefix = cssClasses.PREFIX;
89
89
  const more = outerMore?.layer === layer ? outerMore : undefined;
90
-
91
- // An avatar in the `more` content keeps its own size and shape and only falls back to the group's
92
90
  const size = $derived(ownSize ?? more?.size ?? defaults('size', 'medium'));
93
91
  const shape = $derived(ownShape ?? more?.shape ?? defaults('shape', 'circle'));
94
92
  const clickable = $derived(rest.onclick !== undefined);
@@ -110,7 +108,6 @@
110
108
  const borderClass = $derived([`${prefix}-additionalBorder`, `${prefix}-additionalBorder-${size}`, `${prefix}-${shape}`]);
111
109
  const borderColor = $derived(typeof border === 'object' ? border.color : undefined);
112
110
 
113
- // Avatars nested in this one's content are not items of the group
114
111
  setAvatarGroupMoreContext(undefined);
115
112
 
116
113
  const handleKeyDown = (event: KeyboardEvent & { currentTarget: HTMLElement }) => {
@@ -154,7 +151,6 @@
154
151
  isText = nextIsText;
155
152
  text = nextIsText ? next : undefined;
156
153
  if (changed) {
157
- // the scale spans exist after this flush
158
154
  void tick().then(foundation.changeScale);
159
155
  }
160
156
  };
@@ -1,6 +1,5 @@
1
1
  import type { AvatarShape } from './interface.js';
2
2
  export interface AvatarGroupMoreValue {
3
- /** The popup layer the `more` content renders in */
4
3
  readonly layer?: symbol;
5
4
  readonly size?: string;
6
5
  readonly shape?: AvatarShape;
@@ -10,7 +10,6 @@ export interface AvatarTopSlot {
10
10
  textColor?: string;
11
11
  className?: string;
12
12
  style?: string;
13
- /** Replaces the whole top mark */
14
13
  render?: Snippet;
15
14
  }
16
15
  export interface AvatarBottomSlot {
@@ -19,7 +18,6 @@ export interface AvatarBottomSlot {
19
18
  textColor?: string;
20
19
  className?: string;
21
20
  style?: string;
22
- /** Replaces the whole bottom mark */
23
21
  render?: Snippet;
24
22
  }
25
23
  export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'onmouseenter' | 'onmouseleave'> {
@@ -58,7 +56,6 @@ export interface AvatarGroupItemContext {
58
56
  }
59
57
  export interface AvatarGroupMoreContext {
60
58
  restNumber: number;
61
- /** The hidden items, in order */
62
59
  restAvatars: AvatarGroupItem[];
63
60
  }
64
61
  export interface AvatarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
@@ -69,6 +66,5 @@ export interface AvatarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, '
69
66
  items?: AvatarGroupItem[];
70
67
  /** Content of every avatar, taking precedence over the item's own `children` */
71
68
  item?: Snippet<[AvatarGroupItemContext]>;
72
- /** Replaces the default `+N` avatar */
73
69
  more?: Snippet<[AvatarGroupMoreContext]>;
74
70
  }
@@ -39,7 +39,6 @@
39
39
 
40
40
  let button = $state<HTMLElement>();
41
41
 
42
- // the foundation reads the props through getters, since $props() cannot be handed over as one object
43
42
  const { foundation, states } = useFoundation<Foundation, Adapter, BackTopBaseProps, BackTopState>(
44
43
  BackTopFoundation,
45
44
  {
@@ -66,7 +65,6 @@
66
65
  const ariaLabel = $derived(rest['aria-label'] ?? (children ? undefined : locale().locale.backToTop));
67
66
  const throttledClick = $derived(throttle((event: ClickEvent) => foundation.onClick(event), duration));
68
67
 
69
- // FloatButton hands its rest props, attachments included, to the native button
70
68
  const captureButton: Attachment<HTMLElement> = (node) => {
71
69
  button = node;
72
70
  return () => {
@@ -5,7 +5,6 @@ export interface BackTopProps extends Omit<FloatButtonProps, 'children' | 'disab
5
5
  duration?: number;
6
6
  /** The scrolled element; defaults to the window. Read on mount and whenever the function itself changes */
7
7
  target?: () => Window | HTMLElement | null;
8
- /** The button shows once the target is scrolled beyond this many pixels */
9
8
  visibilityHeight?: number;
10
9
  /** Static content of the button, shown in place of the icon; must not contain interactive elements */
11
10
  children?: Snippet;
@@ -14,6 +14,5 @@ export interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'child
14
14
  overflowCount?: number;
15
15
  countClassName?: string;
16
16
  countStyle?: string;
17
- /** The element the badge is attached to */
18
17
  children?: Snippet;
19
18
  }
@@ -61,7 +61,7 @@
61
61
  </script>
62
62
 
63
63
  {#if states().visible}
64
- <div {...rest} class={[prefix, `${prefix}-${type}`, rest.class, fullMode ? `${prefix}-full` : `${prefix}-in-container`, { [`${prefix}-bordered`]: !fullMode && bordered }]} role="alert">
64
+ <div {...rest} class={[prefix, `${prefix}-${type}`, rest.class, fullMode ? `${prefix}-full` : `${prefix}-in-container`, { [`${prefix}-bordered`]: !fullMode && bordered }]}>
65
65
  <div class={`${prefix}-content-wrapper`}>
66
66
  <div class={`${prefix}-content`}>
67
67
  {#if icon !== null}
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  export type BannerType = 'info' | 'danger' | 'warning' | 'success';
4
- export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'role'> {
4
+ export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
5
  bordered?: boolean;
6
6
  fullMode?: boolean;
7
7
  title?: string | Snippet;
@@ -9,10 +9,8 @@ export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
9
9
  /** The close button's click event; the banner hides right after the callback returns */
10
10
  onClose?: (event: MouseEvent) => void;
11
11
  description?: Snippet;
12
- /** Replaces the icon of the type; `null` hides the icon */
13
12
  icon?: Snippet | null;
14
13
  /** Replaces the icon of the close button; `null` removes the button */
15
14
  closeIcon?: Snippet | null;
16
- /** Content below the message, in the `-extra` area */
17
15
  children?: Snippet;
18
16
  }
@@ -18,7 +18,6 @@
18
18
  type Foundation = BreadcrumbItemFoundation<Pick<ItemProps, 'route'>, object, MouseEvent>;
19
19
  type Adapter = BreadcrumbItemAdapter<Pick<ItemProps, 'route'>, object, MouseEvent>;
20
20
 
21
- // Only the Breadcrumb renders items; `rest` holds the route's data-* attributes
22
21
  const { route, index, active, shouldRenderSeparator, ...rest }: ItemProps = $props();
23
22
 
24
23
  const context = getBreadcrumbContext('Breadcrumb item');
@@ -78,7 +78,6 @@
78
78
  BreadcrumbFoundation.genRoutes(routes).map((route, index) => ({
79
79
  index,
80
80
  route: route._origin,
81
- // Only the Item attributes a route may set stay; other route fields stay off the DOM
82
81
  attrs: getDataAttr(route) as Record<`data-${string}`, string>,
83
82
  key: String(route._origin.key || `item-${route.name || route.path}-${index}`),
84
83
  }))
@@ -2,7 +2,6 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
  import type { IconSize } from '@fibrae/semi-icons-svelte';
4
4
  import type { ShowTooltip } from '../typography/interface.js';
5
- /** A route of the `routes` prop. A custom title is the `item` snippet and the icon is the `icon` snippet */
6
5
  export interface BreadcrumbRoute {
7
6
  [x: string]: unknown;
8
7
  name?: string;
@@ -20,21 +19,17 @@ export interface BreadcrumbShowTooltip {
20
19
  opts?: ShowTooltip['opts'];
21
20
  }
22
21
  export type BreadcrumbMoreType = 'default' | 'popover';
23
- /** A string route arrives as `{ name }` */
24
22
  export type BreadcrumbClick = (route: BreadcrumbRoute, event: MouseEvent) => void;
25
23
  export interface BreadcrumbRouteContext {
26
- /** The route as passed in */
27
24
  route: BreadcrumbRoute;
28
25
  /** Counts every route, the collapsed ones included */
29
26
  index: number;
30
27
  }
31
28
  export interface BreadcrumbIconContext extends BreadcrumbRouteContext {
32
- /** Pass both to the icon: `<IconHome {size} class={className} />` */
33
29
  size: IconSize;
34
30
  class: string;
35
31
  }
36
32
  export interface BreadcrumbMoreContext {
37
- /** The collapsed routes, in order */
38
33
  restItems: BreadcrumbRouteContext[];
39
34
  }
40
35
  export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
@@ -44,7 +39,6 @@ export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
44
39
  maxItemCount?: number;
45
40
  moreType?: BreadcrumbMoreType;
46
41
  routes?: Array<BreadcrumbRoute | string>;
47
- /** Text, or a snippet rendered after every item */
48
42
  separator?: string | Snippet;
49
43
  showTooltip?: boolean | BreadcrumbShowTooltip;
50
44
  /**
@@ -55,6 +49,5 @@ export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
55
49
  /** Custom title of every item; rendered inline, without the truncating text */
56
50
  item?: Snippet<[BreadcrumbRouteContext]>;
57
51
  icon?: Snippet<[BreadcrumbIconContext]>;
58
- /** Content of the more button in place of the icon */
59
52
  more?: Snippet<[BreadcrumbMoreContext]>;
60
53
  }
@@ -37,7 +37,6 @@
37
37
  ...rest
38
38
  }: CalendarProps = $props();
39
39
 
40
- // One "today" source per Calendar; the views read it.
41
40
  const today = useToday();
42
41
 
43
42
  // Without displayValue the first frame shows the current date, so server rendering passes displayValue to make the server and the browser agree
@@ -36,8 +36,6 @@
36
36
  const prefixCls = `${cssClasses.PREFIX}-day`;
37
37
  const allDayCls = `${cssClasses.PREFIX}-all-day`;
38
38
  const parsedEvents = $derived(CalendarFoundation.getParseDailyEvents(events, displayValue));
39
-
40
- // every view hands the dateGrid snippet the day's midnight, not the caller's time of day
41
39
  const dayStart = $derived(startOfDay(displayValue));
42
40
  const isWeekend = $derived(markWeekend && checkWeekend(displayValue));
43
41
  </script>
@@ -79,7 +77,6 @@
79
77
  <div class={`${prefixCls}-scroll-wrapper`} role="rowgroup">
80
78
  <div {@attach grid.observe} bind:this={scroll} class={`${prefixCls}-scroll`} role="row">
81
79
  <TimeCol class={`${prefixCls}-sticky-left`} {timeDisplay} />
82
- <!-- a new day, a new showCurrTime or a day that becomes today gets a new column, which decides again whether to show the line -->
83
80
  {#key `${dayStart.toDateString()}|${showCurrTime}|${today !== null && isSameDay(dayStart, today)}`}
84
81
  <DayCol {dateGrid} displayValue={dayStart} {event} events={parsedEvents.day} {isWeekend} {minEventHeight} onSlotClick={(mouseEvent, value) => onClick?.(mouseEvent, value)} scrollHeight={grid.scrollHeight()} {showCurrTime} />
85
82
  {/key}
@@ -13,7 +13,6 @@ export interface EventObject {
13
13
  children?: string | number;
14
14
  }
15
15
  export interface CalendarEventArgs {
16
- /** The object from `events`, found by its key */
17
16
  event: EventObject;
18
17
  }
19
18
  export interface CalendarDateDisplayArgs {
@@ -51,19 +50,12 @@ export interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
51
50
  header?: Snippet;
52
51
  /** Content of an event, called once per place the event shows. Defaults to the event's `children` text */
53
52
  event?: Snippet<[CalendarEventArgs]>;
54
- /** The date in a week or range column header and in every month cell. Not used by the day view */
55
53
  dateDisplay?: Snippet<[CalendarDateDisplayArgs]>;
56
- /** Extra content in every day column, or in every month cell */
57
54
  dateGrid?: Snippet<[CalendarDateGridArgs]>;
58
- /** The hour labels from 1 to 23 */
59
55
  timeDisplay?: Snippet<[CalendarTimeDisplayArgs]>;
60
56
  /** Replaces the all-day events of the day, week and range views; renders `li` items */
61
57
  allDayEvents?: Snippet<[CalendarAllDayEventsArgs]>;
62
58
  }
63
- /**
64
- * What every view takes from Calendar, which resolves `mode`, `range` and the defaults: every other attribute goes to
65
- * the view's root element
66
- */
67
59
  export interface CalendarViewProps extends Pick<CalendarProps, 'width' | 'height' | 'header' | 'event' | 'dateGrid' | 'onClick'>, Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onclick' | 'onclose'> {
68
60
  events: EventObject[];
69
61
  markWeekend: boolean;
@@ -79,7 +79,6 @@
79
79
  const weekCount = $derived(Object.keys(monthlyData).length);
80
80
  const stale = $derived(CalendarFoundation.isOpenCardStale(openCardKey, monthlyData, parsedEvents, itemLimit));
81
81
 
82
- // A day's events are a sparse array indexed by row, so the holes are dropped before listing or counting them.
83
82
  const weeks = $derived(
84
83
  Object.values(monthlyData).map((weekDays, weekInd) => {
85
84
  const parsed = parsedEvents[weekInd];
@@ -103,7 +102,6 @@
103
102
 
104
103
  const isOpen = (key: string) => states().showCard[key] ?? false;
105
104
 
106
- // rows split the grid height evenly; the last row is measured because it always renders
107
105
  const measure = () => {
108
106
  const row = grid?.lastElementChild;
109
107
  if (row) {
@@ -113,7 +111,6 @@
113
111
 
114
112
  const observe = observeResize(measure);
115
113
 
116
- // Registers an element under its day's key for as long as it is mounted
117
114
  const track =
118
115
  <E extends HTMLElement>(map: Map<string, E>, key: string): Attachment<E> =>
119
116
  (element) => {
@@ -233,7 +230,6 @@
233
230
  {#each weeks as week, weekInd (weekInd)}
234
231
  <div class={`${prefixCls}-weekrow`}>
235
232
  <div class={`${prefixCls}-skeleton`} role="row">
236
- <!-- a collapsed day is the anchor of its "more" card -->
237
233
  {#each week.days as day (day.date.valueOf())}
238
234
  {#if day.hidden > 0}
239
235
  <Popover aria-labelledby={day.titleId} bind:visible={() => isOpen(day.key), () => {}} onEscKeyDown={(keyEvent) => closeCardToMore(keyEvent, day.key)} position="leftTopOver" trigger="custom">
@@ -13,7 +13,6 @@
13
13
 
14
14
  interface Props extends CalendarViewProps, Pick<CalendarProps, 'dateDisplay' | 'timeDisplay' | 'allDayEvents'> {
15
15
  range: Date[];
16
- /** The date whose month names the grid; the first day of the range by default */
17
16
  labelDate?: Date;
18
17
  minEventHeight?: number;
19
18
  showCurrTime: boolean;
@@ -94,7 +93,6 @@
94
93
  {#if allDayEvents}
95
94
  {@render allDayEvents({ events })}
96
95
  {:else}
97
- <!-- positioned spans always carry leftPos, width and topInd; the foundation type keeps them optional -->
98
96
  {#each withKeys(allDayItems, 'allDay') as { id, item } (id)}
99
97
  <li class={[`${cssClasses.PREFIX}-event-item`, `${cssClasses.PREFIX}-event-allday`]} style:left={toPercent(item.leftPos ?? 0)} style:top={`${item.topInd ?? 0}em`} style:width={toPercent(item.width ?? 0)}>
100
98
  {#if event}
@@ -1,7 +1,6 @@
1
1
  import type { CalendarProps, CalendarViewProps, WeekStartsOn } from './interface.js';
2
2
  interface Props extends CalendarViewProps, Pick<CalendarProps, 'dateDisplay' | 'timeDisplay' | 'allDayEvents'> {
3
3
  range: Date[];
4
- /** The date whose month names the grid; the first day of the range by default */
5
4
  labelDate?: Date;
6
5
  minEventHeight?: number;
7
6
  showCurrTime: boolean;
@@ -1,4 +1,3 @@
1
- /** The timestamp of today's local midnight; used while the first frame has no `today` */
2
1
  export declare const snapshotToday: () => number;
3
2
  /**
4
3
  * The timestamp of today's local midnight, kept current while mounted. `null` until mounted so the server render and
@@ -2,7 +2,6 @@ import { onMount } from 'svelte';
2
2
  import { startOfDay } from 'date-fns';
3
3
  import { getCurrDate } from '@fibrae/semi-foundation/calendar/event-util';
4
4
  import CalendarFoundation from '@fibrae/semi-foundation/calendar/foundation';
5
- /** The timestamp of today's local midnight; used while the first frame has no `today` */
6
5
  export const snapshotToday = () => startOfDay(getCurrDate()).getTime();
7
6
  /**
8
7
  * The timestamp of today's local midnight, kept current while mounted. `null` until mounted so the server render and
@@ -1,6 +1,5 @@
1
1
  import CardBase from './card.svelte';
2
2
  import CardMetaPart from './meta.svelte';
3
- // Svelte components are functions, so the part attaches to the component itself
4
3
  export const Card = Object.assign(CardBase, { Meta: CardMetaPart });
5
4
  export { default as CardGroup } from './card-group.svelte';
6
5
  export { default as CardMeta } from './meta.svelte';
@@ -4,7 +4,6 @@ import type { SpaceProps } from '../space/interface.js';
4
4
  export type Shadows = 'hover' | 'always';
5
5
  export type CardGroupType = 'grid';
6
6
  export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
7
- /** Content area inline style */
8
7
  bodyStyle?: string;
9
8
  bordered?: boolean;
10
9
  footerLine?: boolean;
@@ -16,10 +15,8 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
16
15
  /** A string renders as a 6th-level title with a single-line ellipsis tooltip; a snippet renders as it is */
17
16
  title?: string | Snippet;
18
17
  headerExtraContent?: Snippet;
19
- /** Replaces the title and headerExtraContent */
20
18
  header?: Snippet;
21
19
  cover?: Snippet;
22
- /** One snippet per action */
23
20
  actions?: Snippet[];
24
21
  footer?: Snippet;
25
22
  children?: Snippet;
@@ -51,8 +51,6 @@
51
51
 
52
52
  // Used to find the indicator tab to focus, from the root: slides may contain tabs or nested carousels
53
53
  let root: HTMLElement | undefined;
54
-
55
- // the roving tabindex moves with the current slide, so focus follows it after a key changed it
56
54
  let focusPending = false;
57
55
 
58
56
  // Slides that arrive after mount (data still loading) start the configured autoplay, as mounting with them would
@@ -62,7 +60,6 @@
62
60
  let leftNamed = $state(false);
63
61
  let rightNamed = $state(false);
64
62
 
65
- // $bindable needs destructuring, so the foundation reads the props through getters
66
63
  const foundationProps: CarouselBaseProps = {
67
64
  get activeIndex() {
68
65
  return activeIndex;
@@ -84,7 +81,6 @@
84
81
  },
85
82
  (base) => ({
86
83
  notifyChange: (next, preIndex) => {
87
- // the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
88
84
  activeIndex = next;
89
85
  onChange?.(next, preIndex);
90
86
  },
@@ -1,7 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
3
  import type { CarouselAutoPlay } from '@fibrae/semi-foundation/carousel/foundation';
4
- /** Data for one arrow button; `onclick` and `class` merge with the built-in handler and classes */
5
4
  export interface ArrowButton {
6
5
  props?: HTMLButtonAttributes;
7
6
  }
@@ -34,9 +33,7 @@ export interface CarouselProps<T = unknown> extends Omit<HTMLAttributes<HTMLDivE
34
33
  onChange?: (activeIndex: number, preIndex: number) => void;
35
34
  /** The content of one slide; the carousel wraps it in the element that carries the slide's classes, role and `inert` */
36
35
  slide: Snippet<[CarouselSlideContext<T>]>;
37
- /** Replaces the icon of the previous arrow */
38
36
  leftArrow?: Snippet;
39
- /** Replaces the icon of the next arrow */
40
37
  rightArrow?: Snippet;
41
38
  }
42
39
  export interface CarouselState {
@@ -141,7 +141,6 @@
141
141
  const selectionTextId = `${uid}-selection`;
142
142
  const cls = cssClasses.PREFIX;
143
143
 
144
- // $bindable needs destructuring, so the foundation reads the props through getters
145
144
  const foundationProps: BasicCascaderProps = {
146
145
  get autoMergeValue() {
147
146
  return autoMergeValue;
@@ -226,7 +225,6 @@
226
225
  if (searchInput) {
227
226
  searchInput.focus({ preventScroll });
228
227
  } else if (tagInput) {
229
- // TagInput reads preventScroll from its own prop
230
228
  tagInput.focus();
231
229
  } else {
232
230
  triggerEl?.focus({ preventScroll });
@@ -238,7 +236,6 @@
238
236
  },
239
237
  updateStates: (next) => base.setState(next as BasicCascaderInnerData),
240
238
  notifyChange: (next) => {
241
- // the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
242
239
  value = next as CascaderValue;
243
240
  onChange?.(next as CascaderChangeValue);
244
241
  },
@@ -279,7 +276,6 @@
279
276
  })
280
277
  );
281
278
 
282
- // controlled values and the multiple-mode tree are derived here, so they reach the DOM in the render that receives them
283
279
  const view: BasicCascaderInnerData = $derived(multiple ? { ...states(), ...CascaderFoundation.deriveMultipleState(foundationProps, states()) } : states());
284
280
  const renderData = $derived(CascaderFoundation.getRenderData(foundationProps, view));
285
281
  const isEmpty = $derived(!renderData.length);
@@ -342,7 +338,6 @@
342
338
 
343
339
  const triggerSnippetProps: CascaderTriggerSnippetProps = $derived.by(() => {
344
340
  const { keyEntities, checkedKeys, resolvedCheckedKeys, selectedKeys } = view;
345
- // the trigger gets positions; mergeType decides which checked set they come from, whatever checkRelation is
346
341
  const keys = mergeType === strings.NONE_MERGE_TYPE ? checkedKeys : resolvedCheckedKeys;
347
342
  return {
348
343
  value: multiple ? new Set([...keys].map((key) => keyEntities[key]?.pos)) : keyEntities[[...selectedKeys][0]]?.pos,
@@ -692,7 +687,6 @@
692
687
  {/snippet}
693
688
 
694
689
  {#snippet triggerNode({ props }: { props: TooltipTriggerProps })}
695
- <!-- the combobox is the Tab stop -->
696
690
  <div
697
691
  bind:this={triggerEl}
698
692
  {...props}
@@ -10,12 +10,10 @@ import type { Position } from '../tooltip/index.js';
10
10
  export type CascaderKeyMapProps = KeyMapProps;
11
11
  export type CascaderSize = Size;
12
12
  export type CascaderVirtualize = Virtualize;
13
- /** A node of `treeData`; markup for its label goes in the `label` snippet */
14
13
  export interface CascaderData extends BasicCascaderData {
15
14
  label: string | number;
16
15
  children?: CascaderData[];
17
16
  }
18
- /** A node of `treeData` with its place in the tree */
19
17
  export interface CascaderEntity extends BasicEntity {
20
18
  children?: CascaderEntity[];
21
19
  data: CascaderData;
@@ -24,7 +22,6 @@ export interface CascaderEntity extends BasicEntity {
24
22
  export interface CascaderScrollPanelProps extends BasicScrollPanelProps {
25
23
  activeNode: CascaderData;
26
24
  }
27
- /** The basic type of the value of Cascader */
28
25
  export type CascaderSimpleValue = string | number | CascaderData;
29
26
  /** A single-mode value is one node or its path; a multiple-mode value may also be a list of paths */
30
27
  export type CascaderValue = CascaderSimpleValue | CascaderSimpleValue[] | CascaderSimpleValue[][];
@@ -34,7 +31,6 @@ export interface CascaderLabelSnippetProps {
34
31
  item: CascaderData;
35
32
  }
36
33
  export interface CascaderDisplaySnippetProps {
37
- /** The `displayProp` of each node on the selected path */
38
34
  labels: Array<string | number>;
39
35
  /**
40
36
  * The nodes on the selected path; a value not found in `treeData` gives its raw values instead, as `onChange`
@@ -49,44 +45,36 @@ export interface CascaderTagSnippetProps {
49
45
  /** Unchecks the node; a given event has its default prevented, so a Tag wired to it does not hide itself */
50
46
  onClose: (event?: TagCloseEvent) => void;
51
47
  }
52
- /** What a custom search result row spreads on its element: the combobox's aria-activedescendant points at the id */
53
48
  export interface CascaderFilterItemDomProps {
54
49
  id: string;
55
50
  role: 'option';
56
51
  'aria-selected': boolean;
57
52
  'aria-disabled'?: true;
58
53
  class: ClassValue;
59
- /** Only in virtual results: the row's position */
60
54
  style?: string;
61
55
  onclick: (event: MouseEvent) => void;
62
56
  }
63
57
  export interface CascaderFilterItemSnippetProps {
64
- /** Spread it on the row's element: `<li {...props}>` */
65
58
  props: CascaderFilterItemDomProps;
66
59
  inputValue: string;
67
60
  disabled: boolean;
68
- /** The nodes of the path */
69
61
  data: CascaderData[];
70
62
  checkStatus: {
71
63
  checked: boolean;
72
64
  halfChecked: boolean;
73
65
  };
74
66
  selected: boolean;
75
- /** For the `onChange` of a Checkbox in the row */
76
67
  onCheck: (event: CheckboxEvent) => void;
77
68
  }
78
69
  export interface CascaderTriggerSnippetProps {
79
70
  /** The position in treeData (such as `0-0-1`) of the selected node, or in multiple mode of each checked node */
80
71
  value: string | Set<string> | undefined;
81
- /** The search keyword; the selected path's text while closed in single mode */
82
72
  inputValue: string;
83
73
  placeholder?: string;
84
74
  disabled: boolean;
85
- /** Updates the search keyword */
86
75
  onSearch: (inputValue: string) => void;
87
76
  /** Pass the click event when bound to a control inside the trigger, so the click does not open the dropdown */
88
77
  onClear: (event?: MouseEvent) => void;
89
- /** Unchecks the node at a position of `value` */
90
78
  onRemove: (pos: string) => void;
91
79
  }
92
80
  type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect' | 'onfocus' | 'onblur' | 'onkeydown';
@@ -112,7 +100,6 @@ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
112
100
  /** Loads the children of the last node; a node without `isLeaf` shows the expand arrow while it is set */
113
101
  loadData?: (selectOptions: CascaderData[]) => Promise<void>;
114
102
  filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string, data?: CascaderData) => boolean);
115
- /** `first` and `second` are the two result paths, from the root to the matched node */
116
103
  filterSorter?: (first: CascaderData[], second: CascaderData[], inputValue: string) => number;
117
104
  filterLeafOnly?: boolean;
118
105
  treeNodeFilterProp?: string;
@@ -161,21 +148,15 @@ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
161
148
  * options still take the key
162
149
  */
163
150
  onKeyDown?: (event: KeyboardEvent) => void;
164
- /** Content of an option of the tree; the search results, the selection and the tags show the label text */
165
151
  label?: Snippet<[CascaderLabelSnippetProps]>;
166
- /** The selection in single mode */
167
152
  display?: Snippet<[CascaderDisplaySnippetProps]>;
168
- /** Replaces each tag in multiple mode */
169
153
  tag?: Snippet<[CascaderTagSnippetProps]>;
170
- /** Replaces a row of the search results */
171
154
  filterItem?: Snippet<[CascaderFilterItemSnippetProps]>;
172
- /** Replaces the trigger content */
173
155
  trigger?: Snippet<[CascaderTriggerSnippetProps]>;
174
156
  expandIcon?: Snippet;
175
157
  /** `null` hides the arrow */
176
158
  arrowIcon?: Snippet | null;
177
159
  clearIcon?: Snippet;
178
- /** `null` hides the empty state */
179
160
  emptyContent?: Snippet | null;
180
161
  prefix?: Snippet;
181
162
  suffix?: Snippet;
@@ -11,7 +11,6 @@
11
11
  import { Spin } from '../spin/index.js';
12
12
  import type { CascaderData, CascaderEntity, CascaderFilterItemSnippetProps, CascaderLabelSnippetProps, CascaderVirtualize } from './interface.js';
13
13
 
14
- /** The tree or the search results of a Cascader; not a public component */
15
14
  interface SearchData extends BasicData {
16
15
  data: CascaderData;
17
16
  pathData?: CascaderData[];
@@ -25,7 +24,6 @@
25
24
  checkedKeys: Set<string>;
26
25
  halfCheckedKeys: Set<string>;
27
26
  showNext: 'click' | 'hover';
28
- /** The search results, a listbox, rather than the tree */
29
27
  searchable: boolean;
30
28
  keyword: string;
31
29
  /** A node without isLeaf is a branch while loadData is set */
@@ -36,10 +34,8 @@
36
34
  virtualize?: CascaderVirtualize;
37
35
  /** Id of the tree, or of the listbox of search results; the combobox's aria-controls points at it */
38
36
  id: string;
39
- /** The popup's name, the same as the combobox's */
40
37
  ariaLabel?: string;
41
38
  ariaLabelledby?: string;
42
- /** The option the arrow keys are on, pointed at by the combobox's aria-activedescendant */
43
39
  keyboardKey: string | null;
44
40
  optionId: (key: string) => string;
45
41
  label?: Snippet<[CascaderLabelSnippetProps]>;
@@ -1,7 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import { type BasicData } from '@fibrae/semi-foundation/cascader/foundation';
3
3
  import type { CascaderData, CascaderEntity, CascaderFilterItemSnippetProps, CascaderLabelSnippetProps, CascaderVirtualize } from './interface.js';
4
- /** The tree or the search results of a Cascader; not a public component */
5
4
  interface SearchData extends BasicData {
6
5
  data: CascaderData;
7
6
  pathData?: CascaderData[];
@@ -14,7 +13,6 @@ interface ItemProps {
14
13
  checkedKeys: Set<string>;
15
14
  halfCheckedKeys: Set<string>;
16
15
  showNext: 'click' | 'hover';
17
- /** The search results, a listbox, rather than the tree */
18
16
  searchable: boolean;
19
17
  keyword: string;
20
18
  /** A node without isLeaf is a branch while loadData is set */
@@ -25,10 +23,8 @@ interface ItemProps {
25
23
  virtualize?: CascaderVirtualize;
26
24
  /** Id of the tree, or of the listbox of search results; the combobox's aria-controls points at it */
27
25
  id: string;
28
- /** The popup's name, the same as the combobox's */
29
26
  ariaLabel?: string;
30
27
  ariaLabelledby?: string;
31
- /** The option the arrow keys are on, pointed at by the combobox's aria-activedescendant */
32
28
  keyboardKey: string | null;
33
29
  optionId: (key: string) => string;
34
30
  label?: Snippet<[CascaderLabelSnippetProps]>;
@@ -33,7 +33,6 @@
33
33
  ...rest
34
34
  }: CheckboxGroupProps = $props();
35
35
 
36
- // One name per group, so form submission never mixes groups.
37
36
  const uid = $props.id();
38
37
 
39
38
  // role="group" supports none of these. aria-invalid and aria-errormessage go to each checkbox (the role supports
@@ -41,7 +40,6 @@
41
40
  // Tooltip injects the rest for a dialog trigger, and tabindex would add a stray Tab stop.
42
41
  const DROPPED_ATTRS = new Set(['aria-invalid', 'aria-errormessage', 'aria-required', 'aria-expanded', 'aria-haspopup', 'aria-controls', 'tabindex', 'tabIndex']);
43
42
 
44
- // $bindable needs destructuring, so the foundation reads the props through getters
45
43
  const foundationProps: CheckboxGroupBaseProps = {
46
44
  get value() {
47
45
  return value;
@@ -55,7 +53,6 @@
55
53
  (base) => ({
56
54
  updateGroupValue: (next) => base.setState({ value: next }),
57
55
  notifyChange: (next) => {
58
- // the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
59
56
  value = next;
60
57
  onChange?.(next);
61
58
  },
@@ -43,7 +43,6 @@
43
43
  let input = $state<HTMLInputElement>();
44
44
  let root = $state<HTMLSpanElement>();
45
45
 
46
- // $bindable needs destructuring, so the foundation reads the props through getters
47
46
  const foundationProps: BaseCheckboxProps = {
48
47
  get checked() {
49
48
  return checked;
@@ -63,7 +62,6 @@
63
62
  (base) => ({
64
63
  setChecked: (next) => base.setState({ checked: next }),
65
64
  notifyChange: (event) => {
66
- // the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
67
65
  checked = event.target.checked;
68
66
  onChange?.(event as CheckboxEvent);
69
67
  },
@@ -107,8 +105,6 @@
107
105
  const labelledby = $derived(joinIds(rest['aria-labelledby'], children ? addonDomId : undefined));
108
106
  const tooltip = $derived(bindTrigger());
109
107
  const describedby = $derived(joinIds(rest['aria-describedby'], extra ? extraDomId : undefined, tooltip?.['aria-describedby']));
110
-
111
- // aria-*, id, tabindex, autofocus and focus listeners name and focus the input, the only focus target
112
108
  const attrs = $derived(splitControlAttrs(rest, isNativeInputKey));
113
109
 
114
110
  // The root is a span rather than a label so that text clicks and box clicks share this one handler (gitlab #364).