@fibrae/semi-foundation 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 (209) hide show
  1. package/LICENSE +0 -62
  2. package/README.md +36 -34
  3. package/README.zh-CN.md +79 -0
  4. package/dist/anchor/foundation.d.ts +0 -3
  5. package/dist/anchor/foundation.js +0 -1
  6. package/dist/audio-player/foundation.d.ts +0 -3
  7. package/dist/audio-player/foundation.js +0 -1
  8. package/dist/auto-complete/foundation.d.ts +0 -2
  9. package/dist/auto-complete/foundation.js +0 -1
  10. package/dist/avatar/foundation.d.ts +0 -1
  11. package/dist/avatar/variables.scss +0 -1
  12. package/dist/backtop/foundation.d.ts +0 -3
  13. package/dist/backtop/foundation.js +0 -1
  14. package/dist/base/auto-close-foundation.d.ts +0 -1
  15. package/dist/base/foundation.d.ts +0 -1
  16. package/dist/base/list-store.d.ts +0 -1
  17. package/dist/calendar/event-util.d.ts +0 -10
  18. package/dist/calendar/event-util.js +0 -10
  19. package/dist/calendar/foundation.d.ts +1 -6
  20. package/dist/calendar/foundation.js +1 -5
  21. package/dist/calendar/month-foundation.d.ts +0 -1
  22. package/dist/calendar/month-foundation.js +0 -1
  23. package/dist/carousel/foundation.d.ts +0 -2
  24. package/dist/cascader/foundation.d.ts +2 -6
  25. package/dist/cascader/foundation.js +2 -11
  26. package/dist/cascader/util.d.ts +1 -8
  27. package/dist/cascader/util.js +1 -8
  28. package/dist/checkbox/checkbox-foundation.d.ts +1 -5
  29. package/dist/checkbox/checkbox-foundation.js +0 -2
  30. package/dist/checkbox/checkbox-group-foundation.d.ts +0 -1
  31. package/dist/code-highlight/index.d.ts +0 -1
  32. package/dist/color-picker/color-picker.scss +0 -2
  33. package/dist/color-picker/interface.d.ts +0 -1
  34. package/dist/config-provider/responsive-types.d.ts +0 -16
  35. package/dist/cropper/foundation.d.ts +0 -1
  36. package/dist/cropper/foundation.js +0 -1
  37. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  38. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  39. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  40. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  41. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  42. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  43. package/dist/date-picker/_utils/parser.d.ts +0 -3
  44. package/dist/date-picker/_utils/parser.js +0 -7
  45. package/dist/date-picker/_utils/picker-type.d.ts +1 -3
  46. package/dist/date-picker/_utils/picker-type.js +0 -2
  47. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  48. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  49. package/dist/date-picker/date-picker.scss +0 -3
  50. package/dist/date-picker/foundation.d.ts +3 -22
  51. package/dist/date-picker/foundation.js +1 -24
  52. package/dist/date-picker/input-foundation.d.ts +1 -7
  53. package/dist/date-picker/input-foundation.js +0 -2
  54. package/dist/date-picker/month-foundation.d.ts +0 -3
  55. package/dist/date-picker/month-foundation.js +0 -2
  56. package/dist/date-picker/months-grid-foundation.d.ts +1 -10
  57. package/dist/date-picker/months-grid-foundation.js +1 -10
  58. package/dist/drag-move/foundation.d.ts +0 -1
  59. package/dist/dropdown/foundation.d.ts +0 -2
  60. package/dist/dropdown/menu-foundation.d.ts +1 -2
  61. package/dist/feedback/foundation.d.ts +0 -1
  62. package/dist/feedback/variables.scss +1 -5
  63. package/dist/float-button/float-button.css +0 -1
  64. package/dist/float-button/float-button.scss +0 -2
  65. package/dist/form/form.scss +0 -12
  66. package/dist/form/foundation.js +0 -15
  67. package/dist/form/interface.d.ts +2 -15
  68. package/dist/form/utils.d.ts +0 -8
  69. package/dist/form/utils.js +0 -7
  70. package/dist/form/variables.scss +1 -4
  71. package/dist/grid/variables.scss +0 -10
  72. package/dist/highlight/foundation.d.ts +0 -2
  73. package/dist/highlight/foundation.js +0 -2
  74. package/dist/hot-keys/foundation.d.ts +0 -1
  75. package/dist/image/image-foundation.d.ts +0 -2
  76. package/dist/image/preview-footer-foundation.d.ts +0 -1
  77. package/dist/image/preview-foundation.d.ts +0 -3
  78. package/dist/image/preview-image-foundation.d.ts +0 -1
  79. package/dist/image/preview-inner-foundation.d.ts +0 -1
  80. package/dist/input/foundation.d.ts +0 -1
  81. package/dist/input/text-entry-foundation.d.ts +0 -2
  82. package/dist/input/text-entry-foundation.js +0 -1
  83. package/dist/input/textarea-foundation.d.ts +0 -1
  84. package/dist/input-number/caret.d.ts +0 -1
  85. package/dist/input-number/caret.js +0 -1
  86. package/dist/input-number/foundation.d.ts +0 -5
  87. package/dist/input-number/foundation.js +0 -5
  88. package/dist/json-viewer/foundation.d.ts +0 -2
  89. package/dist/json-viewer/foundation.js +0 -1
  90. package/dist/locale/interface.d.ts +0 -3
  91. package/dist/markdown-render/foundation.d.ts +1 -6
  92. package/dist/markdown-render/foundation.js +1 -5
  93. package/dist/navigation/foundation.d.ts +0 -7
  94. package/dist/navigation/foundation.js +0 -6
  95. package/dist/navigation/sub-nav-foundation.d.ts +0 -1
  96. package/dist/notification/notification-list-foundation.d.ts +2 -3
  97. package/dist/notification/notification-list-foundation.js +0 -1
  98. package/dist/notification/variables.scss +0 -1
  99. package/dist/overflow-list/foundation.d.ts +0 -2
  100. package/dist/overflow-list/foundation.js +0 -1
  101. package/dist/pagination/foundation.d.ts +0 -2
  102. package/dist/pincode/foundation.d.ts +1 -4
  103. package/dist/pincode/foundation.js +1 -4
  104. package/dist/popconfirm/popconfirm-foundation.d.ts +0 -2
  105. package/dist/progress/generates.d.ts +1 -4
  106. package/dist/progress/generates.js +1 -4
  107. package/dist/progress/utils.d.ts +1 -1
  108. package/dist/progress/utils.js +1 -1
  109. package/dist/radio/radio-foundation.d.ts +0 -4
  110. package/dist/radio/radio-foundation.js +0 -1
  111. package/dist/radio/radio-group-foundation.d.ts +0 -1
  112. package/dist/rating/foundation.d.ts +0 -5
  113. package/dist/rating/foundation.js +0 -3
  114. package/dist/resizable/group/index.d.ts +0 -4
  115. package/dist/resizable/group/index.js +0 -4
  116. package/dist/resizable/resizable.scss +0 -1
  117. package/dist/resizable/single/index.d.ts +1 -5
  118. package/dist/resizable/single/index.js +1 -4
  119. package/dist/scroll-list/item-foundation.d.ts +0 -2
  120. package/dist/scroll-list/item-foundation.js +0 -1
  121. package/dist/scroll-list/variables.scss +1 -6
  122. package/dist/select/foundation.d.ts +0 -1
  123. package/dist/select/option-foundation.d.ts +2 -3
  124. package/dist/select/option-foundation.js +0 -1
  125. package/dist/select/variables.scss +1 -8
  126. package/dist/side-sheet/side-sheet-foundation.d.ts +1 -6
  127. package/dist/side-sheet/side-sheet-foundation.js +1 -5
  128. package/dist/side-sheet/variables.scss +1 -3
  129. package/dist/slider/foundation.d.ts +1 -12
  130. package/dist/slider/foundation.js +1 -13
  131. package/dist/slider/variables.scss +1 -5
  132. package/dist/spin/foundation.d.ts +0 -2
  133. package/dist/spin/foundation.js +0 -1
  134. package/dist/spin/variables.scss +1 -3
  135. package/dist/switch/foundation.d.ts +0 -1
  136. package/dist/switch/switch.scss +1 -1
  137. package/dist/switch/variables.scss +1 -5
  138. package/dist/table/foundation.d.ts +12 -21
  139. package/dist/table/foundation.js +51 -15
  140. package/dist/table/table.scss +0 -1
  141. package/dist/table/utils.d.ts +0 -8
  142. package/dist/table/utils.js +0 -13
  143. package/dist/table/variables.scss +1 -5
  144. package/dist/tabs/foundation.d.ts +0 -9
  145. package/dist/tabs/foundation.js +0 -4
  146. package/dist/tabs/tabs.scss +1 -1
  147. package/dist/tag/focus.js +0 -1
  148. package/dist/tag-input/foundation.d.ts +0 -2
  149. package/dist/tag-input/foundation.js +0 -1
  150. package/dist/tag-input/tag-input.scss +0 -1
  151. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  152. package/dist/tag-input/utils/tag-focus.js +0 -1
  153. package/dist/time-picker/combox-foundation.d.ts +3 -11
  154. package/dist/time-picker/combox-foundation.js +3 -10
  155. package/dist/time-picker/foundation.d.ts +0 -10
  156. package/dist/time-picker/foundation.js +0 -9
  157. package/dist/time-picker/utils/index.d.ts +0 -11
  158. package/dist/time-picker/utils/index.js +0 -11
  159. package/dist/tooltip/adjust-position.d.ts +1 -2
  160. package/dist/tooltip/constants.d.ts +0 -3
  161. package/dist/tooltip/constants.js +0 -3
  162. package/dist/tooltip/foundation.d.ts +0 -3
  163. package/dist/tooltip/foundation.js +0 -2
  164. package/dist/tooltip/position.scss +0 -1
  165. package/dist/transfer/foundation.d.ts +0 -4
  166. package/dist/transfer/foundation.js +0 -1
  167. package/dist/tree/foundation.d.ts +0 -2
  168. package/dist/tree/foundation.js +0 -1
  169. package/dist/tree/shared.d.ts +1 -3
  170. package/dist/tree/shared.js +0 -2
  171. package/dist/tree/tree-util.d.ts +0 -5
  172. package/dist/tree/tree-util.js +0 -5
  173. package/dist/tree-select/foundation.d.ts +0 -2
  174. package/dist/tree-select/foundation.js +0 -3
  175. package/dist/typography/ellipsis.d.ts +1 -3
  176. package/dist/typography/ellipsis.js +0 -2
  177. package/dist/typography/typography.scss +0 -1
  178. package/dist/upload/constants.d.ts +1 -1
  179. package/dist/upload/foundation.d.ts +0 -6
  180. package/dist/upload/foundation.js +1 -11
  181. package/dist/upload/utils.d.ts +0 -5
  182. package/dist/upload/utils.js +0 -5
  183. package/dist/user-guide/foundation.d.ts +0 -2
  184. package/dist/utils/a11y.d.ts +1 -5
  185. package/dist/utils/a11y.js +1 -4
  186. package/dist/utils/array.d.ts +0 -6
  187. package/dist/utils/array.js +0 -6
  188. package/dist/utils/date-fns-extra.js +1 -5
  189. package/dist/utils/dom.d.ts +0 -1
  190. package/dist/utils/dom.js +0 -1
  191. package/dist/utils/escape-html.js +0 -3
  192. package/dist/utils/field-sizing.d.ts +0 -2
  193. package/dist/utils/field-sizing.js +0 -2
  194. package/dist/utils/focus-handle.d.ts +0 -1
  195. package/dist/utils/focus-handle.js +0 -1
  196. package/dist/utils/focus-scope.d.ts +0 -1
  197. package/dist/utils/focus-scope.js +0 -1
  198. package/dist/utils/scroll-lock.d.ts +3 -4
  199. package/dist/utils/scroll-lock.js +3 -4
  200. package/dist/utils/tween.d.ts +0 -1
  201. package/dist/utils/tween.js +0 -1
  202. package/dist/utils/uuid.d.ts +0 -1
  203. package/dist/utils/uuid.js +0 -1
  204. package/dist/utils/warning.d.ts +0 -1
  205. package/dist/utils/warning.js +0 -1
  206. package/dist/video-player/progress-foundation.d.ts +0 -1
  207. package/dist/video-player/progress-foundation.js +0 -1
  208. package/dist/video-player/variables.scss +1 -1
  209. package/package.json +2 -2
@@ -104,7 +104,6 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
104
104
  this.#blurPending = false;
105
105
  this.adapter.notifyBlur(e);
106
106
  }
107
- /** Loads a node's children once, after it is expanded */
108
107
  #handleNodeLoad(key, data) {
109
108
  const { loadData } = this.getProps();
110
109
  const { loadedKeys, loadingKeys } = this.getStates();
@@ -365,7 +364,6 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
365
364
  newState.prevProps = { ...props };
366
365
  return newState;
367
366
  }
368
- /** The state of a new TreeSelect: the empty state with what the props imply */
369
367
  static getInitialState(props) {
370
368
  const state = {
371
369
  inputTriggerFocus: false,
@@ -437,7 +435,6 @@ var TreeSelectFoundation = class TreeSelectFoundation extends BaseFoundation {
437
435
  syncDerivedState = (derived) => {
438
436
  this.adapter.updateState(derived);
439
437
  };
440
- /** Searches as if `value` were typed, opening the dropdown first */
441
438
  search = (value) => {
442
439
  if (!this.getState("isOpen")) this.#open();
443
440
  this.#handleInputChange(value);
@@ -1,4 +1,4 @@
1
- /** The ellipsis fields the foundation resolves; `showTooltip` carries each framework's own tooltip config */
1
+ /** `showTooltip` carries each framework's own tooltip config */
2
2
  export interface EllipsisConfig<Tooltip> {
3
3
  collapseText?: string;
4
4
  collapsible?: boolean;
@@ -11,7 +11,6 @@ export interface EllipsisConfig<Tooltip> {
11
11
  }
12
12
  /** An unset field, or one explicitly undefined, takes the default; the expand and collapse texts default only when their button is enabled */
13
13
  export declare function getEllipsisOpt<Tooltip>(ellipsis: EllipsisConfig<Tooltip> | boolean, expandStr: string, collapseStr: string): Required<Omit<EllipsisConfig<Tooltip>, 'expandText' | 'collapseText'>> & Pick<EllipsisConfig<Tooltip>, 'expandText' | 'collapseText'>;
14
- /** Whether CSS can truncate the text; every other option needs the measured JS truncation */
15
14
  export declare function canUseCSSEllipsis({ expandable, expandText, pos, suffix }: Pick<EllipsisConfig<unknown>, 'expandable' | 'expandText' | 'pos' | 'suffix'>, copyable: unknown): boolean;
16
15
  /** Whether `node` is, or holds, a focusable item; the copy button is not the tab stop, so it does not count */
17
16
  export declare function isInsideWidgetItem(node: HTMLElement, copy?: Node | null): boolean;
@@ -20,7 +19,6 @@ export declare function getRenderText(originEle: HTMLElement, rows: number, cont
20
19
  expand: Node | null;
21
20
  copy: Node | null;
22
21
  }, suffix: string, ellipsisPos: string, isStrong: boolean): string;
23
- /** Whether the text overflows: in width for a single row, in height for several rows */
24
22
  export declare function isOverflowing(node: HTMLElement, rows: number): boolean;
25
23
  /**
26
24
  * The pending measurement frame, and the gate for ResizeObserver reports. The observer reports every newly
@@ -16,7 +16,6 @@ function getEllipsisOpt(ellipsis, expandStr, collapseStr) {
16
16
  collapseText: config.collapseText ?? (config.collapsible ? collapseStr : void 0)
17
17
  };
18
18
  }
19
- /** Whether CSS can truncate the text; every other option needs the measured JS truncation */
20
19
  function canUseCSSEllipsis({ expandable, expandText, pos, suffix }, copyable) {
21
20
  return !expandable && expandText === void 0 && !copyable && pos === "end" && !suffix;
22
21
  }
@@ -115,7 +114,6 @@ function isSingleRowOverflowing(containerNode) {
115
114
  return acc + range.getBoundingClientRect().width;
116
115
  }, 0) > contentAreaWidth;
117
116
  }
118
- /** Whether the text overflows: in width for a single row, in height for several rows */
119
117
  function isOverflowing(node, rows) {
120
118
  if (!rows || rows < 1) return false;
121
119
  return rows <= 1 ? isSingleRowOverflowing(node) : node.scrollHeight > node.offsetHeight;
@@ -139,7 +139,6 @@ $module: #{$prefix}-typography;
139
139
  white-space: nowrap;
140
140
 
141
141
  &.#{$module}-ellipsis-overflow-ellipsis-text {
142
- // max-width keeps it within the parent when no width is set
143
142
  display: inline-block;
144
143
  max-width: 100%;
145
144
  vertical-align: top;
@@ -11,7 +11,7 @@ export declare const strings: {
11
11
  FILE_STATUS_WAIT_UPLOAD: string;
12
12
  FILE_LIST_PIC: "picture";
13
13
  FILE_LIST_DEFAULT: "list";
14
- LIST_TYPE: ("list" | "picture" | "none")[];
14
+ LIST_TYPE: ("picture" | "list" | "none")[];
15
15
  DRAG_AREA_DEFAULT: string;
16
16
  DRAG_AREA_LEGAL: string;
17
17
  TRIGGER_AUTO: "auto";
@@ -132,17 +132,13 @@ export interface UploadBaseState {
132
132
  /** The uid of the item a pending replace will overwrite; the list may change while the user picks the file */
133
133
  replaceUid: string;
134
134
  cropperVisible: boolean;
135
- /** The image file currently being cropped */
136
135
  cropperFile: File | null;
137
- /** Object URL for the image currently being cropped */
138
136
  cropperSrc: string;
139
- /** Remaining image files queued for cropping (cropped one at a time) */
140
137
  pendingImageFiles: File[];
141
138
  /** Non-image files that bypass cropping but are uploaded together */
142
139
  nonImageFiles: File[];
143
140
  /** Image files already cropped, accumulated until the queue drains */
144
141
  croppedFiles: File[];
145
- /** The round was started by a replace, so the result replaces one item */
146
142
  isReplaceOperation: boolean;
147
143
  }
148
144
  export default class UploadFoundation<P extends UploadBaseProps = UploadBaseProps, S extends UploadBaseState = UploadBaseState, E extends UploadDragEvent = UploadDragEvent> extends BaseFoundation<UploadAdapter<P, S, E>, P, S> {
@@ -159,13 +155,11 @@ export default class UploadFoundation<P extends UploadBaseProps = UploadBaseProp
159
155
  protected checkFileFormat(accept: string, file: File): boolean;
160
156
  /** Closes the cropper and drops the queue; the files already cropped are discarded */
161
157
  cancelCrop: () => void;
162
- /** Crops the current image, then moves to the next queued one or adds every result once the queue drains */
163
158
  confirmCrop: () => Promise<void>;
164
159
  /** Keep the synchronous snapshot aligned with an externally controlled fileList. */
165
160
  syncLatestFileList: (fileList: Array<BaseFileItem>) => void;
166
161
  /** A fileList prop that goes back to undefined clears the list (a form reset) and leaves it uncontrolled */
167
162
  handleFileListPropChange: (fileList?: Array<BaseFileItem>) => void;
168
- /** The list on screen: the fileList prop when controlled, otherwise the fileList state. */
169
163
  getFileList(): BaseFileItem[];
170
164
  init(): void;
171
165
  /** Adds the files of a paste on the page; the host listens only while addOnPasting is on and not disabled */
@@ -373,10 +373,7 @@ var UploadFoundation = class extends BaseFoundation {
373
373
  this.adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
374
374
  this.adapter.notifyDrop(e, files, fileList);
375
375
  }
376
- /**
377
- * Keeps the files accept allows and reports the others. When accept leaves nothing it returns undefined after
378
- * calling `reset`: a remounted input fires change again when the same file is picked.
379
- */
376
+ /** When accept leaves nothing it returns undefined after calling `reset`: a remounted input fires change again when the same file is picked */
380
377
  #acceptFiles(files, reset) {
381
378
  const { accept } = this.getProps();
382
379
  if (typeof accept === "undefined") return files;
@@ -428,7 +425,6 @@ var UploadFoundation = class extends BaseFoundation {
428
425
  isReplaceOperation
429
426
  });
430
427
  }
431
- /** Filters by accept, then crops the images (when `crop` is on and allowed) or adds the files to the list */
432
428
  #selectFiles(currentFileList, allowCrop) {
433
429
  let files = this.#acceptFiles(currentFileList, () => this.adapter.resetInput());
434
430
  if (!files) return;
@@ -442,10 +438,6 @@ var UploadFoundation = class extends BaseFoundation {
442
438
  }
443
439
  this.#addSelected(files);
444
440
  }
445
- /**
446
- * Pipeline for files that passed accept: transform and assign uid, flag invalid sizes, apply limit, add to the
447
- * list; with uploadTrigger 'auto', each file with a valid size then goes through beforeUpload and the upload.
448
- */
449
441
  #addSelected(selected) {
450
442
  const { limit } = this.getProps();
451
443
  const fileList = this.getFileList();
@@ -565,7 +557,6 @@ var UploadFoundation = class extends BaseFoundation {
565
557
  this.adapter.resetInput();
566
558
  this.adapter.resetReplaceInput();
567
559
  };
568
- /** Crops the current image, then moves to the next queued one or adds every result once the queue drains */
569
560
  confirmCrop = async () => {
570
561
  const { cropperFile, cropperSrc, pendingImageFiles, nonImageFiles, croppedFiles, isReplaceOperation } = this.getStates();
571
562
  const { crop } = this.getProps();
@@ -608,7 +599,6 @@ var UploadFoundation = class extends BaseFoundation {
608
599
  handleFileListPropChange = (fileList) => {
609
600
  if (fileList === void 0) this.#updateFileListInternal([]);
610
601
  };
611
- /** The list on screen: the fileList prop when controlled, otherwise the fileList state. */
612
602
  getFileList() {
613
603
  const props = this.getProps();
614
604
  return props.fileList === void 0 ? this.getState("fileList") : props.fileList || [];
@@ -3,12 +3,7 @@ export declare const byteMB = 1048576;
3
3
  export declare const addAreaControlAttributes: string[];
4
4
  export declare function containsControl(node: HTMLElement): boolean;
5
5
  export declare function containsName(node: HTMLElement): boolean;
6
- /** The position of the card that holds `target`; -1 when it is outside the cards, like the clear button */
7
6
  export declare function indexOfCard(cards: ArrayLike<Element>, target: Node): number;
8
- /**
9
- * Where focus goes once the control that held it left the list (a card removed, cleared, retried or replaced): the
10
- * remove button of the card now at `index`, else of the last card, else the add area.
11
- */
12
7
  export declare function getFocusHandoverTarget(cards: ArrayLike<Element>, index: number, addArea: HTMLElement | null): HTMLElement | null;
13
8
  /**
14
9
  * Remembers which control in the file list held focus. Removing, clearing, retrying or replacing a file (or disabling
@@ -17,14 +17,9 @@ function containsControl(node) {
17
17
  function containsName(node) {
18
18
  return (node.textContent ?? "").trim() !== "" || node.querySelector("[aria-label],[aria-labelledby],[alt]") !== null;
19
19
  }
20
- /** The position of the card that holds `target`; -1 when it is outside the cards, like the clear button */
21
20
  function indexOfCard(cards, target) {
22
21
  return Array.from(cards).findIndex((card) => card.contains(target));
23
22
  }
24
- /**
25
- * Where focus goes once the control that held it left the list (a card removed, cleared, retried or replaced): the
26
- * remove button of the card now at `index`, else of the last card, else the add area.
27
- */
28
23
  function getFocusHandoverTarget(cards, index, addArea) {
29
24
  const card = index >= 0 ? cards[Math.min(index, cards.length - 1)] : void 0;
30
25
  const cardTarget = card && (card.querySelector(`.${cssClasses.PREFIX}-file-card-close, .${cssClasses.PREFIX}-picture-file-card-close`) ?? FocusTrapHandle.getFocusableElements(card).find((node) => node instanceof HTMLElement));
@@ -9,12 +9,10 @@ export interface UserGuideAdapter<P extends UserGuideBaseProps = UserGuideBasePr
9
9
  disabledBodyScroll: () => void;
10
10
  enabledBodyScroll: () => void;
11
11
  }
12
- /** The props the foundation reads */
13
12
  export interface UserGuideBaseProps {
14
13
  current?: number;
15
14
  steps: unknown[];
16
15
  }
17
- /** The state the foundation reads */
18
16
  export interface UserGuideBaseState {
19
17
  current: number;
20
18
  }
@@ -8,7 +8,6 @@ export declare function setFocusToItem(itemNodes: HTMLElement[], targetItem: HTM
8
8
  export declare function setFocusToFirstItem(itemNodes: HTMLElement[]): void;
9
9
  export declare function setFocusToLastItem(itemNodes: HTMLElement[]): void;
10
10
  export interface ListNavigationOptions {
11
- /** Arrows past either end wrap around instead of staying */
12
11
  loop?: boolean;
13
12
  /** Which arrows step: Up and Down for a vertical list, Left and Right (swapped in RTL) for a horizontal one */
14
13
  orientation?: 'vertical' | 'horizontal';
@@ -87,10 +86,7 @@ export declare class Typeahead {
87
86
  */
88
87
  match(key: string, labels: string[], current: number): number;
89
88
  }
90
- /**
91
- * Development-only: warns when a dialog has no accessible name, which screen readers would announce as just
92
- * "dialog". The name comes from `aria-label` or from the element `aria-labelledby` points at (usually the title).
93
- */
89
+ /** Development-only: warns when a dialog has no accessible name, which screen readers would announce as just "dialog" */
94
90
  export declare function warnIfDialogUnnamed(dialog: HTMLElement | null, component: string): void;
95
91
  /**
96
92
  * `root`: the document or shadow root the popup lives in, which also holds its trigger (the popup is portaled into the
@@ -147,10 +147,7 @@ var Typeahead = class {
147
147
  return -1;
148
148
  }
149
149
  };
150
- /**
151
- * Development-only: warns when a dialog has no accessible name, which screen readers would announce as just
152
- * "dialog". The name comes from `aria-label` or from the element `aria-labelledby` points at (usually the title).
153
- */
150
+ /** Development-only: warns when a dialog has no accessible name, which screen readers would announce as just "dialog" */
154
151
  function warnIfDialogUnnamed(dialog, component) {
155
152
  if (!isDev() || !dialog) return;
156
153
  const labelledBy = dialog.getAttribute("aria-labelledby");
@@ -1,10 +1,4 @@
1
- /**
2
- * A new array of the unique items of source that are not in removed
3
- *
4
- * differenceUnique(['a', 'b', 'c', 'a', 'b', 'c'], ['a', 'c']) => ['b']
5
- */
6
1
  export declare function differenceUnique<T>(source: T[], removed: T[]): T[];
7
2
  type CompareFn<T> = (a: T, b: T, sortOrder: 'ascend' | 'descend') => number;
8
- /** Wraps a compare function so that `descend` flips its sign */
9
3
  export declare function withOrderSort<T = any>(fn: CompareFn<T>, order?: 'ascend' | 'descend'): (a: T, b: T) => number;
10
4
  export {};
@@ -1,14 +1,8 @@
1
1
  import { difference, uniq } from "es-toolkit";
2
2
  // src/utils/array.ts
3
- /**
4
- * A new array of the unique items of source that are not in removed
5
- *
6
- * differenceUnique(['a', 'b', 'c', 'a', 'b', 'c'], ['a', 'c']) => ['b']
7
- */
8
3
  function differenceUnique(source, removed) {
9
4
  return difference(uniq(source), removed);
10
5
  }
11
- /** Wraps a compare function so that `descend` flips its sign */
12
6
  function withOrderSort(fn, order = "ascend") {
13
7
  switch (order) {
14
8
  case "descend": return (a, b) => {
@@ -29,10 +29,7 @@ function isValidTimezoneIANAString(timeZoneString) {
29
29
  }
30
30
  const MILLISECONDS_IN_MINUTE = 6e4;
31
31
  const MILLISECONDS_IN_DAY = 864e5;
32
- /**
33
- * UTC offset of `timeZone` (IANA name or ±HH[:MM]) at the instant `time` in milliseconds, positive east of UTC. No
34
- * zone or Z means UTC; an unknown zone gives NaN.
35
- */
32
+ /** UTC offset of `timeZone` (IANA name or ±HH[:MM]) at the instant `time` in milliseconds, positive east of UTC */
36
33
  function zoneOffset(timeZone, time) {
37
34
  if (!timeZone || timeZone === "Z") return 0;
38
35
  if (!isValidTimezoneIANAString(timeZone)) return NaN;
@@ -48,7 +45,6 @@ function wallTimeToInstant(wallTime, timeZone) {
48
45
  const offsetAfter = zoneOffset(timeZone, wallTime + MILLISECONDS_IN_DAY);
49
46
  return [wallTime - Math.max(offsetBefore, offsetAfter), wallTime - Math.min(offsetBefore, offsetAfter)].find((time) => time + zoneOffset(timeZone, time) === wallTime) ?? wallTime - offsetBefore;
50
47
  }
51
- /** Wall-clock fields of a system-local Date read as UTC */
52
48
  function wallTimeAsUtc(date) {
53
49
  const utc = /* @__PURE__ */ new Date(0);
54
50
  utc.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
@@ -11,7 +11,6 @@ export interface RegisterMediaQueryOption {
11
11
  unmatch?: (e: MediaQueryList | MediaQueryListEvent) => void;
12
12
  callInInit?: boolean;
13
13
  }
14
- /** Returns the function that removes the listener */
15
14
  export declare function registerMediaQuery(media: string, { match, unmatch, callInInit }: RegisterMediaQueryOption): () => void;
16
15
  /**
17
16
  * Whether an overlay rendered through `getPopupContainer` covers the page: no container, or one that resolves to body.
package/dist/utils/dom.js CHANGED
@@ -11,7 +11,6 @@ function isEventInside(e, ...nodes) {
11
11
  const path = e.composedPath();
12
12
  return nodes.some((node) => node != null && path.includes(node));
13
13
  }
14
- /** Returns the function that removes the listener */
15
14
  function registerMediaQuery(media, { match, unmatch, callInInit = true }) {
16
15
  if (typeof window !== "undefined") {
17
16
  const mediaQueryList = window.matchMedia(media);
@@ -29,9 +29,6 @@ function escapeHtmlInMarkdown(text) {
29
29
  }
30
30
  return result.join("\n");
31
31
  }
32
- /**
33
- * Escape `<` to `&lt;` in a single line, but preserve content inside inline code spans.
34
- */
35
32
  function escapeAngleBracketsOutsideInlineCode(line) {
36
33
  const parts = [];
37
34
  let i = 0;
@@ -9,7 +9,5 @@ export declare function supportsFieldSizing(): boolean;
9
9
  * min-block-size and max-block-size clamp the height.
10
10
  */
11
11
  export declare function fitTextareaHeight(textarea: HTMLTextAreaElement): number;
12
- /** Sets the input's inline width to fit its value, or its placeholder while empty. */
13
12
  export declare function fitInputWidth(input: HTMLInputElement): number;
14
- /** Calls `refit` when web fonts finish loading, which changes text metrics after the first measurement. */
15
13
  export declare function onFontsLoaded(refit: () => void, signal: AbortSignal): void;
@@ -20,7 +20,6 @@ function fitTextareaHeight(textarea) {
20
20
  textarea.scrollTop = scrollTop;
21
21
  return height;
22
22
  }
23
- /** Sets the input's inline width to fit its value, or its placeholder while empty. */
24
23
  function fitInputWidth(input) {
25
24
  const style = getComputedStyle(input);
26
25
  const mirror = document.createElement("span");
@@ -45,7 +44,6 @@ function fitInputWidth(input) {
45
44
  input.style.width = `${width}px`;
46
45
  return width;
47
46
  }
48
- /** Calls `refit` when web fonts finish loading, which changes text metrics after the first measurement. */
49
47
  function onFontsLoaded(refit, signal) {
50
48
  document.fonts.addEventListener("loadingdone", refit, { signal });
51
49
  }
@@ -23,7 +23,6 @@ export default class FocusTrapHandle {
23
23
  static shouldRestoreFocus(container: HTMLElement | null | undefined, modal: boolean): boolean;
24
24
  /** Whether focus is inside `container` and was moved there by the keyboard, so closing it should hand focus back */
25
25
  static isFocusVisibleWithin(container?: HTMLElement | null): boolean;
26
- /** Focuses the first focusable element in `container`, or the container itself when it holds none */
27
26
  static focusFirstOrSelf(container?: HTMLElement | null, options?: FocusOptions): void;
28
27
  /** The first focusable element marked autofocus; neither the browser nor Vue focuses one that is inserted later */
29
28
  static findAutofocus(container: HTMLElement): FocusableElement | undefined;
@@ -63,7 +63,6 @@ var FocusTrapHandle = class FocusTrapHandle {
63
63
  const active = FocusTrapHandle.getActiveElement(container);
64
64
  return Boolean(container && active && container.contains(active) && active.matches(":focus-visible"));
65
65
  }
66
- /** Focuses the first focusable element in `container`, or the container itself when it holds none */
67
66
  static focusFirstOrSelf(container, options) {
68
67
  (container ? FocusTrapHandle.getFocusableElements(container)[0] ?? container : void 0)?.focus(options);
69
68
  }
@@ -12,7 +12,6 @@ export default class FocusScope {
12
12
  activate(container: HTMLElement, preventScroll?: boolean): void;
13
13
  /** Focuses `container` without trapping Tab, for a non-modal overlay; an element inside may already have focus */
14
14
  enter(container: HTMLElement, preventScroll?: boolean): void;
15
- /** `activate` for a modal overlay, `enter` for a non-modal one */
16
15
  engage: (container: HTMLElement, modal: boolean, preventScroll?: boolean) => void;
17
16
  deactivate: () => void;
18
17
  /** Focuses the recorded element again; call it after the inert around the overlay is released */
@@ -54,7 +54,6 @@ var FocusScope = class {
54
54
  if (!container.contains(FocusTrapHandle.getActiveElement(container))) container.focus({ preventScroll });
55
55
  if (!container.contains(FocusTrapHandle.getActiveElement(container))) FocusTrapHandle.getFocusableElements(container)[0]?.focus({ preventScroll });
56
56
  }
57
- /** `activate` for a modal overlay, `enter` for a non-modal one */
58
57
  engage = (container, modal, preventScroll) => {
59
58
  if (modal) this.activate(container, preventScroll);
60
59
  else this.enter(container, preventScroll);
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Stops the page from scrolling behind an overlay and returns the function that releases this lock. Locks are
3
- * counted, so stacked overlays release the page only when the last one closes. The body's end padding grows by the
4
- * scrollbar width, so the page does not shift sideways when its scrollbar disappears; padding rather than width keeps
5
- * the body's own margin and any width set by the page's stylesheet.
2
+ * Locks are counted, so stacked overlays release the page only when the last one closes. The body's end padding grows
3
+ * by the scrollbar width, so the page does not shift sideways when its scrollbar disappears; padding rather than width
4
+ * keeps the body's own margin and any width set by the page's stylesheet.
6
5
  */
7
6
  export declare function lockBodyScroll(): () => void;
@@ -2,10 +2,9 @@
2
2
  let lockCount = 0;
3
3
  let restore = null;
4
4
  /**
5
- * Stops the page from scrolling behind an overlay and returns the function that releases this lock. Locks are
6
- * counted, so stacked overlays release the page only when the last one closes. The body's end padding grows by the
7
- * scrollbar width, so the page does not shift sideways when its scrollbar disappears; padding rather than width keeps
8
- * the body's own margin and any width set by the page's stylesheet.
5
+ * Locks are counted, so stacked overlays release the page only when the last one closes. The body's end padding grows
6
+ * by the scrollbar width, so the page does not shift sideways when its scrollbar disappears; padding rather than width
7
+ * keeps the body's own margin and any width set by the page's stylesheet.
9
8
  */
10
9
  function lockBodyScroll() {
11
10
  if (lockCount === 0) {
@@ -10,5 +10,4 @@ export interface TweenOptions {
10
10
  onFrame: (value: number) => void;
11
11
  onEnd?: () => void;
12
12
  }
13
- /** Animates a number from `from` to `to` once per frame; returns a function that cancels it */
14
13
  export declare function tween({ from, to, duration, easing, onFrame, onEnd }: TweenOptions): () => void;
@@ -1,7 +1,6 @@
1
1
  // src/utils/tween.ts
2
2
  const linear = (t) => t;
3
3
  const easeInOutCubic = (t) => t < .5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2;
4
- /** Animates a number from `from` to `to` once per frame; returns a function that cancels it */
5
4
  function tween({ from, to, duration, easing = linear, onFrame, onEnd }) {
6
5
  let start;
7
6
  let frame = requestAnimationFrame(function step(now) {
@@ -1,2 +1 @@
1
- /** Random unique id, as `${prefix}-${uuid}` when a prefix is given */
2
1
  export declare function createId(prefix?: string): string;
@@ -1,5 +1,4 @@
1
1
  // src/utils/uuid.ts
2
- /** Random unique id, as `${prefix}-${uuid}` when a prefix is given */
3
2
  function createId(prefix) {
4
3
  const id = crypto.randomUUID();
5
4
  return prefix ? `${prefix}-${id}` : id;
@@ -4,5 +4,4 @@
4
4
  * false in the browser, silencing every check.
5
5
  */
6
6
  export declare function isDev(): boolean;
7
- /** Prints `info` as a development-time warning when `flag` holds; production builds print nothing */
8
7
  export default function warning(flag: boolean, info: string): void;
@@ -7,7 +7,6 @@
7
7
  function isDev() {
8
8
  return process.env.NODE_ENV !== "production";
9
9
  }
10
- /** Prints `info` as a development-time warning when `flag` holds; production builds print nothing */
11
10
  function warning(flag, info) {
12
11
  if (flag && isDev()) console.warn(`Warning: ${info}`);
13
12
  }
@@ -58,7 +58,6 @@ export default class VideoProgressFoundation<P extends VideoProgressBaseProps =
58
58
  static getMarkerTitle(list: MarkerListItem[], value: number): string | undefined;
59
59
  /** The handle's `left`; the 8px is half the handle's width in the stylesheet */
60
60
  static getHandleLeft(value: number, max: number): string;
61
- /** How much of a marker `value` covers, as a CSS width */
62
61
  static getValueWidth({ start, end }: MarkerListItem, value: number): string;
63
62
  /** The APG slider keys: arrows move by `step`, PageUp and PageDown by a tenth of `max`, Home and End to the ends */
64
63
  handleKeyDown: (e: ProgressKeyboardEvent) => void;
@@ -53,7 +53,6 @@ var VideoProgressFoundation = class VideoProgressFoundation extends BaseFoundati
53
53
  static getHandleLeft(value, max) {
54
54
  return `calc(${(max ? value / max : 0) * 100}% - 8px)`;
55
55
  }
56
- /** How much of a marker `value` covers, as a CSS width */
57
56
  static getValueWidth({ start, end }, value) {
58
57
  if (end <= start) return "0%";
59
58
  if (value > end) return "calc(100% - 2px)";
@@ -9,7 +9,7 @@ $color-videoPlayer_notification-bg: var(--semi-color-overlay-bg); // notificatio
9
9
  $color-videoPlayer_notification-text: var(--semi-color-default); // notification 字体色
10
10
  $color-videoPlayer_controls-bg: rgba(28, 31, 35, 0.8); // 控制栏背景色
11
11
  $color-videoPlayer_controls-text: #fff; // 控制栏文字色
12
- // AudioPlayer 弹层在浅色下的深灰;控制栏文字固定为白色,所以不用随主题翻转的 --semi-grey-8
12
+ // control bar text is always white, so this cannot use --semi-grey-8, which flips with the theme
13
13
  $color-videoPlayer_controls_popup-bg: rgb(46, 50, 56); // 音量弹层与菜单背景色
14
14
  $color-videoPlayer_controls_item_popup-bg-default: var(--semi-color-overlay-bg); // 控制栏弹层背景色
15
15
  $color-videoPlayer_controls_item_popup-bg-hover: rgba(67, 68, 74, 1); // 控制栏弹层背景色 - hover
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibrae/semi-foundation",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "homepage": "https://semi-design-next.pages.dev",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@date-fns/tz": "^1.5.0",
27
27
  "@dnd-kit/dom": "~0.5.1",
28
- "@fibrae/semi-json-viewer-core": "0.2.0",
28
+ "@fibrae/semi-json-viewer-core": "0.3.1",
29
29
  "@mdx-js/mdx": "^3.1.1",
30
30
  "@shikijs/core": "^4.5.0",
31
31
  "async-validator": "^4.2.5",