@swiftwc/ui 0.0.0-dev.4 → 0.0.0-dev.41
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 +24 -0
- package/generated/client/index.js +272 -0
- package/generated/components/alert-dialog.d.ts +8 -0
- package/generated/components/alert-dialog.js +99 -0
- package/generated/components/body-view.d.ts +5 -0
- package/generated/components/body-view.js +14 -0
- package/generated/components/bordered-button.d.ts +13 -0
- package/generated/components/bordered-button.js +45 -0
- package/generated/components/bordered-prominent-button.d.ts +13 -0
- package/generated/components/bordered-prominent-button.js +45 -0
- package/generated/components/borderless-button.d.ts +13 -0
- package/generated/components/borderless-button.js +45 -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 +468 -0
- package/generated/components/disclosure-group.d.ts +9 -0
- package/generated/components/disclosure-group.js +58 -0
- package/generated/components/fine-tooltip.d.ts +7 -0
- package/generated/components/fine-tooltip.js +107 -0
- package/generated/components/form-view.d.ts +6 -0
- package/generated/components/form-view.js +60 -0
- package/generated/components/glass-button.d.ts +12 -0
- package/generated/components/glass-button.js +42 -0
- package/generated/components/glass-prominent-button.d.ts +12 -0
- package/generated/components/glass-prominent-button.js +42 -0
- package/generated/components/index.d.ts +42 -0
- package/generated/components/index.js +42 -0
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +59 -0
- package/generated/components/list-view.d.ts +5 -0
- package/generated/components/list-view.js +29 -0
- package/generated/components/menu-view.d.ts +9 -0
- package/generated/components/menu-view.js +145 -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 +10 -0
- package/generated/components/navigation-split-view.js +25 -0
- package/generated/components/navigation-stack.d.ts +10 -0
- package/generated/components/navigation-stack.js +31 -0
- package/generated/components/navigation-title.d.ts +8 -0
- package/generated/components/navigation-title.js +52 -0
- package/generated/components/picker-view.d.ts +28 -0
- package/generated/components/picker-view.js +697 -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 +125 -0
- package/generated/components/screen-view.d.ts +5 -0
- package/generated/components/screen-view.js +11 -0
- 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 +10 -0
- package/generated/components/scroll-view.js +202 -0
- package/generated/components/search-view.d.ts +8 -0
- package/generated/components/search-view.js +30 -0
- package/generated/components/section-view.d.ts +9 -0
- package/generated/components/section-view.js +83 -0
- package/generated/components/sheet-view.d.ts +8 -0
- package/generated/components/sheet-view.js +62 -0
- package/generated/components/sidebar-toggle.d.ts +7 -0
- package/generated/components/sidebar-toggle.js +85 -0
- package/generated/components/sidebar-view.d.ts +7 -0
- package/generated/components/sidebar-view.js +34 -0
- package/generated/components/sticky-container.d.ts +6 -0
- package/generated/components/sticky-container.js +26 -0
- package/generated/components/tab-bar.d.ts +10 -0
- package/generated/components/tab-bar.js +43 -0
- package/generated/components/tab-item.d.ts +7 -0
- package/generated/components/tab-item.js +132 -0
- package/generated/components/tab-view.d.ts +22 -0
- package/generated/components/tab-view.js +264 -0
- package/generated/components/table-view.d.ts +7 -0
- package/generated/components/table-view.js +174 -0
- package/generated/components/text-field.d.ts +29 -0
- package/generated/components/text-field.js +503 -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 +15 -0
- package/generated/components/v-keyboard.js +89 -0
- package/generated/components/v-stack.d.ts +10 -0
- package/generated/components/v-stack.js +19 -0
- package/generated/css/index.css +8089 -0
- package/generated/events/alert-dialog.d.ts +8 -0
- package/generated/events/alert-dialog.js +1 -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/index.d.ts +2 -0
- package/generated/index.js +3 -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 +79 -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 +4 -0
- package/generated/internal/decorators/index.js +4 -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/css-time.d.ts +1 -0
- package/generated/internal/utils/css-time.js +3 -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 +19 -0
- package/generated/internal/utils/index.js +22 -0
- 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 -0
- package/generated/internal/utils/kebab-case.js +11 -0
- 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/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 +9 -0
- package/generated/snapshot/index.js +60 -0
- package/package.json +35 -11
- package/scss/_components.scss +59 -14
- 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 +142 -23
- package/scss/base/_layout.scss +31 -16
- package/scss/base/_reboot.scss +151 -15
- package/scss/base/_root.scss +355 -25
- package/scss/colors/_index.scss +672 -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 +63 -0
- package/scss/components/_borderless-button.scss +36 -6
- package/scss/components/_confirmation-dialog.scss +84 -0
- package/scss/components/_content-unavailable-view.scss +45 -0
- package/scss/components/_date-picker.scss +30 -0
- package/scss/components/_detail-placeholder.scss +153 -0
- package/scss/components/_disclosure-group.scss +146 -51
- package/scss/components/_fine-tooltip.scss +82 -0
- package/scss/components/_form-view.scss +195 -0
- package/scss/components/_full-screen.scss +7 -5
- package/scss/components/_glass-button.scss +59 -0
- package/scss/components/_glass-prominent-button.scss +68 -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/_index.scss +234 -7
- package/scss/components/_label-view copy.scss.txt +420 -0
- package/scss/components/_label-view.scss +355 -0
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_labeled-content.scss +9 -0
- package/scss/components/_list-view.scss +229 -0
- package/scss/components/_menu-view.scss +211 -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 +131 -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 +18 -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 +207 -84
- package/scss/components/_tab-item.scss +25 -0
- package/scss/components/_tab-view.scss +270 -126
- package/scss/components/_table-column.scss +52 -0
- package/scss/components/_table-row.scss +172 -0
- package/scss/components/_table-view.scss +223 -0
- package/scss/components/_text-field.scss +37 -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 +422 -0
- package/scss/placeholders/_buttons.scss +117 -0
- package/scss/placeholders/_lists.scss +571 -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 +22 -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 +91 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +209 -0
- package/web-components.html-data/en.json +500 -0
- 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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Snapshot } from '../../snapshot';
|
|
2
|
+
export class MutationObserverSet {
|
|
3
|
+
callback;
|
|
4
|
+
#observers = new Map();
|
|
5
|
+
constructor(callback) {
|
|
6
|
+
this.callback = callback;
|
|
7
|
+
}
|
|
8
|
+
async observe(target, attributeFilter) {
|
|
9
|
+
await Snapshot.waitReady;
|
|
10
|
+
if (this.#observers.has(target))
|
|
11
|
+
return;
|
|
12
|
+
const observer = new MutationObserver(this.callback);
|
|
13
|
+
observer.observe(target, {
|
|
14
|
+
attributes: true,
|
|
15
|
+
characterData: true,
|
|
16
|
+
subtree: true,
|
|
17
|
+
childList: true,
|
|
18
|
+
...(attributeFilter && { attributeFilter }),
|
|
19
|
+
});
|
|
20
|
+
this.#observers.set(target, observer);
|
|
21
|
+
}
|
|
22
|
+
async unobserve(target) {
|
|
23
|
+
await Snapshot.waitReady;
|
|
24
|
+
this.#observers.get(target)?.disconnect();
|
|
25
|
+
this.#observers.delete(target);
|
|
26
|
+
}
|
|
27
|
+
async syncObservations(source, attributeFilter) {
|
|
28
|
+
await Snapshot.waitReady;
|
|
29
|
+
const sourceSet = new Set(source);
|
|
30
|
+
for (const el of [...this.#observers.keys()])
|
|
31
|
+
if (!sourceSet.has(el))
|
|
32
|
+
this.unobserve(el);
|
|
33
|
+
for (const el of source)
|
|
34
|
+
this.observe(el, attributeFilter);
|
|
35
|
+
}
|
|
36
|
+
async unobserveAll() {
|
|
37
|
+
await Snapshot.waitReady;
|
|
38
|
+
for (const obs of this.#observers.values())
|
|
39
|
+
obs.disconnect();
|
|
40
|
+
this.#observers.clear();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class MutationObserverSingleton {
|
|
2
|
+
#private;
|
|
3
|
+
readonly observer: Promise<MutationObserver>;
|
|
4
|
+
constructor();
|
|
5
|
+
observe(target: Node, callback: (entry: MutationRecord) => void, options: MutationObserverInit): Promise<void>;
|
|
6
|
+
unobserve(target: Node): Promise<void>;
|
|
7
|
+
/** Observes automatically all elements using a Set provided by outside. Calls renderCallback on EVERY change. */
|
|
8
|
+
syncObservations(set: Set<Element>, nodes: Element[], renderCallback: () => void, attributeFilter?: string[]): Promise<void>;
|
|
9
|
+
clearObservationsSet(set: Set<Element>): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Snapshot } from '../../snapshot';
|
|
2
|
+
export class MutationObserverSingleton {
|
|
3
|
+
#observers = new WeakMap();
|
|
4
|
+
observer;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.observer = Snapshot.waitReady.then(() => {
|
|
7
|
+
return new MutationObserver((entries) => {
|
|
8
|
+
for (const entry of entries)
|
|
9
|
+
this.#observers.get(entry.target)?.(entry);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async observe(target, callback, options) {
|
|
14
|
+
this.#observers.set(target, callback);
|
|
15
|
+
(await this.observer).observe(target, options);
|
|
16
|
+
}
|
|
17
|
+
async unobserve(target) {
|
|
18
|
+
;
|
|
19
|
+
(await this.observer).disconnect();
|
|
20
|
+
this.#observers.delete(target);
|
|
21
|
+
}
|
|
22
|
+
/** Observes automatically all elements using a Set provided by outside. Calls renderCallback on EVERY change. */
|
|
23
|
+
// shortcur fot this
|
|
24
|
+
// #trackedElements = new Set<Element>()
|
|
25
|
+
// for (const el of this.#trackedElements)
|
|
26
|
+
// if (!assigned.includes(el)) {
|
|
27
|
+
// observers.unobserve(el)
|
|
28
|
+
// this.#trackedElements.delete(el)
|
|
29
|
+
// }
|
|
30
|
+
// for (const el of assigned) {
|
|
31
|
+
// if (!this.#trackedElements.has(el))
|
|
32
|
+
// observers.observe(el, this.#handleTagMutation, {
|
|
33
|
+
// attributes: true,
|
|
34
|
+
// characterData: true,
|
|
35
|
+
// subtree: true,
|
|
36
|
+
// childList: true,
|
|
37
|
+
// // attributeFilter: ['value', 'label'],
|
|
38
|
+
// })
|
|
39
|
+
// this.#trackedElements.add(el)
|
|
40
|
+
// }
|
|
41
|
+
async syncObservations(set, nodes, renderCallback, attributeFilter) {
|
|
42
|
+
for (const el of set)
|
|
43
|
+
if (!nodes.includes(el)) {
|
|
44
|
+
this.unobserve(el);
|
|
45
|
+
set.delete(el);
|
|
46
|
+
}
|
|
47
|
+
for (const el of nodes) {
|
|
48
|
+
if (!set.has(el))
|
|
49
|
+
this.observe(el, renderCallback, {
|
|
50
|
+
attributes: true,
|
|
51
|
+
characterData: true,
|
|
52
|
+
subtree: true,
|
|
53
|
+
childList: true,
|
|
54
|
+
...(attributeFilter && { attributeFilter }),
|
|
55
|
+
});
|
|
56
|
+
set.add(el);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async clearObservationsSet(set) {
|
|
60
|
+
for (const el of set)
|
|
61
|
+
this.unobserve(el);
|
|
62
|
+
set.clear();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as Components from '../../components';
|
|
2
|
+
import { type NavigationHost, type NavigationPage, type NavigationToolbarConfiguration } from '../privateNamespace';
|
|
3
|
+
export declare class NavigationPath {
|
|
4
|
+
#private;
|
|
5
|
+
get component(): NavigationHost | undefined;
|
|
6
|
+
get body(): Components.ScrollView | null | undefined;
|
|
7
|
+
get page(): NavigationPage | null | undefined;
|
|
8
|
+
get toolBarConfig(): NavigationToolbarConfiguration[] | undefined;
|
|
9
|
+
get slot(): NavigationHost | null | undefined;
|
|
10
|
+
constructor(any?: HTMLElement);
|
|
11
|
+
hydrate(): this;
|
|
12
|
+
children(): Generator<NavigationPath>;
|
|
13
|
+
parents(): Generator<NavigationPath>;
|
|
14
|
+
[Symbol.iterator](): Generator<NavigationPath>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets current host (closest)
|
|
3
|
+
*/
|
|
4
|
+
function closestHost(any) {
|
|
5
|
+
return any?.closest('body-view,[is=sheet-view],navigation-stack,navigation-split-view') ?? undefined;
|
|
6
|
+
}
|
|
7
|
+
export class NavigationPath {
|
|
8
|
+
#component;
|
|
9
|
+
#slot;
|
|
10
|
+
#body;
|
|
11
|
+
#page;
|
|
12
|
+
#toolBarConfig;
|
|
13
|
+
get component() {
|
|
14
|
+
return this.#component;
|
|
15
|
+
}
|
|
16
|
+
get body() {
|
|
17
|
+
if (undefined === this.#body)
|
|
18
|
+
this.#queryBody();
|
|
19
|
+
return this.#body;
|
|
20
|
+
}
|
|
21
|
+
get page() {
|
|
22
|
+
if (undefined === this.#page)
|
|
23
|
+
this.#queryPage();
|
|
24
|
+
return this.#page;
|
|
25
|
+
}
|
|
26
|
+
get toolBarConfig() {
|
|
27
|
+
if (undefined === this.#toolBarConfig)
|
|
28
|
+
this.#queryToolBarConfig();
|
|
29
|
+
return this.#toolBarConfig;
|
|
30
|
+
}
|
|
31
|
+
get slot() {
|
|
32
|
+
if (undefined === this.#slot)
|
|
33
|
+
this.#querySlot();
|
|
34
|
+
return this.#slot;
|
|
35
|
+
}
|
|
36
|
+
constructor(any) {
|
|
37
|
+
this.#component = closestHost(any);
|
|
38
|
+
}
|
|
39
|
+
#queryBody() {
|
|
40
|
+
this.#body = closestHost(this.#component)?.querySelector(`:scope>scroll-view,:scope>[is=sidebar-view]>scroll-view`) ?? null;
|
|
41
|
+
}
|
|
42
|
+
#queryPage() {
|
|
43
|
+
this.#page = this.#component?.querySelector(':scope>scroll-view,:scope>[is=sidebar-view]') ?? null;
|
|
44
|
+
}
|
|
45
|
+
#queryToolBarConfig() {
|
|
46
|
+
this.#toolBarConfig = [
|
|
47
|
+
...(this.#component?.querySelectorAll(`:scope>tool-bar>tool-bar-item,:scope>tool-bar>tool-bar-item-group,:scope>[is=sidebar-view]>tool-bar>tool-bar-item,:scope>[is=sidebar-view]>tool-bar>tool-bar-item-group`) ?? []),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
#querySlot() {
|
|
51
|
+
this.#slot =
|
|
52
|
+
this.#component?.querySelector(':scope>body-view:not([hidden]),:scope>[is=sheet-view]:not([hidden]),:scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])') ?? null;
|
|
53
|
+
}
|
|
54
|
+
hydrate() {
|
|
55
|
+
this.#queryBody();
|
|
56
|
+
this.#queryPage();
|
|
57
|
+
this.#queryToolBarConfig();
|
|
58
|
+
this.#querySlot();
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
*children() {
|
|
62
|
+
if (!this.slot)
|
|
63
|
+
return;
|
|
64
|
+
const child = new NavigationPath(this.slot);
|
|
65
|
+
yield child;
|
|
66
|
+
yield* child.children();
|
|
67
|
+
}
|
|
68
|
+
*parents() {
|
|
69
|
+
if (!this.#component)
|
|
70
|
+
return;
|
|
71
|
+
let el = this.#component.parentElement;
|
|
72
|
+
while (el) {
|
|
73
|
+
const host = closestHost(el);
|
|
74
|
+
if (!host)
|
|
75
|
+
break;
|
|
76
|
+
yield new NavigationPath(host);
|
|
77
|
+
el = host.parentElement;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
*[Symbol.iterator]() {
|
|
81
|
+
yield this;
|
|
82
|
+
yield* this.children();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class NavigationView extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
constructor();
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { lifecycleObserver } from '../../buses';
|
|
3
|
+
import { CleanupRegistry } from '../../internal/class/cleanup-registry';
|
|
4
|
+
import { devFlags, frame, onoff } from '../utils';
|
|
5
|
+
export class NavigationView extends HTMLElement {
|
|
6
|
+
static get observedAttributes() {
|
|
7
|
+
return ['hidden'];
|
|
8
|
+
}
|
|
9
|
+
// pairedEventSystem
|
|
10
|
+
#recentBefore;
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
CleanupRegistry.unregister(this);
|
|
16
|
+
this.#recentBefore = undefined;
|
|
17
|
+
// this.removeEventListener('tabreveal', this.#handleTabReveal)
|
|
18
|
+
if (this.closest('tab-view'))
|
|
19
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabhide', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
if (this.closest('tab-view')) {
|
|
23
|
+
// frame(this).then((r) => {
|
|
24
|
+
// if (!r) return
|
|
25
|
+
// this.dispatchEvent(new CustomEvent<TabDetail>('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true }))
|
|
26
|
+
// })
|
|
27
|
+
CleanupRegistry.register(this, onoff('beforetabreveal beforetabswap', this.#handleBeforeTabRevealOrSwap, this).on());
|
|
28
|
+
}
|
|
29
|
+
// Snapshot.waitReady.then(async () => {
|
|
30
|
+
if (this.hasAttribute('hidden'))
|
|
31
|
+
return; // will be picked up by attr-change!
|
|
32
|
+
if (this.closest('tab-view'))
|
|
33
|
+
frame(this).then(() => {
|
|
34
|
+
// if (!r) return
|
|
35
|
+
lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true }));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
39
|
+
switch (name) {
|
|
40
|
+
case 'hidden':
|
|
41
|
+
if (oldValue === newValue)
|
|
42
|
+
break;
|
|
43
|
+
if (!this.closest('tab-view'))
|
|
44
|
+
break; // tabview stuff
|
|
45
|
+
let eventType = this.hasAttribute(name) ? 'tabhide' : 'tabshow', target = lifecycleObserver;
|
|
46
|
+
// isRecent by 100ms window
|
|
47
|
+
if (this.#recentBefore && performance.now() - this.#recentBefore.time <= 100) {
|
|
48
|
+
if (this.#recentBefore.type === 'beforetabreveal') {
|
|
49
|
+
eventType = 'tabreveal';
|
|
50
|
+
target = this;
|
|
51
|
+
}
|
|
52
|
+
else if (this.#recentBefore.type === 'beforetabswap') {
|
|
53
|
+
eventType = 'tabswap';
|
|
54
|
+
target = this;
|
|
55
|
+
}
|
|
56
|
+
// consume it (important so it doesn’t leak to next change)
|
|
57
|
+
this.#recentBefore = undefined;
|
|
58
|
+
}
|
|
59
|
+
if (devFlags.debug)
|
|
60
|
+
console.debug(`${_a.name} 💡 ${eventType}`);
|
|
61
|
+
frame(this).then(() => {
|
|
62
|
+
// if (!r) return
|
|
63
|
+
target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true }));
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
#handleBeforeTabRevealOrSwap = (evt) => {
|
|
69
|
+
if (devFlags.debug)
|
|
70
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
71
|
+
if (this.id !== evt.detail?.tag)
|
|
72
|
+
return;
|
|
73
|
+
this.#recentBefore = {
|
|
74
|
+
type: evt.type, // beforetabreveal / beforetabswap
|
|
75
|
+
time: performance.now(),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
_a = NavigationView;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Snapshot } from '../../snapshot';
|
|
2
|
+
export class ResizeObserverSingleton {
|
|
3
|
+
#observers = new WeakMap();
|
|
4
|
+
observer;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.observer = Snapshot.waitReady.then(() => {
|
|
7
|
+
return new ResizeObserver((entries) => {
|
|
8
|
+
for (const entry of entries)
|
|
9
|
+
this.#observers.get(entry.target)?.(entry);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async observe(target, callback) {
|
|
14
|
+
this.#observers.set(target, callback);
|
|
15
|
+
(await this.observer).observe(target);
|
|
16
|
+
}
|
|
17
|
+
async unobserve(target) {
|
|
18
|
+
;
|
|
19
|
+
(await this.observer).unobserve(target);
|
|
20
|
+
this.#observers.delete(target);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (filter?: (el: HTMLElement) => boolean): <T extends CustomElementConstructor>(Base: T, _context?: ClassDecoratorContext<T>) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Snapshot } from '../../snapshot';
|
|
2
|
+
import { CleanupRegistry } from '../class/cleanup-registry';
|
|
3
|
+
import { devFlags, onoff } from '../utils';
|
|
4
|
+
export default function (filter) {
|
|
5
|
+
const handleMediaChange = (el, { type, matches }) => {
|
|
6
|
+
if (devFlags.debug)
|
|
7
|
+
console.debug(`${el.localName} ⚡️ ${type}`);
|
|
8
|
+
if (matches) {
|
|
9
|
+
if (!el.matches(`[slot="cancellation-action"],[slot="primary-action"],[slot="confirmation-action"],[slot="destructive-action"]`))
|
|
10
|
+
return;
|
|
11
|
+
const newSlot = ['destructive-action'].includes(el.slot) ? 'bottom-bar-leading' : 'bottom-bar-trailing';
|
|
12
|
+
if (el.slot !== newSlot)
|
|
13
|
+
el.dataset.previousSlot = el.slot;
|
|
14
|
+
el.slot = newSlot;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (!el.matches(`[data-previous-slot]`))
|
|
18
|
+
return;
|
|
19
|
+
el.slot = el.dataset.previousSlot ?? '';
|
|
20
|
+
delete el.dataset.previousSlot;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return function (Base, _context) {
|
|
24
|
+
const originalConnected = Base.prototype.connectedCallback, originalDisconnected = Base.prototype.disconnectedCallback;
|
|
25
|
+
Base.prototype.connectedCallback = function () {
|
|
26
|
+
if (devFlags.debug)
|
|
27
|
+
console.debug(`decorator:[${this.localName}] ⚡️ connect`);
|
|
28
|
+
originalConnected?.call(this);
|
|
29
|
+
if (filter && !filter(this))
|
|
30
|
+
return;
|
|
31
|
+
if (!this.closest('[is=sheet-view]'))
|
|
32
|
+
return;
|
|
33
|
+
if (!self.matchMedia('(pointer: fine)').matches)
|
|
34
|
+
return;
|
|
35
|
+
const handler1 = handleMediaChange.bind(null, this);
|
|
36
|
+
CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1, Snapshot.on).on(), 'adaptive-slot');
|
|
37
|
+
Snapshot.waitReady.then(() => {
|
|
38
|
+
handleMediaChange(this, new MediaQueryListEvent(`media-change`, {
|
|
39
|
+
matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
40
|
+
})); // Initial check
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
Base.prototype.disconnectedCallback = function () {
|
|
44
|
+
if (devFlags.debug)
|
|
45
|
+
console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
|
|
46
|
+
originalDisconnected?.call(this);
|
|
47
|
+
CleanupRegistry.unregister(this, 'adaptive-slot');
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as Components from '../components';
|
|
2
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
3
|
+
type TransitionType = 'forwards' | 'backwards' | 'reload';
|
|
4
|
+
export type NavigationHost = Components.BodyView | Components.SheetView | Components.NavigationStack | Components.NavigationSplitView;
|
|
5
|
+
export type NavigationToolbarConfiguration = Components.ToolBarItem | Components.ToolBarItemGroup;
|
|
6
|
+
export type NavigationPage = Components.SidebarView | Components.ScrollView;
|
|
7
|
+
export declare function queryInsertPosition(frame: NavigationHost): "afterend" | "beforebegin";
|
|
8
|
+
type UpdateCallback = () => void | Promise<void>;
|
|
9
|
+
type NavigateOptions = {
|
|
10
|
+
updateCallback?: UpdateCallback;
|
|
11
|
+
tos?: () => NavigationPath[];
|
|
12
|
+
};
|
|
13
|
+
export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
|
|
14
|
+
export {};
|
|
@@ -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
|
+
// }
|