@swiftwc/ui 0.0.0-dev.5 → 0.0.0-dev.50
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/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/image-view.d.ts +9 -0
- package/generated/components/image-view.js +46 -0
- package/generated/components/index.d.ts +39 -10
- package/generated/components/index.js +39 -15
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +51 -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-link.d.ts +10 -0
- package/generated/components/navigation-link.js +25 -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 +31 -0
- package/generated/components/picker-view.js +764 -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 +10 -0
- package/generated/components/table-view.js +177 -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 -67
- package/generated/components/v-stack.d.ts +10 -0
- package/generated/components/v-stack.js +19 -0
- package/generated/css/index.css +8475 -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 +143 -23
- package/scss/base/_layout.scss +40 -16
- package/scss/base/_reboot.scss +151 -15
- package/scss/base/_root.scss +348 -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 +143 -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 +235 -7
- package/scss/components/_label-view copy.scss.txt +420 -0
- package/scss/components/_label-view.scss +367 -0
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_labeled-content.scss +9 -0
- package/scss/components/_list-view.scss +269 -0
- package/scss/components/_menu-view.scss +215 -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 +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 +52 -0
- package/scss/components/_table-row.scss +173 -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 +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 +209 -0
- package/web-components.html-data/en.json +576 -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,142 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { $, devFlags, onoff, renderLabel, touchGlass } from '../internal/utils';
|
|
4
|
+
/**
|
|
5
|
+
* @summary A control for presenting a menu of actions.
|
|
6
|
+
*/
|
|
7
|
+
export class MenuView extends HTMLElement {
|
|
8
|
+
static get observedAttributes() {
|
|
9
|
+
return ['open', 'closing', 'label'];
|
|
10
|
+
}
|
|
11
|
+
static #template;
|
|
12
|
+
static get template() {
|
|
13
|
+
return (this.#template ??= $(String.raw `
|
|
14
|
+
<button type="button" part="root button menu-summary">
|
|
15
|
+
<slot name="label"></slot>
|
|
16
|
+
</button>
|
|
17
|
+
<dialog part="root menu-dialog" autofocus inert>
|
|
18
|
+
<form part="root menu-form" method="dialog" novalidate>
|
|
19
|
+
<div part="root menu-scrollable">
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</div>
|
|
22
|
+
</form>
|
|
23
|
+
</dialog>`));
|
|
24
|
+
}
|
|
25
|
+
#shadowRoot;
|
|
26
|
+
#dialog;
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
30
|
+
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
31
|
+
}
|
|
32
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
33
|
+
if (devFlags.debug)
|
|
34
|
+
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
35
|
+
switch (name) {
|
|
36
|
+
case 'open':
|
|
37
|
+
if (!this.#dialog)
|
|
38
|
+
break;
|
|
39
|
+
this.#dialog.inert = null === newValue;
|
|
40
|
+
if (null === newValue && this.#dialog.open) {
|
|
41
|
+
if (devFlags.debug)
|
|
42
|
+
console.debug(`${_a.name} ⚡️ will-close`);
|
|
43
|
+
this.setAttribute('closing', '');
|
|
44
|
+
Promise.allSettled(this.#dialog.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
45
|
+
if (!this.hasAttribute('closing'))
|
|
46
|
+
return;
|
|
47
|
+
this.#dialog?.close();
|
|
48
|
+
this.removeAttribute('closing');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if ('' === newValue && !this.#dialog.open) {
|
|
52
|
+
if (devFlags.debug)
|
|
53
|
+
console.debug(`${_a.name} ⚡️ will-open`);
|
|
54
|
+
this.removeAttribute('closing');
|
|
55
|
+
const form = this.#shadowRoot.querySelector('form');
|
|
56
|
+
form.scrollTop = 0;
|
|
57
|
+
this.#dialog.showModal();
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'label':
|
|
61
|
+
renderLabel(this, ':scope>[slot=label]', `<label-view slot="label"><span></span></label-view>`, newValue);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
disconnectedCallback() {
|
|
66
|
+
if (devFlags.debug)
|
|
67
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
68
|
+
// const dialog = this.#shadowRoot.querySelector('dialog'),
|
|
69
|
+
// trigger = this.#shadowRoot.querySelector('button')
|
|
70
|
+
// trigger?.removeEventListener('click', this.#handleTriggerClick)
|
|
71
|
+
// dialog?.removeEventListener('click', this.#handleDialogClick)
|
|
72
|
+
// dialog?.removeEventListener('close', this.#handleDialogClose)
|
|
73
|
+
// dialog?.removeEventListener('cancel', this.#handleDialogCancel)
|
|
74
|
+
const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
|
|
75
|
+
summaryPart?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, summaryPart)
|
|
76
|
+
dialogPart?.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, dialogPart)
|
|
77
|
+
CleanupRegistry.unregister(this);
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
if (devFlags.debug)
|
|
81
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
82
|
+
this.#dialog = this.#shadowRoot.querySelector('dialog') ?? undefined;
|
|
83
|
+
const trigger = this.#shadowRoot.querySelector('button') ?? undefined;
|
|
84
|
+
CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, trigger).on());
|
|
85
|
+
CleanupRegistry.register(this, onoff([
|
|
86
|
+
{ types: 'click', listener: this.#handleDialogClick },
|
|
87
|
+
{ types: 'close', listener: this.#handleDialogClose },
|
|
88
|
+
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
89
|
+
], this.#dialog).on());
|
|
90
|
+
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, ({ target }) => {
|
|
91
|
+
if (!(target instanceof HTMLElement))
|
|
92
|
+
return true;
|
|
93
|
+
if (target.matches('menu-view'))
|
|
94
|
+
return false;
|
|
95
|
+
if (!target.closest('menu-view[open]'))
|
|
96
|
+
return false;
|
|
97
|
+
return true;
|
|
98
|
+
}), this).on());
|
|
99
|
+
const newAnchorName = `--menu-view-${self.crypto.randomUUID()}`;
|
|
100
|
+
const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
|
|
101
|
+
summaryPart?.style.setProperty('anchor-name', newAnchorName, 'important'); // override unset:all // $.prop('anchor-name', newAnchorName, summaryPart, 'important') //
|
|
102
|
+
dialogPart?.style.setProperty('position-anchor', newAnchorName); // $.prop('position-anchor', newAnchorName, dialogPart) //
|
|
103
|
+
}
|
|
104
|
+
#handleDialogClick = ({ type, target }) => {
|
|
105
|
+
if (devFlags.debug)
|
|
106
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
107
|
+
if (!(target instanceof HTMLElement))
|
|
108
|
+
return;
|
|
109
|
+
if (target.matches('dialog'))
|
|
110
|
+
return this.toggleAttribute('open', false); // click outside
|
|
111
|
+
target.scrollIntoView({
|
|
112
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
113
|
+
block: 'nearest',
|
|
114
|
+
inline: 'nearest',
|
|
115
|
+
});
|
|
116
|
+
if (!target.closest('button'))
|
|
117
|
+
return;
|
|
118
|
+
// TODO: Handle btns this.toggleAttribute('open', false)
|
|
119
|
+
this.toggleAttribute('open', false);
|
|
120
|
+
// event.stopPropagation() //NOTE: add this only if not nested, disposes all nicely if ommited
|
|
121
|
+
};
|
|
122
|
+
#handleTriggerClick = (evt) => {
|
|
123
|
+
if (devFlags.debug)
|
|
124
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
125
|
+
this.toggleAttribute('open', true);
|
|
126
|
+
};
|
|
127
|
+
// intercept to modify open attr
|
|
128
|
+
#handleDialogCancel = (evt) => {
|
|
129
|
+
if (devFlags.debug)
|
|
130
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
131
|
+
if (!evt.cancelable)
|
|
132
|
+
return;
|
|
133
|
+
evt.preventDefault();
|
|
134
|
+
this.toggleAttribute('open', false);
|
|
135
|
+
};
|
|
136
|
+
#handleDialogClose = (evt) => {
|
|
137
|
+
if (devFlags.debug)
|
|
138
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
139
|
+
this.toggleAttribute('open', this.#shadowRoot.querySelector('dialog')?.open ?? false);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
_a = MenuView;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
|
+
import { add, devFlags, frame, onoff, slowHideShow, timeout } from '../internal/utils';
|
|
5
|
+
import { Snapshot } from '../snapshot';
|
|
6
|
+
const observing = new WeakSet();
|
|
7
|
+
function observeResizeEnd(el, callback, stableFrames = 4) {
|
|
8
|
+
let rafId = null;
|
|
9
|
+
let lastRect = el.getBoundingClientRect();
|
|
10
|
+
let stableCount = 0;
|
|
11
|
+
function check() {
|
|
12
|
+
const rect = el.getBoundingClientRect();
|
|
13
|
+
if (rect.width === lastRect.width && rect.height === lastRect.height) {
|
|
14
|
+
stableCount++;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
stableCount = 0;
|
|
18
|
+
lastRect = rect;
|
|
19
|
+
}
|
|
20
|
+
if (stableCount >= stableFrames) {
|
|
21
|
+
rafId = null;
|
|
22
|
+
callback(rect);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
rafId = self.requestAnimationFrame(check);
|
|
26
|
+
}
|
|
27
|
+
const observer = new ResizeObserver(() => {
|
|
28
|
+
stableCount = 0;
|
|
29
|
+
if (rafId === null) {
|
|
30
|
+
lastRect = el.getBoundingClientRect();
|
|
31
|
+
rafId = self.requestAnimationFrame(check);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
observer.observe(el);
|
|
35
|
+
return () => {
|
|
36
|
+
observer.disconnect();
|
|
37
|
+
if (rafId)
|
|
38
|
+
self.cancelAnimationFrame(rafId);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function parseRootMargin(rootMargin = '0px 0px 0px 0px') {
|
|
42
|
+
const parts = rootMargin.split(/\s+/).map((v) => parseInt(v));
|
|
43
|
+
switch (parts.length) {
|
|
44
|
+
case 1:
|
|
45
|
+
return [parts[0], parts[0], parts[0], parts[0]];
|
|
46
|
+
case 2:
|
|
47
|
+
return [parts[0], parts[1], parts[0], parts[1]];
|
|
48
|
+
case 3:
|
|
49
|
+
return [parts[0], parts[1], parts[2], parts[1]];
|
|
50
|
+
case 4:
|
|
51
|
+
return parts;
|
|
52
|
+
default:
|
|
53
|
+
return [0, 0, 0, 0];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function isIntersectingWithContainer(el, container, rootMargin = '0px 0px 0px 0px') {
|
|
57
|
+
if (!(el instanceof Element) || !(container instanceof Element))
|
|
58
|
+
return false;
|
|
59
|
+
const elRect = el.getBoundingClientRect();
|
|
60
|
+
const contRect = container.getBoundingClientRect();
|
|
61
|
+
const [topMargin, rightMargin, bottomMargin, leftMargin] = parseRootMargin(rootMargin);
|
|
62
|
+
const marginRect = {
|
|
63
|
+
top: contRect.top + topMargin,
|
|
64
|
+
right: contRect.right - rightMargin,
|
|
65
|
+
bottom: contRect.bottom - bottomMargin,
|
|
66
|
+
left: contRect.left + leftMargin,
|
|
67
|
+
};
|
|
68
|
+
return !(elRect.bottom < marginRect.top || elRect.top > marginRect.bottom || elRect.right < marginRect.left || elRect.left > marginRect.right);
|
|
69
|
+
}
|
|
70
|
+
export class NavigationLargeTitle extends HTMLElement {
|
|
71
|
+
#styleObserver;
|
|
72
|
+
#scrollObserver;
|
|
73
|
+
#scrollSafetyTimer = timeout();
|
|
74
|
+
#rootMarginTop = '0px';
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
}
|
|
78
|
+
disconnectedCallback() {
|
|
79
|
+
if (devFlags.debug)
|
|
80
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
81
|
+
this.#clearScrollState();
|
|
82
|
+
this.#styleObserver?.disconnect();
|
|
83
|
+
CleanupRegistry.unregister(this);
|
|
84
|
+
}
|
|
85
|
+
connectedCallback() {
|
|
86
|
+
if (devFlags.debug)
|
|
87
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
88
|
+
const root = this.closest('scroll-view') ?? undefined;
|
|
89
|
+
if (!root)
|
|
90
|
+
return;
|
|
91
|
+
if (!root?.hasAttribute('navigation-bar-title-display-mode'))
|
|
92
|
+
root?.setAttribute('navigation-bar-title-display-mode', 'large');
|
|
93
|
+
frame(this).then(() => {
|
|
94
|
+
// if (!r) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
|
|
95
|
+
this.#styleObserver = new CSSStyleObserver();
|
|
96
|
+
this.#styleObserver.observe(this, this.#handleStyleChange);
|
|
97
|
+
Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange)); //Snapshot.waitReady.then(this.#handleStyleChange)
|
|
98
|
+
// this.#observer?.observe(this)
|
|
99
|
+
CleanupRegistry.register(this, onoff([
|
|
100
|
+
{ types: 'scroll', listener: this.#handleScroll, addOptions: { passive: true } },
|
|
101
|
+
{ types: 'scrollend', listener: this.#handleScrollend, addOptions: { passive: true } },
|
|
102
|
+
], root).on());
|
|
103
|
+
observeResizeEnd(root, () => {
|
|
104
|
+
const isIntersecting = isIntersectingWithContainer(this, root, `${this.#rootMarginTop} 0px 0px 0px`);
|
|
105
|
+
this.#applySlowness(root, isIntersecting);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
#handleStyleChange = () => {
|
|
110
|
+
if (devFlags.debug)
|
|
111
|
+
console.debug(`${_a.name} ⚡️ style`);
|
|
112
|
+
const root = this.closest('scroll-view') ?? undefined;
|
|
113
|
+
if (!root)
|
|
114
|
+
return;
|
|
115
|
+
const style = self.getComputedStyle(this);
|
|
116
|
+
const blockSizeProp = style.getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
|
|
117
|
+
blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(style.getPropertyValue('--root-font-size')) || 16 : 1);
|
|
118
|
+
// blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(self.getComputedStyle(document.documentElement).fontSize) : 1)
|
|
119
|
+
const rootMarginTop = `${blockSize}px`;
|
|
120
|
+
if (this.#rootMarginTop === rootMarginTop)
|
|
121
|
+
return;
|
|
122
|
+
this.#rootMarginTop = rootMarginTop;
|
|
123
|
+
// Tear down old observer cleanly before replacing it
|
|
124
|
+
const wasObserving = observing.delete(this);
|
|
125
|
+
this.#scrollObserver?.disconnect();
|
|
126
|
+
this.#scrollObserver = new IntersectionObserver(this.#handleIntersect, {
|
|
127
|
+
root,
|
|
128
|
+
rootMargin: `-${this.#rootMarginTop} 0px 0px 0px`,
|
|
129
|
+
threshold: [0, 1],
|
|
130
|
+
});
|
|
131
|
+
// Re-observe immediately if we were mid-scroll
|
|
132
|
+
if (wasObserving) {
|
|
133
|
+
observing.add(this);
|
|
134
|
+
this.#scrollObserver.observe(this);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
#clearScrollState = () => {
|
|
138
|
+
if (observing.delete(this))
|
|
139
|
+
this.#scrollObserver?.unobserve(this);
|
|
140
|
+
this.#scrollSafetyTimer.cancel();
|
|
141
|
+
};
|
|
142
|
+
#handleScroll = (evt) => {
|
|
143
|
+
if (add(observing, this))
|
|
144
|
+
this.#scrollObserver?.observe(this);
|
|
145
|
+
this.#scrollSafetyTimer.next(() => this.#clearScrollState(), 2000); // reset watchdog every scroll event
|
|
146
|
+
};
|
|
147
|
+
#handleScrollend = (evt) => {
|
|
148
|
+
this.#clearScrollState();
|
|
149
|
+
};
|
|
150
|
+
// #handleResizeend: EventListener = (evt: Event) => {
|
|
151
|
+
// const root = evt.target as HTMLElement
|
|
152
|
+
// const isIntersecting = isIntersectingWithContainer(this, root, `${this.#rootMarginTop} 0px 0px 0px`)
|
|
153
|
+
// this.#applySlowness(root, isIntersecting)
|
|
154
|
+
// }
|
|
155
|
+
#handleIntersect = (entries, { root }) => {
|
|
156
|
+
if (devFlags.debug)
|
|
157
|
+
console.debug(`${_a.name} ⚡️ intersect (${entries?.at(0)?.isIntersecting})`);
|
|
158
|
+
if (!(root instanceof HTMLElement))
|
|
159
|
+
return;
|
|
160
|
+
for (const { isIntersecting } of entries)
|
|
161
|
+
this.#applySlowness(root, isIntersecting);
|
|
162
|
+
// for (const { isIntersecting } of entries) {
|
|
163
|
+
// const value = isIntersecting ? 'large' : 'inline'
|
|
164
|
+
// if (value === root?.getAttribute('navigation-bar-title-display-mode')) continue
|
|
165
|
+
// root?.setAttribute('navigation-bar-title-display-mode', value)
|
|
166
|
+
// if (this.closest('[hidden]')) continue // if (0 === this.offsetHeight + this.offsetWidth) continue
|
|
167
|
+
// if (this.hasAttribute('navigation-bar-auto-hide')) slowHideShow(isIntersecting ? 'show' : 'hide', this)
|
|
168
|
+
// }
|
|
169
|
+
};
|
|
170
|
+
#applySlowness = (root, isIntersecting) => {
|
|
171
|
+
const value = isIntersecting ? 'large' : 'inline';
|
|
172
|
+
if (this.closest('[hidden]'))
|
|
173
|
+
return; // if (0 === this.offsetHeight + this.offsetWidth) continue
|
|
174
|
+
if (value === root?.getAttribute('navigation-bar-title-display-mode'))
|
|
175
|
+
return;
|
|
176
|
+
root?.setAttribute('navigation-bar-title-display-mode', value);
|
|
177
|
+
if (this.hasAttribute('navigation-bar-auto-hide'))
|
|
178
|
+
slowHideShow(isIntersecting ? 'show' : 'hide', this);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
_a = NavigationLargeTitle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A button that controls a navigation presentation.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NavigationLink extends ButtonBase {
|
|
6
|
+
#private;
|
|
7
|
+
constructor();
|
|
8
|
+
static polyfillDisconnectedCallback(el: NavigationLink): void;
|
|
9
|
+
static polyfillConnectedCallback(el: NavigationLink): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
/**
|
|
5
|
+
* @summary A button that controls a navigation presentation.
|
|
6
|
+
*/
|
|
7
|
+
export class NavigationLink extends ButtonBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
static polyfillDisconnectedCallback(el) {
|
|
12
|
+
if (devFlags.debug)
|
|
13
|
+
console.debug(`${NavigationLink.name} ⚡️ disconnect`);
|
|
14
|
+
CleanupRegistry.unregister(el);
|
|
15
|
+
}
|
|
16
|
+
static polyfillConnectedCallback(el) {
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${NavigationLink.name} ⚡️ connect`);
|
|
19
|
+
el.tabIndex = 0;
|
|
20
|
+
CleanupRegistry.register(el, onoff('click', NavigationLink.#handleClick, el).on());
|
|
21
|
+
}
|
|
22
|
+
static #handleClick = async (evt) => {
|
|
23
|
+
// alert(99)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A view with two or three side-by-side sections, where what you choose in the left section changes what appears in the next section.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NavigationSplitView extends NavigationView {
|
|
3
6
|
constructor();
|
|
7
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
4
8
|
disconnectedCallback(): void;
|
|
9
|
+
connectedCallback(): void;
|
|
5
10
|
}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { devFlags } from '../internal/utils';
|
|
3
|
+
/**
|
|
4
|
+
* @summary A view with two or three side-by-side sections, where what you choose in the left section changes what appears in the next section.
|
|
5
|
+
*/
|
|
6
|
+
export class NavigationSplitView extends NavigationView {
|
|
2
7
|
constructor() {
|
|
3
8
|
super();
|
|
4
9
|
}
|
|
10
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
13
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
14
|
+
}
|
|
5
15
|
disconnectedCallback() {
|
|
6
|
-
|
|
16
|
+
if (devFlags.debug)
|
|
17
|
+
console.debug(`${NavigationSplitView.name} ⚡️ disconnect`);
|
|
18
|
+
super.disconnectedCallback();
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
if (devFlags.debug)
|
|
22
|
+
console.debug(`${NavigationSplitView.name} ⚡️ connect`);
|
|
23
|
+
super.connectedCallback();
|
|
7
24
|
}
|
|
8
25
|
}
|
|
9
|
-
NavigationSplitView.observedAttributes = ['hidden'];
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A view that shows a main screen and lets you open other screens on top of it.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NavigationStack extends NavigationView {
|
|
3
6
|
constructor();
|
|
7
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
4
8
|
disconnectedCallback(): void;
|
|
5
9
|
connectedCallback(): void;
|
|
6
10
|
}
|
|
@@ -1,67 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { devFlags } from '../internal/utils';
|
|
3
|
+
/**
|
|
4
|
+
* @summary A view that shows a main screen and lets you open other screens on top of it.
|
|
5
|
+
*/
|
|
6
|
+
export class NavigationStack extends NavigationView {
|
|
2
7
|
constructor() {
|
|
3
8
|
super();
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
requestAnimationFrame(() => (sv.scrollTop = st))
|
|
17
|
-
}) */
|
|
18
|
-
// const template = document.createElement('template')
|
|
19
|
-
// template.innerHTML = this.constructor.#template
|
|
20
|
-
// const template = document.getElementById('element-details-template')
|
|
21
|
-
// // Named slot for toolbar
|
|
22
|
-
// const toolbarSlot = document.createElement('slot');
|
|
23
|
-
// toolbarSlot.name = 'toolbar';
|
|
24
|
-
// // Default slot for everything else
|
|
25
|
-
// const defaultSlot = document.createElement('slot');
|
|
26
|
-
// shadow.appendChild(toolbarSlot);
|
|
27
|
-
// shadow.appendChild(defaultSlot);
|
|
28
|
-
// this.attachShadow({ mode: 'open' }).append(template.content.cloneNode(true))
|
|
29
|
-
////this.constructor.template.content.cloneNode(true)
|
|
30
|
-
// shadowRoot.appendChild(document.importNode(template.content, true))
|
|
31
|
-
// alert(9)
|
|
32
|
-
// const t = this
|
|
9
|
+
}
|
|
10
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${NavigationStack.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
13
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
14
|
+
// Snapshot.waitReady.then(() => {
|
|
15
|
+
switch (name) {
|
|
16
|
+
case 'hidden':
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
// })
|
|
33
20
|
}
|
|
34
21
|
disconnectedCallback() {
|
|
35
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${NavigationStack.name} ⚡️ disconnect`);
|
|
24
|
+
super.disconnectedCallback();
|
|
36
25
|
}
|
|
37
26
|
connectedCallback() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// const toolbarSlot = this.shadowRoot.querySelector('slot[name="toolbar"]');
|
|
42
|
-
// const defaultSlot = this.shadowRoot.querySelector('slot:not([name])');
|
|
43
|
-
// // Get assigned nodes
|
|
44
|
-
// const toolbarNodes = toolbarSlot.assignedNodes({ flatten: true });
|
|
45
|
-
// const defaultNodes = defaultSlot.assignedNodes({ flatten: true });
|
|
46
|
-
// console.log('Toolbar nodes:', toolbarNodes);
|
|
47
|
-
// console.log('Default nodes:', defaultNodes);
|
|
48
|
-
// const starRating = document.getElementById('star-rating-template').content;
|
|
49
|
-
// const shadowRoot = this.attachShadow({
|
|
50
|
-
// mode: 'open'
|
|
51
|
-
// });
|
|
52
|
-
// shadowRoot.appendChild(starRating.cloneNode(true));
|
|
53
|
-
// this.innerHTML = `<div>gh</div><slot name="toolbar"><legend>Rate your experience:</legend></slot>`
|
|
54
|
-
// this.appendChild(slottedToolbar)
|
|
55
|
-
// console.log(99)
|
|
56
|
-
// this.innerHTML = `
|
|
57
|
-
// <header>
|
|
58
|
-
// <label>New</label>
|
|
59
|
-
// </header>
|
|
60
|
-
// <p>
|
|
61
|
-
// <h2>Welcome to the new page!</h2>
|
|
62
|
-
// </p>
|
|
63
|
-
// ${this.innerHTML}
|
|
64
|
-
// `;
|
|
27
|
+
if (devFlags.debug)
|
|
28
|
+
console.debug(`${NavigationStack.name} ⚡️ connect`);
|
|
29
|
+
super.connectedCallback();
|
|
65
30
|
}
|
|
66
31
|
}
|
|
67
|
-
NavigationStack.observedAttributes = ['hidden'];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class NavigationTitle extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
constructor();
|
|
5
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var NavigationTitle_1;
|
|
8
|
+
import { microtaskOnConnected } from '../internal/decorators';
|
|
9
|
+
import { $, devFlags, renderLabel } from '../internal/utils';
|
|
10
|
+
let NavigationTitle = NavigationTitle_1 = class NavigationTitle extends HTMLElement {
|
|
11
|
+
static get observedAttributes() {
|
|
12
|
+
return ['value', 'subtitle'];
|
|
13
|
+
}
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
+
if (devFlags.debug)
|
|
19
|
+
console.debug(`${NavigationTitle_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
20
|
+
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'));
|
|
21
|
+
}
|
|
22
|
+
disconnectedCallback() {
|
|
23
|
+
if (devFlags.debug)
|
|
24
|
+
console.debug(`${NavigationTitle_1.name} ⚡️ disconnect`);
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
if (devFlags.debug)
|
|
28
|
+
console.debug(`${NavigationTitle_1.name} ⚡️ connect`);
|
|
29
|
+
}
|
|
30
|
+
#render = (title, subtitle) => {
|
|
31
|
+
const titleTemplate = `<label-view line-limit="1" truncation-mode="tail" font="headline"><span></span></label-view>`, subtitleTemplate = `<label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout"><span></span></label-view>`, vStactTemplate = `<v-stack spacing="0" alignment="fill">${titleTemplate}${subtitleTemplate}</v-stack>`;
|
|
32
|
+
const el = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(`<navigation-large-title>${vStactTemplate}</navigation-large-title>`, '>1')), vStack = el.querySelector(':scope>v-stack') ?? el.appendChild($(vStactTemplate, '>1'));
|
|
33
|
+
renderLabel(vStack, ':scope>label-view:nth-child(1)', titleTemplate, title);
|
|
34
|
+
renderLabel(vStack, ':scope>label-view:nth-child(2)', subtitleTemplate, subtitle);
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
NavigationTitle = NavigationTitle_1 = __decorate([
|
|
38
|
+
microtaskOnConnected((el) => {
|
|
39
|
+
const sibling = el.closest('scroll-view'), value = el.getAttribute('value'), subtitle = el.getAttribute('subtitle');
|
|
40
|
+
if (null === value)
|
|
41
|
+
sibling?.removeAttribute('navigation-inline-title');
|
|
42
|
+
else
|
|
43
|
+
sibling?.setAttribute('navigation-inline-title', value);
|
|
44
|
+
if (null === subtitle)
|
|
45
|
+
sibling?.removeAttribute('navigation-inline-subtitle');
|
|
46
|
+
else
|
|
47
|
+
sibling?.setAttribute('navigation-inline-subtitle', subtitle);
|
|
48
|
+
})
|
|
49
|
+
], NavigationTitle);
|
|
50
|
+
export { NavigationTitle };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormAssociatedBase } from '../internal/class/form-associated-base';
|
|
2
|
+
declare const pickerStyles: readonly ["menu", "inline", "navigation-link", "sheet", "automatic"];
|
|
3
|
+
export type PickerStyle = (typeof pickerStyles)[number];
|
|
4
|
+
export declare class PickerView extends FormAssociatedBase {
|
|
5
|
+
#private;
|
|
6
|
+
static get ATTR(): {
|
|
7
|
+
PLACEHOLDER: string;
|
|
8
|
+
LABEL: string;
|
|
9
|
+
PICKER_STYLE: string;
|
|
10
|
+
SELECTION: string;
|
|
11
|
+
SEARCHABLE: string;
|
|
12
|
+
CURRENT_VALUE_LABEL: string;
|
|
13
|
+
TRIGGER_HELP: string;
|
|
14
|
+
};
|
|
15
|
+
static get observedAttributes(): string[];
|
|
16
|
+
get selection(): string;
|
|
17
|
+
set selection(v: string);
|
|
18
|
+
get template(): DocumentFragment;
|
|
19
|
+
constructor();
|
|
20
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
connectedCallback(): void;
|
|
23
|
+
get pickerStyle(): PickerStyle;
|
|
24
|
+
get name(): string;
|
|
25
|
+
setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
|
|
26
|
+
setCustomValidity: (message: string) => void;
|
|
27
|
+
formAssociatedCallback: (form: HTMLFormElement) => void;
|
|
28
|
+
formDisabledCallback: (disabled: boolean) => void;
|
|
29
|
+
formResetCallback: () => void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|