@swiftwc/ui 0.0.0-dev.6 → 0.0.0-dev.61
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/README.md +15 -0
- package/generated/buses/alert-dialog.d.ts +2 -0
- package/generated/buses/alert-dialog.js +1 -0
- package/generated/buses/confirmation-dialog.d.ts +2 -0
- package/generated/buses/confirmation-dialog.js +1 -0
- package/generated/buses/index.d.ts +6 -0
- package/generated/buses/index.js +6 -0
- package/generated/buses/lifecycle-observer.d.ts +2 -0
- package/generated/buses/lifecycle-observer.js +1 -0
- package/generated/client/index.d.ts +22 -4
- package/generated/client/index.js +219 -181
- package/generated/components/alert-dialog.d.ts +8 -0
- package/generated/components/alert-dialog.js +99 -0
- package/generated/components/body-view.js +5 -2
- package/generated/components/bordered-button.d.ts +17 -0
- package/generated/components/bordered-button.js +56 -0
- package/generated/components/bordered-prominent-button.d.ts +17 -0
- package/generated/components/bordered-prominent-button.js +56 -0
- package/generated/components/borderless-button.d.ts +12 -4
- package/generated/components/borderless-button.js +47 -16
- package/generated/components/color-scheme.d.ts +7 -0
- package/generated/components/color-scheme.js +54 -0
- package/generated/components/confirmation-dialog.d.ts +9 -0
- package/generated/components/confirmation-dialog.js +113 -0
- package/generated/components/content-unavailable-view.d.ts +24 -0
- package/generated/components/content-unavailable-view.js +81 -0
- package/generated/components/date-picker.d.ts +36 -0
- package/generated/components/date-picker.js +461 -0
- package/generated/components/disclosure-group.d.ts +9 -7
- package/generated/components/disclosure-group.js +51 -65
- package/generated/components/fine-tooltip.d.ts +7 -0
- package/generated/components/fine-tooltip.js +107 -0
- package/generated/components/form-view.d.ts +9 -0
- package/generated/components/form-view.js +63 -0
- package/generated/components/glass-button.d.ts +16 -0
- package/generated/components/glass-button.js +53 -0
- package/generated/components/glass-prominent-button.d.ts +16 -0
- package/generated/components/glass-prominent-button.js +53 -0
- package/generated/components/h-stack.d.ts +10 -0
- package/generated/components/h-stack.js +19 -0
- package/generated/components/image-view.d.ts +9 -0
- package/generated/components/image-view.js +46 -0
- package/generated/components/index.d.ts +41 -10
- package/generated/components/index.js +41 -15
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +51 -0
- package/generated/components/labeled-content.d.ts +9 -0
- package/generated/components/labeled-content.js +115 -0
- package/generated/components/list-view.d.ts +8 -0
- package/generated/components/list-view.js +32 -0
- package/generated/components/menu-view.d.ts +12 -0
- package/generated/components/menu-view.js +142 -0
- package/generated/components/navigation-large-title.d.ts +6 -0
- package/generated/components/navigation-large-title.js +181 -0
- package/generated/components/navigation-split-view.d.ts +7 -2
- package/generated/components/navigation-split-view.js +19 -3
- package/generated/components/navigation-stack.d.ts +6 -2
- package/generated/components/navigation-stack.js +23 -59
- package/generated/components/navigation-title.d.ts +8 -0
- package/generated/components/navigation-title.js +50 -0
- package/generated/components/picker-view.d.ts +44 -0
- package/generated/components/picker-view.js +1009 -0
- package/generated/components/plain-button.d.ts +7 -0
- package/generated/components/plain-button.js +22 -0
- package/generated/components/progress-view.d.ts +13 -0
- package/generated/components/progress-view.js +120 -0
- package/generated/components/screen-view.d.ts +1 -1
- package/generated/components/screen-view.js +4 -2
- package/generated/components/scroll-view-proxy.d.ts +8 -0
- package/generated/components/scroll-view-proxy.js +17 -0
- package/generated/components/scroll-view.d.ts +4 -2
- package/generated/components/scroll-view.js +179 -64
- package/generated/components/search-view.d.ts +7 -0
- package/generated/components/search-view.js +30 -0
- package/generated/components/section-view.d.ts +9 -0
- package/generated/components/section-view.js +85 -0
- package/generated/components/sheet-view.d.ts +3 -4
- package/generated/components/sheet-view.js +53 -17
- package/generated/components/sidebar-toggle.d.ts +1 -1
- package/generated/components/sidebar-toggle.js +76 -72
- package/generated/components/sidebar-view.d.ts +2 -4
- package/generated/components/sidebar-view.js +25 -17
- package/generated/components/sticky-container.d.ts +6 -0
- package/generated/components/sticky-container.js +26 -0
- package/generated/components/tab-bar.d.ts +5 -4
- package/generated/components/tab-bar.js +34 -17
- package/generated/components/tab-item.d.ts +4 -3
- package/generated/components/tab-item.js +125 -29
- package/generated/components/tab-view.d.ts +17 -2
- package/generated/components/tab-view.js +252 -17
- package/generated/components/table-view.d.ts +12 -0
- package/generated/components/table-view.js +153 -0
- package/generated/components/text-field.d.ts +29 -0
- package/generated/components/text-field.js +496 -0
- package/generated/components/tool-bar-item-group.d.ts +5 -0
- package/generated/components/tool-bar-item-group.js +28 -0
- package/generated/components/tool-bar-item.d.ts +8 -0
- package/generated/components/tool-bar-item.js +66 -0
- package/generated/components/tool-bar.d.ts +19 -0
- package/generated/components/tool-bar.js +93 -0
- package/generated/components/v-keyboard.d.ts +4 -0
- package/generated/components/v-keyboard.js +72 -70
- package/generated/components/v-stack.d.ts +13 -0
- package/generated/components/v-stack.js +22 -0
- package/generated/css/index.css +8847 -0
- package/generated/events/alert-dialog.d.ts +8 -0
- package/generated/events/confirmation-dialog.d.ts +9 -0
- package/generated/events/confirmation-dialog.js +1 -0
- package/generated/events/date-picker.d.ts +8 -0
- package/generated/events/date-picker.js +1 -0
- package/generated/events/index.d.ts +8 -0
- package/generated/events/index.js +8 -0
- package/generated/events/lifecycle-observer.d.ts +10 -0
- package/generated/events/lifecycle-observer.js +1 -0
- package/generated/events/picker-view.d.ts +15 -0
- package/generated/events/picker-view.js +1 -0
- package/generated/events/scroll-view.d.ts +10 -0
- package/generated/events/scroll-view.js +1 -0
- package/generated/events/tab-view.d.ts +28 -0
- package/generated/events/tab-view.js +1 -0
- package/generated/events/text-field.d.ts +8 -0
- package/generated/events/text-field.js +1 -0
- package/generated/i18n/index.d.ts +34 -0
- package/generated/i18n/index.js +167 -0
- package/generated/i18n/locales/el.d.ts +16 -0
- package/generated/i18n/locales/el.js +16 -0
- package/generated/i18n/locales/en.d.ts +16 -0
- package/generated/i18n/locales/en.js +16 -0
- package/generated/i18n/locales/index.d.ts +4 -0
- package/generated/i18n/locales/index.js +4 -0
- package/generated/internal/class/cleanup-registry.d.ts +5 -0
- package/generated/internal/class/cleanup-registry.js +38 -0
- package/generated/internal/class/css-style-observer.d.ts +8 -0
- package/generated/internal/class/css-style-observer.js +26 -0
- package/generated/internal/class/form-associated-base.d.ts +16 -0
- package/generated/internal/class/form-associated-base.js +78 -0
- package/generated/internal/class/mutation-observer-set.d.ts +9 -0
- package/generated/internal/class/mutation-observer-set.js +42 -0
- package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
- package/generated/internal/class/mutation-observer-singleton.js +64 -0
- package/generated/internal/class/navigation-path.d.ts +15 -0
- package/generated/internal/class/navigation-path.js +84 -0
- package/generated/internal/class/navigation-view.d.ts +8 -0
- package/generated/internal/class/navigation-view.js +72 -0
- package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
- package/generated/internal/class/resize-observer-singleton.js +22 -0
- package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
- package/generated/internal/decorators/adaptive-slot.js +50 -0
- package/generated/internal/decorators/custom-element.d.ts +5 -0
- package/generated/internal/decorators/custom-element.js +5 -0
- package/generated/internal/decorators/index.d.ts +6 -0
- package/generated/internal/decorators/index.js +6 -0
- package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
- package/generated/internal/decorators/microtask-on-connected.js +67 -0
- package/generated/internal/privateNamespace.d.ts +14 -0
- package/generated/internal/privateNamespace.js +168 -0
- package/generated/internal/utils/add.d.ts +1 -0
- package/generated/internal/utils/add.js +7 -0
- package/generated/internal/utils/cash/ancestors.d.ts +1 -0
- package/generated/internal/utils/cash/ancestors.js +27 -0
- package/generated/internal/utils/cash/index.d.ts +23 -0
- package/generated/internal/utils/cash/index.js +25 -0
- package/generated/internal/utils/cash/next-all.d.ts +1 -0
- package/generated/internal/utils/cash/next-all.js +10 -0
- package/generated/internal/utils/cash/next.d.ts +1 -0
- package/generated/internal/utils/cash/next.js +9 -0
- package/generated/internal/utils/cash/prev-all.d.ts +1 -0
- package/generated/internal/utils/cash/prev-all.js +10 -0
- package/generated/internal/utils/cash/prev.d.ts +1 -0
- package/generated/internal/utils/cash/prev.js +9 -0
- package/generated/internal/utils/cash/prop.d.ts +18 -0
- package/generated/internal/utils/cash/prop.js +30 -0
- package/generated/internal/utils/cash/siblings.d.ts +1 -0
- package/generated/internal/utils/cash/siblings.js +10 -0
- package/generated/internal/utils/clamp.d.ts +1 -0
- package/generated/internal/utils/clamp.js +4 -0
- package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
- package/generated/internal/utils/compare-big-decimals.js +90 -0
- package/generated/internal/utils/debounce.d.ts +1 -0
- package/generated/internal/utils/debounce.js +13 -0
- package/generated/internal/utils/dev-flags.d.ts +3 -0
- package/generated/internal/utils/dev-flags.js +5 -0
- package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
- package/generated/internal/utils/ensure-placeholder.js +55 -0
- package/generated/internal/utils/frame.d.ts +1 -0
- package/generated/internal/utils/frame.js +6 -0
- package/generated/internal/utils/index.d.ts +21 -1
- package/generated/internal/utils/index.js +24 -1
- package/generated/internal/utils/is-inside.d.ts +1 -0
- package/generated/internal/utils/is-inside.js +4 -0
- package/generated/internal/utils/kebab-case.d.ts +1 -1
- package/generated/internal/utils/list-active.d.ts +7 -0
- package/generated/internal/utils/list-active.js +83 -0
- package/generated/internal/utils/microtask.d.ts +1 -0
- package/generated/internal/utils/microtask.js +3 -0
- package/generated/internal/utils/onoff.d.ts +45 -0
- package/generated/internal/utils/onoff.js +31 -0
- package/generated/internal/utils/render-label-icon.d.ts +2 -0
- package/generated/internal/utils/render-label-icon.js +19 -0
- package/generated/internal/utils/render-label-title.d.ts +2 -0
- package/generated/internal/utils/render-label-title.js +16 -0
- package/generated/internal/utils/render-label.d.ts +1 -0
- package/generated/internal/utils/render-label.js +19 -0
- package/generated/internal/utils/set.d.ts +1 -0
- package/generated/internal/utils/set.js +7 -0
- package/generated/internal/utils/sleep.d.ts +1 -0
- package/generated/internal/utils/sleep.js +3 -0
- package/generated/internal/utils/slow-hide-show.d.ts +1 -0
- package/generated/internal/utils/slow-hide-show.js +16 -0
- package/generated/internal/utils/timeout.d.ts +5 -0
- package/generated/internal/utils/timeout.js +16 -0
- package/generated/internal/utils/touch-glass.d.ts +7 -0
- package/generated/internal/utils/touch-glass.js +19 -0
- package/generated/namespace-browser/base.d.ts +45 -0
- package/generated/namespace-browser/base.js +115 -0
- package/generated/namespace-browser/index.d.ts +7 -0
- package/generated/namespace-browser/index.js +1 -0
- package/generated/snapshot/index.d.ts +4 -11
- package/generated/snapshot/index.js +55 -145
- package/package.json +33 -9
- package/scss/_components.scss +60 -13
- package/scss/_final.scss +1 -0
- package/scss/_functions.scss +10 -0
- package/scss/_mixins.scss +4 -169
- package/scss/_placeholders.scss +3 -0
- package/scss/_transitions.scss +22 -1
- package/scss/_utils.scss +9 -0
- package/scss/_vars.scss +144 -23
- package/scss/base/_layout.scss +40 -16
- package/scss/base/_reboot.scss +151 -15
- package/scss/base/_root.scss +358 -25
- package/scss/colors/_index.scss +788 -70
- package/scss/components/_alert-dialog.scss +111 -0
- package/scss/components/_body-view.scss +12 -3
- package/scss/components/_bordered-button.scss +57 -0
- package/scss/components/_bordered-prominent-button.scss +64 -0
- package/scss/components/_borderless-button.scss +36 -6
- package/scss/components/_confirmation-dialog.scss +102 -0
- package/scss/components/_content-unavailable-view.scss +54 -0
- package/scss/components/_date-picker.scss +30 -0
- package/scss/components/_detail-placeholder.scss +153 -0
- package/scss/components/_disclosure-group.scss +147 -48
- package/scss/components/_fine-tooltip.scss +84 -0
- package/scss/components/_form-view.scss +233 -0
- package/scss/components/_full-screen.scss +7 -5
- package/scss/components/_glass-button.scss +59 -0
- package/scss/components/_glass-prominent-button.scss +70 -0
- package/scss/components/_h-divider.scss +13 -0
- package/scss/components/_h-flex-stack.scss +23 -0
- package/scss/components/_h-stack.scss +29 -0
- package/scss/components/_image-view.scss +9 -0
- package/scss/components/_index.scss +239 -7
- package/scss/components/_label-view copy.scss.txt +420 -0
- package/scss/components/_label-view.scss +372 -0
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_labeled-content.scss +67 -0
- package/scss/components/_list-view.scss +269 -0
- package/scss/components/_menu-view.scss +219 -0
- package/scss/components/_navigation-large-title.scss +27 -0
- package/scss/components/_navigation-split-view.scss +329 -269
- package/scss/components/_navigation-stack.scss +6 -6
- package/scss/components/_navigation-title.scss +10 -0
- package/scss/components/_picker-view.scss +307 -0
- package/scss/components/_plain-button.scss +18 -0
- package/scss/components/_progress-view.scss +98 -0
- package/scss/components/_scroll-view-proxy.scss +79 -0
- package/scss/components/_scroll-view-toolbars.scss +126 -0
- package/scss/components/_scroll-view.scss +114 -66
- package/scss/components/_search-view.scss +22 -0
- package/scss/components/_section-view.scss +119 -0
- package/scss/components/_sheet-view.scss +78 -35
- package/scss/components/_sidebar-toggle.scss +87 -27
- package/scss/components/_sidebar-view.scss +30 -40
- package/scss/components/_sticky-container.scss +42 -0
- package/scss/components/_tab-bar.scss +211 -84
- package/scss/components/_tab-item.scss +25 -0
- package/scss/components/_tab-view.scss +270 -126
- package/scss/components/_table-column.scss +54 -0
- package/scss/components/_table-row.scss +240 -0
- package/scss/components/_table-view.scss +231 -0
- package/scss/components/_text-field.scss +53 -0
- package/scss/components/_tool-bar-item-group.scss +30 -19
- package/scss/components/_tool-bar-item.scss +81 -71
- package/scss/components/_tool-bar.scss +126 -63
- package/scss/components/_v-divider.scss +13 -0
- package/scss/components/_v-flex-stack.scss +29 -0
- package/scss/components/_v-keyboard.scss +6 -4
- package/scss/components/_v-stack.scss +15 -9
- package/scss/final/_touch-glass.scss +91 -0
- package/scss/index.scss +6 -2
- package/scss/mixins/_button.scss +44 -0
- package/scss/mixins/_color.scss +16 -0
- package/scss/mixins/_dialog.scss +89 -0
- package/scss/mixins/_index.scss +453 -0
- package/scss/placeholders/_buttons.scss +117 -0
- package/scss/placeholders/_lists.scss +594 -0
- package/scss/transitions/_alert-dialog.scss +18 -0
- package/scss/transitions/_bwd.navbar.scss +3 -13
- package/scss/transitions/_bwd.scss +4 -20
- package/scss/transitions/_confirmation-dialog.scss +27 -0
- package/scss/transitions/_disclosure-group.scss +35 -0
- package/scss/transitions/_fine-tooltip.scss +21 -0
- package/scss/transitions/_fwd.navbar.scss +4 -9
- package/scss/transitions/_fwd.scss +4 -34
- package/scss/transitions/_glass-button.scss +12 -0
- package/scss/transitions/_glass-prominent-button.scss +12 -0
- package/scss/transitions/_index.scss +35 -143
- package/scss/transitions/_menu-view.scss +26 -0
- package/scss/transitions/_navigation-split-view.scss +23 -0
- package/scss/transitions/_progress-view.scss +23 -0
- package/scss/transitions/_sheet-view.scss +30 -0
- package/scss/transitions/_sidebar-view.scss +36 -0
- package/scss/transitions/_tab-bar.scss +20 -0
- package/scss/utils/_frame.scss +91 -0
- package/scss/utils/_index.scss +78 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +222 -0
- package/web-components.html-data/en.json +721 -0
- package/generated/components/bottom-bar.d.ts +0 -10
- package/generated/components/bottom-bar.js +0 -73
- package/generated/components/navigation-bar.d.ts +0 -10
- package/generated/components/navigation-bar.js +0 -80
- package/generated/internal/class.d.ts +0 -18
- package/generated/internal/class.js +0 -18
- package/generated/namespace/index.d.ts +0 -6
- package/generated/styles.css +0 -1305
- package/scss/_dev.scss +0 -68
- package/scss/components/_tab-bar-stack.scss +0 -101
- package/scss/components/_toolbars.scss +0 -100
- package/scss/transitions/_dialog.scss +0 -32
- /package/generated/{namespace/index.js → events/alert-dialog.js} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
2
|
+
import { devFlags } from '../internal/utils';
|
|
3
|
+
import { Snapshot } from '../snapshot';
|
|
4
|
+
export function queryInsertPosition(frame) {
|
|
5
|
+
if ('NAVIGATION-SPLIT-VIEW' === frame?.tagName)
|
|
6
|
+
return 'beforebegin'; // lookFor = 'previousElementSibling'
|
|
7
|
+
else if ('NAVIGATION-SPLIT-VIEW' === frame?.parentElement?.tagName && frame?.parentElement.querySelector(':scope>[is=sidebar-view]') && 'BODY-VIEW' === frame?.tagName)
|
|
8
|
+
return 'beforebegin'; // lookFor = 'previousElementSibling'
|
|
9
|
+
return 'afterend'; // lookFor = 'nextElementSibling'
|
|
10
|
+
}
|
|
11
|
+
const cleanup = (lm, type) => {
|
|
12
|
+
let arr = [Snapshot.config['vt-fwd-class-name'], 'fwdd', 'fwn', 'fwnn', 'bwd', 'bwdd', 'bwn', 'bwnn'];
|
|
13
|
+
if (['backwards', 'forwards'].includes(type ?? ''))
|
|
14
|
+
for (let i = arr.length - 1; i >= 0; i--)
|
|
15
|
+
if (arr[i].startsWith('backwards' === type ? 'fw' : 'bw'))
|
|
16
|
+
arr.splice(i, 1);
|
|
17
|
+
for (const el of [...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? [])])
|
|
18
|
+
el.classList.remove(...arr);
|
|
19
|
+
};
|
|
20
|
+
export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
|
|
21
|
+
if (devFlags.debug)
|
|
22
|
+
console.debug(`startViewTransition (${type})`, target);
|
|
23
|
+
if (!(target instanceof HTMLElement))
|
|
24
|
+
throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
|
|
25
|
+
if (!['forwards', 'backwards', 'reload'].includes(type))
|
|
26
|
+
throw new TypeError("Argument 2 ('type') to client.startViewTransition must be of TransitionType");
|
|
27
|
+
const options = typeof updateCallbackOrOptions === 'function'
|
|
28
|
+
? {
|
|
29
|
+
updateCallback: updateCallbackOrOptions,
|
|
30
|
+
}
|
|
31
|
+
: (updateCallbackOrOptions ?? {}), updateCallback = options.updateCallback ?? (async () => { });
|
|
32
|
+
await Snapshot.waitReady;
|
|
33
|
+
const from = new NavigationPath(target); //const from = closestBody(target) //event.target as HTMLElement)
|
|
34
|
+
if ('forwards' === type) {
|
|
35
|
+
await updateCallback(); // updatetheDOMSomehow
|
|
36
|
+
// Snapshot.getSnapshot(from)
|
|
37
|
+
// const root = getRootViewController(from)
|
|
38
|
+
// const oldPath = new NavigationPath(from)
|
|
39
|
+
const root = [from, ...from.parents()]
|
|
40
|
+
.map((item) => item.component)
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.at(-1);
|
|
43
|
+
// const { toolBarConfig: oldToolbars } = getComputedView(from) // const { toolBarConfig: oldToolbars, slot: oldSLot, page: oldPage } = getComputedView(from) //
|
|
44
|
+
// console.log(88, oldPage, oldPath.page, oldSLot, oldPath.slot, oldToolbars, oldPath.toolBarConfig)
|
|
45
|
+
// const oldToolbars = Snapshot.toolbarItems
|
|
46
|
+
// const { toolBarConfig: oldToolbars, host: oldHost } = getComputedView(from)
|
|
47
|
+
const tos = options.tos?.() ?? [...from.children()].map((item) => item?.hydrate()), //queryBodyAll(oldSLot), //[...oldPath.children()].map((item) => item.body).filter(Boolean),//
|
|
48
|
+
to = tos.at(-1),
|
|
49
|
+
// to = newPath?.body, //tos.slice(-1)?.pop?.(), //Snapshot.leaf, //
|
|
50
|
+
// newHost = newPath?.component, //{ host: newHost } = getComputedView(to),
|
|
51
|
+
newToolbars = tos.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item),
|
|
52
|
+
// .map((item) => item.toolBarConfig)
|
|
53
|
+
// .flat()
|
|
54
|
+
// .filter(Boolean), //queryToolbarConfigAll(oldSLot),
|
|
55
|
+
modalViews = tos.map((item) => item.component).filter((item) => !!item && item.matches('dialog')); //[...queryHostAll(oldPage)].filter?.((item) => item?.matches('dialog'))
|
|
56
|
+
// toFrame = Snapshot.leafContainer, //queryHostAll(from).slice(-1)?.pop?.(),
|
|
57
|
+
// toToolbars = Snapshot.leafToolbarItems
|
|
58
|
+
// dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
|
|
59
|
+
// if ('DIALOG' === newHost?.tagName) {
|
|
60
|
+
// ;(newHost as HTMLDialogElement).showModal()
|
|
61
|
+
// if (devFlags.debug) console.debug(`⚡️ view-transition-start (${type})`)
|
|
62
|
+
// await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
|
|
63
|
+
// if (devFlags.debug) console.debug(`⚡️ view-transition-end (${type})`)
|
|
64
|
+
// return
|
|
65
|
+
// }
|
|
66
|
+
// purge
|
|
67
|
+
cleanup(root, 'backwards');
|
|
68
|
+
// prepare old
|
|
69
|
+
from.body?.classList.add(Snapshot.config['vt-fwd-class-name']);
|
|
70
|
+
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
71
|
+
for (const oldToolbar of from.toolBarConfig ?? [])
|
|
72
|
+
oldToolbar.classList.add('fwn'); // prepare navbs
|
|
73
|
+
// prepare new
|
|
74
|
+
const toolbarExclusion = 0 < modalViews.length
|
|
75
|
+
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar,body-view ~ tool-bar)')
|
|
76
|
+
: (value, index, array) => value.parentElement?.matches('tool-bar:not(body-view ~ tool-bar)'), bodyExclusion = 0 < modalViews.length ? (item) => item.body?.matches('scroll-view:not(dialog scroll-view)') : (value, index, array) => value;
|
|
77
|
+
for (const bti of newToolbars?.filter?.(toolbarExclusion) ?? [])
|
|
78
|
+
bti.classList.add('fwnn'); // for (const ti of newToolbars ?? []) ti.classList.add('fwnn') //
|
|
79
|
+
for (const bt of tos?.filter?.(bodyExclusion) ?? []) {
|
|
80
|
+
bt.body?.classList.add('fwdd'); //to?.classList.add('fwdd')
|
|
81
|
+
bt.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: bt.body }, bubbles: true, composed: true }));
|
|
82
|
+
}
|
|
83
|
+
if (0 < modalViews.length) {
|
|
84
|
+
for await (const el of modalViews)
|
|
85
|
+
el.showModal();
|
|
86
|
+
if (devFlags.debug)
|
|
87
|
+
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
88
|
+
await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
|
|
89
|
+
if (devFlags.debug)
|
|
90
|
+
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (devFlags.debug)
|
|
94
|
+
console.debug(`⚡️ view-transition-start (${type})`);
|
|
95
|
+
await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
|
|
96
|
+
if (devFlags.debug)
|
|
97
|
+
console.debug(`⚡️ view-transition-end (${type})`);
|
|
98
|
+
}
|
|
99
|
+
if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
|
|
100
|
+
return;
|
|
101
|
+
cleanup(root);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// Snapshot.getSnapshot(from)
|
|
105
|
+
// const oldPath = new NavigationPath(from)
|
|
106
|
+
const root = [from, ...from.parents()]
|
|
107
|
+
.map((item) => item.component)
|
|
108
|
+
.filter(Boolean)
|
|
109
|
+
.at(-1); // const root = getRootViewController(from)
|
|
110
|
+
//const { toolBarConfig: oldToolbars, host: oldHost, page: oldPage, slot: oldSlot } = getComputedView(from)
|
|
111
|
+
const froms = [...from.children()].map((item) => item?.hydrate());
|
|
112
|
+
const oldToolbars = froms.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item), oldBodies = froms.map((item) => item.body).filter((item) => !!item);
|
|
113
|
+
// console.log(99, queryToolbarConfigAll(oldSlot), oldToolbars)
|
|
114
|
+
// if most-top effect is closing a modal, skip everything
|
|
115
|
+
if ('DIALOG' === from.component?.tagName) {
|
|
116
|
+
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
117
|
+
from.component.close();
|
|
118
|
+
if (devFlags.debug)
|
|
119
|
+
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
120
|
+
await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
|
|
121
|
+
if (devFlags.debug)
|
|
122
|
+
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
123
|
+
if (from.component.matches('[open]'))
|
|
124
|
+
return;
|
|
125
|
+
await updateCallback();
|
|
126
|
+
return; // just close modal
|
|
127
|
+
}
|
|
128
|
+
const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
|
|
129
|
+
if (!to)
|
|
130
|
+
return console.debug('Can not go backwards.'); // nothing to go back to
|
|
131
|
+
const tv = to.body?.closest('tab-view');
|
|
132
|
+
if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
|
|
133
|
+
if ('bottom-bar' !== tv.tabBarPlacement)
|
|
134
|
+
return;
|
|
135
|
+
// const { toolBarConfig: newToolbars } = getComputedView(to.body)
|
|
136
|
+
// purge
|
|
137
|
+
cleanup(root, 'forwards');
|
|
138
|
+
// prepare new
|
|
139
|
+
for (const ti of to.toolBarConfig ?? [])
|
|
140
|
+
ti.classList.add('bwnn');
|
|
141
|
+
to.body?.classList.add('bwdd');
|
|
142
|
+
to.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: to.body }, bubbles: true, composed: true }));
|
|
143
|
+
// prepare old
|
|
144
|
+
const inbetweenModals = froms.map((item) => item.component).filter((item) => !!item && item.matches('dialog[open]')), //queryHostAll(oldPage).filter?.((item) => item.matches('dialog[open]')) ?? [], // FIXME: TEst this, added oldHost too
|
|
145
|
+
toolbarExclusion = 0 < inbetweenModals.length
|
|
146
|
+
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar)')
|
|
147
|
+
: (value, index, array) => value, bodyExclusion = 0 < inbetweenModals.length ? (item) => item?.matches('scroll-view:not(dialog scroll-view)') : (item) => item;
|
|
148
|
+
for (const ti of [...(from.toolBarConfig ?? []), ...(oldToolbars?.filter?.(toolbarExclusion) ?? [])])
|
|
149
|
+
ti.classList.add('bwn');
|
|
150
|
+
for (const nn of [from.body, ...oldBodies?.filter?.(bodyExclusion)]) {
|
|
151
|
+
nn?.classList.add('bwd'); //from?.classList.add('bwd')
|
|
152
|
+
nn?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: nn }, bubbles: true, composed: true }));
|
|
153
|
+
}
|
|
154
|
+
for (const el of inbetweenModals)
|
|
155
|
+
el.close(); // close old inbetween modals
|
|
156
|
+
// capture trans
|
|
157
|
+
if (devFlags.debug)
|
|
158
|
+
console.debug(`⚡️ view-transition-start (${type})`);
|
|
159
|
+
await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
|
|
160
|
+
if (devFlags.debug)
|
|
161
|
+
console.debug(`⚡️ view-transition-end (${type})`);
|
|
162
|
+
if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
|
|
163
|
+
return;
|
|
164
|
+
cleanup(root);
|
|
165
|
+
// remove or hide
|
|
166
|
+
await updateCallback();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends object>(set: Set<T> | WeakSet<T>, value: T): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector: string, element?: Element): T[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function (selector, element) {
|
|
2
|
+
const matches = [];
|
|
3
|
+
let current = element?.closest(selector) ?? undefined;
|
|
4
|
+
while (current) {
|
|
5
|
+
matches.push(current);
|
|
6
|
+
current = current.parentElement?.closest(selector) ?? undefined;
|
|
7
|
+
}
|
|
8
|
+
return matches;
|
|
9
|
+
}
|
|
10
|
+
// function querySelectorAllUp(el, selector) {
|
|
11
|
+
// const matches = [];
|
|
12
|
+
// let current = el.parentElement;
|
|
13
|
+
// while (current) {
|
|
14
|
+
// if (current.matches(selector)) matches.push(current);
|
|
15
|
+
// current = current.parentElement;
|
|
16
|
+
// }
|
|
17
|
+
// return matches;
|
|
18
|
+
// }
|
|
19
|
+
// function querySelectorAllUp(el, selector) {
|
|
20
|
+
// const matches = [];
|
|
21
|
+
// let current = el.closest(selector);
|
|
22
|
+
// while (current) {
|
|
23
|
+
// matches.push(current);
|
|
24
|
+
// current = current.parentElement?.closest(selector);
|
|
25
|
+
// }
|
|
26
|
+
// return matches;
|
|
27
|
+
// }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ancestors from './ancestors';
|
|
2
|
+
import next from './next';
|
|
3
|
+
import nextAll from './next-all';
|
|
4
|
+
import prev from './prev';
|
|
5
|
+
import prevAll from './prev-all';
|
|
6
|
+
import prop from './prop';
|
|
7
|
+
import siblings from './siblings';
|
|
8
|
+
declare const DEFAULT: ">1";
|
|
9
|
+
interface CashFn {
|
|
10
|
+
(innerHTML: string): DocumentFragment;
|
|
11
|
+
<T extends Element = Element>(innerHTML: string, selector: typeof DEFAULT): T;
|
|
12
|
+
<T extends Element = Element>(innerHTML: string, selector: string): T;
|
|
13
|
+
prop: typeof prop;
|
|
14
|
+
nextAll: typeof nextAll;
|
|
15
|
+
prevAll: typeof prevAll;
|
|
16
|
+
next: typeof next;
|
|
17
|
+
prev: typeof prev;
|
|
18
|
+
siblings: typeof siblings;
|
|
19
|
+
ancestors: typeof ancestors;
|
|
20
|
+
}
|
|
21
|
+
declare const cash: CashFn;
|
|
22
|
+
export default cash;
|
|
23
|
+
export { ancestors, next, nextAll, prev, prevAll, prop, siblings };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ancestors from './ancestors';
|
|
2
|
+
import next from './next';
|
|
3
|
+
import nextAll from './next-all';
|
|
4
|
+
import prev from './prev';
|
|
5
|
+
import prevAll from './prev-all';
|
|
6
|
+
import prop from './prop';
|
|
7
|
+
import siblings from './siblings';
|
|
8
|
+
const DEFAULT = '>1';
|
|
9
|
+
const cash = ((innerHTML, selector) => {
|
|
10
|
+
const template = Object.assign(document.createElement('template'), { innerHTML });
|
|
11
|
+
if (!selector)
|
|
12
|
+
return template.content;
|
|
13
|
+
if (selector === DEFAULT)
|
|
14
|
+
return template.content.firstElementChild; // OVERKILL
|
|
15
|
+
return template.content.querySelector('>1' === selector ? ':first-child' : selector);
|
|
16
|
+
});
|
|
17
|
+
cash.prop = prop;
|
|
18
|
+
cash.nextAll = nextAll;
|
|
19
|
+
cash.prevAll = prevAll;
|
|
20
|
+
cash.next = next;
|
|
21
|
+
cash.prev = prev;
|
|
22
|
+
cash.siblings = siblings;
|
|
23
|
+
cash.ancestors = ancestors;
|
|
24
|
+
export default cash;
|
|
25
|
+
export { ancestors, next, nextAll, prev, prevAll, prop, siblings };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector?: string, element?: Element): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector?: string, element?: Element): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector?: string, element?: Element): T[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function (selector, element) {
|
|
2
|
+
const siblings = [];
|
|
3
|
+
let prev = element?.previousElementSibling;
|
|
4
|
+
while (prev) {
|
|
5
|
+
if (!selector || prev.matches(selector))
|
|
6
|
+
siblings.push(prev);
|
|
7
|
+
prev = prev.previousElementSibling;
|
|
8
|
+
}
|
|
9
|
+
return siblings;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector?: string, element?: Element): T | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A remove/set property utility that checks before doing DOM manipulations.
|
|
3
|
+
* It enforces the important flag, the built-in functionality is to leave it as-is if there was an important flat and the setProperty does not have one
|
|
4
|
+
* In case of undefined it does a removeProperty, the built-in functionality is to add a string representation ("undefined")
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* By default setProperty does NOT enforce important. It always triggers a DOM manipulation.
|
|
8
|
+
* By default getPropertyValue returns a trimmed string but fails to inform of the presence in the style attribute.
|
|
9
|
+
*
|
|
10
|
+
* Examples:
|
|
11
|
+
* [style] prop('--prop', '1rem', el) style="--prop: 1rem;"
|
|
12
|
+
* [style] prop('--prop', null | '' | undefined, el) style
|
|
13
|
+
* [style] prop('--prop', ' ', el) style="--prop: ;"
|
|
14
|
+
* [style] prop('--prop', ' ', el) style="--prop: ;"
|
|
15
|
+
* style="--prop: 1rem;" prop('--prop', '1rem', el, 'important') style="--prop: 1rem !important;"
|
|
16
|
+
* style="--prop: 1rem !important;" prop('--prop', '1rem', el) style="--prop: 1rem;"
|
|
17
|
+
*/
|
|
18
|
+
export default function (property: string, value?: string | null, el?: HTMLElement | null, priority?: 'important'): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A remove/set property utility that checks before doing DOM manipulations.
|
|
3
|
+
* It enforces the important flag, the built-in functionality is to leave it as-is if there was an important flat and the setProperty does not have one
|
|
4
|
+
* In case of undefined it does a removeProperty, the built-in functionality is to add a string representation ("undefined")
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* By default setProperty does NOT enforce important. It always triggers a DOM manipulation.
|
|
8
|
+
* By default getPropertyValue returns a trimmed string but fails to inform of the presence in the style attribute.
|
|
9
|
+
*
|
|
10
|
+
* Examples:
|
|
11
|
+
* [style] prop('--prop', '1rem', el) style="--prop: 1rem;"
|
|
12
|
+
* [style] prop('--prop', null | '' | undefined, el) style
|
|
13
|
+
* [style] prop('--prop', ' ', el) style="--prop: ;"
|
|
14
|
+
* [style] prop('--prop', ' ', el) style="--prop: ;"
|
|
15
|
+
* style="--prop: 1rem;" prop('--prop', '1rem', el, 'important') style="--prop: 1rem !important;"
|
|
16
|
+
* style="--prop: 1rem !important;" prop('--prop', '1rem', el) style="--prop: 1rem;"
|
|
17
|
+
*/
|
|
18
|
+
export default function (property, value, el, priority) {
|
|
19
|
+
if (!el)
|
|
20
|
+
return;
|
|
21
|
+
if (!value) {
|
|
22
|
+
if (-1 !== Array.from(el.style).indexOf(property))
|
|
23
|
+
el.style.removeProperty(property); // remove key entirely
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const currentValue = el.style.getPropertyValue(property), // "" always trimmed
|
|
27
|
+
currentPriority = el.style.getPropertyPriority(property); // "" always lowercase
|
|
28
|
+
if (currentValue !== value.trim() || currentPriority !== (priority ?? '').toLowerCase())
|
|
29
|
+
el.style.setProperty(property, value, priority); // enforce priority
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends Element>(selector?: string, element?: Element): T[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function (selector, element) {
|
|
2
|
+
const siblings = [];
|
|
3
|
+
let child = element?.parentElement?.firstElementChild;
|
|
4
|
+
while (child) {
|
|
5
|
+
if (child !== element && (!selector || child.matches(selector)))
|
|
6
|
+
siblings.push(child);
|
|
7
|
+
child = child.nextElementSibling;
|
|
8
|
+
}
|
|
9
|
+
return siblings;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (value?: string, min?: number, max?: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (a: string, b: string): number;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* compareBigDecimals("1e3", "1000") // 0
|
|
4
|
+
* compareBigDecimals("1e-3", "0.001") // 0
|
|
5
|
+
* compareBigDecimals("-10", "-2") // -1 ✅
|
|
6
|
+
* const arr = ["1.2","1.10","1.02","1e2","100","-0.5"]
|
|
7
|
+
* arr.sort(compareBigDecimals)
|
|
8
|
+
* console.log(arr)
|
|
9
|
+
* function isInRange(value: string, min: string, max: string): boolean {return compareBigDecimals(value, min) >= 0 && compareBigDecimals(value, max) <= 0}
|
|
10
|
+
* // examples
|
|
11
|
+
* isInRange("-5", "-10", "-1") // true
|
|
12
|
+
* isInRange("-11", "-10", "-1") // false
|
|
13
|
+
* isInRange("0", "-10", "-1") // false
|
|
14
|
+
* isInRange("-Infinity", "-Infinity", "-1") // true
|
|
15
|
+
* isInRange("5", "-Infinity", "Infinity") // true
|
|
16
|
+
*/
|
|
17
|
+
const POSITIVE_INFINITY = 'Infinity', NEGATIVE_INFINITY = '-Infinity';
|
|
18
|
+
export default function (a, b) {
|
|
19
|
+
const aInf = isInfinity(a), bInf = isInfinity(b);
|
|
20
|
+
if (aInf !== 0 || bInf !== 0) {
|
|
21
|
+
if (aInf === bInf)
|
|
22
|
+
return 0;
|
|
23
|
+
return aInf > bInf ? 1 : -1;
|
|
24
|
+
}
|
|
25
|
+
const A = parse(a), B = parse(b);
|
|
26
|
+
// different signs
|
|
27
|
+
if (A.sign !== B.sign)
|
|
28
|
+
return A.sign - B.sign;
|
|
29
|
+
const sign = A.sign;
|
|
30
|
+
// compare integer length
|
|
31
|
+
if (A.i.length !== B.i.length)
|
|
32
|
+
return (A.i.length - B.i.length) * sign;
|
|
33
|
+
// compare integer part
|
|
34
|
+
if (A.i !== B.i)
|
|
35
|
+
return (A.i > B.i ? 1 : -1) * sign;
|
|
36
|
+
// compare fractional part
|
|
37
|
+
const max = Math.max(A.f.length, B.f.length);
|
|
38
|
+
for (let i = 0; i < max; i++) {
|
|
39
|
+
const da = A.f.charCodeAt(i) || 48, // '0'
|
|
40
|
+
db = B.f.charCodeAt(i) || 48;
|
|
41
|
+
if (da !== db)
|
|
42
|
+
return (da > db ? 1 : -1) * sign;
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
function isInfinity(s) {
|
|
47
|
+
const t = s.trim();
|
|
48
|
+
if (t === POSITIVE_INFINITY || t === '+Infinity')
|
|
49
|
+
return 1;
|
|
50
|
+
if (t === NEGATIVE_INFINITY)
|
|
51
|
+
return -1;
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
function parse(input) {
|
|
55
|
+
let s = input.trim(), sign = 1;
|
|
56
|
+
// sign
|
|
57
|
+
if (s[0] === '-') {
|
|
58
|
+
sign = -1;
|
|
59
|
+
s = s.slice(1);
|
|
60
|
+
}
|
|
61
|
+
else if (s[0] === '+') {
|
|
62
|
+
s = s.slice(1);
|
|
63
|
+
}
|
|
64
|
+
// scientific notation
|
|
65
|
+
let exp = 0;
|
|
66
|
+
const eIndex = s.search(/e/i);
|
|
67
|
+
if (eIndex !== -1) {
|
|
68
|
+
exp = parseInt(s.slice(eIndex + 1), 10) || 0;
|
|
69
|
+
s = s.slice(0, eIndex);
|
|
70
|
+
}
|
|
71
|
+
let [i = '0', f = ''] = s.split('.');
|
|
72
|
+
// remove leading zeros
|
|
73
|
+
i = i.replace(/^0+/, '') || '0';
|
|
74
|
+
// apply exponent by shifting decimal
|
|
75
|
+
if (exp > 0) {
|
|
76
|
+
const move = Math.min(exp, f.length);
|
|
77
|
+
i += f.slice(0, move);
|
|
78
|
+
f = f.slice(move) + '0'.repeat(exp - move);
|
|
79
|
+
}
|
|
80
|
+
else if (exp < 0) {
|
|
81
|
+
const move = Math.min(-exp, i.length);
|
|
82
|
+
f = i.slice(i.length - move) + f;
|
|
83
|
+
i = i.slice(0, i.length - move) || '0';
|
|
84
|
+
f = '0'.repeat(-exp - move) + f;
|
|
85
|
+
}
|
|
86
|
+
// normalize again
|
|
87
|
+
i = i.replace(/^0+/, '') || '0';
|
|
88
|
+
f = f.replace(/0+$/, '');
|
|
89
|
+
return { sign, i, f };
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <F extends (...args: any[]) => any>(fn: F, delay?: number, immediate?: boolean): (...args: Parameters<F>) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import timeout from './timeout';
|
|
2
|
+
export default function (fn, delay = 300, immediate = false) {
|
|
3
|
+
const { next, pending } = timeout();
|
|
4
|
+
return function (...args) {
|
|
5
|
+
const context = this, callNow = immediate && !pending();
|
|
6
|
+
next(() => {
|
|
7
|
+
if (!immediate)
|
|
8
|
+
fn.apply(context, args);
|
|
9
|
+
}, delay);
|
|
10
|
+
if (callNow)
|
|
11
|
+
fn.apply(context, args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (target: HTMLElement | null, role: string | null, titleKey?: string | null): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { I18n } from '../../i18n';
|
|
2
|
+
import { Snapshot } from '../../snapshot';
|
|
3
|
+
import { default as $ } from './cash';
|
|
4
|
+
function renderPlaceholder(el, role, titleKey) {
|
|
5
|
+
// if (!el.isConnected) return
|
|
6
|
+
// self.requestAnimationFrame(() => {
|
|
7
|
+
// if (!el.isConnected) return
|
|
8
|
+
const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'));
|
|
9
|
+
switch (role) {
|
|
10
|
+
case 'cancel':
|
|
11
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel);
|
|
12
|
+
label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
|
|
13
|
+
break;
|
|
14
|
+
case 'close':
|
|
15
|
+
if (label.closest('[is=alert-dialog]')) {
|
|
16
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').OK);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Close);
|
|
20
|
+
label.setAttribute('system-image', Snapshot.config['close-button-icon']);
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
case 'confirm':
|
|
24
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm);
|
|
25
|
+
label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
|
|
26
|
+
break;
|
|
27
|
+
case 'confirmation-action':
|
|
28
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm);
|
|
29
|
+
label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
|
|
30
|
+
break;
|
|
31
|
+
case 'cancellation-action':
|
|
32
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel);
|
|
33
|
+
label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
|
|
34
|
+
break;
|
|
35
|
+
case 'destructive':
|
|
36
|
+
label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Destructive);
|
|
37
|
+
label.setAttribute('system-image', Snapshot.config['delete-button-icon']);
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
label?.remove();
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
// if (role) {
|
|
44
|
+
// label.setAttribute('title', I18n.t('ButtonRole').Default.Destructive)
|
|
45
|
+
// } else label?.remove()
|
|
46
|
+
// })
|
|
47
|
+
}
|
|
48
|
+
export default function (target, role, titleKey) {
|
|
49
|
+
if (!target)
|
|
50
|
+
return;
|
|
51
|
+
const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
|
|
52
|
+
renderPlaceholder(target, role, overiderTitle);
|
|
53
|
+
// CleanupRegistry.unregister(target, 'i18n')
|
|
54
|
+
// CleanupRegistry.register(target, onoff('localechange', () => renderPlaceholder(target, role, overiderTitle), I18n.on).on(), 'i18n')
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (element?: Element): Promise<number | undefined>;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as add } from './add';
|
|
2
|
+
export { default as $ } from './cash';
|
|
3
|
+
export { default as clamp } from './clamp';
|
|
4
|
+
export { default as compareBigDecimals } from './compare-big-decimals';
|
|
2
5
|
export { default as cssTime } from './css-time';
|
|
6
|
+
export { default as debounce } from './debounce';
|
|
7
|
+
export { default as devFlags } from './dev-flags';
|
|
8
|
+
export { default as ensurePlaceholder } from './ensure-placeholder';
|
|
9
|
+
export { default as frame } from './frame';
|
|
10
|
+
export { default as isInside } from './is-inside';
|
|
11
|
+
export { default as kebabCase } from './kebab-case';
|
|
12
|
+
export { default as listActive } from './list-active';
|
|
13
|
+
export { default as microtask } from './microtask';
|
|
14
|
+
export { default as onoff } from './onoff';
|
|
15
|
+
export { default as renderLabel } from './render-label';
|
|
16
|
+
export { default as renderLabelIcon } from './render-label-icon';
|
|
17
|
+
export { default as renderLabelTitle } from './render-label-title';
|
|
18
|
+
export { default as set } from './set';
|
|
19
|
+
export { default as sleep } from './sleep';
|
|
20
|
+
export { default as slowHideShow } from './slow-hide-show';
|
|
21
|
+
export { default as timeout } from './timeout';
|
|
22
|
+
export { default as touchGlass } from './touch-glass';
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
// import * as _intl from './intl'
|
|
2
|
+
// import cash from './cash'
|
|
3
|
+
export { default as add } from './add';
|
|
4
|
+
export { default as $ } from './cash';
|
|
5
|
+
export { default as clamp } from './clamp';
|
|
6
|
+
export { default as compareBigDecimals } from './compare-big-decimals';
|
|
2
7
|
export { default as cssTime } from './css-time';
|
|
8
|
+
export { default as debounce } from './debounce';
|
|
9
|
+
export { default as devFlags } from './dev-flags';
|
|
10
|
+
export { default as ensurePlaceholder } from './ensure-placeholder';
|
|
11
|
+
export { default as frame } from './frame';
|
|
12
|
+
export { default as isInside } from './is-inside';
|
|
13
|
+
export { default as kebabCase } from './kebab-case';
|
|
14
|
+
export { default as listActive } from './list-active';
|
|
15
|
+
export { default as microtask } from './microtask';
|
|
16
|
+
export { default as onoff } from './onoff';
|
|
17
|
+
export { default as renderLabel } from './render-label';
|
|
18
|
+
export { default as renderLabelIcon } from './render-label-icon';
|
|
19
|
+
export { default as renderLabelTitle } from './render-label-title';
|
|
20
|
+
export { default as set } from './set';
|
|
21
|
+
export { default as sleep } from './sleep';
|
|
22
|
+
export { default as slowHideShow } from './slow-hide-show';
|
|
23
|
+
export { default as timeout } from './timeout';
|
|
24
|
+
export { default as touchGlass } from './touch-glass';
|
|
25
|
+
// export const $: typeof cash = cash
|