@swiftwc/ui 0.0.0-dev.11 → 0.0.0-dev.110
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 +24 -10
- package/generated/client/index.js +179 -194
- package/generated/components/alert-dialog.d.ts +11 -0
- package/generated/components/alert-dialog.js +94 -0
- package/generated/components/body-view.d.ts +8 -0
- package/generated/components/body-view.js +6 -2
- package/generated/components/bordered-button.d.ts +10 -0
- package/generated/components/bordered-button.js +36 -3
- package/generated/components/bordered-prominent-button.d.ts +10 -0
- package/generated/components/bordered-prominent-button.js +36 -3
- package/generated/components/borderless-button.d.ts +9 -1
- package/generated/components/borderless-button.js +29 -11
- package/generated/components/color-scheme.d.ts +12 -0
- package/generated/components/color-scheme.js +51 -0
- package/generated/components/confirmation-dialog.d.ts +4 -1
- package/generated/components/confirmation-dialog.js +38 -32
- package/generated/components/content-unavailable.d.ts +30 -0
- package/generated/components/content-unavailable.js +79 -0
- package/generated/components/date-picker.d.ts +21 -15
- package/generated/components/date-picker.js +126 -88
- package/generated/components/detail-placeholder.d.ts +11 -0
- package/generated/components/detail-placeholder.js +15 -0
- package/generated/components/disclosure-group.d.ts +8 -0
- package/generated/components/disclosure-group.js +18 -7
- package/generated/components/fine-tooltip.d.ts +15 -0
- package/generated/components/fine-tooltip.js +108 -0
- package/generated/components/form-view.d.ts +10 -0
- package/generated/components/form-view.js +8 -3
- package/generated/components/glass-button.d.ts +10 -0
- package/generated/components/glass-button.js +36 -3
- package/generated/components/glass-prominent-button.d.ts +10 -0
- package/generated/components/glass-prominent-button.js +36 -3
- package/generated/components/h-divider.d.ts +11 -0
- package/generated/components/h-divider.js +15 -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 +15 -3
- package/generated/components/index.js +15 -3
- package/generated/components/label-view.d.ts +19 -1
- package/generated/components/label-view.js +63 -62
- package/generated/components/labeled-content.d.ts +33 -0
- package/generated/components/labeled-content.js +160 -0
- package/generated/components/list-view.d.ts +14 -0
- package/generated/components/list-view.js +12 -17
- package/generated/components/menu-view.d.ts +12 -1
- package/generated/components/menu-view.js +63 -65
- package/generated/components/navigation-large-title.d.ts +11 -0
- package/generated/components/navigation-large-title.js +11 -5
- package/generated/components/navigation-split-view.d.ts +9 -1
- package/generated/components/navigation-split-view.js +10 -6
- package/generated/components/navigation-stack.d.ts +9 -1
- package/generated/components/navigation-stack.js +13 -11
- package/generated/components/navigation-title.d.ts +11 -1
- package/generated/components/navigation-title.js +58 -55
- package/generated/components/picker-view.d.ts +48 -7
- package/generated/components/picker-view.js +971 -261
- package/generated/components/plain-button.js +3 -3
- package/generated/components/progress-view.d.ts +20 -0
- package/generated/components/progress-view.js +120 -0
- package/generated/components/screen-view.js +2 -1
- 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 +13 -1
- package/generated/components/scroll-view.js +140 -97
- package/generated/components/search-view.d.ts +12 -0
- package/generated/components/search-view.js +24 -0
- package/generated/components/section-view.d.ts +13 -1
- package/generated/components/section-view.js +38 -58
- package/generated/components/sheet-view.d.ts +4 -2
- package/generated/components/sheet-view.js +10 -39
- package/generated/components/sidebar-toggle.d.ts +9 -1
- package/generated/components/sidebar-toggle.js +46 -69
- package/generated/components/sidebar-view.d.ts +3 -0
- package/generated/components/sidebar-view.js +16 -9
- package/generated/components/sticky-container.d.ts +6 -1
- package/generated/components/sticky-container.js +9 -7
- package/generated/components/tab-bar.d.ts +3 -0
- package/generated/components/tab-bar.js +17 -13
- package/generated/components/tab-item.d.ts +3 -0
- package/generated/components/tab-item.js +20 -13
- package/generated/components/tab-view.d.ts +13 -4
- package/generated/components/tab-view.js +25 -89
- package/generated/components/table-view.d.ts +19 -0
- package/generated/components/table-view.js +88 -107
- package/generated/components/text-field.d.ts +19 -6
- package/generated/components/text-field.js +127 -99
- 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 +8 -0
- package/generated/components/tool-bar-item-group.js +22 -4
- package/generated/components/tool-bar-item.d.ts +12 -1
- package/generated/components/tool-bar-item.js +57 -10
- package/generated/components/tool-bar.d.ts +19 -0
- package/generated/components/tool-bar.js +48 -33
- package/generated/components/v-divider.d.ts +11 -0
- package/generated/components/v-divider.js +15 -0
- package/generated/components/v-keyboard.d.ts +8 -1
- package/generated/components/v-keyboard.js +11 -9
- package/generated/components/v-stack.d.ts +20 -0
- package/generated/components/v-stack.js +18 -2
- package/generated/css/index.css +4617 -1266
- package/generated/events/alert-dialog.d.ts +13 -0
- package/generated/events/alert-dialog.js +1 -0
- package/generated/events/confirmation-dialog.d.ts +7 -2
- package/generated/events/date-picker.d.ts +6 -1
- package/generated/events/index.d.ts +2 -0
- package/generated/events/index.js +2 -0
- package/generated/events/lifecycle-observer.d.ts +10 -2
- package/generated/events/picker-view.d.ts +22 -1
- package/generated/events/scroll-view.d.ts +10 -2
- package/generated/events/tab-view.d.ts +38 -8
- package/generated/events/text-field.d.ts +6 -1
- package/generated/events/toggle-view.d.ts +14 -0
- package/generated/events/toggle-view.js +1 -0
- package/generated/i18n/index.d.ts +19 -10
- package/generated/i18n/index.js +79 -54
- package/generated/i18n/locales/el.d.ts +16 -0
- package/generated/i18n/locales/el.js +16 -0
- package/generated/i18n/locales/en.d.ts +16 -0
- package/generated/i18n/locales/en.js +16 -0
- package/generated/i18n/locales/index.d.ts +4 -0
- package/generated/i18n/locales/index.js +4 -0
- package/generated/internal/class/css-style-observer.js +2 -2
- package/generated/internal/class/form-associated-base.d.ts +0 -4
- package/generated/internal/class/form-associated-base.js +22 -39
- 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.js +18 -0
- package/generated/internal/class/navigation-view.d.ts +1 -1
- package/generated/internal/class/navigation-view.js +36 -43
- 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 +1 -1
- package/generated/internal/decorators/custom-element.js +2 -1
- 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/flags.d.ts +4 -0
- package/generated/internal/flags.js +1 -0
- package/generated/internal/privateNamespace.d.ts +10 -0
- package/generated/internal/privateNamespace.js +159 -1
- package/generated/internal/utils/$.d.ts +9 -0
- package/generated/internal/utils/$.js +11 -0
- package/generated/internal/utils/compare-big-decimals.js +7 -17
- 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/index.d.ts +39 -2
- package/generated/internal/utils/index.js +39 -3
- 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.js +6 -9
- package/generated/internal/utils/list-active.js +67 -12
- package/generated/internal/utils/touch-glass.js +5 -5
- 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 +12 -3
- package/generated/namespace-browser/base.js +41 -18
- package/generated/namespace-browser/event.d.ts +10 -0
- package/generated/namespace-browser/event.js +1 -0
- package/generated/snapshot/index.d.ts +3 -1
- package/generated/snapshot/index.js +23 -2
- 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 +32 -7
- package/scss/_components.scss +15 -0
- package/scss/_functions.scss +10 -0
- package/scss/_maps.scss +293 -0
- package/scss/_mixins.scss +4 -0
- package/scss/_transitions.scss +6 -1
- package/scss/_utils.scss +2 -0
- package/scss/_vars.scss +9 -115
- package/scss/base/_layout.scss +17 -7
- package/scss/base/_reboot.scss +34 -1
- package/scss/base/_root.scss +143 -124
- package/scss/colors/_index.scss +328 -88
- package/scss/components/_alert-dialog.scss +111 -0
- package/scss/components/_bordered-button.scss +37 -0
- package/scss/components/_bordered-prominent-button.scss +46 -0
- package/scss/components/_borderless-button.scss +26 -0
- package/scss/components/_confirmation-dialog.scss +41 -49
- package/scss/components/_content-unavailable.scss +57 -0
- package/scss/components/_date-picker.scss +15 -15
- package/scss/components/_detail-placeholder.scss +1 -3
- package/scss/components/_disclosure-group.scss +85 -34
- package/scss/components/_fine-tooltip.scss +84 -0
- package/scss/components/_form-view.scss +63 -24
- package/scss/components/_glass-button.scss +37 -0
- package/scss/components/_glass-prominent-button.scss +47 -0
- package/scss/components/_group-box.scss +27 -0
- package/scss/components/_h-flex-stack.scss +23 -0
- package/scss/components/_h-stack.scss +6 -17
- package/scss/components/_image-view.scss +20 -0
- package/scss/components/_index.scss +69 -36
- package/scss/components/_label-view copy.scss.txt +420 -0
- package/scss/components/_label-view.scss +105 -120
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_labeled-content.scss +67 -1
- package/scss/components/_list-view.scss +70 -29
- package/scss/components/_menu-view.scss +96 -61
- package/scss/components/_navigation-large-title.scss +23 -0
- package/scss/components/_navigation-split-view.scss +3 -3
- package/scss/components/_navigation-title.scss +1 -1
- package/scss/components/_picker-view.scss +270 -63
- package/scss/components/_plain-button.scss +8 -0
- package/scss/components/_progress-view.scss +98 -0
- package/scss/components/_scroll-view-proxy.scss +24 -22
- package/scss/components/_scroll-view-toolbars.scss +8 -2
- package/scss/components/_scroll-view.scss +16 -0
- package/scss/components/_search-view.scss +23 -0
- package/scss/components/_section-view.scss +23 -22
- package/scss/components/_sheet-view.scss +16 -6
- package/scss/components/_sidebar-toggle.scss +1 -4
- package/scss/components/_sticky-container.scss +1 -1
- package/scss/components/_tab-bar.scss +17 -3
- package/scss/components/_tab-view.scss +12 -2
- package/scss/components/_table-column.scss +4 -2
- package/scss/components/_table-row.scss +71 -3
- package/scss/components/_table-view.scss +27 -18
- package/scss/components/_text-field.scss +37 -17
- package/scss/components/_text-view.scss +57 -0
- package/scss/components/_toggle-view.scss +171 -0
- package/scss/components/_tool-bar-item.scss +34 -82
- package/scss/components/_tool-bar.scss +77 -57
- package/scss/components/_v-stack.scss +8 -2
- package/scss/final/_touch-glass.scss +31 -0
- package/scss/mixins/_button.scss +44 -0
- package/scss/mixins/_color.scss +16 -0
- package/scss/mixins/_dialog.scss +1 -0
- package/scss/mixins/_index.scss +73 -5
- package/scss/placeholders/_buttons.scss +46 -11
- package/scss/placeholders/_lists.scss +159 -126
- package/scss/transitions/_alert-dialog.scss +18 -0
- package/scss/transitions/_confirmation-dialog.scss +8 -0
- package/scss/transitions/_fine-tooltip.scss +21 -0
- package/scss/transitions/_menu-view.scss +17 -15
- package/scss/transitions/_progress-view.scss +23 -0
- package/scss/transitions/_sheet-view.scss +30 -0
- package/scss/transitions/_tab-bar.scss +6 -5
- package/scss/utils/_background.scss +52 -0
- package/scss/utils/_frame.scss +59 -40
- package/scss/utils/_index.scss +45 -56
- package/scss/utils/_scroll-view.scss +1 -1
- package/scss/utils/_spacing.scss +1 -1
- package/scss/utils/_stacks.scss +34 -164
- package/web-components.css-data/en.json +28 -0
- package/web-components.html-data/en.json +2456 -166
- package/generated/confirmation-dialog/index.d.ts +0 -1
- package/generated/confirmation-dialog/index.js +0 -1
- package/generated/internal/utils/cash/index.d.ts +0 -22
- package/generated/internal/utils/cash/index.js +0 -23
- package/generated/lifecycle-observer/index.d.ts +0 -1
- package/generated/lifecycle-observer/index.js +0 -1
- package/scss/transitions/_dialog.scss +0 -28
- /package/generated/internal/utils/{cash/ancestors.d.ts → ancestors.d.ts} +0 -0
- /package/generated/internal/utils/{cash/ancestors.js → ancestors.js} +0 -0
- /package/generated/internal/utils/{cash/next-all.d.ts → next-all.d.ts} +0 -0
- /package/generated/internal/utils/{cash/next-all.js → next-all.js} +0 -0
- /package/generated/internal/utils/{cash/next.d.ts → next.d.ts} +0 -0
- /package/generated/internal/utils/{cash/next.js → next.js} +0 -0
- /package/generated/internal/utils/{cash/prev-all.d.ts → prev-all.d.ts} +0 -0
- /package/generated/internal/utils/{cash/prev-all.js → prev-all.js} +0 -0
- /package/generated/internal/utils/{cash/prev.d.ts → prev.d.ts} +0 -0
- /package/generated/internal/utils/{cash/prev.js → prev.js} +0 -0
- /package/generated/internal/utils/{cash/prop.d.ts → prop.d.ts} +0 -0
- /package/generated/internal/utils/{cash/prop.js → prop.js} +0 -0
- /package/generated/internal/utils/{cash/siblings.d.ts → siblings.d.ts} +0 -0
- /package/generated/internal/utils/{cash/siblings.js → siblings.js} +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary A container view that wraps a scroll view, marking it as a screen your app can navigate to.
|
|
3
|
+
*/
|
|
1
4
|
export declare class BodyView extends HTMLElement {
|
|
2
5
|
constructor();
|
|
3
6
|
disconnectedCallback(): void;
|
|
4
7
|
connectedCallback(): void;
|
|
5
8
|
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'body-view': BodyView;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A container view that wraps a scroll view, marking it as a screen your app can navigate to.
|
|
4
|
+
*/
|
|
1
5
|
export class BodyView extends HTMLElement {
|
|
2
6
|
constructor() {
|
|
3
7
|
super();
|
|
4
8
|
}
|
|
5
9
|
disconnectedCallback() {
|
|
6
|
-
|
|
10
|
+
debug(`${BodyView.name} ⚡️ disconnect`);
|
|
7
11
|
}
|
|
8
12
|
connectedCallback() {
|
|
9
|
-
|
|
13
|
+
debug(`${BodyView.name} ⚡️ connect`);
|
|
10
14
|
}
|
|
11
15
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
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
|
+
*/
|
|
2
10
|
export declare class BorderedButton extends ButtonBase {
|
|
3
11
|
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
4
13
|
constructor();
|
|
5
14
|
static polyfillDisconnectedCallback(el: BorderedButton): void;
|
|
6
15
|
static polyfillConnectedCallback(el: BorderedButton): void;
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
7
17
|
}
|
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
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
|
+
*/
|
|
4
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
|
+
}
|
|
5
24
|
constructor() {
|
|
6
25
|
super();
|
|
7
26
|
}
|
|
8
27
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
28
|
+
debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
10
29
|
CleanupRegistry.unregister(el);
|
|
11
30
|
}
|
|
12
31
|
static polyfillConnectedCallback(el) {
|
|
13
|
-
|
|
32
|
+
debug(`${BorderedButton.name} ⚡️ connect`);
|
|
14
33
|
el.tabIndex = 0;
|
|
15
34
|
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
16
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
|
+
}
|
|
17
50
|
static #handleClick = async (evt) => {
|
|
18
51
|
//
|
|
19
52
|
};
|
|
@@ -1,7 +1,17 @@
|
|
|
1
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
|
+
*/
|
|
2
10
|
export declare class BorderedProminentButton extends ButtonBase {
|
|
3
11
|
#private;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
4
13
|
constructor();
|
|
5
14
|
static polyfillDisconnectedCallback(el: BorderedProminentButton): void;
|
|
6
15
|
static polyfillConnectedCallback(el: BorderedProminentButton): void;
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
7
17
|
}
|
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
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
|
+
*/
|
|
4
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
|
+
}
|
|
5
24
|
constructor() {
|
|
6
25
|
super();
|
|
7
26
|
}
|
|
8
27
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
28
|
+
debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
10
29
|
CleanupRegistry.unregister(el);
|
|
11
30
|
}
|
|
12
31
|
static polyfillConnectedCallback(el) {
|
|
13
|
-
|
|
32
|
+
debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
14
33
|
el.tabIndex = 0;
|
|
15
34
|
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
16
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
|
+
}
|
|
17
50
|
static #handleClick = async (evt) => {
|
|
18
51
|
//
|
|
19
52
|
};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
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
|
+
*/
|
|
2
10
|
export declare class BorderlessButton extends ButtonBase {
|
|
3
11
|
#private;
|
|
4
12
|
static get observedAttributes(): string[];
|
|
5
13
|
constructor();
|
|
6
14
|
static polyfillDisconnectedCallback(el: BorderlessButton): void;
|
|
7
15
|
static polyfillConnectedCallback(el: BorderlessButton): void;
|
|
8
|
-
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]):
|
|
16
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
9
17
|
}
|
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A control that starts an action. Styled without any borders.
|
|
7
|
+
*
|
|
8
|
+
* @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`
|
|
9
|
+
*
|
|
10
|
+
* @slot overlay
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
4
13
|
export class BorderlessButton extends ButtonBase {
|
|
5
14
|
static get observedAttributes() {
|
|
6
|
-
return [
|
|
15
|
+
return [
|
|
16
|
+
/**
|
|
17
|
+
* A value that describes the purpose of a button
|
|
18
|
+
* @type {destructive|confirm}
|
|
19
|
+
*/
|
|
20
|
+
'role',
|
|
21
|
+
'title-key',
|
|
22
|
+
];
|
|
7
23
|
}
|
|
8
24
|
constructor() {
|
|
9
25
|
super();
|
|
10
26
|
}
|
|
11
27
|
static polyfillDisconnectedCallback(el) {
|
|
12
|
-
|
|
28
|
+
debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
13
29
|
CleanupRegistry.unregister(el);
|
|
14
30
|
}
|
|
15
31
|
static polyfillConnectedCallback(el) {
|
|
16
|
-
|
|
32
|
+
debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
17
33
|
el.tabIndex = 0;
|
|
18
34
|
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
19
35
|
}
|
|
20
|
-
static
|
|
21
|
-
|
|
36
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
37
|
+
debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
38
|
+
const node = target instanceof HTMLButtonElement;
|
|
39
|
+
if (!node)
|
|
40
|
+
return;
|
|
22
41
|
switch (attributeName) {
|
|
42
|
+
case 'title-key':
|
|
23
43
|
case 'role':
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// label.setAttribute('title', newValue)
|
|
28
|
-
// } else label?.remove()
|
|
44
|
+
Snapshot.waitReady.then(() => {
|
|
45
|
+
ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
|
|
46
|
+
});
|
|
29
47
|
break;
|
|
30
48
|
}
|
|
31
49
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ColorScheme extends HTMLElement {
|
|
2
|
+
static get observedAttributes(): string[];
|
|
3
|
+
constructor();
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'color-scheme': ColorScheme;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
2
|
+
export class ColorScheme extends HTMLElement {
|
|
3
|
+
static get observedAttributes() {
|
|
4
|
+
return ['dark'];
|
|
5
|
+
}
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
debug(`${ColorScheme.name} ⚡️ connect`);
|
|
11
|
+
this.hidden = true;
|
|
12
|
+
this.inert = true;
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
debug(`${ColorScheme.name} ⚡️ disconnect`);
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
+
debug(`${ColorScheme.name} ⚡️ attr-change [${name}]`);
|
|
19
|
+
// self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
|
|
20
|
+
if (newValue)
|
|
21
|
+
self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
|
|
22
|
+
// @property --canvas {
|
|
23
|
+
// syntax: "<color>";
|
|
24
|
+
// initial-value: oklch(100% 0 0deg);
|
|
25
|
+
// inherits: false;
|
|
26
|
+
// }
|
|
27
|
+
// @media (prefers-color-scheme: dark) {
|
|
28
|
+
// @property --canvas {
|
|
29
|
+
// syntax: "<color>";
|
|
30
|
+
// initial-value: oklch(0% 0 0deg);
|
|
31
|
+
// inherits: false;
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
34
|
+
// @property --canvastext {
|
|
35
|
+
// syntax: "<color>";
|
|
36
|
+
// initial-value: oklch(0% 0 0deg);
|
|
37
|
+
// inherits: false;
|
|
38
|
+
// }
|
|
39
|
+
// @media (prefers-color-scheme: dark) {
|
|
40
|
+
// @property --canvastext {
|
|
41
|
+
// syntax: "<color>";
|
|
42
|
+
// initial-value: oklch(100% 0 0deg);
|
|
43
|
+
// inherits: false;
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// if (CSS.supports('interpolate-size', 'allow-keywords')) {
|
|
47
|
+
// self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
|
|
48
|
+
if (null !== newValue)
|
|
49
|
+
self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A dialog that asks the user to confirm an action. Use it from the client module like `await confirmationDialog(trigger, 'Permanently erase the items in the Trash?')`.
|
|
4
|
+
*/
|
|
2
5
|
export declare class ConfirmationDialog extends DialogBase {
|
|
3
6
|
#private;
|
|
4
7
|
static get observedAttributes(): string[];
|
|
5
8
|
constructor();
|
|
6
9
|
static polyfillDisconnectedCallback(el: ConfirmationDialog): void;
|
|
7
10
|
static polyfillConnectedCallback(el: ConfirmationDialog): void;
|
|
8
|
-
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]):
|
|
11
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
9
12
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { confirmationDialog } from '../buses';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import {
|
|
3
|
+
import { debug, isInside, onoff, touchGlass } from '../internal/utils';
|
|
4
4
|
import { DialogBase } from '../namespace-browser/base';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A dialog that asks the user to confirm an action. Use it from the client module like `await confirmationDialog(trigger, 'Permanently erase the items in the Trash?')`.
|
|
7
|
+
*/
|
|
5
8
|
export class ConfirmationDialog extends DialogBase {
|
|
6
9
|
static get observedAttributes() {
|
|
7
10
|
return ['anchor'];
|
|
@@ -10,38 +13,41 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
10
13
|
super();
|
|
11
14
|
}
|
|
12
15
|
static polyfillDisconnectedCallback(el) {
|
|
13
|
-
|
|
16
|
+
debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
|
|
14
17
|
const positionAnchor = el.style.getPropertyValue('position-anchor');
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
|
|
19
|
+
el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
|
|
17
20
|
CleanupRegistry.unregister(el);
|
|
18
|
-
|
|
21
|
+
confirmationDialog.dispatchEvent(new CustomEvent('confirmation:return', {
|
|
19
22
|
detail: { returnValue: el.returnValue, positionAnchor },
|
|
20
23
|
bubbles: true,
|
|
21
24
|
composed: true,
|
|
22
25
|
}));
|
|
23
26
|
}
|
|
24
27
|
static polyfillConnectedCallback(el) {
|
|
25
|
-
|
|
28
|
+
debug(`${ConfirmationDialog.name} ⚡️ connect`);
|
|
26
29
|
CleanupRegistry.register(el, onoff([
|
|
27
30
|
{ types: 'click', listener: this.#handleDialogClick },
|
|
28
31
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
29
32
|
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
30
33
|
], el).on());
|
|
31
|
-
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (
|
|
32
|
-
if (
|
|
34
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
35
|
+
if (!(target instanceof HTMLElement))
|
|
36
|
+
return true;
|
|
37
|
+
if (target.matches('[is=confirmation-dialog]'))
|
|
33
38
|
return false;
|
|
34
39
|
// if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
|
|
35
40
|
return true;
|
|
36
41
|
}), el).on());
|
|
37
|
-
|
|
42
|
+
debug(`${ConfirmationDialog.name} ⚡️ will-open`);
|
|
38
43
|
el.removeAttribute('closing');
|
|
39
44
|
el.scrollTop = 0;
|
|
40
45
|
el.returnValue = '';
|
|
46
|
+
el.autofocus = true;
|
|
41
47
|
el.showModal();
|
|
42
48
|
}
|
|
43
|
-
static
|
|
44
|
-
|
|
49
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
50
|
+
debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
45
51
|
// const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
|
|
46
52
|
switch (attributeName) {
|
|
47
53
|
case 'label':
|
|
@@ -54,16 +60,15 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
static #handleDialogClick = (evt) => {
|
|
57
|
-
|
|
58
|
-
const dialog = evt
|
|
59
|
-
if (!dialog)
|
|
63
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
64
|
+
const { target, currentTarget: dialog } = evt;
|
|
65
|
+
if (!(dialog instanceof HTMLDialogElement))
|
|
60
66
|
return;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const button = target?.closest('button');
|
|
67
|
+
if (!(target instanceof HTMLElement))
|
|
68
|
+
return;
|
|
69
|
+
if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
|
|
70
|
+
return dialog.requestClose(); // click outside
|
|
71
|
+
const button = target.closest('button');
|
|
67
72
|
if (!button)
|
|
68
73
|
return;
|
|
69
74
|
button.scrollIntoView({
|
|
@@ -72,20 +77,20 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
72
77
|
inline: 'nearest',
|
|
73
78
|
});
|
|
74
79
|
dialog.returnValue = button.value;
|
|
75
|
-
dialog
|
|
76
|
-
evt
|
|
77
|
-
evt
|
|
80
|
+
dialog.requestClose(button.value);
|
|
81
|
+
evt.stopPropagation();
|
|
82
|
+
evt.stopImmediatePropagation();
|
|
78
83
|
};
|
|
79
84
|
static #handleDialogCancel = (evt) => {
|
|
80
|
-
|
|
85
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
81
86
|
if (!evt.cancelable)
|
|
82
87
|
return;
|
|
83
|
-
const target = evt
|
|
84
|
-
if (!target)
|
|
88
|
+
const { target } = evt;
|
|
89
|
+
if (!(target instanceof HTMLDialogElement))
|
|
85
90
|
return;
|
|
86
91
|
evt.preventDefault();
|
|
87
92
|
target.inert = true;
|
|
88
|
-
|
|
93
|
+
debug(`${ConfirmationDialog.name} ⚡️ will-close`);
|
|
89
94
|
target.setAttribute('closing', '');
|
|
90
95
|
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
91
96
|
if (!target.hasAttribute('closing'))
|
|
@@ -94,9 +99,10 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
94
99
|
target.removeAttribute('closing');
|
|
95
100
|
});
|
|
96
101
|
};
|
|
97
|
-
static #handleDialogClose = (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
103
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
|
|
104
|
+
if (!(target instanceof HTMLDialogElement))
|
|
105
|
+
return;
|
|
106
|
+
target.remove();
|
|
101
107
|
};
|
|
102
108
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
3
|
+
*
|
|
4
|
+
* @example <content-unavailable search></content-unavailable>
|
|
5
|
+
*
|
|
6
|
+
* @example <content-unavailable search="foo"></content-unavailable>
|
|
7
|
+
*
|
|
8
|
+
* @example <content-unavailable padding><label-view title="No Mail"><i class="ph ph-tray" slot="icon" foreground="secondary"></i></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
|
|
9
|
+
*
|
|
10
|
+
* @example <content-unavailable padding><label-view title="No Mail"><svg slot="icon" foreground="secondary" ...>...</svg></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
|
|
11
|
+
*
|
|
12
|
+
* @slot — The default slot.
|
|
13
|
+
* @slot description
|
|
14
|
+
* @slot actions
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContentUnavailable extends HTMLElement {
|
|
18
|
+
#private;
|
|
19
|
+
static get observedAttributes(): string[];
|
|
20
|
+
static get template(): DocumentFragment;
|
|
21
|
+
constructor();
|
|
22
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
connectedCallback(): void;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
'content-unavailable': ContentUnavailable;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { I18n } from '../i18n';
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { $, debug, onoff } from '../internal/utils';
|
|
4
|
+
import { html } from '../tpl';
|
|
5
|
+
/**
|
|
6
|
+
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
7
|
+
*
|
|
8
|
+
* @example <content-unavailable search></content-unavailable>
|
|
9
|
+
*
|
|
10
|
+
* @example <content-unavailable search="foo"></content-unavailable>
|
|
11
|
+
*
|
|
12
|
+
* @example <content-unavailable padding><label-view title="No Mail"><i class="ph ph-tray" slot="icon" foreground="secondary"></i></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
|
|
13
|
+
*
|
|
14
|
+
* @example <content-unavailable padding><label-view title="No Mail"><svg slot="icon" foreground="secondary" ...>...</svg></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
|
|
15
|
+
*
|
|
16
|
+
* @slot — The default slot.
|
|
17
|
+
* @slot description
|
|
18
|
+
* @slot actions
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export class ContentUnavailable extends HTMLElement {
|
|
22
|
+
static get observedAttributes() {
|
|
23
|
+
return ['search'];
|
|
24
|
+
}
|
|
25
|
+
static #template;
|
|
26
|
+
static get template() {
|
|
27
|
+
return (this.#template ??= $(html `<div part="root content-unavailable-title-stack">
|
|
28
|
+
<slot></slot>
|
|
29
|
+
</div>
|
|
30
|
+
<div part="root content-unavailable-description-stack">
|
|
31
|
+
<slot name="description"></slot>
|
|
32
|
+
</div>
|
|
33
|
+
<div part="root content-unavailable-actions-stack">
|
|
34
|
+
<slot name="actions"></slot>
|
|
35
|
+
</div>`));
|
|
36
|
+
}
|
|
37
|
+
#shadowRoot;
|
|
38
|
+
#slots;
|
|
39
|
+
constructor() {
|
|
40
|
+
super();
|
|
41
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
42
|
+
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
43
|
+
this.#slots = {
|
|
44
|
+
'': this.#shadowRoot.querySelector('slot:not([name])') ?? undefined,
|
|
45
|
+
description: this.#shadowRoot.querySelector('slot[name="description"]') ?? undefined,
|
|
46
|
+
actions: this.#shadowRoot.querySelector('slot[name="actions"]') ?? undefined,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
50
|
+
debug(`${ContentUnavailable.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
51
|
+
switch (name) {
|
|
52
|
+
case 'search':
|
|
53
|
+
if (oldValue === newValue)
|
|
54
|
+
break;
|
|
55
|
+
this.#renderSearch(newValue);
|
|
56
|
+
CleanupRegistry.unregister(this, 'i18n');
|
|
57
|
+
CleanupRegistry.register(this, onoff('localechange', () => {
|
|
58
|
+
this.#renderSearch(this.getAttribute('search'));
|
|
59
|
+
}, I18n.on).on(), 'i18n');
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
debug(`${ContentUnavailable.name} ⚡️ disconnect`);
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
debug(`${ContentUnavailable.name} ⚡️ connect`);
|
|
68
|
+
}
|
|
69
|
+
#renderSearch = (search) => {
|
|
70
|
+
const titleLabel = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(html `<label-view><i class="ph ph-magnifying-glass" slot="icon" foreground="secondary"></i></label-view>`, '>1')), descText = this.querySelector(':scope>[slot=description]') ?? this.appendChild($(html `<label-view foreground="secondary" slot="description"></label-view>`, '>1'));
|
|
71
|
+
if (search) {
|
|
72
|
+
const interpolate = (text, vars) => text.replaceAll(/\{(\w+)\}/g, (_, key) => vars[key] ?? '');
|
|
73
|
+
titleLabel.setAttribute('title', interpolate(I18n.t('SearchUnavailableContent').Label, { search }));
|
|
74
|
+
}
|
|
75
|
+
else
|
|
76
|
+
titleLabel?.setAttribute('title', I18n.t('SearchUnavailableContent').NoLabel);
|
|
77
|
+
descText.setAttribute('title', I18n.t('SearchUnavailableContent').Description);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { FormAssociatedBase } from '../internal/class/form-associated-base';
|
|
2
2
|
declare const datePickerStyles: readonly ["graphical", "field", "automatic"];
|
|
3
3
|
export type DatePickerStyle = (typeof datePickerStyles)[number];
|
|
4
|
+
/**
|
|
5
|
+
* @summary A control that selects an absolute date.
|
|
6
|
+
*/
|
|
4
7
|
export declare class DatePicker extends FormAssociatedBase {
|
|
5
8
|
#private;
|
|
6
9
|
static get observedAttributes(): string[];
|
|
7
10
|
get template(): DocumentFragment;
|
|
8
11
|
constructor();
|
|
9
|
-
connectedCallback(): void;
|
|
10
|
-
disconnectedCallback(): void;
|
|
11
12
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
connectedCallback(): void;
|
|
12
15
|
get datePickerStyle(): DatePickerStyle;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
day: string;
|
|
17
|
-
};
|
|
18
|
-
set selection(v: {
|
|
19
|
-
year: string;
|
|
20
|
-
month: string;
|
|
21
|
-
day: string;
|
|
22
|
-
});
|
|
16
|
+
/**
|
|
17
|
+
* Form participation property
|
|
18
|
+
*/
|
|
23
19
|
get name(): string;
|
|
24
20
|
get value(): {
|
|
25
21
|
year: string;
|
|
26
22
|
month: string;
|
|
27
23
|
day: string;
|
|
28
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns the value as a Date object.
|
|
27
|
+
* @type {Date|null}
|
|
28
|
+
*/
|
|
29
29
|
get valueAsDate(): Date | null;
|
|
30
30
|
get minimum(): {
|
|
31
31
|
year: string;
|
|
@@ -39,8 +39,14 @@ export declare class DatePicker extends FormAssociatedBase {
|
|
|
39
39
|
} | null;
|
|
40
40
|
setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
|
|
41
41
|
setCustomValidity: (message: string) => void;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
formStateRestoreCallback(state: string, reason: string): void;
|
|
43
|
+
formAssociatedCallback(form: HTMLFormElement): void;
|
|
44
|
+
formDisabledCallback(disabled: boolean): void;
|
|
45
|
+
formResetCallback(): void;
|
|
46
|
+
}
|
|
47
|
+
declare global {
|
|
48
|
+
interface HTMLElementTagNameMap {
|
|
49
|
+
'date-picker': DatePicker;
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
export {};
|