@swiftwc/ui 0.0.0-dev.4 → 0.0.0-dev.6

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.
Files changed (51) hide show
  1. package/generated/client/index.d.ts +6 -0
  2. package/generated/client/index.js +223 -0
  3. package/generated/components/body-view.d.ts +5 -0
  4. package/generated/components/body-view.js +11 -0
  5. package/generated/components/borderless-button.d.ts +9 -0
  6. package/generated/components/borderless-button.js +25 -0
  7. package/generated/components/bottom-bar.d.ts +10 -0
  8. package/generated/components/bottom-bar.js +73 -0
  9. package/generated/components/disclosure-group.d.ts +12 -0
  10. package/generated/components/disclosure-group.js +76 -0
  11. package/generated/components/index.d.ts +15 -0
  12. package/generated/components/index.js +20 -0
  13. package/generated/components/navigation-bar.d.ts +10 -0
  14. package/generated/components/navigation-bar.js +80 -0
  15. package/generated/components/navigation-split-view.d.ts +5 -0
  16. package/generated/components/navigation-split-view.js +9 -0
  17. package/generated/components/navigation-stack.d.ts +6 -0
  18. package/generated/components/navigation-stack.js +67 -0
  19. package/generated/components/screen-view.d.ts +5 -0
  20. package/generated/components/screen-view.js +9 -0
  21. package/generated/components/scroll-view.d.ts +8 -0
  22. package/generated/components/scroll-view.js +80 -0
  23. package/generated/components/sheet-view.d.ts +9 -0
  24. package/generated/components/sheet-view.js +26 -0
  25. package/generated/components/sidebar-toggle.d.ts +7 -0
  26. package/generated/components/sidebar-toggle.js +81 -0
  27. package/generated/components/sidebar-view.d.ts +9 -0
  28. package/generated/components/sidebar-view.js +26 -0
  29. package/generated/components/tab-bar.d.ts +9 -0
  30. package/generated/components/tab-bar.js +26 -0
  31. package/generated/components/tab-item.d.ts +6 -0
  32. package/generated/components/tab-item.js +35 -0
  33. package/generated/components/tab-view.d.ts +7 -0
  34. package/generated/components/tab-view.js +29 -0
  35. package/generated/components/v-keyboard.d.ts +11 -0
  36. package/generated/components/v-keyboard.js +87 -0
  37. package/generated/index.d.ts +2 -0
  38. package/generated/index.js +3 -0
  39. package/generated/internal/class.d.ts +18 -0
  40. package/generated/internal/class.js +18 -0
  41. package/generated/internal/utils/css-time.d.ts +1 -0
  42. package/generated/internal/utils/css-time.js +3 -0
  43. package/generated/internal/utils/index.d.ts +2 -0
  44. package/generated/internal/utils/index.js +2 -0
  45. package/generated/internal/utils/kebab-case.d.ts +1 -0
  46. package/generated/internal/utils/kebab-case.js +11 -0
  47. package/generated/namespace/index.d.ts +6 -0
  48. package/generated/namespace/index.js +1 -0
  49. package/generated/snapshot/index.d.ts +16 -0
  50. package/generated/snapshot/index.js +150 -0
  51. package/package.json +4 -4
@@ -0,0 +1,6 @@
1
+ import { Snapshot } from '../snapshot';
2
+ import { type WebComponentCtor } from '../namespace';
3
+ export declare const polyfills: Map<string, WebComponentCtor>;
4
+ type TransitionType = 'forwards' | 'backwards' | 'reload';
5
+ export declare const startViewTransition: (event: Event, type?: TransitionType, updateCallback?: () => Promise<void>) => Promise<void>;
6
+ export { Snapshot };
@@ -0,0 +1,223 @@
1
+ import * as Components from '../components';
2
+ import { kebabCase } from '../internal/utils';
3
+ import { Snapshot } from '../snapshot';
4
+ export const polyfills = new Map();
5
+ for (const [k, v] of Object.entries(Components)) {
6
+ const is = kebabCase(k);
7
+ if ('polyfillExtends' in v &&
8
+ 'string' === typeof v.polyfillExtends) {
9
+ customElements.define(is, v, { extends: v.polyfillExtends });
10
+ if (!(document.createElement(v.polyfillExtends, { is }) instanceof v))
11
+ polyfills.set(is, v);
12
+ continue;
13
+ }
14
+ customElements.define(is, v);
15
+ }
16
+ console.debug(polyfills);
17
+ if (0 < polyfills.size) {
18
+ const polyfillTagNamesCache = new Set([...polyfills.values()]
19
+ .map((v) => String(v.polyfillExtends ?? '').toUpperCase())
20
+ .filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
21
+ const handlers = new WeakMap();
22
+ // @ts-expect-error
23
+ const observe = (el, polyfill) => {
24
+ if (!Array.isArray(polyfill.observedAttributes))
25
+ return;
26
+ if (0 === polyfill?.observedAttributes.length)
27
+ return;
28
+ handlers.set(el, new MutationObserver(polyfill.polyfillAttributeChangedCallback).observe(el, {
29
+ attributes: true,
30
+ attributeFilter: polyfill.observedAttributes,
31
+ attributeOldValue: true,
32
+ }));
33
+ },
34
+ // @ts-expect-error
35
+ unobserve = (el) => {
36
+ handlers.delete(el);
37
+ };
38
+ console.debug(polyfillTagNamesCache);
39
+ for (const [is, polyfill] of polyfills)
40
+ for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${is}"]`)) {
41
+ polyfill.polyfillConnectedCallback(el);
42
+ observe(el, polyfill);
43
+ }
44
+ // observer callback
45
+ const observer = new MutationObserver((mutations) => {
46
+ for (const { addedNodes, removedNodes } of mutations) {
47
+ for (const node of addedNodes) {
48
+ if (!(node instanceof HTMLElement))
49
+ continue;
50
+ if (!polyfillTagNamesCache.has(node.tagName))
51
+ continue;
52
+ const is = node?.getAttribute('is') ?? '';
53
+ if (!polyfills.has(is))
54
+ continue;
55
+ polyfills.get(is)?.polyfillConnectedCallback(node);
56
+ observe(node, polyfills.get(is));
57
+ }
58
+ for (const node of removedNodes) {
59
+ if (!(node instanceof HTMLElement))
60
+ continue;
61
+ if (!polyfillTagNamesCache.has(node.tagName))
62
+ continue;
63
+ const is = node?.getAttribute('is') ?? '';
64
+ if (!polyfills.has(is))
65
+ continue;
66
+ polyfills.get(is)?.polyfillDisconnectedCallback(node);
67
+ unobserve(node);
68
+ }
69
+ }
70
+ });
71
+ observer.observe(document.body, {
72
+ childList: true,
73
+ subtree: true,
74
+ });
75
+ }
76
+ const cleanup = (lm, dir) => {
77
+ let arr = [
78
+ Snapshot.config['vt-fwd-class-name'],
79
+ 'fwdd',
80
+ 'fwn',
81
+ 'fwnn',
82
+ 'bwd',
83
+ 'bwdd',
84
+ 'bwn',
85
+ 'bwnn',
86
+ ];
87
+ if (['backwards', 'forwards'].includes(dir ?? ''))
88
+ for (let i = arr.length - 1; i >= 0; i--)
89
+ if (arr[i].startsWith('backwards' === dir ? 'fw' : 'bw'))
90
+ arr.splice(i, 1);
91
+ for (const el of [
92
+ ...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? []),
93
+ ])
94
+ el.classList.remove(...arr);
95
+ };
96
+ export const startViewTransition = async (event, type = 'forwards', updateCallback = async () => { }) => {
97
+ // const sv =
98
+ // (event.target as HTMLElement).closest<Components.ScrollView>(
99
+ // 'scroll-view'
100
+ // ) ?? undefined,
101
+ const from = event.target.closest('scroll-view') ?? undefined;
102
+ if ('forwards' === type) {
103
+ // const sis = Router.toolbarItems //sv.parentElement.querySelectorAll(`:scope > navigation-bar > toolbar-item,:scope > bottom-bar > toolbar-item`)
104
+ // pr = Router.frame //sv.parentElement
105
+ // const pt = event.target.closest('navigation-stack,body-view')
106
+ // const inte = event.target.closest(".fwd");
107
+ // const st = sv.scrollTop
108
+ // console.log(333, lm, sv, sis)
109
+ // let to
110
+ // inject or unhide
111
+ // if (pr.tagName === 'NAVIGATION-STACK' && 'more' === pr.getAttribute('is')) {
112
+ // to = document.querySelector(`#${event.target.getAttribute('tag')}`)
113
+ // to.hidden = false
114
+ // } else {
115
+ await updateCallback(); // updatetheDOMSomehow
116
+ // to = sv.nextElementSibling //pr.lastElementChild //sv.nextElementSibling
117
+ // }
118
+ Snapshot.getSnapshot(from);
119
+ const fromToolbars = Snapshot.toolbarItems;
120
+ // from = Snapshot.landmark
121
+ const to = Snapshot.leaf, toFrame = Snapshot.leafContainer, toToolbars = Snapshot.leafToolbarItems;
122
+ if ('DIALOG' === toFrame?.tagName) {
123
+ ;
124
+ toFrame.showModal();
125
+ console.debug(`⚡️ view-transition-start (${type})`);
126
+ await Promise.allSettled(toFrame.getAnimations().map(({ finished }) => finished));
127
+ console.debug(`⚡️ view-transition-end (${type})`);
128
+ return;
129
+ }
130
+ // purge
131
+ cleanup(Snapshot.root, 'backwards');
132
+ for (const ti of toToolbars ?? [])
133
+ ti.classList.add('fwnn');
134
+ to?.classList.add('fwdd');
135
+ // prepare principal/leader
136
+ from?.classList.add(Snapshot.config['vt-fwd-class-name']);
137
+ for (const ti of fromToolbars ?? [])
138
+ ti.classList.add('fwn'); // prepare navbs
139
+ // sv.inert = true
140
+ // if (!document.startViewTransition) {
141
+ // startViewTransition(event, false)
142
+ // return
143
+ // }
144
+ // With a transition:
145
+ // const transition = document.startViewTransition({
146
+ // async update() {},
147
+ // types: ['forwards'],
148
+ // })
149
+ // console.debug(transition)
150
+ // await transition.finished
151
+ // alert(3)
152
+ // return
153
+ console.debug(`⚡️ view-transition-start (${type})`);
154
+ await Promise.allSettled([
155
+ ...(from?.getAnimations().map(({ finished }) => finished) ?? []),
156
+ ...(to?.getAnimations().map(({ finished }) => finished) ?? []),
157
+ ]);
158
+ // await Promise.allSettled(
159
+ // from.getAnimations().map(({ finished }) => finished)
160
+ // )
161
+ console.debug(`⚡️ view-transition-end (${type})`);
162
+ // console.log(9, to.querySelectorAll('.fwd'))
163
+ // sv2.classList.remove("fwdd");
164
+ if (0 <
165
+ (toFrame?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
166
+ return;
167
+ cleanup(Snapshot.root);
168
+ }
169
+ else {
170
+ Snapshot.getSnapshot(from);
171
+ const fromToolbars = Snapshot.toolbarItems,
172
+ // from = Snapshot.landmark,
173
+ fromFrame = Snapshot.container; //sv.parentElement.querySelectorAll(`:scope > navigation-bar > toolbar-item,:scope > bottom-bar > toolbar-item`)
174
+ // fromFrame = Router.frame //sv.parentElement
175
+ // const pt = event.target.closest('navigation-stack,body-view')
176
+ // const pt = pt0.parentElement.closest('navigation-stack,body-view')
177
+ const to = Snapshot.parent, //pr.parentElement.querySelector(`:scope > scroll-view`) //pr.previousElementSibling
178
+ // toFrame = Snapshot.parentContainer,
179
+ toToolbars = Snapshot.parentToolbarItems; //sv2.parentElement?.querySelectorAll?.( `:scope > navigation-bar > toolbar-item,:scope > bottom-bar > toolbar-item` )
180
+ // const st2 = sv2.scrollTop
181
+ if ('DIALOG' === fromFrame?.tagName) {
182
+ ;
183
+ fromFrame.close();
184
+ console.debug(`⚡️ view-transition-start (${type})`);
185
+ await Promise.allSettled(fromFrame.getAnimations().map(({ finished }) => finished));
186
+ console.debug(`⚡️ view-transition-end (${type})`);
187
+ if (fromFrame.matches('[open]'))
188
+ return;
189
+ await updateCallback();
190
+ return;
191
+ }
192
+ // purge
193
+ cleanup(Snapshot.root, 'forwards');
194
+ // prepare others
195
+ for (const ti of toToolbars ?? [])
196
+ ti.classList.add('bwnn');
197
+ to?.classList.add('bwdd');
198
+ // sv2.style.visibility = "visible";
199
+ // prepare leader/principal (tracked)
200
+ for (const ti of fromToolbars ?? [])
201
+ ti.classList.add('bwn');
202
+ from?.classList.add('bwd');
203
+ // pr.inert = true
204
+ console.debug(`⚡️ view-transition-start (${type})`);
205
+ await Promise.allSettled([
206
+ ...(from?.getAnimations().map(({ finished }) => finished) ?? []),
207
+ ...(to?.getAnimations().map(({ finished }) => finished) ?? []),
208
+ ]);
209
+ // await Promise.allSettled(
210
+ // from.getAnimations().map(({ finished }) => finished)
211
+ // )
212
+ // await Promise.allSettled(to.getAnimations().map(({ finished }) => finished))
213
+ console.debug(`⚡️ view-transition-end (${type})`);
214
+ // console.log(999, sv2.closest('.fwd'))
215
+ if (to?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
216
+ return;
217
+ cleanup(Snapshot.root);
218
+ // remove or hide
219
+ await updateCallback();
220
+ }
221
+ };
222
+ void Snapshot.setOwnConfig();
223
+ export { Snapshot };
@@ -0,0 +1,5 @@
1
+ export declare class BodyView extends HTMLElement {
2
+ constructor();
3
+ disconnectedCallback(): void;
4
+ connectedCallback(): void;
5
+ }
@@ -0,0 +1,11 @@
1
+ export class BodyView extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ }
5
+ disconnectedCallback() {
6
+ console.debug(`${BodyView.name} ⚡️ disconnect`);
7
+ }
8
+ connectedCallback() {
9
+ console.debug(`${BodyView.name} ⚡️ connect`);
10
+ }
11
+ }
@@ -0,0 +1,9 @@
1
+ import { ButtonBase } from '../internal/class';
2
+ export declare class BorderlessButton extends ButtonBase {
3
+ constructor();
4
+ disconnectedCallback(): void;
5
+ connectedCallback(): void;
6
+ static polyfillDisconnectedCallback(el: BorderlessButton): void;
7
+ static polyfillConnectedCallback(el: BorderlessButton): void;
8
+ static handleClick: (event: Event) => Promise<void>;
9
+ }
@@ -0,0 +1,25 @@
1
+ var _a;
2
+ import { ButtonBase } from '../internal/class';
3
+ export class BorderlessButton extends ButtonBase {
4
+ constructor() {
5
+ super();
6
+ }
7
+ disconnectedCallback() {
8
+ console.debug(`${_a.name} ⚡️ disconnect`);
9
+ _a.polyfillDisconnectedCallback(this);
10
+ }
11
+ connectedCallback() {
12
+ console.debug(`${_a.name} ⚡️ connect`);
13
+ _a.polyfillConnectedCallback(this);
14
+ }
15
+ static polyfillDisconnectedCallback(el) {
16
+ el.removeEventListener('click', _a.handleClick);
17
+ }
18
+ static polyfillConnectedCallback(el) {
19
+ el.addEventListener('click', _a.handleClick);
20
+ }
21
+ }
22
+ _a = BorderlessButton;
23
+ BorderlessButton.handleClick = async (event) => {
24
+ alert(99);
25
+ };
@@ -0,0 +1,10 @@
1
+ export declare class BottomBar extends HTMLElement {
2
+ #private;
3
+ static get leadingPartName(): string;
4
+ static get principalPartName(): string;
5
+ static get trailingPartName(): string;
6
+ static get template(): HTMLTemplateElement;
7
+ constructor();
8
+ connectedCallback(): void;
9
+ disconnectedCallback(): void;
10
+ }
@@ -0,0 +1,73 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _BottomBar_instances, _a, _BottomBar_template, _BottomBar_shadowRoot, _BottomBar_ro, _BottomBar_sibling_get, _BottomBar_sp_set, _BottomBar_ep_set, _BottomBar_measureStacks;
13
+ export class BottomBar extends HTMLElement {
14
+ static get leadingPartName() {
15
+ return 'toolbar-leading-stack';
16
+ }
17
+ static get principalPartName() {
18
+ return 'toolbar-principal-stack';
19
+ }
20
+ static get trailingPartName() {
21
+ return 'toolbar-trailing-stack';
22
+ }
23
+ static get template() {
24
+ if (!__classPrivateFieldGet(this, _a, "f", _BottomBar_template))
25
+ __classPrivateFieldSet(this, _a, Object.assign(document.createElement('template'), {
26
+ innerHTML: `<div part="${this.leadingPartName}">
27
+ <slot name="leading"></slot>
28
+ </div>
29
+ <div part="${this.principalPartName}">
30
+ <slot></slot>
31
+ </div>
32
+ <div part="${this.trailingPartName}">
33
+ <slot name="trailing"></slot>
34
+ </div>`,
35
+ }), "f", _BottomBar_template);
36
+ return __classPrivateFieldGet(this, _a, "f", _BottomBar_template);
37
+ }
38
+ constructor() {
39
+ super();
40
+ _BottomBar_instances.add(this);
41
+ _BottomBar_shadowRoot.set(this, void 0);
42
+ _BottomBar_ro.set(this, void 0);
43
+ __classPrivateFieldSet(this, _BottomBar_shadowRoot, this.attachShadow({ mode: 'open' }), "f");
44
+ __classPrivateFieldGet(this, _BottomBar_shadowRoot, "f").appendChild(document.importNode(this.constructor.template.content, true));
45
+ __classPrivateFieldSet(this, _BottomBar_ro, new ResizeObserver(__classPrivateFieldGet(this, _BottomBar_instances, "m", _BottomBar_measureStacks).bind(this)), "f");
46
+ }
47
+ connectedCallback() {
48
+ console.debug(`${_a.name} ⚡️ connect`);
49
+ __classPrivateFieldGet(this, _BottomBar_ro, "f")?.observe(__classPrivateFieldGet(this, _BottomBar_shadowRoot, "f").querySelector(`[part="${this.constructor.leadingPartName}"]`));
50
+ __classPrivateFieldGet(this, _BottomBar_ro, "f")?.observe(__classPrivateFieldGet(this, _BottomBar_shadowRoot, "f").querySelector(`[part="${this.constructor.trailingPartName}"]`));
51
+ }
52
+ disconnectedCallback() {
53
+ console.debug(`${_a.name} ⚡️ disconnect`);
54
+ __classPrivateFieldGet(this, _BottomBar_ro, "f").disconnect();
55
+ }
56
+ }
57
+ _a = BottomBar, _BottomBar_shadowRoot = new WeakMap(), _BottomBar_ro = new WeakMap(), _BottomBar_instances = new WeakSet(), _BottomBar_sibling_get = function _BottomBar_sibling_get() {
58
+ return (this.parentElement?.querySelector(':scope > scroll-view') ?? undefined); //this.previousElementSibling ?? undefined
59
+ }, _BottomBar_sp_set = function _BottomBar_sp_set(nv) {
60
+ ;
61
+ __classPrivateFieldGet(this, _BottomBar_instances, "a", _BottomBar_sibling_get)?.style?.setProperty?.('--bottombar-padding-inline-start', `${nv}px`);
62
+ }, _BottomBar_ep_set = function _BottomBar_ep_set(nv) {
63
+ ;
64
+ __classPrivateFieldGet(this, _BottomBar_instances, "a", _BottomBar_sibling_get)?.style?.setProperty?.('--bottombar-padding-inline-end', `${nv}px`);
65
+ }, _BottomBar_measureStacks = function _BottomBar_measureStacks(entries = []) {
66
+ console.debug(`${_a.name} ⚡️ resize observer callback: ${__classPrivateFieldGet(this, _BottomBar_instances, "m", _BottomBar_measureStacks).name}`);
67
+ for (const { contentRect, target } of entries)
68
+ if (target.part.contains(this.constructor.leadingPartName))
69
+ __classPrivateFieldSet(this, _BottomBar_instances, Math.round(contentRect.width), "a", _BottomBar_sp_set);
70
+ else if (target.part.contains(this.constructor.trailingPartName))
71
+ __classPrivateFieldSet(this, _BottomBar_instances, Math.round(contentRect.width), "a", _BottomBar_ep_set);
72
+ };
73
+ _BottomBar_template = { value: void 0 };
@@ -0,0 +1,12 @@
1
+ import { DetailsBase } from '../internal/class';
2
+ export declare class DisclosureGroup extends DetailsBase {
3
+ static observedAttributes: string[];
4
+ constructor();
5
+ attributeChangedCallback(name: string, oldValue: boolean, newValue: boolean): void;
6
+ disconnectedCallback(): void;
7
+ connectedCallback(): void;
8
+ static polyfillDisconnectedCallback(el: DisclosureGroup): void;
9
+ static polyfillConnectedCallback(el: DisclosureGroup): void;
10
+ static handleClick: (event: Event) => Promise<void>;
11
+ static polyfillAttributeChangedCallback([entry]: MutationRecord[]): Promise<void>;
12
+ }
@@ -0,0 +1,76 @@
1
+ var _a;
2
+ import { DetailsBase } from '../internal/class';
3
+ import { cssTime } from '../internal/utils';
4
+ import { Snapshot } from '../snapshot';
5
+ const observers = new WeakMap();
6
+ export class DisclosureGroup extends DetailsBase {
7
+ constructor() {
8
+ super();
9
+ }
10
+ attributeChangedCallback(name, oldValue, newValue) {
11
+ console.debug(`${_a.name} ⚡️ [${name}] change`);
12
+ if (CSS.supports('interpolate-size', 'allow-keywords'))
13
+ return;
14
+ const mr = {
15
+ attributeName: name,
16
+ oldValue: oldValue,
17
+ target: this,
18
+ };
19
+ // @ts-expect-error
20
+ _a.polyfillAttributeChangedCallback([mr]);
21
+ }
22
+ disconnectedCallback() {
23
+ console.debug(`${_a.name} ⚡️ disconnect`);
24
+ }
25
+ connectedCallback() {
26
+ console.debug(`${_a.name} ⚡️ connect`);
27
+ }
28
+ static polyfillDisconnectedCallback(el) {
29
+ if (CSS.supports('interpolate-size', 'allow-keywords'))
30
+ return;
31
+ el.removeEventListener('click', _a.handleClick);
32
+ observers?.get(el)?.unobserve?.(el);
33
+ }
34
+ static polyfillConnectedCallback(el) {
35
+ if (CSS.supports('interpolate-size', 'allow-keywords'))
36
+ return;
37
+ el.addEventListener('click', _a.handleClick);
38
+ }
39
+ static async polyfillAttributeChangedCallback([entry]) {
40
+ const node = entry.target;
41
+ node.classList.remove(Snapshot.config['disclosure-group-animation-close-class']);
42
+ if (node.open) {
43
+ observers.set(node, new ResizeObserver(([entry]) => {
44
+ const { height } = entry.contentRect;
45
+ node?.style?.setProperty?.(Snapshot.config['disclosure-group-contents-height-css-prop'], `${height}px`);
46
+ }));
47
+ observers.get(node).observe(node);
48
+ }
49
+ else {
50
+ observers.get(node)?.unobserve?.(node);
51
+ observers.delete(node);
52
+ node?.style?.removeProperty?.(Snapshot.config['disclosure-group-contents-height-css-prop']);
53
+ }
54
+ }
55
+ }
56
+ _a = DisclosureGroup;
57
+ DisclosureGroup.observedAttributes = ['open'];
58
+ DisclosureGroup.handleClick = async (event) => {
59
+ if (!event.target.closest('summary'))
60
+ return;
61
+ const el = event.target.closest('details');
62
+ if (!el)
63
+ return;
64
+ const wasOpen = el.open; // will close after this event
65
+ el.inert = true;
66
+ if (wasOpen) {
67
+ el.classList.add(Snapshot.config['disclosure-group-animation-close-class']);
68
+ event.preventDefault();
69
+ event.stopPropagation();
70
+ event.stopImmediatePropagation();
71
+ }
72
+ await new Promise((r) => setTimeout(r, cssTime(`${el.computedStyleMap().get(Snapshot.config['disclosure-group-animation-duration-css-prop'])}`)));
73
+ el.inert = false;
74
+ if (wasOpen)
75
+ el.open = false;
76
+ };
@@ -0,0 +1,15 @@
1
+ export * from './navigation-stack';
2
+ export * from './navigation-split-view';
3
+ export * from './sheet-view';
4
+ export * from './scroll-view';
5
+ export * from './body-view';
6
+ export * from './tab-bar';
7
+ export * from './sidebar-toggle';
8
+ export * from './borderless-button';
9
+ export * from './v-keyboard';
10
+ export * from './navigation-bar';
11
+ export * from './bottom-bar';
12
+ export * from './tab-item';
13
+ export * from './tab-view';
14
+ export * from './sidebar-view';
15
+ export * from './disclosure-group';
@@ -0,0 +1,20 @@
1
+ /*
2
+ * This is a barrel export file for all components and their related types.
3
+ *
4
+ * 🟢 You can import this file directly.
5
+ */
6
+ export * from './navigation-stack';
7
+ export * from './navigation-split-view';
8
+ export * from './sheet-view';
9
+ export * from './scroll-view';
10
+ export * from './body-view';
11
+ export * from './tab-bar';
12
+ export * from './sidebar-toggle';
13
+ export * from './borderless-button';
14
+ export * from './v-keyboard';
15
+ export * from './navigation-bar';
16
+ export * from './bottom-bar';
17
+ export * from './tab-item';
18
+ export * from './tab-view';
19
+ export * from './sidebar-view';
20
+ export * from './disclosure-group';
@@ -0,0 +1,10 @@
1
+ export declare class NavigationBar extends HTMLElement {
2
+ #private;
3
+ static get leadingPartName(): string;
4
+ static get principalPartName(): string;
5
+ static get trailingPartName(): string;
6
+ static get template(): HTMLTemplateElement;
7
+ constructor();
8
+ connectedCallback(): void;
9
+ disconnectedCallback(): void;
10
+ }
@@ -0,0 +1,80 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _NavigationBar_instances, _a, _NavigationBar_template, _NavigationBar_shadowRoot, _NavigationBar_ro, _NavigationBar_sibling_get, _NavigationBar_sp_set, _NavigationBar_ep_set, _NavigationBar_measureStacks;
13
+ export class NavigationBar extends HTMLElement {
14
+ static get leadingPartName() {
15
+ return 'toolbar-leading-stack';
16
+ }
17
+ static get principalPartName() {
18
+ return 'toolbar-principal-stack';
19
+ }
20
+ static get trailingPartName() {
21
+ return 'toolbar-trailing-stack';
22
+ }
23
+ static get template() {
24
+ if (!__classPrivateFieldGet(this, _a, "f", _NavigationBar_template))
25
+ __classPrivateFieldSet(this, _a, Object.assign(document.createElement('template'), {
26
+ innerHTML: `<div part="${this.leadingPartName}">
27
+ <slot name="leading"></slot>
28
+ </div>
29
+ <div part="${this.principalPartName}">
30
+ <slot></slot>
31
+ </div>
32
+ <div part="${this.trailingPartName}">
33
+ <slot name="trailing"></slot>
34
+ </div>`,
35
+ }), "f", _NavigationBar_template);
36
+ return __classPrivateFieldGet(this, _a, "f", _NavigationBar_template);
37
+ }
38
+ constructor() {
39
+ super();
40
+ _NavigationBar_instances.add(this);
41
+ _NavigationBar_shadowRoot.set(this, void 0);
42
+ _NavigationBar_ro.set(this, void 0);
43
+ __classPrivateFieldSet(this, _NavigationBar_shadowRoot, this.attachShadow({ mode: 'open' }), "f");
44
+ __classPrivateFieldGet(this, _NavigationBar_shadowRoot, "f").appendChild(document.importNode(this.constructor.template.content, true));
45
+ // this.#sp = this.#shadowRoot.querySelector<HTMLElement>(
46
+ // '[part="tool-bat-navigation-bar-leading-stack"]'
47
+ // )!.offsetWidth
48
+ // this.#ep = this.#shadowRoot.querySelector<HTMLElement>(
49
+ // '[part="tool-bat-navigation-bar-trailing-stack"]'
50
+ // )!.offsetWidth
51
+ __classPrivateFieldSet(this, _NavigationBar_ro, new ResizeObserver(__classPrivateFieldGet(this, _NavigationBar_instances, "m", _NavigationBar_measureStacks).bind(this)), "f");
52
+ }
53
+ connectedCallback() {
54
+ console.debug(`${_a.name} ⚡️ connect`);
55
+ __classPrivateFieldGet(this, _NavigationBar_ro, "f")?.observe(__classPrivateFieldGet(this, _NavigationBar_shadowRoot, "f").querySelector(`[part="${this.constructor.leadingPartName}"]`));
56
+ __classPrivateFieldGet(this, _NavigationBar_ro, "f")?.observe(__classPrivateFieldGet(this, _NavigationBar_shadowRoot, "f").querySelector(`[part="${this.constructor.trailingPartName}"]`));
57
+ }
58
+ disconnectedCallback() {
59
+ console.debug(`${_a.name} ⚡️ disconnect`);
60
+ __classPrivateFieldGet(this, _NavigationBar_ro, "f").disconnect();
61
+ }
62
+ }
63
+ _a = NavigationBar, _NavigationBar_shadowRoot = new WeakMap(), _NavigationBar_ro = new WeakMap(), _NavigationBar_instances = new WeakSet(), _NavigationBar_sibling_get = function _NavigationBar_sibling_get() {
64
+ return (this.parentElement?.querySelector(':scope > scroll-view') ?? undefined); //this.previousElementSibling ?? undefined
65
+ }, _NavigationBar_sp_set = function _NavigationBar_sp_set(nv) {
66
+ ;
67
+ __classPrivateFieldGet(this, _NavigationBar_instances, "a", _NavigationBar_sibling_get)?.style?.setProperty?.('--navbar-padding-inline-start', `${nv}px`);
68
+ }, _NavigationBar_ep_set = function _NavigationBar_ep_set(nv) {
69
+ ;
70
+ __classPrivateFieldGet(this, _NavigationBar_instances, "a", _NavigationBar_sibling_get)?.style?.setProperty?.('--navbar-padding-inline-end', `${nv}px`);
71
+ }, _NavigationBar_measureStacks = function _NavigationBar_measureStacks(entries = []) {
72
+ console.debug(`${_a.name} ⚡️ resize observer callback: ${__classPrivateFieldGet(this, _NavigationBar_instances, "m", _NavigationBar_measureStacks).name}`);
73
+ for (const { contentRect, target } of entries) {
74
+ if (target.part.contains(this.constructor.leadingPartName))
75
+ __classPrivateFieldSet(this, _NavigationBar_instances, Math.round(contentRect.width), "a", _NavigationBar_sp_set);
76
+ else if (target.part.contains(this.constructor.trailingPartName))
77
+ __classPrivateFieldSet(this, _NavigationBar_instances, Math.round(contentRect.width), "a", _NavigationBar_ep_set);
78
+ }
79
+ };
80
+ _NavigationBar_template = { value: void 0 };
@@ -0,0 +1,5 @@
1
+ export declare class NavigationSplitView extends HTMLElement {
2
+ static observedAttributes: string[];
3
+ constructor();
4
+ disconnectedCallback(): void;
5
+ }
@@ -0,0 +1,9 @@
1
+ export class NavigationSplitView extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ }
5
+ disconnectedCallback() {
6
+ console.debug(`${NavigationSplitView.name} ⚡️ disconnect`);
7
+ }
8
+ }
9
+ NavigationSplitView.observedAttributes = ['hidden'];
@@ -0,0 +1,6 @@
1
+ export declare class NavigationStack extends HTMLElement {
2
+ static observedAttributes: string[];
3
+ constructor();
4
+ disconnectedCallback(): void;
5
+ connectedCallback(): void;
6
+ }