@swiftwc/ui 0.0.0-dev.36 → 0.0.0-dev.37
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.d.ts +2 -9
- package/generated/client/index.js +5 -156
- package/generated/components/alert-dialog.js +18 -21
- package/generated/components/body-view.js +3 -2
- package/generated/components/bordered-button.js +4 -4
- package/generated/components/bordered-prominent-button.js +4 -4
- package/generated/components/borderless-button.js +4 -4
- package/generated/components/confirmation-dialog.js +18 -21
- package/generated/components/content-unavailable-view.js +4 -4
- package/generated/components/date-picker.d.ts +0 -10
- package/generated/components/date-picker.js +43 -28
- package/generated/components/disclosure-group.js +5 -5
- package/generated/components/fine-tooltip.js +4 -4
- package/generated/components/form-view.js +3 -3
- package/generated/components/glass-button.js +4 -4
- package/generated/components/glass-prominent-button.js +4 -4
- package/generated/components/index.d.ts +1 -0
- package/generated/components/index.js +1 -0
- package/generated/components/label-view.js +4 -4
- package/generated/components/list-view.js +3 -3
- package/generated/components/menu-view.js +14 -16
- package/generated/components/navigation-large-title.js +5 -5
- package/generated/components/navigation-split-view.js +4 -3
- package/generated/components/navigation-stack.js +4 -3
- package/generated/components/navigation-title.js +4 -4
- package/generated/components/picker-view.d.ts +2 -2
- package/generated/components/picker-view.js +313 -192
- package/generated/components/plain-button.js +3 -3
- package/generated/components/progress-view.js +6 -6
- package/generated/components/screen-view.js +2 -1
- package/generated/components/scroll-view-proxy.js +3 -2
- package/generated/components/scroll-view.js +15 -18
- package/generated/components/search-view.d.ts +8 -0
- package/generated/components/search-view.js +27 -0
- package/generated/components/section-view.js +4 -4
- package/generated/components/sheet-view.js +6 -34
- package/generated/components/sidebar-toggle.js +9 -10
- package/generated/components/sidebar-view.js +6 -8
- package/generated/components/sticky-container.js +3 -3
- package/generated/components/tab-bar.js +8 -10
- package/generated/components/tab-item.js +8 -8
- package/generated/components/tab-view.js +10 -11
- package/generated/components/table-view.js +18 -36
- package/generated/components/text-field.js +32 -17
- package/generated/components/tool-bar-item-group.js +17 -19
- package/generated/components/tool-bar-item.js +22 -23
- package/generated/components/tool-bar.d.ts +2 -2
- package/generated/components/tool-bar.js +7 -7
- package/generated/components/v-keyboard.js +5 -5
- package/generated/components/v-stack.js +3 -2
- package/generated/css/index.css +283 -272
- package/generated/events/picker-view.d.ts +6 -0
- package/generated/i18n/locales/el.d.ts +1 -0
- package/generated/i18n/locales/el.js +1 -0
- package/generated/i18n/locales/en.d.ts +1 -0
- package/generated/i18n/locales/en.js +1 -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 +21 -41
- 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.js +3 -3
- 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 +4 -0
- package/generated/internal/decorators/index.js +4 -0
- package/generated/internal/privateNamespace.d.ts +10 -0
- package/generated/internal/privateNamespace.js +159 -1
- package/generated/internal/utils/debug.d.ts +1 -0
- package/generated/internal/utils/debug.js +3 -0
- package/generated/internal/utils/index.d.ts +3 -3
- package/generated/internal/utils/index.js +5 -3
- package/generated/namespace-browser/base.d.ts +9 -0
- package/generated/namespace-browser/base.js +23 -0
- package/generated/snapshot/index.d.ts +1 -1
- package/generated/snapshot/index.js +4 -4
- package/package.json +2 -1
- package/scss/_components.scss +2 -0
- package/scss/base/_root.scss +10 -8
- package/scss/colors/_index.scss +9 -12
- package/scss/components/_index.scss +2 -0
- package/scss/components/_menu-view.scss +11 -5
- package/scss/components/_picker-view.scss +11 -2
- package/scss/components/_scroll-view.scss +4 -0
- package/scss/components/_search-view.scss +18 -0
- package/scss/components/_sheet-view.scss +2 -1
- package/scss/components/_sticky-container.scss +1 -1
- package/scss/placeholders/_lists.scss +35 -35
- package/scss/utils/_index.scss +21 -7
- package/scss/utils/_stacks.scss +5 -43
- package/web-components.html-data/en.json +11 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { I18n } from '../i18n';
|
|
3
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
|
-
import { FormAssociatedBase, getInternals
|
|
5
|
-
import {
|
|
4
|
+
import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
|
|
5
|
+
import { MutationObserverSet } from '../internal/class/mutation-observer-set';
|
|
6
|
+
import { $, clamp, debug, kebabCase, onoff, set } from '../internal/utils';
|
|
6
7
|
const datePickerStyles = ['graphical', 'field', 'automatic'];
|
|
7
8
|
export class DatePicker extends FormAssociatedBase {
|
|
8
9
|
static get observedAttributes() {
|
|
@@ -24,9 +25,14 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
24
25
|
}
|
|
25
26
|
static #templates = new Map();
|
|
26
27
|
// #lastRenderedStyle?: DatePickerStyle //string | null
|
|
28
|
+
#renderValidityMsgs = (entries) => {
|
|
29
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
30
|
+
this.setValidity(this.validity, this.validationMessage);
|
|
31
|
+
};
|
|
27
32
|
#shadowRoot;
|
|
28
33
|
#customValidity = '';
|
|
29
34
|
#slots = new Map();
|
|
35
|
+
#validityObservers = new MutationObserverSet(this.#renderValidityMsgs);
|
|
30
36
|
// #validitiesSlot?: HTMLSlotElement
|
|
31
37
|
#inputs = [];
|
|
32
38
|
get #internals() {
|
|
@@ -69,18 +75,19 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
69
75
|
if (!this.hasAttribute('selection'))
|
|
70
76
|
return;
|
|
71
77
|
const [y = '', m = '', d = ''] = (this.getAttribute('selection') ?? '').split(/\D+/);
|
|
72
|
-
this
|
|
78
|
+
this.#selectedDate = { year: y, month: m, day: d };
|
|
73
79
|
this.#sendValueToForm(false);
|
|
74
80
|
}
|
|
75
81
|
disconnectedCallback() {
|
|
76
82
|
super.disconnectedCallback();
|
|
83
|
+
this.#validityObservers.unobserveAll();
|
|
77
84
|
}
|
|
78
85
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
79
|
-
|
|
86
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
80
87
|
switch (name) {
|
|
81
88
|
case 'selection':
|
|
82
89
|
const [y = '', m = '', d = ''] = (newValue ?? '').split(/\D+/);
|
|
83
|
-
this
|
|
90
|
+
this.#selectedDate = { year: y, month: m, day: d };
|
|
84
91
|
break;
|
|
85
92
|
case 'required':
|
|
86
93
|
for (const input of this.#inputs)
|
|
@@ -117,7 +124,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
117
124
|
return datePickerStyles.includes(this.getAttribute('date-picker-style') ?? '') ? this.getAttribute('date-picker-style') : 'automatic';
|
|
118
125
|
}
|
|
119
126
|
#render() {
|
|
120
|
-
|
|
127
|
+
debug(`${_a.name} ⚡️ render (${this.datePickerStyle})`);
|
|
121
128
|
if (!this.isConnected)
|
|
122
129
|
return;
|
|
123
130
|
// if (this.#lastRenderedStyle === this.datePickerStyle) return // skip if already applied
|
|
@@ -131,7 +138,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
131
138
|
this.#slots = new Map();
|
|
132
139
|
}, 'slots');
|
|
133
140
|
CleanupRegistry.unregister(this, 'validities');
|
|
134
|
-
CleanupRegistry.register(this, onoff(
|
|
141
|
+
CleanupRegistry.register(this, onoff('slotchange', this.#handleValiditiesSlotchange, this.#slots?.get('validity-options')).on(), 'validities');
|
|
135
142
|
switch (this.datePickerStyle) {
|
|
136
143
|
default:
|
|
137
144
|
const [yyyy = '', mm = '', dd = ''] = new Date().toISOString().split('T').shift()?.split('-') ?? [], map = { year: yyyy, month: mm, day: dd };
|
|
@@ -162,7 +169,16 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
162
169
|
break;
|
|
163
170
|
}
|
|
164
171
|
}
|
|
165
|
-
|
|
172
|
+
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
173
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
174
|
+
if (!(slot instanceof HTMLSlotElement && slot))
|
|
175
|
+
return;
|
|
176
|
+
const assigned = slot.assignedElements();
|
|
177
|
+
this.#validityObservers.syncObservations(assigned, ['value', 'label']);
|
|
178
|
+
if (0 < assigned.length)
|
|
179
|
+
this.#renderValidityMsgs([]);
|
|
180
|
+
};
|
|
181
|
+
get #selectedDate() {
|
|
166
182
|
const map = Object.fromEntries(this.#inputs.map(({ name, value }) => [name, value]));
|
|
167
183
|
return {
|
|
168
184
|
year: map.year ?? '',
|
|
@@ -170,7 +186,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
170
186
|
day: map.day ?? '',
|
|
171
187
|
};
|
|
172
188
|
}
|
|
173
|
-
set selectedDate(v) {
|
|
189
|
+
set #selectedDate(v) {
|
|
174
190
|
for (const input of this.#inputs) {
|
|
175
191
|
const nv = v[input.name] ?? '', pattern = /^(\d+)?$/;
|
|
176
192
|
let finalValue = pattern.test(nv) ? nv : '', parsedValue = parseInt(finalValue);
|
|
@@ -182,9 +198,9 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
182
198
|
}
|
|
183
199
|
}
|
|
184
200
|
#handleClick = (evt) => {
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
if (!target)
|
|
201
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
202
|
+
const { target } = evt;
|
|
203
|
+
if (!(target instanceof HTMLElement && target))
|
|
188
204
|
return;
|
|
189
205
|
const input = target.closest('input');
|
|
190
206
|
if (input)
|
|
@@ -217,7 +233,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
217
233
|
else
|
|
218
234
|
this.setValidity({});
|
|
219
235
|
}
|
|
220
|
-
const selection = `${this
|
|
236
|
+
const selection = `${this.#selectedDate.year}-${this.#selectedDate.month}-${this.#selectedDate.day}`;
|
|
221
237
|
const entries = new FormData();
|
|
222
238
|
entries.append(this.name, selection);
|
|
223
239
|
this.#internals.setFormValue(entries);
|
|
@@ -225,9 +241,9 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
225
241
|
this.dispatchEvent(new CustomEvent('selection', { detail: { selection }, bubbles: true, composed: true }));
|
|
226
242
|
};
|
|
227
243
|
#handleInputPaste = (evt) => {
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
if (!input)
|
|
244
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
245
|
+
const { target: input } = evt;
|
|
246
|
+
if (!(input instanceof HTMLInputElement && input))
|
|
231
247
|
return;
|
|
232
248
|
evt.preventDefault();
|
|
233
249
|
const data = [...`${(evt.clipboardData?.getData('text') ?? '').trim()}`].reduce((acc, ch, i) => {
|
|
@@ -247,9 +263,9 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
247
263
|
this.#sendValueToForm();
|
|
248
264
|
};
|
|
249
265
|
#handleInputBeforeinput = (evt) => {
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
if (!input)
|
|
266
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
267
|
+
const { target: input } = evt;
|
|
268
|
+
if (!(input instanceof HTMLInputElement && input))
|
|
253
269
|
return;
|
|
254
270
|
if ('insertText' !== evt.inputType)
|
|
255
271
|
return;
|
|
@@ -270,7 +286,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
270
286
|
}
|
|
271
287
|
};
|
|
272
288
|
#handleInputKeydown = ({ type, target, key }) => {
|
|
273
|
-
|
|
289
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
274
290
|
if (!(target instanceof HTMLInputElement && target))
|
|
275
291
|
return;
|
|
276
292
|
const input = target;
|
|
@@ -289,14 +305,13 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
289
305
|
this.#inputs[index]?.focus();
|
|
290
306
|
};
|
|
291
307
|
#handleInputFocus = (evt) => {
|
|
292
|
-
|
|
308
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
293
309
|
for (const input of this.#inputs)
|
|
294
310
|
input.classList.toggle('focus', input === evt.target);
|
|
295
311
|
};
|
|
296
|
-
#handleInputBlur = (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (!target)
|
|
312
|
+
#handleInputBlur = ({ target, type }) => {
|
|
313
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
314
|
+
if (!(target instanceof HTMLInputElement && target))
|
|
300
315
|
return;
|
|
301
316
|
const input = target;
|
|
302
317
|
if (0 === input.value.length)
|
|
@@ -308,7 +323,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
308
323
|
this.#sendValueToForm();
|
|
309
324
|
};
|
|
310
325
|
#handleInputInput = (evt) => {
|
|
311
|
-
|
|
326
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
312
327
|
this.#sendValueToForm();
|
|
313
328
|
};
|
|
314
329
|
// Optional: form participation properties
|
|
@@ -413,7 +428,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
413
428
|
message = kebabCase(key);
|
|
414
429
|
break;
|
|
415
430
|
}
|
|
416
|
-
|
|
431
|
+
debug(`${_a.name} ⚡️ validity-change`);
|
|
417
432
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#inputs.at(0));
|
|
418
433
|
};
|
|
419
434
|
setCustomValidity = (message) => {
|
|
@@ -431,7 +446,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
431
446
|
input.toggleAttribute('disabled', !disabled);
|
|
432
447
|
};
|
|
433
448
|
formResetCallback = () => {
|
|
434
|
-
this
|
|
449
|
+
this.#selectedDate = {
|
|
435
450
|
year: '',
|
|
436
451
|
month: '',
|
|
437
452
|
day: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { cssTime, onoff, timeout } from '../internal/utils';
|
|
2
|
+
import { cssTime, debug, onoff, timeout } from '../internal/utils';
|
|
3
3
|
import { DetailsBase } from '../namespace-browser/base';
|
|
4
4
|
const toggleTimers = new WeakMap();
|
|
5
5
|
export class DisclosureGroup extends DetailsBase {
|
|
@@ -15,15 +15,15 @@ export class DisclosureGroup extends DetailsBase {
|
|
|
15
15
|
super();
|
|
16
16
|
}
|
|
17
17
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
-
|
|
18
|
+
debug(`${DisclosureGroup.name} ⚡️ attr-change [${name}]`);
|
|
19
19
|
// if (CSS.supports('interpolate-size', 'allow-keywords')) return
|
|
20
20
|
}
|
|
21
21
|
static polyfillDisconnectedCallback(el) {
|
|
22
|
-
|
|
22
|
+
debug(`${DisclosureGroup.name} ⚡️ disconnect`);
|
|
23
23
|
CleanupRegistry.unregister(el);
|
|
24
24
|
}
|
|
25
25
|
static polyfillConnectedCallback(el) {
|
|
26
|
-
|
|
26
|
+
debug(`${DisclosureGroup.name} ⚡️ connect`);
|
|
27
27
|
const newValue = el.open ? 'open' : 'closed';
|
|
28
28
|
if (newValue !== el.dataset.state)
|
|
29
29
|
el.dataset.state = newValue;
|
|
@@ -34,7 +34,7 @@ export class DisclosureGroup extends DetailsBase {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
static #handleToggle = async (evt) => {
|
|
37
|
-
|
|
37
|
+
debug(`${DisclosureGroup.name} ⚡️ ${evt?.type}`);
|
|
38
38
|
const details = evt.currentTarget instanceof HTMLDetailsElement && evt.currentTarget;
|
|
39
39
|
if (!details)
|
|
40
40
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $, onoff } from '../internal/utils';
|
|
3
|
+
import { $, debug, onoff } from '../internal/utils';
|
|
4
4
|
export class FineTooltip extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
@@ -16,7 +16,7 @@ export class FineTooltip extends HTMLElement {
|
|
|
16
16
|
this.#render(target.getAttribute(attributeName));
|
|
17
17
|
};
|
|
18
18
|
#handleMeasure = ([{ target, borderBoxSize }]) => {
|
|
19
|
-
|
|
19
|
+
debug(`${_a.name} ⚡️ measure`);
|
|
20
20
|
if (target.hasAttribute('closing'))
|
|
21
21
|
return;
|
|
22
22
|
if (!(target instanceof HTMLElement && target))
|
|
@@ -46,7 +46,7 @@ export class FineTooltip extends HTMLElement {
|
|
|
46
46
|
label.removeAttribute('title');
|
|
47
47
|
};
|
|
48
48
|
connectedCallback() {
|
|
49
|
-
|
|
49
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
50
50
|
this.removeAttribute('closing');
|
|
51
51
|
this.popover = 'manual';
|
|
52
52
|
this.inert = true;
|
|
@@ -55,7 +55,7 @@ export class FineTooltip extends HTMLElement {
|
|
|
55
55
|
this.showPopover();
|
|
56
56
|
}
|
|
57
57
|
disconnectedCallback() {
|
|
58
|
-
|
|
58
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
59
59
|
this.#resizeObserver.unobserve(this);
|
|
60
60
|
this.#mutationObserver?.disconnect();
|
|
61
61
|
this.#mutationObserver2?.disconnect();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { listActive, onoff } from '../internal/utils';
|
|
2
|
+
import { debug, listActive, onoff } from '../internal/utils';
|
|
3
3
|
import { FormBase } from '../namespace-browser/base';
|
|
4
4
|
export class FormView extends FormBase {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
}
|
|
8
8
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
9
|
+
debug(`${FormView.name} ⚡️ disconnect`);
|
|
10
10
|
// finally
|
|
11
11
|
CleanupRegistry.unregister(el);
|
|
12
12
|
}
|
|
13
13
|
static polyfillConnectedCallback(el) {
|
|
14
|
-
|
|
14
|
+
debug(`${FormView.name} ⚡️ connect`);
|
|
15
15
|
if (el.closest('[is=sidebar-view],[is=tab-bar]')) {
|
|
16
16
|
el.method = 'dialog';
|
|
17
17
|
el.noValidate = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,16 @@ export class GlassButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${GlassButton.name} ⚡️ disconnect`);
|
|
18
18
|
CleanupRegistry.unregister(el);
|
|
19
19
|
}
|
|
20
20
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
21
|
+
debug(`${GlassButton.name} ⚡️ connect`);
|
|
22
22
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
23
23
|
el.tabIndex = 0;
|
|
24
24
|
}
|
|
25
25
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
26
|
+
debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
27
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
28
|
if (!node)
|
|
29
29
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,16 @@ export class GlassProminentButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${GlassProminentButton.name} ⚡️ disconnect`);
|
|
18
18
|
CleanupRegistry.unregister(el);
|
|
19
19
|
}
|
|
20
20
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
21
|
+
debug(`${GlassProminentButton.name} ⚡️ connect`);
|
|
22
22
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
23
23
|
el.tabIndex = 0;
|
|
24
24
|
}
|
|
25
25
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
26
|
+
debug(`${GlassProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
27
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
28
|
if (!node)
|
|
29
29
|
return;
|
|
@@ -24,6 +24,7 @@ export * from './progress-view';
|
|
|
24
24
|
export * from './screen-view';
|
|
25
25
|
export * from './scroll-view-proxy';
|
|
26
26
|
export * from './scroll-view';
|
|
27
|
+
export * from './search-view';
|
|
27
28
|
export * from './section-view';
|
|
28
29
|
export * from './sheet-view';
|
|
29
30
|
export * from './sidebar-toggle';
|
|
@@ -24,6 +24,7 @@ export * from './progress-view';
|
|
|
24
24
|
export * from './screen-view';
|
|
25
25
|
export * from './scroll-view-proxy';
|
|
26
26
|
export * from './scroll-view';
|
|
27
|
+
export * from './search-view';
|
|
27
28
|
export * from './section-view';
|
|
28
29
|
export * from './sheet-view';
|
|
29
30
|
export * from './sidebar-toggle';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
2
2
|
export class LabelView extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ['system-image', 'title', 'line-limit', 'truncation-mode'];
|
|
@@ -25,13 +25,13 @@ export class LabelView extends HTMLElement {
|
|
|
25
25
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
26
26
|
}
|
|
27
27
|
disconnectedCallback() {
|
|
28
|
-
|
|
28
|
+
debug(`${LabelView.name} ⚡️ disconnect`);
|
|
29
29
|
}
|
|
30
30
|
connectedCallback() {
|
|
31
|
-
|
|
31
|
+
debug(`${LabelView.name} ⚡️ connect`);
|
|
32
32
|
}
|
|
33
33
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
34
|
-
|
|
34
|
+
debug(`${LabelView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
35
35
|
switch (name) {
|
|
36
36
|
case 'system-image':
|
|
37
37
|
let image = this.querySelector(':scope>[slot=image]');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { listActive, onoff } from '../internal/utils';
|
|
2
|
+
import { debug, listActive, onoff } from '../internal/utils';
|
|
3
3
|
export class ListView extends HTMLElement {
|
|
4
4
|
// static #template: DocumentFragment
|
|
5
5
|
// static get template() {
|
|
@@ -17,11 +17,11 @@ export class ListView extends HTMLElement {
|
|
|
17
17
|
// this.#shadowRoot.appendChild(document.importNode((this.constructor as typeof ListView).template, true))
|
|
18
18
|
}
|
|
19
19
|
disconnectedCallback() {
|
|
20
|
-
|
|
20
|
+
debug(`${ListView.name} ⚡️ disconnect`);
|
|
21
21
|
CleanupRegistry.unregister(this);
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
|
-
|
|
24
|
+
debug(`${ListView.name} ⚡️ connect`);
|
|
25
25
|
CleanupRegistry.register(this, onoff(listActive(this), this).on());
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { $, debug, onoff, touchGlass } from '../internal/utils';
|
|
4
4
|
export class MenuView extends HTMLElement {
|
|
5
5
|
static get observedAttributes() {
|
|
6
6
|
return ['open', 'closing', 'label'];
|
|
@@ -27,7 +27,7 @@ export class MenuView extends HTMLElement {
|
|
|
27
27
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
28
28
|
}
|
|
29
29
|
disconnectedCallback() {
|
|
30
|
-
|
|
30
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
31
31
|
// const dialog = this.#shadowRoot.querySelector('dialog'),
|
|
32
32
|
// trigger = this.#shadowRoot.querySelector('button')
|
|
33
33
|
// trigger?.removeEventListener('click', this.#handleTriggerClick)
|
|
@@ -40,7 +40,7 @@ export class MenuView extends HTMLElement {
|
|
|
40
40
|
CleanupRegistry.unregister(this);
|
|
41
41
|
}
|
|
42
42
|
connectedCallback() {
|
|
43
|
-
|
|
43
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
44
44
|
this.#dialog = this.#shadowRoot.querySelector('dialog') ?? undefined;
|
|
45
45
|
const trigger = this.#shadowRoot.querySelector('button') ?? undefined;
|
|
46
46
|
CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, trigger).on());
|
|
@@ -49,9 +49,8 @@ export class MenuView extends HTMLElement {
|
|
|
49
49
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
50
50
|
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
51
51
|
], this.#dialog).on());
|
|
52
|
-
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, (
|
|
53
|
-
|
|
54
|
-
if (!target)
|
|
52
|
+
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, ({ target }) => {
|
|
53
|
+
if (!(target instanceof HTMLElement && target))
|
|
55
54
|
return true;
|
|
56
55
|
if (target.matches('menu-view'))
|
|
57
56
|
return false;
|
|
@@ -65,14 +64,14 @@ export class MenuView extends HTMLElement {
|
|
|
65
64
|
dialogPart?.style.setProperty('position-anchor', newAnchorName); // $.prop('position-anchor', newAnchorName, dialogPart) //
|
|
66
65
|
}
|
|
67
66
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
68
|
-
|
|
67
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
69
68
|
switch (name) {
|
|
70
69
|
case 'open':
|
|
71
70
|
if (!this.#dialog)
|
|
72
71
|
break;
|
|
73
72
|
this.#dialog.inert = null === newValue;
|
|
74
73
|
if (null === newValue && this.#dialog.open) {
|
|
75
|
-
|
|
74
|
+
debug(`${_a.name} ⚡️ will-close`);
|
|
76
75
|
this.setAttribute('closing', '');
|
|
77
76
|
Promise.allSettled(this.#dialog.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
78
77
|
if (!this.hasAttribute('closing'))
|
|
@@ -82,7 +81,7 @@ export class MenuView extends HTMLElement {
|
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
if ('' === newValue && !this.#dialog.open) {
|
|
85
|
-
|
|
84
|
+
debug(`${_a.name} ⚡️ will-open`);
|
|
86
85
|
this.removeAttribute('closing');
|
|
87
86
|
const form = this.#shadowRoot.querySelector('form');
|
|
88
87
|
form.scrollTop = 0;
|
|
@@ -100,10 +99,9 @@ export class MenuView extends HTMLElement {
|
|
|
100
99
|
break;
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
#handleDialogClick = (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!target)
|
|
102
|
+
#handleDialogClick = ({ type, target }) => {
|
|
103
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
104
|
+
if (!(target instanceof HTMLElement && target))
|
|
107
105
|
return;
|
|
108
106
|
if (target.matches('dialog'))
|
|
109
107
|
return this.toggleAttribute('open', false); // click outside
|
|
@@ -119,19 +117,19 @@ export class MenuView extends HTMLElement {
|
|
|
119
117
|
// event.stopPropagation() //NOTE: add this only if not nested, disposes all nicely if ommited
|
|
120
118
|
};
|
|
121
119
|
#handleTriggerClick = (evt) => {
|
|
122
|
-
|
|
120
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
123
121
|
this.toggleAttribute('open', true);
|
|
124
122
|
};
|
|
125
123
|
// intercept to modify open attr
|
|
126
124
|
#handleDialogCancel = (evt) => {
|
|
127
|
-
|
|
125
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
128
126
|
if (!evt.cancelable)
|
|
129
127
|
return;
|
|
130
128
|
evt.preventDefault();
|
|
131
129
|
this.toggleAttribute('open', false);
|
|
132
130
|
};
|
|
133
131
|
#handleDialogClose = (evt) => {
|
|
134
|
-
|
|
132
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
135
133
|
this.toggleAttribute('open', this.#shadowRoot.querySelector('dialog')?.open ?? false);
|
|
136
134
|
};
|
|
137
135
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
3
|
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
|
-
import { add, frame, onoff, slowHideShow, timeout } from '../internal/utils';
|
|
4
|
+
import { add, debug, frame, onoff, slowHideShow, timeout } from '../internal/utils';
|
|
5
5
|
import { Snapshot } from '../snapshot';
|
|
6
6
|
const observing = new WeakSet();
|
|
7
7
|
function observeResizeEnd(el, callback, stableFrames = 4) {
|
|
@@ -76,13 +76,13 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
76
76
|
super();
|
|
77
77
|
}
|
|
78
78
|
disconnectedCallback() {
|
|
79
|
-
|
|
79
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
80
80
|
this.#clearScrollState();
|
|
81
81
|
this.#styleObserver?.disconnect();
|
|
82
82
|
CleanupRegistry.unregister(this);
|
|
83
83
|
}
|
|
84
84
|
connectedCallback() {
|
|
85
|
-
|
|
85
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
86
86
|
const root = this.closest('scroll-view') ?? undefined;
|
|
87
87
|
if (!root)
|
|
88
88
|
return;
|
|
@@ -105,7 +105,7 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
#handleStyleChange = () => {
|
|
108
|
-
|
|
108
|
+
debug(`${_a.name} ⚡️ style`);
|
|
109
109
|
const root = this.closest('scroll-view') ?? undefined;
|
|
110
110
|
if (!root)
|
|
111
111
|
return;
|
|
@@ -150,7 +150,7 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
150
150
|
// this.#applySlowness(root, isIntersecting)
|
|
151
151
|
// }
|
|
152
152
|
#handleIntersect = (entries, { root }) => {
|
|
153
|
-
|
|
153
|
+
debug(`${_a.name} ⚡️ intersect (${entries?.at(0)?.isIntersecting})`);
|
|
154
154
|
if (!(root instanceof HTMLElement))
|
|
155
155
|
return;
|
|
156
156
|
for (const { isIntersecting } of entries)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { debug } from '../internal/utils';
|
|
2
3
|
/**
|
|
3
4
|
* @summary A view with two or three side-by-side sections, where what you choose in the left section changes what appears in the next section.
|
|
4
5
|
*/
|
|
@@ -7,15 +8,15 @@ export class NavigationSplitView extends NavigationView {
|
|
|
7
8
|
super();
|
|
8
9
|
}
|
|
9
10
|
disconnectedCallback() {
|
|
10
|
-
|
|
11
|
+
debug(`${NavigationSplitView.name} ⚡️ disconnect`);
|
|
11
12
|
super.disconnectedCallback();
|
|
12
13
|
}
|
|
13
14
|
connectedCallback() {
|
|
14
|
-
|
|
15
|
+
debug(`${NavigationSplitView.name} ⚡️ connect`);
|
|
15
16
|
super.connectedCallback();
|
|
16
17
|
}
|
|
17
18
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
-
|
|
19
|
+
debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
19
20
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { debug } from '../internal/utils';
|
|
2
3
|
/**
|
|
3
4
|
* @summary A view that shows a main screen and lets you open other screens on top of it.
|
|
4
5
|
*/
|
|
@@ -7,15 +8,15 @@ export class NavigationStack extends NavigationView {
|
|
|
7
8
|
super();
|
|
8
9
|
}
|
|
9
10
|
disconnectedCallback() {
|
|
10
|
-
|
|
11
|
+
debug(`${NavigationStack.name} ⚡️ disconnect`);
|
|
11
12
|
super.disconnectedCallback();
|
|
12
13
|
}
|
|
13
14
|
connectedCallback() {
|
|
14
|
-
|
|
15
|
+
debug(`${NavigationStack.name} ⚡️ connect`);
|
|
15
16
|
super.connectedCallback();
|
|
16
17
|
}
|
|
17
18
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
-
|
|
19
|
+
debug(`${NavigationStack.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
19
20
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
20
21
|
// Snapshot.waitReady.then(() => {
|
|
21
22
|
switch (name) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
2
2
|
export class NavigationTitle extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ['value', 'subtitle'];
|
|
@@ -7,13 +7,13 @@ export class NavigationTitle extends HTMLElement {
|
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
disconnectedCallback() {
|
|
10
|
-
|
|
10
|
+
debug(`${NavigationTitle.name} ⚡️ disconnect`);
|
|
11
11
|
}
|
|
12
12
|
connectedCallback() {
|
|
13
|
-
|
|
13
|
+
debug(`${NavigationTitle.name} ⚡️ connect`);
|
|
14
14
|
}
|
|
15
15
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
16
|
-
|
|
16
|
+
debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
17
17
|
const sibling = this.closest('scroll-view') ?? undefined;
|
|
18
18
|
switch (name) {
|
|
19
19
|
case 'value':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormAssociatedBase } from '../internal/class/form-associated-base';
|
|
2
|
-
declare const pickerStyles: readonly ["menu", "inline", "automatic"];
|
|
2
|
+
declare const pickerStyles: readonly ["menu", "inline", "navigation-link", "sheet", "automatic"];
|
|
3
3
|
export type PickerStyle = (typeof pickerStyles)[number];
|
|
4
4
|
export declare class PickerView extends FormAssociatedBase {
|
|
5
5
|
#private;
|
|
@@ -8,6 +8,7 @@ export declare class PickerView extends FormAssociatedBase {
|
|
|
8
8
|
LABEL: string;
|
|
9
9
|
PICKER_STYLE: string;
|
|
10
10
|
SELECTION: string;
|
|
11
|
+
SEARCHABLE: string;
|
|
11
12
|
};
|
|
12
13
|
static get observedAttributes(): string[];
|
|
13
14
|
get template(): DocumentFragment;
|
|
@@ -16,7 +17,6 @@ export declare class PickerView extends FormAssociatedBase {
|
|
|
16
17
|
disconnectedCallback(): void;
|
|
17
18
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
18
19
|
get pickerStyle(): PickerStyle;
|
|
19
|
-
static wrapTag(node: Element, slotName?: string): Element;
|
|
20
20
|
get name(): string;
|
|
21
21
|
setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
|
|
22
22
|
setCustomValidity: (message: string) => void;
|