@sprawlify/primitives 0.0.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.
- package/dist/anatomy.cjs +3 -0
- package/dist/anatomy.d.cts +2 -0
- package/dist/anatomy.d.mts +2 -0
- package/dist/anatomy.mjs +3 -0
- package/dist/aria-hidden-DqYx0f_y.mjs +177 -0
- package/dist/aria-hidden-DtLU6hSU.cjs +182 -0
- package/dist/aria-hidden.cjs +4 -0
- package/dist/aria-hidden.d.cts +16 -0
- package/dist/aria-hidden.d.mts +16 -0
- package/dist/aria-hidden.mjs +4 -0
- package/dist/auto-resize-D3qHtFy1.mjs +114 -0
- package/dist/auto-resize-xzlPFDyD.cjs +125 -0
- package/dist/auto-resize.cjs +5 -0
- package/dist/auto-resize.d.cts +17 -0
- package/dist/auto-resize.d.mts +17 -0
- package/dist/auto-resize.mjs +4 -0
- package/dist/chunk-CbDLau6x.cjs +34 -0
- package/dist/collection-8XqaNHs_.mjs +1279 -0
- package/dist/collection-DIoIDISa.cjs +1326 -0
- package/dist/collection.cjs +11 -0
- package/dist/collection.d.cts +5 -0
- package/dist/collection.d.mts +5 -0
- package/dist/collection.mjs +4 -0
- package/dist/color-BkAP1Tkd.d.mts +60 -0
- package/dist/color-VKewNv2e.d.cts +60 -0
- package/dist/color-utils-Cc5GVXZh.mjs +657 -0
- package/dist/color-utils-LER_6Zwu.cjs +680 -0
- package/dist/color-utils.cjs +7 -0
- package/dist/color-utils.d.cts +19 -0
- package/dist/color-utils.d.mts +19 -0
- package/dist/color-utils.mjs +4 -0
- package/dist/core-30pJjyC2.d.mts +49 -0
- package/dist/core-CQFbMdTl.cjs +176 -0
- package/dist/core-CefBjbst.d.cts +49 -0
- package/dist/core-DCFNMTZF.mjs +129 -0
- package/dist/core.cjs +12 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.mts +3 -0
- package/dist/core.mjs +5 -0
- package/dist/create-anatomy-B3XYc-qG.d.mts +70 -0
- package/dist/create-anatomy-BGQ8pv8J.d.cts +70 -0
- package/dist/create-anatomy-BbDZbHpC.mjs +39 -0
- package/dist/create-anatomy-CDsIFUXg.cjs +45 -0
- package/dist/create-props-BnF_vl-E.mjs +5 -0
- package/dist/create-props-YKy7JIKj.cjs +11 -0
- package/dist/data-url-C3ITPVRX.d.cts +10 -0
- package/dist/data-url-DLwZ9M77.d.mts +10 -0
- package/dist/date-utils-D2xPHa_I.cjs +738 -0
- package/dist/date-utils-wEa1hhpc.mjs +474 -0
- package/dist/date-utils.cjs +46 -0
- package/dist/date-utils.d.cts +101 -0
- package/dist/date-utils.d.mts +2 -0
- package/dist/date-utils.mjs +3 -0
- package/dist/defineProperty-BoUOT9Ie.cjs +49 -0
- package/dist/defineProperty-DrXfyjd4.mjs +43 -0
- package/dist/dismissable-CTfKZ4OG.cjs +282 -0
- package/dist/dismissable-DDrx0xnH.mjs +271 -0
- package/dist/dismissable-layer-C7pZU2wi.d.cts +39 -0
- package/dist/dismissable-layer-t_b0fk-p.d.mts +39 -0
- package/dist/dismissable.cjs +7 -0
- package/dist/dismissable.d.cts +3 -0
- package/dist/dismissable.d.mts +3 -0
- package/dist/dismissable.mjs +6 -0
- package/dist/dom-query-CWZdWUGp.cjs +2141 -0
- package/dist/dom-query-DFCRhyj1.mjs +1374 -0
- package/dist/dom-query.cjs +130 -0
- package/dist/dom-query.d.cts +307 -0
- package/dist/dom-query.d.mts +307 -0
- package/dist/dom-query.mjs +3 -0
- package/dist/file-utils.cjs +220 -0
- package/dist/file-utils.d.cts +51 -0
- package/dist/file-utils.d.mts +51 -0
- package/dist/file-utils.mjs +210 -0
- package/dist/focus-trap-D-bypQEJ.mjs +485 -0
- package/dist/focus-trap-D4i52S9A.cjs +496 -0
- package/dist/focus-trap.cjs +5 -0
- package/dist/focus-trap.d.cts +88 -0
- package/dist/focus-trap.d.mts +88 -0
- package/dist/focus-trap.mjs +4 -0
- package/dist/focus-visible-DYTWdWpa.cjs +210 -0
- package/dist/focus-visible-irppYatv.mjs +175 -0
- package/dist/focus-visible.cjs +9 -0
- package/dist/focus-visible.d.cts +31 -0
- package/dist/focus-visible.d.mts +31 -0
- package/dist/focus-visible.mjs +4 -0
- package/dist/functions-BOkTDEFM.d.cts +15 -0
- package/dist/functions-IZtWcC8Q.d.mts +15 -0
- package/dist/highlight-word.cjs +100 -0
- package/dist/highlight-word.d.cts +24 -0
- package/dist/highlight-word.d.mts +24 -0
- package/dist/highlight-word.mjs +99 -0
- package/dist/hotkeys.cjs +758 -0
- package/dist/hotkeys.d.cts +130 -0
- package/dist/hotkeys.d.mts +130 -0
- package/dist/hotkeys.mjs +754 -0
- package/dist/i18n-utils.cjs +450 -0
- package/dist/i18n-utils.d.cts +61 -0
- package/dist/i18n-utils.d.mts +61 -0
- package/dist/i18n-utils.mjs +440 -0
- package/dist/index-BkzYij2j.d.mts +25 -0
- package/dist/index-Bqw3r34-.d.cts +1383 -0
- package/dist/index-C0MKXQmE.d.mts +1383 -0
- package/dist/index-C9-feK5c.d.cts +25 -0
- package/dist/index-CD5FN7kY.d.mts +114 -0
- package/dist/index-CJji6wHl.d.cts +15 -0
- package/dist/index-CNi5FkPe.d.mts +15 -0
- package/dist/index-D96rs8B0.d.mts +115 -0
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/interact-outside-BplxR9cR.mjs +200 -0
- package/dist/interact-outside-C8-oFBpB.cjs +205 -0
- package/dist/interact-outside.cjs +5 -0
- package/dist/interact-outside.d.cts +2 -0
- package/dist/interact-outside.d.mts +2 -0
- package/dist/interact-outside.mjs +5 -0
- package/dist/json-tree-utils.cjs +1512 -0
- package/dist/json-tree-utils.d.cts +117 -0
- package/dist/json-tree-utils.d.mts +117 -0
- package/dist/json-tree-utils.mjs +1463 -0
- package/dist/list-collection-BIMJGQjn.d.cts +61 -0
- package/dist/list-collection-Db3eixRU.d.mts +61 -0
- package/dist/live-region-CcZPGo89.cjs +52 -0
- package/dist/live-region-CnPh21WH.mjs +46 -0
- package/dist/live-region.cjs +3 -0
- package/dist/live-region.d.cts +2 -0
- package/dist/live-region.d.mts +2 -0
- package/dist/live-region.mjs +3 -0
- package/dist/machines/accordion/index.cjs +328 -0
- package/dist/machines/accordion/index.d.cts +83 -0
- package/dist/machines/accordion/index.d.mts +83 -0
- package/dist/machines/accordion/index.mjs +322 -0
- package/dist/machines/async-list/index.cjs +311 -0
- package/dist/machines/async-list/index.d.cts +89 -0
- package/dist/machines/async-list/index.d.mts +89 -0
- package/dist/machines/async-list/index.mjs +310 -0
- package/dist/machines/avatar/index.cjs +169 -0
- package/dist/machines/avatar/index.d.cts +63 -0
- package/dist/machines/avatar/index.d.mts +63 -0
- package/dist/machines/avatar/index.mjs +165 -0
- package/dist/machines/bottom-sheet/index.cjs +676 -0
- package/dist/machines/bottom-sheet/index.d.cts +239 -0
- package/dist/machines/bottom-sheet/index.d.mts +239 -0
- package/dist/machines/bottom-sheet/index.mjs +672 -0
- package/dist/machines/carousel/index.cjs +859 -0
- package/dist/machines/carousel/index.d.cts +146 -0
- package/dist/machines/carousel/index.d.mts +146 -0
- package/dist/machines/carousel/index.mjs +851 -0
- package/dist/machines/checkbox/index.cjs +316 -0
- package/dist/machines/checkbox/index.d.cts +81 -0
- package/dist/machines/checkbox/index.d.mts +81 -0
- package/dist/machines/checkbox/index.mjs +312 -0
- package/dist/machines/clipboard/index.cjs +225 -0
- package/dist/machines/clipboard/index.d.cts +68 -0
- package/dist/machines/clipboard/index.d.mts +68 -0
- package/dist/machines/clipboard/index.mjs +219 -0
- package/dist/machines/collapsible/index.cjs +362 -0
- package/dist/machines/collapsible/index.d.cts +82 -0
- package/dist/machines/collapsible/index.d.mts +82 -0
- package/dist/machines/collapsible/index.mjs +358 -0
- package/dist/machines/color-picker/index.cjs +1529 -0
- package/dist/machines/color-picker/index.d.cts +205 -0
- package/dist/machines/color-picker/index.d.mts +205 -0
- package/dist/machines/color-picker/index.mjs +1514 -0
- package/dist/machines/combobox/index.cjs +1593 -0
- package/dist/machines/combobox/index.d.cts +214 -0
- package/dist/machines/combobox/index.d.mts +214 -0
- package/dist/machines/combobox/index.mjs +1582 -0
- package/dist/machines/date-picker/index.cjs +2177 -0
- package/dist/machines/date-picker/index.d.cts +350 -0
- package/dist/machines/date-picker/index.d.mts +350 -0
- package/dist/machines/date-picker/index.mjs +2161 -0
- package/dist/machines/dialog/index.cjs +325 -0
- package/dist/machines/dialog/index.d.cts +80 -0
- package/dist/machines/dialog/index.d.mts +80 -0
- package/dist/machines/dialog/index.mjs +321 -0
- package/dist/machines/editable/index.cjs +551 -0
- package/dist/machines/editable/index.d.cts +114 -0
- package/dist/machines/editable/index.d.mts +114 -0
- package/dist/machines/editable/index.mjs +547 -0
- package/dist/machines/floating-panel/index.cjs +995 -0
- package/dist/machines/floating-panel/index.d.cts +147 -0
- package/dist/machines/floating-panel/index.d.mts +147 -0
- package/dist/machines/floating-panel/index.mjs +988 -0
- package/dist/machines/hover-card/index.cjs +383 -0
- package/dist/machines/hover-card/index.d.cts +69 -0
- package/dist/machines/hover-card/index.d.mts +69 -0
- package/dist/machines/hover-card/index.mjs +379 -0
- package/dist/machines/image-cropper/index.cjs +1995 -0
- package/dist/machines/image-cropper/index.d.cts +182 -0
- package/dist/machines/image-cropper/index.d.mts +182 -0
- package/dist/machines/image-cropper/index.mjs +1990 -0
- package/dist/machines/listbox/index.cjs +794 -0
- package/dist/machines/listbox/index.d.cts +168 -0
- package/dist/machines/listbox/index.d.mts +168 -0
- package/dist/machines/listbox/index.mjs +782 -0
- package/dist/machines/marquee/index.cjs +395 -0
- package/dist/machines/marquee/index.d.cts +102 -0
- package/dist/machines/marquee/index.d.mts +102 -0
- package/dist/machines/marquee/index.mjs +391 -0
- package/dist/machines/menu/index.cjs +1298 -0
- package/dist/machines/menu/index.d.cts +175 -0
- package/dist/machines/menu/index.d.mts +175 -0
- package/dist/machines/menu/index.mjs +1286 -0
- package/dist/machines/navigation-menu/index.cjs +861 -0
- package/dist/machines/navigation-menu/index.d.cts +127 -0
- package/dist/machines/navigation-menu/index.d.mts +127 -0
- package/dist/machines/navigation-menu/index.mjs +857 -0
- package/dist/machines/number-input/index.cjs +996 -0
- package/dist/machines/number-input/index.d.cts +134 -0
- package/dist/machines/number-input/index.d.mts +134 -0
- package/dist/machines/number-input/index.mjs +991 -0
- package/dist/machines/pagination/index.cjs +419 -0
- package/dist/machines/pagination/index.d.cts +139 -0
- package/dist/machines/pagination/index.d.mts +139 -0
- package/dist/machines/pagination/index.mjs +411 -0
- package/dist/machines/password-input/index.cjs +228 -0
- package/dist/machines/password-input/index.d.cts +71 -0
- package/dist/machines/password-input/index.d.mts +71 -0
- package/dist/machines/password-input/index.mjs +224 -0
- package/dist/machines/pin-input/index.cjs +523 -0
- package/dist/machines/pin-input/index.d.cts +105 -0
- package/dist/machines/pin-input/index.d.mts +105 -0
- package/dist/machines/pin-input/index.mjs +519 -0
- package/dist/machines/popover/index.cjs +430 -0
- package/dist/machines/popover/index.d.cts +88 -0
- package/dist/machines/popover/index.d.mts +88 -0
- package/dist/machines/popover/index.mjs +426 -0
- package/dist/machines/presence/index.cjs +192 -0
- package/dist/machines/presence/index.d.cts +44 -0
- package/dist/machines/presence/index.d.mts +44 -0
- package/dist/machines/presence/index.mjs +190 -0
- package/dist/machines/progress/index.cjs +288 -0
- package/dist/machines/progress/index.d.cts +96 -0
- package/dist/machines/progress/index.d.mts +96 -0
- package/dist/machines/progress/index.mjs +284 -0
- package/dist/machines/qr-code/index.cjs +172 -0
- package/dist/machines/qr-code/index.d.cts +70 -0
- package/dist/machines/qr-code/index.d.mts +70 -0
- package/dist/machines/qr-code/index.mjs +167 -0
- package/dist/machines/radio-group/index.cjs +436 -0
- package/dist/machines/radio-group/index.d.cts +106 -0
- package/dist/machines/radio-group/index.d.mts +106 -0
- package/dist/machines/radio-group/index.mjs +430 -0
- package/dist/machines/rating-group/index.cjs +405 -0
- package/dist/machines/rating-group/index.d.cts +101 -0
- package/dist/machines/rating-group/index.d.mts +101 -0
- package/dist/machines/rating-group/index.mjs +399 -0
- package/dist/machines/scroll-area/index.cjs +857 -0
- package/dist/machines/scroll-area/index.d.cts +159 -0
- package/dist/machines/scroll-area/index.d.mts +159 -0
- package/dist/machines/scroll-area/index.mjs +853 -0
- package/dist/machines/select/index.cjs +1165 -0
- package/dist/machines/select/index.d.cts +183 -0
- package/dist/machines/select/index.d.mts +183 -0
- package/dist/machines/select/index.mjs +1154 -0
- package/dist/machines/signature-pad/index.cjs +334 -0
- package/dist/machines/signature-pad/index.d.cts +108 -0
- package/dist/machines/signature-pad/index.d.mts +108 -0
- package/dist/machines/signature-pad/index.mjs +328 -0
- package/dist/machines/slider/index.cjs +957 -0
- package/dist/machines/slider/index.d.cts +149 -0
- package/dist/machines/slider/index.d.mts +149 -0
- package/dist/machines/slider/index.mjs +949 -0
- package/dist/machines/splitter/index.cjs +1112 -0
- package/dist/machines/splitter/index.d.cts +155 -0
- package/dist/machines/splitter/index.d.mts +155 -0
- package/dist/machines/splitter/index.mjs +1103 -0
- package/dist/machines/steps/index.cjs +289 -0
- package/dist/machines/steps/index.d.cts +97 -0
- package/dist/machines/steps/index.d.mts +97 -0
- package/dist/machines/steps/index.mjs +285 -0
- package/dist/machines/switch/index.cjs +305 -0
- package/dist/machines/switch/index.d.cts +80 -0
- package/dist/machines/switch/index.d.mts +80 -0
- package/dist/machines/switch/index.mjs +301 -0
- package/dist/machines/tabs/index.cjs +508 -0
- package/dist/machines/tabs/index.d.cts +111 -0
- package/dist/machines/tabs/index.d.mts +111 -0
- package/dist/machines/tabs/index.mjs +500 -0
- package/dist/machines/tags-input/index.cjs +1127 -0
- package/dist/machines/tags-input/index.d.cts +179 -0
- package/dist/machines/tags-input/index.d.mts +179 -0
- package/dist/machines/tags-input/index.mjs +1121 -0
- package/dist/machines/timer/index.cjs +329 -0
- package/dist/machines/timer/index.d.cts +98 -0
- package/dist/machines/timer/index.d.mts +98 -0
- package/dist/machines/timer/index.mjs +324 -0
- package/dist/machines/toast/index.cjs +1155 -0
- package/dist/machines/toast/index.d.cts +195 -0
- package/dist/machines/toast/index.d.mts +195 -0
- package/dist/machines/toast/index.mjs +1151 -0
- package/dist/machines/toggle/index.cjs +103 -0
- package/dist/machines/toggle/index.d.cts +46 -0
- package/dist/machines/toggle/index.d.mts +46 -0
- package/dist/machines/toggle/index.mjs +99 -0
- package/dist/machines/toggle-group/index.cjs +328 -0
- package/dist/machines/toggle-group/index.d.cts +81 -0
- package/dist/machines/toggle-group/index.d.mts +81 -0
- package/dist/machines/toggle-group/index.mjs +322 -0
- package/dist/machines/tooltip/index.cjs +516 -0
- package/dist/machines/tooltip/index.d.cts +71 -0
- package/dist/machines/tooltip/index.d.mts +71 -0
- package/dist/machines/tooltip/index.mjs +512 -0
- package/dist/machines/tour/index.cjs +1108 -0
- package/dist/machines/tour/index.d.cts +206 -0
- package/dist/machines/tour/index.d.mts +206 -0
- package/dist/machines/tour/index.mjs +1101 -0
- package/dist/machines/tree-view/index.cjs +1271 -0
- package/dist/machines/tree-view/index.d.cts +215 -0
- package/dist/machines/tree-view/index.d.mts +215 -0
- package/dist/machines/tree-view/index.mjs +1263 -0
- package/dist/node-BctU8GXk.d.mts +24 -0
- package/dist/node-CSsuPZVZ.d.cts +24 -0
- package/dist/popper-BPJeAtcA.mjs +349 -0
- package/dist/popper-D0FAW_p7.cjs +373 -0
- package/dist/popper.cjs +8 -0
- package/dist/popper.d.cts +74 -0
- package/dist/popper.d.mts +2 -0
- package/dist/popper.mjs +5 -0
- package/dist/raf-BnlYUlDi.d.mts +15 -0
- package/dist/raf-Cd2FGy0z.d.cts +15 -0
- package/dist/rect-utils-0ellN0a_.mjs +854 -0
- package/dist/rect-utils-DKLRhP8G.cjs +1147 -0
- package/dist/rect-utils.cjs +51 -0
- package/dist/rect-utils.d.cts +198 -0
- package/dist/rect-utils.d.mts +198 -0
- package/dist/rect-utils.mjs +3 -0
- package/dist/remove-scroll-Lrfv79X_.mjs +58 -0
- package/dist/remove-scroll-Uvzg1L9r.cjs +63 -0
- package/dist/remove-scroll.cjs +0 -0
- package/dist/remove-scroll.d.cts +1 -0
- package/dist/remove-scroll.d.mts +1 -0
- package/dist/remove-scroll.mjs +1 -0
- package/dist/scroll-snap-CrTmQRzA.mjs +152 -0
- package/dist/scroll-snap-zyiZLv7W.cjs +175 -0
- package/dist/scroll-snap.cjs +7 -0
- package/dist/scroll-snap.d.cts +14 -0
- package/dist/scroll-snap.d.mts +14 -0
- package/dist/scroll-snap.mjs +4 -0
- package/dist/selection-BIhSzkF7.d.mts +50 -0
- package/dist/selection-CS1GBp8e.d.cts +50 -0
- package/dist/store-BZcXv49B.cjs +305 -0
- package/dist/store-DEojWy9H.mjs +263 -0
- package/dist/store.cjs +9 -0
- package/dist/store.d.cts +26 -0
- package/dist/store.d.mts +26 -0
- package/dist/store.mjs +3 -0
- package/dist/stringify-state.cjs +49 -0
- package/dist/stringify-state.d.cts +8 -0
- package/dist/stringify-state.d.mts +8 -0
- package/dist/stringify-state.mjs +46 -0
- package/dist/tree-collection-BwU5WhGQ.d.mts +78 -0
- package/dist/tree-collection-DP_eznnI.d.cts +78 -0
- package/dist/typeahead-BdNwVP09.d.cts +45 -0
- package/dist/typeahead-XN6lZ7G9.d.mts +45 -0
- package/dist/types-BivBkYg9.d.cts +57 -0
- package/dist/types-Bl_6JtPQ.d.mts +57 -0
- package/dist/types-CPUMVt7c.d.mts +54 -0
- package/dist/types-CT_W6HWr.d.cts +54 -0
- package/dist/types-DDTcG99l.d.mts +201 -0
- package/dist/types-DejIu60O.d.cts +201 -0
- package/dist/types-DiIdKZ3K.d.cts +45 -0
- package/dist/types-GxLIgJib.d.cts +17 -0
- package/dist/types.cjs +15 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +14 -0
- package/dist/utils-BZyrxWWR.mjs +525 -0
- package/dist/utils-_6frwjgJ.cjs +1040 -0
- package/dist/utils.cjs +88 -0
- package/dist/utils.d.cts +144 -0
- package/dist/utils.d.mts +144 -0
- package/dist/utils.mjs +3 -0
- package/dist/wait-for-CMjPsqWk.d.cts +10 -0
- package/dist/wait-for-D2nkdD4z.d.mts +10 -0
- package/package.json +399 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { n as DataUrlType, r as getDataUrl, t as DataUrlOptions } from "./data-url-DLwZ9M77.mjs";
|
|
2
|
+
import { C as JSX, c as MaybeFn, u as Nullable } from "./index-C0MKXQmE.mjs";
|
|
3
|
+
import { _ as isRootElement, a as getNodeName, b as isWindow, c as getWindow, d as isDocument, f as isEditableElement, g as isNode, h as isInputElement, i as getDocumentElement, l as isActiveElement, m as isHTMLElement, n as getActiveElement, o as getParentNode, p as isElementVisible, r as getDocument, s as getRootNode, t as contains, u as isAnchorElement, v as isShadowRoot, y as isVisualViewport } from "./node-BctU8GXk.mjs";
|
|
4
|
+
import { a as getByText, c as indexOfId, d as prevById, f as query, i as SearchableItem, l as itemById, n as TypeaheadState, o as ItemToId, p as queryAll, r as getByTypeahead, s as defaultItemToId, t as TypeaheadOptions, u as nextById } from "./typeahead-XN6lZ7G9.mjs";
|
|
5
|
+
import { i as raf, n as nextTick, r as queueBeforeEvent, t as AnimationFrame } from "./raf-BnlYUlDi.mjs";
|
|
6
|
+
import { i as waitForPromise, n as WaitForPromiseReturn, r as waitForElement, t as WaitForOptions } from "./wait-for-D2nkdD4z.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/shared/dom-query/caret.d.ts
|
|
9
|
+
declare function isCaretAtStart(input: HTMLInputElement | HTMLTextAreaElement | null): boolean;
|
|
10
|
+
declare function setCaretToEnd(input: HTMLInputElement | HTMLTextAreaElement | null): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/shared/dom-query/computed-style.d.ts
|
|
13
|
+
declare function getComputedStyle(el: Element): CSSStyleDeclaration;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/shared/dom-query/controller.d.ts
|
|
16
|
+
interface ControlledElementOptions {
|
|
17
|
+
followControlledElements?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
declare function isControlledElement(container: HTMLElement, element: HTMLElement): boolean;
|
|
20
|
+
declare function findControlledElements(searchRoot: HTMLElement, callback: (controlledElement: HTMLElement) => void): void;
|
|
21
|
+
declare function getControlledElements(container: HTMLElement): HTMLElement[];
|
|
22
|
+
declare function isInteractiveContainerElement(element: Element): boolean;
|
|
23
|
+
declare function isControllerElement(element: Element): boolean;
|
|
24
|
+
declare function hasControllerElements(element: Element): boolean;
|
|
25
|
+
declare function isControlledByExpandedController(element: Element): boolean;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/shared/dom-query/types.d.ts
|
|
28
|
+
type Booleanish = boolean | "true" | "false";
|
|
29
|
+
interface Point {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}
|
|
33
|
+
interface EventKeyOptions {
|
|
34
|
+
dir?: "ltr" | "rtl" | undefined;
|
|
35
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
36
|
+
}
|
|
37
|
+
type NativeEvent<E> = JSX.ChangeEvent<any> extends E ? InputEvent : E extends JSX.SyntheticEvent<any, infer T> ? T : never;
|
|
38
|
+
type AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent;
|
|
39
|
+
type MaybeElement$1 = Nullable<HTMLElement>;
|
|
40
|
+
type MaybeElementOrFn = MaybeFn<MaybeElement$1>;
|
|
41
|
+
type HTMLElementWithValue = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/shared/dom-query/event.d.ts
|
|
44
|
+
declare function getBeforeInputValue(event: Pick<InputEvent, "currentTarget">): string;
|
|
45
|
+
declare function getEventTarget<T extends EventTarget>(event: Partial<Pick<UIEvent, "target" | "composedPath">>): T | null;
|
|
46
|
+
declare function isOpeningInNewTab(event: Pick<MouseEvent, "currentTarget" | "metaKey" | "ctrlKey" | "button">): boolean;
|
|
47
|
+
declare function isDownloadingEvent(event: Pick<MouseEvent, "altKey" | "currentTarget">): boolean;
|
|
48
|
+
declare function isComposingEvent(event: any): boolean;
|
|
49
|
+
declare function isKeyboardClick(e: Pick<MouseEvent, "detail" | "clientX" | "clientY">): boolean;
|
|
50
|
+
declare function isCtrlOrMetaKey(e: Pick<KeyboardEvent, "ctrlKey" | "metaKey">): boolean;
|
|
51
|
+
declare function isPrintableKey(e: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey">): boolean;
|
|
52
|
+
declare function isVirtualPointerEvent(e: PointerEvent): boolean;
|
|
53
|
+
declare function isVirtualClick(e: MouseEvent | PointerEvent): boolean;
|
|
54
|
+
declare const isLeftClick: (e: Pick<MouseEvent, "button">) => boolean;
|
|
55
|
+
declare const isContextMenuEvent: (e: Pick<MouseEvent, "button" | "ctrlKey" | "metaKey">) => boolean;
|
|
56
|
+
declare const isModifierKey: (e: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "altKey">) => boolean;
|
|
57
|
+
declare const isTouchEvent: (event: AnyPointerEvent) => event is TouchEvent;
|
|
58
|
+
declare function getEventKey(event: Pick<KeyboardEvent, "key">, options?: EventKeyOptions): string;
|
|
59
|
+
declare function getNativeEvent<E>(event: E): NativeEvent<E>;
|
|
60
|
+
declare function getEventStep(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "key" | "shiftKey">): 1 | 10 | 0.1;
|
|
61
|
+
declare function getEventPoint(event: any, type?: "page" | "client"): {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
};
|
|
65
|
+
interface DOMEventMap extends DocumentEventMap, WindowEventMap, HTMLElementEventMap {}
|
|
66
|
+
declare const addDomEvent: <K extends keyof DOMEventMap>(target: MaybeFn<EventTarget | null>, eventName: K | (string & {}), handler: (event: DOMEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => () => void;
|
|
67
|
+
declare const isSelfTarget: (event: Partial<Pick<UIEvent, "currentTarget" | "target" | "composedPath">>) => boolean;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/shared/dom-query/form.d.ts
|
|
70
|
+
declare function setElementValue(el: HTMLElementWithValue | null, value: string, property?: "value" | "checked"): void;
|
|
71
|
+
declare function setElementChecked(el: HTMLInputElement | null, checked: boolean): void;
|
|
72
|
+
interface InputValueEventOptions {
|
|
73
|
+
value: string | number;
|
|
74
|
+
bubbles?: boolean | undefined;
|
|
75
|
+
}
|
|
76
|
+
declare function dispatchInputValueEvent(el: HTMLElementWithValue | null, options: InputValueEventOptions): void;
|
|
77
|
+
interface CheckedEventOptions {
|
|
78
|
+
checked: boolean;
|
|
79
|
+
bubbles?: boolean | undefined;
|
|
80
|
+
}
|
|
81
|
+
declare function dispatchInputCheckedEvent(el: HTMLInputElement | null, options: CheckedEventOptions): void;
|
|
82
|
+
interface TrackFormControlOptions {
|
|
83
|
+
onFieldsetDisabledChange: (disabled: boolean) => void;
|
|
84
|
+
onFormReset: VoidFunction;
|
|
85
|
+
}
|
|
86
|
+
declare function trackFormControl(el: HTMLElement | null, options: TrackFormControlOptions): (() => void) | undefined;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/shared/dom-query/initial-focus.d.ts
|
|
89
|
+
interface InitialFocusOptions {
|
|
90
|
+
root: HTMLElement | null;
|
|
91
|
+
getInitialEl?: (() => HTMLElement | null) | undefined;
|
|
92
|
+
enabled?: boolean | undefined;
|
|
93
|
+
filter?: ((el: HTMLElement) => boolean) | undefined;
|
|
94
|
+
}
|
|
95
|
+
declare function getInitialFocus(options: InitialFocusOptions): HTMLElement | undefined;
|
|
96
|
+
declare function isValidTabEvent(event: Pick<KeyboardEvent, "shiftKey" | "currentTarget">): boolean;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/shared/dom-query/mutation-observer.d.ts
|
|
99
|
+
interface ObserveAttributeOptions {
|
|
100
|
+
attributes: string[];
|
|
101
|
+
callback(record: MutationRecord): void;
|
|
102
|
+
defer?: boolean | undefined;
|
|
103
|
+
}
|
|
104
|
+
declare function observeAttributes(nodeOrFn: MaybeElementOrFn, options: ObserveAttributeOptions): () => void;
|
|
105
|
+
interface ObserveChildrenOptions {
|
|
106
|
+
callback: MutationCallback;
|
|
107
|
+
defer?: boolean | undefined;
|
|
108
|
+
}
|
|
109
|
+
declare function observeChildren(nodeOrFn: MaybeElementOrFn, options: ObserveChildrenOptions): () => void;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/shared/dom-query/navigate.d.ts
|
|
112
|
+
interface NavigateOptions {
|
|
113
|
+
key?: string;
|
|
114
|
+
orientation?: "both" | "vertical" | "horizontal";
|
|
115
|
+
loop?: boolean;
|
|
116
|
+
dir?: "ltr" | "rtl";
|
|
117
|
+
}
|
|
118
|
+
declare function navigate<T extends HTMLElement>(items: T[], current: T | null, options?: NavigateOptions): T | null;
|
|
119
|
+
declare function clickIfLink(el: HTMLAnchorElement): void;
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/shared/dom-query/overflow.d.ts
|
|
122
|
+
type OverflowAncestor = Array<VisualViewport | Window | HTMLElement | null>;
|
|
123
|
+
declare function getNearestOverflowAncestor(el: Node): HTMLElement;
|
|
124
|
+
declare function getOverflowAncestors(el: HTMLElement, list?: OverflowAncestor): OverflowAncestor;
|
|
125
|
+
declare function isInView(el: HTMLElement | Window | VisualViewport, ancestor: HTMLElement | Window | VisualViewport): boolean;
|
|
126
|
+
declare function isOverflowElement(el: HTMLElement): boolean;
|
|
127
|
+
interface ScrollOptions extends ScrollIntoViewOptions {
|
|
128
|
+
rootEl: HTMLElement | null;
|
|
129
|
+
}
|
|
130
|
+
declare function scrollIntoView(el: HTMLElement | null | undefined, options?: ScrollOptions): void;
|
|
131
|
+
interface ScrollPosition {
|
|
132
|
+
scrollLeft: number;
|
|
133
|
+
scrollTop: number;
|
|
134
|
+
}
|
|
135
|
+
declare function getScrollPosition(element: HTMLElement | Window): ScrollPosition;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/shared/dom-query/platform.d.ts
|
|
138
|
+
declare const isDom: () => boolean;
|
|
139
|
+
declare function getPlatform(): string;
|
|
140
|
+
declare function getUserAgent(): string;
|
|
141
|
+
declare const isTouchDevice: () => boolean;
|
|
142
|
+
declare const isIPhone: () => boolean;
|
|
143
|
+
declare const isIPad: () => boolean;
|
|
144
|
+
declare const isIos: () => boolean;
|
|
145
|
+
declare const isApple: () => boolean;
|
|
146
|
+
declare const isMac: () => boolean;
|
|
147
|
+
declare const isSafari: () => boolean;
|
|
148
|
+
declare const isFirefox: () => boolean;
|
|
149
|
+
declare const isChrome: () => boolean;
|
|
150
|
+
declare const isWebKit: () => boolean;
|
|
151
|
+
declare const isAndroid: () => boolean;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/shared/dom-query/point.d.ts
|
|
154
|
+
interface PercentValueOptions {
|
|
155
|
+
inverted?: boolean | {
|
|
156
|
+
x?: boolean | undefined;
|
|
157
|
+
y?: boolean | undefined;
|
|
158
|
+
} | undefined;
|
|
159
|
+
dir?: "ltr" | "rtl" | undefined;
|
|
160
|
+
orientation?: "vertical" | "horizontal" | undefined;
|
|
161
|
+
}
|
|
162
|
+
declare function getRelativePoint(point: Point, element: HTMLElement): {
|
|
163
|
+
offset: {
|
|
164
|
+
x: number;
|
|
165
|
+
y: number;
|
|
166
|
+
};
|
|
167
|
+
percent: {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
};
|
|
171
|
+
getPercentValue: (options?: PercentValueOptions) => number;
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/shared/dom-query/pointer-lock.d.ts
|
|
175
|
+
declare function requestPointerLock(doc: Document, fn?: (locked: boolean) => void): (() => void) | undefined;
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/shared/dom-query/pointer-move.d.ts
|
|
178
|
+
interface PointerMoveDetails {
|
|
179
|
+
point: Point;
|
|
180
|
+
event: PointerEvent;
|
|
181
|
+
}
|
|
182
|
+
interface PointerUpDetails {
|
|
183
|
+
point: Point;
|
|
184
|
+
event: PointerEvent;
|
|
185
|
+
}
|
|
186
|
+
interface PointerMoveHandlers {
|
|
187
|
+
onPointerUp: (details: PointerUpDetails) => void;
|
|
188
|
+
onPointerMove: (details: PointerMoveDetails) => void;
|
|
189
|
+
}
|
|
190
|
+
declare function trackPointerMove(doc: Document, handlers: PointerMoveHandlers): () => void;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/shared/dom-query/press.d.ts
|
|
193
|
+
interface PressDetails {
|
|
194
|
+
point: Point;
|
|
195
|
+
event: PointerEvent;
|
|
196
|
+
}
|
|
197
|
+
interface TrackPressOptions {
|
|
198
|
+
pointerNode: Element | null;
|
|
199
|
+
keyboardNode?: Element | null | undefined;
|
|
200
|
+
isValidKey?(event: KeyboardEvent): boolean;
|
|
201
|
+
onPress?(details: PressDetails): void;
|
|
202
|
+
onPressStart?(details: PressDetails): void;
|
|
203
|
+
onPressEnd?(details: PressDetails): void;
|
|
204
|
+
}
|
|
205
|
+
declare function trackPress(options: TrackPressOptions): () => void;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/shared/dom-query/tabbable.d.ts
|
|
208
|
+
type IncludeContainerType = boolean | "if-empty";
|
|
209
|
+
type GetShadowRootOption = boolean | ((node: HTMLElement) => ShadowRoot | boolean | undefined) | undefined;
|
|
210
|
+
interface TabbableOptions {
|
|
211
|
+
includeContainer?: IncludeContainerType;
|
|
212
|
+
getShadowRoot?: GetShadowRootOption;
|
|
213
|
+
}
|
|
214
|
+
interface NextTabbableOptions {
|
|
215
|
+
current?: HTMLElement | undefined | null;
|
|
216
|
+
getShadowRoot?: GetShadowRootOption;
|
|
217
|
+
}
|
|
218
|
+
declare const getFocusables: (container: Pick<HTMLElement, "querySelectorAll"> | null, options?: TabbableOptions) => HTMLElement[];
|
|
219
|
+
declare function isFocusable(element: HTMLElement | EventTarget | null): element is HTMLElement;
|
|
220
|
+
declare function getFirstFocusable(container: HTMLElement | null, options?: TabbableOptions): HTMLElement | null;
|
|
221
|
+
declare function getTabbables(container: HTMLElement | null, options?: TabbableOptions): HTMLElement[];
|
|
222
|
+
declare function isTabbable(el: HTMLElement | EventTarget | null): el is HTMLElement;
|
|
223
|
+
declare function getFirstTabbable(container: HTMLElement | null, options?: TabbableOptions): HTMLElement | null;
|
|
224
|
+
declare function getLastTabbable(container: HTMLElement | null, options?: TabbableOptions): HTMLElement | null;
|
|
225
|
+
declare function getTabbableEdges(container: HTMLElement | null, options?: TabbableOptions): [HTMLElement, HTMLElement] | [null, null];
|
|
226
|
+
declare function getNextTabbable(container: HTMLElement | null, options?: NextTabbableOptions): HTMLElement | null;
|
|
227
|
+
declare function getTabIndex(node: HTMLElement | SVGElement): number;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/shared/dom-query/proxy-tab-focus.d.ts
|
|
230
|
+
interface ProxyTabFocusOptions<T = MaybeElement$1> {
|
|
231
|
+
triggerElement?: T | undefined;
|
|
232
|
+
onFocus?: ((elementToFocus: HTMLElement) => void) | undefined;
|
|
233
|
+
onFocusEnter?: VoidFunction | undefined;
|
|
234
|
+
defer?: boolean | undefined;
|
|
235
|
+
getShadowRoot?: GetShadowRootOption | undefined;
|
|
236
|
+
}
|
|
237
|
+
declare function proxyTabFocus(container: MaybeElementOrFn, options: ProxyTabFocusOptions<MaybeElementOrFn>): () => void;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/shared/dom-query/resize-observer.d.ts
|
|
240
|
+
type Subscriber<T> = (entry: T) => void;
|
|
241
|
+
interface SharedResizeObserver {
|
|
242
|
+
observe: (element: Element, listener: Subscriber<ResizeObserverEntry>) => () => void;
|
|
243
|
+
unobserve: (element: Element) => void;
|
|
244
|
+
}
|
|
245
|
+
declare const resizeObserverContentBox: SharedResizeObserver;
|
|
246
|
+
declare const resizeObserverBorderBox: SharedResizeObserver;
|
|
247
|
+
declare const resizeObserverDevicePixelContentBox: SharedResizeObserver;
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/shared/dom-query/scope.d.ts
|
|
250
|
+
interface ScopeContext {
|
|
251
|
+
getRootNode?: (() => Document | ShadowRoot | Node) | undefined;
|
|
252
|
+
}
|
|
253
|
+
declare function createScope<T>(methods: T): {
|
|
254
|
+
getRootNode: (ctx: ScopeContext) => Document | ShadowRoot;
|
|
255
|
+
getDoc: (ctx: ScopeContext) => Document;
|
|
256
|
+
getWin: (ctx: ScopeContext) => Window & typeof globalThis;
|
|
257
|
+
getActiveElement: (ctx: ScopeContext) => HTMLElement | null;
|
|
258
|
+
isActiveElement: typeof isActiveElement;
|
|
259
|
+
getById: <T_1 extends Element = HTMLElement>(ctx: ScopeContext, id: string) => T_1 | null;
|
|
260
|
+
setValue: <T_1 extends HTMLElementWithValue>(elem: T_1 | null, value: string | number | null | undefined) => void;
|
|
261
|
+
} & T;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/shared/dom-query/set.d.ts
|
|
264
|
+
declare function setAttribute(el: Element, attr: string, v: string): () => void;
|
|
265
|
+
declare function setProperty<T extends Element, K extends keyof T & string>(el: T, prop: K, v: T[K]): () => void;
|
|
266
|
+
declare function setStyle(el: HTMLElement | null | undefined, style: Partial<CSSStyleDeclaration>): () => void;
|
|
267
|
+
declare function setStyleProperty(el: HTMLElement | null | undefined, prop: string, value: string): () => void;
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/shared/dom-query/shared.d.ts
|
|
270
|
+
declare const MAX_Z_INDEX = 2147483647;
|
|
271
|
+
declare const dataAttr: (guard: boolean | undefined) => Booleanish;
|
|
272
|
+
declare const ariaAttr: (guard: boolean | undefined) => "true" | undefined;
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/shared/dom-query/text-selection.d.ts
|
|
275
|
+
interface DisableTextSelectionOptions<T = MaybeElement> {
|
|
276
|
+
target?: T | undefined;
|
|
277
|
+
doc?: Document | undefined;
|
|
278
|
+
defer?: boolean | undefined;
|
|
279
|
+
}
|
|
280
|
+
declare function restoreTextSelection(options?: DisableTextSelectionOptions): void;
|
|
281
|
+
type MaybeElement = HTMLElement | null | undefined;
|
|
282
|
+
type NodeOrFn = MaybeElement | (() => MaybeElement);
|
|
283
|
+
declare function disableTextSelection(options?: DisableTextSelectionOptions<NodeOrFn>): () => void;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/shared/dom-query/visual-viewport.d.ts
|
|
286
|
+
interface ViewportSize {
|
|
287
|
+
width: number;
|
|
288
|
+
height: number;
|
|
289
|
+
}
|
|
290
|
+
declare function trackVisualViewport(doc: Document, fn: (data: ViewportSize) => void): () => void;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/shared/dom-query/visually-hidden.d.ts
|
|
293
|
+
declare const visuallyHiddenStyle: {
|
|
294
|
+
readonly border: "0";
|
|
295
|
+
readonly clip: "rect(0 0 0 0)";
|
|
296
|
+
readonly height: "1px";
|
|
297
|
+
readonly margin: "-1px";
|
|
298
|
+
readonly overflow: "hidden";
|
|
299
|
+
readonly padding: "0";
|
|
300
|
+
readonly position: "absolute";
|
|
301
|
+
readonly width: "1px";
|
|
302
|
+
readonly whiteSpace: "nowrap";
|
|
303
|
+
readonly wordWrap: "normal";
|
|
304
|
+
};
|
|
305
|
+
declare function setVisuallyHidden(el: HTMLElement): void;
|
|
306
|
+
//#endregion
|
|
307
|
+
export { AnimationFrame, CheckedEventOptions, ControlledElementOptions, DataUrlOptions, DataUrlType, DisableTextSelectionOptions, GetShadowRootOption, InitialFocusOptions, InputValueEventOptions, ItemToId, MAX_Z_INDEX, NavigateOptions, NextTabbableOptions, ObserveAttributeOptions, ObserveChildrenOptions, OverflowAncestor, PercentValueOptions, PointerMoveDetails, PointerMoveHandlers, PointerUpDetails, PressDetails, ProxyTabFocusOptions, ScopeContext, ScrollOptions, ScrollPosition, SearchableItem, TabbableOptions, TrackFormControlOptions, TrackPressOptions, TypeaheadOptions, TypeaheadState, ViewportSize, WaitForOptions, WaitForPromiseReturn, addDomEvent, ariaAttr, clickIfLink, contains, createScope, dataAttr, defaultItemToId, disableTextSelection, dispatchInputCheckedEvent, dispatchInputValueEvent, findControlledElements, getActiveElement, getBeforeInputValue, getByText, getByTypeahead, getComputedStyle, getControlledElements, getDataUrl, getDocument, getDocumentElement, getEventKey, getEventPoint, getEventStep, getEventTarget, getFirstFocusable, getFirstTabbable, getFocusables, getInitialFocus, getLastTabbable, getNativeEvent, getNearestOverflowAncestor, getNextTabbable, getNodeName, getOverflowAncestors, getParentNode, getPlatform, getRelativePoint, getRootNode, getScrollPosition, getTabIndex, getTabbableEdges, getTabbables, getUserAgent, getWindow, hasControllerElements, indexOfId, isActiveElement, isAnchorElement, isAndroid, isApple, isCaretAtStart, isChrome, isComposingEvent, isContextMenuEvent, isControlledByExpandedController, isControlledElement, isControllerElement, isCtrlOrMetaKey, isDocument, isDom, isDownloadingEvent, isEditableElement, isElementVisible, isFirefox, isFocusable, isHTMLElement, isIPad, isIPhone, isInView, isInputElement, isInteractiveContainerElement, isIos, isKeyboardClick, isLeftClick, isMac, isModifierKey, isNode, isOpeningInNewTab, isOverflowElement, isPrintableKey, isRootElement, isSafari, isSelfTarget, isShadowRoot, isTabbable, isTouchDevice, isTouchEvent, isValidTabEvent, isVirtualClick, isVirtualPointerEvent, isVisualViewport, isWebKit, isWindow, itemById, navigate, nextById, nextTick, observeAttributes, observeChildren, prevById, proxyTabFocus, query, queryAll, queueBeforeEvent, raf, requestPointerLock, resizeObserverBorderBox, resizeObserverContentBox, resizeObserverDevicePixelContentBox, restoreTextSelection, scrollIntoView, setAttribute, setCaretToEnd, setElementChecked, setElementValue, setProperty, setStyle, setStyleProperty, setVisuallyHidden, trackFormControl, trackPointerMove, trackPress, trackVisualViewport, visuallyHiddenStyle, waitForElement, waitForPromise };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { $ as getTabbables, $t as getDocumentElement, A as getNearestOverflowAncestor, At as isApple, B as AnimationFrame, Bt as isWebKit, C as proxyTabFocus, Ct as isSelfTarget, D as restoreTextSelection, Dt as getPlatform, E as disableTextSelection, Et as isVirtualPointerEvent, F as scrollIntoView, Ft as isIPhone, G as isValidTabEvent, Gt as isControlledByExpandedController, H as queueBeforeEvent, Ht as findControlledElements, I as clickIfLink, It as isIos, J as getFocusables, Jt as isInteractiveContainerElement, K as getFirstFocusable, Kt as isControlledElement, L as navigate, Lt as isMac, M as getScrollPosition, Mt as isDom, N as isInView, Nt as isFirefox, O as requestPointerLock, Ot as getUserAgent, P as isOverflowElement, Pt as isIPad, Q as getTabbableEdges, Qt as getDocument, R as observeAttributes, Rt as isSafari, S as queryAll, St as isPrintableKey, T as trackPointerMove, Tt as isVirtualClick, U as raf, Ut as getControlledElements, V as nextTick, Vt as getDataUrl, W as getInitialFocus, Wt as hasControllerElements, X as getNextTabbable, Xt as contains, Y as getLastTabbable, Yt as getComputedStyle, Z as getTabIndex, Zt as getActiveElement, _ as indexOfId, _n as ariaAttr, _t as isDownloadingEvent, a as trackVisualViewport, an as isAnchorElement, at as setElementValue, b as prevById, bn as setCaretToEnd, bt as isModifierKey, c as setProperty, cn as isElementVisible, ct as getBeforeInputValue, d as getByText, dn as isNode, dt as getEventStep, en as getNodeName, et as isFocusable, f as createScope, fn as isRootElement, ft as getEventTarget, g as defaultItemToId, gn as MAX_Z_INDEX, gt as isCtrlOrMetaKey, h as resizeObserverDevicePixelContentBox, hn as isWindow, ht as isContextMenuEvent, i as visuallyHiddenStyle, in as isActiveElement, it as setElementChecked, j as getOverflowAncestors, jt as isChrome, k as getRelativePoint, kt as isAndroid, l as setStyle, ln as isHTMLElement, lt as getEventKey, m as resizeObserverContentBox, mn as isVisualViewport, mt as isComposingEvent, n as waitForPromise, nn as getRootNode, nt as dispatchInputCheckedEvent, o as getByTypeahead, on as isDocument, ot as trackFormControl, p as resizeObserverBorderBox, pn as isShadowRoot, pt as getNativeEvent, q as getFirstTabbable, qt as isControllerElement, r as setVisuallyHidden, rn as getWindow, rt as dispatchInputValueEvent, s as setAttribute, sn as isEditableElement, st as addDomEvent, t as waitForElement, tn as getParentNode, tt as isTabbable, u as setStyleProperty, un as isInputElement, ut as getEventPoint, v as itemById, vn as dataAttr, vt as isKeyboardClick, w as trackPress, wt as isTouchEvent, x as query, xt as isOpeningInNewTab, y as nextById, yn as isCaretAtStart, yt as isLeftClick, z as observeChildren, zt as isTouchDevice } from "./dom-query-DFCRhyj1.mjs";
|
|
2
|
+
|
|
3
|
+
export { AnimationFrame, MAX_Z_INDEX, addDomEvent, ariaAttr, clickIfLink, contains, createScope, dataAttr, defaultItemToId, disableTextSelection, dispatchInputCheckedEvent, dispatchInputValueEvent, findControlledElements, getActiveElement, getBeforeInputValue, getByText, getByTypeahead, getComputedStyle, getControlledElements, getDataUrl, getDocument, getDocumentElement, getEventKey, getEventPoint, getEventStep, getEventTarget, getFirstFocusable, getFirstTabbable, getFocusables, getInitialFocus, getLastTabbable, getNativeEvent, getNearestOverflowAncestor, getNextTabbable, getNodeName, getOverflowAncestors, getParentNode, getPlatform, getRelativePoint, getRootNode, getScrollPosition, getTabIndex, getTabbableEdges, getTabbables, getUserAgent, getWindow, hasControllerElements, indexOfId, isActiveElement, isAnchorElement, isAndroid, isApple, isCaretAtStart, isChrome, isComposingEvent, isContextMenuEvent, isControlledByExpandedController, isControlledElement, isControllerElement, isCtrlOrMetaKey, isDocument, isDom, isDownloadingEvent, isEditableElement, isElementVisible, isFirefox, isFocusable, isHTMLElement, isIPad, isIPhone, isInView, isInputElement, isInteractiveContainerElement, isIos, isKeyboardClick, isLeftClick, isMac, isModifierKey, isNode, isOpeningInNewTab, isOverflowElement, isPrintableKey, isRootElement, isSafari, isSelfTarget, isShadowRoot, isTabbable, isTouchDevice, isTouchEvent, isValidTabEvent, isVirtualClick, isVirtualPointerEvent, isVisualViewport, isWebKit, isWindow, itemById, navigate, nextById, nextTick, observeAttributes, observeChildren, prevById, proxyTabFocus, query, queryAll, queueBeforeEvent, raf, requestPointerLock, resizeObserverBorderBox, resizeObserverContentBox, resizeObserverDevicePixelContentBox, restoreTextSelection, scrollIntoView, setAttribute, setCaretToEnd, setElementChecked, setElementValue, setProperty, setStyle, setStyleProperty, setVisuallyHidden, trackFormControl, trackPointerMove, trackPress, trackVisualViewport, visuallyHiddenStyle, waitForElement, waitForPromise };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/shared/file-utils/data-transfer.ts
|
|
3
|
+
const getItemEntry = (item) => typeof item.getAsEntry === "function" ? item.getAsEntry() : typeof item.webkitGetAsEntry === "function" ? item.webkitGetAsEntry() : null;
|
|
4
|
+
const isDirectoryEntry = (entry) => entry.isDirectory;
|
|
5
|
+
const isFileEntry = (entry) => entry.isFile;
|
|
6
|
+
const addRelativePath = (file, path) => {
|
|
7
|
+
Object.defineProperty(file, "relativePath", { value: path ? `${path}/${file.name}` : file.name });
|
|
8
|
+
return file;
|
|
9
|
+
};
|
|
10
|
+
const getFileEntries = (items, traverseDirectories) => Promise.all(Array.from(items).filter((item) => item.kind === "file").map((item) => {
|
|
11
|
+
const entry = getItemEntry(item);
|
|
12
|
+
if (!entry) return null;
|
|
13
|
+
if (isDirectoryEntry(entry) && traverseDirectories) return getDirectoryFiles(entry.createReader(), `${entry.name}`);
|
|
14
|
+
if (isFileEntry(entry) && typeof item.getAsFile === "function") {
|
|
15
|
+
const file = item.getAsFile();
|
|
16
|
+
return Promise.resolve(file ? addRelativePath(file, "") : null);
|
|
17
|
+
}
|
|
18
|
+
if (isFileEntry(entry)) return new Promise((resolve) => {
|
|
19
|
+
entry.file((file) => {
|
|
20
|
+
resolve(addRelativePath(file, ""));
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}).filter((b) => b));
|
|
24
|
+
const getDirectoryFiles = (reader, path = "") => new Promise((resolve) => {
|
|
25
|
+
const entryPromises = [];
|
|
26
|
+
const readDirectoryEntries = () => {
|
|
27
|
+
reader.readEntries((entries) => {
|
|
28
|
+
if (entries.length === 0) {
|
|
29
|
+
resolve(Promise.all(entryPromises).then((entries$1) => entries$1.flat()));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const promises = entries.map((entry) => {
|
|
33
|
+
if (!entry) return null;
|
|
34
|
+
if (isDirectoryEntry(entry)) return getDirectoryFiles(entry.createReader(), `${path}${entry.name}`);
|
|
35
|
+
if (isFileEntry(entry)) return new Promise((resolve$1) => {
|
|
36
|
+
entry.file((file) => {
|
|
37
|
+
resolve$1(addRelativePath(file, path));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}).filter((b) => b);
|
|
41
|
+
entryPromises.push(Promise.all(promises));
|
|
42
|
+
readDirectoryEntries();
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
readDirectoryEntries();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/shared/file-utils/data-url-to-blob.ts
|
|
50
|
+
function dataURItoBlob(uri) {
|
|
51
|
+
const binary = atob(uri.split(",")[1]);
|
|
52
|
+
const mimeString = uri.split(",")[0].split(":")[1].split(";")[0];
|
|
53
|
+
const buffer = new ArrayBuffer(binary.length);
|
|
54
|
+
const intArray = new Uint8Array(buffer);
|
|
55
|
+
for (let i = 0; i < binary.length; i++) intArray[i] = binary.charCodeAt(i);
|
|
56
|
+
return new Blob([buffer], { type: mimeString });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/shared/file-utils/download-file.ts
|
|
61
|
+
const BOM_REGEX = /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i;
|
|
62
|
+
const MAC_REGEX = /Macintosh/;
|
|
63
|
+
const APPLE_WEBKIT_REGEX = /AppleWebKit/;
|
|
64
|
+
const SAFARI_REGEX = /Safari/;
|
|
65
|
+
function getBlob(blobOrString, type, appendBOM) {
|
|
66
|
+
let blob = typeof blobOrString === "string" ? new Blob([blobOrString], { type }) : blobOrString;
|
|
67
|
+
if (appendBOM && BOM_REGEX.test(blob.type)) return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
|
68
|
+
return blob;
|
|
69
|
+
}
|
|
70
|
+
function isMSEdge(win) {
|
|
71
|
+
return Boolean(win.navigator && win.navigator.msSaveOrOpenBlob);
|
|
72
|
+
}
|
|
73
|
+
function isWebView(win) {
|
|
74
|
+
return win.navigator && MAC_REGEX.test(win.navigator.userAgent) && APPLE_WEBKIT_REGEX.test(win.navigator.userAgent) && !SAFARI_REGEX.test(win.navigator.userAgent);
|
|
75
|
+
}
|
|
76
|
+
function downloadFile(options) {
|
|
77
|
+
const { file, win = window, type, name, appendBOM, revokeTimeout = 0 } = options;
|
|
78
|
+
const doc = win.document;
|
|
79
|
+
const blob = getBlob(file, type, appendBOM);
|
|
80
|
+
const fileName = (file instanceof File ? name || file.name : name) || "file-download";
|
|
81
|
+
if (isMSEdge(win)) {
|
|
82
|
+
win.navigator.msSaveOrOpenBlob(blob, fileName);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const isMacOSWebView = isWebView(win);
|
|
86
|
+
const anchor = doc.createElement("a");
|
|
87
|
+
if ("download" in anchor && !isMacOSWebView) {
|
|
88
|
+
const url$1 = win.URL.createObjectURL(blob);
|
|
89
|
+
anchor.href = url$1;
|
|
90
|
+
anchor.rel = "noopener";
|
|
91
|
+
anchor.download = fileName;
|
|
92
|
+
anchor.style.display = "none";
|
|
93
|
+
doc.body.appendChild(anchor);
|
|
94
|
+
anchor.dispatchEvent(new win.MouseEvent("click"));
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
win.URL.revokeObjectURL(url$1);
|
|
97
|
+
anchor.remove();
|
|
98
|
+
}, revokeTimeout);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const url = win.URL.createObjectURL(blob);
|
|
102
|
+
if (!win.open(url, "_blank")) win.location.href = url;
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
win.URL.revokeObjectURL(url);
|
|
105
|
+
}, revokeTimeout);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/shared/file-utils/get-accept-attr.ts
|
|
110
|
+
function isMIMEType(v) {
|
|
111
|
+
return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
|
|
112
|
+
}
|
|
113
|
+
function isExt(v) {
|
|
114
|
+
return /^.*\.[\w]+$/.test(v);
|
|
115
|
+
}
|
|
116
|
+
const isValidMIME = (v) => isMIMEType(v) || isExt(v);
|
|
117
|
+
function getAcceptAttrString(accept) {
|
|
118
|
+
if (accept == null) return;
|
|
119
|
+
if (typeof accept === "string") return accept;
|
|
120
|
+
if (Array.isArray(accept)) return accept.filter(isValidMIME).join(",");
|
|
121
|
+
return Object.entries(accept).reduce((a, [mimeType, ext]) => [
|
|
122
|
+
...a,
|
|
123
|
+
mimeType,
|
|
124
|
+
...ext
|
|
125
|
+
], []).filter(isValidMIME).join(",");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/shared/file-utils/get-file-data-url.ts
|
|
130
|
+
const getFileDataUrl = async (file) => {
|
|
131
|
+
const reader = new FileReader();
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
reader.onerror = () => {
|
|
134
|
+
reader.abort();
|
|
135
|
+
reject(/* @__PURE__ */ new Error("There was an error reading a file"));
|
|
136
|
+
};
|
|
137
|
+
reader.onloadend = () => {
|
|
138
|
+
const { result } = reader;
|
|
139
|
+
if (result instanceof ArrayBuffer) reject(/* @__PURE__ */ new Error("Expected DataURL as string from Blob/File, got ArrayBuffer"));
|
|
140
|
+
else resolve(result || void 0);
|
|
141
|
+
};
|
|
142
|
+
reader.readAsDataURL(file);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/shared/file-utils/get-total-file-size.ts
|
|
148
|
+
const getTotalFileSize = (files) => {
|
|
149
|
+
return files.reduce((acc, file) => acc + file.size, 0);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/shared/file-utils/is-file-equal.ts
|
|
154
|
+
const isFileEqual = (file1, file2) => {
|
|
155
|
+
return file1.name === file2.name && file1.size === file2.size && file1.type === file2.type;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/shared/file-utils/is-valid-file-size.ts
|
|
160
|
+
const isDefined = (v) => v !== void 0 && v !== null;
|
|
161
|
+
function isValidFileSize(file, minSize, maxSize) {
|
|
162
|
+
if (isDefined(file.size)) {
|
|
163
|
+
if (isDefined(minSize) && isDefined(maxSize)) {
|
|
164
|
+
if (file.size > maxSize) return [false, "FILE_TOO_LARGE"];
|
|
165
|
+
if (file.size < minSize) return [false, "FILE_TOO_SMALL"];
|
|
166
|
+
} else if (isDefined(minSize) && file.size < minSize) return [false, "FILE_TOO_SMALL"];
|
|
167
|
+
else if (isDefined(maxSize) && file.size > maxSize) return [false, "FILE_TOO_LARGE"];
|
|
168
|
+
}
|
|
169
|
+
return [true, null];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/shared/file-utils/mime-types.ts
|
|
174
|
+
const mimeTypes = "3g2_video/3gpp2[3gp,3gpp_video/3gpp[3mf_model/3mf[7z_application/x-7z-compressed[aac_audio/aac[ac_application/pkix-attr-cert[adp_audio/adpcm[adts_audio/aac[ai_application/postscript[aml_application/automationml-aml+xml[amlx_application/automationml-amlx+zip[amr_audio/amr[apk_application/vnd.android.package-archive[apng_image/apng[appcache,manifest_text/cache-manifest[appinstaller_application/appinstaller[appx_application/appx[appxbundle_application/appxbundle[asc_application/pgp-keys[atom_application/atom+xml[atomcat_application/atomcat+xml[atomdeleted_application/atomdeleted+xml[atomsvc_application/atomsvc+xml[au,snd_audio/basic[avi_video/x-msvideo[avci_image/avci[avcs_image/avcs[avif_image/avif[aw_application/applixware[bdoc_application/bdoc[bin,bpk,buffer,deb,deploy,dist,distz,dll,dmg,dms,dump,elc,exe,img,iso,lrf,mar,msi,msm,msp,pkg,so_application/octet-stream[bmp,dib_image/bmp[btf,btif_image/prs.btif[bz2_application/x-bzip2[c_text/x-c[ccxml_application/ccxml+xml[cdfx_application/cdfx+xml[cdmia_application/cdmi-capability[cdmic_application/cdmi-container[cdmid_application/cdmi-domain[cdmio_application/cdmi-object[cdmiq_application/cdmi-queue[cer_application/pkix-cert[cgm_image/cgm[cjs_application/node[class_application/java-vm[coffee,litcoffee_text/coffeescript[conf,def,in,ini,list,log,text,txt_text/plain[cpp,cxx,cc_text/x-c++src[cpl_application/cpl+xml[cpt_application/mac-compactpro[crl_application/pkix-crl[css_text/css[csv_text/csv[cu_application/cu-seeme[cwl_application/cwl[cww_application/prs.cww[davmount_application/davmount+xml[dbk_application/docbook+xml[doc_application/msword[docx_application/vnd.openxmlformats-officedocument.wordprocessingml.document[dsc_text/prs.lines.tag[dssc_application/dssc+der[dtd_application/xml-dtd[dwd_application/atsc-dwd+xml[ear,jar,war_application/java-archive[ecma_application/ecmascript[emf_image/emf[eml,mime_message/rfc822[emma_application/emma+xml[emotionml_application/emotionml+xml[eot_application/vnd.ms-fontobject[eps,ps_application/postscript[epub_application/epub+zip[exi_application/exi[exp_application/express[exr_image/aces[ez_application/andrew-inset[fdf_application/fdf[fdt_application/fdt+xml[fits_image/fits[flac_audio/flac[flv_video/x-flv[g3_image/g3fax[geojson_application/geo+json[gif_image/gif[glb_model/gltf-binary[gltf_model/gltf+json[gml_application/gml+xml[go_text/x-go[gpx_application/gpx+xml[gz_application/gzip[h_text/x-h[h261_video/h261[h263_video/h263[h264_video/h264[heic_image/heic[heics_image/heic-sequence[heif_image/heif[heifs_image/heif-sequence[htm,html,shtml_text/html[ico_image/x-icon[icns_image/x-icns[ics,ifb_text/calendar[iges,igs_model/iges[ink,inkml_application/inkml+xml[ipa_application/octet-stream[java_text/x-java-source[jp2,jpg2_image/jp2[jpeg,jpe,jpg_image/jpeg[jpf,jpx_image/jpx[jpm,jpgm_image/jpm[jpgv_video/jpeg[jph_image/jph[js,mjs_text/javascript[json_application/json[json5_application/json5[jsonld_application/ld+json[jsx_text/jsx[jxl_image/jxl[jxr_image/jxr[ktx_image/ktx[ktx2_image/ktx2[less_text/less[m1v,m2v,mpe,mpeg,mpg_video/mpeg[m4a_audio/mp4[m4v_video/x-m4v[md,markdown_text/markdown[mid,midi,kar,rmi_audio/midi[mkv_video/x-matroska[mp2,mp2a,mp3,mpga,m3a,m2a_audio/mpeg[mp4,mp4v,mpg4_video/mp4[mp4a_audio/mp4[mp4s,m4p_application/mp4[odp_application/vnd.oasis.opendocument.presentation[oda_application/oda[ods_application/vnd.oasis.opendocument.spreadsheet[odt_application/vnd.oasis.opendocument.text[oga,ogg,opus,spx_audio/ogg[ogv_video/ogg[ogx_application/ogg[otf_font/otf[p12,pfx_application/x-pkcs12[pdf_application/pdf[pem_application/x-pem-file[php_text/x-php[png_image/png[ppt_application/vnd.ms-powerpoint[pptx_application/vnd.openxmlformats-officedocument.presentationml.presentation[pskcxml_application/pskc+xml[psd_image/vnd.adobe.photoshop[py_text/x-python[qt,mov_video/quicktime[rar_application/vnd.rar[rdf_application/rdf+xml[rtf_text/rtf[sass_text/x-sass[scss_text/x-scss[sgm,sgml_text/sgml[sh_application/x-sh[svg,svgz_image/svg+xml[swf_application/x-shockwave-flash[tar_application/x-tar[tif,tiff_image/tiff[toml_application/toml[ts_video/mp2t[tsx_text/tsx[tsv_text/tab-separated-values[ttc_font/collection[ttf_font/ttf[vtt_text/vtt[wasm_application/wasm[wav_audio/wav[weba_audio/webm[webm_video/webm[webmanifest_application/manifest+json[webp_image/webp[wma_audio/x-ms-wma[wmv_video/x-ms-wmv[woff_font/woff[woff2_font/woff2[xls_application/vnd.ms-excel[xlsx_application/vnd.openxmlformats-officedocument.spreadsheetml.sheet[xml_application/xml[xz_application/x-xz[yaml,yml_text/yaml[zip_application/zip";
|
|
175
|
+
const mimeTypesMap = new Map(mimeTypes.split("[").flatMap((mime) => {
|
|
176
|
+
const [extensions, mimeType] = mime.split("_");
|
|
177
|
+
return extensions.split(",").map((ext) => [ext, mimeType]);
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/shared/file-utils/get-file-mime-type.ts
|
|
182
|
+
function getFileMimeType(name) {
|
|
183
|
+
const extension = name.split(".").pop();
|
|
184
|
+
return extension ? mimeTypesMap.get(extension) || null : null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/shared/file-utils/is-valid-file-type.ts
|
|
189
|
+
function isFileAccepted(file, accept) {
|
|
190
|
+
if (file && accept) {
|
|
191
|
+
const types = Array.isArray(accept) ? accept : typeof accept === "string" ? accept.split(",") : [];
|
|
192
|
+
if (types.length === 0) return true;
|
|
193
|
+
const fileName = file.name || "";
|
|
194
|
+
const mimeType = (file.type || getFileMimeType(fileName) || "").toLowerCase();
|
|
195
|
+
const baseMimeType = mimeType.replace(/\/.*$/, "");
|
|
196
|
+
return types.some((type) => {
|
|
197
|
+
const validType = type.trim().toLowerCase();
|
|
198
|
+
if (validType.charAt(0) === ".") return fileName.toLowerCase().endsWith(validType);
|
|
199
|
+
if (validType.endsWith("/*")) return baseMimeType === validType.replace(/\/.*$/, "");
|
|
200
|
+
return mimeType === validType;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
function isValidFileType(file, accept) {
|
|
206
|
+
const isAcceptable = file.type === "application/x-moz-file" || isFileAccepted(file, accept);
|
|
207
|
+
return [isAcceptable, isAcceptable ? null : "FILE_INVALID_TYPE"];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
exports.dataURItoBlob = dataURItoBlob;
|
|
212
|
+
exports.downloadFile = downloadFile;
|
|
213
|
+
exports.getAcceptAttrString = getAcceptAttrString;
|
|
214
|
+
exports.getFileDataUrl = getFileDataUrl;
|
|
215
|
+
exports.getFileEntries = getFileEntries;
|
|
216
|
+
exports.getFileMimeType = getFileMimeType;
|
|
217
|
+
exports.getTotalFileSize = getTotalFileSize;
|
|
218
|
+
exports.isFileEqual = isFileEqual;
|
|
219
|
+
exports.isValidFileSize = isValidFileSize;
|
|
220
|
+
exports.isValidFileType = isValidFileType;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/shared/file-utils/data-transfer.d.ts
|
|
2
|
+
declare const getFileEntries: (items: DataTransferItemList, traverseDirectories: boolean | undefined) => Promise<(File | (File | null)[] | null | undefined)[]>;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/shared/file-utils/data-url-to-blob.d.ts
|
|
5
|
+
declare function dataURItoBlob(uri: string): Blob;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/shared/file-utils/download-file.d.ts
|
|
8
|
+
interface DownloadFileOptions {
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
type: string;
|
|
11
|
+
file: File | Blob | string;
|
|
12
|
+
win?: typeof window | undefined;
|
|
13
|
+
appendBOM?: boolean | undefined;
|
|
14
|
+
revokeTimeout?: number | undefined;
|
|
15
|
+
}
|
|
16
|
+
declare function downloadFile(options: DownloadFileOptions): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/shared/file-utils/get-accept-attr.d.ts
|
|
19
|
+
declare function getAcceptAttrString(accept: Record<string, string[]> | string | string[] | undefined): string | undefined;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/shared/file-utils/get-file-data-url.d.ts
|
|
22
|
+
declare const getFileDataUrl: (file: File | Blob) => Promise<string | undefined>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/shared/file-utils/get-total-file-size.d.ts
|
|
25
|
+
declare const getTotalFileSize: (files: File[]) => number;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/shared/file-utils/is-file-equal.d.ts
|
|
28
|
+
declare const isFileEqual: (file1: File, file2: File) => boolean;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/shared/file-utils/types.d.ts
|
|
31
|
+
type AnyString = string & {};
|
|
32
|
+
type FileError = "TOO_MANY_FILES" | "FILE_INVALID_TYPE" | "FILE_TOO_LARGE" | "FILE_TOO_SMALL" | "FILE_INVALID" | "FILE_EXISTS" | AnyString;
|
|
33
|
+
type ImageFileMimeType = "image/png" | "image/gif" | "image/jpeg" | "image/svg+xml" | "image/webp" | "image/avif" | "image/heic" | "image/bmp";
|
|
34
|
+
type ApplicationFileMimeType = "application/pdf" | "application/zip" | "application/json" | "application/xml" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/rtf" | "application/x-rar" | "application/x-7z-compressed" | "application/x-tar" | "application/vnd.microsoft.portable-executable";
|
|
35
|
+
type TextFileMimeType = "text/css" | "text/csv" | "text/html" | "text/markdown" | "text/plain";
|
|
36
|
+
type FontFileMimeType = "font/ttf" | "font/otf" | "font/woff" | "font/woff2" | "font/eot" | "font/svg";
|
|
37
|
+
type VideoFileMimeType = "video/mp4" | "video/webm" | "video/ogg" | "video/quicktime" | "video/x-msvideo";
|
|
38
|
+
type AudioFileMimeType = "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "audio/aac" | "audio/flac" | "audio/x-m4a";
|
|
39
|
+
type FileMimeTypeGroup = "image/*" | "audio/*" | "video/*" | "text/*" | "application/*" | "font/*";
|
|
40
|
+
type FileMimeType = ImageFileMimeType | ApplicationFileMimeType | TextFileMimeType | FontFileMimeType | VideoFileMimeType | AudioFileMimeType | FileMimeTypeGroup | AnyString;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/shared/file-utils/is-valid-file-size.d.ts
|
|
43
|
+
declare function isValidFileSize(file: File, minSize?: number, maxSize?: number): [boolean, FileError | null];
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/shared/file-utils/is-valid-file-type.d.ts
|
|
46
|
+
declare function isValidFileType(file: File, accept: string | undefined): [boolean, FileError | null];
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/shared/file-utils/get-file-mime-type.d.ts
|
|
49
|
+
declare function getFileMimeType(name: string): FileMimeType | null;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { ApplicationFileMimeType, AudioFileMimeType, DownloadFileOptions, FileError, FileMimeType, FileMimeTypeGroup, FontFileMimeType, ImageFileMimeType, TextFileMimeType, VideoFileMimeType, dataURItoBlob, downloadFile, getAcceptAttrString, getFileDataUrl, getFileEntries, getFileMimeType, getTotalFileSize, isFileEqual, isValidFileSize, isValidFileType };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/shared/file-utils/data-transfer.d.ts
|
|
2
|
+
declare const getFileEntries: (items: DataTransferItemList, traverseDirectories: boolean | undefined) => Promise<(File | (File | null)[] | null | undefined)[]>;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/shared/file-utils/data-url-to-blob.d.ts
|
|
5
|
+
declare function dataURItoBlob(uri: string): Blob;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/shared/file-utils/download-file.d.ts
|
|
8
|
+
interface DownloadFileOptions {
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
type: string;
|
|
11
|
+
file: File | Blob | string;
|
|
12
|
+
win?: typeof window | undefined;
|
|
13
|
+
appendBOM?: boolean | undefined;
|
|
14
|
+
revokeTimeout?: number | undefined;
|
|
15
|
+
}
|
|
16
|
+
declare function downloadFile(options: DownloadFileOptions): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/shared/file-utils/get-accept-attr.d.ts
|
|
19
|
+
declare function getAcceptAttrString(accept: Record<string, string[]> | string | string[] | undefined): string | undefined;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/shared/file-utils/get-file-data-url.d.ts
|
|
22
|
+
declare const getFileDataUrl: (file: File | Blob) => Promise<string | undefined>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/shared/file-utils/get-total-file-size.d.ts
|
|
25
|
+
declare const getTotalFileSize: (files: File[]) => number;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/shared/file-utils/is-file-equal.d.ts
|
|
28
|
+
declare const isFileEqual: (file1: File, file2: File) => boolean;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/shared/file-utils/types.d.ts
|
|
31
|
+
type AnyString = string & {};
|
|
32
|
+
type FileError = "TOO_MANY_FILES" | "FILE_INVALID_TYPE" | "FILE_TOO_LARGE" | "FILE_TOO_SMALL" | "FILE_INVALID" | "FILE_EXISTS" | AnyString;
|
|
33
|
+
type ImageFileMimeType = "image/png" | "image/gif" | "image/jpeg" | "image/svg+xml" | "image/webp" | "image/avif" | "image/heic" | "image/bmp";
|
|
34
|
+
type ApplicationFileMimeType = "application/pdf" | "application/zip" | "application/json" | "application/xml" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/rtf" | "application/x-rar" | "application/x-7z-compressed" | "application/x-tar" | "application/vnd.microsoft.portable-executable";
|
|
35
|
+
type TextFileMimeType = "text/css" | "text/csv" | "text/html" | "text/markdown" | "text/plain";
|
|
36
|
+
type FontFileMimeType = "font/ttf" | "font/otf" | "font/woff" | "font/woff2" | "font/eot" | "font/svg";
|
|
37
|
+
type VideoFileMimeType = "video/mp4" | "video/webm" | "video/ogg" | "video/quicktime" | "video/x-msvideo";
|
|
38
|
+
type AudioFileMimeType = "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "audio/aac" | "audio/flac" | "audio/x-m4a";
|
|
39
|
+
type FileMimeTypeGroup = "image/*" | "audio/*" | "video/*" | "text/*" | "application/*" | "font/*";
|
|
40
|
+
type FileMimeType = ImageFileMimeType | ApplicationFileMimeType | TextFileMimeType | FontFileMimeType | VideoFileMimeType | AudioFileMimeType | FileMimeTypeGroup | AnyString;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/shared/file-utils/is-valid-file-size.d.ts
|
|
43
|
+
declare function isValidFileSize(file: File, minSize?: number, maxSize?: number): [boolean, FileError | null];
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/shared/file-utils/is-valid-file-type.d.ts
|
|
46
|
+
declare function isValidFileType(file: File, accept: string | undefined): [boolean, FileError | null];
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/shared/file-utils/get-file-mime-type.d.ts
|
|
49
|
+
declare function getFileMimeType(name: string): FileMimeType | null;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { ApplicationFileMimeType, AudioFileMimeType, DownloadFileOptions, FileError, FileMimeType, FileMimeTypeGroup, FontFileMimeType, ImageFileMimeType, TextFileMimeType, VideoFileMimeType, dataURItoBlob, downloadFile, getAcceptAttrString, getFileDataUrl, getFileEntries, getFileMimeType, getTotalFileSize, isFileEqual, isValidFileSize, isValidFileType };
|