@swiftwc/ui 0.0.0-dev.6 → 0.0.0-dev.8
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/client/index.d.ts +13 -3
- package/generated/client/index.js +228 -158
- package/generated/components/bordered-button.d.ts +7 -0
- package/generated/components/bordered-button.js +20 -0
- package/generated/components/bordered-prominent-button.d.ts +7 -0
- package/generated/components/bordered-prominent-button.js +20 -0
- package/generated/components/borderless-button.d.ts +4 -4
- package/generated/components/borderless-button.js +26 -16
- package/generated/components/confirmation-dialog.d.ts +9 -0
- package/generated/components/confirmation-dialog.js +102 -0
- package/generated/components/date-picker.d.ts +46 -0
- package/generated/components/date-picker.js +430 -0
- package/generated/components/disclosure-group.d.ts +4 -7
- package/generated/components/disclosure-group.js +41 -66
- package/generated/components/form-view.d.ts +6 -0
- package/generated/components/form-view.js +58 -0
- package/generated/components/glass-button.d.ts +6 -0
- package/generated/components/glass-button.js +17 -0
- package/generated/components/glass-prominent-button.d.ts +6 -0
- package/generated/components/glass-prominent-button.js +17 -0
- package/generated/components/index.d.ts +34 -10
- package/generated/components/index.js +33 -14
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +83 -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 +133 -0
- package/generated/components/navigation-large-title.d.ts +6 -0
- package/generated/components/navigation-large-title.js +177 -0
- package/generated/components/navigation-split-view.d.ts +4 -2
- package/generated/components/navigation-split-view.js +11 -2
- package/generated/components/navigation-stack.d.ts +3 -2
- package/generated/components/navigation-stack.js +15 -58
- package/generated/components/navigation-title.d.ts +8 -0
- package/generated/components/navigation-title.js +66 -0
- package/generated/components/picker-view.d.ts +27 -0
- package/generated/components/picker-view.js +442 -0
- package/generated/components/plain-button.d.ts +7 -0
- package/generated/components/plain-button.js +20 -0
- package/generated/components/screen-view.d.ts +1 -1
- package/generated/components/screen-view.js +1 -1
- package/generated/components/scroll-view.d.ts +4 -2
- package/generated/components/scroll-view.js +169 -62
- package/generated/components/section-view.d.ts +9 -0
- package/generated/components/section-view.js +81 -0
- package/generated/components/sheet-view.d.ts +4 -4
- package/generated/components/sheet-view.js +59 -16
- package/generated/components/sidebar-toggle.d.ts +1 -1
- package/generated/components/sidebar-toggle.js +89 -63
- package/generated/components/sidebar-view.d.ts +2 -4
- package/generated/components/sidebar-view.js +20 -17
- package/generated/components/sticky-container.d.ts +6 -0
- package/generated/components/sticky-container.js +22 -0
- package/generated/components/tab-bar.d.ts +2 -4
- package/generated/components/tab-bar.js +24 -17
- package/generated/components/tab-item.d.ts +4 -3
- package/generated/components/tab-item.js +114 -29
- package/generated/components/tab-view.d.ts +17 -2
- package/generated/components/tab-view.js +244 -17
- package/generated/components/table-view.d.ts +7 -0
- package/generated/components/table-view.js +175 -0
- package/generated/components/text-field.d.ts +29 -0
- package/generated/components/text-field.js +489 -0
- package/generated/components/tool-bar-item-group.d.ts +5 -0
- package/generated/components/tool-bar-item-group.js +11 -0
- package/generated/components/tool-bar-item.d.ts +5 -0
- package/generated/components/tool-bar-item.js +19 -0
- package/generated/components/tool-bar.d.ts +7 -0
- package/generated/components/tool-bar.js +77 -0
- package/generated/components/v-keyboard.d.ts +2 -0
- package/generated/components/v-keyboard.js +64 -68
- package/generated/components/v-stack.d.ts +5 -0
- package/generated/components/v-stack.js +11 -0
- package/generated/confirmation-dialog/index.d.ts +1 -0
- package/generated/confirmation-dialog/index.js +1 -0
- package/generated/css/index.css +7463 -0
- package/generated/events/confirmation-dialog.d.ts +9 -0
- package/generated/events/date-picker.d.ts +8 -0
- package/generated/events/date-picker.js +1 -0
- package/generated/events/index.d.ts +7 -0
- package/generated/events/index.js +7 -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 +8 -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 +24 -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 +24 -0
- package/generated/i18n/index.js +139 -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 +20 -0
- package/generated/internal/class/form-associated-base.js +93 -0
- package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
- package/generated/internal/class/mutation-observer-singleton.js +46 -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 +77 -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/custom-element.d.ts +5 -0
- package/generated/internal/decorators/custom-element.js +4 -0
- package/generated/internal/privateNamespace.d.ts +4 -0
- package/generated/internal/privateNamespace.js +1 -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 +22 -0
- package/generated/internal/utils/cash/index.js +23 -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/frame.d.ts +1 -0
- package/generated/internal/utils/frame.js +6 -0
- package/generated/internal/utils/index.d.ts +16 -1
- package/generated/internal/utils/index.js +17 -1
- 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 +28 -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/lifecycle-observer/index.d.ts +1 -0
- package/generated/lifecycle-observer/index.js +1 -0
- package/generated/namespace-browser/base.d.ts +36 -0
- package/generated/namespace-browser/base.js +92 -0
- package/generated/namespace-browser/index.d.ts +7 -0
- package/generated/namespace-browser/index.js +1 -0
- package/generated/snapshot/index.d.ts +2 -11
- package/generated/snapshot/index.js +31 -144
- package/package.json +19 -8
- package/scss/_components.scss +52 -16
- package/scss/_final.scss +1 -0
- package/scss/_mixins.scss +2 -171
- package/scss/_placeholders.scss +3 -0
- package/scss/_transitions.scss +16 -0
- package/scss/_utils.scss +9 -0
- package/scss/_vars.scss +137 -23
- package/scss/base/_layout.scss +31 -15
- package/scss/base/_reboot.scss +118 -15
- package/scss/base/_root.scss +355 -25
- package/scss/colors/_index.scss +624 -70
- package/scss/components/_body-view.scss +12 -3
- package/scss/components/_bordered-button.scss +22 -0
- package/scss/components/_bordered-prominent-button.scss +19 -0
- package/scss/components/_borderless-button.scss +11 -6
- package/scss/components/_confirmation-dialog.scss +110 -0
- package/scss/components/_date-picker.scss +30 -0
- package/scss/components/_detail-placeholder.scss +155 -0
- package/scss/components/_disclosure-group.scss +100 -52
- package/scss/components/_form-view.scss +195 -0
- package/scss/components/_full-screen.scss +7 -5
- package/scss/components/_glass-button.scss +24 -0
- package/scss/components/_glass-prominent-button.scss +24 -0
- package/scss/components/_h-divider.scss +13 -0
- package/scss/components/_h-stack.scss +39 -0
- package/scss/components/_index.scss +224 -7
- package/scss/components/_label-view.scss +386 -0
- package/scss/components/_labeled-content.scss +9 -0
- package/scss/components/_list-view.scss +229 -0
- package/scss/components/_menu-view.scss +188 -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 +122 -0
- package/scss/components/_plain-button.scss +11 -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 +110 -66
- package/scss/components/_section-view.scss +119 -0
- package/scss/components/_sheet-view.scss +68 -35
- package/scss/components/_sidebar-toggle.scss +90 -27
- package/scss/components/_sidebar-view.scss +30 -40
- package/scss/components/_sticky-container.scss +42 -0
- package/scss/components/_tab-bar.scss +201 -84
- package/scss/components/_tab-item.scss +25 -0
- package/scss/components/_tab-view.scss +268 -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 +128 -70
- package/scss/components/_tool-bar.scss +107 -64
- 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 +8 -9
- package/scss/final/_touch-glass.scss +67 -0
- package/scss/index.scss +6 -2
- package/scss/mixins/_dialog.scss +88 -0
- package/scss/mixins/_index.scss +405 -0
- package/scss/placeholders/_buttons.scss +83 -0
- package/scss/placeholders/_lists.scss +589 -0
- package/scss/transitions/_bwd.navbar.scss +3 -13
- package/scss/transitions/_bwd.scss +4 -20
- package/scss/transitions/_confirmation-dialog.scss +19 -0
- package/scss/transitions/_dialog.scss +7 -11
- package/scss/transitions/_disclosure-group.scss +35 -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/_sidebar-view.scss +36 -0
- package/scss/transitions/_tab-bar.scss +19 -0
- package/scss/utils/_frame.scss +84 -0
- package/scss/utils/_index.scss +68 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +242 -0
- package/web-components.html-data/en.json +330 -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/generated/{namespace/index.js → events/confirmation-dialog.js} +0 -0
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).
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import { ConfirmationDialog } from '../confirmation-dialog';
|
|
2
|
+
import { I18n } from '../i18n';
|
|
3
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
4
|
+
import { LifecycleObserver } from '../lifecycle-observer';
|
|
5
|
+
import { type WebComponentCtor } from '../namespace-browser';
|
|
1
6
|
import { Snapshot } from '../snapshot';
|
|
2
|
-
import { type WebComponentCtor } from '../namespace';
|
|
3
7
|
export declare const polyfills: Map<string, WebComponentCtor>;
|
|
4
8
|
type TransitionType = 'forwards' | 'backwards' | 'reload';
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
type UpdateCallback = () => void | Promise<void>;
|
|
10
|
+
type NavigateOptions = {
|
|
11
|
+
updateCallback?: UpdateCallback;
|
|
12
|
+
tos?: () => NavigationPath[];
|
|
13
|
+
};
|
|
14
|
+
export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
|
|
15
|
+
export declare const confirmationDialog: (trigger: HTMLElement, title: string, entries: Array<[string, any]>, controller?: AbortController) => Promise<unknown>;
|
|
16
|
+
export { ConfirmationDialog, I18n, LifecycleObserver, NavigationPath, Snapshot };
|
|
@@ -1,70 +1,92 @@
|
|
|
1
1
|
import * as Components from '../components';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfirmationDialog } from '../confirmation-dialog';
|
|
3
|
+
import { I18n } from '../i18n';
|
|
4
|
+
import { NavigationPath } from '../internal/class/navigation-path';
|
|
5
|
+
import { $, kebabCase, onoff } from '../internal/utils';
|
|
6
|
+
import { LifecycleObserver } from '../lifecycle-observer';
|
|
3
7
|
import { Snapshot } from '../snapshot';
|
|
4
8
|
export const polyfills = new Map();
|
|
5
|
-
for (const [k,
|
|
9
|
+
for (const [k, Ctor] of Object.entries(Components)) {
|
|
6
10
|
const is = kebabCase(k);
|
|
7
|
-
if ('polyfillExtends' in
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
if ('polyfillExtends' in Ctor && 'string' === typeof Ctor.polyfillExtends) {
|
|
12
|
+
if (customElements.get(is))
|
|
13
|
+
continue;
|
|
14
|
+
customElements.define(is, Ctor, { extends: Ctor.polyfillExtends });
|
|
15
|
+
if (!(document.createElement(Ctor.polyfillExtends, { is }) instanceof Ctor))
|
|
16
|
+
polyfills.set(is, Ctor);
|
|
12
17
|
continue;
|
|
13
18
|
}
|
|
14
|
-
customElements.
|
|
19
|
+
if (!customElements.get(is))
|
|
20
|
+
customElements.define(is, Ctor);
|
|
15
21
|
}
|
|
16
22
|
console.debug(polyfills);
|
|
17
23
|
if (0 < polyfills.size) {
|
|
18
|
-
const polyfillTagNamesCache = new Set([...polyfills.values()]
|
|
19
|
-
.map((v) => String(v.polyfillExtends ?? '').toUpperCase())
|
|
20
|
-
.filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
24
|
+
const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
21
25
|
const handlers = new WeakMap();
|
|
22
|
-
// @ts-expect-error
|
|
23
26
|
const observe = (el, polyfill) => {
|
|
24
27
|
if (!Array.isArray(polyfill.observedAttributes))
|
|
25
28
|
return;
|
|
26
29
|
if (0 === polyfill?.observedAttributes.length)
|
|
27
30
|
return;
|
|
28
|
-
|
|
31
|
+
if (!polyfill.polyfillAttributeChangedCallback)
|
|
32
|
+
return;
|
|
33
|
+
const observer = new MutationObserver(polyfill.polyfillAttributeChangedCallback);
|
|
34
|
+
observer.observe(el, {
|
|
29
35
|
attributes: true,
|
|
30
36
|
attributeFilter: polyfill.observedAttributes,
|
|
31
37
|
attributeOldValue: true,
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
});
|
|
39
|
+
handlers.set(el, observer);
|
|
40
|
+
for (const attributeName of polyfill.observedAttributes)
|
|
41
|
+
if (el.hasAttribute(attributeName)) {
|
|
42
|
+
const entry = {
|
|
43
|
+
attributeName,
|
|
44
|
+
oldValue: null,
|
|
45
|
+
target: el,
|
|
46
|
+
};
|
|
47
|
+
void polyfill.polyfillAttributeChangedCallback([entry]);
|
|
48
|
+
}
|
|
49
|
+
}, unobserve = (el) => {
|
|
36
50
|
handlers.delete(el);
|
|
37
|
-
};
|
|
38
|
-
console.debug(polyfillTagNamesCache);
|
|
51
|
+
}, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
|
|
52
|
+
console.debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
|
|
39
53
|
for (const [is, polyfill] of polyfills)
|
|
40
|
-
for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${is}"]`)) {
|
|
54
|
+
for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
|
|
41
55
|
polyfill.polyfillConnectedCallback(el);
|
|
42
56
|
observe(el, polyfill);
|
|
43
57
|
}
|
|
44
58
|
// observer callback
|
|
45
59
|
const observer = new MutationObserver((mutations) => {
|
|
46
60
|
for (const { addedNodes, removedNodes } of mutations) {
|
|
47
|
-
for (const
|
|
48
|
-
if (!(
|
|
49
|
-
continue;
|
|
50
|
-
if (!polyfillTagNamesCache.has(node.tagName))
|
|
51
|
-
continue;
|
|
52
|
-
const is = node?.getAttribute('is') ?? '';
|
|
53
|
-
if (!polyfills.has(is))
|
|
61
|
+
for (const root of addedNodes) {
|
|
62
|
+
if (!(root instanceof HTMLElement))
|
|
54
63
|
continue;
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
for (const node of flatten(root)) {
|
|
65
|
+
if (!(node instanceof HTMLElement))
|
|
66
|
+
continue;
|
|
67
|
+
if (!polyfillTagNamesCache.has(node.tagName))
|
|
68
|
+
continue;
|
|
69
|
+
const is = node?.getAttribute('is') ?? '';
|
|
70
|
+
if (!polyfills.has(is))
|
|
71
|
+
continue;
|
|
72
|
+
polyfills.get(is)?.polyfillConnectedCallback(node);
|
|
73
|
+
observe(node, polyfills.get(is));
|
|
74
|
+
}
|
|
57
75
|
}
|
|
58
|
-
for (const
|
|
59
|
-
if (!(
|
|
76
|
+
for (const root of removedNodes) {
|
|
77
|
+
if (!(root instanceof HTMLElement))
|
|
60
78
|
continue;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
for (const node of flatten(root)) {
|
|
80
|
+
if (!(node instanceof HTMLElement))
|
|
81
|
+
continue;
|
|
82
|
+
if (!polyfillTagNamesCache.has(node.tagName))
|
|
83
|
+
continue;
|
|
84
|
+
const is = node?.getAttribute('is') ?? '';
|
|
85
|
+
if (!polyfills.has(is))
|
|
86
|
+
continue;
|
|
87
|
+
polyfills.get(is)?.polyfillDisconnectedCallback(node);
|
|
88
|
+
unobserve(node);
|
|
89
|
+
}
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
});
|
|
@@ -73,151 +95,199 @@ if (0 < polyfills.size) {
|
|
|
73
95
|
subtree: true,
|
|
74
96
|
});
|
|
75
97
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'bwd',
|
|
83
|
-
'bwdd',
|
|
84
|
-
'bwn',
|
|
85
|
-
'bwnn',
|
|
86
|
-
];
|
|
87
|
-
if (['backwards', 'forwards'].includes(dir ?? ''))
|
|
98
|
+
// SECTION: Safari polyfill
|
|
99
|
+
document.addEventListener('touchstart', () => { }, { passive: true });
|
|
100
|
+
// SECTION: Transitions
|
|
101
|
+
const cleanup = (lm, type) => {
|
|
102
|
+
let arr = [Snapshot.config['vt-fwd-class-name'], 'fwdd', 'fwn', 'fwnn', 'bwd', 'bwdd', 'bwn', 'bwnn'];
|
|
103
|
+
if (['backwards', 'forwards'].includes(type ?? ''))
|
|
88
104
|
for (let i = arr.length - 1; i >= 0; i--)
|
|
89
|
-
if (arr[i].startsWith('backwards' ===
|
|
105
|
+
if (arr[i].startsWith('backwards' === type ? 'fw' : 'bw'))
|
|
90
106
|
arr.splice(i, 1);
|
|
91
|
-
for (const el of [
|
|
92
|
-
...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? []),
|
|
93
|
-
])
|
|
107
|
+
for (const el of [...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? [])])
|
|
94
108
|
el.classList.remove(...arr);
|
|
95
109
|
};
|
|
96
|
-
export const startViewTransition = async (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
|
|
111
|
+
console.debug(`startViewTransition (${type})`, target);
|
|
112
|
+
if (!(target instanceof HTMLElement))
|
|
113
|
+
throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
|
|
114
|
+
if (!['forwards', 'backwards', 'reload'].includes(type))
|
|
115
|
+
throw new TypeError("Argument 2 ('type') to client.startViewTransition must be of TransitionType");
|
|
116
|
+
const options = typeof updateCallbackOrOptions === 'function'
|
|
117
|
+
? {
|
|
118
|
+
updateCallback: updateCallbackOrOptions,
|
|
119
|
+
}
|
|
120
|
+
: (updateCallbackOrOptions ?? {}), updateCallback = options.updateCallback ?? (async () => { });
|
|
121
|
+
await Snapshot.waitReady;
|
|
122
|
+
const from = new NavigationPath(target); //const from = closestBody(target) //event.target as HTMLElement)
|
|
102
123
|
if ('forwards' === type) {
|
|
103
|
-
// const sis = Router.toolbarItems //sv.parentElement.querySelectorAll(`:scope > navigation-bar > toolbar-item,:scope > bottom-bar > toolbar-item`)
|
|
104
|
-
// pr = Router.frame //sv.parentElement
|
|
105
|
-
// const pt = event.target.closest('navigation-stack,body-view')
|
|
106
|
-
// const inte = event.target.closest(".fwd");
|
|
107
|
-
// const st = sv.scrollTop
|
|
108
|
-
// console.log(333, lm, sv, sis)
|
|
109
|
-
// let to
|
|
110
|
-
// inject or unhide
|
|
111
|
-
// if (pr.tagName === 'NAVIGATION-STACK' && 'more' === pr.getAttribute('is')) {
|
|
112
|
-
// to = document.querySelector(`#${event.target.getAttribute('tag')}`)
|
|
113
|
-
// to.hidden = false
|
|
114
|
-
// } else {
|
|
115
124
|
await updateCallback(); // updatetheDOMSomehow
|
|
116
|
-
//
|
|
125
|
+
// Snapshot.getSnapshot(from)
|
|
126
|
+
// const root = getRootViewController(from)
|
|
127
|
+
// const oldPath = new NavigationPath(from)
|
|
128
|
+
const root = [from, ...from.parents()]
|
|
129
|
+
.map((item) => item.component)
|
|
130
|
+
.filter(Boolean)
|
|
131
|
+
.at(-1);
|
|
132
|
+
// const { toolBarConfig: oldToolbars } = getComputedView(from) // const { toolBarConfig: oldToolbars, slot: oldSLot, page: oldPage } = getComputedView(from) //
|
|
133
|
+
// console.log(88, oldPage, oldPath.page, oldSLot, oldPath.slot, oldToolbars, oldPath.toolBarConfig)
|
|
134
|
+
// const oldToolbars = Snapshot.toolbarItems
|
|
135
|
+
// const { toolBarConfig: oldToolbars, host: oldHost } = getComputedView(from)
|
|
136
|
+
const tos = options.tos?.() ?? [...from.children()].map((item) => item?.hydrate()), //queryBodyAll(oldSLot), //[...oldPath.children()].map((item) => item.body).filter(Boolean),//
|
|
137
|
+
to = tos.at(-1),
|
|
138
|
+
// to = newPath?.body, //tos.slice(-1)?.pop?.(), //Snapshot.leaf, //
|
|
139
|
+
// newHost = newPath?.component, //{ host: newHost } = getComputedView(to),
|
|
140
|
+
newToolbars = tos.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item),
|
|
141
|
+
// .map((item) => item.toolBarConfig)
|
|
142
|
+
// .flat()
|
|
143
|
+
// .filter(Boolean), //queryToolbarConfigAll(oldSLot),
|
|
144
|
+
modalViews = tos.map((item) => item.component).filter((item) => !!item && item.matches('dialog')); //[...queryHostAll(oldPage)].filter?.((item) => item?.matches('dialog'))
|
|
145
|
+
// toFrame = Snapshot.leafContainer, //queryHostAll(from).slice(-1)?.pop?.(),
|
|
146
|
+
// toToolbars = Snapshot.leafToolbarItems
|
|
147
|
+
// dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
|
|
148
|
+
// if ('DIALOG' === newHost?.tagName) {
|
|
149
|
+
// ;(newHost as HTMLDialogElement).showModal()
|
|
150
|
+
// console.debug(`⚡️ view-transition-start (${type})`)
|
|
151
|
+
// await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
|
|
152
|
+
// console.debug(`⚡️ view-transition-end (${type})`)
|
|
153
|
+
// return
|
|
117
154
|
// }
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
155
|
+
// purge
|
|
156
|
+
cleanup(root, 'backwards');
|
|
157
|
+
// prepare old
|
|
158
|
+
from.body?.classList.add(Snapshot.config['vt-fwd-class-name']);
|
|
159
|
+
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
160
|
+
for (const oldToolbar of from.toolBarConfig ?? [])
|
|
161
|
+
oldToolbar.classList.add('fwn'); // prepare navbs
|
|
162
|
+
// prepare new
|
|
163
|
+
const toolbarExclusion = 0 < modalViews.length
|
|
164
|
+
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar,body-view ~ tool-bar)')
|
|
165
|
+
: (value, index, array) => value.parentElement?.matches('tool-bar:not(body-view ~ tool-bar)'), bodyExclusion = 0 < modalViews.length
|
|
166
|
+
? (item) => item.body?.matches('scroll-view:not(dialog scroll-view)')
|
|
167
|
+
: (value, index, array) => value;
|
|
168
|
+
for (const bti of newToolbars?.filter?.(toolbarExclusion) ?? [])
|
|
169
|
+
bti.classList.add('fwnn'); // for (const ti of newToolbars ?? []) ti.classList.add('fwnn') //
|
|
170
|
+
for (const bt of tos?.filter?.(bodyExclusion) ?? []) {
|
|
171
|
+
bt.body?.classList.add('fwdd'); //to?.classList.add('fwdd')
|
|
172
|
+
bt.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: bt.body }, bubbles: true, composed: true }));
|
|
173
|
+
}
|
|
174
|
+
if (0 < modalViews.length) {
|
|
175
|
+
for await (const el of modalViews)
|
|
176
|
+
el.showModal();
|
|
177
|
+
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
178
|
+
await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
|
|
179
|
+
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
125
182
|
console.debug(`⚡️ view-transition-start (${type})`);
|
|
126
|
-
await Promise.allSettled(
|
|
183
|
+
await Promise.allSettled([
|
|
184
|
+
...(from.body?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
185
|
+
...(to?.body?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
186
|
+
]);
|
|
127
187
|
console.debug(`⚡️ view-transition-end (${type})`);
|
|
128
|
-
return;
|
|
129
188
|
}
|
|
130
|
-
|
|
131
|
-
cleanup(Snapshot.root, 'backwards');
|
|
132
|
-
for (const ti of toToolbars ?? [])
|
|
133
|
-
ti.classList.add('fwnn');
|
|
134
|
-
to?.classList.add('fwdd');
|
|
135
|
-
// prepare principal/leader
|
|
136
|
-
from?.classList.add(Snapshot.config['vt-fwd-class-name']);
|
|
137
|
-
for (const ti of fromToolbars ?? [])
|
|
138
|
-
ti.classList.add('fwn'); // prepare navbs
|
|
139
|
-
// sv.inert = true
|
|
140
|
-
// if (!document.startViewTransition) {
|
|
141
|
-
// startViewTransition(event, false)
|
|
142
|
-
// return
|
|
143
|
-
// }
|
|
144
|
-
// With a transition:
|
|
145
|
-
// const transition = document.startViewTransition({
|
|
146
|
-
// async update() {},
|
|
147
|
-
// types: ['forwards'],
|
|
148
|
-
// })
|
|
149
|
-
// console.debug(transition)
|
|
150
|
-
// await transition.finished
|
|
151
|
-
// alert(3)
|
|
152
|
-
// return
|
|
153
|
-
console.debug(`⚡️ view-transition-start (${type})`);
|
|
154
|
-
await Promise.allSettled([
|
|
155
|
-
...(from?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
156
|
-
...(to?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
157
|
-
]);
|
|
158
|
-
// await Promise.allSettled(
|
|
159
|
-
// from.getAnimations().map(({ finished }) => finished)
|
|
160
|
-
// )
|
|
161
|
-
console.debug(`⚡️ view-transition-end (${type})`);
|
|
162
|
-
// console.log(9, to.querySelectorAll('.fwd'))
|
|
163
|
-
// sv2.classList.remove("fwdd");
|
|
164
|
-
if (0 <
|
|
165
|
-
(toFrame?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
|
|
189
|
+
if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
|
|
166
190
|
return;
|
|
167
|
-
cleanup(
|
|
191
|
+
cleanup(root);
|
|
168
192
|
}
|
|
169
193
|
else {
|
|
170
|
-
Snapshot.getSnapshot(from)
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
//
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
//
|
|
181
|
-
if ('DIALOG' ===
|
|
182
|
-
;
|
|
183
|
-
|
|
184
|
-
console.debug(`⚡️ view-transition-start (${type})`);
|
|
185
|
-
await Promise.allSettled(
|
|
186
|
-
console.debug(`⚡️ view-transition-end (${type})`);
|
|
187
|
-
if (
|
|
194
|
+
// Snapshot.getSnapshot(from)
|
|
195
|
+
// const oldPath = new NavigationPath(from)
|
|
196
|
+
const root = [from, ...from.parents()]
|
|
197
|
+
.map((item) => item.component)
|
|
198
|
+
.filter(Boolean)
|
|
199
|
+
.at(-1); // const root = getRootViewController(from)
|
|
200
|
+
//const { toolBarConfig: oldToolbars, host: oldHost, page: oldPage, slot: oldSlot } = getComputedView(from)
|
|
201
|
+
const froms = [...from.children()].map((item) => item?.hydrate());
|
|
202
|
+
const oldToolbars = froms.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item), oldBodies = froms.map((item) => item.body).filter((item) => !!item);
|
|
203
|
+
// console.log(99, queryToolbarConfigAll(oldSlot), oldToolbars)
|
|
204
|
+
// if most-top effect is closing a modal, skip everything
|
|
205
|
+
if ('DIALOG' === from.component?.tagName) {
|
|
206
|
+
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
207
|
+
from.component.close();
|
|
208
|
+
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
209
|
+
await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
|
|
210
|
+
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
211
|
+
if (from.component.matches('[open]'))
|
|
188
212
|
return;
|
|
189
213
|
await updateCallback();
|
|
190
|
-
return;
|
|
214
|
+
return; // just close modal
|
|
191
215
|
}
|
|
216
|
+
const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
|
|
217
|
+
// console.log(99, to)
|
|
218
|
+
if (!to)
|
|
219
|
+
return console.debug('Can not go backwards.'); // nothing to go back to
|
|
220
|
+
const tv = to.body?.closest('tab-view');
|
|
221
|
+
if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
|
|
222
|
+
if ('bottom-bar' !== tv.tabBarPlacement)
|
|
223
|
+
return;
|
|
224
|
+
// const { toolBarConfig: newToolbars } = getComputedView(to.body)
|
|
192
225
|
// purge
|
|
193
|
-
cleanup(
|
|
194
|
-
// prepare
|
|
195
|
-
for (const ti of
|
|
226
|
+
cleanup(root, 'forwards');
|
|
227
|
+
// prepare new
|
|
228
|
+
for (const ti of to.toolBarConfig ?? [])
|
|
196
229
|
ti.classList.add('bwnn');
|
|
197
|
-
to?.classList.add('bwdd');
|
|
198
|
-
|
|
199
|
-
// prepare
|
|
200
|
-
|
|
230
|
+
to.body?.classList.add('bwdd');
|
|
231
|
+
to.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: to.body }, bubbles: true, composed: true }));
|
|
232
|
+
// prepare old
|
|
233
|
+
const inbetweenModals = froms.map((item) => item.component).filter((item) => !!item && item.matches('dialog[open]')), //queryHostAll(oldPage).filter?.((item) => item.matches('dialog[open]')) ?? [], // FIXME: TEst this, added oldHost too
|
|
234
|
+
toolbarExclusion = 0 < inbetweenModals.length
|
|
235
|
+
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar)')
|
|
236
|
+
: (value, index, array) => value, bodyExclusion = 0 < inbetweenModals.length ? (item) => item?.matches('scroll-view:not(dialog scroll-view)') : (item) => item;
|
|
237
|
+
for (const ti of [...(from.toolBarConfig ?? []), ...(oldToolbars?.filter?.(toolbarExclusion) ?? [])])
|
|
201
238
|
ti.classList.add('bwn');
|
|
202
|
-
from?.
|
|
203
|
-
|
|
239
|
+
for (const nn of [from.body, ...oldBodies?.filter?.(bodyExclusion)]) {
|
|
240
|
+
nn?.classList.add('bwd'); //from?.classList.add('bwd')
|
|
241
|
+
nn?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: nn }, bubbles: true, composed: true }));
|
|
242
|
+
}
|
|
243
|
+
for (const el of inbetweenModals)
|
|
244
|
+
el.close(); // close old inbetween modals
|
|
245
|
+
// capture trans
|
|
204
246
|
console.debug(`⚡️ view-transition-start (${type})`);
|
|
205
247
|
await Promise.allSettled([
|
|
206
|
-
...(from?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
207
|
-
...(to?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
248
|
+
...(from.body?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
249
|
+
...(to.body?.getAnimations().map(({ finished }) => finished) ?? []),
|
|
208
250
|
]);
|
|
209
|
-
// await Promise.allSettled(
|
|
210
|
-
// from.getAnimations().map(({ finished }) => finished)
|
|
211
|
-
// )
|
|
212
|
-
// await Promise.allSettled(to.getAnimations().map(({ finished }) => finished))
|
|
213
251
|
console.debug(`⚡️ view-transition-end (${type})`);
|
|
214
|
-
|
|
215
|
-
if (to?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
|
|
252
|
+
if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
|
|
216
253
|
return;
|
|
217
|
-
cleanup(
|
|
254
|
+
cleanup(root);
|
|
218
255
|
// remove or hide
|
|
219
256
|
await updateCallback();
|
|
220
257
|
}
|
|
221
258
|
};
|
|
222
|
-
|
|
223
|
-
|
|
259
|
+
export const confirmationDialog = async (trigger, title, entries, controller = new AbortController()) => {
|
|
260
|
+
const newAnchorName = `--confirmation-dialog-${self.crypto.randomUUID()}`;
|
|
261
|
+
const dialog = $(`<dialog is="confirmation-dialog">
|
|
262
|
+
${entries.map((item, index) => `<button type="button" tabindex="0" value="${index}">
|
|
263
|
+
<label-view title="${item[0]}"></label-view>
|
|
264
|
+
</button>`)}
|
|
265
|
+
</dialog>`);
|
|
266
|
+
$.prop('anchor-name', newAnchorName, trigger, 'important');
|
|
267
|
+
$.prop('position-anchor', newAnchorName, dialog);
|
|
268
|
+
if (title) {
|
|
269
|
+
const label = $(`<label-view></label-view>`);
|
|
270
|
+
label.setAttribute('title', title);
|
|
271
|
+
dialog.insertAdjacentElement('afterbegin', label);
|
|
272
|
+
}
|
|
273
|
+
trigger.closest('body-view')?.insertAdjacentElement('beforeend', dialog); // dialog.showModal()
|
|
274
|
+
return await new Promise((resolve, reject) => {
|
|
275
|
+
const onClose = (evt) => {
|
|
276
|
+
off();
|
|
277
|
+
resolve(evt.detail.returnValue);
|
|
278
|
+
}, off = onoff('return', onClose, ConfirmationDialog, { once: true }).on();
|
|
279
|
+
// const onAbort = () => {
|
|
280
|
+
// cleanup()
|
|
281
|
+
// reject(new DOMException('aborted', 'AbortError'))
|
|
282
|
+
// }
|
|
283
|
+
// const cleanup = () => {
|
|
284
|
+
// ConfirmationDialog.removeEventListener('close', onClose)
|
|
285
|
+
// // controller.signal.removeEventListener('abort', onAbort)
|
|
286
|
+
// }
|
|
287
|
+
// ConfirmationDialog.addEventListener('close', onClose, { once: true })
|
|
288
|
+
// controller.signal.addEventListener('abort', onAbort, { once: true })
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
void Snapshot.waitReady; // void Snapshot.setOwnConfig()
|
|
292
|
+
// SECTION
|
|
293
|
+
export { ConfirmationDialog, I18n, LifecycleObserver, NavigationPath, Snapshot };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class BorderedButton extends ButtonBase {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: BorderedButton): void;
|
|
6
|
+
static polyfillConnectedCallback(el: BorderedButton): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
export class BorderedButton extends ButtonBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
8
|
+
static polyfillDisconnectedCallback(el) {
|
|
9
|
+
console.debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
10
|
+
CleanupRegistry.unregister(el);
|
|
11
|
+
}
|
|
12
|
+
static polyfillConnectedCallback(el) {
|
|
13
|
+
console.debug(`${BorderedButton.name} ⚡️ connect`);
|
|
14
|
+
el.tabIndex = 0;
|
|
15
|
+
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
16
|
+
}
|
|
17
|
+
static #handleClick = async (evt) => {
|
|
18
|
+
//
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class BorderedProminentButton extends ButtonBase {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: BorderedProminentButton): void;
|
|
6
|
+
static polyfillConnectedCallback(el: BorderedProminentButton): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
export class BorderedProminentButton extends ButtonBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
8
|
+
static polyfillDisconnectedCallback(el) {
|
|
9
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
10
|
+
CleanupRegistry.unregister(el);
|
|
11
|
+
}
|
|
12
|
+
static polyfillConnectedCallback(el) {
|
|
13
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
14
|
+
el.tabIndex = 0;
|
|
15
|
+
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
16
|
+
}
|
|
17
|
+
static #handleClick = async (evt) => {
|
|
18
|
+
//
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ButtonBase } from '../
|
|
1
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
2
2
|
export declare class BorderlessButton extends ButtonBase {
|
|
3
|
+
#private;
|
|
4
|
+
static get observedAttributes(): string[];
|
|
3
5
|
constructor();
|
|
4
|
-
disconnectedCallback(): void;
|
|
5
|
-
connectedCallback(): void;
|
|
6
6
|
static polyfillDisconnectedCallback(el: BorderlessButton): void;
|
|
7
7
|
static polyfillConnectedCallback(el: BorderlessButton): void;
|
|
8
|
-
static
|
|
8
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): Promise<void>;
|
|
9
9
|
}
|
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
3
4
|
export class BorderlessButton extends ButtonBase {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ['role'];
|
|
7
|
+
}
|
|
4
8
|
constructor() {
|
|
5
9
|
super();
|
|
6
10
|
}
|
|
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
11
|
static polyfillDisconnectedCallback(el) {
|
|
16
|
-
|
|
12
|
+
console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
13
|
+
CleanupRegistry.unregister(el);
|
|
17
14
|
}
|
|
18
15
|
static polyfillConnectedCallback(el) {
|
|
19
|
-
|
|
16
|
+
console.debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
17
|
+
el.tabIndex = 0;
|
|
18
|
+
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
19
|
+
}
|
|
20
|
+
static async polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
21
|
+
console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
22
|
+
switch (attributeName) {
|
|
23
|
+
case 'role':
|
|
24
|
+
// let label = this.querySelector(':scope>[slot=label]')
|
|
25
|
+
// if (newValue) {
|
|
26
|
+
// label ??= this.appendChild($(`<label-view slot="label"></label-view>`))
|
|
27
|
+
// label.setAttribute('title', newValue)
|
|
28
|
+
// } else label?.remove()
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
20
31
|
}
|
|
32
|
+
static #handleClick = async (evt) => {
|
|
33
|
+
// alert(99)
|
|
34
|
+
};
|
|
21
35
|
}
|
|
22
|
-
_a = BorderlessButton;
|
|
23
|
-
BorderlessButton.handleClick = async (event) => {
|
|
24
|
-
alert(99);
|
|
25
|
-
};
|
|
@@ -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'>[]): Promise<void>;
|
|
9
|
+
}
|