@swiftwc/ui 1.0.0-canary.0 → 1.0.0-canary.2
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/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 +30 -0
- package/generated/client/index.js +278 -0
- package/generated/components/alert-dialog.d.ts +11 -0
- package/generated/components/alert-dialog.js +94 -0
- package/generated/components/bordered-button.d.ts +17 -0
- package/generated/components/bordered-button.js +53 -0
- package/generated/components/bordered-prominent-button.d.ts +17 -0
- package/generated/components/bordered-prominent-button.js +53 -0
- package/generated/components/borderless-button.d.ts +17 -0
- package/generated/components/borderless-button.js +53 -0
- package/generated/components/color-scheme.d.ts +12 -0
- package/generated/components/color-scheme.js +51 -0
- package/generated/components/confirmation-dialog.d.ts +12 -0
- package/generated/components/confirmation-dialog.js +108 -0
- package/generated/components/content-unavailable.d.ts +30 -0
- package/generated/components/content-unavailable.js +79 -0
- package/generated/components/content-view.d.ts +13 -0
- package/generated/components/content-view.js +15 -0
- package/generated/components/date-picker.d.ts +52 -0
- package/generated/components/date-picker.js +468 -0
- package/generated/components/detail-placeholder.d.ts +11 -0
- package/generated/components/detail-placeholder.js +15 -0
- package/generated/components/disclosure-group.d.ts +17 -0
- package/generated/components/disclosure-group.js +62 -0
- package/generated/components/fine-tooltip.d.ts +15 -0
- package/generated/components/fine-tooltip.js +108 -0
- package/generated/components/form-view.d.ts +16 -0
- package/generated/components/form-view.js +63 -0
- package/generated/components/glass-button.d.ts +16 -0
- package/generated/components/glass-button.js +50 -0
- package/generated/components/glass-prominent-button.d.ts +16 -0
- package/generated/components/glass-prominent-button.js +50 -0
- package/generated/components/h-divider.d.ts +11 -0
- package/generated/components/h-divider.js +15 -0
- package/generated/components/h-flex-stack.d.ts +16 -0
- package/generated/components/h-flex-stack.js +18 -0
- package/generated/components/h-stack.d.ts +22 -0
- package/generated/components/h-stack.js +24 -0
- package/generated/components/image-view.d.ts +18 -0
- package/generated/components/image-view.js +65 -0
- package/generated/components/index.d.ts +53 -0
- package/generated/components/index.js +53 -0
- package/generated/components/label-view.d.ts +27 -0
- package/generated/components/label-view.js +84 -0
- package/generated/components/labeled-content.d.ts +33 -0
- package/generated/components/labeled-content.js +160 -0
- package/generated/components/list-view.d.ts +19 -0
- package/generated/components/list-view.js +24 -0
- package/generated/components/menu-view.d.ts +20 -0
- package/generated/components/menu-view.js +131 -0
- package/generated/components/navigation-large-title.d.ts +17 -0
- package/generated/components/navigation-large-title.js +183 -0
- package/generated/components/navigation-split-view.d.ts +15 -0
- package/generated/components/navigation-split-view.js +22 -0
- package/generated/components/navigation-stack.d.ts +15 -0
- package/generated/components/navigation-stack.js +26 -0
- package/generated/components/navigation-title.d.ts +18 -0
- package/generated/components/navigation-title.js +69 -0
- package/generated/components/picker-view.d.ts +51 -0
- package/generated/components/picker-view.js +1201 -0
- package/generated/components/plain-button.d.ts +7 -0
- package/generated/components/plain-button.js +20 -0
- package/generated/components/progress-view.d.ts +20 -0
- package/generated/components/progress-view.js +120 -0
- package/generated/components/screen-view.d.ts +5 -0
- package/generated/components/screen-view.js +10 -0
- package/generated/components/scroll-view-proxy.d.ts +13 -0
- package/generated/components/scroll-view-proxy.js +15 -0
- package/generated/components/scroll-view.d.ts +22 -0
- package/generated/components/scroll-view.js +230 -0
- package/generated/components/search-view.d.ts +12 -0
- package/generated/components/search-view.js +24 -0
- package/generated/components/section-view.d.ts +21 -0
- package/generated/components/section-view.js +61 -0
- package/generated/components/sheet-view.d.ts +11 -0
- package/generated/components/sheet-view.js +40 -0
- package/generated/components/sidebar-toggle.d.ts +15 -0
- package/generated/components/sidebar-toggle.js +84 -0
- package/generated/components/sidebar-view.d.ts +10 -0
- package/generated/components/sidebar-view.js +36 -0
- package/generated/components/sticky-container.d.ts +11 -0
- package/generated/components/sticky-container.js +24 -0
- package/generated/components/tab-bar.d.ts +10 -0
- package/generated/components/tab-bar.js +37 -0
- package/generated/components/tab-item.d.ts +10 -0
- package/generated/components/tab-item.js +127 -0
- package/generated/components/tab-view.d.ts +31 -0
- package/generated/components/tab-view.js +194 -0
- package/generated/components/table-view.d.ts +26 -0
- package/generated/components/table-view.js +156 -0
- package/generated/components/text-field.d.ts +42 -0
- package/generated/components/text-field.js +517 -0
- package/generated/components/text-view.d.ts +11 -0
- package/generated/components/text-view.js +16 -0
- package/generated/components/toggle-view.d.ts +43 -0
- package/generated/components/toggle-view.js +366 -0
- package/generated/components/tool-bar-item-group.d.ts +13 -0
- package/generated/components/tool-bar-item-group.js +29 -0
- package/generated/components/tool-bar-item.d.ts +16 -0
- package/generated/components/tool-bar-item.js +66 -0
- package/generated/components/tool-bar.d.ts +26 -0
- package/generated/components/tool-bar.js +92 -0
- package/generated/components/v-divider.d.ts +11 -0
- package/generated/components/v-divider.js +15 -0
- package/generated/components/v-flex-stack.d.ts +16 -0
- package/generated/components/v-flex-stack.js +18 -0
- package/generated/components/v-keyboard.d.ts +20 -0
- package/generated/components/v-keyboard.js +85 -0
- package/generated/components/v-stack.d.ts +25 -0
- package/generated/components/v-stack.js +27 -0
- package/generated/css/index.css +10964 -0
- package/generated/events/alert-dialog.d.ts +13 -0
- package/generated/events/alert-dialog.js +1 -0
- package/generated/events/confirmation-dialog.d.ts +14 -0
- package/generated/events/confirmation-dialog.js +1 -0
- package/generated/events/date-picker.d.ts +13 -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 +18 -0
- package/generated/events/lifecycle-observer.js +1 -0
- package/generated/events/picker-view.d.ts +29 -0
- package/generated/events/picker-view.js +1 -0
- package/generated/events/scroll-view.d.ts +18 -0
- package/generated/events/scroll-view.js +1 -0
- package/generated/events/tab-view.d.ts +54 -0
- package/generated/events/tab-view.js +1 -0
- package/generated/events/text-field.d.ts +13 -0
- package/generated/events/text-field.js +1 -0
- package/generated/events/toggle-view.d.ts +14 -0
- package/generated/events/toggle-view.js +1 -0
- package/generated/i18n/index.d.ts +33 -0
- package/generated/i18n/index.js +164 -0
- package/generated/i18n/locales/el.d.ts +16 -0
- package/generated/i18n/locales/el.js +16 -0
- package/generated/i18n/locales/en.d.ts +16 -0
- package/generated/i18n/locales/en.js +16 -0
- package/generated/i18n/locales/index.d.ts +4 -0
- package/generated/i18n/locales/index.js +4 -0
- package/generated/index.d.ts +2 -0
- package/generated/index.js +3 -0
- package/generated/internal/class/cleanup-registry.d.ts +5 -0
- package/generated/internal/class/cleanup-registry.js +38 -0
- package/generated/internal/class/css-style-observer.d.ts +8 -0
- package/generated/internal/class/css-style-observer.js +25 -0
- package/generated/internal/class/form-associated-base.d.ts +16 -0
- package/generated/internal/class/form-associated-base.js +76 -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 +70 -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 +47 -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/dev-flags.d.ts +4 -0
- package/generated/internal/dev-flags.js +1 -0
- package/generated/internal/privateNamespace.d.ts +14 -0
- package/generated/internal/privateNamespace.js +159 -0
- package/generated/internal/utils/$.d.ts +9 -0
- package/generated/internal/utils/$.js +11 -0
- package/generated/internal/utils/add.d.ts +1 -0
- package/generated/internal/utils/add.js +7 -0
- package/generated/internal/utils/ancestors.d.ts +1 -0
- package/generated/internal/utils/ancestors.js +27 -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 +80 -0
- package/generated/internal/utils/css-time.d.ts +1 -0
- package/generated/internal/utils/css-time.js +3 -0
- package/generated/internal/utils/debounce.d.ts +1 -0
- package/generated/internal/utils/debounce.js +13 -0
- package/generated/internal/utils/debug.d.ts +1 -0
- package/generated/internal/utils/debug.js +4 -0
- package/generated/internal/utils/define-translations.d.ts +1 -0
- package/generated/internal/utils/define-translations.js +3 -0
- package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
- package/generated/internal/utils/ensure-placeholder.js +41 -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 +54 -0
- package/generated/internal/utils/index.js +54 -0
- package/generated/internal/utils/is-inside.d.ts +1 -0
- package/generated/internal/utils/is-inside.js +4 -0
- package/generated/internal/utils/kebab-case.d.ts +1 -0
- package/generated/internal/utils/kebab-case.js +8 -0
- package/generated/internal/utils/list-active.d.ts +7 -0
- package/generated/internal/utils/list-active.js +83 -0
- package/generated/internal/utils/microtask.d.ts +1 -0
- package/generated/internal/utils/microtask.js +3 -0
- package/generated/internal/utils/next-all.d.ts +1 -0
- package/generated/internal/utils/next-all.js +10 -0
- package/generated/internal/utils/next.d.ts +1 -0
- package/generated/internal/utils/next.js +9 -0
- package/generated/internal/utils/onoff.d.ts +45 -0
- package/generated/internal/utils/onoff.js +31 -0
- package/generated/internal/utils/prev-all.d.ts +1 -0
- package/generated/internal/utils/prev-all.js +10 -0
- package/generated/internal/utils/prev.d.ts +1 -0
- package/generated/internal/utils/prev.js +9 -0
- package/generated/internal/utils/prop.d.ts +18 -0
- package/generated/internal/utils/prop.js +30 -0
- package/generated/internal/utils/set.d.ts +1 -0
- package/generated/internal/utils/set.js +7 -0
- package/generated/internal/utils/siblings.d.ts +1 -0
- package/generated/internal/utils/siblings.js +10 -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/internal/vendor/morphdom.d.ts +6 -0
- package/generated/internal/vendor/morphdom.js +720 -0
- package/generated/morphdom/index.d.ts +8 -0
- package/generated/morphdom/index.js +8 -0
- package/generated/morphdom/morph.d.ts +4 -0
- package/generated/morphdom/morph.js +10 -0
- package/generated/morphdom/query-morph.d.ts +5 -0
- package/generated/morphdom/query-morph.js +12 -0
- package/generated/morphdom/render-to-string.d.ts +12 -0
- package/generated/morphdom/render-to-string.js +48 -0
- package/generated/morphdom/unsafe-html.d.ts +2 -0
- package/generated/morphdom/unsafe-html.js +4 -0
- package/generated/namespace-browser/base.d.ts +45 -0
- package/generated/namespace-browser/base.js +115 -0
- package/generated/namespace-browser/event.d.ts +10 -0
- package/generated/namespace-browser/event.js +1 -0
- package/generated/namespace-browser/index.d.ts +7 -0
- package/generated/namespace-browser/index.js +1 -0
- package/generated/snapshot/index.d.ts +9 -0
- package/generated/snapshot/index.js +58 -0
- package/generated/tpl/html.d.ts +5 -0
- package/generated/tpl/html.js +7 -0
- package/generated/tpl/index.d.ts +6 -0
- package/generated/tpl/index.js +6 -0
- package/generated/tpl/is-template-result.d.ts +3 -0
- package/generated/tpl/is-template-result.js +1 -0
- package/generated/tpl/render.d.ts +2 -0
- package/generated/tpl/render.js +132 -0
- package/package.json +19 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default new EventTarget();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default new EventTarget();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as alertDialog } from './alert-dialog';
|
|
2
|
+
export * from './alert-dialog';
|
|
3
|
+
export { default as confirmationDialog } from './confirmation-dialog';
|
|
4
|
+
export * from './confirmation-dialog';
|
|
5
|
+
export { default as lifecycleObserver } from './lifecycle-observer';
|
|
6
|
+
export * from './lifecycle-observer';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as alertDialog } from './alert-dialog';
|
|
2
|
+
export * from './alert-dialog';
|
|
3
|
+
export { default as confirmationDialog } from './confirmation-dialog';
|
|
4
|
+
export * from './confirmation-dialog';
|
|
5
|
+
export { default as lifecycleObserver } from './lifecycle-observer';
|
|
6
|
+
export * from './lifecycle-observer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default new EventTarget();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { lifecycleObserver } from '../buses';
|
|
2
|
+
import { I18n } from '../i18n';
|
|
3
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
4
|
+
import { type NavigationHost, queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
5
|
+
import { type WebComponentCtor } from '../namespace-browser';
|
|
6
|
+
import { Snapshot } from '../snapshot';
|
|
7
|
+
export declare const polyfills: Map<string, WebComponentCtor>;
|
|
8
|
+
/**
|
|
9
|
+
* Presents an alert with a message using the given data to produce the alert’s content and a string variable as a title.
|
|
10
|
+
*/
|
|
11
|
+
export declare const alert: (title?: string, message?: string, actions?: {
|
|
12
|
+
label?: string;
|
|
13
|
+
image?: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
}[], options?: {
|
|
16
|
+
titleVisibility?: boolean;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}) => Promise<string | undefined> & {
|
|
19
|
+
dismiss: (reason?: unknown) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const confirmationDialog: (trigger: HTMLElement, title: string, message?: string, actions?: {
|
|
22
|
+
label?: string;
|
|
23
|
+
image?: string;
|
|
24
|
+
role?: string;
|
|
25
|
+
}[], options?: {
|
|
26
|
+
controller?: AbortController;
|
|
27
|
+
titleVisibility?: boolean;
|
|
28
|
+
}) => Promise<string>;
|
|
29
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
30
|
+
export { type NavigationHost };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { alertDialog, confirmationDialog as confirmationDialogBus, lifecycleObserver } from '../buses';
|
|
2
|
+
import * as Components from '../components';
|
|
3
|
+
import { I18n } from '../i18n';
|
|
4
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
5
|
+
import devFlags from '../internal/dev-flags';
|
|
6
|
+
import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
7
|
+
import { $, debug, kebabCase, onoff } from '../internal/utils';
|
|
8
|
+
import { Snapshot } from '../snapshot';
|
|
9
|
+
import { html, render } from '../tpl';
|
|
10
|
+
debug(devFlags);
|
|
11
|
+
//#region polyfills
|
|
12
|
+
export const polyfills = new Map();
|
|
13
|
+
for (const [k, Ctor] of Object.entries(Components)) {
|
|
14
|
+
const is = kebabCase(k);
|
|
15
|
+
if ('polyfillExtends' in Ctor && 'string' === typeof Ctor.polyfillExtends) {
|
|
16
|
+
if (customElements.get(is))
|
|
17
|
+
continue;
|
|
18
|
+
customElements.define(is, Ctor, { extends: Ctor.polyfillExtends });
|
|
19
|
+
// NOTE: Test via the imperative creation path
|
|
20
|
+
if (!(document.createElement(Ctor.polyfillExtends, { is }) instanceof Ctor))
|
|
21
|
+
polyfills.set(is, Ctor);
|
|
22
|
+
// NOTE: Defensive, test again via the HTML-parsing path
|
|
23
|
+
if (!($(html `<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`, '>1') instanceof Ctor))
|
|
24
|
+
polyfills.set(is, Ctor);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!customElements.get(is))
|
|
28
|
+
customElements.define(is, Ctor);
|
|
29
|
+
}
|
|
30
|
+
debug(polyfills);
|
|
31
|
+
if (0 < polyfills.size) {
|
|
32
|
+
const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
33
|
+
const handlers = new WeakMap();
|
|
34
|
+
const observe = (el, polyfill) => {
|
|
35
|
+
if (!Array.isArray(polyfill.observedAttributes))
|
|
36
|
+
return;
|
|
37
|
+
if (0 === polyfill?.observedAttributes.length)
|
|
38
|
+
return;
|
|
39
|
+
if (!polyfill.polyfillAttributeChangedCallback)
|
|
40
|
+
return;
|
|
41
|
+
const observer = new MutationObserver(polyfill.polyfillAttributeChangedCallback);
|
|
42
|
+
observer.observe(el, {
|
|
43
|
+
attributes: true,
|
|
44
|
+
attributeFilter: polyfill.observedAttributes,
|
|
45
|
+
attributeOldValue: true,
|
|
46
|
+
});
|
|
47
|
+
handlers.set(el, observer);
|
|
48
|
+
for (const attributeName of polyfill.observedAttributes)
|
|
49
|
+
if (el.hasAttribute(attributeName)) {
|
|
50
|
+
const entry = {
|
|
51
|
+
attributeName,
|
|
52
|
+
oldValue: null,
|
|
53
|
+
target: el,
|
|
54
|
+
};
|
|
55
|
+
polyfill.polyfillAttributeChangedCallback([entry]);
|
|
56
|
+
}
|
|
57
|
+
}, unobserve = (el) => {
|
|
58
|
+
handlers.delete(el);
|
|
59
|
+
}, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
|
|
60
|
+
debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
|
|
61
|
+
for (const [is, polyfill] of polyfills)
|
|
62
|
+
for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
|
|
63
|
+
polyfill.polyfillConnectedCallback(el);
|
|
64
|
+
observe(el, polyfill);
|
|
65
|
+
}
|
|
66
|
+
// observer callback
|
|
67
|
+
const observer = new MutationObserver((mutations) => {
|
|
68
|
+
for (const { addedNodes, removedNodes } of mutations) {
|
|
69
|
+
for (const root of addedNodes) {
|
|
70
|
+
if (!(root instanceof HTMLElement))
|
|
71
|
+
continue;
|
|
72
|
+
for (const node of flatten(root)) {
|
|
73
|
+
if (!(node instanceof HTMLElement))
|
|
74
|
+
continue;
|
|
75
|
+
if (!polyfillTagNamesCache.has(node.tagName))
|
|
76
|
+
continue;
|
|
77
|
+
const is = node?.getAttribute('is') ?? '';
|
|
78
|
+
if (!polyfills.has(is))
|
|
79
|
+
continue;
|
|
80
|
+
polyfills.get(is)?.polyfillConnectedCallback(node);
|
|
81
|
+
observe(node, polyfills.get(is));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const root of removedNodes) {
|
|
85
|
+
if (!(root instanceof HTMLElement))
|
|
86
|
+
continue;
|
|
87
|
+
for (const node of flatten(root)) {
|
|
88
|
+
if (!(node instanceof HTMLElement))
|
|
89
|
+
continue;
|
|
90
|
+
if (!polyfillTagNamesCache.has(node.tagName))
|
|
91
|
+
continue;
|
|
92
|
+
const is = node?.getAttribute('is') ?? '';
|
|
93
|
+
if (!polyfills.has(is))
|
|
94
|
+
continue;
|
|
95
|
+
polyfills.get(is)?.polyfillDisconnectedCallback(node);
|
|
96
|
+
unobserve(node);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
observer.observe(document.body, {
|
|
102
|
+
childList: true,
|
|
103
|
+
subtree: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// SECTION: Safari polyfill
|
|
107
|
+
document.addEventListener('touchstart', () => { }, { passive: true });
|
|
108
|
+
//#endregion
|
|
109
|
+
// SECTION
|
|
110
|
+
const handleHelp = ({ target, relatedTarget }) => {
|
|
111
|
+
if (!(target instanceof HTMLElement))
|
|
112
|
+
return;
|
|
113
|
+
const trigger = target.closest('[help]');
|
|
114
|
+
if (!trigger)
|
|
115
|
+
return;
|
|
116
|
+
if (['PICKER-VIEW'].includes(trigger.tagName))
|
|
117
|
+
return;
|
|
118
|
+
if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
|
|
119
|
+
return;
|
|
120
|
+
const newAnchorName = `--help-${self.crypto.randomUUID()}`;
|
|
121
|
+
const tooltip = $(html `<fine-tooltip></fine-tooltip>`, '>1');
|
|
122
|
+
trigger.style.setProperty('anchor-name', newAnchorName);
|
|
123
|
+
tooltip.style.setProperty('position-anchor', newAnchorName);
|
|
124
|
+
document.body.appendChild(tooltip);
|
|
125
|
+
// setInterval(() => {
|
|
126
|
+
// trigger.setAttribute('help', trigger.getAttribute('help') + 'h')
|
|
127
|
+
// }, 2000)
|
|
128
|
+
// console.log(999, trigger)
|
|
129
|
+
}, handleDone = ({ target, relatedTarget }) => {
|
|
130
|
+
if (!(target instanceof HTMLElement))
|
|
131
|
+
return;
|
|
132
|
+
const trigger = target.closest('[help]');
|
|
133
|
+
if (!trigger)
|
|
134
|
+
return;
|
|
135
|
+
if (['PICKER-VIEW'].includes(trigger.tagName))
|
|
136
|
+
return;
|
|
137
|
+
if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
|
|
138
|
+
return;
|
|
139
|
+
const anchorName = trigger.style.anchorName;
|
|
140
|
+
if (!anchorName.startsWith('--help-'))
|
|
141
|
+
return;
|
|
142
|
+
// for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
|
|
143
|
+
// for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
|
|
144
|
+
// return
|
|
145
|
+
// }
|
|
146
|
+
const tooltip = document.querySelector(`[style*="${CSS.escape(anchorName)}"]:not([help])`);
|
|
147
|
+
if (!tooltip)
|
|
148
|
+
return;
|
|
149
|
+
// for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
|
|
150
|
+
// for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
|
|
151
|
+
// return
|
|
152
|
+
// }
|
|
153
|
+
// trigger.style.removeProperty('anchor-name')
|
|
154
|
+
tooltip.hidePopover(); // tooltip.remove?.()
|
|
155
|
+
};
|
|
156
|
+
const mediaQueryList = self.matchMedia(`(pointer: fine)`);
|
|
157
|
+
mediaQueryList.addEventListener('change', ({ matches }) => {
|
|
158
|
+
for (const [k, v] of [
|
|
159
|
+
['pointerover', handleHelp],
|
|
160
|
+
['pointerout', handleDone],
|
|
161
|
+
])
|
|
162
|
+
document.removeEventListener(k, v);
|
|
163
|
+
if (matches)
|
|
164
|
+
for (const [k, v] of [
|
|
165
|
+
['pointerover', handleHelp],
|
|
166
|
+
['pointerout', handleDone],
|
|
167
|
+
])
|
|
168
|
+
document.addEventListener(k, v, { passive: true });
|
|
169
|
+
});
|
|
170
|
+
if (mediaQueryList.matches)
|
|
171
|
+
for (const [k, v] of [
|
|
172
|
+
['pointerover', handleHelp],
|
|
173
|
+
['pointerout', handleDone],
|
|
174
|
+
])
|
|
175
|
+
document.addEventListener(k, v, { passive: true });
|
|
176
|
+
//#region fns
|
|
177
|
+
// const a = alert('Saving…', 'Please wait')
|
|
178
|
+
// // later, e.g. save completed early
|
|
179
|
+
// a.dismiss() // silently resolves undefined, closes+removes dialog
|
|
180
|
+
// // or
|
|
181
|
+
// a.dismiss(new Error('cancelled')) // rejects instead
|
|
182
|
+
// const result = await a // still works normally if not dismissed
|
|
183
|
+
// const ac = new AbortController()
|
|
184
|
+
// const a = alert('Uploading…', 'Please wait', undefined, { signal: ac.signal })
|
|
185
|
+
// // elsewhere, e.g. upload finished before the user dismissed
|
|
186
|
+
// ac.abort() // dialog closes silently, a rejects with AbortError
|
|
187
|
+
// // or still works standalone
|
|
188
|
+
// a.dismiss() // same effect, no signal needed
|
|
189
|
+
/**
|
|
190
|
+
* Presents an alert with a message using the given data to produce the alert’s content and a string variable as a title.
|
|
191
|
+
*/
|
|
192
|
+
export const alert = (title, message, actions, options) => {
|
|
193
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
194
|
+
let dialog;
|
|
195
|
+
let off;
|
|
196
|
+
const dismiss = (reason) => {
|
|
197
|
+
off?.();
|
|
198
|
+
dialog?.close();
|
|
199
|
+
// dialog?.remove()
|
|
200
|
+
reason === undefined ? resolve(undefined) : reject(reason instanceof Error ? reason : new DOMException('Alert dismissed', 'AbortError'));
|
|
201
|
+
};
|
|
202
|
+
if (options?.signal)
|
|
203
|
+
if (options.signal.aborted)
|
|
204
|
+
dismiss(options.signal.reason); // already aborted before we even started — settle immediately, skip showing anything
|
|
205
|
+
else
|
|
206
|
+
options.signal.addEventListener('abort', () => dismiss(options.signal.reason), { once: true });
|
|
207
|
+
navigator.locks
|
|
208
|
+
.request('alert:', async () => {
|
|
209
|
+
if (options?.signal?.aborted)
|
|
210
|
+
return; // in case it was aborted while queued behind another lock holder
|
|
211
|
+
const mount = document.createElement('div');
|
|
212
|
+
render(html `<dialog is="alert-dialog">
|
|
213
|
+
<v-stack spacing="1" alignment="fill">
|
|
214
|
+
${title ? html `<label-view font="headline" title="${title}"></label-view>` : null}
|
|
215
|
+
${message ? html `<label-view foreground="secondary" font="callout" title="${message}"></label-view>` : null}
|
|
216
|
+
</v-stack>
|
|
217
|
+
${(actions ?? [{ role: 'close' }]).map((action, index) => html `
|
|
218
|
+
<button type="button" tabindex="0" is="bordered-button" value="${index}" role="${action.role ?? null}">
|
|
219
|
+
${action.label || action.image ? html `<label-view title="${action.label ?? null}" system-image="${action.image ?? null}"></label-view>` : null}
|
|
220
|
+
</button>
|
|
221
|
+
`)}
|
|
222
|
+
</dialog>`, mount);
|
|
223
|
+
dialog = mount.firstElementChild;
|
|
224
|
+
document.body.insertAdjacentElement('beforeend', dialog);
|
|
225
|
+
dialog.showModal();
|
|
226
|
+
off = onoff('alert:return', (evt) => {
|
|
227
|
+
const { detail } = evt;
|
|
228
|
+
off?.();
|
|
229
|
+
resolve(detail.returnValue);
|
|
230
|
+
}, alertDialog, { once: true }).on();
|
|
231
|
+
return promise;
|
|
232
|
+
})
|
|
233
|
+
.catch(() => { });
|
|
234
|
+
return Object.assign(promise, { dismiss });
|
|
235
|
+
};
|
|
236
|
+
export const confirmationDialog = async (trigger, title, message, actions, options) => {
|
|
237
|
+
const newAnchorName = `--confirmation-dialog-${self.crypto.randomUUID()}`;
|
|
238
|
+
const dialog = $(html `<dialog is="confirmation-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(html `<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
|
|
239
|
+
trigger.style.setProperty('anchor-name', newAnchorName, 'important'); //$.prop('anchor-name', newAnchorName, trigger, 'important')
|
|
240
|
+
dialog.style.setProperty('position-anchor', newAnchorName); //$.prop('position-anchor', newAnchorName, dialog)
|
|
241
|
+
if (title && false !== options?.titleVisibility) {
|
|
242
|
+
const label = $(html `<label-view font="headline"></label-view>`, '>1');
|
|
243
|
+
label.setAttribute('title', title);
|
|
244
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
245
|
+
}
|
|
246
|
+
if (message && false !== options?.titleVisibility) {
|
|
247
|
+
const label = $(html `<label-view foreground="secondary" font="callout"></label-view>`, '>1');
|
|
248
|
+
label.setAttribute('title', message);
|
|
249
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
250
|
+
}
|
|
251
|
+
for (const [index, action] of (actions ?? []).entries()) {
|
|
252
|
+
const btn = $(html `<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
|
|
253
|
+
btn.setAttribute('value', `${index}`);
|
|
254
|
+
if (action?.role)
|
|
255
|
+
btn.setAttribute('role', action.role);
|
|
256
|
+
if (action.label || action.image) {
|
|
257
|
+
const label = $(html `<label-view></label-view>`, '>1');
|
|
258
|
+
if (action.label)
|
|
259
|
+
label.setAttribute('title', action.label);
|
|
260
|
+
if (action.image)
|
|
261
|
+
label.setAttribute('system-image', action.image);
|
|
262
|
+
btn.appendChild(label);
|
|
263
|
+
}
|
|
264
|
+
dialog.insertAdjacentElement('beforeend', btn);
|
|
265
|
+
}
|
|
266
|
+
trigger.closest('content-view,dialog')?.insertAdjacentElement('beforeend', dialog); // dialog.showModal()
|
|
267
|
+
const { promise, resolve } = Promise.withResolvers(), off = onoff('confirmation:return', (evt) => {
|
|
268
|
+
const { detail } = evt;
|
|
269
|
+
off();
|
|
270
|
+
resolve(detail.returnValue);
|
|
271
|
+
}, confirmationDialogBus, { once: true }).on();
|
|
272
|
+
return promise;
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
void Snapshot.waitReady;
|
|
276
|
+
//#region exports
|
|
277
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
278
|
+
//#endregion
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A dialog that shows a message. Use it from the client module like `void alert('Save failed.')`.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AlertDialog extends DialogBase {
|
|
6
|
+
#private;
|
|
7
|
+
constructor();
|
|
8
|
+
static polyfillDisconnectedCallback(el: AlertDialog): void;
|
|
9
|
+
static polyfillConnectedCallback(el: AlertDialog): void;
|
|
10
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { alertDialog } from '../buses';
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { debug, onoff, touchGlass } from '../internal/utils';
|
|
4
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A dialog that shows a message. Use it from the client module like `void alert('Save failed.')`.
|
|
7
|
+
*/
|
|
8
|
+
export class AlertDialog extends DialogBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
12
|
+
static polyfillDisconnectedCallback(el) {
|
|
13
|
+
debug(`${AlertDialog.name} ⚡️ disconnect`);
|
|
14
|
+
CleanupRegistry.unregister(el);
|
|
15
|
+
alertDialog.dispatchEvent(new CustomEvent('alert:return', {
|
|
16
|
+
detail: { returnValue: el.returnValue },
|
|
17
|
+
bubbles: true,
|
|
18
|
+
composed: true,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
static polyfillConnectedCallback(el) {
|
|
22
|
+
debug(`${AlertDialog.name} ⚡️ connect`);
|
|
23
|
+
CleanupRegistry.register(el, onoff([
|
|
24
|
+
{ types: 'click', listener: this.#handleDialogClick },
|
|
25
|
+
{ types: 'close', listener: this.#handleDialogClose },
|
|
26
|
+
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
27
|
+
], el).on());
|
|
28
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
29
|
+
if (!(target instanceof HTMLElement))
|
|
30
|
+
return true;
|
|
31
|
+
if (target.matches('[is=alert-dialog]'))
|
|
32
|
+
return false;
|
|
33
|
+
return true;
|
|
34
|
+
}), el).on());
|
|
35
|
+
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
|
+
debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
44
|
+
switch (attributeName) {
|
|
45
|
+
case 'label':
|
|
46
|
+
//
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static #handleDialogClick = (evt) => {
|
|
51
|
+
debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
52
|
+
const { target, currentTarget: dialog } = evt;
|
|
53
|
+
if (!(dialog instanceof HTMLDialogElement))
|
|
54
|
+
return;
|
|
55
|
+
if (!(target instanceof HTMLElement))
|
|
56
|
+
return;
|
|
57
|
+
const button = target.closest('button');
|
|
58
|
+
if (!button)
|
|
59
|
+
return;
|
|
60
|
+
button.scrollIntoView({
|
|
61
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
62
|
+
block: 'nearest',
|
|
63
|
+
inline: 'nearest',
|
|
64
|
+
});
|
|
65
|
+
dialog.returnValue = button.value;
|
|
66
|
+
dialog.requestClose(button.value);
|
|
67
|
+
evt.stopPropagation();
|
|
68
|
+
evt.stopImmediatePropagation();
|
|
69
|
+
};
|
|
70
|
+
static #handleDialogCancel = (evt) => {
|
|
71
|
+
debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
72
|
+
if (!evt.cancelable)
|
|
73
|
+
return;
|
|
74
|
+
const { target } = evt;
|
|
75
|
+
if (!(target instanceof HTMLDialogElement))
|
|
76
|
+
return;
|
|
77
|
+
evt.preventDefault();
|
|
78
|
+
target.inert = true;
|
|
79
|
+
debug(`${AlertDialog.name} ⚡️ will-close`);
|
|
80
|
+
target.setAttribute('closing', '');
|
|
81
|
+
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
82
|
+
if (!target.hasAttribute('closing'))
|
|
83
|
+
return;
|
|
84
|
+
target?.close(target?.returnValue);
|
|
85
|
+
target.removeAttribute('closing');
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
89
|
+
debug(`${AlertDialog.name} ⚡️ ${type}`);
|
|
90
|
+
if (!(target instanceof HTMLDialogElement))
|
|
91
|
+
return;
|
|
92
|
+
target.remove();
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A control that starts an action. Styled with a standard border, adapting to the button’s surroundings.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a bordered 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,53 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A control that starts an action. Styled with a standard border, adapting to the button’s surroundings.
|
|
7
|
+
*
|
|
8
|
+
* @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a bordered 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
|
+
debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
29
|
+
CleanupRegistry.unregister(el);
|
|
30
|
+
}
|
|
31
|
+
static polyfillConnectedCallback(el) {
|
|
32
|
+
debug(`${BorderedButton.name} ⚡️ connect`);
|
|
33
|
+
el.tabIndex = 0;
|
|
34
|
+
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
35
|
+
}
|
|
36
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
37
|
+
debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
38
|
+
const node = target instanceof HTMLButtonElement;
|
|
39
|
+
if (!node)
|
|
40
|
+
return;
|
|
41
|
+
switch (attributeName) {
|
|
42
|
+
case 'title-key':
|
|
43
|
+
case 'role':
|
|
44
|
+
Snapshot.waitReady.then(() => {
|
|
45
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
|
|
46
|
+
});
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static #handleClick = async (evt) => {
|
|
51
|
+
//
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A control that starts an action. Styled with a prominent border, adapting to the button’s surroundings.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a prominent bordered 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,53 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A control that starts an action. Styled with a prominent border, adapting to the button’s surroundings.
|
|
7
|
+
*
|
|
8
|
+
* @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a prominent bordered 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
|
+
debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
29
|
+
CleanupRegistry.unregister(el);
|
|
30
|
+
}
|
|
31
|
+
static polyfillConnectedCallback(el) {
|
|
32
|
+
debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
33
|
+
el.tabIndex = 0;
|
|
34
|
+
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
35
|
+
}
|
|
36
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
37
|
+
debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
38
|
+
const node = target instanceof HTMLButtonElement;
|
|
39
|
+
if (!node)
|
|
40
|
+
return;
|
|
41
|
+
switch (attributeName) {
|
|
42
|
+
case 'title-key':
|
|
43
|
+
case 'role':
|
|
44
|
+
Snapshot.waitReady.then(() => {
|
|
45
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
|
|
46
|
+
});
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static #handleClick = async (evt) => {
|
|
51
|
+
//
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A control that starts an action. Styled without any borders.
|
|
4
|
+
*
|
|
5
|
+
* @example <button is="borderless-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Use the `is` attribute to style a `button` as a `borderless-button`
|
|
6
|
+
*
|
|
7
|
+
* @slot overlay
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class BorderlessButton extends ButtonBase {
|
|
11
|
+
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
constructor();
|
|
14
|
+
static polyfillDisconnectedCallback(el: BorderlessButton): void;
|
|
15
|
+
static polyfillConnectedCallback(el: BorderlessButton): void;
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
17
|
+
}
|