@fibrae/semi-foundation 0.1.1 → 0.3.0

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 (282) hide show
  1. package/dist/anchor/foundation.d.ts +1 -4
  2. package/dist/anchor/foundation.js +21 -22
  3. package/dist/audio-player/foundation.d.ts +10 -13
  4. package/dist/audio-player/foundation.js +19 -20
  5. package/dist/auto-complete/foundation.d.ts +12 -14
  6. package/dist/auto-complete/foundation.js +51 -52
  7. package/dist/avatar/foundation.d.ts +5 -6
  8. package/dist/avatar/foundation.js +16 -16
  9. package/dist/avatar/variables.scss +0 -1
  10. package/dist/backtop/foundation.d.ts +2 -5
  11. package/dist/backtop/foundation.js +7 -8
  12. package/dist/banner/foundation.d.ts +1 -1
  13. package/dist/banner/foundation.js +4 -4
  14. package/dist/base/auto-close-foundation.d.ts +8 -9
  15. package/dist/base/auto-close-foundation.js +15 -15
  16. package/dist/base/foundation.d.ts +4 -4
  17. package/dist/base/foundation.js +12 -11
  18. package/dist/base/list-store.d.ts +0 -1
  19. package/dist/breadcrumb/foundation.d.ts +5 -5
  20. package/dist/breadcrumb/foundation.js +9 -10
  21. package/dist/breadcrumb/item-foundation.d.ts +3 -3
  22. package/dist/breadcrumb/item-foundation.js +6 -6
  23. package/dist/calendar/event-util.d.ts +0 -10
  24. package/dist/calendar/event-util.js +1 -11
  25. package/dist/calendar/foundation.d.ts +1 -6
  26. package/dist/calendar/foundation.js +5 -9
  27. package/dist/calendar/month-foundation.d.ts +2 -3
  28. package/dist/calendar/month-foundation.js +6 -7
  29. package/dist/carousel/foundation.d.ts +17 -19
  30. package/dist/carousel/foundation.js +51 -51
  31. package/dist/cascader/foundation.d.ts +36 -32
  32. package/dist/cascader/foundation.js +145 -132
  33. package/dist/cascader/util.d.ts +1 -8
  34. package/dist/cascader/util.js +1 -8
  35. package/dist/checkbox/checkbox-foundation.d.ts +3 -7
  36. package/dist/checkbox/checkbox-foundation.js +15 -17
  37. package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
  38. package/dist/checkbox/checkbox-group-foundation.js +8 -8
  39. package/dist/code-highlight/index.d.ts +1 -2
  40. package/dist/code-highlight/index.js +3 -3
  41. package/dist/collapse/foundation.d.ts +2 -2
  42. package/dist/collapse/foundation.js +7 -7
  43. package/dist/collapsible/foundation.d.ts +3 -3
  44. package/dist/collapsible/foundation.js +8 -8
  45. package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
  46. package/dist/color-picker/alpha-slider-foundation.js +10 -10
  47. package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
  48. package/dist/color-picker/color-choose-area-foundation.js +14 -14
  49. package/dist/color-picker/color-picker.scss +0 -2
  50. package/dist/color-picker/color-slider-foundation.d.ts +2 -4
  51. package/dist/color-picker/color-slider-foundation.js +10 -10
  52. package/dist/color-picker/data-part-foundation.d.ts +5 -5
  53. package/dist/color-picker/data-part-foundation.js +11 -11
  54. package/dist/color-picker/foundation.d.ts +4 -4
  55. package/dist/color-picker/foundation.js +10 -10
  56. package/dist/color-picker/interface.d.ts +0 -1
  57. package/dist/config-provider/breakpoint-observer.d.ts +3 -3
  58. package/dist/config-provider/breakpoint-observer.js +6 -6
  59. package/dist/config-provider/responsive-types.d.ts +0 -16
  60. package/dist/cropper/foundation.d.ts +15 -16
  61. package/dist/cropper/foundation.js +26 -24
  62. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  63. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  64. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  65. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  66. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  67. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  68. package/dist/date-picker/_utils/parser.d.ts +0 -3
  69. package/dist/date-picker/_utils/parser.js +0 -7
  70. package/dist/date-picker/_utils/picker-type.d.ts +1 -3
  71. package/dist/date-picker/_utils/picker-type.js +0 -2
  72. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  73. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  74. package/dist/date-picker/date-picker.scss +0 -3
  75. package/dist/date-picker/foundation.d.ts +39 -58
  76. package/dist/date-picker/foundation.js +126 -153
  77. package/dist/date-picker/input-foundation.d.ts +10 -16
  78. package/dist/date-picker/input-foundation.js +28 -30
  79. package/dist/date-picker/month-foundation.d.ts +0 -3
  80. package/dist/date-picker/month-foundation.js +0 -2
  81. package/dist/date-picker/months-grid-foundation.d.ts +17 -26
  82. package/dist/date-picker/months-grid-foundation.js +65 -75
  83. package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
  84. package/dist/date-picker/year-and-month-foundation.js +11 -11
  85. package/dist/drag-move/foundation.d.ts +2 -3
  86. package/dist/drag-move/foundation.js +15 -13
  87. package/dist/dropdown/foundation.d.ts +8 -7
  88. package/dist/dropdown/foundation.js +32 -28
  89. package/dist/dropdown/menu-foundation.d.ts +1 -2
  90. package/dist/dropdown/menu-foundation.js +11 -11
  91. package/dist/feedback/foundation.d.ts +9 -10
  92. package/dist/feedback/foundation.js +33 -33
  93. package/dist/feedback/variables.scss +1 -5
  94. package/dist/float-button/float-button.css +0 -1
  95. package/dist/float-button/float-button.scss +0 -2
  96. package/dist/form/form-api-proxy.d.ts +8 -7
  97. package/dist/form/form-api-proxy.js +25 -25
  98. package/dist/form/form.scss +0 -12
  99. package/dist/form/foundation.d.ts +5 -5
  100. package/dist/form/foundation.js +60 -76
  101. package/dist/form/interface.d.ts +2 -15
  102. package/dist/form/utils.d.ts +0 -8
  103. package/dist/form/utils.js +0 -7
  104. package/dist/form/variables.scss +1 -4
  105. package/dist/grid/variables.scss +0 -10
  106. package/dist/highlight/foundation.d.ts +0 -2
  107. package/dist/highlight/foundation.js +1 -3
  108. package/dist/hot-keys/foundation.d.ts +2 -3
  109. package/dist/hot-keys/foundation.js +5 -5
  110. package/dist/image/image-foundation.d.ts +4 -6
  111. package/dist/image/image-foundation.js +10 -10
  112. package/dist/image/preview-footer-foundation.d.ts +3 -4
  113. package/dist/image/preview-footer-foundation.js +10 -10
  114. package/dist/image/preview-foundation.d.ts +0 -3
  115. package/dist/image/preview-foundation.js +7 -6
  116. package/dist/image/preview-image-foundation.d.ts +6 -9
  117. package/dist/image/preview-image-foundation.js +14 -14
  118. package/dist/image/preview-inner-foundation.d.ts +9 -10
  119. package/dist/image/preview-inner-foundation.js +38 -38
  120. package/dist/input/foundation.d.ts +10 -11
  121. package/dist/input/foundation.js +47 -49
  122. package/dist/input/text-entry-foundation.d.ts +3 -5
  123. package/dist/input/text-entry-foundation.js +14 -15
  124. package/dist/input/textarea-foundation.d.ts +7 -8
  125. package/dist/input/textarea-foundation.js +36 -36
  126. package/dist/input-number/caret.d.ts +0 -1
  127. package/dist/input-number/caret.js +0 -1
  128. package/dist/input-number/foundation.d.ts +16 -19
  129. package/dist/input-number/foundation.js +54 -58
  130. package/dist/json-viewer/foundation.d.ts +8 -10
  131. package/dist/json-viewer/foundation.js +23 -24
  132. package/dist/locale/interface.d.ts +0 -3
  133. package/dist/lottie/foundation.d.ts +1 -1
  134. package/dist/lottie/foundation.js +4 -4
  135. package/dist/markdown-render/foundation.d.ts +2 -7
  136. package/dist/markdown-render/foundation.js +5 -9
  137. package/dist/modal/modal-content-foundation.d.ts +7 -7
  138. package/dist/modal/modal-content-foundation.js +20 -20
  139. package/dist/modal/modal-foundation.d.ts +6 -6
  140. package/dist/modal/modal-foundation.js +24 -24
  141. package/dist/navigation/foundation.d.ts +1 -8
  142. package/dist/navigation/foundation.js +14 -20
  143. package/dist/navigation/item-foundation.d.ts +1 -1
  144. package/dist/navigation/item-foundation.js +8 -8
  145. package/dist/navigation/sub-nav-foundation.d.ts +3 -4
  146. package/dist/navigation/sub-nav-foundation.js +17 -17
  147. package/dist/notification/notification-list-foundation.d.ts +7 -8
  148. package/dist/notification/notification-list-foundation.js +12 -13
  149. package/dist/notification/variables.scss +0 -1
  150. package/dist/overflow-list/foundation.d.ts +4 -6
  151. package/dist/overflow-list/foundation.js +18 -19
  152. package/dist/pagination/foundation.d.ts +8 -10
  153. package/dist/pagination/foundation.js +28 -28
  154. package/dist/pincode/foundation.d.ts +6 -9
  155. package/dist/pincode/foundation.js +23 -26
  156. package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
  157. package/dist/popconfirm/popconfirm-foundation.js +26 -26
  158. package/dist/progress/generates.d.ts +1 -4
  159. package/dist/progress/generates.js +1 -4
  160. package/dist/progress/utils.d.ts +1 -1
  161. package/dist/progress/utils.js +1 -1
  162. package/dist/radio/radio-foundation.d.ts +5 -9
  163. package/dist/radio/radio-foundation.js +15 -16
  164. package/dist/radio/radio-group-foundation.d.ts +2 -3
  165. package/dist/radio/radio-group-foundation.js +9 -9
  166. package/dist/rating/foundation.d.ts +10 -15
  167. package/dist/rating/foundation.js +35 -38
  168. package/dist/resizable/group/index.d.ts +6 -10
  169. package/dist/resizable/group/index.js +40 -44
  170. package/dist/resizable/resizable.scss +0 -1
  171. package/dist/resizable/single/index.d.ts +3 -7
  172. package/dist/resizable/single/index.js +10 -13
  173. package/dist/scroll-list/item-foundation.d.ts +7 -9
  174. package/dist/scroll-list/item-foundation.js +35 -36
  175. package/dist/scroll-list/variables.scss +1 -6
  176. package/dist/select/foundation.d.ts +42 -57
  177. package/dist/select/foundation.js +214 -279
  178. package/dist/select/option-foundation.d.ts +23 -28
  179. package/dist/select/option-foundation.js +10 -19
  180. package/dist/select/variables.scss +1 -8
  181. package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
  182. package/dist/side-sheet/side-sheet-foundation.js +23 -27
  183. package/dist/side-sheet/variables.scss +1 -3
  184. package/dist/slider/foundation.d.ts +17 -28
  185. package/dist/slider/foundation.js +47 -59
  186. package/dist/slider/variables.scss +1 -5
  187. package/dist/sortable/accessibility.d.ts +1 -1
  188. package/dist/sortable/accessibility.js +2 -2
  189. package/dist/spin/foundation.d.ts +2 -4
  190. package/dist/spin/foundation.js +6 -7
  191. package/dist/spin/variables.scss +1 -3
  192. package/dist/steps/utils.d.ts +1 -1
  193. package/dist/switch/foundation.d.ts +2 -3
  194. package/dist/switch/foundation.js +7 -7
  195. package/dist/switch/switch.scss +1 -1
  196. package/dist/switch/variables.scss +1 -5
  197. package/dist/table/foundation.d.ts +24 -33
  198. package/dist/table/foundation.js +144 -108
  199. package/dist/table/table.scss +0 -1
  200. package/dist/table/utils.d.ts +2 -10
  201. package/dist/table/utils.js +0 -13
  202. package/dist/table/variables.scss +1 -5
  203. package/dist/tabs/foundation.d.ts +5 -14
  204. package/dist/tabs/foundation.js +17 -21
  205. package/dist/tabs/tabs.scss +1 -1
  206. package/dist/tag/focus.js +0 -1
  207. package/dist/tag-input/foundation.d.ts +11 -13
  208. package/dist/tag-input/foundation.js +52 -53
  209. package/dist/tag-input/tag-input.scss +0 -1
  210. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  211. package/dist/tag-input/utils/tag-focus.js +0 -1
  212. package/dist/time-picker/combox-foundation.d.ts +3 -11
  213. package/dist/time-picker/combox-foundation.js +3 -10
  214. package/dist/time-picker/foundation.d.ts +13 -23
  215. package/dist/time-picker/foundation.js +39 -48
  216. package/dist/time-picker/input-foundation.d.ts +4 -4
  217. package/dist/time-picker/input-foundation.js +13 -13
  218. package/dist/time-picker/utils/index.d.ts +0 -11
  219. package/dist/time-picker/utils/index.js +0 -11
  220. package/dist/toast/toast-list-foundation.d.ts +7 -7
  221. package/dist/toast/toast-list-foundation.js +14 -14
  222. package/dist/tooltip/adjust-position.d.ts +1 -2
  223. package/dist/tooltip/constants.d.ts +0 -3
  224. package/dist/tooltip/constants.js +0 -3
  225. package/dist/tooltip/foundation.d.ts +9 -12
  226. package/dist/tooltip/foundation.js +67 -63
  227. package/dist/tooltip/position.scss +0 -1
  228. package/dist/transfer/foundation.d.ts +22 -13
  229. package/dist/transfer/foundation.js +38 -24
  230. package/dist/tree/foundation.d.ts +14 -16
  231. package/dist/tree/foundation.js +61 -62
  232. package/dist/tree/shared.d.ts +2 -4
  233. package/dist/tree/shared.js +0 -2
  234. package/dist/tree/tree-util.d.ts +0 -5
  235. package/dist/tree/tree-util.js +0 -5
  236. package/dist/tree-select/foundation.d.ts +26 -22
  237. package/dist/tree-select/foundation.js +91 -86
  238. package/dist/typography/ellipsis.d.ts +5 -7
  239. package/dist/typography/ellipsis.js +8 -10
  240. package/dist/typography/format-numeral.d.ts +1 -1
  241. package/dist/typography/format-numeral.js +2 -2
  242. package/dist/typography/typography.scss +0 -1
  243. package/dist/upload/constants.d.ts +1 -1
  244. package/dist/upload/foundation.d.ts +17 -23
  245. package/dist/upload/foundation.js +93 -103
  246. package/dist/upload/utils.d.ts +3 -8
  247. package/dist/upload/utils.js +6 -11
  248. package/dist/user-guide/foundation.d.ts +3 -5
  249. package/dist/user-guide/foundation.js +19 -19
  250. package/dist/utils/a11y.d.ts +2 -6
  251. package/dist/utils/a11y.js +1 -4
  252. package/dist/utils/announcer.d.ts +2 -2
  253. package/dist/utils/announcer.js +4 -4
  254. package/dist/utils/array.d.ts +0 -6
  255. package/dist/utils/array.js +0 -6
  256. package/dist/utils/date-fns-extra.js +1 -5
  257. package/dist/utils/dom.d.ts +0 -1
  258. package/dist/utils/dom.js +0 -1
  259. package/dist/utils/escape-html.js +0 -3
  260. package/dist/utils/field-sizing.d.ts +0 -2
  261. package/dist/utils/field-sizing.js +0 -2
  262. package/dist/utils/focus-handle.d.ts +1 -2
  263. package/dist/utils/focus-handle.js +1 -3
  264. package/dist/utils/focus-scope.d.ts +5 -6
  265. package/dist/utils/focus-scope.js +10 -11
  266. package/dist/utils/is-promise.d.ts +1 -1
  267. package/dist/utils/release-holder.d.ts +2 -2
  268. package/dist/utils/release-holder.js +4 -4
  269. package/dist/utils/scroll-lock.d.ts +3 -4
  270. package/dist/utils/scroll-lock.js +3 -4
  271. package/dist/utils/tween.d.ts +0 -1
  272. package/dist/utils/tween.js +0 -1
  273. package/dist/utils/uuid.d.ts +0 -1
  274. package/dist/utils/uuid.js +0 -1
  275. package/dist/utils/warning.d.ts +0 -1
  276. package/dist/utils/warning.js +0 -1
  277. package/dist/video-player/foundation.d.ts +15 -15
  278. package/dist/video-player/foundation.js +89 -89
  279. package/dist/video-player/progress-foundation.d.ts +2 -3
  280. package/dist/video-player/progress-foundation.js +12 -13
  281. package/dist/video-player/variables.scss +1 -1
  282. package/package.json +2 -2
@@ -1,9 +1,9 @@
1
1
  import BaseFoundation from "../base/foundation.js";
2
2
  // src/banner/foundation.ts
3
3
  var BannerFoundation = class extends BaseFoundation {
4
- removeBanner(e) {
5
- this._adapter.notifyClose(e);
6
- this._adapter.hide();
7
- }
4
+ removeBanner = (e) => {
5
+ this.adapter.notifyClose(e);
6
+ this.adapter.hide();
7
+ };
8
8
  };
9
9
  export { BannerFoundation as default };
@@ -1,5 +1,4 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "./foundation.js";
2
- /** The props the foundation reads with getProp */
3
2
  export interface AutoCloseBaseProps {
4
3
  id?: string;
5
4
  duration?: number;
@@ -15,16 +14,16 @@ export default class AutoCloseFoundation<P extends AutoCloseBaseProps = AutoClos
15
14
  #private;
16
15
  init(): void;
17
16
  destroy(): void;
18
- leave(): void;
19
- pauseCloseTimer(): void;
20
- resumeCloseTimer(): void;
17
+ leave: () => void;
18
+ pauseCloseTimer: () => void;
19
+ resumeCloseTimer: () => void;
21
20
  startCloseTimer(): void;
22
- clickClose(e: {
21
+ clickClose: (e: {
23
22
  stopPropagation: () => void;
24
- }): void;
25
- close(e?: {
23
+ }) => void;
24
+ close: (e?: {
26
25
  stopPropagation: () => void;
27
- }): void;
26
+ }) => void;
28
27
  clearCloseTimer(): void;
29
- restartCloseTimer(): void;
28
+ restartCloseTimer: () => void;
30
29
  }
@@ -13,18 +13,18 @@ var AutoCloseFoundation = class extends BaseFoundation {
13
13
  destroy() {
14
14
  this.clearCloseTimer();
15
15
  }
16
- leave() {
16
+ leave = () => {
17
17
  this.#leaving = true;
18
18
  this.clearCloseTimer();
19
- }
20
- pauseCloseTimer() {
19
+ };
20
+ pauseCloseTimer = () => {
21
21
  this.#paused = true;
22
22
  this.clearCloseTimer();
23
- }
24
- resumeCloseTimer() {
23
+ };
24
+ resumeCloseTimer = () => {
25
25
  this.#paused = false;
26
26
  this.startCloseTimer();
27
- }
27
+ };
28
28
  startCloseTimer() {
29
29
  this.clearCloseTimer();
30
30
  const duration = this.getProp("duration");
@@ -32,30 +32,30 @@ var AutoCloseFoundation = class extends BaseFoundation {
32
32
  this.close();
33
33
  }, duration * 1e3);
34
34
  }
35
- clickClose(e) {
35
+ clickClose = (e) => {
36
36
  e.stopPropagation();
37
37
  if (this.#leaving) return;
38
- this._adapter.notifyCloseClick?.(this.#id);
38
+ this.adapter.notifyCloseClick?.(this.#id);
39
39
  this.close();
40
- }
41
- close(e) {
40
+ };
41
+ close = (e) => {
42
42
  e?.stopPropagation();
43
43
  if (this.#leaving) return;
44
44
  this.#leaving = true;
45
45
  this.clearCloseTimer();
46
- this._adapter.notifyWrapperToRemove(this.#id);
47
- this._adapter.notifyClose();
48
- }
46
+ this.adapter.notifyWrapperToRemove(this.#id);
47
+ this.adapter.notifyClose();
48
+ };
49
49
  clearCloseTimer() {
50
50
  if (this.#timer) {
51
51
  clearTimeout(this.#timer);
52
52
  this.#timer = null;
53
53
  }
54
54
  }
55
- restartCloseTimer() {
55
+ restartCloseTimer = () => {
56
56
  this.#leaving = false;
57
57
  this.clearCloseTimer();
58
58
  if (!this.#paused) this.startCloseTimer();
59
- }
59
+ };
60
60
  };
61
61
  export { AutoCloseFoundation as default };
@@ -18,7 +18,6 @@ export interface DefaultAdapter<P = Record<string, any>, S = Record<string, any>
18
18
  /** The context type an adapter declares; `unknown` for a foundation that does not read context */
19
19
  export type ContextOf<T> = T extends DefaultAdapter<any, any, infer C> ? C : never;
20
20
  export type HostContext<A> = unknown extends ContextOf<A> ? ([keyof ContextOf<A>] extends [never] ? any : ContextOf<A>) : ContextOf<A>;
21
- /** The context of a foundation that only reads the reading direction from the enclosing ConfigProvider */
22
21
  export interface DirectionContext {
23
22
  direction?: 'ltr' | 'rtl';
24
23
  }
@@ -30,7 +29,8 @@ export interface DirectionContext {
30
29
  * - The constructor may run more than once per mount (StrictMode discards one instance), so it has no side effects.
31
30
  * - On mount the host calls `connect()` then `init()`, after the DOM is in place and before paint (layout phase).
32
31
  * On unmount it calls `destroy()` then `disconnect()`. Under StrictMode the kept instance goes through
33
- * init -> destroy -> init.
32
+ * init -> destroy -> init. `destroy()` must not rely on the DOM still being attached: Svelte removes a
33
+ * component's DOM before it runs teardown.
34
34
  * - `init()` may run again after `destroy()` on state the user already changed (StrictMode, and React Activity each
35
35
  * time it shows again), so it must be idempotent: initial values resolved from props (`default*`, `value`) belong
36
36
  * in a static `getInitialState` the host calls when it creates the state; `init()` only subscribes and runs
@@ -52,13 +52,13 @@ export interface DirectionContext {
52
52
  */
53
53
  export default class BaseFoundation<T extends DefaultAdapter<P, S, any>, P = Record<string, any>, S = Record<string, any>> {
54
54
  #private;
55
- protected _adapter: T;
55
+ protected adapter: T;
56
56
  constructor(adapter: T);
57
57
  /**
58
58
  * A prop is controlled when its value is not `undefined`: a Vue adapter's props hold every declared key. Without
59
59
  * a key it checks `value`, the controlled prop of most components.
60
60
  */
61
- protected _isControlledComponent(key?: keyof P & string): boolean;
61
+ protected isControlledComponent(key?: keyof P & string): boolean;
62
62
  /** Aborted when the component unmounts: a listener registered with it needs no removal of its own */
63
63
  protected get signal(): AbortSignal;
64
64
  getProp<K extends keyof P>(key: K): P[K];
@@ -7,7 +7,8 @@
7
7
  * - The constructor may run more than once per mount (StrictMode discards one instance), so it has no side effects.
8
8
  * - On mount the host calls `connect()` then `init()`, after the DOM is in place and before paint (layout phase).
9
9
  * On unmount it calls `destroy()` then `disconnect()`. Under StrictMode the kept instance goes through
10
- * init -> destroy -> init.
10
+ * init -> destroy -> init. `destroy()` must not rely on the DOM still being attached: Svelte removes a
11
+ * component's DOM before it runs teardown.
11
12
  * - `init()` may run again after `destroy()` on state the user already changed (StrictMode, and React Activity each
12
13
  * time it shows again), so it must be idempotent: initial values resolved from props (`default*`, `value`) belong
13
14
  * in a static `getInitialState` the host calls when it creates the state; `init()` only subscribes and runs
@@ -29,15 +30,15 @@
29
30
  */
30
31
  var BaseFoundation = class {
31
32
  #lifetime = null;
32
- _adapter;
33
+ adapter;
33
34
  constructor(adapter) {
34
- this._adapter = adapter;
35
+ this.adapter = adapter;
35
36
  }
36
37
  /**
37
38
  * A prop is controlled when its value is not `undefined`: a Vue adapter's props hold every declared key. Without
38
39
  * a key it checks `value`, the controlled prop of most components.
39
40
  */
40
- _isControlledComponent(key = "value") {
41
+ isControlledComponent(key = "value") {
41
42
  return this.getProps()[key] !== void 0;
42
43
  }
43
44
  /** Aborted when the component unmounts: a listener registered with it needs no removal of its own */
@@ -46,25 +47,25 @@ var BaseFoundation = class {
46
47
  return this.#lifetime.signal;
47
48
  }
48
49
  getProp(key) {
49
- return this._adapter.getProp(key);
50
+ return this.adapter.getProp(key);
50
51
  }
51
52
  getProps() {
52
- return this._adapter.getProps();
53
+ return this.adapter.getProps();
53
54
  }
54
55
  getState(key) {
55
- return this._adapter.getState(key);
56
+ return this.adapter.getState(key);
56
57
  }
57
58
  getStates() {
58
- return this._adapter.getStates();
59
+ return this.adapter.getStates();
59
60
  }
60
61
  setState(states, cb) {
61
- return this._adapter.setState({ ...states }, cb);
62
+ return this.adapter.setState({ ...states }, cb);
62
63
  }
63
64
  getContext(key) {
64
- return this._adapter.getContext(key);
65
+ return this.adapter.getContext(key);
65
66
  }
66
67
  getContexts() {
67
- return this._adapter.getContexts();
68
+ return this.adapter.getContexts();
68
69
  }
69
70
  connect() {
70
71
  this.#lifetime = new AbortController();
@@ -1,4 +1,3 @@
1
- /** The part of a Toast or Notification list's state the kernel maintains */
2
1
  export interface ListStoreState<T> {
3
2
  removedItems: T[];
4
3
  updatedItems: T[];
@@ -22,16 +22,16 @@ export default class BreadcrumbFoundation<P extends object = object, S extends o
22
22
  /** `activeIndex` marks the current item; without it the last one is current */
23
23
  static isActive(index: number, total: number, activeIndex?: number): boolean;
24
24
  /** No separator after the last item, nor after one hidden behind a custom more area or the popover */
25
- static shouldRenderSeparator(index: number, total: number, collapse: {
25
+ static shouldRenderSeparator(index: number, total: number, { collapsed, start, end, hasCustomMore, moreType }: {
26
26
  collapsed: boolean;
27
27
  start: number;
28
28
  end: number;
29
29
  hasCustomMore: boolean;
30
30
  moreType?: string;
31
31
  }): boolean;
32
- handleClick(info: BreadcrumbItemInfo, event: E): void;
33
- handleExpand(clickEvent: unknown): void;
34
- handleExpandKeyDown(keyboardEvent: Pick<KeyboardEvent, 'key' | 'target' | 'preventDefault'> & {
32
+ handleClick: (info: BreadcrumbItemInfo, event: E) => void;
33
+ handleExpand: (clickEvent: unknown) => void;
34
+ handleExpandKeyDown: (keyboardEvent: Pick<KeyboardEvent, "key" | "target" | "preventDefault"> & {
35
35
  currentTarget: Node;
36
- }): void;
36
+ }) => void;
37
37
  }
@@ -38,24 +38,23 @@ var BreadcrumbFoundation = class extends BaseFoundation {
38
38
  return activeIndex !== void 0 ? activeIndex === index : index === total - 1;
39
39
  }
40
40
  /** No separator after the last item, nor after one hidden behind a custom more area or the popover */
41
- static shouldRenderSeparator(index, total, collapse) {
42
- const { collapsed, start, end, hasCustomMore, moreType } = collapse;
41
+ static shouldRenderSeparator(index, total, { collapsed, start, end, hasCustomMore, moreType }) {
43
42
  const hidden = collapsed && (hasCustomMore || moreType === "popover") && index >= start && index <= end;
44
43
  return index !== total - 1 && !hidden;
45
44
  }
46
- handleClick(info, event) {
47
- this._adapter.notifyClick(info, event);
48
- }
49
- handleExpand(clickEvent) {
50
- this._adapter.expandCollapsed(clickEvent);
51
- }
52
- handleExpandKeyDown(keyboardEvent) {
45
+ handleClick = (info, event) => {
46
+ this.adapter.notifyClick(info, event);
47
+ };
48
+ handleExpand = (clickEvent) => {
49
+ this.adapter.expandCollapsed(clickEvent);
50
+ };
51
+ handleExpandKeyDown = (keyboardEvent) => {
53
52
  const { target } = keyboardEvent;
54
53
  if (!(target instanceof Node && keyboardEvent.currentTarget.contains(target))) return;
55
54
  if (isEnterPress(keyboardEvent) || keyboardEvent.key === " ") {
56
55
  keyboardEvent.preventDefault();
57
56
  this.handleExpand(keyboardEvent);
58
57
  }
59
- }
58
+ };
60
59
  };
61
60
  export { BreadcrumbFoundation as default };
@@ -35,11 +35,11 @@ export default class BreadcrumbItemFoundation<P extends object = object, S exten
35
35
  noLink?: boolean;
36
36
  hasOnClick: boolean;
37
37
  }): boolean;
38
- handleClick(item: BreadcrumbItemInfo, e: E): void;
38
+ handleClick: (item: BreadcrumbItemInfo, e: E) => void;
39
39
  /** Enter goes through a real click so handlers keep receiving a MouseEvent */
40
- handleKeyDown(e: Pick<KeyboardEvent, 'key' | 'preventDefault'> & {
40
+ handleKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault"> & {
41
41
  currentTarget: {
42
42
  click: () => void;
43
43
  };
44
- }, isKeyboardLink: boolean): void;
44
+ }, isKeyboardLink: boolean) => void;
45
45
  }
@@ -21,16 +21,16 @@ var BreadcrumbItemFoundation = class extends BaseFoundation {
21
21
  static isKeyboardLink({ active, hasHref, noLink, hasOnClick }) {
22
22
  return !active && !hasHref && !noLink && hasOnClick;
23
23
  }
24
- handleClick(item, e) {
25
- this._adapter.notifyClick(item, e);
26
- this._adapter.notifyParent(item, e);
27
- }
24
+ handleClick = (item, e) => {
25
+ this.adapter.notifyClick(item, e);
26
+ this.adapter.notifyParent(item, e);
27
+ };
28
28
  /** Enter goes through a real click so handlers keep receiving a MouseEvent */
29
- handleKeyDown(e, isKeyboardLink) {
29
+ handleKeyDown = (e, isKeyboardLink) => {
30
30
  if (isKeyboardLink && e.key === "Enter") {
31
31
  e.preventDefault();
32
32
  e.currentTarget.click();
33
33
  }
34
- }
34
+ };
35
35
  };
36
36
  export { BreadcrumbItemFoundation as default };
@@ -2,14 +2,10 @@ import { EventObject, ParsedRangeEvent } from "./foundation.js";
2
2
  import { Locale } from "date-fns";
3
3
  export declare function checkWeekend(val: Date): boolean;
4
4
  export declare function getCurrDate(): Date;
5
- /** A 0-1 fraction of the day or week row as a CSS percentage, capped at 100% */
6
5
  export declare function toPercent(num: number): string;
7
6
  export declare function round(value: number): number;
8
7
  export declare function getPos(value: Date | number): number;
9
8
  export declare function isAllDayEvent(event: EventObject): boolean;
10
- /**
11
- * Fills a missing start (end - 1h) or end (start + 1h), clamped to the day.
12
- */
13
9
  export declare function amendEvent(event: EventObject): EventObject | undefined;
14
10
  /** An event every view can lay out: it has a start, and when it has an end, the end is not before it */
15
11
  export interface NormalizedEvent extends EventObject {
@@ -21,7 +17,6 @@ export interface NormalizedEvent extends EventObject {
21
17
  * 1ms earlier, so it belongs only to the days before that midnight. Works on a copy.
22
18
  */
23
19
  export declare function normalizeEvent(event: EventObject): NormalizedEvent | undefined;
24
- /** The max topInd is the row height */
25
20
  export declare function calcRowHeight(events: ParsedRangeEvent[]): number;
26
21
  export interface DateObj {
27
22
  ind: number;
@@ -35,11 +30,7 @@ export interface DateObj {
35
30
  }
36
31
  export type weekStartsOnEnum = 0 | 1 | 2 | 3 | 4 | 5 | 6;
37
32
  export declare function calcRangeData(value: Date, start: Date, rangeLen: number, mode: string, locale: Locale, weekStartsOn: weekStartsOnEnum, today?: Date | number | null): DateObj[];
38
- /**
39
- * The days of a week as { date, dayString, ind, isToday, isWeekend, weekday }; `monthStart` is for month mode
40
- */
41
33
  export declare function calcWeekData(value: Date, monthStart: Date | null, mode: string, locale: Locale, weekStartsOn: weekStartsOnEnum, today?: Date | number | null): DateObj[];
42
- /** Splits an all-day event into one event per day it spans */
43
34
  export declare function parseAllDayEvent(event: NormalizedEvent, allDay?: boolean): {
44
35
  [x: string]: any;
45
36
  key: string;
@@ -56,7 +47,6 @@ export declare function parseEvent(rawEvent: EventObject): {
56
47
  end?: Date;
57
48
  children?: any;
58
49
  }[];
59
- /** Groups events into a map keyed by the date string of `key`, normalized by `func` */
60
50
  export declare function convertEventsArrToMap(arr: EventObject[], key: 'start' | 'date', func: (val: Date) => Date): Map<string, EventObject[]>;
61
51
  export declare function filterEvents(events: Map<string, EventObject[]>, start: Date, end: Date): Map<string, EventObject[]>;
62
52
  export declare function parseRangeAllDayEvent(event: EventObject[], startDate: Date, rangeStart: Date, rangeEnd: Date, parsed: Array<Array<ParsedRangeEvent>>): ParsedRangeEvent[][];
@@ -22,7 +22,6 @@ function checkWeekend(val) {
22
22
  function getCurrDate() {
23
23
  return /* @__PURE__ */ new Date();
24
24
  }
25
- /** A 0-1 fraction of the day or week row as a CSS percentage, capped at 100% */
26
25
  function toPercent(num) {
27
26
  return `${num < 1 ? num * 100 : 100}%`;
28
27
  }
@@ -35,9 +34,6 @@ function getPos(value) {
35
34
  function isAllDayEvent(event) {
36
35
  return "allDay" in event && event.allDay;
37
36
  }
38
- /**
39
- * Fills a missing start (end - 1h) or end (start + 1h), clamped to the day.
40
- */
41
37
  function amendEvent(event) {
42
38
  const { start, end } = event;
43
39
  if (!start && !end) {
@@ -78,7 +74,6 @@ function normalizeEvent(event) {
78
74
  };
79
75
  return amendEvent(event);
80
76
  }
81
- /** The max topInd is the row height */
82
77
  function calcRowHeight(events) {
83
78
  const topIndArr = events.map((item) => item.topInd);
84
79
  return topIndArr.length ? Math.max(...topIndArr) + 1 : 1;
@@ -106,14 +101,10 @@ function calcRangeData(value, start, rangeLen, mode, locale, weekStartsOn, today
106
101
  return dateObj;
107
102
  });
108
103
  }
109
- /**
110
- * The days of a week as { date, dayString, ind, isToday, isWeekend, weekday }; `monthStart` is for month mode
111
- */
112
104
  function calcWeekData(value, monthStart, mode = "week", locale, weekStartsOn, today) {
113
105
  const start = startOfWeek(value, { weekStartsOn });
114
106
  return calcRangeData(monthStart || value, start, 7, mode, locale, weekStartsOn, today);
115
107
  }
116
- /** Splits an all-day event into one event per day it spans */
117
108
  function parseAllDayEvent(event, allDay = true) {
118
109
  const { start, end } = event;
119
110
  const diff = end ? differenceInCalendarDays(end, start) : 0;
@@ -128,7 +119,6 @@ function parseEvent(rawEvent) {
128
119
  if (differenceInHours(end, start) < 24) return [copyEvent(event, startOfDay(start), null, endOfDay(start)), copyEvent(event, startOfDay(end), startOfDay(end))];
129
120
  return parseAllDayEvent(event);
130
121
  }
131
- /** Groups events into a map keyed by the date string of `key`, normalized by `func` */
132
122
  function convertEventsArrToMap(arr, key, func) {
133
123
  return new Map(Object.entries(groupBy(arr, (item) => (func ? func(item[key]) : item[key]).toString())));
134
124
  }
@@ -147,7 +137,7 @@ function filterEvents(events, start, end) {
147
137
  }
148
138
  function parseRangeAllDayEvent(event, startDate, rangeStart, rangeEnd, parsed) {
149
139
  const dateRangeLen = differenceInCalendarDays(rangeEnd, rangeStart);
150
- event.sort((a, b) => compareAsc(a.start, b.start)).forEach((item) => {
140
+ event.toSorted((a, b) => compareAsc(a.start, b.start)).forEach((item) => {
151
141
  const itemInfo = { ...item };
152
142
  const { end } = item;
153
143
  let dateLength;
@@ -31,7 +31,6 @@ export interface RangeData {
31
31
  week: DateObj[];
32
32
  }
33
33
  export type MonthData = Record<number, DateObj[]>;
34
- /** The props the foundation reads with getProps */
35
34
  export interface CalendarBaseProps {
36
35
  displayValue?: Date;
37
36
  showCurrTime?: boolean;
@@ -40,9 +39,6 @@ export interface CalendarAdapter<P extends CalendarBaseProps = CalendarBaseProps
40
39
  updateCurrPos: (currPos: number) => void;
41
40
  setShowCurrTime: (show: boolean) => void;
42
41
  }
43
- /**
44
- * Static pure layout functions for the views; an instance drives a day column's current time line.
45
- */
46
42
  export default class CalendarFoundation<P extends CalendarBaseProps = CalendarBaseProps, S extends object = object> extends BaseFoundation<CalendarAdapter<P, S>, P, S> {
47
43
  #private;
48
44
  static formatCbValue([date, ...time]: [Date, number, number, number] | [Date]): Date;
@@ -63,9 +59,8 @@ export default class CalendarFoundation<P extends CalendarBaseProps = CalendarBa
63
59
  * Subscribes to the day changing; returns the unsubscribe function. The caller refreshes once itself on mount.
64
60
  */
65
61
  static watchToday(onChange: () => void): () => void;
66
- /** How many event rows fit in a month cell of this height */
67
62
  static getItemLimit(cellHeight: number): number;
68
- /** How many of a day's events overflow the limit; a day's events are a sparse array indexed by row */
63
+ /** A day's events are a sparse array indexed by row */
69
64
  static countHidden(dayEvents: ParsedRangeEvent[] | undefined, itemLimit: number): number;
70
65
  /**
71
66
  * Once the open card's cell no longer collapses (resize, events changed) its "more" button is gone, and the
@@ -4,9 +4,6 @@ import { calcRangeData, calcWeekData, collectDailyEvents, convertEventsArrToMap,
4
4
  import { countBy } from "es-toolkit";
5
5
  import { addDays, compareAsc, differenceInCalendarDays, endOfMonth, endOfWeek, format, getWeekOfMonth, getWeeksInMonth, isAfter, isBefore, isSameDay, isSameMonth, isSameWeek, startOfDay, startOfMonth, startOfWeek } from "date-fns";
6
6
  // src/calendar/foundation.ts
7
- /**
8
- * Static pure layout functions for the views; an instance drives a day column's current time line.
9
- */
10
7
  var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
11
8
  #currTimeTimer;
12
9
  static #parseEvents(events) {
@@ -28,7 +25,7 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
28
25
  static #parseRangeEvents(events, [start, end]) {
29
26
  let parsed = [[]];
30
27
  const filtered = filterEvents(events, start, end);
31
- [...filtered.keys()].sort(compareAsc).forEach((item) => {
28
+ [...filtered.keys()].toSorted(compareAsc).forEach((item) => {
32
29
  const startDate = new Date(item);
33
30
  const curr = filtered.get(item).filter((event) => isSameDay(event.date, startDate));
34
31
  parsed = parseRangeAllDayEvent(curr, startDate, start, end, parsed);
@@ -42,10 +39,10 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
42
39
  const update = () => {
43
40
  if (!isSameDay(this.getProp("displayValue"), getCurrDate())) {
44
41
  clearInterval(this.#currTimeTimer);
45
- this._adapter.setShowCurrTime(false);
42
+ this.adapter.setShowCurrTime(false);
46
43
  return;
47
44
  }
48
- this._adapter.updateCurrPos(round(getPos(getCurrDate())));
45
+ this.adapter.updateCurrPos(round(getPos(getCurrDate())));
49
46
  };
50
47
  update();
51
48
  clearInterval(this.#currTimeTimer);
@@ -165,11 +162,10 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
165
162
  window.removeEventListener("focus", onChange);
166
163
  };
167
164
  }
168
- /** How many event rows fit in a month cell of this height */
169
165
  static getItemLimit(cellHeight) {
170
166
  return Math.max(0, Math.ceil((cellHeight - numbers.MONTH_CELL_PADDING) / numbers.MONTH_EVENT_HEIGHT));
171
167
  }
172
- /** How many of a day's events overflow the limit; a day's events are a sparse array indexed by row */
168
+ /** A day's events are a sparse array indexed by row */
173
169
  static countHidden(dayEvents, itemLimit) {
174
170
  return dayEvents?.slice(itemLimit).filter(Boolean).length ?? 0;
175
171
  }
@@ -187,7 +183,7 @@ var CalendarFoundation = class CalendarFoundation extends BaseFoundation {
187
183
  init() {
188
184
  const { showCurrTime, displayValue } = this.getProps();
189
185
  if (showCurrTime && isSameDay(displayValue, getCurrDate())) {
190
- this._adapter.setShowCurrTime(true);
186
+ this.adapter.setShowCurrTime(true);
191
187
  this.#startCurrentTimeTicker();
192
188
  }
193
189
  }
@@ -3,9 +3,8 @@ export interface CalendarMonthAdapter<P extends object = object, S extends objec
3
3
  notifyClose: (e: any, key: string) => void;
4
4
  openCard: (key: string) => void;
5
5
  }
6
- /** Drives the month view's "more" card */
7
6
  export default class CalendarMonthFoundation<P extends object = object, S extends object = object> extends BaseFoundation<CalendarMonthAdapter<P, S>, P, S> {
8
7
  /** Closes the "more" card from its close button or a mousedown outside */
9
- closeCard(e: any, key: string): void;
10
- showCard(key: string): void;
8
+ closeCard: (e: unknown, key: string) => void;
9
+ showCard: (key: string) => void;
11
10
  }
@@ -1,13 +1,12 @@
1
1
  import BaseFoundation from "../base/foundation.js";
2
2
  // src/calendar/month-foundation.ts
3
- /** Drives the month view's "more" card */
4
3
  var CalendarMonthFoundation = class extends BaseFoundation {
5
4
  /** Closes the "more" card from its close button or a mousedown outside */
6
- closeCard(e, key) {
7
- this._adapter.notifyClose(e, key);
8
- }
9
- showCard(key) {
10
- this._adapter.openCard(key);
11
- }
5
+ closeCard = (e, key) => {
6
+ this.adapter.notifyClose(e, key);
7
+ };
8
+ showCard = (key) => {
9
+ this.adapter.openCard(key);
10
+ };
12
11
  };
13
12
  export { CalendarMonthFoundation as default };
@@ -12,13 +12,11 @@ export type CarouselAutoPlay = boolean | {
12
12
  interval?: number;
13
13
  hoverToPause?: boolean;
14
14
  };
15
- /** The props the foundation reads */
16
15
  export interface CarouselBaseProps {
17
16
  activeIndex?: number;
18
17
  autoPlay?: CarouselAutoPlay;
19
18
  speed?: number;
20
19
  }
21
- /** The state the foundation reads */
22
20
  export interface CarouselBaseState {
23
21
  activeIndex: number;
24
22
  isInit: boolean;
@@ -40,22 +38,22 @@ export default class CarouselFoundation<P extends CarouselBaseProps = CarouselBa
40
38
  activeIndex: number;
41
39
  }, total: number): number;
42
40
  init(): void;
43
- setForcePlay(forcePlay: boolean): void;
44
- stopByUser(): void;
45
- stop(): void;
46
- handleAutoPlayChange(autoPlayOn: boolean): void;
47
- handlePointerEnter(): void;
48
- handlePointerLeave(): void;
49
- resetPointer(): void;
50
- handleSlideCountChange(previous: number, count: number): void;
51
- handleKeyboardFocus(): void;
52
- handleFocusLeave(): void;
53
- goTo(activeIndex: number): void;
54
- next(): void;
55
- prev(): void;
41
+ setForcePlay: (forcePlay: boolean) => void;
42
+ stopByUser: () => void;
43
+ stop: () => void;
44
+ handleAutoPlayChange: (autoPlayOn: boolean) => void;
45
+ handlePointerEnter: () => void;
46
+ handlePointerLeave: () => void;
47
+ resetPointer: () => void;
48
+ handleSlideCountChange: (previous: number, count: number) => void;
49
+ handleKeyboardFocus: () => void;
50
+ handleFocusLeave: () => void;
51
+ goTo: (activeIndex: number) => void;
52
+ next: () => void;
53
+ prev: () => void;
56
54
  destroy(): void;
57
- handleAutoPlay(): void;
58
- handleKeyDown(event: Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'preventDefault'>): boolean;
59
- onIndicatorChange(activeIndex: number): void;
60
- syncActiveIndex(activeIndex: number): void;
55
+ handleAutoPlay: () => void;
56
+ handleKeyDown: (event: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "preventDefault">) => boolean;
57
+ onIndicatorChange: (activeIndex: number) => void;
58
+ syncActiveIndex: (activeIndex: number) => void;
61
59
  }