@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,17 +1,10 @@
|
|
|
1
1
|
import { lifecycleObserver } from '../buses';
|
|
2
2
|
import { I18n } from '../i18n';
|
|
3
3
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
4
|
-
import { type NavigationHost } from '../internal/privateNamespace';
|
|
4
|
+
import { type NavigationHost, queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
5
5
|
import { type WebComponentCtor } from '../namespace-browser';
|
|
6
6
|
import { Snapshot } from '../snapshot';
|
|
7
7
|
export declare const polyfills: Map<string, WebComponentCtor>;
|
|
8
|
-
type TransitionType = 'forwards' | 'backwards' | 'reload';
|
|
9
|
-
type UpdateCallback = () => void | Promise<void>;
|
|
10
|
-
type NavigateOptions = {
|
|
11
|
-
updateCallback?: UpdateCallback;
|
|
12
|
-
tos?: () => NavigationPath[];
|
|
13
|
-
};
|
|
14
|
-
export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
|
|
15
8
|
export declare const alert: (title?: string, message?: string, actions?: {
|
|
16
9
|
label?: string;
|
|
17
10
|
image?: string;
|
|
@@ -27,5 +20,5 @@ export declare const confirmationDialog: (trigger: HTMLElement, title: string, m
|
|
|
27
20
|
controller?: AbortController;
|
|
28
21
|
titleVisibility?: boolean;
|
|
29
22
|
}) => Promise<string>;
|
|
30
|
-
export { I18n, lifecycleObserver, NavigationPath, Snapshot };
|
|
23
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
31
24
|
export { type NavigationHost };
|
|
@@ -2,7 +2,8 @@ import { alertDialog, confirmationDialog as confirmationDialogBus, lifecycleObse
|
|
|
2
2
|
import * as Components from '../components';
|
|
3
3
|
import { I18n } from '../i18n';
|
|
4
4
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
5
|
-
import {
|
|
5
|
+
import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
6
|
+
import { $, debug, kebabCase, onoff } from '../internal/utils';
|
|
6
7
|
import { Snapshot } from '../snapshot';
|
|
7
8
|
//#region polyfills
|
|
8
9
|
export const polyfills = new Map();
|
|
@@ -24,7 +25,7 @@ for (const [k, Ctor] of Object.entries(Components)) {
|
|
|
24
25
|
if (!customElements.get(is))
|
|
25
26
|
customElements.define(is, Ctor);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
debug(polyfills);
|
|
28
29
|
if (0 < polyfills.size) {
|
|
29
30
|
const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
30
31
|
const handlers = new WeakMap();
|
|
@@ -54,7 +55,7 @@ if (0 < polyfills.size) {
|
|
|
54
55
|
}, unobserve = (el) => {
|
|
55
56
|
handlers.delete(el);
|
|
56
57
|
}, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
|
|
57
|
-
|
|
58
|
+
debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
|
|
58
59
|
for (const [is, polyfill] of polyfills)
|
|
59
60
|
for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
|
|
60
61
|
polyfill.polyfillConnectedCallback(el);
|
|
@@ -166,158 +167,6 @@ if (mediaQueryList.matches)
|
|
|
166
167
|
['pointerout', handleDone],
|
|
167
168
|
])
|
|
168
169
|
document.addEventListener(k, v, { passive: true });
|
|
169
|
-
//#region Transitions
|
|
170
|
-
const cleanup = (lm, type) => {
|
|
171
|
-
let arr = [Snapshot.config['vt-fwd-class-name'], 'fwdd', 'fwn', 'fwnn', 'bwd', 'bwdd', 'bwn', 'bwnn'];
|
|
172
|
-
if (['backwards', 'forwards'].includes(type ?? ''))
|
|
173
|
-
for (let i = arr.length - 1; i >= 0; i--)
|
|
174
|
-
if (arr[i].startsWith('backwards' === type ? 'fw' : 'bw'))
|
|
175
|
-
arr.splice(i, 1);
|
|
176
|
-
for (const el of [...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? [])])
|
|
177
|
-
el.classList.remove(...arr);
|
|
178
|
-
};
|
|
179
|
-
export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
|
|
180
|
-
console.debug(`startViewTransition (${type})`, target);
|
|
181
|
-
if (!(target instanceof HTMLElement))
|
|
182
|
-
throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
|
|
183
|
-
if (!['forwards', 'backwards', 'reload'].includes(type))
|
|
184
|
-
throw new TypeError("Argument 2 ('type') to client.startViewTransition must be of TransitionType");
|
|
185
|
-
const options = typeof updateCallbackOrOptions === 'function'
|
|
186
|
-
? {
|
|
187
|
-
updateCallback: updateCallbackOrOptions,
|
|
188
|
-
}
|
|
189
|
-
: (updateCallbackOrOptions ?? {}), updateCallback = options.updateCallback ?? (async () => { });
|
|
190
|
-
await Snapshot.waitReady;
|
|
191
|
-
const from = new NavigationPath(target); //const from = closestBody(target) //event.target as HTMLElement)
|
|
192
|
-
if ('forwards' === type) {
|
|
193
|
-
await updateCallback(); // updatetheDOMSomehow
|
|
194
|
-
// Snapshot.getSnapshot(from)
|
|
195
|
-
// const root = getRootViewController(from)
|
|
196
|
-
// const oldPath = new NavigationPath(from)
|
|
197
|
-
const root = [from, ...from.parents()]
|
|
198
|
-
.map((item) => item.component)
|
|
199
|
-
.filter(Boolean)
|
|
200
|
-
.at(-1);
|
|
201
|
-
// const { toolBarConfig: oldToolbars } = getComputedView(from) // const { toolBarConfig: oldToolbars, slot: oldSLot, page: oldPage } = getComputedView(from) //
|
|
202
|
-
// console.log(88, oldPage, oldPath.page, oldSLot, oldPath.slot, oldToolbars, oldPath.toolBarConfig)
|
|
203
|
-
// const oldToolbars = Snapshot.toolbarItems
|
|
204
|
-
// const { toolBarConfig: oldToolbars, host: oldHost } = getComputedView(from)
|
|
205
|
-
const tos = options.tos?.() ?? [...from.children()].map((item) => item?.hydrate()), //queryBodyAll(oldSLot), //[...oldPath.children()].map((item) => item.body).filter(Boolean),//
|
|
206
|
-
to = tos.at(-1),
|
|
207
|
-
// to = newPath?.body, //tos.slice(-1)?.pop?.(), //Snapshot.leaf, //
|
|
208
|
-
// newHost = newPath?.component, //{ host: newHost } = getComputedView(to),
|
|
209
|
-
newToolbars = tos.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item),
|
|
210
|
-
// .map((item) => item.toolBarConfig)
|
|
211
|
-
// .flat()
|
|
212
|
-
// .filter(Boolean), //queryToolbarConfigAll(oldSLot),
|
|
213
|
-
modalViews = tos.map((item) => item.component).filter((item) => !!item && item.matches('dialog')); //[...queryHostAll(oldPage)].filter?.((item) => item?.matches('dialog'))
|
|
214
|
-
// toFrame = Snapshot.leafContainer, //queryHostAll(from).slice(-1)?.pop?.(),
|
|
215
|
-
// toToolbars = Snapshot.leafToolbarItems
|
|
216
|
-
// dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
|
|
217
|
-
// if ('DIALOG' === newHost?.tagName) {
|
|
218
|
-
// ;(newHost as HTMLDialogElement).showModal()
|
|
219
|
-
// console.debug(`⚡️ view-transition-start (${type})`)
|
|
220
|
-
// await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
|
|
221
|
-
// console.debug(`⚡️ view-transition-end (${type})`)
|
|
222
|
-
// return
|
|
223
|
-
// }
|
|
224
|
-
// purge
|
|
225
|
-
cleanup(root, 'backwards');
|
|
226
|
-
// prepare old
|
|
227
|
-
from.body?.classList.add(Snapshot.config['vt-fwd-class-name']);
|
|
228
|
-
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
229
|
-
for (const oldToolbar of from.toolBarConfig ?? [])
|
|
230
|
-
oldToolbar.classList.add('fwn'); // prepare navbs
|
|
231
|
-
// prepare new
|
|
232
|
-
const toolbarExclusion = 0 < modalViews.length
|
|
233
|
-
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar,body-view ~ tool-bar)')
|
|
234
|
-
: (value, index, array) => value.parentElement?.matches('tool-bar:not(body-view ~ tool-bar)'), bodyExclusion = 0 < modalViews.length ? (item) => item.body?.matches('scroll-view:not(dialog scroll-view)') : (value, index, array) => value;
|
|
235
|
-
for (const bti of newToolbars?.filter?.(toolbarExclusion) ?? [])
|
|
236
|
-
bti.classList.add('fwnn'); // for (const ti of newToolbars ?? []) ti.classList.add('fwnn') //
|
|
237
|
-
for (const bt of tos?.filter?.(bodyExclusion) ?? []) {
|
|
238
|
-
bt.body?.classList.add('fwdd'); //to?.classList.add('fwdd')
|
|
239
|
-
bt.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: bt.body }, bubbles: true, composed: true }));
|
|
240
|
-
}
|
|
241
|
-
if (0 < modalViews.length) {
|
|
242
|
-
for await (const el of modalViews)
|
|
243
|
-
el.showModal();
|
|
244
|
-
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
245
|
-
await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
|
|
246
|
-
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
console.debug(`⚡️ view-transition-start (${type})`);
|
|
250
|
-
await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
|
|
251
|
-
console.debug(`⚡️ view-transition-end (${type})`);
|
|
252
|
-
}
|
|
253
|
-
if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
|
|
254
|
-
return;
|
|
255
|
-
cleanup(root);
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
// Snapshot.getSnapshot(from)
|
|
259
|
-
// const oldPath = new NavigationPath(from)
|
|
260
|
-
const root = [from, ...from.parents()]
|
|
261
|
-
.map((item) => item.component)
|
|
262
|
-
.filter(Boolean)
|
|
263
|
-
.at(-1); // const root = getRootViewController(from)
|
|
264
|
-
//const { toolBarConfig: oldToolbars, host: oldHost, page: oldPage, slot: oldSlot } = getComputedView(from)
|
|
265
|
-
const froms = [...from.children()].map((item) => item?.hydrate());
|
|
266
|
-
const oldToolbars = froms.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item), oldBodies = froms.map((item) => item.body).filter((item) => !!item);
|
|
267
|
-
// console.log(99, queryToolbarConfigAll(oldSlot), oldToolbars)
|
|
268
|
-
// if most-top effect is closing a modal, skip everything
|
|
269
|
-
if ('DIALOG' === from.component?.tagName) {
|
|
270
|
-
from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
|
|
271
|
-
from.component.close();
|
|
272
|
-
console.debug(`⚡️ view-dialog-transition-start (${type})`);
|
|
273
|
-
await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
|
|
274
|
-
console.debug(`⚡️ view-dialog-transition-end (${type})`);
|
|
275
|
-
if (from.component.matches('[open]'))
|
|
276
|
-
return;
|
|
277
|
-
await updateCallback();
|
|
278
|
-
return; // just close modal
|
|
279
|
-
}
|
|
280
|
-
const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
|
|
281
|
-
// console.log(99, to)
|
|
282
|
-
if (!to)
|
|
283
|
-
return console.debug('Can not go backwards.'); // nothing to go back to
|
|
284
|
-
const tv = to.body?.closest('tab-view');
|
|
285
|
-
if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
|
|
286
|
-
if ('bottom-bar' !== tv.tabBarPlacement)
|
|
287
|
-
return;
|
|
288
|
-
// const { toolBarConfig: newToolbars } = getComputedView(to.body)
|
|
289
|
-
// purge
|
|
290
|
-
cleanup(root, 'forwards');
|
|
291
|
-
// prepare new
|
|
292
|
-
for (const ti of to.toolBarConfig ?? [])
|
|
293
|
-
ti.classList.add('bwnn');
|
|
294
|
-
to.body?.classList.add('bwdd');
|
|
295
|
-
to.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: to.body }, bubbles: true, composed: true }));
|
|
296
|
-
// prepare old
|
|
297
|
-
const inbetweenModals = froms.map((item) => item.component).filter((item) => !!item && item.matches('dialog[open]')), //queryHostAll(oldPage).filter?.((item) => item.matches('dialog[open]')) ?? [], // FIXME: TEst this, added oldHost too
|
|
298
|
-
toolbarExclusion = 0 < inbetweenModals.length
|
|
299
|
-
? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar)')
|
|
300
|
-
: (value, index, array) => value, bodyExclusion = 0 < inbetweenModals.length ? (item) => item?.matches('scroll-view:not(dialog scroll-view)') : (item) => item;
|
|
301
|
-
for (const ti of [...(from.toolBarConfig ?? []), ...(oldToolbars?.filter?.(toolbarExclusion) ?? [])])
|
|
302
|
-
ti.classList.add('bwn');
|
|
303
|
-
for (const nn of [from.body, ...oldBodies?.filter?.(bodyExclusion)]) {
|
|
304
|
-
nn?.classList.add('bwd'); //from?.classList.add('bwd')
|
|
305
|
-
nn?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: nn }, bubbles: true, composed: true }));
|
|
306
|
-
}
|
|
307
|
-
for (const el of inbetweenModals)
|
|
308
|
-
el.close(); // close old inbetween modals
|
|
309
|
-
// capture trans
|
|
310
|
-
console.debug(`⚡️ view-transition-start (${type})`);
|
|
311
|
-
await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
|
|
312
|
-
console.debug(`⚡️ view-transition-end (${type})`);
|
|
313
|
-
if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
|
|
314
|
-
return;
|
|
315
|
-
cleanup(root);
|
|
316
|
-
// remove or hide
|
|
317
|
-
await updateCallback();
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
//#endregion
|
|
321
170
|
//#region fns
|
|
322
171
|
export const alert = async (title, message, actions, options) => {
|
|
323
172
|
await navigator.locks.request('alert:', async () => {
|
|
@@ -417,5 +266,5 @@ export const confirmationDialog = async (trigger, title, message, actions, optio
|
|
|
417
266
|
//#endregion
|
|
418
267
|
void Snapshot.waitReady; // void Snapshot.setOwnConfig()
|
|
419
268
|
//#region exports
|
|
420
|
-
export { I18n, lifecycleObserver, NavigationPath, Snapshot };
|
|
269
|
+
export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
|
|
421
270
|
//#endregion
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { alertDialog } from '../buses';
|
|
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
|
import { DialogBase } from '../namespace-browser/base';
|
|
5
5
|
export class AlertDialog extends DialogBase {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
static polyfillDisconnectedCallback(el) {
|
|
10
|
-
|
|
10
|
+
debug(`${AlertDialog.name} ⚡️ disconnect`);
|
|
11
11
|
CleanupRegistry.unregister(el);
|
|
12
12
|
alertDialog.dispatchEvent(new CustomEvent('alert:return', {
|
|
13
13
|
detail: { returnValue: el.returnValue },
|
|
@@ -16,21 +16,20 @@ export class AlertDialog extends DialogBase {
|
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
18
|
static polyfillConnectedCallback(el) {
|
|
19
|
-
|
|
19
|
+
debug(`${AlertDialog.name} ⚡️ connect`);
|
|
20
20
|
CleanupRegistry.register(el, onoff([
|
|
21
21
|
{ types: 'click', listener: this.#handleDialogClick },
|
|
22
22
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
23
23
|
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
24
24
|
], el).on());
|
|
25
|
-
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (
|
|
26
|
-
|
|
27
|
-
if (!target)
|
|
25
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
26
|
+
if (!(target instanceof HTMLElement && target))
|
|
28
27
|
return true;
|
|
29
28
|
if (target.matches('[is=alert-dialog]'))
|
|
30
29
|
return false;
|
|
31
30
|
return true;
|
|
32
31
|
}), el).on());
|
|
33
|
-
|
|
32
|
+
debug(`${AlertDialog.name} ⚡️ will-open`);
|
|
34
33
|
el.removeAttribute('closing');
|
|
35
34
|
el.scrollTop = 0;
|
|
36
35
|
el.returnValue = '';
|
|
@@ -38,7 +37,7 @@ export class AlertDialog extends DialogBase {
|
|
|
38
37
|
el.showModal();
|
|
39
38
|
}
|
|
40
39
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
41
|
-
|
|
40
|
+
debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
42
41
|
switch (attributeName) {
|
|
43
42
|
case 'label':
|
|
44
43
|
//
|
|
@@ -46,12 +45,11 @@ export class AlertDialog extends DialogBase {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
static #handleDialogClick = (evt) => {
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
if (!dialog)
|
|
48
|
+
debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
49
|
+
const { target, currentTarget: dialog } = evt;
|
|
50
|
+
if (!(dialog instanceof HTMLDialogElement && dialog))
|
|
52
51
|
return;
|
|
53
|
-
|
|
54
|
-
if (!target)
|
|
52
|
+
if (!(target instanceof HTMLElement && target))
|
|
55
53
|
return;
|
|
56
54
|
const button = target.closest('button');
|
|
57
55
|
if (!button)
|
|
@@ -67,15 +65,15 @@ export class AlertDialog extends DialogBase {
|
|
|
67
65
|
evt.stopImmediatePropagation();
|
|
68
66
|
};
|
|
69
67
|
static #handleDialogCancel = (evt) => {
|
|
70
|
-
|
|
68
|
+
debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
71
69
|
if (!evt.cancelable)
|
|
72
70
|
return;
|
|
73
|
-
const
|
|
74
|
-
if (!target)
|
|
71
|
+
const { target } = evt;
|
|
72
|
+
if (!(target instanceof HTMLDialogElement && target))
|
|
75
73
|
return;
|
|
76
74
|
evt.preventDefault();
|
|
77
75
|
target.inert = true;
|
|
78
|
-
|
|
76
|
+
debug(`${AlertDialog.name} ⚡️ will-close`);
|
|
79
77
|
target.setAttribute('closing', '');
|
|
80
78
|
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
81
79
|
if (!target.hasAttribute('closing'))
|
|
@@ -84,10 +82,9 @@ export class AlertDialog extends DialogBase {
|
|
|
84
82
|
target.removeAttribute('closing');
|
|
85
83
|
});
|
|
86
84
|
};
|
|
87
|
-
static #handleDialogClose = (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!target)
|
|
85
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
86
|
+
debug(`${AlertDialog.name} ⚡️ ${type}`);
|
|
87
|
+
if (!(target instanceof HTMLDialogElement && target))
|
|
91
88
|
return;
|
|
92
89
|
target.remove();
|
|
93
90
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
1
2
|
export class BodyView extends HTMLElement {
|
|
2
3
|
constructor() {
|
|
3
4
|
super();
|
|
4
5
|
}
|
|
5
6
|
disconnectedCallback() {
|
|
6
|
-
|
|
7
|
+
debug(`${BodyView.name} ⚡️ disconnect`);
|
|
7
8
|
}
|
|
8
9
|
connectedCallback() {
|
|
9
|
-
|
|
10
|
+
debug(`${BodyView.name} ⚡️ connect`);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { ensurePlaceholder, onoff } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } 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 BorderedButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
18
18
|
CleanupRegistry.unregister(el);
|
|
19
19
|
}
|
|
20
20
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
21
|
+
debug(`${BorderedButton.name} ⚡️ connect`);
|
|
22
22
|
el.tabIndex = 0;
|
|
23
23
|
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
24
24
|
}
|
|
25
25
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
26
|
+
debug(`${BorderedButton.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 } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } 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 BorderedProminentButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
18
18
|
CleanupRegistry.unregister(el);
|
|
19
19
|
}
|
|
20
20
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
21
|
+
debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
22
22
|
el.tabIndex = 0;
|
|
23
23
|
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
24
24
|
}
|
|
25
25
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
26
|
+
debug(`${BorderedProminentButton.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 } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff } 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 BorderlessButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
18
18
|
CleanupRegistry.unregister(el);
|
|
19
19
|
}
|
|
20
20
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
21
|
+
debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
22
22
|
el.tabIndex = 0;
|
|
23
23
|
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
24
24
|
}
|
|
25
25
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
26
|
+
debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
27
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
28
|
if (!node)
|
|
29
29
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { confirmationDialog } from '../buses';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { isInside, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { debug, isInside, onoff, touchGlass } from '../internal/utils';
|
|
4
4
|
import { DialogBase } from '../namespace-browser/base';
|
|
5
5
|
export class ConfirmationDialog extends DialogBase {
|
|
6
6
|
static get observedAttributes() {
|
|
@@ -10,7 +10,7 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
10
10
|
super();
|
|
11
11
|
}
|
|
12
12
|
static polyfillDisconnectedCallback(el) {
|
|
13
|
-
|
|
13
|
+
debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
|
|
14
14
|
const positionAnchor = el.style.getPropertyValue('position-anchor');
|
|
15
15
|
document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
|
|
16
16
|
el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
|
|
@@ -22,22 +22,21 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
static polyfillConnectedCallback(el) {
|
|
25
|
-
|
|
25
|
+
debug(`${ConfirmationDialog.name} ⚡️ connect`);
|
|
26
26
|
CleanupRegistry.register(el, onoff([
|
|
27
27
|
{ types: 'click', listener: this.#handleDialogClick },
|
|
28
28
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
29
29
|
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
30
30
|
], el).on());
|
|
31
|
-
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (
|
|
32
|
-
|
|
33
|
-
if (!target)
|
|
31
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
32
|
+
if (!(target instanceof HTMLElement && target))
|
|
34
33
|
return true;
|
|
35
34
|
if (target.matches('[is=confirmation-dialog]'))
|
|
36
35
|
return false;
|
|
37
36
|
// if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
|
|
38
37
|
return true;
|
|
39
38
|
}), el).on());
|
|
40
|
-
|
|
39
|
+
debug(`${ConfirmationDialog.name} ⚡️ will-open`);
|
|
41
40
|
el.removeAttribute('closing');
|
|
42
41
|
el.scrollTop = 0;
|
|
43
42
|
el.returnValue = '';
|
|
@@ -45,7 +44,7 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
45
44
|
el.showModal();
|
|
46
45
|
}
|
|
47
46
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
48
|
-
|
|
47
|
+
debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
49
48
|
// const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
|
|
50
49
|
switch (attributeName) {
|
|
51
50
|
case 'label':
|
|
@@ -58,12 +57,11 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
static #handleDialogClick = (evt) => {
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
if (!dialog)
|
|
60
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
61
|
+
const { target, currentTarget: dialog } = evt;
|
|
62
|
+
if (!(dialog instanceof HTMLDialogElement && dialog))
|
|
64
63
|
return;
|
|
65
|
-
|
|
66
|
-
if (!target)
|
|
64
|
+
if (!(target instanceof HTMLElement && target))
|
|
67
65
|
return;
|
|
68
66
|
if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
|
|
69
67
|
return dialog.requestClose(); // click outside
|
|
@@ -81,15 +79,15 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
81
79
|
evt.stopImmediatePropagation();
|
|
82
80
|
};
|
|
83
81
|
static #handleDialogCancel = (evt) => {
|
|
84
|
-
|
|
82
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
85
83
|
if (!evt.cancelable)
|
|
86
84
|
return;
|
|
87
|
-
const
|
|
88
|
-
if (!target)
|
|
85
|
+
const { target } = evt;
|
|
86
|
+
if (!(target instanceof HTMLDialogElement && target))
|
|
89
87
|
return;
|
|
90
88
|
evt.preventDefault();
|
|
91
89
|
target.inert = true;
|
|
92
|
-
|
|
90
|
+
debug(`${ConfirmationDialog.name} ⚡️ will-close`);
|
|
93
91
|
target.setAttribute('closing', '');
|
|
94
92
|
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
95
93
|
if (!target.hasAttribute('closing'))
|
|
@@ -98,10 +96,9 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
98
96
|
target.removeAttribute('closing');
|
|
99
97
|
});
|
|
100
98
|
};
|
|
101
|
-
static #handleDialogClose = (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!target)
|
|
99
|
+
static #handleDialogClose = ({ type, target }) => {
|
|
100
|
+
debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
|
|
101
|
+
if (!(target instanceof HTMLDialogElement && target))
|
|
105
102
|
return;
|
|
106
103
|
target.remove();
|
|
107
104
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { I18n } from '../i18n';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $, onoff } from '../internal/utils';
|
|
3
|
+
import { $, debug, onoff } from '../internal/utils';
|
|
4
4
|
/**
|
|
5
5
|
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
6
6
|
*
|
|
@@ -46,13 +46,13 @@ export class ContentUnavailableView extends HTMLElement {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
disconnectedCallback() {
|
|
49
|
-
|
|
49
|
+
debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
|
|
50
50
|
}
|
|
51
51
|
connectedCallback() {
|
|
52
|
-
|
|
52
|
+
debug(`${ContentUnavailableView.name} ⚡️ connect`);
|
|
53
53
|
}
|
|
54
54
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
55
|
-
|
|
55
|
+
debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
56
56
|
switch (name) {
|
|
57
57
|
case 'search':
|
|
58
58
|
if (oldValue === newValue)
|
|
@@ -10,16 +10,6 @@ export declare class DatePicker extends FormAssociatedBase {
|
|
|
10
10
|
disconnectedCallback(): void;
|
|
11
11
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
12
12
|
get datePickerStyle(): DatePickerStyle;
|
|
13
|
-
get selectedDate(): {
|
|
14
|
-
year: string;
|
|
15
|
-
month: string;
|
|
16
|
-
day: string;
|
|
17
|
-
};
|
|
18
|
-
set selectedDate(v: {
|
|
19
|
-
year: string;
|
|
20
|
-
month: string;
|
|
21
|
-
day: string;
|
|
22
|
-
});
|
|
23
13
|
get name(): string;
|
|
24
14
|
get value(): {
|
|
25
15
|
year: string;
|