@swiftwc/ui 0.0.0-dev.35 → 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 +11 -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 +15 -17
- 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 +286 -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/_h-stack.scss +1 -1
- 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 +46 -36
- package/scss/utils/_index.scss +21 -7
- package/scss/utils/_stacks.scss +5 -43
- package/web-components.html-data/en.json +11 -0
|
@@ -1,14 +1,12 @@
|
|
|
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 {
|
|
5
|
-
import { $, listActive, onoff } from '../internal/utils';
|
|
4
|
+
import { MutationObserverSet } from '../internal/class/mutation-observer-set';
|
|
5
|
+
import { $, debug, listActive, onoff } from '../internal/utils';
|
|
6
6
|
import { Snapshot } from '../snapshot';
|
|
7
|
-
const observers = new MutationObserverSingleton();
|
|
8
7
|
export class TableView extends HTMLElement {
|
|
9
8
|
#styleObserver;
|
|
10
9
|
#compactToolbarItem;
|
|
11
|
-
#trackedElements = new Set();
|
|
12
10
|
static #template;
|
|
13
11
|
static get template() {
|
|
14
12
|
return (this.#template ??= $(String.raw `
|
|
@@ -43,8 +41,6 @@ export class TableView extends HTMLElement {
|
|
|
43
41
|
}
|
|
44
42
|
#shadowRoot;
|
|
45
43
|
#slots = new Map();
|
|
46
|
-
// #colSlot?: HTMLSlotElement
|
|
47
|
-
// #slot?: HTMLSlotElement
|
|
48
44
|
constructor() {
|
|
49
45
|
super();
|
|
50
46
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
@@ -54,9 +50,7 @@ export class TableView extends HTMLElement {
|
|
|
54
50
|
CleanupRegistry.register(this, () => {
|
|
55
51
|
this.#slots = new Map();
|
|
56
52
|
});
|
|
57
|
-
|
|
58
|
-
// this.#slot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot:not([name])') ?? undefined
|
|
59
|
-
this.#slots?.get('column')?.addEventListener('slotchange', this.#handleSlotchange);
|
|
53
|
+
this.#slots?.get('column')?.addEventListener('slotchange', this.#handleColumnSlotchange);
|
|
60
54
|
// this.append(
|
|
61
55
|
// document.createRange().createContextualFragment(`<menu-view slot="header-trailing">
|
|
62
56
|
// <label-view slot="label" title="Delete"></label-view>
|
|
@@ -88,14 +82,14 @@ export class TableView extends HTMLElement {
|
|
|
88
82
|
// )
|
|
89
83
|
}
|
|
90
84
|
disconnectedCallback() {
|
|
91
|
-
|
|
85
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
92
86
|
CleanupRegistry.unregister(this);
|
|
93
87
|
this.#styleObserver?.disconnect();
|
|
94
|
-
observers.
|
|
88
|
+
this.#observers.unobserveAll();
|
|
95
89
|
this.#compactToolbarItem = undefined;
|
|
96
90
|
}
|
|
97
91
|
connectedCallback() {
|
|
98
|
-
|
|
92
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
99
93
|
CleanupRegistry.register(this, onoff(listActive(this), this).on());
|
|
100
94
|
// console.log(999, this.#shadowRoot.querySelector('[part*=table-column-stack]'))
|
|
101
95
|
this.#styleObserver = new CSSStyleObserver({
|
|
@@ -107,23 +101,17 @@ export class TableView extends HTMLElement {
|
|
|
107
101
|
this.#styleObserver.observe(target, this.#handleStyleChange);
|
|
108
102
|
Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
|
|
109
103
|
}
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (!slot)
|
|
104
|
+
#handleColumnSlotchange = ({ type, target: slot }) => {
|
|
105
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
106
|
+
if (!(slot instanceof HTMLSlotElement && slot))
|
|
114
107
|
return;
|
|
115
|
-
const assigned = slot.assignedElements(
|
|
116
|
-
observers.syncObservations(
|
|
108
|
+
const assigned = slot.assignedElements();
|
|
109
|
+
this.#observers.syncObservations(assigned);
|
|
117
110
|
if (0 < assigned.length)
|
|
118
|
-
this.#
|
|
111
|
+
this.#renderColumns([]);
|
|
119
112
|
};
|
|
120
|
-
#
|
|
121
|
-
|
|
122
|
-
// const sourceSlot = 0 < (this.#slots?.get('column')?.assignedElements({ flatten: true }) ?? []).length ? this.#slots?.get('column') : this.#slots?.get('column')
|
|
123
|
-
// const menu = this.querySelector(':scope>menu-view:not([slot])') ?? this.appendChild($(`<menu-view></menu-view>`))
|
|
124
|
-
// menu.innerHTML = `<label-view slot="label" system-image="dots-three" title="rtyty"></label-view>`
|
|
125
|
-
// for (const el of sourceSlot?.assignedElements({ flatten: true }) ?? []) menu.insertAdjacentElement('beforeend', TableView.wrapTag(el, sourceSlot?.name))
|
|
126
|
-
//
|
|
113
|
+
#renderColumns = (entries) => {
|
|
114
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
127
115
|
if (!this.#compactToolbarItem) {
|
|
128
116
|
this.#compactToolbarItem = $(`<menu-view tabindex="0" slot="header-trailing"></menu-view>`, '>1');
|
|
129
117
|
CleanupRegistry.unregister(this, 'compact_toolbar');
|
|
@@ -143,15 +131,10 @@ export class TableView extends HTMLElement {
|
|
|
143
131
|
subTitle?.setAttribute('title', node.ariaSort ?? '');
|
|
144
132
|
this.#compactToolbarItem.appendChild(btn);
|
|
145
133
|
}
|
|
146
|
-
// const wasConnected = this.#compactToolbarItem?.isConnected
|
|
147
|
-
// this.#compactToolbarItem?.removeEventListener('click', this.#handleMenuClick)
|
|
148
|
-
// this.#compactToolbarItem?.remove()
|
|
149
|
-
// this.#compactToolbarItem = menu
|
|
150
|
-
// this.#compactToolbarItem?.addEventListener('click', this.#handleMenuClick)
|
|
151
|
-
// if (wasConnected) this.insertAdjacentElement('beforeend', this.#compactToolbarItem)
|
|
152
134
|
};
|
|
135
|
+
#observers = new MutationObserverSet(this.#renderColumns);
|
|
153
136
|
#handleStyleChange = () => {
|
|
154
|
-
|
|
137
|
+
debug(`${_a.name} ⚡️ style`);
|
|
155
138
|
const target = this.#shadowRoot.querySelector('[part*=table-container]') ?? undefined;
|
|
156
139
|
if (!target)
|
|
157
140
|
return;
|
|
@@ -172,9 +155,8 @@ export class TableView extends HTMLElement {
|
|
|
172
155
|
break;
|
|
173
156
|
}
|
|
174
157
|
};
|
|
175
|
-
#handleMenuClick = (
|
|
176
|
-
|
|
177
|
-
if (!target)
|
|
158
|
+
#handleMenuClick = ({ target }) => {
|
|
159
|
+
if (!(target instanceof HTMLElement && target))
|
|
178
160
|
return;
|
|
179
161
|
const btn = target.closest('button');
|
|
180
162
|
if (!btn)
|
|
@@ -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 { $, compareBigDecimals, debug, kebabCase, onoff, set } from '../internal/utils';
|
|
6
7
|
const keyboardTypes = ['decimal-pad', 'number-pad', 'default'];
|
|
7
8
|
/**
|
|
8
9
|
* @slot label
|
|
@@ -25,11 +26,16 @@ export class TextField extends FormAssociatedBase {
|
|
|
25
26
|
<slot name="validity-options" hidden></slot>
|
|
26
27
|
</label>`));
|
|
27
28
|
}
|
|
29
|
+
#renderValidityMsgs = (entries) => {
|
|
30
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
31
|
+
this.setValidity(this.validity, this.validationMessage);
|
|
32
|
+
};
|
|
28
33
|
#shadowRoot;
|
|
29
34
|
// #internals: ElementInternals
|
|
30
35
|
#customValidity = '';
|
|
31
36
|
// #validitiesSlot?: HTMLSlotElement
|
|
32
37
|
#slots = new Map();
|
|
38
|
+
#validityObservers = new MutationObserverSet(this.#renderValidityMsgs);
|
|
33
39
|
#input;
|
|
34
40
|
get #internals() {
|
|
35
41
|
return getInternals(this);
|
|
@@ -44,7 +50,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
44
50
|
this.#slots = new Map();
|
|
45
51
|
});
|
|
46
52
|
CleanupRegistry.unregister(this, 'validities');
|
|
47
|
-
CleanupRegistry.register(this, onoff(
|
|
53
|
+
CleanupRegistry.register(this, onoff('slotchange', this.#handleValiditiesSlotchange, this.#slots?.get('validity-options')).on(), 'validities');
|
|
48
54
|
this.#input = this.#shadowRoot.querySelector('input') ?? undefined;
|
|
49
55
|
CleanupRegistry.register(this, onoff([{ types: 'focusin', listener: this.#handleFocusin }], this).on());
|
|
50
56
|
CleanupRegistry.register(this, onoff([
|
|
@@ -67,9 +73,10 @@ export class TextField extends FormAssociatedBase {
|
|
|
67
73
|
}
|
|
68
74
|
disconnectedCallback() {
|
|
69
75
|
super.disconnectedCallback();
|
|
76
|
+
this.#validityObservers.unobserveAll();
|
|
70
77
|
}
|
|
71
78
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
72
|
-
|
|
79
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
73
80
|
switch (name) {
|
|
74
81
|
case 'keyboard-type':
|
|
75
82
|
switch (newValue) {
|
|
@@ -189,8 +196,17 @@ export class TextField extends FormAssociatedBase {
|
|
|
189
196
|
set(this.#input, 'value', finalText); // if (this.text !== finalText) this.#input.value = finalText
|
|
190
197
|
}
|
|
191
198
|
}
|
|
199
|
+
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
200
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
201
|
+
if (!(slot instanceof HTMLSlotElement && slot))
|
|
202
|
+
return;
|
|
203
|
+
const assigned = slot.assignedElements();
|
|
204
|
+
this.#validityObservers.syncObservations(assigned, ['value', 'label']);
|
|
205
|
+
if (0 < assigned.length)
|
|
206
|
+
this.#renderValidityMsgs([]);
|
|
207
|
+
};
|
|
192
208
|
#handleFocusin = (evt) => {
|
|
193
|
-
|
|
209
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
194
210
|
if (evt.target === this)
|
|
195
211
|
this.#input?.focus();
|
|
196
212
|
};
|
|
@@ -221,9 +237,9 @@ export class TextField extends FormAssociatedBase {
|
|
|
221
237
|
this.dispatchEvent(new CustomEvent('commit', { detail: { text: this.text }, bubbles: true, composed: true }));
|
|
222
238
|
};
|
|
223
239
|
#handleInputPaste = (evt) => {
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
if (!input)
|
|
240
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
241
|
+
const { target: input } = evt;
|
|
242
|
+
if (!(input instanceof HTMLInputElement && input))
|
|
227
243
|
return;
|
|
228
244
|
evt.preventDefault();
|
|
229
245
|
const data = this.#identity(evt.clipboardData?.getData('text') ?? ''); // number is now sanitized but contains edge cases like '+' and also global one separator that could be wither dot or decimal.
|
|
@@ -324,9 +340,9 @@ export class TextField extends FormAssociatedBase {
|
|
|
324
340
|
}
|
|
325
341
|
};
|
|
326
342
|
#handleInputBeforeinput = (evt) => {
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
if (!input)
|
|
343
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
344
|
+
const { target: input } = evt;
|
|
345
|
+
if (!(input instanceof HTMLInputElement && input))
|
|
330
346
|
return;
|
|
331
347
|
if ('insertText' !== evt.inputType)
|
|
332
348
|
return;
|
|
@@ -358,10 +374,9 @@ export class TextField extends FormAssociatedBase {
|
|
|
358
374
|
// this.setValidity(prevValidity, prevValiditationMessage) // restore
|
|
359
375
|
}
|
|
360
376
|
};
|
|
361
|
-
#handleInputBlur = (
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (!input)
|
|
377
|
+
#handleInputBlur = ({ type, target: input }) => {
|
|
378
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
379
|
+
if (!(input instanceof HTMLInputElement && input))
|
|
365
380
|
return;
|
|
366
381
|
if (0 === input.value.length)
|
|
367
382
|
return;
|
|
@@ -371,7 +386,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
371
386
|
this.#sendValueToForm();
|
|
372
387
|
};
|
|
373
388
|
#handleInputInput = (evt) => {
|
|
374
|
-
|
|
389
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
375
390
|
this.#sendValueToForm();
|
|
376
391
|
};
|
|
377
392
|
// Optional: form participation properties
|
|
@@ -453,7 +468,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
453
468
|
message = kebabCase(key);
|
|
454
469
|
break;
|
|
455
470
|
}
|
|
456
|
-
|
|
471
|
+
debug(`${_a.name} ⚡️ validity-change`);
|
|
457
472
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#input);
|
|
458
473
|
};
|
|
459
474
|
setCustomValidity = (message) => {
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var ToolBarItemGroup_1;
|
|
1
8
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// }
|
|
9
|
+
import { adaptiveSlot } from '../internal/decorators';
|
|
10
|
+
import { debug } from '../internal/utils';
|
|
11
|
+
let ToolBarItemGroup = ToolBarItemGroup_1 = class ToolBarItemGroup extends HTMLElement {
|
|
6
12
|
constructor() {
|
|
7
13
|
super();
|
|
8
14
|
}
|
|
9
15
|
connectedCallback() {
|
|
10
|
-
|
|
11
|
-
// if (!this.closest('[is=sheet-view]')) return
|
|
12
|
-
// if (!self.matchMedia('(pointer: fine)').matches) return
|
|
13
|
-
// const handler1 = toolbarRepositioner.bind(null, this)
|
|
14
|
-
// CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1 as unknown as EventListener, Snapshot.on).on())
|
|
15
|
-
// Snapshot.waitReady.then(() => {
|
|
16
|
-
// toolbarRepositioner(
|
|
17
|
-
// this,
|
|
18
|
-
// new MediaQueryListEvent(`media-change`, {
|
|
19
|
-
// matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
20
|
-
// })
|
|
21
|
-
// ) // Initial check
|
|
22
|
-
// })
|
|
16
|
+
debug(`${ToolBarItemGroup_1.name} ⚡️ connect`);
|
|
23
17
|
}
|
|
24
18
|
disconnectedCallback() {
|
|
25
|
-
|
|
19
|
+
debug(`${ToolBarItemGroup_1.name} ⚡️ disconnect`);
|
|
26
20
|
CleanupRegistry.unregister(this);
|
|
27
21
|
}
|
|
28
|
-
}
|
|
22
|
+
};
|
|
23
|
+
ToolBarItemGroup = ToolBarItemGroup_1 = __decorate([
|
|
24
|
+
adaptiveSlot()
|
|
25
|
+
], ToolBarItemGroup);
|
|
26
|
+
export { ToolBarItemGroup };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var ToolBarItem_1;
|
|
1
8
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
9
|
+
import { adaptiveSlot } from '../internal/decorators';
|
|
10
|
+
import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
3
11
|
import { Snapshot } from '../snapshot';
|
|
4
|
-
|
|
12
|
+
let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
|
|
5
13
|
static get observedAttributes() {
|
|
6
14
|
return ['slot', 'data-previous-slot', 'title-key'];
|
|
7
15
|
}
|
|
@@ -10,40 +18,26 @@ export class ToolBarItem extends HTMLElement {
|
|
|
10
18
|
super();
|
|
11
19
|
}
|
|
12
20
|
disconnectedCallback() {
|
|
13
|
-
|
|
21
|
+
debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
|
|
14
22
|
this.#mutationObserver?.disconnect();
|
|
15
23
|
CleanupRegistry.unregister(this);
|
|
16
24
|
}
|
|
17
25
|
connectedCallback() {
|
|
18
|
-
|
|
19
|
-
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, (
|
|
20
|
-
|
|
21
|
-
if (!target)
|
|
26
|
+
debug(`${ToolBarItem_1.name} ⚡️ connect`);
|
|
27
|
+
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, ({ target }) => {
|
|
28
|
+
if (!(target instanceof HTMLElement && target))
|
|
22
29
|
return true;
|
|
23
30
|
if (target.closest('menu-view[open]'))
|
|
24
31
|
return false;
|
|
25
32
|
return true;
|
|
26
33
|
}), this).on());
|
|
27
|
-
// if (this.closest('tool-bar-item-group')) return
|
|
28
|
-
// if (!this.closest('[is=sheet-view]')) return
|
|
29
|
-
// if (!self.matchMedia('(pointer: fine)').matches) return
|
|
30
|
-
// const handler1 = toolbarRepositioner.bind(null, this)
|
|
31
|
-
// CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1 as unknown as EventListener, Snapshot.on).on())
|
|
32
|
-
// Snapshot.waitReady.then(() => {
|
|
33
|
-
// toolbarRepositioner(
|
|
34
|
-
// this,
|
|
35
|
-
// new MediaQueryListEvent(`media-change`, {
|
|
36
|
-
// matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
37
|
-
// })
|
|
38
|
-
// ) // Initial check
|
|
39
|
-
// })
|
|
40
34
|
}
|
|
41
35
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
42
|
-
|
|
36
|
+
debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
43
37
|
switch (name) {
|
|
44
38
|
case 'slot':
|
|
45
39
|
case 'data-previous-slot':
|
|
46
|
-
case 'title-key':
|
|
40
|
+
case 'title-key': {
|
|
47
41
|
this.#mutationObserver?.disconnect();
|
|
48
42
|
const role = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '', tKey = this.getAttribute('title-key');
|
|
49
43
|
if (['confirmation-action', 'cancellation-action'].includes(role))
|
|
@@ -59,6 +53,11 @@ export class ToolBarItem extends HTMLElement {
|
|
|
59
53
|
});
|
|
60
54
|
});
|
|
61
55
|
break;
|
|
56
|
+
}
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
|
-
}
|
|
59
|
+
};
|
|
60
|
+
ToolBarItem = ToolBarItem_1 = __decorate([
|
|
61
|
+
adaptiveSlot((el) => !el.closest('tool-bar-item-group'))
|
|
62
|
+
], ToolBarItem);
|
|
63
|
+
export { ToolBarItem };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the
|
|
2
|
+
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
3
3
|
* @slot primary-action - The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
4
4
|
* @slot confirmation-action - The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
5
|
-
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the
|
|
5
|
+
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
|
|
6
6
|
* @slot top-bar-leading - Places the item in the leading edge of the top bar
|
|
7
7
|
* @slot top-bar-principal - Places the item in the middle of the top bar
|
|
8
8
|
* @slot top-bar-trailing - Places the item in the trailing edge of the top bar
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
3
|
-
import {
|
|
3
|
+
import { $, debug } from '../internal/utils';
|
|
4
4
|
const observers = new ResizeObserverSingleton();
|
|
5
5
|
/**
|
|
6
|
-
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the
|
|
6
|
+
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
7
7
|
* @slot primary-action - The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
8
8
|
* @slot confirmation-action - The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
9
|
-
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the
|
|
9
|
+
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
|
|
10
10
|
* @slot top-bar-leading - Places the item in the leading edge of the top bar
|
|
11
11
|
* @slot top-bar-principal - Places the item in the middle of the top bar
|
|
12
12
|
* @slot top-bar-trailing - Places the item in the trailing edge of the top bar
|
|
@@ -22,6 +22,7 @@ export class ToolBar extends HTMLElement {
|
|
|
22
22
|
<div part="root top-bar">
|
|
23
23
|
<div part="root toolbar-leading-stack">
|
|
24
24
|
<slot name="cancellation-action"></slot>
|
|
25
|
+
<slot name="destructive-action"></slot>
|
|
25
26
|
<slot name="top-bar-leading"></slot>
|
|
26
27
|
</div>
|
|
27
28
|
<div part="root toolbar-principal-stack">
|
|
@@ -31,7 +32,6 @@ export class ToolBar extends HTMLElement {
|
|
|
31
32
|
<slot name="top-bar-trailing"></slot>
|
|
32
33
|
<slot name="primary-action"></slot>
|
|
33
34
|
<slot name="confirmation-action"></slot>
|
|
34
|
-
<slot name="destructive-action"></slot>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
<div part="root bottom-bar">
|
|
@@ -56,7 +56,7 @@ export class ToolBar extends HTMLElement {
|
|
|
56
56
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
57
57
|
}
|
|
58
58
|
connectedCallback() {
|
|
59
|
-
|
|
59
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
60
60
|
// NOTE: wait for config
|
|
61
61
|
// Snapshot.waitReady.then(() => {
|
|
62
62
|
for (const el of this.#shadowRoot.querySelectorAll(`[part*="toolbar-leading-stack"],[part*="toolbar-trailing-stack"]`))
|
|
@@ -64,11 +64,11 @@ export class ToolBar extends HTMLElement {
|
|
|
64
64
|
// })
|
|
65
65
|
}
|
|
66
66
|
disconnectedCallback() {
|
|
67
|
-
|
|
67
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
68
68
|
observers.unobserve(this);
|
|
69
69
|
}
|
|
70
70
|
#measureStacks(entry) {
|
|
71
|
-
|
|
71
|
+
debug(`${_a.name} ⚡️ measure`);
|
|
72
72
|
if (this.closest('[hidden]'))
|
|
73
73
|
return;
|
|
74
74
|
const leading = 'toolbar-leading-stack', trailing = 'toolbar-trailing-stack';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $, frame, onoff, sleep } from '../internal/utils';
|
|
3
|
+
import { $, debug, frame, onoff, sleep } from '../internal/utils';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
6
6
|
* BUG: Safari on IOS reports inaccurate innerHeight (which is what we really want) on orientationchange.
|
|
@@ -22,11 +22,11 @@ export class VKeyboard extends HTMLElement {
|
|
|
22
22
|
super();
|
|
23
23
|
}
|
|
24
24
|
disconnectedCallback() {
|
|
25
|
-
|
|
25
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
26
26
|
CleanupRegistry.unregister(this);
|
|
27
27
|
}
|
|
28
28
|
connectedCallback() {
|
|
29
|
-
|
|
29
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
30
30
|
this.inert = true;
|
|
31
31
|
CleanupRegistry.register(this, onoff([
|
|
32
32
|
{ types: 'scroll', listener: this.#handleWindowScroll },
|
|
@@ -58,13 +58,13 @@ export class VKeyboard extends HTMLElement {
|
|
|
58
58
|
self.scrollTo(0, 0);
|
|
59
59
|
};
|
|
60
60
|
#handleWindowOrientationchange = async () => {
|
|
61
|
-
|
|
61
|
+
debug(`${_a.name} ⚡️ orientationchange`);
|
|
62
62
|
if (!(await frame(this)))
|
|
63
63
|
return; //self.requestAnimationFrame(this.#ifKeyboardScrollIntoActiveElement)
|
|
64
64
|
this.#ifKeyboardScrollIntoActiveElement();
|
|
65
65
|
};
|
|
66
66
|
#handleBodyFocusin = async () => {
|
|
67
|
-
|
|
67
|
+
debug(`${_a.name} ⚡️ focusin`);
|
|
68
68
|
await sleep(100); // self.setTimeout(this.#ifKeyboardScrollIntoActiveElement, 100)
|
|
69
69
|
if (!this.isConnected)
|
|
70
70
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
1
2
|
/**
|
|
2
3
|
* @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution - The distribution of cols
|
|
3
4
|
*
|
|
@@ -8,9 +9,9 @@ export class VStack extends HTMLElement {
|
|
|
8
9
|
super();
|
|
9
10
|
}
|
|
10
11
|
connectedCallback() {
|
|
11
|
-
|
|
12
|
+
debug(`${VStack.name} ⚡️ connect`);
|
|
12
13
|
}
|
|
13
14
|
disconnectedCallback() {
|
|
14
|
-
|
|
15
|
+
debug(`${VStack.name} ⚡️ disconnect`);
|
|
15
16
|
}
|
|
16
17
|
}
|