@swiftwc/ui 0.0.0-dev.4 → 0.0.0-dev.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/generated/buses/alert-dialog.d.ts +2 -0
- package/generated/buses/alert-dialog.js +1 -0
- package/generated/buses/confirmation-dialog.d.ts +2 -0
- package/generated/buses/confirmation-dialog.js +1 -0
- package/generated/buses/index.d.ts +6 -0
- package/generated/buses/index.js +6 -0
- package/generated/buses/lifecycle-observer.d.ts +2 -0
- package/generated/buses/lifecycle-observer.js +1 -0
- package/generated/client/index.d.ts +24 -0
- package/generated/client/index.js +272 -0
- package/generated/components/alert-dialog.d.ts +8 -0
- package/generated/components/alert-dialog.js +99 -0
- package/generated/components/body-view.d.ts +5 -0
- package/generated/components/body-view.js +14 -0
- package/generated/components/bordered-button.d.ts +13 -0
- package/generated/components/bordered-button.js +45 -0
- package/generated/components/bordered-prominent-button.d.ts +13 -0
- package/generated/components/bordered-prominent-button.js +45 -0
- package/generated/components/borderless-button.d.ts +13 -0
- package/generated/components/borderless-button.js +45 -0
- package/generated/components/confirmation-dialog.d.ts +9 -0
- package/generated/components/confirmation-dialog.js +113 -0
- package/generated/components/content-unavailable-view.d.ts +24 -0
- package/generated/components/content-unavailable-view.js +81 -0
- package/generated/components/date-picker.d.ts +36 -0
- package/generated/components/date-picker.js +468 -0
- package/generated/components/disclosure-group.d.ts +9 -0
- package/generated/components/disclosure-group.js +58 -0
- package/generated/components/fine-tooltip.d.ts +7 -0
- package/generated/components/fine-tooltip.js +107 -0
- package/generated/components/form-view.d.ts +6 -0
- package/generated/components/form-view.js +60 -0
- package/generated/components/glass-button.d.ts +12 -0
- package/generated/components/glass-button.js +42 -0
- package/generated/components/glass-prominent-button.d.ts +12 -0
- package/generated/components/glass-prominent-button.js +42 -0
- package/generated/components/index.d.ts +42 -0
- package/generated/components/index.js +42 -0
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +59 -0
- package/generated/components/list-view.d.ts +5 -0
- package/generated/components/list-view.js +29 -0
- package/generated/components/menu-view.d.ts +9 -0
- package/generated/components/menu-view.js +145 -0
- package/generated/components/navigation-large-title.d.ts +6 -0
- package/generated/components/navigation-large-title.js +181 -0
- package/generated/components/navigation-split-view.d.ts +10 -0
- package/generated/components/navigation-split-view.js +25 -0
- package/generated/components/navigation-stack.d.ts +10 -0
- package/generated/components/navigation-stack.js +31 -0
- package/generated/components/navigation-title.d.ts +8 -0
- package/generated/components/navigation-title.js +52 -0
- package/generated/components/picker-view.d.ts +28 -0
- package/generated/components/picker-view.js +681 -0
- package/generated/components/plain-button.d.ts +7 -0
- package/generated/components/plain-button.js +22 -0
- package/generated/components/progress-view.d.ts +13 -0
- package/generated/components/progress-view.js +125 -0
- package/generated/components/screen-view.d.ts +5 -0
- package/generated/components/screen-view.js +11 -0
- package/generated/components/scroll-view-proxy.d.ts +8 -0
- package/generated/components/scroll-view-proxy.js +17 -0
- package/generated/components/scroll-view.d.ts +10 -0
- package/generated/components/scroll-view.js +202 -0
- package/generated/components/search-view.d.ts +8 -0
- package/generated/components/search-view.js +30 -0
- package/generated/components/section-view.d.ts +9 -0
- package/generated/components/section-view.js +83 -0
- package/generated/components/sheet-view.d.ts +8 -0
- package/generated/components/sheet-view.js +62 -0
- package/generated/components/sidebar-toggle.d.ts +7 -0
- package/generated/components/sidebar-toggle.js +85 -0
- package/generated/components/sidebar-view.d.ts +7 -0
- package/generated/components/sidebar-view.js +34 -0
- package/generated/components/sticky-container.d.ts +6 -0
- package/generated/components/sticky-container.js +26 -0
- package/generated/components/tab-bar.d.ts +10 -0
- package/generated/components/tab-bar.js +43 -0
- package/generated/components/tab-item.d.ts +7 -0
- package/generated/components/tab-item.js +132 -0
- package/generated/components/tab-view.d.ts +22 -0
- package/generated/components/tab-view.js +264 -0
- package/generated/components/table-view.d.ts +7 -0
- package/generated/components/table-view.js +174 -0
- package/generated/components/text-field.d.ts +29 -0
- package/generated/components/text-field.js +503 -0
- package/generated/components/tool-bar-item-group.d.ts +5 -0
- package/generated/components/tool-bar-item-group.js +28 -0
- package/generated/components/tool-bar-item.d.ts +8 -0
- package/generated/components/tool-bar-item.js +66 -0
- package/generated/components/tool-bar.d.ts +19 -0
- package/generated/components/tool-bar.js +93 -0
- package/generated/components/v-keyboard.d.ts +15 -0
- package/generated/components/v-keyboard.js +89 -0
- package/generated/components/v-stack.d.ts +10 -0
- package/generated/components/v-stack.js +19 -0
- package/generated/css/index.css +8089 -0
- package/generated/events/alert-dialog.d.ts +8 -0
- package/generated/events/alert-dialog.js +1 -0
- package/generated/events/confirmation-dialog.d.ts +9 -0
- package/generated/events/confirmation-dialog.js +1 -0
- package/generated/events/date-picker.d.ts +8 -0
- package/generated/events/date-picker.js +1 -0
- package/generated/events/index.d.ts +8 -0
- package/generated/events/index.js +8 -0
- package/generated/events/lifecycle-observer.d.ts +10 -0
- package/generated/events/lifecycle-observer.js +1 -0
- package/generated/events/picker-view.d.ts +15 -0
- package/generated/events/picker-view.js +1 -0
- package/generated/events/scroll-view.d.ts +10 -0
- package/generated/events/scroll-view.js +1 -0
- package/generated/events/tab-view.d.ts +28 -0
- package/generated/events/tab-view.js +1 -0
- package/generated/events/text-field.d.ts +8 -0
- package/generated/events/text-field.js +1 -0
- package/generated/i18n/index.d.ts +34 -0
- package/generated/i18n/index.js +167 -0
- package/generated/i18n/locales/el.d.ts +16 -0
- package/generated/i18n/locales/el.js +16 -0
- package/generated/i18n/locales/en.d.ts +16 -0
- package/generated/i18n/locales/en.js +16 -0
- package/generated/i18n/locales/index.d.ts +4 -0
- package/generated/i18n/locales/index.js +4 -0
- package/generated/index.d.ts +2 -0
- package/generated/index.js +3 -0
- package/generated/internal/class/cleanup-registry.d.ts +5 -0
- package/generated/internal/class/cleanup-registry.js +38 -0
- package/generated/internal/class/css-style-observer.d.ts +8 -0
- package/generated/internal/class/css-style-observer.js +26 -0
- package/generated/internal/class/form-associated-base.d.ts +16 -0
- package/generated/internal/class/form-associated-base.js +78 -0
- package/generated/internal/class/mutation-observer-set.d.ts +9 -0
- package/generated/internal/class/mutation-observer-set.js +42 -0
- package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
- package/generated/internal/class/mutation-observer-singleton.js +64 -0
- package/generated/internal/class/navigation-path.d.ts +15 -0
- package/generated/internal/class/navigation-path.js +84 -0
- package/generated/internal/class/navigation-view.d.ts +8 -0
- package/generated/internal/class/navigation-view.js +79 -0
- package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
- package/generated/internal/class/resize-observer-singleton.js +22 -0
- package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
- package/generated/internal/decorators/adaptive-slot.js +50 -0
- package/generated/internal/decorators/custom-element.d.ts +5 -0
- package/generated/internal/decorators/custom-element.js +5 -0
- package/generated/internal/decorators/index.d.ts +4 -0
- package/generated/internal/decorators/index.js +4 -0
- package/generated/internal/privateNamespace.d.ts +14 -0
- package/generated/internal/privateNamespace.js +168 -0
- package/generated/internal/utils/add.d.ts +1 -0
- package/generated/internal/utils/add.js +7 -0
- package/generated/internal/utils/cash/ancestors.d.ts +1 -0
- package/generated/internal/utils/cash/ancestors.js +27 -0
- package/generated/internal/utils/cash/index.d.ts +23 -0
- package/generated/internal/utils/cash/index.js +25 -0
- package/generated/internal/utils/cash/next-all.d.ts +1 -0
- package/generated/internal/utils/cash/next-all.js +10 -0
- package/generated/internal/utils/cash/next.d.ts +1 -0
- package/generated/internal/utils/cash/next.js +9 -0
- package/generated/internal/utils/cash/prev-all.d.ts +1 -0
- package/generated/internal/utils/cash/prev-all.js +10 -0
- package/generated/internal/utils/cash/prev.d.ts +1 -0
- package/generated/internal/utils/cash/prev.js +9 -0
- package/generated/internal/utils/cash/prop.d.ts +18 -0
- package/generated/internal/utils/cash/prop.js +30 -0
- package/generated/internal/utils/cash/siblings.d.ts +1 -0
- package/generated/internal/utils/cash/siblings.js +10 -0
- package/generated/internal/utils/clamp.d.ts +1 -0
- package/generated/internal/utils/clamp.js +4 -0
- package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
- package/generated/internal/utils/compare-big-decimals.js +90 -0
- package/generated/internal/utils/css-time.d.ts +1 -0
- package/generated/internal/utils/css-time.js +3 -0
- package/generated/internal/utils/debounce.d.ts +1 -0
- package/generated/internal/utils/debounce.js +13 -0
- package/generated/internal/utils/dev-flags.d.ts +3 -0
- package/generated/internal/utils/dev-flags.js +5 -0
- package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
- package/generated/internal/utils/ensure-placeholder.js +55 -0
- package/generated/internal/utils/frame.d.ts +1 -0
- package/generated/internal/utils/frame.js +6 -0
- package/generated/internal/utils/index.d.ts +19 -0
- package/generated/internal/utils/index.js +22 -0
- package/generated/internal/utils/is-inside.d.ts +1 -0
- package/generated/internal/utils/is-inside.js +4 -0
- package/generated/internal/utils/kebab-case.d.ts +1 -0
- package/generated/internal/utils/kebab-case.js +11 -0
- package/generated/internal/utils/list-active.d.ts +7 -0
- package/generated/internal/utils/list-active.js +83 -0
- package/generated/internal/utils/microtask.d.ts +1 -0
- package/generated/internal/utils/microtask.js +3 -0
- package/generated/internal/utils/onoff.d.ts +45 -0
- package/generated/internal/utils/onoff.js +31 -0
- package/generated/internal/utils/set.d.ts +1 -0
- package/generated/internal/utils/set.js +7 -0
- package/generated/internal/utils/sleep.d.ts +1 -0
- package/generated/internal/utils/sleep.js +3 -0
- package/generated/internal/utils/slow-hide-show.d.ts +1 -0
- package/generated/internal/utils/slow-hide-show.js +16 -0
- package/generated/internal/utils/timeout.d.ts +5 -0
- package/generated/internal/utils/timeout.js +16 -0
- package/generated/internal/utils/touch-glass.d.ts +7 -0
- package/generated/internal/utils/touch-glass.js +19 -0
- package/generated/namespace-browser/base.d.ts +45 -0
- package/generated/namespace-browser/base.js +115 -0
- package/generated/namespace-browser/index.d.ts +7 -0
- package/generated/namespace-browser/index.js +1 -0
- package/generated/snapshot/index.d.ts +9 -0
- package/generated/snapshot/index.js +60 -0
- package/package.json +35 -11
- package/scss/_components.scss +59 -14
- package/scss/_final.scss +1 -0
- package/scss/_functions.scss +10 -0
- package/scss/_mixins.scss +4 -169
- package/scss/_placeholders.scss +3 -0
- package/scss/_transitions.scss +22 -1
- package/scss/_utils.scss +9 -0
- package/scss/_vars.scss +142 -23
- package/scss/base/_layout.scss +31 -16
- package/scss/base/_reboot.scss +151 -15
- package/scss/base/_root.scss +355 -25
- package/scss/colors/_index.scss +672 -70
- package/scss/components/_alert-dialog.scss +111 -0
- package/scss/components/_body-view.scss +12 -3
- package/scss/components/_bordered-button.scss +57 -0
- package/scss/components/_bordered-prominent-button.scss +63 -0
- package/scss/components/_borderless-button.scss +36 -6
- package/scss/components/_confirmation-dialog.scss +84 -0
- package/scss/components/_content-unavailable-view.scss +45 -0
- package/scss/components/_date-picker.scss +30 -0
- package/scss/components/_detail-placeholder.scss +153 -0
- package/scss/components/_disclosure-group.scss +146 -51
- package/scss/components/_fine-tooltip.scss +82 -0
- package/scss/components/_form-view.scss +195 -0
- package/scss/components/_full-screen.scss +7 -5
- package/scss/components/_glass-button.scss +59 -0
- package/scss/components/_glass-prominent-button.scss +68 -0
- package/scss/components/_h-divider.scss +13 -0
- package/scss/components/_h-flex-stack.scss +23 -0
- package/scss/components/_h-stack.scss +29 -0
- package/scss/components/_index.scss +234 -7
- package/scss/components/_label-view copy.scss.txt +420 -0
- package/scss/components/_label-view.scss +355 -0
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_labeled-content.scss +9 -0
- package/scss/components/_list-view.scss +229 -0
- package/scss/components/_menu-view.scss +211 -0
- package/scss/components/_navigation-large-title.scss +27 -0
- package/scss/components/_navigation-split-view.scss +329 -269
- package/scss/components/_navigation-stack.scss +6 -6
- package/scss/components/_navigation-title.scss +10 -0
- package/scss/components/_picker-view.scss +131 -0
- package/scss/components/_plain-button.scss +18 -0
- package/scss/components/_progress-view.scss +98 -0
- package/scss/components/_scroll-view-proxy.scss +79 -0
- package/scss/components/_scroll-view-toolbars.scss +126 -0
- package/scss/components/_scroll-view.scss +114 -66
- package/scss/components/_search-view.scss +18 -0
- package/scss/components/_section-view.scss +119 -0
- package/scss/components/_sheet-view.scss +78 -35
- package/scss/components/_sidebar-toggle.scss +87 -27
- package/scss/components/_sidebar-view.scss +30 -40
- package/scss/components/_sticky-container.scss +42 -0
- package/scss/components/_tab-bar.scss +207 -84
- package/scss/components/_tab-item.scss +25 -0
- package/scss/components/_tab-view.scss +270 -126
- package/scss/components/_table-column.scss +52 -0
- package/scss/components/_table-row.scss +172 -0
- package/scss/components/_table-view.scss +223 -0
- package/scss/components/_text-field.scss +37 -0
- package/scss/components/_tool-bar-item-group.scss +30 -19
- package/scss/components/_tool-bar-item.scss +81 -71
- package/scss/components/_tool-bar.scss +126 -63
- package/scss/components/_v-divider.scss +13 -0
- package/scss/components/_v-flex-stack.scss +29 -0
- package/scss/components/_v-keyboard.scss +6 -4
- package/scss/components/_v-stack.scss +15 -9
- package/scss/final/_touch-glass.scss +91 -0
- package/scss/index.scss +6 -2
- package/scss/mixins/_button.scss +44 -0
- package/scss/mixins/_color.scss +16 -0
- package/scss/mixins/_dialog.scss +89 -0
- package/scss/mixins/_index.scss +422 -0
- package/scss/placeholders/_buttons.scss +117 -0
- package/scss/placeholders/_lists.scss +571 -0
- package/scss/transitions/_alert-dialog.scss +18 -0
- package/scss/transitions/_bwd.navbar.scss +3 -13
- package/scss/transitions/_bwd.scss +4 -20
- package/scss/transitions/_confirmation-dialog.scss +22 -0
- package/scss/transitions/_disclosure-group.scss +35 -0
- package/scss/transitions/_fine-tooltip.scss +21 -0
- package/scss/transitions/_fwd.navbar.scss +4 -9
- package/scss/transitions/_fwd.scss +4 -34
- package/scss/transitions/_glass-button.scss +12 -0
- package/scss/transitions/_glass-prominent-button.scss +12 -0
- package/scss/transitions/_index.scss +35 -143
- package/scss/transitions/_menu-view.scss +26 -0
- package/scss/transitions/_navigation-split-view.scss +23 -0
- package/scss/transitions/_progress-view.scss +23 -0
- package/scss/transitions/_sheet-view.scss +30 -0
- package/scss/transitions/_sidebar-view.scss +36 -0
- package/scss/transitions/_tab-bar.scss +20 -0
- package/scss/utils/_frame.scss +91 -0
- package/scss/utils/_index.scss +91 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +209 -0
- package/web-components.html-data/en.json +500 -0
- package/generated/styles.css +0 -1305
- package/scss/_dev.scss +0 -68
- package/scss/components/_tab-bar-stack.scss +0 -101
- package/scss/components/_toolbars.scss +0 -100
- package/scss/transitions/_dialog.scss +0 -32
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @swiftwc/ui
|
|
2
|
+
|
|
3
|
+
[README](https://github.com/swiftwc/ui/blob/main/README.md)
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
Visit [swiftwc.github.io/ui/](https://swiftwc.github.io/ui/) to view the documentation.
|
|
8
|
+
|
|
9
|
+
## Contributing
|
|
10
|
+
|
|
11
|
+
Please read the [contributing guide](https://github.com/swiftwc/ui/blob/main/CONTRIBUTING.md).
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
Licensed under the [MIT license](https://github.com/swiftwc/ui/blob/main/LICENSE.md).
|
|
@@ -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,24 @@
|
|
|
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
|
+
export declare const alert: (title?: string, message?: string, actions?: {
|
|
9
|
+
label?: string;
|
|
10
|
+
image?: string;
|
|
11
|
+
role?: string;
|
|
12
|
+
}[], options?: {
|
|
13
|
+
titleVisibility?: boolean;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
export declare const confirmationDialog: (trigger: HTMLElement, title: string, message?: string, actions?: {
|
|
16
|
+
label?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
}[], options?: {
|
|
20
|
+
controller?: AbortController;
|
|
21
|
+
titleVisibility?: boolean;
|
|
22
|
+
}) => Promise<string>;
|
|
23
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
24
|
+
export { type NavigationHost };
|
|
@@ -0,0 +1,272 @@
|
|
|
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 { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
6
|
+
import { $, devFlags, kebabCase, onoff } from '../internal/utils';
|
|
7
|
+
import { Snapshot } from '../snapshot';
|
|
8
|
+
//#region polyfills
|
|
9
|
+
export const polyfills = new Map();
|
|
10
|
+
for (const [k, Ctor] of Object.entries(Components)) {
|
|
11
|
+
const is = kebabCase(k);
|
|
12
|
+
if ('polyfillExtends' in Ctor && 'string' === typeof Ctor.polyfillExtends) {
|
|
13
|
+
if (customElements.get(is))
|
|
14
|
+
continue;
|
|
15
|
+
customElements.define(is, Ctor, { extends: Ctor.polyfillExtends });
|
|
16
|
+
if (!(document.createElement(Ctor.polyfillExtends, { is }) instanceof Ctor))
|
|
17
|
+
polyfills.set(is, Ctor);
|
|
18
|
+
// const testEl = document.createElement('template')
|
|
19
|
+
// testEl.innerHTML = `<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`
|
|
20
|
+
// const testNode = testEl.content.firstElementChild,
|
|
21
|
+
if (!($(`<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`, '>1') instanceof Ctor))
|
|
22
|
+
polyfills.set(is, Ctor);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (!customElements.get(is))
|
|
26
|
+
customElements.define(is, Ctor);
|
|
27
|
+
}
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(polyfills);
|
|
30
|
+
if (0 < polyfills.size) {
|
|
31
|
+
const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
32
|
+
const handlers = new WeakMap();
|
|
33
|
+
const observe = (el, polyfill) => {
|
|
34
|
+
if (!Array.isArray(polyfill.observedAttributes))
|
|
35
|
+
return;
|
|
36
|
+
if (0 === polyfill?.observedAttributes.length)
|
|
37
|
+
return;
|
|
38
|
+
if (!polyfill.polyfillAttributeChangedCallback)
|
|
39
|
+
return;
|
|
40
|
+
const observer = new MutationObserver(polyfill.polyfillAttributeChangedCallback);
|
|
41
|
+
observer.observe(el, {
|
|
42
|
+
attributes: true,
|
|
43
|
+
attributeFilter: polyfill.observedAttributes,
|
|
44
|
+
attributeOldValue: true,
|
|
45
|
+
});
|
|
46
|
+
handlers.set(el, observer);
|
|
47
|
+
for (const attributeName of polyfill.observedAttributes)
|
|
48
|
+
if (el.hasAttribute(attributeName)) {
|
|
49
|
+
const entry = {
|
|
50
|
+
attributeName,
|
|
51
|
+
oldValue: null,
|
|
52
|
+
target: el,
|
|
53
|
+
};
|
|
54
|
+
polyfill.polyfillAttributeChangedCallback([entry]);
|
|
55
|
+
}
|
|
56
|
+
}, unobserve = (el) => {
|
|
57
|
+
handlers.delete(el);
|
|
58
|
+
}, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
|
|
59
|
+
if (devFlags.debug)
|
|
60
|
+
console.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 && target))
|
|
112
|
+
return;
|
|
113
|
+
const trigger = target.closest('[help]');
|
|
114
|
+
if (!trigger)
|
|
115
|
+
return;
|
|
116
|
+
if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
|
|
117
|
+
return;
|
|
118
|
+
const newAnchorName = `--help-${self.crypto.randomUUID()}`;
|
|
119
|
+
const tooltip = $(`<fine-tooltip></fine-tooltip>`, '>1');
|
|
120
|
+
trigger.style.setProperty('anchor-name', newAnchorName);
|
|
121
|
+
tooltip.style.setProperty('position-anchor', newAnchorName);
|
|
122
|
+
document.body.appendChild(tooltip);
|
|
123
|
+
// setInterval(() => {
|
|
124
|
+
// trigger.setAttribute('help', trigger.getAttribute('help') + 'h')
|
|
125
|
+
// }, 2000)
|
|
126
|
+
// console.log(999, trigger)
|
|
127
|
+
}, handleDone = ({ target, relatedTarget }) => {
|
|
128
|
+
if (!(target instanceof HTMLElement && target))
|
|
129
|
+
return;
|
|
130
|
+
const trigger = target.closest('[help]');
|
|
131
|
+
if (!trigger)
|
|
132
|
+
return;
|
|
133
|
+
if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
|
|
134
|
+
return;
|
|
135
|
+
const anchorName = trigger.style.anchorName;
|
|
136
|
+
if (!anchorName.startsWith('--help-'))
|
|
137
|
+
return;
|
|
138
|
+
// for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
|
|
139
|
+
// for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
|
|
140
|
+
// return
|
|
141
|
+
// }
|
|
142
|
+
const tooltip = document.querySelector(`[style*="${CSS.escape(anchorName)}"]:not([help])`);
|
|
143
|
+
if (!tooltip)
|
|
144
|
+
return;
|
|
145
|
+
// for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
|
|
146
|
+
// for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
|
|
147
|
+
// return
|
|
148
|
+
// }
|
|
149
|
+
// trigger.style.removeProperty('anchor-name')
|
|
150
|
+
tooltip.hidePopover(); // tooltip.remove?.()
|
|
151
|
+
};
|
|
152
|
+
const mediaQueryList = self.matchMedia(`(pointer: fine)`);
|
|
153
|
+
mediaQueryList.addEventListener('change', ({ matches }) => {
|
|
154
|
+
for (const [k, v] of [
|
|
155
|
+
['pointerover', handleHelp],
|
|
156
|
+
['pointerout', handleDone],
|
|
157
|
+
])
|
|
158
|
+
document.removeEventListener(k, v);
|
|
159
|
+
if (matches)
|
|
160
|
+
for (const [k, v] of [
|
|
161
|
+
['pointerover', handleHelp],
|
|
162
|
+
['pointerout', handleDone],
|
|
163
|
+
])
|
|
164
|
+
document.addEventListener(k, v, { passive: true });
|
|
165
|
+
});
|
|
166
|
+
if (mediaQueryList.matches)
|
|
167
|
+
for (const [k, v] of [
|
|
168
|
+
['pointerover', handleHelp],
|
|
169
|
+
['pointerout', handleDone],
|
|
170
|
+
])
|
|
171
|
+
document.addEventListener(k, v, { passive: true });
|
|
172
|
+
//#region fns
|
|
173
|
+
export const alert = async (title, message, actions, options) => {
|
|
174
|
+
await navigator.locks.request('alert:', async () => {
|
|
175
|
+
const dialog = $(`<dialog is="alert-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(`<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
|
|
176
|
+
if (title) {
|
|
177
|
+
const label = $(`<label-view font="headline"></label-view>`, '>1');
|
|
178
|
+
label.setAttribute('title', title);
|
|
179
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
180
|
+
}
|
|
181
|
+
if (message) {
|
|
182
|
+
const label = $(`<label-view foreground="secondary" font="callout"></label-view>`, '>1');
|
|
183
|
+
label.setAttribute('title', message);
|
|
184
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
185
|
+
}
|
|
186
|
+
for (const [index, action] of (actions ?? [
|
|
187
|
+
{
|
|
188
|
+
role: 'close',
|
|
189
|
+
},
|
|
190
|
+
]).entries()) {
|
|
191
|
+
const btn = $(`<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
|
|
192
|
+
btn.setAttribute('value', `${index}`);
|
|
193
|
+
if (action?.role)
|
|
194
|
+
btn.setAttribute('role', action.role);
|
|
195
|
+
if (action.label || action.image) {
|
|
196
|
+
const label = $(`<label-view></label-view>`, '>1');
|
|
197
|
+
if (action.label)
|
|
198
|
+
label.setAttribute('title', action.label);
|
|
199
|
+
if (action.image)
|
|
200
|
+
label.setAttribute('system-image', action.image);
|
|
201
|
+
btn.appendChild(label);
|
|
202
|
+
}
|
|
203
|
+
dialog.insertAdjacentElement('beforeend', btn);
|
|
204
|
+
}
|
|
205
|
+
document.body.insertAdjacentElement('beforeend', dialog);
|
|
206
|
+
dialog.showModal();
|
|
207
|
+
const { promise, resolve } = Promise.withResolvers(), off = onoff('alert:return', (evt) => {
|
|
208
|
+
off();
|
|
209
|
+
resolve(evt.detail.returnValue);
|
|
210
|
+
}, alertDialog, { once: true }).on();
|
|
211
|
+
return promise;
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
export const confirmationDialog = async (trigger, title, message, actions, options) => {
|
|
215
|
+
const newAnchorName = `--confirmation-dialog-${self.crypto.randomUUID()}`;
|
|
216
|
+
const dialog = $(`<dialog is="confirmation-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(`<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
|
|
217
|
+
trigger.style.setProperty('anchor-name', newAnchorName, 'important'); //$.prop('anchor-name', newAnchorName, trigger, 'important')
|
|
218
|
+
dialog.style.setProperty('position-anchor', newAnchorName); //$.prop('position-anchor', newAnchorName, dialog)
|
|
219
|
+
if (title && false !== options?.titleVisibility) {
|
|
220
|
+
const label = $(`<label-view font="headline"></label-view>`, '>1');
|
|
221
|
+
label.setAttribute('title', title);
|
|
222
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
223
|
+
}
|
|
224
|
+
if (message && false !== options?.titleVisibility) {
|
|
225
|
+
const label = $(`<label-view foreground="secondary" font="callout"></label-view>`, '>1');
|
|
226
|
+
label.setAttribute('title', message);
|
|
227
|
+
vStack.insertAdjacentElement('beforeend', label);
|
|
228
|
+
}
|
|
229
|
+
for (const [index, action] of (actions ?? []).entries()) {
|
|
230
|
+
const btn = $(`<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
|
|
231
|
+
btn.setAttribute('value', `${index}`);
|
|
232
|
+
if (action?.role)
|
|
233
|
+
btn.setAttribute('role', action.role);
|
|
234
|
+
if (action.label || action.image) {
|
|
235
|
+
const label = $(`<label-view></label-view>`, '>1');
|
|
236
|
+
if (action.label)
|
|
237
|
+
label.setAttribute('title', action.label);
|
|
238
|
+
if (action.image)
|
|
239
|
+
label.setAttribute('system-image', action.image);
|
|
240
|
+
btn.appendChild(label);
|
|
241
|
+
}
|
|
242
|
+
dialog.insertAdjacentElement('beforeend', btn);
|
|
243
|
+
}
|
|
244
|
+
trigger.closest('body-view,dialog')?.insertAdjacentElement('beforeend', dialog); // dialog.showModal()
|
|
245
|
+
const { promise, resolve } = Promise.withResolvers(), off = onoff('confirmation:return', (evt) => {
|
|
246
|
+
off();
|
|
247
|
+
resolve(evt.detail.returnValue);
|
|
248
|
+
}, confirmationDialogBus, { once: true }).on();
|
|
249
|
+
return promise;
|
|
250
|
+
// return await new Promise((resolve, reject) => {
|
|
251
|
+
// const onClose = (evt: any) => {
|
|
252
|
+
// off()
|
|
253
|
+
// resolve(evt.detail.returnValue)
|
|
254
|
+
// },
|
|
255
|
+
// off = onoff('return', onClose, ConfirmationDialog, { once: true }).on()
|
|
256
|
+
// // const onAbort = () => {
|
|
257
|
+
// // cleanup()
|
|
258
|
+
// // reject(new DOMException('aborted', 'AbortError'))
|
|
259
|
+
// // }
|
|
260
|
+
// // const cleanup = () => {
|
|
261
|
+
// // ConfirmationDialog.removeEventListener('close', onClose)
|
|
262
|
+
// // // controller.signal.removeEventListener('abort', onAbort)
|
|
263
|
+
// // }
|
|
264
|
+
// // ConfirmationDialog.addEventListener('close', onClose, { once: true })
|
|
265
|
+
// // controller.signal.addEventListener('abort', onAbort, { once: true })
|
|
266
|
+
// })
|
|
267
|
+
};
|
|
268
|
+
//#endregion
|
|
269
|
+
void Snapshot.waitReady; // void Snapshot.setOwnConfig()
|
|
270
|
+
//#region exports
|
|
271
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
272
|
+
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class AlertDialog extends DialogBase {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: AlertDialog): void;
|
|
6
|
+
static polyfillConnectedCallback(el: AlertDialog): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
8
|
+
}
|
|
@@ -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 && target))
|
|
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 && dialog))
|
|
56
|
+
return;
|
|
57
|
+
if (!(target instanceof HTMLElement && target))
|
|
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 && target))
|
|
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 && target))
|
|
96
|
+
return;
|
|
97
|
+
target.remove();
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
2
|
+
export class BodyView extends HTMLElement {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
5
|
+
}
|
|
6
|
+
disconnectedCallback() {
|
|
7
|
+
if (devFlags.debug)
|
|
8
|
+
console.debug(`${BodyView.name} ⚡️ disconnect`);
|
|
9
|
+
}
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${BodyView.name} ⚡️ connect`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @slot overlay
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class BorderedButton extends ButtonBase {
|
|
7
|
+
#private;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
static polyfillDisconnectedCallback(el: BorderedButton): void;
|
|
11
|
+
static polyfillConnectedCallback(el: BorderedButton): void;
|
|
12
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class BorderedButton extends ButtonBase {
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ['role', 'title-key'];
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
static polyfillDisconnectedCallback(el) {
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
19
|
+
CleanupRegistry.unregister(el);
|
|
20
|
+
}
|
|
21
|
+
static polyfillConnectedCallback(el) {
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderedButton.name} ⚡️ connect`);
|
|
24
|
+
el.tabIndex = 0;
|
|
25
|
+
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
26
|
+
}
|
|
27
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
30
|
+
const node = target instanceof HTMLButtonElement && target;
|
|
31
|
+
if (!node)
|
|
32
|
+
return;
|
|
33
|
+
switch (attributeName) {
|
|
34
|
+
case 'title-key':
|
|
35
|
+
case 'role':
|
|
36
|
+
Snapshot.waitReady.then(() => {
|
|
37
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static #handleClick = async (evt) => {
|
|
43
|
+
//
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @slot overlay
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class BorderedProminentButton extends ButtonBase {
|
|
7
|
+
#private;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
static polyfillDisconnectedCallback(el: BorderedProminentButton): void;
|
|
11
|
+
static polyfillConnectedCallback(el: BorderedProminentButton): void;
|
|
12
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class BorderedProminentButton extends ButtonBase {
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ['role', 'title-key'];
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
static polyfillDisconnectedCallback(el) {
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
19
|
+
CleanupRegistry.unregister(el);
|
|
20
|
+
}
|
|
21
|
+
static polyfillConnectedCallback(el) {
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
24
|
+
el.tabIndex = 0;
|
|
25
|
+
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
26
|
+
}
|
|
27
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
30
|
+
const node = target instanceof HTMLButtonElement && target;
|
|
31
|
+
if (!node)
|
|
32
|
+
return;
|
|
33
|
+
switch (attributeName) {
|
|
34
|
+
case 'title-key':
|
|
35
|
+
case 'role':
|
|
36
|
+
Snapshot.waitReady.then(() => {
|
|
37
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static #handleClick = async (evt) => {
|
|
43
|
+
//
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @slot overlay
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class BorderlessButton extends ButtonBase {
|
|
7
|
+
#private;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
static polyfillDisconnectedCallback(el: BorderlessButton): void;
|
|
11
|
+
static polyfillConnectedCallback(el: BorderlessButton): void;
|
|
12
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class BorderlessButton extends ButtonBase {
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ['role', 'title-key'];
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
static polyfillDisconnectedCallback(el) {
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
19
|
+
CleanupRegistry.unregister(el);
|
|
20
|
+
}
|
|
21
|
+
static polyfillConnectedCallback(el) {
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
24
|
+
el.tabIndex = 0;
|
|
25
|
+
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
26
|
+
}
|
|
27
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
30
|
+
const node = target instanceof HTMLButtonElement && target;
|
|
31
|
+
if (!node)
|
|
32
|
+
return;
|
|
33
|
+
switch (attributeName) {
|
|
34
|
+
case 'title-key':
|
|
35
|
+
case 'role':
|
|
36
|
+
Snapshot.waitReady.then(() => {
|
|
37
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static #handleClick = async (evt) => {
|
|
43
|
+
// alert(99)
|
|
44
|
+
};
|
|
45
|
+
}
|