@swiftwc/ui 0.0.0-dev.7 → 0.0.0-dev.71
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 +25 -4
- package/generated/client/index.js +234 -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 +16 -0
- package/generated/components/h-stack.js +25 -0
- package/generated/components/image-view.d.ts +9 -0
- package/generated/components/image-view.js +46 -0
- package/generated/components/index.d.ts +42 -10
- package/generated/components/index.js +42 -15
- package/generated/components/label-view.d.ts +14 -0
- package/generated/components/label-view.js +56 -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 +55 -0
- package/generated/components/picker-view.js +1132 -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/toggle-view.d.ts +28 -0
- package/generated/components/toggle-view.js +222 -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 +19 -0
- package/generated/components/v-stack.js +28 -0
- package/generated/css/index.css +8966 -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 +9 -0
- package/generated/events/index.js +9 -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/events/toggle-view.d.ts +9 -0
- package/generated/events/toggle-view.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/generated/tpl/html.d.ts +5 -0
- package/generated/tpl/html.js +3 -0
- package/generated/tpl/index.d.ts +4 -0
- package/generated/tpl/index.js +4 -0
- package/generated/tpl/render.d.ts +2 -0
- package/generated/tpl/render.js +131 -0
- package/package.json +34 -9
- package/scss/_components.scss +62 -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 +843 -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 +45 -0
- package/scss/components/_image-view.scss +9 -0
- package/scss/components/_index.scss +243 -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 +223 -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 +322 -0
- package/scss/components/_plain-button.scss +18 -0
- package/scss/components/_progress-view.scss +98 -0
- package/scss/components/_scroll-view-proxy.scss +81 -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 +120 -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 +215 -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 +57 -0
- package/scss/components/_toggle-view.scss +79 -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 +123 -60
- 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 +461 -0
- package/scss/placeholders/_buttons.scss +117 -0
- package/scss/placeholders/_lists.scss +596 -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 +28 -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 +83 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +225 -0
- package/web-components.html-data/en.json +950 -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,99 @@
|
|
|
1
|
+
import { alertDialog } from '../buses';
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { devFlags, onoff, touchGlass } from '../internal/utils';
|
|
4
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
5
|
+
export class AlertDialog extends DialogBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
static polyfillDisconnectedCallback(el) {
|
|
10
|
+
if (devFlags.debug)
|
|
11
|
+
console.debug(`${AlertDialog.name} ⚡️ disconnect`);
|
|
12
|
+
CleanupRegistry.unregister(el);
|
|
13
|
+
alertDialog.dispatchEvent(new CustomEvent('alert:return', {
|
|
14
|
+
detail: { returnValue: el.returnValue },
|
|
15
|
+
bubbles: true,
|
|
16
|
+
composed: true,
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
static polyfillConnectedCallback(el) {
|
|
20
|
+
if (devFlags.debug)
|
|
21
|
+
console.debug(`${AlertDialog.name} ⚡️ connect`);
|
|
22
|
+
CleanupRegistry.register(el, onoff([
|
|
23
|
+
{ types: 'click', listener: this.#handleDialogClick },
|
|
24
|
+
{ types: 'close', listener: this.#handleDialogClose },
|
|
25
|
+
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
26
|
+
], el).on());
|
|
27
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
28
|
+
if (!(target instanceof HTMLElement))
|
|
29
|
+
return true;
|
|
30
|
+
if (target.matches('[is=alert-dialog]'))
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}), el).on());
|
|
34
|
+
if (devFlags.debug)
|
|
35
|
+
console.debug(`${AlertDialog.name} ⚡️ will-open`);
|
|
36
|
+
el.removeAttribute('closing');
|
|
37
|
+
el.scrollTop = 0;
|
|
38
|
+
el.returnValue = '';
|
|
39
|
+
el.autofocus = true;
|
|
40
|
+
el.showModal();
|
|
41
|
+
}
|
|
42
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
43
|
+
if (devFlags.debug)
|
|
44
|
+
console.debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
45
|
+
switch (attributeName) {
|
|
46
|
+
case 'label':
|
|
47
|
+
//
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
static #handleDialogClick = (evt) => {
|
|
52
|
+
if (devFlags.debug)
|
|
53
|
+
console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
54
|
+
const { target, currentTarget: dialog } = evt;
|
|
55
|
+
if (!(dialog instanceof HTMLDialogElement))
|
|
56
|
+
return;
|
|
57
|
+
if (!(target instanceof HTMLElement))
|
|
58
|
+
return;
|
|
59
|
+
const button = target.closest('button');
|
|
60
|
+
if (!button)
|
|
61
|
+
return;
|
|
62
|
+
button.scrollIntoView({
|
|
63
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
64
|
+
block: 'nearest',
|
|
65
|
+
inline: 'nearest',
|
|
66
|
+
});
|
|
67
|
+
dialog.returnValue = button.value;
|
|
68
|
+
dialog.requestClose(button.value);
|
|
69
|
+
evt.stopPropagation();
|
|
70
|
+
evt.stopImmediatePropagation();
|
|
71
|
+
};
|
|
72
|
+
static #handleDialogCancel = (evt) => {
|
|
73
|
+
if (devFlags.debug)
|
|
74
|
+
console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
75
|
+
if (!evt.cancelable)
|
|
76
|
+
return;
|
|
77
|
+
const { target } = evt;
|
|
78
|
+
if (!(target instanceof HTMLDialogElement))
|
|
79
|
+
return;
|
|
80
|
+
evt.preventDefault();
|
|
81
|
+
target.inert = true;
|
|
82
|
+
if (devFlags.debug)
|
|
83
|
+
console.debug(`${AlertDialog.name} ⚡️ will-close`);
|
|
84
|
+
target.setAttribute('closing', '');
|
|
85
|
+
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
86
|
+
if (!target.hasAttribute('closing'))
|
|
87
|
+
return;
|
|
88
|
+
target?.close(target?.returnValue);
|
|
89
|
+
target.removeAttribute('closing');
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
93
|
+
if (devFlags.debug)
|
|
94
|
+
console.debug(`${AlertDialog.name} ⚡️ ${type}`);
|
|
95
|
+
if (!(target instanceof HTMLDialogElement))
|
|
96
|
+
return;
|
|
97
|
+
target.remove();
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
1
2
|
export class BodyView extends HTMLElement {
|
|
2
3
|
constructor() {
|
|
3
4
|
super();
|
|
4
5
|
}
|
|
5
6
|
disconnectedCallback() {
|
|
6
|
-
|
|
7
|
+
if (devFlags.debug)
|
|
8
|
+
console.debug(`${BodyView.name} ⚡️ disconnect`);
|
|
7
9
|
}
|
|
8
10
|
connectedCallback() {
|
|
9
|
-
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${BodyView.name} ⚡️ connect`);
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A button that applies standard border artwork based on the button’s context.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
6
|
+
*
|
|
7
|
+
* @slot overlay
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class BorderedButton extends ButtonBase {
|
|
11
|
+
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
constructor();
|
|
14
|
+
static polyfillDisconnectedCallback(el: BorderedButton): void;
|
|
15
|
+
static polyfillConnectedCallback(el: BorderedButton): void;
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A button that applies standard border artwork based on the button’s context.
|
|
7
|
+
*
|
|
8
|
+
* @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
9
|
+
*
|
|
10
|
+
* @slot overlay
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export class BorderedButton extends ButtonBase {
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
/**
|
|
17
|
+
* A value that describes the purpose of a button
|
|
18
|
+
* @type {destructive|confirm}
|
|
19
|
+
*/
|
|
20
|
+
'role',
|
|
21
|
+
'title-key',
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
static polyfillDisconnectedCallback(el) {
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
30
|
+
CleanupRegistry.unregister(el);
|
|
31
|
+
}
|
|
32
|
+
static polyfillConnectedCallback(el) {
|
|
33
|
+
if (devFlags.debug)
|
|
34
|
+
console.debug(`${BorderedButton.name} ⚡️ connect`);
|
|
35
|
+
el.tabIndex = 0;
|
|
36
|
+
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
37
|
+
}
|
|
38
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
39
|
+
if (devFlags.debug)
|
|
40
|
+
console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
41
|
+
const node = target instanceof HTMLButtonElement;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
switch (attributeName) {
|
|
45
|
+
case 'title-key':
|
|
46
|
+
case 'role':
|
|
47
|
+
Snapshot.waitReady.then(() => {
|
|
48
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
static #handleClick = async (evt) => {
|
|
54
|
+
//
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A button that applies standard border prominent artwork based on the button’s context.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
6
|
+
*
|
|
7
|
+
* @slot overlay
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class BorderedProminentButton extends ButtonBase {
|
|
11
|
+
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
constructor();
|
|
14
|
+
static polyfillDisconnectedCallback(el: BorderedProminentButton): void;
|
|
15
|
+
static polyfillConnectedCallback(el: BorderedProminentButton): void;
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A button that applies standard border prominent artwork based on the button’s context.
|
|
7
|
+
*
|
|
8
|
+
* @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
9
|
+
*
|
|
10
|
+
* @slot overlay
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export class BorderedProminentButton extends ButtonBase {
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
/**
|
|
17
|
+
* A value that describes the purpose of a button
|
|
18
|
+
* @type {destructive|confirm}
|
|
19
|
+
*/
|
|
20
|
+
'role',
|
|
21
|
+
'title-key',
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
static polyfillDisconnectedCallback(el) {
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
30
|
+
CleanupRegistry.unregister(el);
|
|
31
|
+
}
|
|
32
|
+
static polyfillConnectedCallback(el) {
|
|
33
|
+
if (devFlags.debug)
|
|
34
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
35
|
+
el.tabIndex = 0;
|
|
36
|
+
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
37
|
+
}
|
|
38
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
39
|
+
if (devFlags.debug)
|
|
40
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
41
|
+
const node = target instanceof HTMLButtonElement;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
switch (attributeName) {
|
|
45
|
+
case 'title-key':
|
|
46
|
+
case 'role':
|
|
47
|
+
Snapshot.waitReady.then(() => {
|
|
48
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
static #handleClick = async (evt) => {
|
|
54
|
+
//
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { ButtonBase } from '../
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A button that doesn’t apply a border.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="borderless-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
6
|
+
*
|
|
7
|
+
* @slot overlay
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
2
10
|
export declare class BorderlessButton extends ButtonBase {
|
|
11
|
+
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
3
13
|
constructor();
|
|
4
|
-
disconnectedCallback(): void;
|
|
5
|
-
connectedCallback(): void;
|
|
6
14
|
static polyfillDisconnectedCallback(el: BorderlessButton): void;
|
|
7
15
|
static polyfillConnectedCallback(el: BorderlessButton): void;
|
|
8
|
-
static
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
9
17
|
}
|
|
@@ -1,25 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A button that doesn’t apply a border.
|
|
7
|
+
*
|
|
8
|
+
* @example <button is="borderless-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button>
|
|
9
|
+
*
|
|
10
|
+
* @slot overlay
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
3
13
|
export class BorderlessButton extends ButtonBase {
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
/**
|
|
17
|
+
* A value that describes the purpose of a button
|
|
18
|
+
* @type {destructive|confirm}
|
|
19
|
+
*/
|
|
20
|
+
'role',
|
|
21
|
+
'title-key',
|
|
22
|
+
];
|
|
23
|
+
}
|
|
4
24
|
constructor() {
|
|
5
25
|
super();
|
|
6
26
|
}
|
|
7
|
-
disconnectedCallback() {
|
|
8
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
9
|
-
_a.polyfillDisconnectedCallback(this);
|
|
10
|
-
}
|
|
11
|
-
connectedCallback() {
|
|
12
|
-
console.debug(`${_a.name} ⚡️ connect`);
|
|
13
|
-
_a.polyfillConnectedCallback(this);
|
|
14
|
-
}
|
|
15
27
|
static polyfillDisconnectedCallback(el) {
|
|
16
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
30
|
+
CleanupRegistry.unregister(el);
|
|
17
31
|
}
|
|
18
32
|
static polyfillConnectedCallback(el) {
|
|
19
|
-
|
|
33
|
+
if (devFlags.debug)
|
|
34
|
+
console.debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
35
|
+
el.tabIndex = 0;
|
|
36
|
+
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
37
|
+
}
|
|
38
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
39
|
+
if (devFlags.debug)
|
|
40
|
+
console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
41
|
+
const node = target instanceof HTMLButtonElement;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
switch (attributeName) {
|
|
45
|
+
case 'title-key':
|
|
46
|
+
case 'role':
|
|
47
|
+
Snapshot.waitReady.then(() => {
|
|
48
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
20
52
|
}
|
|
53
|
+
static #handleClick = async (evt) => {
|
|
54
|
+
// alert(99)
|
|
55
|
+
};
|
|
21
56
|
}
|
|
22
|
-
_a = BorderlessButton;
|
|
23
|
-
BorderlessButton.handleClick = async (event) => {
|
|
24
|
-
alert(99);
|
|
25
|
-
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class ColorScheme extends HTMLElement {
|
|
2
|
+
static get observedAttributes(): string[];
|
|
3
|
+
constructor();
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
2
|
+
export class ColorScheme extends HTMLElement {
|
|
3
|
+
static get observedAttributes() {
|
|
4
|
+
return ['dark'];
|
|
5
|
+
}
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
if (devFlags.debug)
|
|
11
|
+
console.debug(`${ColorScheme.name} ⚡️ connect`);
|
|
12
|
+
this.hidden = true;
|
|
13
|
+
this.inert = true;
|
|
14
|
+
}
|
|
15
|
+
disconnectedCallback() {
|
|
16
|
+
if (devFlags.debug)
|
|
17
|
+
console.debug(`${ColorScheme.name} ⚡️ disconnect`);
|
|
18
|
+
}
|
|
19
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
20
|
+
if (devFlags.debug)
|
|
21
|
+
console.debug(`${ColorScheme.name} ⚡️ attr-change [${name}]`);
|
|
22
|
+
// self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
|
|
23
|
+
if (newValue)
|
|
24
|
+
self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
|
|
25
|
+
// @property --canvas {
|
|
26
|
+
// syntax: "<color>";
|
|
27
|
+
// initial-value: oklch(100% 0 0deg);
|
|
28
|
+
// inherits: false;
|
|
29
|
+
// }
|
|
30
|
+
// @media (prefers-color-scheme: dark) {
|
|
31
|
+
// @property --canvas {
|
|
32
|
+
// syntax: "<color>";
|
|
33
|
+
// initial-value: oklch(0% 0 0deg);
|
|
34
|
+
// inherits: false;
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
// @property --canvastext {
|
|
38
|
+
// syntax: "<color>";
|
|
39
|
+
// initial-value: oklch(0% 0 0deg);
|
|
40
|
+
// inherits: false;
|
|
41
|
+
// }
|
|
42
|
+
// @media (prefers-color-scheme: dark) {
|
|
43
|
+
// @property --canvastext {
|
|
44
|
+
// syntax: "<color>";
|
|
45
|
+
// initial-value: oklch(100% 0 0deg);
|
|
46
|
+
// inherits: false;
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// if (CSS.supports('interpolate-size', 'allow-keywords')) {
|
|
50
|
+
// self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
|
|
51
|
+
if (null !== newValue)
|
|
52
|
+
self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class ConfirmationDialog extends DialogBase {
|
|
3
|
+
#private;
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
constructor();
|
|
6
|
+
static polyfillDisconnectedCallback(el: ConfirmationDialog): void;
|
|
7
|
+
static polyfillConnectedCallback(el: ConfirmationDialog): void;
|
|
8
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { confirmationDialog } from '../buses';
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { devFlags, isInside, onoff, touchGlass } from '../internal/utils';
|
|
4
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
5
|
+
export class ConfirmationDialog extends DialogBase {
|
|
6
|
+
static get observedAttributes() {
|
|
7
|
+
return ['anchor'];
|
|
8
|
+
}
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
12
|
+
static polyfillDisconnectedCallback(el) {
|
|
13
|
+
if (devFlags.debug)
|
|
14
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
|
|
15
|
+
const positionAnchor = el.style.getPropertyValue('position-anchor');
|
|
16
|
+
document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
|
|
17
|
+
el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
|
|
18
|
+
CleanupRegistry.unregister(el);
|
|
19
|
+
confirmationDialog.dispatchEvent(new CustomEvent('confirmation:return', {
|
|
20
|
+
detail: { returnValue: el.returnValue, positionAnchor },
|
|
21
|
+
bubbles: true,
|
|
22
|
+
composed: true,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
static polyfillConnectedCallback(el) {
|
|
26
|
+
if (devFlags.debug)
|
|
27
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ connect`);
|
|
28
|
+
CleanupRegistry.register(el, onoff([
|
|
29
|
+
{ types: 'click', listener: this.#handleDialogClick },
|
|
30
|
+
{ types: 'close', listener: this.#handleDialogClose },
|
|
31
|
+
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
32
|
+
], el).on());
|
|
33
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
34
|
+
if (!(target instanceof HTMLElement))
|
|
35
|
+
return true;
|
|
36
|
+
if (target.matches('[is=confirmation-dialog]'))
|
|
37
|
+
return false;
|
|
38
|
+
// if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
|
|
39
|
+
return true;
|
|
40
|
+
}), el).on());
|
|
41
|
+
if (devFlags.debug)
|
|
42
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ will-open`);
|
|
43
|
+
el.removeAttribute('closing');
|
|
44
|
+
el.scrollTop = 0;
|
|
45
|
+
el.returnValue = '';
|
|
46
|
+
el.autofocus = true;
|
|
47
|
+
el.showModal();
|
|
48
|
+
}
|
|
49
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
50
|
+
if (devFlags.debug)
|
|
51
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
52
|
+
// const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
|
|
53
|
+
switch (attributeName) {
|
|
54
|
+
case 'label':
|
|
55
|
+
// let label = this.querySelector(':scope>[slot=label]')
|
|
56
|
+
// if (newValue) {
|
|
57
|
+
// label ??= this.appendChild($(`<label-view slot="label"></label-view>`))
|
|
58
|
+
// label.setAttribute('title', newValue)
|
|
59
|
+
// } else label?.remove()
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
static #handleDialogClick = (evt) => {
|
|
64
|
+
if (devFlags.debug)
|
|
65
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
66
|
+
const { target, currentTarget: dialog } = evt;
|
|
67
|
+
if (!(dialog instanceof HTMLDialogElement))
|
|
68
|
+
return;
|
|
69
|
+
if (!(target instanceof HTMLElement))
|
|
70
|
+
return;
|
|
71
|
+
if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
|
|
72
|
+
return dialog.requestClose(); // click outside
|
|
73
|
+
const button = target.closest('button');
|
|
74
|
+
if (!button)
|
|
75
|
+
return;
|
|
76
|
+
button.scrollIntoView({
|
|
77
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
78
|
+
block: 'nearest',
|
|
79
|
+
inline: 'nearest',
|
|
80
|
+
});
|
|
81
|
+
dialog.returnValue = button.value;
|
|
82
|
+
dialog.requestClose(button.value);
|
|
83
|
+
evt.stopPropagation();
|
|
84
|
+
evt.stopImmediatePropagation();
|
|
85
|
+
};
|
|
86
|
+
static #handleDialogCancel = (evt) => {
|
|
87
|
+
if (devFlags.debug)
|
|
88
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
89
|
+
if (!evt.cancelable)
|
|
90
|
+
return;
|
|
91
|
+
const { target } = evt;
|
|
92
|
+
if (!(target instanceof HTMLDialogElement))
|
|
93
|
+
return;
|
|
94
|
+
evt.preventDefault();
|
|
95
|
+
target.inert = true;
|
|
96
|
+
if (devFlags.debug)
|
|
97
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ will-close`);
|
|
98
|
+
target.setAttribute('closing', '');
|
|
99
|
+
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
100
|
+
if (!target.hasAttribute('closing'))
|
|
101
|
+
return;
|
|
102
|
+
target?.close(target?.returnValue);
|
|
103
|
+
target.removeAttribute('closing');
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
107
|
+
if (devFlags.debug)
|
|
108
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
|
|
109
|
+
if (!(target instanceof HTMLDialogElement))
|
|
110
|
+
return;
|
|
111
|
+
target.remove();
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
3
|
+
*
|
|
4
|
+
* @example <content-unavailable-view search></content-unavailable-view>
|
|
5
|
+
*
|
|
6
|
+
* @example <content-unavailable-view search="foo"></content-unavailable-view>
|
|
7
|
+
*
|
|
8
|
+
* @example <content-unavailable-view padding><label-view title="No Mail"><i class="ph ph-tray" slot="icon" foreground="secondary"></i></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable-view>
|
|
9
|
+
*
|
|
10
|
+
* @example <content-unavailable-view padding><label-view title="No Mail"><svg slot="icon" foreground="secondary" ...>...</svg></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable-view>
|
|
11
|
+
*
|
|
12
|
+
* @slot description
|
|
13
|
+
* @slot actions
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare class ContentUnavailableView extends HTMLElement {
|
|
17
|
+
#private;
|
|
18
|
+
static get observedAttributes(): string[];
|
|
19
|
+
static get template(): DocumentFragment;
|
|
20
|
+
constructor();
|
|
21
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { I18n } from '../i18n';
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { $, devFlags, onoff } from '../internal/utils';
|
|
4
|
+
/**
|
|
5
|
+
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
6
|
+
*
|
|
7
|
+
* @example <content-unavailable-view search></content-unavailable-view>
|
|
8
|
+
*
|
|
9
|
+
* @example <content-unavailable-view search="foo"></content-unavailable-view>
|
|
10
|
+
*
|
|
11
|
+
* @example <content-unavailable-view padding><label-view title="No Mail"><i class="ph ph-tray" slot="icon" foreground="secondary"></i></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable-view>
|
|
12
|
+
*
|
|
13
|
+
* @example <content-unavailable-view padding><label-view title="No Mail"><svg slot="icon" foreground="secondary" ...>...</svg></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable-view>
|
|
14
|
+
*
|
|
15
|
+
* @slot description
|
|
16
|
+
* @slot actions
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export class ContentUnavailableView extends HTMLElement {
|
|
20
|
+
static get observedAttributes() {
|
|
21
|
+
return ['search'];
|
|
22
|
+
}
|
|
23
|
+
static #template;
|
|
24
|
+
static get template() {
|
|
25
|
+
return (this.#template ??= $(String.raw `
|
|
26
|
+
<div part="root content-unavailable-title-stack">
|
|
27
|
+
<slot></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<div part="root content-unavailable-description-stack">
|
|
30
|
+
<slot name="description"></slot>
|
|
31
|
+
</div>
|
|
32
|
+
<div part="root content-unavailable-actions-stack">
|
|
33
|
+
<slot name="actions"></slot>
|
|
34
|
+
</div>`));
|
|
35
|
+
}
|
|
36
|
+
#shadowRoot;
|
|
37
|
+
#slots;
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
41
|
+
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
42
|
+
this.#slots = {
|
|
43
|
+
'': this.#shadowRoot.querySelector('slot:not([name])') ?? undefined,
|
|
44
|
+
description: this.#shadowRoot.querySelector('slot[name="description"]') ?? undefined,
|
|
45
|
+
actions: this.#shadowRoot.querySelector('slot[name="actions"]') ?? undefined,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
49
|
+
if (devFlags.debug)
|
|
50
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
51
|
+
switch (name) {
|
|
52
|
+
case 'search':
|
|
53
|
+
if (oldValue === newValue)
|
|
54
|
+
break;
|
|
55
|
+
this.#renderSearch(newValue);
|
|
56
|
+
CleanupRegistry.unregister(this, 'i18n');
|
|
57
|
+
CleanupRegistry.register(this, onoff('localechange', () => {
|
|
58
|
+
this.#renderSearch(this.getAttribute('search'));
|
|
59
|
+
}, I18n.on).on(), 'i18n');
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
if (devFlags.debug)
|
|
65
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
if (devFlags.debug)
|
|
69
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ connect`);
|
|
70
|
+
}
|
|
71
|
+
#renderSearch = (search) => {
|
|
72
|
+
const titleLabel = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(`<label-view><i class="ph ph-magnifying-glass" slot="icon" foreground="secondary"></i></label-view>`, '>1')), descText = this.querySelector(':scope>[slot=description]') ?? this.appendChild($(`<label-view foreground="secondary" slot="description"></label-view>`, '>1'));
|
|
73
|
+
if (search) {
|
|
74
|
+
const interpolate = (text, vars) => text.replaceAll(/\{(\w+)\}/g, (_, key) => vars[key] ?? '');
|
|
75
|
+
titleLabel.setAttribute('title', interpolate(I18n.t('SearchUnavailableContent').Label, { search }));
|
|
76
|
+
}
|
|
77
|
+
else
|
|
78
|
+
titleLabel?.setAttribute('title', I18n.t('SearchUnavailableContent').NoLabel);
|
|
79
|
+
descText.setAttribute('title', I18n.t('SearchUnavailableContent').Description);
|
|
80
|
+
};
|
|
81
|
+
}
|