@swiftwc/ui 0.0.0-dev.102 → 0.0.0-dev.105
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/client/index.js +5 -5
- package/generated/components/alert-dialog.js +10 -17
- package/generated/components/body-view.js +3 -5
- package/generated/components/bordered-button.js +5 -7
- package/generated/components/bordered-prominent-button.js +5 -7
- package/generated/components/borderless-button.js +5 -7
- package/generated/components/color-scheme.js +4 -7
- package/generated/components/confirmation-dialog.js +10 -17
- package/generated/components/content-unavailable.js +5 -7
- package/generated/components/date-picker.js +14 -25
- package/generated/components/detail-placeholder.js +4 -8
- package/generated/components/disclosure-group.js +6 -9
- package/generated/components/fine-tooltip.js +5 -7
- package/generated/components/form-view.js +4 -5
- package/generated/components/glass-button.js +5 -7
- package/generated/components/glass-prominent-button.js +5 -7
- package/generated/components/h-divider.d.ts +11 -0
- package/generated/components/h-divider.js +15 -0
- package/generated/components/h-stack.js +3 -5
- package/generated/components/image-view.js +5 -7
- package/generated/components/index.d.ts +2 -0
- package/generated/components/index.js +2 -0
- package/generated/components/label-view.js +5 -7
- package/generated/components/labeled-content.js +5 -7
- package/generated/components/list-view.js +4 -5
- package/generated/components/menu-view.js +11 -19
- package/generated/components/navigation-large-title.js +6 -9
- package/generated/components/navigation-split-view.js +4 -7
- package/generated/components/navigation-stack.js +4 -7
- package/generated/components/navigation-title.js +4 -7
- package/generated/components/picker-view.js +62 -62
- package/generated/components/plain-button.js +4 -5
- package/generated/components/progress-view.js +7 -11
- package/generated/components/screen-view.js +2 -3
- package/generated/components/scroll-view-proxy.js +3 -5
- package/generated/components/scroll-view.js +10 -16
- package/generated/components/search-view.js +5 -7
- package/generated/components/section-view.js +5 -7
- package/generated/components/sheet-view.js +7 -11
- package/generated/components/sidebar-toggle.js +6 -9
- package/generated/components/sidebar-view.js +3 -3
- package/generated/components/sticky-container.js +4 -5
- package/generated/components/tab-bar.js +5 -7
- package/generated/components/tab-item.js +9 -15
- package/generated/components/tab-view.js +9 -14
- package/generated/components/table-view.js +7 -11
- package/generated/components/text-field.js +11 -19
- package/generated/components/text-view.js +4 -7
- package/generated/components/toggle-view.js +14 -25
- package/generated/components/tool-bar-item-group.js +3 -5
- package/generated/components/tool-bar-item.js +5 -7
- package/generated/components/tool-bar.js +5 -7
- package/generated/components/v-divider.d.ts +11 -0
- package/generated/components/v-divider.js +15 -0
- package/generated/components/v-keyboard.js +9 -12
- package/generated/components/v-stack.js +3 -5
- package/generated/css/index.css +15 -7
- package/generated/internal/class/css-style-observer.js +3 -3
- package/generated/internal/class/form-associated-base.js +5 -7
- package/generated/internal/class/navigation-view.js +4 -5
- package/generated/internal/decorators/adaptive-slot.js +5 -7
- package/generated/internal/decorators/microtask-on-connected.d.ts +2 -2
- package/generated/internal/decorators/microtask-on-connected.js +2 -2
- package/generated/internal/flags.json +3 -0
- package/generated/internal/privateNamespace.js +12 -21
- package/generated/internal/utils/$.d.ts +9 -0
- package/generated/internal/utils/$.js +11 -0
- package/generated/internal/utils/index.d.ts +35 -1
- package/generated/internal/utils/index.js +35 -4
- package/generated/snapshot/index.js +4 -5
- package/package.json +10 -7
- package/scss/components/_index.scss +3 -1
- package/scss/components/_picker-view.scss +2 -2
- package/web-components.html-data/en.json +8 -0
- package/generated/internal/utils/cash/index.d.ts +0 -24
- package/generated/internal/utils/cash/index.js +0 -27
- /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,17 +1,17 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
3
|
import { I18n } from '../i18n';
|
|
3
4
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
5
|
import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
|
|
5
6
|
import { MutationObserverSet } from '../internal/class/mutation-observer-set';
|
|
6
7
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
7
8
|
import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
8
|
-
import { $,
|
|
9
|
+
import { $, ancestors, kebabCase, onoff } from '../internal/utils';
|
|
9
10
|
import { queryMorph } from '../morphdom';
|
|
10
11
|
import { html, render } from '../tpl';
|
|
11
12
|
const pickerStyles = ['menu', 'inline', 'navigation-link', 'sheet', 'automatic'];
|
|
12
13
|
const update = (path, node, overwrite = true) => {
|
|
13
|
-
|
|
14
|
-
console.debug(`PickerView: update`);
|
|
14
|
+
DEBUG && console.debug(`PickerView: update`);
|
|
15
15
|
if (!(path instanceof NavigationPath))
|
|
16
16
|
throw new Error('invalid view');
|
|
17
17
|
const { component, page } = path;
|
|
@@ -23,8 +23,7 @@ const update = (path, node, overwrite = true) => {
|
|
|
23
23
|
page.insertAdjacentElement(position, node);
|
|
24
24
|
};
|
|
25
25
|
const reflectSpawnedPage = (current, source) => {
|
|
26
|
-
|
|
27
|
-
console.debug(`PickerView: reflectSpawnedPage`);
|
|
26
|
+
DEBUG && console.debug(`PickerView: reflectSpawnedPage`);
|
|
28
27
|
const { page: oldSv, toolBarConfig: oldToolbar } = new NavigationPath(current).hydrate(), { page: newSv, toolBarConfig: newToolbar } = new NavigationPath(source).hydrate();
|
|
29
28
|
const oldList = oldSv?.querySelector('list-view'), newList = newSv?.querySelector('list-view'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
|
|
30
29
|
// pre replace list (always exists)
|
|
@@ -62,12 +61,10 @@ const reflectSpawnedPage = (current, source) => {
|
|
|
62
61
|
oldSearch?.remove();
|
|
63
62
|
};
|
|
64
63
|
const extractTag = (node) => {
|
|
65
|
-
|
|
66
|
-
console.debug(`PickerView: extractTag`);
|
|
64
|
+
DEBUG && console.debug(`PickerView: extractTag`);
|
|
67
65
|
return node instanceof HTMLOptionElement ? (((node.getAttribute('value') ?? node.textContent?.trim()) || node.getAttribute('label')) ?? '') : (node.value ?? '');
|
|
68
66
|
}, extractLabel = (node) => {
|
|
69
|
-
|
|
70
|
-
console.debug(`PickerView: extractLabelFromGroup`);
|
|
67
|
+
DEBUG && console.debug(`PickerView: extractLabelFromGroup`);
|
|
71
68
|
if (node instanceof Element)
|
|
72
69
|
if (node instanceof HTMLOptionElement)
|
|
73
70
|
return (node.getAttribute('label') ?? node.getAttribute('value') ?? node.textContent?.trim()) || null;
|
|
@@ -77,16 +74,14 @@ const extractTag = (node) => {
|
|
|
77
74
|
return node.title ?? node.value ?? null;
|
|
78
75
|
// return node instanceof Element ? node.getAttribute('DATALIST' === node.tagName ? 'data-label' : 'label') : (node.title ?? node.value ?? null)
|
|
79
76
|
}, extractIcon = (node) => {
|
|
80
|
-
|
|
81
|
-
console.debug(`PickerView: extractIcon`);
|
|
77
|
+
DEBUG && console.debug(`PickerView: extractIcon`);
|
|
82
78
|
// return node instanceof Element ? node.getAttribute('data-system-image') : (node.systemImage ?? null)
|
|
83
79
|
if (node instanceof Element)
|
|
84
80
|
return node.getAttribute('data-system-image');
|
|
85
81
|
else
|
|
86
82
|
return node.systemImage ?? null;
|
|
87
83
|
}, extractSubtitle = (node) => {
|
|
88
|
-
|
|
89
|
-
console.debug(`PickerView: extractSubtitle`);
|
|
84
|
+
DEBUG && console.debug(`PickerView: extractSubtitle`);
|
|
90
85
|
if (node instanceof Element)
|
|
91
86
|
return node.getAttribute('data-subtitle');
|
|
92
87
|
else
|
|
@@ -171,9 +166,36 @@ export class PickerView extends FormAssociatedBase {
|
|
|
171
166
|
};
|
|
172
167
|
}
|
|
173
168
|
#spawnPage = (elements, tag, parentGroupId, searchable = false, title) => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
DEBUG && console.debug(`${_a.name} #spawnPage`);
|
|
170
|
+
const body = tag === 'sheet-view'
|
|
171
|
+
? $(html `<dialog is="sheet-view">
|
|
172
|
+
<scroll-view>
|
|
173
|
+
<v-stack placement="leading fill">
|
|
174
|
+
<list-view preferred-expanded-style="inset"></list-view>
|
|
175
|
+
</v-stack>
|
|
176
|
+
</scroll-view>
|
|
177
|
+
<tool-bar>
|
|
178
|
+
<tool-bar-item slot="top-bar-leading">
|
|
179
|
+
<button type="button" tabindex="0">
|
|
180
|
+
<label-view system-image="x"></label-view>
|
|
181
|
+
</button>
|
|
182
|
+
</tool-bar-item>
|
|
183
|
+
</tool-bar>
|
|
184
|
+
</dialog>`, '>1')
|
|
185
|
+
: $(html `<body-view>
|
|
186
|
+
<scroll-view>
|
|
187
|
+
<v-stack placement="leading fill">
|
|
188
|
+
<list-view preferred-expanded-style="inset"></list-view>
|
|
189
|
+
</v-stack>
|
|
190
|
+
</scroll-view>
|
|
191
|
+
<tool-bar>
|
|
192
|
+
<tool-bar-item slot="top-bar-leading">
|
|
193
|
+
<button type="button" tabindex="0">
|
|
194
|
+
<label-view system-image="caret-left"></label-view>
|
|
195
|
+
</button>
|
|
196
|
+
</tool-bar-item>
|
|
197
|
+
</tool-bar>
|
|
198
|
+
</body-view>`, '>1'), sv = body.querySelector('scroll-view'), list = body.querySelector('list-view'), backBtn = body.querySelector('button');
|
|
177
199
|
if (title)
|
|
178
200
|
sv?.setAttribute('navigation-inline-title', title);
|
|
179
201
|
if (searchable) {
|
|
@@ -285,7 +307,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
285
307
|
return;
|
|
286
308
|
const groupMap = indexGroups(freshRoot);
|
|
287
309
|
for (const el of this.#spawn.querySelectorAll('body-view')) {
|
|
288
|
-
const depth =
|
|
310
|
+
const depth = ancestors('body-view,[is=sheet-view]', el).indexOf(this.#spawn);
|
|
289
311
|
if (0 >= depth)
|
|
290
312
|
continue;
|
|
291
313
|
const groupId = el.dataset.groupId;
|
|
@@ -302,8 +324,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
302
324
|
}
|
|
303
325
|
};
|
|
304
326
|
#renderButtons(input) {
|
|
305
|
-
|
|
306
|
-
console.debug(`${_a.name} #renderButtons`);
|
|
327
|
+
DEBUG && console.debug(`${_a.name} #renderButtons`);
|
|
307
328
|
switch (input.mode) {
|
|
308
329
|
case 'dictionary': {
|
|
309
330
|
const flattenDictionary = (tree) => {
|
|
@@ -455,18 +476,15 @@ export class PickerView extends FormAssociatedBase {
|
|
|
455
476
|
this.#reflectSelectionOnCurrentValueLabel();
|
|
456
477
|
}
|
|
457
478
|
#renderDictionary = (dictionary) => {
|
|
458
|
-
|
|
459
|
-
console.debug(`${_a.name} ⚡️ mutation`);
|
|
479
|
+
DEBUG && console.debug(`${_a.name} ⚡️ mutation`);
|
|
460
480
|
this.#renderButtons({ mode: 'dictionary', source: dictionary });
|
|
461
481
|
};
|
|
462
482
|
#renderSlotted = (entries) => {
|
|
463
|
-
|
|
464
|
-
console.debug(`${_a.name} ⚡️ mutation`);
|
|
483
|
+
DEBUG && console.debug(`${_a.name} ⚡️ mutation`);
|
|
465
484
|
this.#renderButtons({ mode: 'list', source: this.#slots?.get('list')?.assignedElements({ flatten: true }) ?? [] });
|
|
466
485
|
};
|
|
467
486
|
#renderValidityMsgs = (entries) => {
|
|
468
|
-
|
|
469
|
-
console.debug(`${_a.name} ⚡️ mutation`);
|
|
487
|
+
DEBUG && console.debug(`${_a.name} ⚡️ mutation`);
|
|
470
488
|
this.setValidity(this.validity, this.validationMessage);
|
|
471
489
|
};
|
|
472
490
|
#lastRenderedStyle; //string | null
|
|
@@ -598,8 +616,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
598
616
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
599
617
|
}
|
|
600
618
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
601
|
-
|
|
602
|
-
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
619
|
+
DEBUG && console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
603
620
|
switch (name) {
|
|
604
621
|
case this.constructor.ATTR.PLACEHOLDER:
|
|
605
622
|
case this.constructor.ATTR.PLACEHOLDER_ICON:
|
|
@@ -646,15 +663,13 @@ export class PickerView extends FormAssociatedBase {
|
|
|
646
663
|
}
|
|
647
664
|
}
|
|
648
665
|
disconnectedCallback() {
|
|
649
|
-
|
|
650
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
666
|
+
DEBUG && console.debug(`${_a.name} ⚡️ disconnect`);
|
|
651
667
|
CleanupRegistry.unregister(this);
|
|
652
668
|
this.#validityObservers.unobserveAll();
|
|
653
669
|
this.#observers.unobserveAll();
|
|
654
670
|
}
|
|
655
671
|
connectedCallback() {
|
|
656
|
-
|
|
657
|
-
console.debug(`${_a.name} ⚡️ connect`);
|
|
672
|
+
DEBUG && console.debug(`${_a.name} ⚡️ connect`);
|
|
658
673
|
CleanupRegistry.register(this, onoff('localechange', () => {
|
|
659
674
|
this.#renderSlotted([]);
|
|
660
675
|
}, I18n.on).on());
|
|
@@ -672,8 +687,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
672
687
|
return pickerStyles.includes(this.getAttribute(attr) ?? '') ? this.getAttribute(attr) : 'automatic';
|
|
673
688
|
}
|
|
674
689
|
#render() {
|
|
675
|
-
|
|
676
|
-
console.debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
|
|
690
|
+
DEBUG && console.debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
|
|
677
691
|
// const style = this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)
|
|
678
692
|
if (this.#lastRenderedStyle === this.pickerStyle)
|
|
679
693
|
return; // skip if already applied
|
|
@@ -714,8 +728,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
714
728
|
this.dispatchEvent(new CustomEvent('selection', { detail: { selection: this.#selection }, bubbles: true, composed: true }));
|
|
715
729
|
};
|
|
716
730
|
#handleTriggerClick = async ({ type, target }) => {
|
|
717
|
-
|
|
718
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
731
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
719
732
|
if (!(target instanceof HTMLElement))
|
|
720
733
|
return;
|
|
721
734
|
this.#spawn?.remove?.();
|
|
@@ -730,8 +743,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
730
743
|
});
|
|
731
744
|
};
|
|
732
745
|
#handlePageBtnClick = async (evt) => {
|
|
733
|
-
|
|
734
|
-
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
746
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
735
747
|
evt.stopImmediatePropagation();
|
|
736
748
|
evt.preventDefault();
|
|
737
749
|
const { currentTarget: btn } = evt;
|
|
@@ -754,8 +766,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
754
766
|
});
|
|
755
767
|
};
|
|
756
768
|
#handleClick({ type, target }) {
|
|
757
|
-
|
|
758
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
769
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
759
770
|
if (!(target instanceof HTMLElement))
|
|
760
771
|
return;
|
|
761
772
|
const btn = target.closest('button');
|
|
@@ -767,8 +778,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
767
778
|
this.#sendValueToForm();
|
|
768
779
|
}
|
|
769
780
|
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
770
|
-
|
|
771
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
781
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
772
782
|
if (!(slot instanceof HTMLSlotElement))
|
|
773
783
|
return;
|
|
774
784
|
const assigned = slot.assignedElements();
|
|
@@ -777,8 +787,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
777
787
|
this.#renderValidityMsgs([]);
|
|
778
788
|
};
|
|
779
789
|
#handleListSlotchange = ({ type, target: slot }) => {
|
|
780
|
-
|
|
781
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
790
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
782
791
|
if (!(slot instanceof HTMLSlotElement))
|
|
783
792
|
return;
|
|
784
793
|
const assigned = slot.assignedElements();
|
|
@@ -787,8 +796,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
787
796
|
this.#renderSlotted([]);
|
|
788
797
|
};
|
|
789
798
|
static #wrapOptionSpawnTag(node) {
|
|
790
|
-
|
|
791
|
-
console.debug(`${_a.name} #wrapOptionSpawnTag`);
|
|
799
|
+
DEBUG && console.debug(`${_a.name} #wrapOptionSpawnTag`);
|
|
792
800
|
const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
793
801
|
const mount = document.createElement('div');
|
|
794
802
|
render(html `<button type="button" tabindex="0" navigation-link>
|
|
@@ -826,8 +834,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
826
834
|
return mount.firstElementChild; //btn
|
|
827
835
|
}
|
|
828
836
|
static #wrapOptionTag(node) {
|
|
829
|
-
|
|
830
|
-
console.debug(`${_a.name} #wrapOptionTag`);
|
|
837
|
+
DEBUG && console.debug(`${_a.name} #wrapOptionTag`);
|
|
831
838
|
const tag = extractTag(node), title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
832
839
|
const mount = document.createElement('div');
|
|
833
840
|
render(html `<button type="button" tabindex="0" value="${tag}">
|
|
@@ -859,8 +866,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
859
866
|
return mount.firstElementChild; //btn
|
|
860
867
|
}
|
|
861
868
|
static #wrapOptgroupTag(node) {
|
|
862
|
-
|
|
863
|
-
console.debug(`${_a.name} #wrapOptgroupTag`);
|
|
869
|
+
DEBUG && console.debug(`${_a.name} #wrapOptgroupTag`);
|
|
864
870
|
const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
865
871
|
const mount = document.createElement('div');
|
|
866
872
|
render(html `<details is="disclosure-group" disclosure-style="marker-trailing">
|
|
@@ -893,8 +899,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
893
899
|
// static #reflectButtons(nodes: Element[], container: Element): void
|
|
894
900
|
// static #reflectButtons(nodes: Dictionary, container: Element): void
|
|
895
901
|
static #reflectButtons(nodes, container) {
|
|
896
|
-
|
|
897
|
-
console.debug(`${_a.name} #reflectButtons`);
|
|
902
|
+
DEBUG && console.debug(`${_a.name} #reflectButtons`);
|
|
898
903
|
for (const node of nodes)
|
|
899
904
|
if (node instanceof Element)
|
|
900
905
|
switch (node.tagName) {
|
|
@@ -976,7 +981,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
976
981
|
}
|
|
977
982
|
}
|
|
978
983
|
// #reflectPlaceholder(value: string | null) {
|
|
979
|
-
//
|
|
984
|
+
// DEBUG && console.debug(`#reflectPlaceholder`)
|
|
980
985
|
// const input = this.#shadowRoot.querySelector('input')
|
|
981
986
|
// if (input) {
|
|
982
987
|
// if (value) input.setAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER, value)
|
|
@@ -984,14 +989,12 @@ export class PickerView extends FormAssociatedBase {
|
|
|
984
989
|
// }
|
|
985
990
|
// }
|
|
986
991
|
#reflectLabel(value) {
|
|
987
|
-
|
|
988
|
-
console.debug(`${_a.name} #reflectLabel`);
|
|
992
|
+
DEBUG && console.debug(`${_a.name} #reflectLabel`);
|
|
989
993
|
queryMorph('[slot=label]', html `<label-view slot="label">${value ? html `<span>${value}</span>` : null}</label-view>`, this);
|
|
990
994
|
this.#renderSlotted([]);
|
|
991
995
|
}
|
|
992
996
|
#reflectSelectionOnButtons() {
|
|
993
|
-
|
|
994
|
-
console.debug(`${_a.name} #reflectSelectionOnButtons`);
|
|
997
|
+
DEBUG && console.debug(`${_a.name} #reflectSelectionOnButtons`);
|
|
995
998
|
self.requestAnimationFrame(() => {
|
|
996
999
|
this.ariaCurrent = this.#selection;
|
|
997
1000
|
const groupMap = indexGroups(this.#lastIndexedRoot);
|
|
@@ -1022,8 +1025,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1022
1025
|
* Overwrite cvlabel with the label prop of the current(find[value === #selection]) option/dictentry
|
|
1023
1026
|
*/
|
|
1024
1027
|
#reflectSelectionOnCurrentValueLabel() {
|
|
1025
|
-
|
|
1026
|
-
console.debug(`${_a.name} #reflectSelectionOnCurrentValueLabel`);
|
|
1028
|
+
DEBUG && console.debug(`${_a.name} #reflectSelectionOnCurrentValueLabel`);
|
|
1027
1029
|
self.requestAnimationFrame(() => {
|
|
1028
1030
|
switch (this.pickerStyle) {
|
|
1029
1031
|
case 'sheet':
|
|
@@ -1066,8 +1068,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1066
1068
|
});
|
|
1067
1069
|
}
|
|
1068
1070
|
#reflectTriggerHelp() {
|
|
1069
|
-
|
|
1070
|
-
console.debug(`${_a.name} #reflectTriggerHelp`);
|
|
1071
|
+
DEBUG && console.debug(`${_a.name} #reflectTriggerHelp`);
|
|
1071
1072
|
let trigger;
|
|
1072
1073
|
switch (this.pickerStyle) {
|
|
1073
1074
|
case 'sheet':
|
|
@@ -1122,8 +1123,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1122
1123
|
message = kebabCase(key);
|
|
1123
1124
|
break;
|
|
1124
1125
|
}
|
|
1125
|
-
|
|
1126
|
-
console.debug(`${_a.name} ⚡️ validity-change`);
|
|
1126
|
+
DEBUG && console.debug(`${_a.name} ⚡️ validity-change`);
|
|
1127
1127
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor);
|
|
1128
1128
|
};
|
|
1129
1129
|
setCustomValidity = (message) => {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
1
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
3
|
+
import { onoff } from '../internal/utils';
|
|
3
4
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
5
|
export class PlainButton extends ButtonBase {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
}
|
|
8
9
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
10
|
-
console.debug(`${PlainButton.name} ⚡️ disconnect`);
|
|
10
|
+
DEBUG && console.debug(`${PlainButton.name} ⚡️ disconnect`);
|
|
11
11
|
CleanupRegistry.unregister(el);
|
|
12
12
|
}
|
|
13
13
|
static polyfillConnectedCallback(el) {
|
|
14
|
-
|
|
15
|
-
console.debug(`${PlainButton.name} ⚡️ connect`);
|
|
14
|
+
DEBUG && console.debug(`${PlainButton.name} ⚡️ connect`);
|
|
16
15
|
el.tabIndex = 0;
|
|
17
16
|
CleanupRegistry.register(el, onoff('click', PlainButton.#handleClick, el).on());
|
|
18
17
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
4
|
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
|
-
import {
|
|
5
|
+
import { $ } from '../internal/utils';
|
|
5
6
|
import { queryMorph } from '../morphdom';
|
|
6
7
|
import { Snapshot } from '../snapshot';
|
|
7
8
|
import { html } from '../tpl';
|
|
@@ -60,8 +61,7 @@ export class ProgressView extends HTMLElement {
|
|
|
60
61
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
61
62
|
}
|
|
62
63
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
63
|
-
|
|
64
|
-
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
64
|
+
DEBUG && console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
65
65
|
switch (name) {
|
|
66
66
|
case 'label': {
|
|
67
67
|
const label = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(html `<label-view foreground="secondary"></label-view>`, '>1'));
|
|
@@ -79,13 +79,11 @@ export class ProgressView extends HTMLElement {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
disconnectedCallback() {
|
|
82
|
-
|
|
83
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
82
|
+
DEBUG && console.debug(`${_a.name} ⚡️ disconnect`);
|
|
84
83
|
CleanupRegistry.unregister(this);
|
|
85
84
|
}
|
|
86
85
|
connectedCallback() {
|
|
87
|
-
|
|
88
|
-
console.debug(`${_a.name} ⚡️ connect`);
|
|
86
|
+
DEBUG && console.debug(`${_a.name} ⚡️ connect`);
|
|
89
87
|
this.inert = true;
|
|
90
88
|
this.#cssStyleObserver = new CSSStyleObserver({
|
|
91
89
|
properties: ['--progress-view-style-index'],
|
|
@@ -94,8 +92,7 @@ export class ProgressView extends HTMLElement {
|
|
|
94
92
|
Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
|
|
95
93
|
}
|
|
96
94
|
#handleStyleChange = () => {
|
|
97
|
-
|
|
98
|
-
console.debug(`${_a.name} ⚡️ style`);
|
|
95
|
+
DEBUG && console.debug(`${_a.name} ⚡️ style`);
|
|
99
96
|
const raw = self.getComputedStyle(this).getPropertyValue('--progress-view-style-index').trim();
|
|
100
97
|
const newValue = progressViewStyles[Number(raw)] ?? progressViewStyles[0];
|
|
101
98
|
if (newValue === this.#progressViewStyle)
|
|
@@ -104,8 +101,7 @@ export class ProgressView extends HTMLElement {
|
|
|
104
101
|
this.#render();
|
|
105
102
|
};
|
|
106
103
|
#render() {
|
|
107
|
-
|
|
108
|
-
console.debug(`${_a.name} ⚡️ #render (${this.#progressViewStyle})`);
|
|
104
|
+
DEBUG && console.debug(`${_a.name} ⚡️ #render (${this.#progressViewStyle})`);
|
|
109
105
|
if (this.#lastRenderedStyle === this.#progressViewStyle)
|
|
110
106
|
return; // skip if already applied
|
|
111
107
|
this.#lastRenderedStyle = this.#progressViewStyle;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
2
|
import { DialogBase } from '../namespace-browser/base';
|
|
3
3
|
export class ScreenView extends DialogBase {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
}
|
|
7
7
|
disconnectedCallback() {
|
|
8
|
-
|
|
9
|
-
console.debug(`${ScreenView.name} ⚡️ disconnect`);
|
|
8
|
+
DEBUG && console.debug(`${ScreenView.name} ⚡️ disconnect`);
|
|
10
9
|
}
|
|
11
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
2
|
/**
|
|
3
3
|
* @summary A wrapper for {hv}-stacks
|
|
4
4
|
*/
|
|
@@ -7,11 +7,9 @@ export class ScrollViewProxy extends HTMLElement {
|
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
disconnectedCallback() {
|
|
10
|
-
|
|
11
|
-
console.debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
|
|
10
|
+
DEBUG && console.debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
|
|
12
11
|
}
|
|
13
12
|
connectedCallback() {
|
|
14
|
-
|
|
15
|
-
console.debug(`${ScrollViewProxy.name} ⚡️ connect`);
|
|
13
|
+
DEBUG && console.debug(`${ScrollViewProxy.name} ⚡️ connect`);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { lifecycleObserver } from '../buses';
|
|
3
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
3
4
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
5
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
5
|
-
import { $,
|
|
6
|
+
import { $, frame, onoff, slowHideShow } from '../internal/utils';
|
|
6
7
|
import { queryMorph } from '../morphdom';
|
|
7
8
|
import { html } from '../tpl';
|
|
8
9
|
const observers = new ResizeObserverSingleton();
|
|
@@ -57,8 +58,7 @@ export class ScrollView extends HTMLElement {
|
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
60
|
-
|
|
61
|
-
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
61
|
+
DEBUG && console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
62
62
|
switch (name) {
|
|
63
63
|
case 'navigation-inline-title':
|
|
64
64
|
this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
|
|
@@ -80,15 +80,13 @@ export class ScrollView extends HTMLElement {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
disconnectedCallback() {
|
|
83
|
-
|
|
84
|
-
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
83
|
+
DEBUG && console.debug(`${_a.name} ⚡️ disconnect`);
|
|
85
84
|
CleanupRegistry.unregister(this);
|
|
86
85
|
observers.unobserve(this);
|
|
87
86
|
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pagehide', { detail: { page: this }, bubbles: true, composed: true })));
|
|
88
87
|
}
|
|
89
88
|
connectedCallback() {
|
|
90
|
-
|
|
91
|
-
console.debug(`${_a.name} ⚡️ connect`);
|
|
89
|
+
DEBUG && console.debug(`${_a.name} ⚡️ connect`);
|
|
92
90
|
CleanupRegistry.register(this, onoff([
|
|
93
91
|
// { types: 'tabreveal', listener: this.#handleTabReveal as EventListener },
|
|
94
92
|
{ types: 'beforetabswap', listener: this.#handleTabBeforeswap },
|
|
@@ -122,8 +120,7 @@ export class ScrollView extends HTMLElement {
|
|
|
122
120
|
slowHideShow('largeinline' === `${comp}` ? 'show' : 'hide', title);
|
|
123
121
|
};
|
|
124
122
|
#handleScroll = ({ target, type }) => {
|
|
125
|
-
|
|
126
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
123
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
127
124
|
if (!this.#isMidScroll)
|
|
128
125
|
this.#isMidScroll = true;
|
|
129
126
|
// if (this.#stopRecordingScrollTop) return
|
|
@@ -132,14 +129,12 @@ export class ScrollView extends HTMLElement {
|
|
|
132
129
|
this.#lastScrollTop = target.scrollTop;
|
|
133
130
|
};
|
|
134
131
|
#handleScrollend = (evt) => {
|
|
135
|
-
|
|
136
|
-
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
132
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
137
133
|
if (this.#isMidScroll)
|
|
138
134
|
this.#isMidScroll = false;
|
|
139
135
|
};
|
|
140
136
|
#handleMeasure = (entry) => {
|
|
141
|
-
|
|
142
|
-
console.debug(`${_a.name} ⚡️ measure`);
|
|
137
|
+
DEBUG && console.debug(`${_a.name} ⚡️ measure`);
|
|
143
138
|
if (0 === entry.contentRect.width + entry.contentRect.height)
|
|
144
139
|
return;
|
|
145
140
|
if (undefined === this.#beforeTabSwapLastScrolltop)
|
|
@@ -156,7 +151,7 @@ export class ScrollView extends HTMLElement {
|
|
|
156
151
|
this.#beforeTabSwapLastScrolltop = undefined;
|
|
157
152
|
};
|
|
158
153
|
// #handleTabReveal = ({ type, target }: CustomEvent<TabDetail>) => {
|
|
159
|
-
//
|
|
154
|
+
// DEBUG && console.debug(`${ScrollView.name} ⚡️ ${type}`)
|
|
160
155
|
// if (!(target instanceof HTMLElement)) return
|
|
161
156
|
// if (!target.contains(this)) return
|
|
162
157
|
// if (this.closest('[hidden]')) return
|
|
@@ -184,8 +179,7 @@ export class ScrollView extends HTMLElement {
|
|
|
184
179
|
// // })
|
|
185
180
|
// }
|
|
186
181
|
#handleTabBeforeswap = ({ type, target }) => {
|
|
187
|
-
|
|
188
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
182
|
+
DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
|
|
189
183
|
if (!(target instanceof HTMLElement))
|
|
190
184
|
return;
|
|
191
185
|
if (!target.contains(this))
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
1
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
3
|
+
import { onoff, touchGlass } from '../internal/utils';
|
|
3
4
|
import { InputBase } from '../namespace-browser/base';
|
|
4
5
|
export class SearchView extends InputBase {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
}
|
|
8
9
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
10
|
-
console.debug(`${SearchView.name} ⚡️ disconnect`);
|
|
10
|
+
DEBUG && console.debug(`${SearchView.name} ⚡️ disconnect`);
|
|
11
11
|
CleanupRegistry.unregister(el);
|
|
12
12
|
}
|
|
13
13
|
static polyfillConnectedCallback(el) {
|
|
14
|
-
|
|
15
|
-
console.debug(`${SearchView.name} ⚡️ connect`);
|
|
14
|
+
DEBUG && console.debug(`${SearchView.name} ⚡️ connect`);
|
|
16
15
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
17
16
|
el.type = 'search';
|
|
18
17
|
}
|
|
19
18
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
20
|
-
|
|
21
|
-
console.debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
19
|
+
DEBUG && console.debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
22
20
|
const node = target instanceof HTMLInputElement;
|
|
23
21
|
if (!node)
|
|
24
22
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
|
+
import { $ } from '../internal/utils';
|
|
2
3
|
import { queryMorph } from '../morphdom';
|
|
3
4
|
import { html } from '../tpl';
|
|
4
5
|
/**
|
|
@@ -32,8 +33,7 @@ export class SectionView extends HTMLElement {
|
|
|
32
33
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
33
34
|
}
|
|
34
35
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
35
|
-
|
|
36
|
-
console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
36
|
+
DEBUG && console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
37
37
|
switch (name) {
|
|
38
38
|
case 'header':
|
|
39
39
|
queryMorph('[slot=header]', html `<header slot="header">
|
|
@@ -52,13 +52,11 @@ export class SectionView extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
disconnectedCallback() {
|
|
55
|
-
|
|
56
|
-
console.debug(`${SectionView.name} ⚡️ disconnect`);
|
|
55
|
+
DEBUG && console.debug(`${SectionView.name} ⚡️ disconnect`);
|
|
57
56
|
//
|
|
58
57
|
}
|
|
59
58
|
connectedCallback() {
|
|
60
|
-
|
|
61
|
-
console.debug(`${SectionView.name} ⚡️ connect`);
|
|
59
|
+
DEBUG && console.debug(`${SectionView.name} ⚡️ connect`);
|
|
62
60
|
//
|
|
63
61
|
}
|
|
64
62
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
1
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
3
|
+
import { onoff } from '../internal/utils';
|
|
3
4
|
import { DialogBase } from '../namespace-browser/base';
|
|
4
5
|
/**
|
|
5
6
|
* @summary A dialog that slides up over the current screen.
|
|
@@ -9,13 +10,11 @@ export class SheetView extends DialogBase {
|
|
|
9
10
|
super();
|
|
10
11
|
}
|
|
11
12
|
static polyfillDisconnectedCallback(el) {
|
|
12
|
-
|
|
13
|
-
console.debug(`${SheetView.name} ⚡️ disconnect`);
|
|
13
|
+
DEBUG && console.debug(`${SheetView.name} ⚡️ disconnect`);
|
|
14
14
|
CleanupRegistry.unregister(el);
|
|
15
15
|
}
|
|
16
16
|
static polyfillConnectedCallback(el) {
|
|
17
|
-
|
|
18
|
-
console.debug(`${SheetView.name} ⚡️ connect`);
|
|
17
|
+
DEBUG && console.debug(`${SheetView.name} ⚡️ connect`);
|
|
19
18
|
CleanupRegistry.register(el, onoff([
|
|
20
19
|
{ types: 'cancel', listener: this.#handleCancel },
|
|
21
20
|
{ types: 'keydown', listener: SheetView.#handleKeydown },
|
|
@@ -23,12 +22,10 @@ export class SheetView extends DialogBase {
|
|
|
23
22
|
el.autofocus = true;
|
|
24
23
|
}
|
|
25
24
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
27
|
-
console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
25
|
+
DEBUG && console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
28
26
|
}
|
|
29
27
|
static #handleKeydown = (evt) => {
|
|
30
|
-
|
|
31
|
-
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
28
|
+
DEBUG && console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
32
29
|
if ('Escape' !== evt.key)
|
|
33
30
|
return;
|
|
34
31
|
evt.preventDefault();
|
|
@@ -36,8 +33,7 @@ export class SheetView extends DialogBase {
|
|
|
36
33
|
evt.stopPropagation();
|
|
37
34
|
};
|
|
38
35
|
static #handleCancel = (evt) => {
|
|
39
|
-
|
|
40
|
-
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
|
|
36
|
+
DEBUG && console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
|
|
41
37
|
if (!evt.cancelable)
|
|
42
38
|
return;
|
|
43
39
|
evt.preventDefault();
|