@swiftwc/ui 0.0.0-dev.4 → 0.0.0-dev.41
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 +697 -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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
export class PlainButton extends ButtonBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
8
|
+
static polyfillDisconnectedCallback(el) {
|
|
9
|
+
if (devFlags.debug)
|
|
10
|
+
console.debug(`${PlainButton.name} ⚡️ disconnect`);
|
|
11
|
+
CleanupRegistry.unregister(el);
|
|
12
|
+
}
|
|
13
|
+
static polyfillConnectedCallback(el) {
|
|
14
|
+
if (devFlags.debug)
|
|
15
|
+
console.debug(`${PlainButton.name} ⚡️ connect`);
|
|
16
|
+
el.tabIndex = 0;
|
|
17
|
+
CleanupRegistry.register(el, onoff('click', PlainButton.#handleClick, el).on());
|
|
18
|
+
}
|
|
19
|
+
static #handleClick = async (evt) => {
|
|
20
|
+
// alert(99)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export declare class ProgressView extends HTMLElement {
|
|
5
|
+
#private;
|
|
6
|
+
static get observedAttributes(): string[];
|
|
7
|
+
get progressViewStyle(): "circular" | "linear";
|
|
8
|
+
get template(): DocumentFragment;
|
|
9
|
+
constructor();
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
+
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
|
+
import { $, devFlags } from '../internal/utils';
|
|
5
|
+
import { Snapshot } from '../snapshot';
|
|
6
|
+
const progressViewStyles = ['circular', 'linear'];
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export class ProgressView extends HTMLElement {
|
|
11
|
+
static get observedAttributes() {
|
|
12
|
+
return ['label', 'current-value-label', 'value'];
|
|
13
|
+
}
|
|
14
|
+
static #templates = new Map();
|
|
15
|
+
#cssStyleObserver;
|
|
16
|
+
#progressViewStyle;
|
|
17
|
+
#lastRenderedStyle;
|
|
18
|
+
#shadowRoot;
|
|
19
|
+
#slots = new Map();
|
|
20
|
+
get progressViewStyle() {
|
|
21
|
+
return this.#progressViewStyle ?? 'circular';
|
|
22
|
+
}
|
|
23
|
+
get template() {
|
|
24
|
+
if (!_a.#templates.has(this.progressViewStyle))
|
|
25
|
+
switch (this.progressViewStyle) {
|
|
26
|
+
case 'linear':
|
|
27
|
+
_a.#templates.set(this.progressViewStyle, $(String.raw `
|
|
28
|
+
<slot></slot>
|
|
29
|
+
<div part="root progress-control progress-line-control"></div>
|
|
30
|
+
<slot name="current-value"></slot>
|
|
31
|
+
`));
|
|
32
|
+
break;
|
|
33
|
+
case 'circular':
|
|
34
|
+
default:
|
|
35
|
+
_a.#templates.set(this.progressViewStyle, $(String.raw `
|
|
36
|
+
<div part="root progress-control progress-circular-control">
|
|
37
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-1"></div>
|
|
38
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-2"></div>
|
|
39
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-3"></div>
|
|
40
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-4"></div>
|
|
41
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-5"></div>
|
|
42
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-6"></div>
|
|
43
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-7"></div>
|
|
44
|
+
<div part="root progress-control progress-circular-blade progress-circular-blade-8"></div>
|
|
45
|
+
</div>
|
|
46
|
+
<slot></slot>
|
|
47
|
+
<slot name="current-value"></slot>
|
|
48
|
+
`));
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return _a.#templates.get(this.progressViewStyle);
|
|
52
|
+
}
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
if (devFlags.debug)
|
|
59
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
60
|
+
CleanupRegistry.unregister(this);
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
if (devFlags.debug)
|
|
64
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
65
|
+
this.#cssStyleObserver = new CSSStyleObserver({
|
|
66
|
+
properties: ['--progress-view-style-index'],
|
|
67
|
+
});
|
|
68
|
+
this.#cssStyleObserver.observe(this, this.#handleStyleChange);
|
|
69
|
+
Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
|
|
70
|
+
}
|
|
71
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
72
|
+
if (devFlags.debug)
|
|
73
|
+
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
74
|
+
switch (name) {
|
|
75
|
+
case 'label': {
|
|
76
|
+
const label = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(`<label-view foreground="secondary"></label-view>`, '>1'));
|
|
77
|
+
if (newValue) {
|
|
78
|
+
label.setAttribute('title', newValue);
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
label.removeAttribute('title');
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case 'current-value-label': {
|
|
85
|
+
let label = this.querySelector(':scope>[slot=current-value]');
|
|
86
|
+
if (newValue) {
|
|
87
|
+
label ??= this.appendChild($(`<label-view slot="current-value" font="callout" foreground="secondary"></label-view>`, '>1'));
|
|
88
|
+
label.setAttribute('title', newValue);
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
label?.remove();
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
#handleStyleChange = () => {
|
|
97
|
+
if (devFlags.debug)
|
|
98
|
+
console.debug(`${_a.name} ⚡️ style`);
|
|
99
|
+
const raw = self.getComputedStyle(this).getPropertyValue('--progress-view-style-index').trim();
|
|
100
|
+
const newValue = progressViewStyles[Number(raw)] ?? progressViewStyles[0];
|
|
101
|
+
if (newValue === this.#progressViewStyle)
|
|
102
|
+
return;
|
|
103
|
+
this.#progressViewStyle = newValue;
|
|
104
|
+
this.#render();
|
|
105
|
+
};
|
|
106
|
+
#render() {
|
|
107
|
+
if (devFlags.debug)
|
|
108
|
+
console.debug(`${_a.name} ⚡️ render (${this.#progressViewStyle})`);
|
|
109
|
+
if (this.#lastRenderedStyle === this.#progressViewStyle)
|
|
110
|
+
return; // skip if already applied
|
|
111
|
+
this.#lastRenderedStyle = this.#progressViewStyle;
|
|
112
|
+
this.#shadowRoot.replaceChildren(document.importNode(this.template, true)); // clear shadow DOM
|
|
113
|
+
CleanupRegistry.unregister(this, 'slots');
|
|
114
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
115
|
+
this.#slots?.set(slot.name, slot);
|
|
116
|
+
CleanupRegistry.register(this, () => {
|
|
117
|
+
this.#slots = new Map();
|
|
118
|
+
}, 'slots');
|
|
119
|
+
switch (this.#progressViewStyle
|
|
120
|
+
//
|
|
121
|
+
) {
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
_a = ProgressView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
2
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
3
|
+
export class ScreenView extends DialogBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
disconnectedCallback() {
|
|
8
|
+
if (devFlags.debug)
|
|
9
|
+
console.debug(`${ScreenView.name} ⚡️ disconnect`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
2
|
+
/**
|
|
3
|
+
* @summary A wrapper to {hv}-stacks
|
|
4
|
+
*/
|
|
5
|
+
export class ScrollViewProxy extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
disconnectedCallback() {
|
|
10
|
+
if (devFlags.debug)
|
|
11
|
+
console.debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
if (devFlags.debug)
|
|
15
|
+
console.debug(`${ScrollViewProxy.name} ⚡️ connect`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ScrollView extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
static get template(): DocumentFragment;
|
|
5
|
+
constructor();
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
9
|
+
centerScrollToElement(child: Element): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { lifecycleObserver } from '../buses';
|
|
3
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
|
+
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
5
|
+
import { $, devFlags, frame, onoff, slowHideShow } from '../internal/utils';
|
|
6
|
+
const observers = new ResizeObserverSingleton();
|
|
7
|
+
export class ScrollView extends HTMLElement {
|
|
8
|
+
static get observedAttributes() {
|
|
9
|
+
return ['navigation-title', 'navigation-inline-title', 'navigation-inline-subtitle', 'navigation-bar-title-display-mode'];
|
|
10
|
+
}
|
|
11
|
+
static #template;
|
|
12
|
+
static get template() {
|
|
13
|
+
return (this.#template ??= $(String.raw `
|
|
14
|
+
<slot></slot>
|
|
15
|
+
<div part="root scroll-view-navbar">
|
|
16
|
+
<div part="root scroll-view-navbar-stack">
|
|
17
|
+
<slot name="top-bar-principal"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div part="root scroll-view-toolbar">
|
|
21
|
+
<div part="root scroll-view-toolbar-stack">
|
|
22
|
+
<slot name="bottom-bar-principal"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>`));
|
|
25
|
+
}
|
|
26
|
+
#shadowRoot;
|
|
27
|
+
#slots = new Map();
|
|
28
|
+
// #navbarPrincipalSlot?: HTMLSlotElement
|
|
29
|
+
#isMidScroll;
|
|
30
|
+
#lastScrollTop = 0;
|
|
31
|
+
// #stopRecordingScrollTop?: boolean = false
|
|
32
|
+
#beforeTabSwapLastScrolltop;
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
36
|
+
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
37
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
38
|
+
this.#slots?.set(slot.name, slot);
|
|
39
|
+
CleanupRegistry.register(this, () => {
|
|
40
|
+
this.#slots = new Map();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
if (devFlags.debug)
|
|
45
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
46
|
+
CleanupRegistry.unregister(this);
|
|
47
|
+
observers.unobserve(this);
|
|
48
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pagehide', { detail: { page: this }, bubbles: true, composed: true })));
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
if (devFlags.debug)
|
|
52
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
53
|
+
CleanupRegistry.register(this, onoff([
|
|
54
|
+
// { types: 'tabreveal', listener: this.#handleTabReveal as EventListener },
|
|
55
|
+
{ types: 'beforetabswap', listener: this.#handleTabBeforeswap },
|
|
56
|
+
], this.closest('tab-view') ?? undefined).on());
|
|
57
|
+
CleanupRegistry.register(this, onoff([
|
|
58
|
+
{ types: 'scroll', listener: this.#handleScroll, addOptions: { passive: true } },
|
|
59
|
+
{ types: 'scrollend', listener: this.#handleScrollend, addOptions: { passive: true } },
|
|
60
|
+
], this).on());
|
|
61
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pageshow', { detail: { page: this }, bubbles: true, composed: true })));
|
|
62
|
+
observers.observe(this, this.#handleMeasure.bind(this));
|
|
63
|
+
// frame(this).then((r) => {
|
|
64
|
+
// if (!r) return
|
|
65
|
+
// let first = true
|
|
66
|
+
// observeResizeEnd(this, () => {
|
|
67
|
+
// if (first) {
|
|
68
|
+
// first = false
|
|
69
|
+
// return
|
|
70
|
+
// }
|
|
71
|
+
// this.dispatchEvent(new CustomEvent('resizeend', { bubbles: true, composed: true }))
|
|
72
|
+
// })
|
|
73
|
+
// })
|
|
74
|
+
}
|
|
75
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
76
|
+
if (devFlags.debug)
|
|
77
|
+
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
78
|
+
switch (name) {
|
|
79
|
+
case 'navigation-inline-title':
|
|
80
|
+
this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
|
|
81
|
+
break;
|
|
82
|
+
case 'navigation-inline-subtitle':
|
|
83
|
+
this.#renderNavTitle(this.getAttribute('navigation-inline-title'), newValue);
|
|
84
|
+
break;
|
|
85
|
+
case 'navigation-title':
|
|
86
|
+
//
|
|
87
|
+
break;
|
|
88
|
+
case 'navigation-bar-title-display-mode':
|
|
89
|
+
if (oldValue === newValue)
|
|
90
|
+
break;
|
|
91
|
+
if (this.closest('[hidden]'))
|
|
92
|
+
break; // iREPAINT ALERT! if (0 === this.offsetHeight + this.offsetWidth) break
|
|
93
|
+
if (!this.#isMidScroll)
|
|
94
|
+
break;
|
|
95
|
+
const title = this.#slots?.get('top-bar-principal')?.assignedElements({ flatten: true })?.at(0);
|
|
96
|
+
slowHideShow('largeinline' === `${oldValue}${newValue}` ? 'show' : 'hide', title);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
#handleScroll = ({ target, type }) => {
|
|
101
|
+
if (devFlags.debug)
|
|
102
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
103
|
+
if (!this.#isMidScroll)
|
|
104
|
+
this.#isMidScroll = true;
|
|
105
|
+
// if (this.#stopRecordingScrollTop) return
|
|
106
|
+
if (!(target instanceof HTMLElement && target))
|
|
107
|
+
return;
|
|
108
|
+
this.#lastScrollTop = target.scrollTop;
|
|
109
|
+
};
|
|
110
|
+
#handleScrollend = (evt) => {
|
|
111
|
+
if (devFlags.debug)
|
|
112
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
113
|
+
if (this.#isMidScroll)
|
|
114
|
+
this.#isMidScroll = false;
|
|
115
|
+
};
|
|
116
|
+
#handleMeasure = (entry) => {
|
|
117
|
+
if (devFlags.debug)
|
|
118
|
+
console.debug(`${_a.name} ⚡️ measure`);
|
|
119
|
+
if (0 === entry.contentRect.width + entry.contentRect.height)
|
|
120
|
+
return;
|
|
121
|
+
if (undefined === this.#beforeTabSwapLastScrolltop)
|
|
122
|
+
return;
|
|
123
|
+
if (this.#beforeTabSwapLastScrolltop === this.#lastScrollTop)
|
|
124
|
+
return;
|
|
125
|
+
// this.#stopRecordingScrollTop = true
|
|
126
|
+
entry.target.scrollTop = this.#beforeTabSwapLastScrolltop;
|
|
127
|
+
// entry.target.scrollTo({
|
|
128
|
+
// top: this.#beforeTabSwapLastScrolltop,
|
|
129
|
+
// behavior: 'smooth',
|
|
130
|
+
// }) //
|
|
131
|
+
// this.#stopRecordingScrollTop = false
|
|
132
|
+
this.#beforeTabSwapLastScrolltop = undefined;
|
|
133
|
+
};
|
|
134
|
+
#handleTabReveal = ({ type, target }) => {
|
|
135
|
+
if (devFlags.debug)
|
|
136
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
137
|
+
if (!(target instanceof HTMLElement && target))
|
|
138
|
+
return;
|
|
139
|
+
if (!target.contains(this))
|
|
140
|
+
return;
|
|
141
|
+
if (this.closest('[hidden]'))
|
|
142
|
+
return;
|
|
143
|
+
// console.log(888, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
|
|
144
|
+
// this.style.setProperty('clip-path', 'inset(50%)')
|
|
145
|
+
// this.style.setProperty('opacity', '0.001')
|
|
146
|
+
// this.style.opacity = '0.001'
|
|
147
|
+
// console.log(99, this.style.opacity)
|
|
148
|
+
// self.requestAnimationFrame(() => {
|
|
149
|
+
// if (undefined === this.#beforeTabSwapLastScrolltop) return
|
|
150
|
+
// if (this.#beforeTabSwapLastScrolltop === this.#lastScrollTop) return
|
|
151
|
+
// this.#stopRecordingScrollTop = true
|
|
152
|
+
// // console.log(999, this.#beforeTabSwapLastScrolltop)
|
|
153
|
+
// // console.log(999, this, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
|
|
154
|
+
// this.scrollTop = this.#beforeTabSwapLastScrolltop
|
|
155
|
+
// // this.scrollTo({
|
|
156
|
+
// // top: this.#beforeTabSwapLastScrolltop,
|
|
157
|
+
// // behavior: 'instant',
|
|
158
|
+
// // }) //
|
|
159
|
+
// this.#stopRecordingScrollTop = false
|
|
160
|
+
// this.#beforeTabSwapLastScrolltop = undefined
|
|
161
|
+
// // self.requestAnimationFrame(() => {
|
|
162
|
+
// // // this.style.removeProperty('opacity')
|
|
163
|
+
// // })
|
|
164
|
+
// })
|
|
165
|
+
};
|
|
166
|
+
#handleTabBeforeswap = ({ type, target }) => {
|
|
167
|
+
if (devFlags.debug)
|
|
168
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
169
|
+
if (!(target instanceof HTMLElement && target))
|
|
170
|
+
return;
|
|
171
|
+
if (!target.contains(this))
|
|
172
|
+
return;
|
|
173
|
+
if (this.closest('[hidden]'))
|
|
174
|
+
return;
|
|
175
|
+
this.#beforeTabSwapLastScrolltop = this.scrollTop; //#lastScrollTop
|
|
176
|
+
};
|
|
177
|
+
centerScrollToElement(child) {
|
|
178
|
+
// scrollTop needed to center child
|
|
179
|
+
const parentRect = this.getBoundingClientRect(), childRect = child.getBoundingClientRect();
|
|
180
|
+
// current scroll + offset of child relative to parent
|
|
181
|
+
const top = this.scrollTop + childRect.top - parentRect.top - parentRect.height / 2 + childRect.height / 2;
|
|
182
|
+
this.scrollTo({
|
|
183
|
+
top,
|
|
184
|
+
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant', // optional: smooth scroll
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
#renderNavTitle = (title, subtitle) => {
|
|
188
|
+
const titleTemplate = `<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view>`, subtitleTemplate = `<label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout"></label-view>`;
|
|
189
|
+
const vStack = this.querySelector(':scope>[slot=top-bar-principal]') ?? this.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal">${titleTemplate}${subtitleTemplate}</v-stack>`, '>1'));
|
|
190
|
+
const titleLabel = vStack.querySelector(':scope>label-view:nth-child(1)') ?? vStack.appendChild($(titleTemplate, '>1'));
|
|
191
|
+
if (title)
|
|
192
|
+
titleLabel.setAttribute('title', title);
|
|
193
|
+
else
|
|
194
|
+
titleLabel?.removeAttribute('title');
|
|
195
|
+
let subtitleLabel = vStack.querySelector(':scope>label-view:nth-child(2)') ?? vStack.appendChild($(subtitleTemplate, '>1'));
|
|
196
|
+
if (subtitle)
|
|
197
|
+
subtitleLabel.setAttribute('title', subtitle);
|
|
198
|
+
else
|
|
199
|
+
subtitleLabel?.removeAttribute('title');
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
_a = ScrollView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class SearchView extends InputBase {
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: InputBase): void;
|
|
6
|
+
static polyfillConnectedCallback(el: InputBase): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { InputBase } from '../namespace-browser/base';
|
|
4
|
+
export class SearchView extends InputBase {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ['role', 'title-key'];
|
|
7
|
+
}
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
static polyfillDisconnectedCallback(el) {
|
|
12
|
+
if (devFlags.debug)
|
|
13
|
+
console.debug(`${SearchView.name} ⚡️ disconnect`);
|
|
14
|
+
CleanupRegistry.unregister(el);
|
|
15
|
+
}
|
|
16
|
+
static polyfillConnectedCallback(el) {
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${SearchView.name} ⚡️ connect`);
|
|
19
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
20
|
+
el.type = 'search';
|
|
21
|
+
}
|
|
22
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
23
|
+
if (devFlags.debug)
|
|
24
|
+
console.debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
25
|
+
const node = target instanceof HTMLInputElement && target;
|
|
26
|
+
if (!node)
|
|
27
|
+
return;
|
|
28
|
+
//
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class SectionView extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
static get template(): DocumentFragment;
|
|
5
|
+
constructor();
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { $, devFlags } from '../internal/utils';
|
|
2
|
+
export class SectionView extends HTMLElement {
|
|
3
|
+
static get observedAttributes() {
|
|
4
|
+
return ['header', 'footer'];
|
|
5
|
+
}
|
|
6
|
+
static #template;
|
|
7
|
+
static get template() {
|
|
8
|
+
return (this.#template ??= $(String.raw `
|
|
9
|
+
<div part="root section-main-stack">
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div part="root section-header-stack">
|
|
13
|
+
<slot name="header"></slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div part="root section-footer-stack">
|
|
16
|
+
<slot name="footer"></slot>
|
|
17
|
+
</div>`));
|
|
18
|
+
// <div class="sticky-sentinel" style="grid-area:sentinel;inline-size:100%;block-size:0.1px;pointer-events:none;"></div>
|
|
19
|
+
}
|
|
20
|
+
#shadowRoot;
|
|
21
|
+
// #observer?: IntersectionObserver
|
|
22
|
+
// #sibling?: HTMLElement
|
|
23
|
+
// #sentinel?: HTMLElement
|
|
24
|
+
// #sentinelIsIntersecting: boolean = false
|
|
25
|
+
// #isIntersecting: boolean = false
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
29
|
+
// Snapshot.waitReady.then(() => {
|
|
30
|
+
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
31
|
+
// this.#sentinel = this.#shadowRoot.querySelector('.sticky-sentinel') ?? undefined
|
|
32
|
+
// })
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
if (devFlags.debug)
|
|
36
|
+
console.debug(`${SectionView.name} ⚡️ disconnect`);
|
|
37
|
+
// if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
|
|
38
|
+
// this.#observer?.unobserve(this)
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
if (devFlags.debug)
|
|
42
|
+
console.debug(`${SectionView.name} ⚡️ connect`);
|
|
43
|
+
// this.#sibling = this.closest('scroll-view') ?? undefined
|
|
44
|
+
// Snapshot.waitReady.then(() => {
|
|
45
|
+
// if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
|
|
46
|
+
// const blockSizeProp = getComputedStyle(this).getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
|
|
47
|
+
// blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 1)
|
|
48
|
+
// this.#observer = new IntersectionObserver(this.#handleIntersect, {
|
|
49
|
+
// root: this.#sibling,
|
|
50
|
+
// rootMargin: `-${blockSize}px 0px 0px 0px`,
|
|
51
|
+
// threshold: [0, 1],
|
|
52
|
+
// })
|
|
53
|
+
// if (this.#sentinel) this.#observer.observe(this.#sentinel)
|
|
54
|
+
// this.#observer.observe(this)
|
|
55
|
+
// })
|
|
56
|
+
}
|
|
57
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
58
|
+
if (devFlags.debug)
|
|
59
|
+
console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
60
|
+
// Snapshot.waitReady.then(() => {
|
|
61
|
+
switch (name) {
|
|
62
|
+
case 'header':
|
|
63
|
+
let header = this.querySelector(':scope>[slot=header]');
|
|
64
|
+
if (newValue) {
|
|
65
|
+
header ??= this.appendChild($(`<header slot="header"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></header>`, '>1'));
|
|
66
|
+
header.querySelector('label-view')?.setAttribute('title', newValue);
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
header?.remove();
|
|
70
|
+
break;
|
|
71
|
+
case 'footer':
|
|
72
|
+
let footer = this.querySelector(':scope>[slot=footer]');
|
|
73
|
+
if (newValue) {
|
|
74
|
+
footer ??= this.appendChild($(`<footer slot="footer"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></footer>`, '>1'));
|
|
75
|
+
footer.querySelector('label-view')?.setAttribute('title', newValue);
|
|
76
|
+
}
|
|
77
|
+
else
|
|
78
|
+
footer?.remove();
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
// })
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class SheetView extends DialogBase {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: SheetView): void;
|
|
6
|
+
static polyfillConnectedCallback(el: SheetView): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { devFlags, onoff } from '../internal/utils';
|
|
3
|
+
import { DialogBase } from '../namespace-browser/base';
|
|
4
|
+
export class SheetView extends DialogBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
8
|
+
static polyfillDisconnectedCallback(el) {
|
|
9
|
+
if (devFlags.debug)
|
|
10
|
+
console.debug(`${SheetView.name} ⚡️ disconnect`);
|
|
11
|
+
CleanupRegistry.unregister(el);
|
|
12
|
+
}
|
|
13
|
+
static polyfillConnectedCallback(el) {
|
|
14
|
+
if (devFlags.debug)
|
|
15
|
+
console.debug(`${SheetView.name} ⚡️ connect`);
|
|
16
|
+
CleanupRegistry.register(el, onoff([
|
|
17
|
+
{ types: 'cancel', listener: this.#handleCancel },
|
|
18
|
+
{ types: 'keydown', listener: SheetView.#handleKeydown },
|
|
19
|
+
], el).on());
|
|
20
|
+
el.autofocus = true;
|
|
21
|
+
}
|
|
22
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
23
|
+
if (devFlags.debug)
|
|
24
|
+
console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
25
|
+
// // NOTE: wait for config
|
|
26
|
+
// Snapshot.waitReady.then(() => {
|
|
27
|
+
// switch (attributeName) {
|
|
28
|
+
// case 'fine-presentation-large-adaptation':
|
|
29
|
+
// const node = target instanceof HTMLDialogElement && target
|
|
30
|
+
// if (!node) break
|
|
31
|
+
// CleanupRegistry.unregister(node, 'mediaquery')
|
|
32
|
+
// if ('bottom-bar' !== target.getAttribute(attributeName ?? '')) break
|
|
33
|
+
// const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${Snapshot.config!['ipad-sheet-view-inline-size']}) and (min-height: ${Snapshot.config!['ipad-sheet-view-height']})`)
|
|
34
|
+
// SheetView.#handleMediaChange(
|
|
35
|
+
// node,
|
|
36
|
+
// new MediaQueryListEvent(`media-change`, {
|
|
37
|
+
// matches: mediaQueryList.matches,
|
|
38
|
+
// })
|
|
39
|
+
// ) // Initial check
|
|
40
|
+
// const handler1 = SheetView.#handleMediaChange.bind(null, node)
|
|
41
|
+
// CleanupRegistry.register(node, onoff('change', handler1 as unknown as EventListener, mediaQueryList).on(), 'mediaquery')
|
|
42
|
+
// break
|
|
43
|
+
// }
|
|
44
|
+
// })
|
|
45
|
+
}
|
|
46
|
+
static #handleKeydown = (evt) => {
|
|
47
|
+
if (devFlags.debug)
|
|
48
|
+
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
49
|
+
if ('Escape' !== evt.key)
|
|
50
|
+
return;
|
|
51
|
+
evt.preventDefault();
|
|
52
|
+
evt.stopImmediatePropagation();
|
|
53
|
+
evt.stopPropagation();
|
|
54
|
+
};
|
|
55
|
+
static #handleCancel = (evt) => {
|
|
56
|
+
if (devFlags.debug)
|
|
57
|
+
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
|
|
58
|
+
if (!evt.cancelable)
|
|
59
|
+
return;
|
|
60
|
+
evt.preventDefault();
|
|
61
|
+
};
|
|
62
|
+
}
|