@swiftwc/ui 0.0.0-dev.98 → 1.0.0-canary.0
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/{web-components.html-data → html-data}/en.json +155 -57
- package/package.json +14 -11
- package/scss/_components.scss +1 -1
- package/scss/_maps.scss +3 -1
- package/scss/_utils.scss +3 -1
- package/scss/_vars.scss +1 -0
- package/scss/base/_layout.scss +8 -8
- package/scss/base/_reboot.scss +4 -29
- package/scss/base/_root.scss +27 -12
- package/scss/colors/_index.scss +66 -1
- package/scss/components/_alert-dialog.scss +3 -3
- package/scss/components/_bordered-button.scss +2 -2
- package/scss/components/_bordered-prominent-button.scss +3 -3
- package/scss/components/_borderless-button.scss +2 -2
- package/scss/components/_confirmation-dialog.scss +1 -1
- package/scss/components/_content-unavailable.scss +1 -1
- package/scss/components/{_body-view.scss → _content-view.scss} +2 -2
- package/scss/components/_date-picker.scss +1 -1
- package/scss/components/_detail-placeholder.scss +5 -5
- package/scss/components/_disclosure-group.scss +2 -2
- package/scss/components/_fine-tooltip.scss +1 -1
- package/scss/components/_form-view.scss +3 -3
- package/scss/components/_full-screen.scss +1 -1
- package/scss/components/_glass-button.scss +2 -2
- package/scss/components/_glass-prominent-button.scss +3 -3
- package/scss/components/_group-box.scss +1 -1
- package/scss/components/_h-divider.scss +1 -1
- package/scss/components/_h-flex-stack.scss +3 -1
- package/scss/components/_h-stack.scss +1 -1
- package/scss/components/_image-view.scss +1 -1
- package/scss/components/_index.scss +35 -24
- package/scss/components/_label-view.scss +1 -1
- package/scss/components/_labeled-content.scss +1 -1
- package/scss/components/_list-view.scss +3 -3
- package/scss/components/_menu-view.scss +3 -3
- package/scss/components/_navigation-large-title.scss +15 -9
- package/scss/components/_navigation-split-view.scss +18 -18
- package/scss/components/_navigation-stack.scss +1 -1
- package/scss/components/_navigation-title.scss +1 -1
- package/scss/components/_picker-view.scss +159 -119
- package/scss/components/_plain-button.scss +2 -2
- package/scss/components/_progress-view.scss +1 -1
- package/scss/components/_scroll-view-proxy.scss +1 -1
- package/scss/components/_scroll-view-toolbars.scss +1 -1
- package/scss/components/_scroll-view.scss +2 -2
- package/scss/components/_search-view.scss +1 -1
- package/scss/components/_section-view.scss +1 -1
- package/scss/components/_sheet-view.scss +2 -2
- package/scss/components/_sidebar-toggle.scss +1 -1
- package/scss/components/_sidebar-view.scss +2 -2
- package/scss/components/_sticky-container.scss +1 -1
- package/scss/components/_tab-bar.scss +1 -1
- package/scss/components/_tab-item.scss +1 -1
- package/scss/components/_tab-view.scss +23 -15
- package/scss/components/_table-column.scss +1 -1
- package/scss/components/_table-row.scss +1 -1
- package/scss/components/_table-view.scss +1 -1
- package/scss/components/_text-field.scss +1 -1
- package/scss/components/_text-view.scss +1 -1
- package/scss/components/_toggle-view.scss +88 -30
- package/scss/components/_tool-bar-item-group.scss +1 -1
- package/scss/components/_tool-bar-item.scss +2 -2
- package/scss/components/_tool-bar.scss +2 -2
- package/scss/components/_v-divider.scss +1 -1
- package/scss/components/_v-flex-stack.scss +3 -1
- package/scss/components/_v-keyboard.scss +1 -1
- package/scss/components/_v-stack.scss +1 -1
- package/scss/final/_touch-glass.scss +8 -1
- package/scss/mixins/_index.scss +2 -2
- package/scss/placeholders/_buttons.scss +5 -5
- package/scss/placeholders/_lists.scss +3 -3
- package/scss/transitions/_alert-dialog.scss +1 -1
- package/scss/transitions/_bwd.navbar.scss +1 -1
- package/scss/transitions/_bwd.scss +3 -3
- package/scss/transitions/_confirmation-dialog.scss +1 -1
- package/scss/transitions/_disclosure-group.scss +1 -1
- package/scss/transitions/_fine-tooltip.scss +1 -1
- package/scss/transitions/_fwd.navbar.scss +1 -1
- package/scss/transitions/_fwd.scss +1 -1
- package/scss/transitions/_glass-button.scss +1 -1
- package/scss/transitions/_glass-prominent-button.scss +1 -1
- package/scss/transitions/_index.scss +1 -1
- package/scss/transitions/_menu-view.scss +1 -1
- package/scss/transitions/_navigation-split-view.scss +1 -1
- package/scss/transitions/_progress-view.scss +1 -1
- package/scss/transitions/_sheet-view.scss +1 -1
- package/scss/transitions/_sidebar-view.scss +1 -1
- package/scss/transitions/_tab-bar.scss +1 -1
- package/scss/utils/_background.scss +52 -0
- package/scss/utils/_frame.scss +2 -2
- package/scss/utils/_index.scss +33 -8
- package/scss/utils/_spacing.scss +1 -1
- package/scss/utils/_stacks.scss +5 -3
- package/generated/buses/alert-dialog.d.ts +0 -2
- package/generated/buses/alert-dialog.js +0 -1
- package/generated/buses/confirmation-dialog.d.ts +0 -2
- package/generated/buses/confirmation-dialog.js +0 -1
- package/generated/buses/index.d.ts +0 -6
- package/generated/buses/index.js +0 -6
- package/generated/buses/lifecycle-observer.d.ts +0 -2
- package/generated/buses/lifecycle-observer.js +0 -1
- package/generated/client/index.d.ts +0 -30
- package/generated/client/index.js +0 -279
- package/generated/components/alert-dialog.d.ts +0 -11
- package/generated/components/alert-dialog.js +0 -102
- package/generated/components/body-view.d.ts +0 -13
- package/generated/components/body-view.js +0 -17
- package/generated/components/bordered-button.d.ts +0 -17
- package/generated/components/bordered-button.js +0 -56
- package/generated/components/bordered-prominent-button.d.ts +0 -17
- package/generated/components/bordered-prominent-button.js +0 -56
- package/generated/components/borderless-button.d.ts +0 -17
- package/generated/components/borderless-button.js +0 -56
- package/generated/components/color-scheme.d.ts +0 -12
- package/generated/components/color-scheme.js +0 -54
- package/generated/components/confirmation-dialog.d.ts +0 -12
- package/generated/components/confirmation-dialog.js +0 -116
- package/generated/components/content-unavailable.d.ts +0 -30
- package/generated/components/content-unavailable.js +0 -82
- package/generated/components/date-picker.d.ts +0 -52
- package/generated/components/date-picker.js +0 -480
- package/generated/components/disclosure-group.d.ts +0 -17
- package/generated/components/disclosure-group.js +0 -66
- package/generated/components/fine-tooltip.d.ts +0 -15
- package/generated/components/fine-tooltip.js +0 -111
- package/generated/components/form-view.d.ts +0 -16
- package/generated/components/form-view.js +0 -65
- package/generated/components/glass-button.d.ts +0 -16
- package/generated/components/glass-button.js +0 -53
- package/generated/components/glass-prominent-button.d.ts +0 -16
- package/generated/components/glass-prominent-button.js +0 -53
- package/generated/components/h-stack.d.ts +0 -22
- package/generated/components/h-stack.js +0 -26
- package/generated/components/image-view.d.ts +0 -18
- package/generated/components/image-view.js +0 -68
- package/generated/components/index.d.ts +0 -47
- package/generated/components/index.js +0 -47
- package/generated/components/label-view.d.ts +0 -27
- package/generated/components/label-view.js +0 -87
- package/generated/components/labeled-content.d.ts +0 -27
- package/generated/components/labeled-content.js +0 -160
- package/generated/components/list-view.d.ts +0 -15
- package/generated/components/list-view.js +0 -22
- package/generated/components/menu-view.d.ts +0 -20
- package/generated/components/menu-view.js +0 -140
- package/generated/components/navigation-large-title.d.ts +0 -18
- package/generated/components/navigation-large-title.js +0 -188
- package/generated/components/navigation-split-view.d.ts +0 -15
- package/generated/components/navigation-split-view.js +0 -25
- package/generated/components/navigation-stack.d.ts +0 -15
- package/generated/components/navigation-stack.js +0 -29
- package/generated/components/navigation-title.d.ts +0 -18
- package/generated/components/navigation-title.js +0 -72
- package/generated/components/picker-view.d.ts +0 -68
- package/generated/components/picker-view.js +0 -1153
- package/generated/components/plain-button.d.ts +0 -7
- package/generated/components/plain-button.js +0 -22
- package/generated/components/progress-view.d.ts +0 -20
- package/generated/components/progress-view.js +0 -125
- package/generated/components/screen-view.d.ts +0 -5
- package/generated/components/screen-view.js +0 -11
- package/generated/components/scroll-view-proxy.d.ts +0 -13
- package/generated/components/scroll-view-proxy.js +0 -17
- package/generated/components/scroll-view.d.ts +0 -22
- package/generated/components/scroll-view.js +0 -237
- package/generated/components/search-view.d.ts +0 -12
- package/generated/components/search-view.js +0 -27
- package/generated/components/section-view.d.ts +0 -21
- package/generated/components/section-view.js +0 -64
- package/generated/components/sheet-view.d.ts +0 -11
- package/generated/components/sheet-view.js +0 -45
- package/generated/components/sidebar-toggle.d.ts +0 -15
- package/generated/components/sidebar-toggle.js +0 -88
- package/generated/components/sidebar-view.d.ts +0 -10
- package/generated/components/sidebar-view.js +0 -37
- package/generated/components/sticky-container.d.ts +0 -11
- package/generated/components/sticky-container.js +0 -26
- package/generated/components/tab-bar.d.ts +0 -10
- package/generated/components/tab-bar.js +0 -40
- package/generated/components/tab-item.d.ts +0 -10
- package/generated/components/tab-item.js +0 -134
- package/generated/components/tab-view.d.ts +0 -31
- package/generated/components/tab-view.js +0 -198
- package/generated/components/table-view.d.ts +0 -26
- package/generated/components/table-view.js +0 -161
- package/generated/components/text-field.d.ts +0 -42
- package/generated/components/text-field.js +0 -526
- package/generated/components/toggle-view.d.ts +0 -41
- package/generated/components/toggle-view.js +0 -249
- package/generated/components/tool-bar-item-group.d.ts +0 -13
- package/generated/components/tool-bar-item-group.js +0 -31
- package/generated/components/tool-bar-item.d.ts +0 -16
- package/generated/components/tool-bar-item.js +0 -69
- package/generated/components/tool-bar.d.ts +0 -26
- package/generated/components/tool-bar.js +0 -95
- package/generated/components/v-keyboard.d.ts +0 -20
- package/generated/components/v-keyboard.js +0 -89
- package/generated/components/v-stack.d.ts +0 -25
- package/generated/components/v-stack.js +0 -29
- package/generated/css/index.css +0 -10592
- package/generated/events/alert-dialog.d.ts +0 -13
- package/generated/events/alert-dialog.js +0 -1
- package/generated/events/confirmation-dialog.d.ts +0 -14
- package/generated/events/confirmation-dialog.js +0 -1
- package/generated/events/date-picker.d.ts +0 -13
- package/generated/events/date-picker.js +0 -1
- package/generated/events/index.d.ts +0 -9
- package/generated/events/index.js +0 -9
- package/generated/events/lifecycle-observer.d.ts +0 -18
- package/generated/events/lifecycle-observer.js +0 -1
- package/generated/events/picker-view.d.ts +0 -29
- package/generated/events/picker-view.js +0 -1
- package/generated/events/scroll-view.d.ts +0 -18
- package/generated/events/scroll-view.js +0 -1
- package/generated/events/tab-view.d.ts +0 -54
- package/generated/events/tab-view.js +0 -1
- package/generated/events/text-field.d.ts +0 -13
- package/generated/events/text-field.js +0 -1
- package/generated/events/toggle-view.d.ts +0 -14
- package/generated/events/toggle-view.js +0 -1
- package/generated/i18n/index.d.ts +0 -33
- package/generated/i18n/index.js +0 -164
- package/generated/i18n/locales/el.d.ts +0 -16
- package/generated/i18n/locales/el.js +0 -16
- package/generated/i18n/locales/en.d.ts +0 -16
- package/generated/i18n/locales/en.js +0 -16
- package/generated/i18n/locales/index.d.ts +0 -4
- package/generated/i18n/locales/index.js +0 -4
- package/generated/index.d.ts +0 -2
- package/generated/index.js +0 -3
- package/generated/internal/class/cleanup-registry.d.ts +0 -5
- package/generated/internal/class/cleanup-registry.js +0 -38
- package/generated/internal/class/css-style-observer.d.ts +0 -8
- package/generated/internal/class/css-style-observer.js +0 -26
- package/generated/internal/class/form-associated-base.d.ts +0 -16
- package/generated/internal/class/form-associated-base.js +0 -78
- package/generated/internal/class/mutation-observer-set.d.ts +0 -9
- package/generated/internal/class/mutation-observer-set.js +0 -42
- package/generated/internal/class/mutation-observer-singleton.d.ts +0 -10
- package/generated/internal/class/mutation-observer-singleton.js +0 -64
- package/generated/internal/class/navigation-path.d.ts +0 -15
- package/generated/internal/class/navigation-path.js +0 -84
- package/generated/internal/class/navigation-view.d.ts +0 -8
- package/generated/internal/class/navigation-view.js +0 -72
- package/generated/internal/class/resize-observer-singleton.d.ts +0 -7
- package/generated/internal/class/resize-observer-singleton.js +0 -22
- package/generated/internal/decorators/adaptive-slot.d.ts +0 -1
- package/generated/internal/decorators/adaptive-slot.js +0 -50
- package/generated/internal/decorators/custom-element.d.ts +0 -5
- package/generated/internal/decorators/custom-element.js +0 -5
- package/generated/internal/decorators/index.d.ts +0 -6
- package/generated/internal/decorators/index.js +0 -6
- package/generated/internal/decorators/microtask-on-connected.d.ts +0 -39
- package/generated/internal/decorators/microtask-on-connected.js +0 -67
- package/generated/internal/privateNamespace.d.ts +0 -14
- package/generated/internal/privateNamespace.js +0 -168
- package/generated/internal/utils/add.d.ts +0 -1
- package/generated/internal/utils/add.js +0 -7
- package/generated/internal/utils/cash/ancestors.d.ts +0 -1
- package/generated/internal/utils/cash/ancestors.js +0 -27
- package/generated/internal/utils/cash/index.d.ts +0 -24
- package/generated/internal/utils/cash/index.js +0 -27
- package/generated/internal/utils/cash/next-all.d.ts +0 -1
- package/generated/internal/utils/cash/next-all.js +0 -10
- package/generated/internal/utils/cash/next.d.ts +0 -1
- package/generated/internal/utils/cash/next.js +0 -9
- package/generated/internal/utils/cash/prev-all.d.ts +0 -1
- package/generated/internal/utils/cash/prev-all.js +0 -10
- package/generated/internal/utils/cash/prev.d.ts +0 -1
- package/generated/internal/utils/cash/prev.js +0 -9
- package/generated/internal/utils/cash/prop.d.ts +0 -18
- package/generated/internal/utils/cash/prop.js +0 -30
- package/generated/internal/utils/cash/siblings.d.ts +0 -1
- package/generated/internal/utils/cash/siblings.js +0 -10
- package/generated/internal/utils/clamp.d.ts +0 -1
- package/generated/internal/utils/clamp.js +0 -4
- package/generated/internal/utils/compare-big-decimals.d.ts +0 -1
- package/generated/internal/utils/compare-big-decimals.js +0 -80
- package/generated/internal/utils/css-time.d.ts +0 -1
- package/generated/internal/utils/css-time.js +0 -3
- package/generated/internal/utils/debounce.d.ts +0 -1
- package/generated/internal/utils/debounce.js +0 -13
- package/generated/internal/utils/define-translations.d.ts +0 -1
- package/generated/internal/utils/define-translations.js +0 -3
- package/generated/internal/utils/dev-flags.d.ts +0 -3
- package/generated/internal/utils/dev-flags.js +0 -5
- package/generated/internal/utils/ensure-placeholder.d.ts +0 -1
- package/generated/internal/utils/ensure-placeholder.js +0 -41
- package/generated/internal/utils/frame.d.ts +0 -1
- package/generated/internal/utils/frame.js +0 -6
- package/generated/internal/utils/index.d.ts +0 -20
- package/generated/internal/utils/index.js +0 -23
- package/generated/internal/utils/is-inside.d.ts +0 -1
- package/generated/internal/utils/is-inside.js +0 -4
- package/generated/internal/utils/kebab-case.d.ts +0 -1
- package/generated/internal/utils/kebab-case.js +0 -8
- package/generated/internal/utils/list-active.d.ts +0 -7
- package/generated/internal/utils/list-active.js +0 -83
- package/generated/internal/utils/microtask.d.ts +0 -1
- package/generated/internal/utils/microtask.js +0 -3
- package/generated/internal/utils/onoff.d.ts +0 -45
- package/generated/internal/utils/onoff.js +0 -31
- package/generated/internal/utils/set.d.ts +0 -1
- package/generated/internal/utils/set.js +0 -7
- package/generated/internal/utils/sleep.d.ts +0 -1
- package/generated/internal/utils/sleep.js +0 -3
- package/generated/internal/utils/slow-hide-show.d.ts +0 -1
- package/generated/internal/utils/slow-hide-show.js +0 -16
- package/generated/internal/utils/timeout.d.ts +0 -5
- package/generated/internal/utils/timeout.js +0 -16
- package/generated/internal/utils/touch-glass.d.ts +0 -7
- package/generated/internal/utils/touch-glass.js +0 -19
- package/generated/internal/vendor/morphdom.d.ts +0 -6
- package/generated/internal/vendor/morphdom.js +0 -720
- package/generated/morphdom/index.d.ts +0 -8
- package/generated/morphdom/index.js +0 -8
- package/generated/morphdom/morph.d.ts +0 -4
- package/generated/morphdom/morph.js +0 -10
- package/generated/morphdom/query-morph.d.ts +0 -5
- package/generated/morphdom/query-morph.js +0 -12
- package/generated/morphdom/render-to-string.d.ts +0 -12
- package/generated/morphdom/render-to-string.js +0 -48
- package/generated/morphdom/unsafe-html.d.ts +0 -2
- package/generated/morphdom/unsafe-html.js +0 -4
- package/generated/namespace-browser/base.d.ts +0 -45
- package/generated/namespace-browser/base.js +0 -115
- package/generated/namespace-browser/event.d.ts +0 -10
- package/generated/namespace-browser/event.js +0 -1
- package/generated/namespace-browser/index.d.ts +0 -7
- package/generated/namespace-browser/index.js +0 -1
- package/generated/snapshot/index.d.ts +0 -9
- package/generated/snapshot/index.js +0 -60
- package/generated/tpl/html.d.ts +0 -5
- package/generated/tpl/html.js +0 -7
- package/generated/tpl/index.d.ts +0 -6
- package/generated/tpl/index.js +0 -6
- package/generated/tpl/is-template-result.d.ts +0 -3
- package/generated/tpl/is-template-result.js +0 -1
- package/generated/tpl/render.d.ts +0 -2
- package/generated/tpl/render.js +0 -132
- /package/{web-components.css-data → css-data}/en.json +0 -0
- /package/scss/utils/{_scroll-view.scss → _scroll-view.scss.txt} +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { devFlags } from '../utils';
|
|
2
|
-
import { CleanupRegistry } from './cleanup-registry';
|
|
3
|
-
const internals = new WeakMap();
|
|
4
|
-
// const trackedElements = new WeakMap<FormAssociatedBase, Set<Element>>()
|
|
5
|
-
// const observers = new MutationObserverSingleton()
|
|
6
|
-
export function getInternals(instance) {
|
|
7
|
-
const i = internals.get(instance);
|
|
8
|
-
if (!i)
|
|
9
|
-
throw new Error('Not a FormAssociatedBase instance');
|
|
10
|
-
return i;
|
|
11
|
-
}
|
|
12
|
-
// export function makeSlotchangeHandler(t: FormAssociatedBase) {
|
|
13
|
-
// const handleSlotchange = ({ type, target: slot }: Event) => {
|
|
14
|
-
// if (devFlags.debug) console.debug(`${makeSlotchangeHandler.name} ⚡️ ${type}`)
|
|
15
|
-
// if (!(slot instanceof HTMLSlotElement && slot)) return
|
|
16
|
-
// const assigned = slot.assignedElements({ flatten: true })
|
|
17
|
-
// observers.syncObservations(trackedElements.get(t) ?? new Set(), assigned, handleTagMutation, ['value', 'label'])
|
|
18
|
-
// if (0 < assigned.length) handleTagMutation()
|
|
19
|
-
// },
|
|
20
|
-
// handleTagMutation = (entry?: MutationRecord) => {
|
|
21
|
-
// if (devFlags.debug) console.debug(`${handleTagMutation.name} ⚡️ mutation`)
|
|
22
|
-
// t.setValidity(t.validity, t.validationMessage)
|
|
23
|
-
// }
|
|
24
|
-
// return [{ types: 'slotchange', listener: handleSlotchange }]
|
|
25
|
-
// }
|
|
26
|
-
export class FormAssociatedBase extends HTMLElement {
|
|
27
|
-
static get formAssociated() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
internals.set(this, this.attachInternals?.());
|
|
33
|
-
// trackedElements.set(this, new Set<Element>())
|
|
34
|
-
}
|
|
35
|
-
disconnectedCallback() {
|
|
36
|
-
if (devFlags.debug)
|
|
37
|
-
console.debug(`${FormAssociatedBase.name} ⚡️ disconnect`);
|
|
38
|
-
CleanupRegistry.unregister(this);
|
|
39
|
-
// observers.clearObservationsSet(trackedElements.get(this) ?? new Set())
|
|
40
|
-
}
|
|
41
|
-
connectedCallback() {
|
|
42
|
-
if (devFlags.debug)
|
|
43
|
-
console.debug(`${FormAssociatedBase.name} ⚡️ connect`);
|
|
44
|
-
}
|
|
45
|
-
get type() {
|
|
46
|
-
return this.localName;
|
|
47
|
-
}
|
|
48
|
-
get form() {
|
|
49
|
-
return getInternals(this).form;
|
|
50
|
-
}
|
|
51
|
-
get validity() {
|
|
52
|
-
return getInternals(this).validity;
|
|
53
|
-
}
|
|
54
|
-
get validationMessage() {
|
|
55
|
-
return getInternals(this).validationMessage;
|
|
56
|
-
}
|
|
57
|
-
get willValidate() {
|
|
58
|
-
return getInternals(this).willValidate;
|
|
59
|
-
}
|
|
60
|
-
checkValidity = () => {
|
|
61
|
-
return getInternals(this).checkValidity();
|
|
62
|
-
};
|
|
63
|
-
reportValidity = () => {
|
|
64
|
-
return getInternals(this).reportValidity();
|
|
65
|
-
};
|
|
66
|
-
shake = async (times = 3, distance = 8, duration = 400) => {
|
|
67
|
-
const frames = [{ transform: 'translateX(0)' }];
|
|
68
|
-
for (let i = 0; i < times; i++)
|
|
69
|
-
frames.push({ transform: `translateX(-${distance}px)` }, { transform: `translateX(${distance}px)` });
|
|
70
|
-
frames.push({ transform: 'translateX(0)' });
|
|
71
|
-
try {
|
|
72
|
-
await this.animate(frames, { duration, easing: 'ease-in-out' }).finished;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
//
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare class MutationObserverSet {
|
|
2
|
-
#private;
|
|
3
|
-
private callback;
|
|
4
|
-
constructor(callback: MutationCallback);
|
|
5
|
-
observe(target: Element, attributeFilter?: string[]): Promise<void>;
|
|
6
|
-
unobserve(target: Element): Promise<void>;
|
|
7
|
-
syncObservations(source: Element[], attributeFilter?: string[]): Promise<void>;
|
|
8
|
-
unobserveAll(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Snapshot } from '../../snapshot';
|
|
2
|
-
export class MutationObserverSet {
|
|
3
|
-
callback;
|
|
4
|
-
#observers = new Map();
|
|
5
|
-
constructor(callback) {
|
|
6
|
-
this.callback = callback;
|
|
7
|
-
}
|
|
8
|
-
async observe(target, attributeFilter) {
|
|
9
|
-
await Snapshot.waitReady;
|
|
10
|
-
if (this.#observers.has(target))
|
|
11
|
-
return;
|
|
12
|
-
const observer = new MutationObserver(this.callback);
|
|
13
|
-
observer.observe(target, {
|
|
14
|
-
attributes: true,
|
|
15
|
-
characterData: true,
|
|
16
|
-
subtree: true,
|
|
17
|
-
childList: true,
|
|
18
|
-
...(attributeFilter && { attributeFilter }),
|
|
19
|
-
});
|
|
20
|
-
this.#observers.set(target, observer);
|
|
21
|
-
}
|
|
22
|
-
async unobserve(target) {
|
|
23
|
-
await Snapshot.waitReady;
|
|
24
|
-
this.#observers.get(target)?.disconnect();
|
|
25
|
-
this.#observers.delete(target);
|
|
26
|
-
}
|
|
27
|
-
async syncObservations(source, attributeFilter) {
|
|
28
|
-
await Snapshot.waitReady;
|
|
29
|
-
const sourceSet = new Set(source);
|
|
30
|
-
for (const el of [...this.#observers.keys()])
|
|
31
|
-
if (!sourceSet.has(el))
|
|
32
|
-
this.unobserve(el);
|
|
33
|
-
for (const el of source)
|
|
34
|
-
this.observe(el, attributeFilter);
|
|
35
|
-
}
|
|
36
|
-
async unobserveAll() {
|
|
37
|
-
await Snapshot.waitReady;
|
|
38
|
-
for (const obs of this.#observers.values())
|
|
39
|
-
obs.disconnect();
|
|
40
|
-
this.#observers.clear();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class MutationObserverSingleton {
|
|
2
|
-
#private;
|
|
3
|
-
readonly observer: Promise<MutationObserver>;
|
|
4
|
-
constructor();
|
|
5
|
-
observe(target: Node, callback: (entry: MutationRecord) => void, options: MutationObserverInit): Promise<void>;
|
|
6
|
-
unobserve(target: Node): Promise<void>;
|
|
7
|
-
/** Observes automatically all elements using a Set provided by outside. Calls renderCallback on EVERY change. */
|
|
8
|
-
syncObservations(set: Set<Element>, nodes: Element[], renderCallback: () => void, attributeFilter?: string[]): Promise<void>;
|
|
9
|
-
clearObservationsSet(set: Set<Element>): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Snapshot } from '../../snapshot';
|
|
2
|
-
export class MutationObserverSingleton {
|
|
3
|
-
#observers = new WeakMap();
|
|
4
|
-
observer;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.observer = Snapshot.waitReady.then(() => {
|
|
7
|
-
return new MutationObserver((entries) => {
|
|
8
|
-
for (const entry of entries)
|
|
9
|
-
this.#observers.get(entry.target)?.(entry);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
async observe(target, callback, options) {
|
|
14
|
-
this.#observers.set(target, callback);
|
|
15
|
-
(await this.observer).observe(target, options);
|
|
16
|
-
}
|
|
17
|
-
async unobserve(target) {
|
|
18
|
-
;
|
|
19
|
-
(await this.observer).disconnect();
|
|
20
|
-
this.#observers.delete(target);
|
|
21
|
-
}
|
|
22
|
-
/** Observes automatically all elements using a Set provided by outside. Calls renderCallback on EVERY change. */
|
|
23
|
-
// shortcur fot this
|
|
24
|
-
// #trackedElements = new Set<Element>()
|
|
25
|
-
// for (const el of this.#trackedElements)
|
|
26
|
-
// if (!assigned.includes(el)) {
|
|
27
|
-
// observers.unobserve(el)
|
|
28
|
-
// this.#trackedElements.delete(el)
|
|
29
|
-
// }
|
|
30
|
-
// for (const el of assigned) {
|
|
31
|
-
// if (!this.#trackedElements.has(el))
|
|
32
|
-
// observers.observe(el, this.#handleTagMutation, {
|
|
33
|
-
// attributes: true,
|
|
34
|
-
// characterData: true,
|
|
35
|
-
// subtree: true,
|
|
36
|
-
// childList: true,
|
|
37
|
-
// // attributeFilter: ['value', 'label'],
|
|
38
|
-
// })
|
|
39
|
-
// this.#trackedElements.add(el)
|
|
40
|
-
// }
|
|
41
|
-
async syncObservations(set, nodes, renderCallback, attributeFilter) {
|
|
42
|
-
for (const el of set)
|
|
43
|
-
if (!nodes.includes(el)) {
|
|
44
|
-
this.unobserve(el);
|
|
45
|
-
set.delete(el);
|
|
46
|
-
}
|
|
47
|
-
for (const el of nodes) {
|
|
48
|
-
if (!set.has(el))
|
|
49
|
-
this.observe(el, renderCallback, {
|
|
50
|
-
attributes: true,
|
|
51
|
-
characterData: true,
|
|
52
|
-
subtree: true,
|
|
53
|
-
childList: true,
|
|
54
|
-
...(attributeFilter && { attributeFilter }),
|
|
55
|
-
});
|
|
56
|
-
set.add(el);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async clearObservationsSet(set) {
|
|
60
|
-
for (const el of set)
|
|
61
|
-
this.unobserve(el);
|
|
62
|
-
set.clear();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type * as Components from '../../components';
|
|
2
|
-
import { type NavigationHost, type NavigationPage, type NavigationToolbarConfiguration } from '../privateNamespace';
|
|
3
|
-
export declare class NavigationPath {
|
|
4
|
-
#private;
|
|
5
|
-
get component(): NavigationHost | undefined;
|
|
6
|
-
get body(): Components.ScrollView | null | undefined;
|
|
7
|
-
get page(): NavigationPage | null | undefined;
|
|
8
|
-
get toolBarConfig(): NavigationToolbarConfiguration[] | undefined;
|
|
9
|
-
get slot(): NavigationHost | null | undefined;
|
|
10
|
-
constructor(any?: HTMLElement);
|
|
11
|
-
hydrate(): this;
|
|
12
|
-
children(): Generator<NavigationPath>;
|
|
13
|
-
parents(): Generator<NavigationPath>;
|
|
14
|
-
[Symbol.iterator](): Generator<NavigationPath>;
|
|
15
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets current host (closest)
|
|
3
|
-
*/
|
|
4
|
-
function closestHost(any) {
|
|
5
|
-
return any?.closest('body-view,[is=sheet-view],navigation-stack,navigation-split-view') ?? undefined;
|
|
6
|
-
}
|
|
7
|
-
export class NavigationPath {
|
|
8
|
-
#component;
|
|
9
|
-
#slot;
|
|
10
|
-
#body;
|
|
11
|
-
#page;
|
|
12
|
-
#toolBarConfig;
|
|
13
|
-
get component() {
|
|
14
|
-
return this.#component;
|
|
15
|
-
}
|
|
16
|
-
get body() {
|
|
17
|
-
if (undefined === this.#body)
|
|
18
|
-
this.#queryBody();
|
|
19
|
-
return this.#body;
|
|
20
|
-
}
|
|
21
|
-
get page() {
|
|
22
|
-
if (undefined === this.#page)
|
|
23
|
-
this.#queryPage();
|
|
24
|
-
return this.#page;
|
|
25
|
-
}
|
|
26
|
-
get toolBarConfig() {
|
|
27
|
-
if (undefined === this.#toolBarConfig)
|
|
28
|
-
this.#queryToolBarConfig();
|
|
29
|
-
return this.#toolBarConfig;
|
|
30
|
-
}
|
|
31
|
-
get slot() {
|
|
32
|
-
if (undefined === this.#slot)
|
|
33
|
-
this.#querySlot();
|
|
34
|
-
return this.#slot;
|
|
35
|
-
}
|
|
36
|
-
constructor(any) {
|
|
37
|
-
this.#component = closestHost(any);
|
|
38
|
-
}
|
|
39
|
-
#queryBody() {
|
|
40
|
-
this.#body = closestHost(this.#component)?.querySelector(`:scope>scroll-view,:scope>[is=sidebar-view]>scroll-view`) ?? null;
|
|
41
|
-
}
|
|
42
|
-
#queryPage() {
|
|
43
|
-
this.#page = this.#component?.querySelector(':scope>scroll-view,:scope>[is=sidebar-view]') ?? null;
|
|
44
|
-
}
|
|
45
|
-
#queryToolBarConfig() {
|
|
46
|
-
this.#toolBarConfig = [
|
|
47
|
-
...(this.#component?.querySelectorAll(`:scope>tool-bar>tool-bar-item,:scope>tool-bar>tool-bar-item-group,:scope>[is=sidebar-view]>tool-bar>tool-bar-item,:scope>[is=sidebar-view]>tool-bar>tool-bar-item-group`) ?? []),
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
#querySlot() {
|
|
51
|
-
this.#slot =
|
|
52
|
-
this.#component?.querySelector(':scope>body-view:not([hidden]),:scope>[is=sheet-view]:not([hidden]),:scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])') ?? null;
|
|
53
|
-
}
|
|
54
|
-
hydrate() {
|
|
55
|
-
this.#queryBody();
|
|
56
|
-
this.#queryPage();
|
|
57
|
-
this.#queryToolBarConfig();
|
|
58
|
-
this.#querySlot();
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
*children() {
|
|
62
|
-
if (!this.slot)
|
|
63
|
-
return;
|
|
64
|
-
const child = new NavigationPath(this.slot);
|
|
65
|
-
yield child;
|
|
66
|
-
yield* child.children();
|
|
67
|
-
}
|
|
68
|
-
*parents() {
|
|
69
|
-
if (!this.#component)
|
|
70
|
-
return;
|
|
71
|
-
let el = this.#component.parentElement;
|
|
72
|
-
while (el) {
|
|
73
|
-
const host = closestHost(el);
|
|
74
|
-
if (!host)
|
|
75
|
-
break;
|
|
76
|
-
yield new NavigationPath(host);
|
|
77
|
-
el = host.parentElement;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
*[Symbol.iterator]() {
|
|
81
|
-
yield this;
|
|
82
|
-
yield* this.children();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class NavigationView extends HTMLElement {
|
|
2
|
-
#private;
|
|
3
|
-
static get observedAttributes(): string[];
|
|
4
|
-
constructor();
|
|
5
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
6
|
-
disconnectedCallback(): void;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { lifecycleObserver } from '../../buses';
|
|
3
|
-
import { CleanupRegistry } from '../../internal/class/cleanup-registry';
|
|
4
|
-
import { devFlags, frame, onoff } from '../utils';
|
|
5
|
-
export class NavigationView extends HTMLElement {
|
|
6
|
-
static get observedAttributes() {
|
|
7
|
-
return ['hidden'];
|
|
8
|
-
}
|
|
9
|
-
// pairedEventSystem
|
|
10
|
-
#recentBefore;
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
15
|
-
switch (name) {
|
|
16
|
-
case 'hidden':
|
|
17
|
-
if (oldValue === newValue)
|
|
18
|
-
break;
|
|
19
|
-
if (!this.closest('tab-view'))
|
|
20
|
-
break; // tabview stuff
|
|
21
|
-
// trigger show/hide/reveal/swap on NEXT tick
|
|
22
|
-
// show/hide run on initial render too (show on NEXT tick, is also taken care of on connected on initial render)
|
|
23
|
-
let eventType = this.hasAttribute(name) ? 'tabhide' : 'tabshow', target = lifecycleObserver;
|
|
24
|
-
// isRecent by 100ms window
|
|
25
|
-
// && performance.now() - this.#recentBefore.time <= 100) {
|
|
26
|
-
if (this.#recentBefore) {
|
|
27
|
-
if (['beforetabreveal', 'beforetabswap'].includes(this.#recentBefore.type)) {
|
|
28
|
-
eventType = this.#recentBefore.type === 'beforetabreveal' ? 'tabreveal' : 'tabswap';
|
|
29
|
-
target = this;
|
|
30
|
-
}
|
|
31
|
-
// consume it (important so it doesn’t leak to next change)
|
|
32
|
-
this.#recentBefore = undefined;
|
|
33
|
-
}
|
|
34
|
-
if (devFlags.debug)
|
|
35
|
-
console.debug(`${_a.name} 💡 ${eventType}`);
|
|
36
|
-
frame(this).then(() => target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
disconnectedCallback() {
|
|
41
|
-
CleanupRegistry.unregister(this);
|
|
42
|
-
this.#recentBefore = undefined;
|
|
43
|
-
// trigger hide on NEXT tick
|
|
44
|
-
if (!this.closest('tab-view'))
|
|
45
|
-
return;
|
|
46
|
-
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabhide', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
47
|
-
}
|
|
48
|
-
connectedCallback() {
|
|
49
|
-
if (!this.closest('tab-view'))
|
|
50
|
-
return;
|
|
51
|
-
// wire befores
|
|
52
|
-
CleanupRegistry.register(this, onoff('beforetabreveal beforetabswap', this.#handleBeforeTabRevealOrSwap, this).on());
|
|
53
|
-
// trigger show on NEXT tick
|
|
54
|
-
if (this.hasAttribute('hidden'))
|
|
55
|
-
return; // skip if already rendered by attr-change during upgrade!
|
|
56
|
-
frame(this).then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
57
|
-
}
|
|
58
|
-
#handleBeforeTabRevealOrSwap = ({ type, detail }) => {
|
|
59
|
-
if (devFlags.debug)
|
|
60
|
-
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
61
|
-
if (this.id !== detail?.tag)
|
|
62
|
-
return;
|
|
63
|
-
this.#recentBefore = {
|
|
64
|
-
type, // beforetabreveal / beforetabswap
|
|
65
|
-
time: performance.now(),
|
|
66
|
-
};
|
|
67
|
-
self.queueMicrotask(() => {
|
|
68
|
-
this.#recentBefore = undefined;
|
|
69
|
-
}); // auto-expire after current task
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
_a = NavigationView;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Snapshot } from '../../snapshot';
|
|
2
|
-
export class ResizeObserverSingleton {
|
|
3
|
-
#observers = new WeakMap();
|
|
4
|
-
observer;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.observer = Snapshot.waitReady.then(() => {
|
|
7
|
-
return new ResizeObserver((entries) => {
|
|
8
|
-
for (const entry of entries)
|
|
9
|
-
this.#observers.get(entry.target)?.(entry);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
async observe(target, callback) {
|
|
14
|
-
this.#observers.set(target, callback);
|
|
15
|
-
(await this.observer).observe(target);
|
|
16
|
-
}
|
|
17
|
-
async unobserve(target) {
|
|
18
|
-
;
|
|
19
|
-
(await this.observer).unobserve(target);
|
|
20
|
-
this.#observers.delete(target);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (filter?: (el: HTMLElement) => boolean): <T extends CustomElementConstructor>(Base: T, _context?: ClassDecoratorContext<T>) => void;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Snapshot } from '../../snapshot';
|
|
2
|
-
import { CleanupRegistry } from '../class/cleanup-registry';
|
|
3
|
-
import { devFlags, onoff } from '../utils';
|
|
4
|
-
export default function (filter) {
|
|
5
|
-
const handleMediaChange = (el, { type, matches }) => {
|
|
6
|
-
if (devFlags.debug)
|
|
7
|
-
console.debug(`${el.localName} ⚡️ ${type}`);
|
|
8
|
-
if (matches) {
|
|
9
|
-
if (!el.matches(`[slot="cancellation-action"],[slot="primary-action"],[slot="confirmation-action"],[slot="destructive-action"]`))
|
|
10
|
-
return;
|
|
11
|
-
const newSlot = ['destructive-action'].includes(el.slot) ? 'bottom-bar-leading' : 'bottom-bar-trailing';
|
|
12
|
-
if (el.slot !== newSlot)
|
|
13
|
-
el.dataset.previousSlot = el.slot;
|
|
14
|
-
el.slot = newSlot;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (!el.matches(`[data-previous-slot]`))
|
|
18
|
-
return;
|
|
19
|
-
el.slot = el.dataset.previousSlot ?? '';
|
|
20
|
-
delete el.dataset.previousSlot;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return function (Base, _context) {
|
|
24
|
-
const originalConnected = Base.prototype.connectedCallback, originalDisconnected = Base.prototype.disconnectedCallback;
|
|
25
|
-
Base.prototype.connectedCallback = function () {
|
|
26
|
-
if (devFlags.debug)
|
|
27
|
-
console.debug(`decorator:[${this.localName}] ⚡️ connect`);
|
|
28
|
-
originalConnected?.call(this);
|
|
29
|
-
if (filter && !filter(this))
|
|
30
|
-
return;
|
|
31
|
-
if (!this.closest('[is=sheet-view]'))
|
|
32
|
-
return;
|
|
33
|
-
if (!self.matchMedia('(pointer: fine)').matches)
|
|
34
|
-
return;
|
|
35
|
-
const handler1 = handleMediaChange.bind(null, this);
|
|
36
|
-
CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1, Snapshot.on).on(), 'adaptive-slot');
|
|
37
|
-
Snapshot.waitReady.then(() => {
|
|
38
|
-
handleMediaChange(this, new MediaQueryListEvent(`media-change`, {
|
|
39
|
-
matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
40
|
-
})); // Initial check
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
Base.prototype.disconnectedCallback = function () {
|
|
44
|
-
if (devFlags.debug)
|
|
45
|
-
console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
|
|
46
|
-
originalDisconnected?.call(this);
|
|
47
|
-
CleanupRegistry.unregister(this, 'adaptive-slot');
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as adaptiveSlot } from './adaptive-slot';
|
|
2
|
-
export * from './adaptive-slot';
|
|
3
|
-
export { default as customElement } from './custom-element';
|
|
4
|
-
export * from './custom-element';
|
|
5
|
-
export { default as microtaskOnConnected } from './microtask-on-connected';
|
|
6
|
-
export * from './microtask-on-connected';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as adaptiveSlot } from './adaptive-slot';
|
|
2
|
-
export * from './adaptive-slot';
|
|
3
|
-
export { default as customElement } from './custom-element';
|
|
4
|
-
export * from './custom-element';
|
|
5
|
-
export { default as microtaskOnConnected } from './microtask-on-connected';
|
|
6
|
-
export * from './microtask-on-connected';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replacement for this
|
|
3
|
-
class() {
|
|
4
|
-
#pendingSync = false
|
|
5
|
-
#scheduleSync() {
|
|
6
|
-
if (this.#pendingSync) return
|
|
7
|
-
this.#pendingSync = true
|
|
8
|
-
self.queueMicrotask(() => {
|
|
9
|
-
this.#pendingSync = false
|
|
10
|
-
this.#syncSibling()
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
#syncSibling = () => {
|
|
14
|
-
const sibling = this.closest<ScrollView>('scroll-view'),
|
|
15
|
-
value = this.getAttribute('value'),
|
|
16
|
-
subtitle = this.getAttribute('subtitle')
|
|
17
|
-
|
|
18
|
-
if (null === value) sibling?.removeAttribute('navigation-inline-title')
|
|
19
|
-
else sibling?.setAttribute('navigation-inline-title', value)
|
|
20
|
-
|
|
21
|
-
if (null === subtitle) sibling?.removeAttribute('navigation-inline-subtitle')
|
|
22
|
-
else sibling?.setAttribute('navigation-inline-subtitle', subtitle)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
|
|
27
|
-
|
|
28
|
-
this.#scheduleSync()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
32
|
-
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
|
|
33
|
-
|
|
34
|
-
this.#scheduleSync()
|
|
35
|
-
|
|
36
|
-
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'))
|
|
37
|
-
}
|
|
38
|
-
*/
|
|
39
|
-
export default function <T extends HTMLElement>(fn: (el: T) => void): <C extends CustomElementConstructor>(Base: C, _context?: ClassDecoratorContext<C>) => void;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replacement for this
|
|
3
|
-
class() {
|
|
4
|
-
#pendingSync = false
|
|
5
|
-
#scheduleSync() {
|
|
6
|
-
if (this.#pendingSync) return
|
|
7
|
-
this.#pendingSync = true
|
|
8
|
-
self.queueMicrotask(() => {
|
|
9
|
-
this.#pendingSync = false
|
|
10
|
-
this.#syncSibling()
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
#syncSibling = () => {
|
|
14
|
-
const sibling = this.closest<ScrollView>('scroll-view'),
|
|
15
|
-
value = this.getAttribute('value'),
|
|
16
|
-
subtitle = this.getAttribute('subtitle')
|
|
17
|
-
|
|
18
|
-
if (null === value) sibling?.removeAttribute('navigation-inline-title')
|
|
19
|
-
else sibling?.setAttribute('navigation-inline-title', value)
|
|
20
|
-
|
|
21
|
-
if (null === subtitle) sibling?.removeAttribute('navigation-inline-subtitle')
|
|
22
|
-
else sibling?.setAttribute('navigation-inline-subtitle', subtitle)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
|
|
27
|
-
|
|
28
|
-
this.#scheduleSync()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
32
|
-
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
|
|
33
|
-
|
|
34
|
-
this.#scheduleSync()
|
|
35
|
-
|
|
36
|
-
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'))
|
|
37
|
-
}
|
|
38
|
-
*/
|
|
39
|
-
// const _sync = Symbol('sync')
|
|
40
|
-
// @microtaskOnConnected((el) => (el as NavigationTitle)[_sync]())
|
|
41
|
-
// attributeChangedCallback fires
|
|
42
|
-
// → originalAttrChanged (your #render) runs synchronously ✅
|
|
43
|
-
// → schedule() queues microtask
|
|
44
|
-
// → microtask flush: syncToScrollView runs with already-updated attrs ✅
|
|
45
|
-
export default function (fn) {
|
|
46
|
-
return function (Base, _context) {
|
|
47
|
-
const originalConnected = Base.prototype.connectedCallback, originalAttrChanged = Base.prototype.attributeChangedCallback;
|
|
48
|
-
Base.prototype.connectedCallback = function () {
|
|
49
|
-
originalConnected?.call(this);
|
|
50
|
-
schedule(this, fn);
|
|
51
|
-
};
|
|
52
|
-
Base.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
|
|
53
|
-
originalAttrChanged?.call(this, name, oldValue, newValue);
|
|
54
|
-
schedule(this, fn);
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const pendingMap = new WeakMap();
|
|
59
|
-
function schedule(el, fn) {
|
|
60
|
-
if (pendingMap.get(el))
|
|
61
|
-
return;
|
|
62
|
-
pendingMap.set(el, true);
|
|
63
|
-
self.queueMicrotask(() => {
|
|
64
|
-
pendingMap.delete(el);
|
|
65
|
-
fn(el);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type * as Components from '../components';
|
|
2
|
-
import { NavigationPath } from '../internal/class/navigation-path';
|
|
3
|
-
type TransitionType = 'forwards' | 'backwards' | 'reload';
|
|
4
|
-
export type NavigationHost = Components.BodyView | Components.SheetView | Components.NavigationStack | Components.NavigationSplitView;
|
|
5
|
-
export type NavigationToolbarConfiguration = Components.ToolBarItem | Components.ToolBarItemGroup;
|
|
6
|
-
export type NavigationPage = Components.SidebarView | Components.ScrollView;
|
|
7
|
-
export declare function queryInsertPosition(frame: NavigationHost): "afterend" | "beforebegin";
|
|
8
|
-
type UpdateCallback = () => void | Promise<void>;
|
|
9
|
-
type NavigateOptions = {
|
|
10
|
-
updateCallback?: UpdateCallback;
|
|
11
|
-
tos?: () => NavigationPath[];
|
|
12
|
-
};
|
|
13
|
-
export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
|
|
14
|
-
export {};
|