@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
@@ -12,7 +12,6 @@ export interface AnchorAdapter<P extends AnchorBaseProps = AnchorBaseProps, S ex
12
12
  notifyChange: (currentLink: string, previousLink: string) => void;
13
13
  notifyClick: (e: E, link: string) => void;
14
14
  }
15
- /** The props the foundation reads */
16
15
  export interface AnchorBaseProps {
17
16
  defaultAnchor?: string;
18
17
  scrollMotion?: boolean;
@@ -20,7 +19,6 @@ export interface AnchorBaseProps {
20
19
  offsetTop?: number;
21
20
  scrollIntoViewOptions?: Options;
22
21
  }
23
- /** The state the foundation reads */
24
22
  export interface AnchorBaseState {
25
23
  activeLink: string;
26
24
  links: string[];
@@ -40,8 +38,7 @@ export default class AnchorFoundation<P extends AnchorBaseProps = AnchorBaseProp
40
38
  /** Runs once the links have registered: listens to the container, applies `defaultAnchor` */
41
39
  init(): void;
42
40
  destroy(): void;
43
- /** Rebinds scroll listeners when `getContainer` returns a different node */
44
- handleContainerChange(): void;
41
+ handleContainerChange: () => void;
45
42
  syncSlideBar: () => void;
46
43
  addLink: (link: string) => void;
47
44
  removeLink: (link: string) => void;
@@ -9,7 +9,7 @@ var AnchorFoundation = class extends BaseFoundation {
9
9
  #throttledScroll = throttle(() => this.handleScroll(), 100);
10
10
  #debouncedScrollEnd = debounce(() => this.#handleClickLink(), 100);
11
11
  #bind() {
12
- const container = this._adapter.getContainer();
12
+ const container = this.adapter.getContainer();
13
13
  this.#container = container;
14
14
  container.addEventListener("scroll", this.#throttledScroll);
15
15
  container.addEventListener("scroll", this.#debouncedScrollEnd);
@@ -19,11 +19,11 @@ var AnchorFoundation = class extends BaseFoundation {
19
19
  this.#container?.removeEventListener("scroll", this.#debouncedScrollEnd);
20
20
  this.#container = null;
21
21
  }
22
- #scrollIntoView = (link) => {
22
+ #scrollIntoView(link) {
23
23
  const { scrollMotion, targetOffset, scrollIntoViewOptions } = this.getProps();
24
24
  const behavior = scrollMotion ? "smooth" : "auto";
25
25
  if (link) {
26
- const destNode = this._adapter.getContentNode(link);
26
+ const destNode = this.adapter.getContentNode(link);
27
27
  const scrollOpts = {
28
28
  block: "start",
29
29
  ...scrollIntoViewOptions,
@@ -43,31 +43,31 @@ var AnchorFoundation = class extends BaseFoundation {
43
43
  };
44
44
  if (destNode) scrollIntoView(destNode, scrollOpts);
45
45
  }
46
- };
46
+ }
47
47
  #handleClickLink() {
48
- this._adapter.setState({ clickLink: false });
48
+ this.adapter.setState({ clickLink: false });
49
49
  }
50
50
  #goToLink(link, shouldNotify) {
51
- const destNode = this._adapter.getContentNode(link);
52
- const prevLink = this._adapter.getState("activeLink");
51
+ const destNode = this.adapter.getContentNode(link);
52
+ const prevLink = this.adapter.getState("activeLink");
53
53
  this.setActiveLink(link, prevLink, shouldNotify);
54
- if (destNode) this._adapter.setState({ clickLink: true }, () => {
54
+ if (destNode) this.adapter.setState({ clickLink: true }, () => {
55
55
  this.#scrollIntoView(link);
56
56
  this.#debouncedScrollEnd();
57
57
  });
58
58
  }
59
59
  setActiveLink(link, prevLink, shouldNotify = true) {
60
- if (this._adapter.getState("activeLink") !== link) {
61
- this._adapter.setState({ activeLink: link }, this.syncSlideBar);
62
- if (shouldNotify) this._adapter.notifyChange(link, prevLink);
60
+ if (this.adapter.getState("activeLink") !== link) {
61
+ this.adapter.setState({ activeLink: link }, this.syncSlideBar);
62
+ if (shouldNotify) this.adapter.notifyChange(link, prevLink);
63
63
  }
64
64
  }
65
65
  getLinksTop() {
66
- const container = this._adapter.getContainer();
66
+ const container = this.adapter.getContainer();
67
67
  const containerTop = "getBoundingClientRect" in container ? container.getBoundingClientRect().top : 0;
68
68
  const { offsetTop } = this.getProps();
69
69
  return this.getState("links").map((link) => {
70
- const node = this._adapter.getContentNode(link);
70
+ const node = this.adapter.getContentNode(link);
71
71
  return node && node.getBoundingClientRect().top - containerTop - offsetTop || -Infinity;
72
72
  });
73
73
  }
@@ -113,31 +113,30 @@ var AnchorFoundation = class extends BaseFoundation {
113
113
  this.#throttledScroll.cancel();
114
114
  this.#debouncedScrollEnd.cancel();
115
115
  }
116
- /** Rebinds scroll listeners when `getContainer` returns a different node */
117
- handleContainerChange() {
118
- if (this._adapter.getContainer() !== this.#container) {
116
+ handleContainerChange = () => {
117
+ if (this.adapter.getContainer() !== this.#container) {
119
118
  this.#unbind();
120
119
  this.#bind();
121
120
  }
122
- }
121
+ };
123
122
  syncSlideBar = () => {
124
- const linkNode = this._adapter.getAnchorNode(`.${cssClasses.PREFIX}-link-title-active`);
123
+ const linkNode = this.adapter.getAnchorNode(`.${cssClasses.PREFIX}-link-title-active`);
125
124
  if (linkNode && linkNode.offsetTop !== this.#slideBarTop) {
126
125
  this.#slideBarTop = linkNode.offsetTop;
127
- this._adapter.setState({ slideBarTop: `${this.#slideBarTop}px` });
126
+ this.adapter.setState({ slideBarTop: `${this.#slideBarTop}px` });
128
127
  }
129
128
  };
130
129
  addLink = (link) => {
131
- this._adapter.setState({ links: [...this.getState("links"), link] });
130
+ this.adapter.setState({ links: [...this.getState("links"), link] });
132
131
  };
133
132
  removeLink = (link) => {
134
133
  const links = this.getState("links");
135
134
  const index = links.indexOf(link);
136
- if (index !== -1) this._adapter.setState({ links: links.toSpliced(index, 1) });
135
+ if (index !== -1) this.adapter.setState({ links: links.toSpliced(index, 1) });
137
136
  };
138
137
  handleClick = (e, link) => {
139
138
  this.#goToLink(link, true);
140
- this._adapter.notifyClick(e, link);
139
+ this.adapter.notifyClick(e, link);
141
140
  };
142
141
  };
143
142
  export { AnchorFoundation as default };
@@ -4,12 +4,10 @@ export type AudioInfo = {
4
4
  cover?: string;
5
5
  src: string;
6
6
  };
7
- /** The props the foundation reads with getProp */
8
7
  export interface AudioPlayerBaseProps {
9
8
  audioUrl: string | AudioInfo | (AudioInfo | string)[];
10
9
  skipDuration?: number;
11
10
  }
12
- /** The state the foundation reads and writes */
13
11
  export interface AudioPlayerBaseState {
14
12
  isPlaying: boolean;
15
13
  currentIndex: number;
@@ -30,17 +28,16 @@ export default class AudioPlayerFoundation<P extends AudioPlayerBaseProps = Audi
30
28
  init(): void;
31
29
  handleAudioPlay: () => void;
32
30
  handleAudioPause: () => void;
33
- handleStatusClick(): void;
34
- handleTimeUpdate(): void;
35
- handleTrackChange(direction: 'next' | 'prev'): void;
36
- handleTimeChange(value: number): void;
37
- handleSpeedChange(value: {
31
+ handleStatusClick: () => void;
32
+ handleTimeUpdate: () => void;
33
+ handleTrackChange: (direction: "next" | "prev") => void;
34
+ handleTimeChange: (value: number) => void;
35
+ handleSpeedChange: (value: {
38
36
  label: string;
39
37
  value: number;
40
- }): void;
41
- handleSeek(direction: number): void;
42
- handleRefresh(): void;
43
- handleVolumeChange(value: number): void;
44
- /** Mutes, or restores half volume when muted */
45
- handleVolumeSilent(): void;
38
+ }) => void;
39
+ handleSeek: (direction: number) => void;
40
+ handleRefresh: () => void;
41
+ handleVolumeChange: (value: number) => void;
42
+ handleVolumeSilent: () => void;
46
43
  }
@@ -17,7 +17,7 @@ var AudioPlayerFoundation = class extends BaseFoundation {
17
17
  this.setState({ error: true });
18
18
  }
19
19
  #getAudioRef() {
20
- return this._adapter.getAudioRef();
20
+ return this.adapter.getAudioRef();
21
21
  }
22
22
  #resetAudioState() {
23
23
  this.setState({
@@ -47,18 +47,18 @@ var AudioPlayerFoundation = class extends BaseFoundation {
47
47
  handleAudioPause = () => {
48
48
  this.setState({ isPlaying: false });
49
49
  };
50
- handleStatusClick() {
50
+ handleStatusClick = () => {
51
51
  const audio = this.#getAudioRef();
52
52
  if (!audio) return;
53
53
  if (audio.paused) ignoreExpectedMediaErrors(audio.play());
54
54
  else audio.pause();
55
- }
56
- handleTimeUpdate() {
55
+ };
56
+ handleTimeUpdate = () => {
57
57
  const audio = this.#getAudioRef();
58
58
  if (!audio) return;
59
59
  this.setState({ currentTime: audio.currentTime });
60
- }
61
- handleTrackChange(direction) {
60
+ };
61
+ handleTrackChange = (direction) => {
62
62
  if (!this.#getAudioRef()) return;
63
63
  const audioUrl = this.getProp("audioUrl");
64
64
  if (Array.isArray(audioUrl)) {
@@ -71,28 +71,28 @@ var AudioPlayerFoundation = class extends BaseFoundation {
71
71
  });
72
72
  }
73
73
  this.#resetAudioState();
74
- }
75
- handleTimeChange(value) {
74
+ };
75
+ handleTimeChange = (value) => {
76
76
  const audio = this.#getAudioRef();
77
77
  if (!audio || !Number.isFinite(audio.duration) || !Number.isFinite(value)) return;
78
78
  const time = Math.min(Math.max(value, 0), audio.duration);
79
79
  audio.currentTime = time;
80
80
  this.setState({ currentTime: time });
81
- }
82
- handleSpeedChange(value) {
81
+ };
82
+ handleSpeedChange = (value) => {
83
83
  const audio = this.#getAudioRef();
84
84
  if (!audio) return;
85
85
  audio.defaultPlaybackRate = audio.playbackRate = value.value;
86
86
  this.setState({ currentRate: value });
87
- }
88
- handleSeek(direction) {
87
+ };
88
+ handleSeek = (direction) => {
89
89
  const audio = this.#getAudioRef();
90
90
  if (!audio) return;
91
91
  if (!Number.isFinite(audio.duration)) return;
92
92
  const skipDuration = this.getProp("skipDuration");
93
93
  audio.currentTime = Math.min(Math.max(audio.currentTime + direction * skipDuration, 0), audio.duration);
94
- }
95
- handleRefresh() {
94
+ };
95
+ handleRefresh = () => {
96
96
  const audio = this.#getAudioRef();
97
97
  if (!audio) return;
98
98
  if (this.getState("error")) audio.load();
@@ -100,17 +100,16 @@ var AudioPlayerFoundation = class extends BaseFoundation {
100
100
  audio.currentTime = 0;
101
101
  this.setState({ currentTime: 0 });
102
102
  }
103
- }
104
- handleVolumeChange(value) {
103
+ };
104
+ handleVolumeChange = (value) => {
105
105
  const audio = this.#getAudioRef();
106
106
  if (!audio) return;
107
107
  const volume = Math.floor(value);
108
108
  audio.volume = volume / 100;
109
109
  this.setState({ volume });
110
- }
111
- /** Mutes, or restores half volume when muted */
112
- handleVolumeSilent() {
110
+ };
111
+ handleVolumeSilent = () => {
113
112
  this.handleVolumeChange(this.getState("volume") === 0 ? 50 : 0);
114
- }
113
+ };
115
114
  };
116
115
  export { AudioPlayerFoundation as default };
@@ -11,7 +11,6 @@ export interface StateOptionItem extends DataItem {
11
11
  _source?: DataItem | string | number;
12
12
  }
13
13
  export type AutoCompleteData = ReadonlyArray<DataItem | string | number>;
14
- /** The props the foundation reads with getProps */
15
14
  export interface AutoCompleteBaseProps {
16
15
  data?: AutoCompleteData;
17
16
  defaultActiveFirstOption?: boolean;
@@ -23,7 +22,6 @@ export interface AutoCompleteBaseProps {
23
22
  renderSelectedItem?(this: void, option: DataItem): string;
24
23
  value?: string | number;
25
24
  }
26
- /** The state the foundation reads with getStates */
27
25
  export interface AutoCompleteBaseState {
28
26
  focusIndex: number;
29
27
  inputValue?: string | number;
@@ -57,21 +55,21 @@ export default class AutoCompleteFoundation<P extends AutoCompleteBaseProps = Au
57
55
  visible: boolean;
58
56
  };
59
57
  init(): void;
60
- handleKeyDown(event: Pick<KeyboardEvent, 'key' | 'preventDefault'> & Parameters<typeof isComposing>[0]): void;
58
+ handleKeyDown: (event: Pick<KeyboardEvent, "key" | "preventDefault"> & Parameters<typeof isComposing>[0]) => void;
61
59
  /** Mousedown outside the input and dropdown while shown */
62
- handleClickOutside(_e: MouseEvent): void;
60
+ handleClickOutside: (_e: MouseEvent) => void;
63
61
  /**
64
62
  * Hides the dropdown and reports dropdownVisibleChange(false), without blurring the input or moving focus.
65
63
  * Called when Vue KeepAlive deactivates the host.
66
64
  */
67
- close(): void;
68
- handleInputClick(e: Pick<MouseEvent, 'detail' | 'target' | 'currentTarget'>): void;
69
- handleSearch(inputValue: string): void;
70
- handleSelect(stateOption: StateOptionItem, optionIndex?: number): void;
71
- handleDataChange(newData: any[]): void;
72
- handleValueChange(selectedValue: AutoCompleteBaseProps['value']): void;
73
- handleClear(): void;
74
- handleOptionMouseEnter(optionIndex: number): void;
75
- handleFocus(e: FE): void;
76
- handleBlur(e: FE): void;
65
+ close: () => void;
66
+ handleInputClick: (e: Pick<MouseEvent, "detail" | "target" | "currentTarget">) => void;
67
+ handleSearch: (inputValue: string) => void;
68
+ handleSelect: (stateOption: StateOptionItem, optionIndex?: number) => void;
69
+ handleDataChange: (newData: any[]) => void;
70
+ handleValueChange: (selectedValue: AutoCompleteBaseProps["value"]) => void;
71
+ handleClear: () => void;
72
+ handleOptionMouseEnter: (optionIndex: number) => void;
73
+ handleFocus: (e: FE) => void;
74
+ handleBlur: (e: FE) => void;
77
75
  }
@@ -29,7 +29,6 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
29
29
  static #getRenderSelectedItem({ renderSelectedItem }) {
30
30
  return renderSelectedItem ?? ((option) => option?.value);
31
31
  }
32
- /** The input text, selection and highlight that `selectedValue` shows */
33
32
  static #valueStates(props, selectedValue) {
34
33
  if (selectedValue === void 0) return {
35
34
  inputValue: "",
@@ -64,8 +63,8 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
64
63
  selectedOptionIndex = AutoCompleteFoundation.#generateList(data).findIndex((option) => renderSelectedItem(AutoCompleteFoundation.#toDataItem(option)) === searchValue);
65
64
  }
66
65
  if (selectedOptionIndex === -1 && defaultActiveFirstOption) {
67
- if (focusIndex !== 0) this._adapter.updateFocusIndex(0);
68
- } else if (selectedOptionIndex !== focusIndex) this._adapter.updateFocusIndex(selectedOptionIndex);
66
+ if (focusIndex !== 0) this.adapter.updateFocusIndex(0);
67
+ } else if (selectedOptionIndex !== focusIndex) this.adapter.updateFocusIndex(selectedOptionIndex);
69
68
  }
70
69
  #modifyFocusIndexOnPanelOpen() {
71
70
  let { inputValue } = this.getStates();
@@ -75,8 +74,8 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
75
74
  const { focusIndex, options } = this.getStates();
76
75
  const visibleOptions = options.filter((item) => item.show);
77
76
  const index = getEnabledStepIndex(offset, focusIndex, visibleOptions.length, (i) => visibleOptions[i].disabled);
78
- this._adapter.updateFocusIndex(index);
79
- if (index !== -1) this._adapter.updateScrollTop(index);
77
+ this.adapter.updateFocusIndex(index);
78
+ if (index !== -1) this.adapter.updateScrollTop(index);
80
79
  }
81
80
  #handleArrowKeyDown(offset) {
82
81
  const { visible } = this.getStates();
@@ -92,23 +91,23 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
92
91
  } else this.#closeDropdown();
93
92
  }
94
93
  #openDropdown() {
95
- this._adapter.toggleListVisible(true);
96
- this._adapter.notifyDropdownVisibleChange(true);
94
+ this.adapter.toggleListVisible(true);
95
+ this.adapter.notifyDropdownVisibleChange(true);
97
96
  this.#modifyFocusIndexOnPanelOpen();
98
97
  }
99
98
  #closeDropdown() {
100
99
  if (!this.getState("visible")) return;
101
- this._adapter.toggleListVisible(false);
102
- this._adapter.notifyDropdownVisibleChange(false);
100
+ this.adapter.toggleListVisible(false);
101
+ this.adapter.notifyDropdownVisibleChange(false);
103
102
  }
104
103
  #updateSelection(option) {
105
104
  const selection = /* @__PURE__ */ new Map();
106
105
  if (option) selection.set(option.label, option);
107
- this._adapter.updateSelection(selection);
106
+ this.adapter.updateSelection(selection);
108
107
  }
109
108
  #notifySelect(option) {
110
- if (this.#backwardLabelInValue()) this._adapter.notifySelect(option);
111
- else this._adapter.notifySelect(option.value);
109
+ if (this.#backwardLabelInValue()) this.adapter.notifySelect(option);
110
+ else this.adapter.notifySelect(option.value);
112
111
  }
113
112
  static getInitialState(props) {
114
113
  const value = props.value !== void 0 ? props.value : props.defaultValue;
@@ -123,7 +122,7 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
123
122
  this.#initialized = true;
124
123
  if (this.getProp("defaultOpen") && !this.getProp("disabled")) this.#openDropdown();
125
124
  }
126
- handleKeyDown(event) {
125
+ handleKeyDown = (event) => {
127
126
  const listHidden = this.getProp("loading") && this.getState("visible");
128
127
  switch (isComposing(event) ? "" : event.key) {
129
128
  case "ArrowUp":
@@ -144,34 +143,34 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
144
143
  break;
145
144
  case "Tab": this.#closeDropdown();
146
145
  }
147
- this._adapter.notifyKeyDown(event);
148
- }
146
+ this.adapter.notifyKeyDown(event);
147
+ };
149
148
  /** Mousedown outside the input and dropdown while shown */
150
- handleClickOutside(_e) {
149
+ handleClickOutside = (_e) => {
151
150
  this.#closeDropdown();
152
- }
151
+ };
153
152
  /**
154
153
  * Hides the dropdown and reports dropdownVisibleChange(false), without blurring the input or moving focus.
155
154
  * Called when Vue KeepAlive deactivates the host.
156
155
  */
157
- close() {
156
+ close = () => {
158
157
  this.#closeDropdown();
159
- }
160
- handleInputClick(e) {
158
+ };
159
+ handleInputClick = (e) => {
161
160
  const { disabled } = this.getProps();
162
161
  if (!disabled && !isInnerControlActivation(e)) {
163
162
  if (this.getState("visible")) this.#closeDropdown();
164
163
  else this.#openDropdown();
165
164
  }
166
- }
167
- handleSearch(inputValue) {
168
- this._adapter.updateInputValue(inputValue);
169
- this._adapter.notifySearch(inputValue);
170
- this._adapter.notifyChange(inputValue);
165
+ };
166
+ handleSearch = (inputValue) => {
167
+ this.adapter.updateInputValue(inputValue);
168
+ this.adapter.notifySearch(inputValue);
169
+ this.adapter.notifyChange(inputValue);
171
170
  this.#modifyFocusIndex(inputValue);
172
171
  if (!this.getState("visible")) this.#openDropdown();
173
- }
174
- handleSelect(stateOption, optionIndex) {
172
+ };
173
+ handleSelect = (stateOption, optionIndex) => {
175
174
  const { renderSelectedItem } = this.getProps();
176
175
  const option = AutoCompleteFoundation.#toDataItem(stateOption);
177
176
  let newInputValue = "";
@@ -179,41 +178,41 @@ var AutoCompleteFoundation = class AutoCompleteFoundation extends BaseFoundation
179
178
  newInputValue = renderSelectedItem(option);
180
179
  warning(typeof newInputValue !== "string", "Warning: [Semi AutoComplete] renderSelectedItem must return string, please check your function return");
181
180
  } else newInputValue = option.value;
182
- if (this._isControlledComponent()) {
181
+ if (this.isControlledComponent()) {
183
182
  this.#closeDropdown();
184
183
  this.#notifySelect(option);
185
184
  } else {
186
- this._adapter.updateInputValue(newInputValue);
185
+ this.adapter.updateInputValue(newInputValue);
187
186
  this.#updateSelection(option);
188
187
  this.#notifySelect(option);
189
188
  this.#closeDropdown();
190
189
  }
191
- this._adapter.notifyChange(newInputValue);
192
- this._adapter.updateFocusIndex(optionIndex);
193
- }
194
- handleDataChange(newData) {
190
+ this.adapter.notifyChange(newInputValue);
191
+ this.adapter.updateFocusIndex(optionIndex);
192
+ };
193
+ handleDataChange = (newData) => {
195
194
  const options = AutoCompleteFoundation.#generateList(newData);
196
- this._adapter.updateOptionList(options);
195
+ this.adapter.updateOptionList(options);
197
196
  let { inputValue } = this.getStates();
198
197
  this.#modifyFocusIndex(inputValue);
199
- }
200
- handleValueChange(selectedValue) {
198
+ };
199
+ handleValueChange = (selectedValue) => {
201
200
  const { inputValue, selection, focusIndex } = AutoCompleteFoundation.#valueStates(this.getProps(), selectedValue);
202
- this._adapter.updateInputValue(inputValue);
203
- this._adapter.updateSelection(selection);
204
- this._adapter.updateFocusIndex(focusIndex);
205
- }
206
- handleClear() {
207
- this._adapter.notifyClear();
208
- }
209
- handleOptionMouseEnter(optionIndex) {
210
- this._adapter.updateFocusIndex(optionIndex);
211
- }
212
- handleFocus(e) {
213
- this._adapter.notifyFocus(e);
214
- }
215
- handleBlur(e) {
216
- this._adapter.notifyBlur(e);
217
- }
201
+ this.adapter.updateInputValue(inputValue);
202
+ this.adapter.updateSelection(selection);
203
+ this.adapter.updateFocusIndex(focusIndex);
204
+ };
205
+ handleClear = () => {
206
+ this.adapter.notifyClear();
207
+ };
208
+ handleOptionMouseEnter = (optionIndex) => {
209
+ this.adapter.updateFocusIndex(optionIndex);
210
+ };
211
+ handleFocus = (e) => {
212
+ this.adapter.notifyFocus(e);
213
+ };
214
+ handleBlur = (e) => {
215
+ this.adapter.notifyBlur(e);
216
+ };
218
217
  };
219
218
  export { AutoCompleteFoundation as default };
@@ -1,5 +1,4 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
2
- /** The props the foundation reads */
3
2
  export interface AvatarBaseProps {
4
3
  gap?: number;
5
4
  }
@@ -21,9 +20,9 @@ export interface AvatarAdapter<P = AvatarBaseProps, S = AvatarBaseState, E = unk
21
20
  export default class AvatarFoundation<P extends AvatarBaseProps = AvatarBaseProps, S extends AvatarBaseState = AvatarBaseState, E = unknown> extends BaseFoundation<AvatarAdapter<P, S, E>, P, S> {
22
21
  init(): void;
23
22
  destroy(): void;
24
- handleSrcChange(): void;
25
- handleImgLoadError(): void;
26
- handleEnter(e: E): void;
27
- handleLeave(e: E): void;
28
- changeScale(): void;
23
+ handleSrcChange: () => void;
24
+ handleImgLoadError: () => void;
25
+ handleEnter: (e: E) => void;
26
+ handleLeave: (e: E) => void;
27
+ changeScale: () => void;
29
28
  }
@@ -5,27 +5,27 @@ var AvatarFoundation = class extends BaseFoundation {
5
5
  this.changeScale();
6
6
  }
7
7
  destroy() {}
8
- handleSrcChange() {
9
- this._adapter.setImgExist(true);
10
- }
11
- handleImgLoadError() {
12
- if (this._adapter.notifyError() !== false) this._adapter.setImgExist(false);
13
- }
14
- handleEnter(e) {
15
- this._adapter.notifyEnter(e);
16
- }
17
- handleLeave(e) {
18
- this._adapter.notifyLeave(e);
19
- }
20
- changeScale() {
8
+ handleSrcChange = () => {
9
+ this.adapter.setImgExist(true);
10
+ };
11
+ handleImgLoadError = () => {
12
+ if (this.adapter.notifyError() !== false) this.adapter.setImgExist(false);
13
+ };
14
+ handleEnter = (e) => {
15
+ this.adapter.notifyEnter(e);
16
+ };
17
+ handleLeave = (e) => {
18
+ this.adapter.notifyLeave(e);
19
+ };
20
+ changeScale = () => {
21
21
  const { gap } = this.getProps();
22
- const widths = this._adapter.getTextWidths();
22
+ const widths = this.adapter.getTextWidths();
23
23
  if (!widths) return;
24
24
  const { container: nodeWidth, text: stringNodeWidth } = widths;
25
25
  if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
26
26
  const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
27
- this._adapter.setScale(scale);
27
+ this.adapter.setScale(scale);
28
28
  }
29
- }
29
+ };
30
30
  };
31
31
  export { AvatarFoundation as default };
@@ -91,7 +91,6 @@ $width-avatar-bottom_slot_square_extra_large-border: 2px; // extra large 头像
91
91
 
92
92
  $color-avatar-top_slot_text: var(--semi-color-bg-0); //顶部 Slot 文字颜色
93
93
 
94
- // top slot offset; positions the slot together with the scale below
95
94
  $spacing-avatar-top_slot_small-shift: -28px; // small 顶部 slot 偏移量, 和 scale 一起控制 slot 的位置
96
95
  $spacing-avatar-top_slot_default-shift: -32px; // default 顶部 slot 偏移量, 和 scale 一起控制 slot 的位置
97
96
  $spacing-avatar-top_slot_medium-shift: -30px; // medium 顶部 slot 偏移量, 和 scale 一起控制 slot 的位置
@@ -1,7 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
2
- /** What `target()` returns: the window or a scrollable element */
3
2
  export type Target = Window | HTMLElement;
4
- /** The props the foundation reads */
5
3
  export interface BackTopBaseProps {
6
4
  target?: () => Target | null;
7
5
  visibilityHeight?: number;
@@ -19,8 +17,7 @@ export default class BackTopFoundation<P extends BackTopBaseProps = BackTopBaseP
19
17
  /** Children sit inside a native button, so interactive ones would nest; development only */
20
18
  static warnInteractiveChildren(button?: Element | null): void;
21
19
  init(): void;
22
- /** Rebinds the scroll listener when `target` returns a different element */
23
- handleTargetChange(): void;
20
+ handleTargetChange: () => void;
24
21
  destroy(): void;
25
- onClick(e: E): void;
22
+ onClick: (e: E) => void;
26
23
  }
@@ -20,14 +20,14 @@ var BackTopFoundation = class extends BaseFoundation {
20
20
  cancelAnimationFrame(this.#frame);
21
21
  }
22
22
  #getScroll(target) {
23
- return target === window ? target.scrollY : target.scrollTop;
23
+ return "scrollY" in target ? target.scrollY : target.scrollTop;
24
24
  }
25
25
  #handleScroll = () => {
26
26
  cancelAnimationFrame(this.#frame);
27
27
  this.#frame = requestAnimationFrame(() => {
28
28
  const { visibilityHeight } = this.getProps();
29
29
  const visible = this.#getScroll(this.#targetNode) > visibilityHeight;
30
- if (visible !== Boolean(this.getStates().visible)) this._adapter.updateVisible(visible);
30
+ if (visible !== Boolean(this.getStates().visible)) this.adapter.updateVisible(visible);
31
31
  });
32
32
  };
33
33
  /** Children sit inside a native button, so interactive ones would nest; development only */
@@ -37,18 +37,17 @@ var BackTopFoundation = class extends BaseFoundation {
37
37
  init() {
38
38
  this.#bind();
39
39
  }
40
- /** Rebinds the scroll listener when `target` returns a different element */
41
- handleTargetChange() {
40
+ handleTargetChange = () => {
42
41
  if (this.getProps().target() !== this.#targetNode) {
43
42
  this.#unbind();
44
43
  this.#bind();
45
44
  }
46
- }
45
+ };
47
46
  destroy() {
48
47
  this.#unbind();
49
48
  this.#cancelAnimation?.();
50
49
  }
51
- onClick(e) {
50
+ onClick = (e) => {
52
51
  const targetNode = this.#targetNode;
53
52
  if (targetNode) {
54
53
  this.#cancelAnimation?.();
@@ -63,7 +62,7 @@ var BackTopFoundation = class extends BaseFoundation {
63
62
  }
64
63
  });
65
64
  }
66
- this._adapter.notifyClick(e);
67
- }
65
+ this.adapter.notifyClick(e);
66
+ };
68
67
  };
69
68
  export { BackTopFoundation as default };
@@ -5,5 +5,5 @@ export interface BannerAdapter<P extends object = object, S extends object = obj
5
5
  notifyClose: (e: E) => void;
6
6
  }
7
7
  export default class BannerFoundation<P extends object = object, S extends object = object, E = unknown> extends BaseFoundation<BannerAdapter<P, S, E>, P, S> {
8
- removeBanner(e: E): void;
8
+ removeBanner: (e: E) => void;
9
9
  }