@swiftwc/ui 0.0.0-dev.6 → 0.0.0-dev.60
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 +8841 -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 +207 -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
|
@@ -1,26 +1,62 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
4
|
export class SheetView extends DialogBase {
|
|
3
5
|
constructor() {
|
|
4
6
|
super();
|
|
5
7
|
}
|
|
6
|
-
disconnectedCallback() {
|
|
7
|
-
console.debug(`${SheetView.name} ⚡️ disconnect`);
|
|
8
|
-
SheetView.polyfillDisconnectedCallback(this);
|
|
9
|
-
}
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
console.debug(`${SheetView.name} ⚡️ connect`);
|
|
12
|
-
SheetView.polyfillConnectedCallback(this);
|
|
13
|
-
}
|
|
14
8
|
static polyfillDisconnectedCallback(el) {
|
|
15
|
-
|
|
9
|
+
if (devFlags.debug)
|
|
10
|
+
console.debug(`${SheetView.name} ⚡️ disconnect`);
|
|
11
|
+
CleanupRegistry.unregister(el);
|
|
16
12
|
}
|
|
17
13
|
static polyfillConnectedCallback(el) {
|
|
18
|
-
|
|
14
|
+
if (devFlags.debug)
|
|
15
|
+
console.debug(`${SheetView.name} ⚡️ connect`);
|
|
16
|
+
CleanupRegistry.register(el, onoff([
|
|
17
|
+
{ types: 'cancel', listener: this.#handleCancel },
|
|
18
|
+
{ types: 'keydown', listener: SheetView.#handleKeydown },
|
|
19
|
+
], el).on());
|
|
20
|
+
el.autofocus = true;
|
|
21
|
+
}
|
|
22
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
23
|
+
if (devFlags.debug)
|
|
24
|
+
console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
25
|
+
// // NOTE: wait for config
|
|
26
|
+
// Snapshot.waitReady.then(() => {
|
|
27
|
+
// switch (attributeName) {
|
|
28
|
+
// case 'fine-presentation-large-adaptation':
|
|
29
|
+
// const node = target instanceof HTMLDialogElement && target
|
|
30
|
+
// if (!node) break
|
|
31
|
+
// CleanupRegistry.unregister(node, 'mediaquery')
|
|
32
|
+
// if ('bottom-bar' !== target.getAttribute(attributeName ?? '')) break
|
|
33
|
+
// const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${Snapshot.config!['ipad-sheet-view-inline-size']}) and (min-height: ${Snapshot.config!['ipad-sheet-view-height']})`)
|
|
34
|
+
// SheetView.#handleMediaChange(
|
|
35
|
+
// node,
|
|
36
|
+
// new MediaQueryListEvent(`media-change`, {
|
|
37
|
+
// matches: mediaQueryList.matches,
|
|
38
|
+
// })
|
|
39
|
+
// ) // Initial check
|
|
40
|
+
// const handler1 = SheetView.#handleMediaChange.bind(null, node)
|
|
41
|
+
// CleanupRegistry.register(node, onoff('change', handler1 as unknown as EventListener, mediaQueryList).on(), 'mediaquery')
|
|
42
|
+
// break
|
|
43
|
+
// }
|
|
44
|
+
// })
|
|
19
45
|
}
|
|
46
|
+
static #handleKeydown = (evt) => {
|
|
47
|
+
if (devFlags.debug)
|
|
48
|
+
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
49
|
+
if ('Escape' !== evt.key)
|
|
50
|
+
return;
|
|
51
|
+
evt.preventDefault();
|
|
52
|
+
evt.stopImmediatePropagation();
|
|
53
|
+
evt.stopPropagation();
|
|
54
|
+
};
|
|
55
|
+
static #handleCancel = (evt) => {
|
|
56
|
+
if (devFlags.debug)
|
|
57
|
+
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
|
|
58
|
+
if (!evt.cancelable)
|
|
59
|
+
return;
|
|
60
|
+
evt.preventDefault();
|
|
61
|
+
};
|
|
20
62
|
}
|
|
21
|
-
SheetView.handleCancel = (event) => {
|
|
22
|
-
console.debug(`${SheetView.name} ⚡️ cancel (${event.cancelable})`);
|
|
23
|
-
if (!event.cancelable)
|
|
24
|
-
return;
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
};
|
|
@@ -1,81 +1,85 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _SidebarToggle_instances, _a, _SidebarToggle_ro, _SidebarToggle_autoCloseTabBar, _SidebarToggle_handleClick;
|
|
1
|
+
var _a;
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
4
|
+
import { debounce, devFlags, onoff } from '../internal/utils';
|
|
5
|
+
const observers = new ResizeObserverSingleton();
|
|
13
6
|
export class SidebarToggle extends HTMLElement {
|
|
14
|
-
// #io
|
|
15
|
-
static get cssVarPaddingName() {
|
|
16
|
-
return '--tabview-padding-inline-start';
|
|
17
|
-
}
|
|
18
7
|
constructor() {
|
|
19
8
|
super();
|
|
20
|
-
_SidebarToggle_instances.add(this);
|
|
21
|
-
_SidebarToggle_ro.set(this, void 0);
|
|
22
|
-
__classPrivateFieldSet(this, _SidebarToggle_ro, new ResizeObserver(__classPrivateFieldGet(this, _SidebarToggle_instances, "m", _SidebarToggle_autoCloseTabBar)), "f");
|
|
23
|
-
// this.#io = new IntersectionObserver((entries) => {
|
|
24
|
-
// this._checkVisibility2(entries)
|
|
25
|
-
// })
|
|
26
9
|
}
|
|
27
10
|
connectedCallback() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
13
|
+
CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
|
|
14
|
+
const entry = {
|
|
15
|
+
target: this,
|
|
16
|
+
};
|
|
17
|
+
observers.observe(this, debounce(_a.#handleMeasure, 100, true)); //this.#ro?.observe(this)
|
|
18
|
+
// @ts-expect-error
|
|
19
|
+
_a.#handleMeasure([entry]);
|
|
33
20
|
}
|
|
34
21
|
disconnectedCallback() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
24
|
+
observers.unobserve(this);
|
|
25
|
+
CleanupRegistry.unregister(this);
|
|
39
26
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
static query(target) {
|
|
28
|
+
const container = target?.closest('navigation-split-view,tab-view'), sideBar = container?.querySelector(':scope>[is=sidebar-view]');
|
|
29
|
+
return { container, sideBar };
|
|
30
|
+
}
|
|
31
|
+
// This triggers on show/hide of any of sidebar-toggle elements
|
|
32
|
+
static #handleMeasure(entry) {
|
|
33
|
+
if (devFlags.debug)
|
|
34
|
+
console.debug(`${_a.name} ⚡️ measure`);
|
|
35
|
+
const { target } = entry ?? {};
|
|
36
|
+
if (!(target instanceof HTMLElement))
|
|
37
|
+
return;
|
|
38
|
+
// set/remove css var/prop to parent based on shown/hidden
|
|
39
|
+
const tv = target.parentElement;
|
|
40
|
+
// inlineSize = entry.borderBoxSize?.at(0)?.inlineSize ?? entry.contentRect?.width ?? 0,
|
|
41
|
+
// blockSize = entry.borderBoxSize?.at(0)?.blockSize ?? entry.contentRect?.height ?? 0
|
|
42
|
+
self.requestAnimationFrame(() => {
|
|
43
|
+
const inlineSize = target.offsetWidth ?? 0;
|
|
44
|
+
if (0 < inlineSize)
|
|
45
|
+
tv?.style?.setProperty?.('--sidebar-toggle-padding-inline-start', `${inlineSize}px`); //$.prop('--sidebar-toggle-padding-inline-start', `${inlineSize}px`, tv) //
|
|
46
|
+
else
|
|
47
|
+
tv?.style?.removeProperty?.('--sidebar-toggle-padding-inline-start'); //$.prop('--sidebar-toggle-padding-inline-start', null, tv) //
|
|
48
|
+
});
|
|
49
|
+
// auto close IF open
|
|
50
|
+
const { container, sideBar } = _a.query(target); //target?.closest('navigation-split-view,tab-view')
|
|
51
|
+
if (!sideBar?.open)
|
|
52
|
+
return;
|
|
53
|
+
self.requestAnimationFrame(() => {
|
|
54
|
+
switch (container?.tagName) {
|
|
55
|
+
case 'NAVIGATION-SPLIT-VIEW':
|
|
56
|
+
if (0 < target.offsetWidth && 0 < target.offsetHeight)
|
|
57
|
+
return;
|
|
58
|
+
break;
|
|
59
|
+
case 'TAB-VIEW':
|
|
60
|
+
// scan all toggles for anyone that is visible, sign that sidebar should stay open
|
|
61
|
+
if ([
|
|
62
|
+
...container.querySelectorAll(':scope > sidebar-toggle,:scope > [is=tab-bar] > sidebar-toggle' //,:scope > [is='sidebar-view'] > tool-bar > sidebar-toggle" ?? FIXME: removed this bc/ inside sidebar!
|
|
63
|
+
),
|
|
64
|
+
].some(({ offsetWidth, offsetHeight }) => 0 < offsetWidth && 0 < offsetHeight))
|
|
65
|
+
return;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
sideBar?.close?.();
|
|
69
|
+
});
|
|
59
70
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
? lm.querySelector('dialog[is="tab-bar"]')
|
|
76
|
-
: lm?.querySelector('dialog[is="sidebar-view"]');
|
|
77
|
-
if (!dialog?.open)
|
|
78
|
-
dialog?.showModal();
|
|
79
|
-
else
|
|
80
|
-
dialog.close();
|
|
81
|
-
};
|
|
71
|
+
#handleClick({ target, type }) {
|
|
72
|
+
if (devFlags.debug)
|
|
73
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
74
|
+
if (!(target instanceof HTMLElement))
|
|
75
|
+
return;
|
|
76
|
+
if (!target?.closest('button'))
|
|
77
|
+
return;
|
|
78
|
+
const { sideBar } = _a.query(target);
|
|
79
|
+
if (!sideBar?.open)
|
|
80
|
+
sideBar?.showModal();
|
|
81
|
+
else
|
|
82
|
+
sideBar.close();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
_a = SidebarToggle;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { DialogBase } from '../
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
2
|
export declare class SidebarView extends DialogBase {
|
|
3
|
+
#private;
|
|
3
4
|
constructor();
|
|
4
|
-
disconnectedCallback(): void;
|
|
5
|
-
connectedCallback(): void;
|
|
6
5
|
static polyfillDisconnectedCallback(el: HTMLDialogElement): void;
|
|
7
6
|
static polyfillConnectedCallback(el: HTMLDialogElement): void;
|
|
8
|
-
static handleClick: (event: Event) => Promise<void>;
|
|
9
7
|
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
3
4
|
export class SidebarView extends DialogBase {
|
|
4
5
|
constructor() {
|
|
5
6
|
super();
|
|
6
7
|
}
|
|
7
|
-
disconnectedCallback() {
|
|
8
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
9
|
-
_a.polyfillDisconnectedCallback(this);
|
|
10
|
-
}
|
|
11
|
-
connectedCallback() {
|
|
12
|
-
_a.polyfillConnectedCallback(this);
|
|
13
|
-
}
|
|
14
8
|
static polyfillDisconnectedCallback(el) {
|
|
15
|
-
el.removeEventListener('click',
|
|
9
|
+
el.removeEventListener('click', SidebarView.#handleClick);
|
|
10
|
+
CleanupRegistry.unregister(el);
|
|
16
11
|
}
|
|
17
12
|
static polyfillConnectedCallback(el) {
|
|
18
|
-
|
|
13
|
+
CleanupRegistry.register(el, onoff('click', SidebarView.#handleClick, el).on());
|
|
14
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
15
|
+
if (!(target instanceof HTMLElement))
|
|
16
|
+
return true;
|
|
17
|
+
if (target.matches('[is=sidebar-view]'))
|
|
18
|
+
return false;
|
|
19
|
+
if (target.closest('tool-bar-item'))
|
|
20
|
+
return false;
|
|
21
|
+
return true;
|
|
22
|
+
}), el).on());
|
|
23
|
+
el.autofocus = true;
|
|
19
24
|
}
|
|
25
|
+
/** Autoclose on click outside. */
|
|
26
|
+
static #handleClick = async ({ target, type }) => {
|
|
27
|
+
if (devFlags.debug)
|
|
28
|
+
console.debug(`${SidebarView.name} ⚡️ ${type}`);
|
|
29
|
+
if (!(target instanceof HTMLElement))
|
|
30
|
+
return;
|
|
31
|
+
if (target instanceof HTMLDialogElement && 'sidebar-view' === target.getAttribute('is'))
|
|
32
|
+
target.close?.();
|
|
33
|
+
};
|
|
20
34
|
}
|
|
21
|
-
_a = SidebarView;
|
|
22
|
-
SidebarView.handleClick = async (event) => {
|
|
23
|
-
if ('DIALOG' === event.target.tagName &&
|
|
24
|
-
'sidebar-view' === event.target.getAttribute('is'))
|
|
25
|
-
event?.target?.close?.();
|
|
26
|
-
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
export class StickyContainer extends HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
if (devFlags.debug)
|
|
9
|
+
console.debug(`${StickyContainer.name} ⚡️ connect`);
|
|
10
|
+
// CleanupRegistry.register(this, onoff('transitionend transitionstart transitioncancel', this.#handleTransitionrun as unknown as EventListener, this).on())
|
|
11
|
+
CleanupRegistry.register(this, onoff('transitionrun', this.#handleTransitionrun, this).on());
|
|
12
|
+
}
|
|
13
|
+
disconnectedCallback() {
|
|
14
|
+
if (devFlags.debug)
|
|
15
|
+
console.debug(`${StickyContainer.name} ⚡️ disconnect`);
|
|
16
|
+
CleanupRegistry.unregister(this);
|
|
17
|
+
}
|
|
18
|
+
#handleTransitionrun = ({ target, propertyName, pseudoElement }) => {
|
|
19
|
+
if (!(target instanceof HTMLElement))
|
|
20
|
+
return;
|
|
21
|
+
if ('--stuck' !== propertyName || '::before' !== pseudoElement || !target.matches('sticky-container'))
|
|
22
|
+
return;
|
|
23
|
+
const stuck = self.getComputedStyle(this, 'before').getPropertyValue('--stuck');
|
|
24
|
+
this.toggleAttribute('stuck', '1' === stuck);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DialogBase } from '../
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A screen that lets users switch between different views using buttons, tabs, or other controls.
|
|
4
|
+
*/
|
|
2
5
|
export declare class TabBar extends DialogBase {
|
|
6
|
+
#private;
|
|
3
7
|
constructor();
|
|
4
|
-
disconnectedCallback(): void;
|
|
5
|
-
connectedCallback(): void;
|
|
6
8
|
static polyfillDisconnectedCallback(el: HTMLDialogElement): void;
|
|
7
9
|
static polyfillConnectedCallback(el: HTMLDialogElement): void;
|
|
8
|
-
static handleClick: (event: Event) => Promise<void>;
|
|
9
10
|
}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
4
|
+
/**
|
|
5
|
+
* @summary A screen that lets users switch between different views using buttons, tabs, or other controls.
|
|
6
|
+
*/
|
|
3
7
|
export class TabBar extends DialogBase {
|
|
4
8
|
constructor() {
|
|
5
9
|
super();
|
|
6
10
|
}
|
|
7
|
-
disconnectedCallback() {
|
|
8
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
9
|
-
_a.polyfillDisconnectedCallback(this);
|
|
10
|
-
}
|
|
11
|
-
connectedCallback() {
|
|
12
|
-
_a.polyfillConnectedCallback(this);
|
|
13
|
-
}
|
|
14
11
|
static polyfillDisconnectedCallback(el) {
|
|
15
|
-
|
|
12
|
+
if (devFlags.debug)
|
|
13
|
+
console.debug(`${TabBar.name} ⚡️ disconnect`);
|
|
14
|
+
el.removeEventListener('click', TabBar.#handleClick);
|
|
15
|
+
CleanupRegistry.unregister(el);
|
|
16
16
|
}
|
|
17
17
|
static polyfillConnectedCallback(el) {
|
|
18
|
-
|
|
18
|
+
if (devFlags.debug)
|
|
19
|
+
console.debug(`${TabBar.name} ⚡️ connect`);
|
|
20
|
+
el.autofocus = true;
|
|
21
|
+
// Snapshot.waitReadyFor(el).then((r) => {
|
|
22
|
+
// if (!r) return
|
|
23
|
+
CleanupRegistry.register(el, onoff('click', TabBar.#handleClick, el).on());
|
|
24
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
25
|
+
if (!(target instanceof HTMLElement))
|
|
26
|
+
return true;
|
|
27
|
+
if (target.matches('[is=tab-bar]'))
|
|
28
|
+
return false;
|
|
29
|
+
if (target.closest('tool-bar-item'))
|
|
30
|
+
return false;
|
|
31
|
+
return true;
|
|
32
|
+
}), el).on());
|
|
33
|
+
// })
|
|
19
34
|
}
|
|
35
|
+
static #handleClick = async ({ target, type }) => {
|
|
36
|
+
if (devFlags.debug)
|
|
37
|
+
console.debug(`${TabBar.name} ⚡️ ${type}`);
|
|
38
|
+
if (!(target instanceof HTMLElement))
|
|
39
|
+
return;
|
|
40
|
+
if (target instanceof HTMLDialogElement && 'tab-bar' === target.getAttribute('is'))
|
|
41
|
+
target.close?.();
|
|
42
|
+
};
|
|
20
43
|
}
|
|
21
|
-
_a = TabBar;
|
|
22
|
-
TabBar.handleClick = async (event) => {
|
|
23
|
-
if ('DIALOG' === event.target.tagName &&
|
|
24
|
-
'tab-bar' === event.target.getAttribute('is'))
|
|
25
|
-
event?.target?.close?.();
|
|
26
|
-
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class TabItem extends ButtonBase {
|
|
2
3
|
#private;
|
|
3
4
|
constructor();
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
static polyfillDisconnectedCallback(btn: HTMLButtonElement): void;
|
|
6
|
+
static polyfillConnectedCallback(btn: TabItem): void;
|
|
6
7
|
}
|
|
@@ -1,35 +1,131 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _a, _TabItem_handleClick;
|
|
7
|
-
export class TabItem extends HTMLElement {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { TabView } from './tab-view';
|
|
5
|
+
export class TabItem extends ButtonBase {
|
|
8
6
|
constructor() {
|
|
9
7
|
super();
|
|
10
|
-
_TabItem_handleClick.set(this, () => {
|
|
11
|
-
console.debug(`${_a.name} ⚡️ click`);
|
|
12
|
-
const tag = this.getAttribute('tag');
|
|
13
|
-
if (!tag)
|
|
14
|
-
throw new DOMException(`Attribute "tag" is set but invalid`, 'InvalidStateError');
|
|
15
|
-
const tv = this.closest('tab-view');
|
|
16
|
-
if (!tv)
|
|
17
|
-
throw new Error('Element not found');
|
|
18
|
-
const newTab = tv?.querySelector(`#${tag}`);
|
|
19
|
-
// 'more' === tag
|
|
20
|
-
// ? tv?.querySelector<HTMLElement>(`tab-view>[is=more]`):
|
|
21
|
-
if (!newTab)
|
|
22
|
-
throw new Error('Element not found');
|
|
23
|
-
tv.selection = newTab;
|
|
24
|
-
});
|
|
25
8
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
static polyfillDisconnectedCallback(btn) {
|
|
10
|
+
if (devFlags.debug)
|
|
11
|
+
console.debug(`${TabItem.name} ⚡️ disconnect`);
|
|
12
|
+
CleanupRegistry.unregister(btn);
|
|
29
13
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
static polyfillConnectedCallback(btn) {
|
|
15
|
+
if (devFlags.debug)
|
|
16
|
+
console.debug(`${TabItem.name} ⚡️ connect`);
|
|
17
|
+
Object.assign(btn, {
|
|
18
|
+
tabIndex: 0,
|
|
19
|
+
ariaSelected: 'false',
|
|
20
|
+
});
|
|
21
|
+
CleanupRegistry.register(btn, onoff('click', TabItem.#handleClick, btn).on());
|
|
22
|
+
const handler1 = TabItem.#handleTabRevealOrSwap.bind(null, btn), handler2 = TabItem.#handleTabMoreStackAllowance.bind(null, btn), tv = btn.closest('tab-view') ?? undefined;
|
|
23
|
+
CleanupRegistry.register(btn, onoff('tabreveal tabswap', handler1, tv).on());
|
|
24
|
+
CleanupRegistry.register(btn, onoff('tab-view:adaptable-tab-bar-placement-change', handler2, tv).on());
|
|
25
|
+
// NOTE: Make sure before invoking props of TAB-VIEW
|
|
26
|
+
self.customElements.whenDefined('tab-view').then(() => {
|
|
27
|
+
if (!btn.isConnected)
|
|
28
|
+
return;
|
|
29
|
+
if (tv?.selectedTab?.map(({ id }) => id)?.includes(btn.value))
|
|
30
|
+
void this.#handleTabRevealOrSwap(btn, new CustomEvent('tabreveal', { detail: { tag: btn.value } }));
|
|
31
|
+
if (tv?.moreTab)
|
|
32
|
+
this.#handleTabMoreStackAllowance(btn, new CustomEvent('tab-view:adaptable-tab-bar-placement-change'));
|
|
33
|
+
});
|
|
33
34
|
}
|
|
35
|
+
static #handleTabMoreStackAllowance = async (btn, evt) => {
|
|
36
|
+
if (devFlags.debug)
|
|
37
|
+
console.debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
38
|
+
const tv = btn.closest('tab-view');
|
|
39
|
+
if (!tv)
|
|
40
|
+
return;
|
|
41
|
+
if (tv.moreTab?.id !== btn.value)
|
|
42
|
+
return;
|
|
43
|
+
btn.hidden = 'bottom-bar' !== tv.tabBarPlacement;
|
|
44
|
+
};
|
|
45
|
+
static #handleTabRevealOrSwap = async (btn, evt) => {
|
|
46
|
+
if (devFlags.debug)
|
|
47
|
+
console.debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
48
|
+
const tv = btn?.closest('tab-view');
|
|
49
|
+
if (!tv)
|
|
50
|
+
return;
|
|
51
|
+
// if (evt.detail?.tag !== btn.value) return
|
|
52
|
+
// await Snapshot.waitReady
|
|
53
|
+
const isSelected = tv.selectedTab.map(({ id }) => id).includes(btn.value); //'tabreveal' === evt?.type
|
|
54
|
+
if (`${isSelected}` !== btn.ariaSelected)
|
|
55
|
+
btn.ariaSelected = `${isSelected}`;
|
|
56
|
+
if (!isSelected)
|
|
57
|
+
return;
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
if (btn.ariaSelected !== 'true' || !btn.isConnected)
|
|
60
|
+
return;
|
|
61
|
+
btn.scrollIntoView({
|
|
62
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
63
|
+
block: 'nearest',
|
|
64
|
+
inline: 'nearest',
|
|
65
|
+
});
|
|
66
|
+
}, 100);
|
|
67
|
+
};
|
|
68
|
+
static #handleClick = async ({ type, currentTarget: btn }) => {
|
|
69
|
+
if (devFlags.debug)
|
|
70
|
+
console.debug(`${TabItem.name} ⚡️ ${type}`);
|
|
71
|
+
if (!(btn instanceof HTMLElement))
|
|
72
|
+
return;
|
|
73
|
+
// const tag = btn.getAttribute('value')
|
|
74
|
+
// if (!tag) return // sidebartoggle > tab-item //throw new DOMException(`Attribute "tag" is set but invalid`, 'InvalidStateError')
|
|
75
|
+
const tv = btn.closest('tab-view');
|
|
76
|
+
if (!tv)
|
|
77
|
+
throw new Error('TabView not found');
|
|
78
|
+
const newTab = tv?.querySelector(`#${btn.getAttribute('value')}`);
|
|
79
|
+
if (!newTab)
|
|
80
|
+
return;
|
|
81
|
+
// console.log(99, TabView.gatherTab(newTab))
|
|
82
|
+
// const possibleParentNs = newTab?.parentElement?.closest<NavigationStack | NavigationSplitView>('navigation-stack,navigation-split-view')
|
|
83
|
+
const tabs = TabView.gatherTab(newTab); //[possibleParentNs, newTab].filter(Boolean) as (NavigationStack | NavigationSplitView)[]
|
|
84
|
+
// if (possibleParentNs) tabs.unshift(possibleParentNs)
|
|
85
|
+
// SECTION: before submitting new tabs, check for tabroot
|
|
86
|
+
// iphone cases:
|
|
87
|
+
// current -> new
|
|
88
|
+
// ns1 -> ns1 tabroot💡ns1 1 1 === ===
|
|
89
|
+
// more -> more tabroot💡more 1 1 === ===
|
|
90
|
+
// ns1 -> more tabroot💡more 1 1 !== ->
|
|
91
|
+
// more,settings -> more tabroot💡more 2 1 !== ↖
|
|
92
|
+
// more,settings -> ns1 2 1 !== <-
|
|
93
|
+
// ns1 -> more tabroot💡more 1 1 !== ->
|
|
94
|
+
// ipad cases:
|
|
95
|
+
// ns1 -> ns1 tabroot💡ns1 1 1 === ===
|
|
96
|
+
// more,settings -> more,settings tabroot💡settings 2 2 === ===
|
|
97
|
+
// more,settings -> more,ns3 2 2 !== <->
|
|
98
|
+
// more,ns3 -> more,settings 2 2 !== <->
|
|
99
|
+
// ns1 -> more,settings 1 2 !== ↘
|
|
100
|
+
const seed1 = tv.selectedTab.map((item) => item.id).join(','), seed2 = tabs.map((item) => item.id).join(',');
|
|
101
|
+
const dir = tv.selectedTab.length < tabs.length
|
|
102
|
+
? '↘'
|
|
103
|
+
: tv.selectedTab.length > tabs.length
|
|
104
|
+
? tv.selectedTab.at(0) === tabs.at(0)
|
|
105
|
+
? '↖'
|
|
106
|
+
: '<-'
|
|
107
|
+
: seed1 === seed2
|
|
108
|
+
? '==='
|
|
109
|
+
: tv.moreTab === tabs.at(-1)
|
|
110
|
+
? '->'
|
|
111
|
+
: '<->';
|
|
112
|
+
if (['===', '↖'].includes(dir)) {
|
|
113
|
+
for (const tab of tabs.reverse())
|
|
114
|
+
if (tv.selectedTab.includes(tab)) {
|
|
115
|
+
const eventType = 'tabroot';
|
|
116
|
+
if (devFlags.debug)
|
|
117
|
+
console.debug(`${TabItem.name} 💡 ${eventType}`);
|
|
118
|
+
tab?.dispatchEvent(new CustomEvent(eventType, { bubbles: true, composed: true }));
|
|
119
|
+
return; // skip rest no selection!
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if ('->' === dir) {
|
|
123
|
+
const eventType = 'tabroot';
|
|
124
|
+
if (devFlags.debug)
|
|
125
|
+
console.debug(`${TabItem.name} 💡 ${eventType}`);
|
|
126
|
+
tabs.at(0)?.dispatchEvent(new CustomEvent(eventType, { bubbles: true, composed: true }));
|
|
127
|
+
}
|
|
128
|
+
// SECTION: finally, submit new tabs
|
|
129
|
+
tv.selectedTab = tabs;
|
|
130
|
+
};
|
|
34
131
|
}
|
|
35
|
-
_a = TabItem, _TabItem_handleClick = new WeakMap();
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
import { type NavigationSplitView } from './navigation-split-view';
|
|
2
|
+
import { type NavigationStack } from './navigation-stack';
|
|
3
|
+
declare const TAB_BAR_PLACEMENTS: readonly ["bottom-bar", "ornament", "sidebar", "top-bar"];
|
|
4
|
+
export type TabBarPlacement = (typeof TAB_BAR_PLACEMENTS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* @fires tabshow A Tab is shown
|
|
7
|
+
* @fires tabhide A Tab is hidden
|
|
8
|
+
* @fires tab-view:toggle
|
|
9
|
+
* @fires tab-view:adaptable-tab-bar-placement-change
|
|
10
|
+
*/
|
|
1
11
|
export declare class TabView extends HTMLElement {
|
|
12
|
+
#private;
|
|
13
|
+
static gatherTab(newTab: NavigationStack | NavigationSplitView): (NavigationStack | NavigationSplitView)[];
|
|
2
14
|
constructor();
|
|
3
15
|
disconnectedCallback(): void;
|
|
16
|
+
get tabBarPlacement(): "bottom-bar" | "ornament" | "sidebar" | "top-bar" | undefined;
|
|
17
|
+
get moreTab(): NavigationStack | null;
|
|
4
18
|
connectedCallback(): void;
|
|
5
|
-
get
|
|
6
|
-
set
|
|
19
|
+
get selectedTab(): (NavigationStack | NavigationSplitView)[];
|
|
20
|
+
set selectedTab(tabs: (NavigationStack | NavigationSplitView)[]);
|
|
7
21
|
}
|
|
22
|
+
export {};
|