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

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 (263) hide show
  1. package/README.md +15 -0
  2. package/generated/client/index.d.ts +13 -3
  3. package/generated/client/index.js +228 -158
  4. package/generated/components/bordered-button.d.ts +7 -0
  5. package/generated/components/bordered-button.js +20 -0
  6. package/generated/components/bordered-prominent-button.d.ts +7 -0
  7. package/generated/components/bordered-prominent-button.js +20 -0
  8. package/generated/components/borderless-button.d.ts +4 -4
  9. package/generated/components/borderless-button.js +26 -16
  10. package/generated/components/confirmation-dialog.d.ts +9 -0
  11. package/generated/components/confirmation-dialog.js +102 -0
  12. package/generated/components/date-picker.d.ts +46 -0
  13. package/generated/components/date-picker.js +430 -0
  14. package/generated/components/disclosure-group.d.ts +4 -7
  15. package/generated/components/disclosure-group.js +41 -66
  16. package/generated/components/form-view.d.ts +6 -0
  17. package/generated/components/form-view.js +58 -0
  18. package/generated/components/glass-button.d.ts +6 -0
  19. package/generated/components/glass-button.js +17 -0
  20. package/generated/components/glass-prominent-button.d.ts +6 -0
  21. package/generated/components/glass-prominent-button.js +17 -0
  22. package/generated/components/index.d.ts +34 -10
  23. package/generated/components/index.js +33 -14
  24. package/generated/components/label-view.d.ts +9 -0
  25. package/generated/components/label-view.js +83 -0
  26. package/generated/components/list-view.d.ts +5 -0
  27. package/generated/components/list-view.js +29 -0
  28. package/generated/components/menu-view.d.ts +9 -0
  29. package/generated/components/menu-view.js +133 -0
  30. package/generated/components/navigation-large-title.d.ts +6 -0
  31. package/generated/components/navigation-large-title.js +177 -0
  32. package/generated/components/navigation-split-view.d.ts +4 -2
  33. package/generated/components/navigation-split-view.js +11 -2
  34. package/generated/components/navigation-stack.d.ts +3 -2
  35. package/generated/components/navigation-stack.js +15 -58
  36. package/generated/components/navigation-title.d.ts +8 -0
  37. package/generated/components/navigation-title.js +66 -0
  38. package/generated/components/picker-view.d.ts +27 -0
  39. package/generated/components/picker-view.js +442 -0
  40. package/generated/components/plain-button.d.ts +7 -0
  41. package/generated/components/plain-button.js +20 -0
  42. package/generated/components/screen-view.d.ts +1 -1
  43. package/generated/components/screen-view.js +1 -1
  44. package/generated/components/scroll-view.d.ts +4 -2
  45. package/generated/components/scroll-view.js +169 -62
  46. package/generated/components/section-view.d.ts +9 -0
  47. package/generated/components/section-view.js +81 -0
  48. package/generated/components/sheet-view.d.ts +4 -4
  49. package/generated/components/sheet-view.js +59 -16
  50. package/generated/components/sidebar-toggle.d.ts +1 -1
  51. package/generated/components/sidebar-toggle.js +89 -63
  52. package/generated/components/sidebar-view.d.ts +2 -4
  53. package/generated/components/sidebar-view.js +20 -17
  54. package/generated/components/sticky-container.d.ts +6 -0
  55. package/generated/components/sticky-container.js +22 -0
  56. package/generated/components/tab-bar.d.ts +2 -4
  57. package/generated/components/tab-bar.js +24 -17
  58. package/generated/components/tab-item.d.ts +4 -3
  59. package/generated/components/tab-item.js +114 -29
  60. package/generated/components/tab-view.d.ts +17 -2
  61. package/generated/components/tab-view.js +244 -17
  62. package/generated/components/table-view.d.ts +7 -0
  63. package/generated/components/table-view.js +175 -0
  64. package/generated/components/text-field.d.ts +29 -0
  65. package/generated/components/text-field.js +489 -0
  66. package/generated/components/tool-bar-item-group.d.ts +5 -0
  67. package/generated/components/tool-bar-item-group.js +11 -0
  68. package/generated/components/tool-bar-item.d.ts +5 -0
  69. package/generated/components/tool-bar-item.js +19 -0
  70. package/generated/components/tool-bar.d.ts +7 -0
  71. package/generated/components/tool-bar.js +77 -0
  72. package/generated/components/v-keyboard.d.ts +2 -0
  73. package/generated/components/v-keyboard.js +64 -68
  74. package/generated/components/v-stack.d.ts +5 -0
  75. package/generated/components/v-stack.js +11 -0
  76. package/generated/confirmation-dialog/index.d.ts +1 -0
  77. package/generated/confirmation-dialog/index.js +1 -0
  78. package/generated/css/index.css +7463 -0
  79. package/generated/events/confirmation-dialog.d.ts +9 -0
  80. package/generated/events/date-picker.d.ts +8 -0
  81. package/generated/events/date-picker.js +1 -0
  82. package/generated/events/index.d.ts +7 -0
  83. package/generated/events/index.js +7 -0
  84. package/generated/events/lifecycle-observer.d.ts +10 -0
  85. package/generated/events/lifecycle-observer.js +1 -0
  86. package/generated/events/picker-view.d.ts +8 -0
  87. package/generated/events/picker-view.js +1 -0
  88. package/generated/events/scroll-view.d.ts +10 -0
  89. package/generated/events/scroll-view.js +1 -0
  90. package/generated/events/tab-view.d.ts +24 -0
  91. package/generated/events/tab-view.js +1 -0
  92. package/generated/events/text-field.d.ts +8 -0
  93. package/generated/events/text-field.js +1 -0
  94. package/generated/i18n/index.d.ts +24 -0
  95. package/generated/i18n/index.js +139 -0
  96. package/generated/internal/class/cleanup-registry.d.ts +5 -0
  97. package/generated/internal/class/cleanup-registry.js +38 -0
  98. package/generated/internal/class/css-style-observer.d.ts +8 -0
  99. package/generated/internal/class/css-style-observer.js +25 -0
  100. package/generated/internal/class/form-associated-base.d.ts +20 -0
  101. package/generated/internal/class/form-associated-base.js +93 -0
  102. package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
  103. package/generated/internal/class/mutation-observer-singleton.js +46 -0
  104. package/generated/internal/class/navigation-path.d.ts +15 -0
  105. package/generated/internal/class/navigation-path.js +84 -0
  106. package/generated/internal/class/navigation-view.d.ts +8 -0
  107. package/generated/internal/class/navigation-view.js +77 -0
  108. package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
  109. package/generated/internal/class/resize-observer-singleton.js +22 -0
  110. package/generated/internal/decorators/custom-element.d.ts +5 -0
  111. package/generated/internal/decorators/custom-element.js +4 -0
  112. package/generated/internal/privateNamespace.d.ts +4 -0
  113. package/generated/internal/privateNamespace.js +1 -0
  114. package/generated/internal/utils/add.d.ts +1 -0
  115. package/generated/internal/utils/add.js +7 -0
  116. package/generated/internal/utils/cash/ancestors.d.ts +1 -0
  117. package/generated/internal/utils/cash/ancestors.js +27 -0
  118. package/generated/internal/utils/cash/index.d.ts +22 -0
  119. package/generated/internal/utils/cash/index.js +23 -0
  120. package/generated/internal/utils/cash/next-all.d.ts +1 -0
  121. package/generated/internal/utils/cash/next-all.js +10 -0
  122. package/generated/internal/utils/cash/next.d.ts +1 -0
  123. package/generated/internal/utils/cash/next.js +9 -0
  124. package/generated/internal/utils/cash/prev-all.d.ts +1 -0
  125. package/generated/internal/utils/cash/prev-all.js +10 -0
  126. package/generated/internal/utils/cash/prev.d.ts +1 -0
  127. package/generated/internal/utils/cash/prev.js +9 -0
  128. package/generated/internal/utils/cash/prop.d.ts +18 -0
  129. package/generated/internal/utils/cash/prop.js +30 -0
  130. package/generated/internal/utils/cash/siblings.d.ts +1 -0
  131. package/generated/internal/utils/cash/siblings.js +10 -0
  132. package/generated/internal/utils/clamp.d.ts +1 -0
  133. package/generated/internal/utils/clamp.js +4 -0
  134. package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
  135. package/generated/internal/utils/compare-big-decimals.js +90 -0
  136. package/generated/internal/utils/debounce.d.ts +1 -0
  137. package/generated/internal/utils/debounce.js +13 -0
  138. package/generated/internal/utils/frame.d.ts +1 -0
  139. package/generated/internal/utils/frame.js +6 -0
  140. package/generated/internal/utils/index.d.ts +16 -1
  141. package/generated/internal/utils/index.js +17 -1
  142. package/generated/internal/utils/kebab-case.d.ts +1 -1
  143. package/generated/internal/utils/list-active.d.ts +7 -0
  144. package/generated/internal/utils/list-active.js +28 -0
  145. package/generated/internal/utils/microtask.d.ts +1 -0
  146. package/generated/internal/utils/microtask.js +3 -0
  147. package/generated/internal/utils/onoff.d.ts +45 -0
  148. package/generated/internal/utils/onoff.js +31 -0
  149. package/generated/internal/utils/set.d.ts +1 -0
  150. package/generated/internal/utils/set.js +7 -0
  151. package/generated/internal/utils/sleep.d.ts +1 -0
  152. package/generated/internal/utils/sleep.js +3 -0
  153. package/generated/internal/utils/slow-hide-show.d.ts +1 -0
  154. package/generated/internal/utils/slow-hide-show.js +16 -0
  155. package/generated/internal/utils/timeout.d.ts +5 -0
  156. package/generated/internal/utils/timeout.js +16 -0
  157. package/generated/internal/utils/touch-glass.d.ts +7 -0
  158. package/generated/internal/utils/touch-glass.js +19 -0
  159. package/generated/lifecycle-observer/index.d.ts +1 -0
  160. package/generated/lifecycle-observer/index.js +1 -0
  161. package/generated/namespace-browser/base.d.ts +36 -0
  162. package/generated/namespace-browser/base.js +92 -0
  163. package/generated/namespace-browser/index.d.ts +7 -0
  164. package/generated/namespace-browser/index.js +1 -0
  165. package/generated/snapshot/index.d.ts +2 -11
  166. package/generated/snapshot/index.js +31 -144
  167. package/package.json +19 -8
  168. package/scss/_components.scss +52 -16
  169. package/scss/_final.scss +1 -0
  170. package/scss/_mixins.scss +2 -171
  171. package/scss/_placeholders.scss +3 -0
  172. package/scss/_transitions.scss +16 -0
  173. package/scss/_utils.scss +9 -0
  174. package/scss/_vars.scss +137 -23
  175. package/scss/base/_layout.scss +31 -15
  176. package/scss/base/_reboot.scss +118 -15
  177. package/scss/base/_root.scss +355 -25
  178. package/scss/colors/_index.scss +624 -70
  179. package/scss/components/_body-view.scss +12 -3
  180. package/scss/components/_bordered-button.scss +22 -0
  181. package/scss/components/_bordered-prominent-button.scss +19 -0
  182. package/scss/components/_borderless-button.scss +11 -6
  183. package/scss/components/_confirmation-dialog.scss +110 -0
  184. package/scss/components/_date-picker.scss +30 -0
  185. package/scss/components/_detail-placeholder.scss +155 -0
  186. package/scss/components/_disclosure-group.scss +100 -52
  187. package/scss/components/_form-view.scss +195 -0
  188. package/scss/components/_full-screen.scss +7 -5
  189. package/scss/components/_glass-button.scss +24 -0
  190. package/scss/components/_glass-prominent-button.scss +24 -0
  191. package/scss/components/_h-divider.scss +13 -0
  192. package/scss/components/_h-stack.scss +39 -0
  193. package/scss/components/_index.scss +224 -7
  194. package/scss/components/_label-view.scss +386 -0
  195. package/scss/components/_labeled-content.scss +9 -0
  196. package/scss/components/_list-view.scss +229 -0
  197. package/scss/components/_menu-view.scss +188 -0
  198. package/scss/components/_navigation-large-title.scss +27 -0
  199. package/scss/components/_navigation-split-view.scss +329 -269
  200. package/scss/components/_navigation-stack.scss +6 -6
  201. package/scss/components/_navigation-title.scss +10 -0
  202. package/scss/components/_picker-view.scss +122 -0
  203. package/scss/components/_plain-button.scss +11 -0
  204. package/scss/components/_scroll-view-proxy.scss +79 -0
  205. package/scss/components/_scroll-view-toolbars.scss +126 -0
  206. package/scss/components/_scroll-view.scss +110 -66
  207. package/scss/components/_section-view.scss +119 -0
  208. package/scss/components/_sheet-view.scss +68 -35
  209. package/scss/components/_sidebar-toggle.scss +90 -27
  210. package/scss/components/_sidebar-view.scss +30 -40
  211. package/scss/components/_sticky-container.scss +42 -0
  212. package/scss/components/_tab-bar.scss +201 -84
  213. package/scss/components/_tab-item.scss +25 -0
  214. package/scss/components/_tab-view.scss +268 -126
  215. package/scss/components/_table-column.scss +52 -0
  216. package/scss/components/_table-row.scss +172 -0
  217. package/scss/components/_table-view.scss +223 -0
  218. package/scss/components/_text-field.scss +37 -0
  219. package/scss/components/_tool-bar-item-group.scss +30 -19
  220. package/scss/components/_tool-bar-item.scss +128 -70
  221. package/scss/components/_tool-bar.scss +107 -64
  222. package/scss/components/_v-divider.scss +13 -0
  223. package/scss/components/_v-flex-stack.scss +29 -0
  224. package/scss/components/_v-keyboard.scss +6 -4
  225. package/scss/components/_v-stack.scss +8 -9
  226. package/scss/final/_touch-glass.scss +67 -0
  227. package/scss/index.scss +6 -2
  228. package/scss/mixins/_dialog.scss +88 -0
  229. package/scss/mixins/_index.scss +405 -0
  230. package/scss/placeholders/_buttons.scss +83 -0
  231. package/scss/placeholders/_lists.scss +589 -0
  232. package/scss/transitions/_bwd.navbar.scss +3 -13
  233. package/scss/transitions/_bwd.scss +4 -20
  234. package/scss/transitions/_confirmation-dialog.scss +19 -0
  235. package/scss/transitions/_dialog.scss +7 -11
  236. package/scss/transitions/_disclosure-group.scss +35 -0
  237. package/scss/transitions/_fwd.navbar.scss +4 -9
  238. package/scss/transitions/_fwd.scss +4 -34
  239. package/scss/transitions/_glass-button.scss +12 -0
  240. package/scss/transitions/_glass-prominent-button.scss +12 -0
  241. package/scss/transitions/_index.scss +35 -143
  242. package/scss/transitions/_menu-view.scss +26 -0
  243. package/scss/transitions/_navigation-split-view.scss +23 -0
  244. package/scss/transitions/_sidebar-view.scss +36 -0
  245. package/scss/transitions/_tab-bar.scss +19 -0
  246. package/scss/utils/_frame.scss +84 -0
  247. package/scss/utils/_index.scss +68 -0
  248. package/scss/utils/_scroll-view.scss +14 -0
  249. package/scss/utils/_spacing.scss +25 -0
  250. package/scss/utils/_stacks.scss +242 -0
  251. package/web-components.html-data/en.json +330 -0
  252. package/generated/components/bottom-bar.d.ts +0 -10
  253. package/generated/components/bottom-bar.js +0 -73
  254. package/generated/components/navigation-bar.d.ts +0 -10
  255. package/generated/components/navigation-bar.js +0 -80
  256. package/generated/internal/class.d.ts +0 -18
  257. package/generated/internal/class.js +0 -18
  258. package/generated/namespace/index.d.ts +0 -6
  259. package/generated/styles.css +0 -1305
  260. package/scss/_dev.scss +0 -68
  261. package/scss/components/_tab-bar-stack.scss +0 -101
  262. package/scss/components/_toolbars.scss +0 -100
  263. /package/generated/{namespace/index.js → events/confirmation-dialog.js} +0 -0
@@ -0,0 +1,177 @@
1
+ var _a;
2
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
+ import { CSSStyleObserver } from '../internal/class/css-style-observer';
4
+ import { add, frame, onoff, slowHideShow, timeout } from '../internal/utils';
5
+ import { Snapshot } from '../snapshot';
6
+ const observing = new WeakSet();
7
+ function observeResizeEnd(el, callback, stableFrames = 4) {
8
+ let rafId = null;
9
+ let lastRect = el.getBoundingClientRect();
10
+ let stableCount = 0;
11
+ function check() {
12
+ const rect = el.getBoundingClientRect();
13
+ if (rect.width === lastRect.width && rect.height === lastRect.height) {
14
+ stableCount++;
15
+ }
16
+ else {
17
+ stableCount = 0;
18
+ lastRect = rect;
19
+ }
20
+ if (stableCount >= stableFrames) {
21
+ rafId = null;
22
+ callback(rect);
23
+ return;
24
+ }
25
+ rafId = self.requestAnimationFrame(check);
26
+ }
27
+ const observer = new ResizeObserver(() => {
28
+ stableCount = 0;
29
+ if (rafId === null) {
30
+ lastRect = el.getBoundingClientRect();
31
+ rafId = self.requestAnimationFrame(check);
32
+ }
33
+ });
34
+ observer.observe(el);
35
+ return () => {
36
+ observer.disconnect();
37
+ if (rafId)
38
+ self.cancelAnimationFrame(rafId);
39
+ };
40
+ }
41
+ function parseRootMargin(rootMargin = '0px 0px 0px 0px') {
42
+ const parts = rootMargin.split(/\s+/).map((v) => parseInt(v));
43
+ switch (parts.length) {
44
+ case 1:
45
+ return [parts[0], parts[0], parts[0], parts[0]];
46
+ case 2:
47
+ return [parts[0], parts[1], parts[0], parts[1]];
48
+ case 3:
49
+ return [parts[0], parts[1], parts[2], parts[1]];
50
+ case 4:
51
+ return parts;
52
+ default:
53
+ return [0, 0, 0, 0];
54
+ }
55
+ }
56
+ function isIntersectingWithContainer(el, container, rootMargin = '0px 0px 0px 0px') {
57
+ if (!(el instanceof Element) || !(container instanceof Element))
58
+ return false;
59
+ const elRect = el.getBoundingClientRect();
60
+ const contRect = container.getBoundingClientRect();
61
+ const [topMargin, rightMargin, bottomMargin, leftMargin] = parseRootMargin(rootMargin);
62
+ const marginRect = {
63
+ top: contRect.top + topMargin,
64
+ right: contRect.right - rightMargin,
65
+ bottom: contRect.bottom - bottomMargin,
66
+ left: contRect.left + leftMargin,
67
+ };
68
+ return !(elRect.bottom < marginRect.top || elRect.top > marginRect.bottom || elRect.right < marginRect.left || elRect.left > marginRect.right);
69
+ }
70
+ export class NavigationLargeTitle extends HTMLElement {
71
+ #styleObserver;
72
+ #scrollObserver;
73
+ #scrollSafetyTimer = timeout();
74
+ #rootMarginTop = '0px';
75
+ constructor() {
76
+ super();
77
+ }
78
+ disconnectedCallback() {
79
+ console.debug(`${_a.name} ⚡️ disconnect`);
80
+ this.#clearScrollState();
81
+ this.#styleObserver?.disconnect();
82
+ CleanupRegistry.unregister(this);
83
+ }
84
+ connectedCallback() {
85
+ console.debug(`${_a.name} ⚡️ connect`);
86
+ const root = this.closest('scroll-view') ?? undefined;
87
+ if (!root)
88
+ return;
89
+ if (!root?.hasAttribute('navigation-bar-title-display-mode'))
90
+ root?.setAttribute('navigation-bar-title-display-mode', 'large');
91
+ frame(this).then(() => {
92
+ // if (!r) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
93
+ this.#styleObserver = new CSSStyleObserver();
94
+ this.#styleObserver.observe(this, this.#handleStyleChange);
95
+ Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange)); //Snapshot.waitReady.then(this.#handleStyleChange)
96
+ // this.#observer?.observe(this)
97
+ CleanupRegistry.register(this, onoff([
98
+ { types: 'scroll', listener: this.#handleScroll, addOptions: { passive: true } },
99
+ { types: 'scrollend', listener: this.#handleScrollend, addOptions: { passive: true } },
100
+ ], root).on());
101
+ observeResizeEnd(root, () => {
102
+ const isIntersecting = isIntersectingWithContainer(this, root, `${this.#rootMarginTop} 0px 0px 0px`);
103
+ this.#applySlowness(root, isIntersecting);
104
+ });
105
+ });
106
+ }
107
+ #handleStyleChange = () => {
108
+ console.debug(`${_a.name} ⚡️ style`);
109
+ const root = this.closest('scroll-view') ?? undefined;
110
+ if (!root)
111
+ return;
112
+ const style = self.getComputedStyle(this);
113
+ const blockSizeProp = style.getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
114
+ blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(style.getPropertyValue('--root-font-size')) || 16 : 1);
115
+ // blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(self.getComputedStyle(document.documentElement).fontSize) : 1)
116
+ const rootMarginTop = `${blockSize}px`;
117
+ if (this.#rootMarginTop === rootMarginTop)
118
+ return;
119
+ this.#rootMarginTop = rootMarginTop;
120
+ // Tear down old observer cleanly before replacing it
121
+ const wasObserving = observing.delete(this);
122
+ this.#scrollObserver?.disconnect();
123
+ this.#scrollObserver = new IntersectionObserver(this.#handleIntersect, {
124
+ root,
125
+ rootMargin: `-${this.#rootMarginTop} 0px 0px 0px`,
126
+ threshold: [0, 1],
127
+ });
128
+ // Re-observe immediately if we were mid-scroll
129
+ if (wasObserving) {
130
+ observing.add(this);
131
+ this.#scrollObserver.observe(this);
132
+ }
133
+ };
134
+ #clearScrollState = () => {
135
+ if (observing.delete(this))
136
+ this.#scrollObserver?.unobserve(this);
137
+ this.#scrollSafetyTimer.cancel();
138
+ };
139
+ #handleScroll = (evt) => {
140
+ if (add(observing, this))
141
+ this.#scrollObserver?.observe(this);
142
+ this.#scrollSafetyTimer.next(() => this.#clearScrollState(), 2000); // reset watchdog every scroll event
143
+ };
144
+ #handleScrollend = (evt) => {
145
+ this.#clearScrollState();
146
+ };
147
+ // #handleResizeend: EventListener = (evt: Event) => {
148
+ // const root = evt.target as HTMLElement
149
+ // const isIntersecting = isIntersectingWithContainer(this, root, `${this.#rootMarginTop} 0px 0px 0px`)
150
+ // this.#applySlowness(root, isIntersecting)
151
+ // }
152
+ #handleIntersect = (entries, { root }) => {
153
+ console.debug(`${_a.name} ⚡️ intersect (${entries?.at(0)?.isIntersecting})`);
154
+ if (!(root instanceof HTMLElement))
155
+ return;
156
+ for (const { isIntersecting } of entries)
157
+ this.#applySlowness(root, isIntersecting);
158
+ // for (const { isIntersecting } of entries) {
159
+ // const value = isIntersecting ? 'large' : 'inline'
160
+ // if (value === root?.getAttribute('navigation-bar-title-display-mode')) continue
161
+ // root?.setAttribute('navigation-bar-title-display-mode', value)
162
+ // if (this.closest('[hidden]')) continue // if (0 === this.offsetHeight + this.offsetWidth) continue
163
+ // if (this.hasAttribute('navigation-bar-auto-hide')) slowHideShow(isIntersecting ? 'show' : 'hide', this)
164
+ // }
165
+ };
166
+ #applySlowness = (root, isIntersecting) => {
167
+ const value = isIntersecting ? 'large' : 'inline';
168
+ if (this.closest('[hidden]'))
169
+ return; // if (0 === this.offsetHeight + this.offsetWidth) continue
170
+ if (value === root?.getAttribute('navigation-bar-title-display-mode'))
171
+ return;
172
+ root?.setAttribute('navigation-bar-title-display-mode', value);
173
+ if (this.hasAttribute('navigation-bar-auto-hide'))
174
+ slowHideShow(isIntersecting ? 'show' : 'hide', this);
175
+ };
176
+ }
177
+ _a = NavigationLargeTitle;
@@ -1,5 +1,7 @@
1
- export declare class NavigationSplitView extends HTMLElement {
2
- static observedAttributes: string[];
1
+ import { NavigationView } from '../internal/class/navigation-view';
2
+ export declare class NavigationSplitView extends NavigationView {
3
3
  constructor();
4
4
  disconnectedCallback(): void;
5
+ connectedCallback(): void;
6
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
5
7
  }
@@ -1,9 +1,18 @@
1
- export class NavigationSplitView extends HTMLElement {
1
+ import { NavigationView } from '../internal/class/navigation-view';
2
+ export class NavigationSplitView extends NavigationView {
2
3
  constructor() {
3
4
  super();
4
5
  }
5
6
  disconnectedCallback() {
6
7
  console.debug(`${NavigationSplitView.name} ⚡️ disconnect`);
8
+ super.disconnectedCallback();
9
+ }
10
+ connectedCallback() {
11
+ console.debug(`${NavigationSplitView.name} ⚡️ connect`);
12
+ super.connectedCallback();
13
+ }
14
+ attributeChangedCallback(name, oldValue, newValue) {
15
+ console.debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
16
+ super.attributeChangedCallback(name, oldValue, newValue);
7
17
  }
8
18
  }
9
- NavigationSplitView.observedAttributes = ['hidden'];
@@ -1,6 +1,7 @@
1
- export declare class NavigationStack extends HTMLElement {
2
- static observedAttributes: string[];
1
+ import { NavigationView } from '../internal/class/navigation-view';
2
+ export declare class NavigationStack extends NavigationView {
3
3
  constructor();
4
4
  disconnectedCallback(): void;
5
5
  connectedCallback(): void;
6
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
6
7
  }
@@ -1,67 +1,24 @@
1
- export class NavigationStack extends HTMLElement {
1
+ import { NavigationView } from '../internal/class/navigation-view';
2
+ export class NavigationStack extends NavigationView {
2
3
  constructor() {
3
4
  super();
4
- /* const shadowRoot = this.attachShadow({ mode: 'open' })
5
- shadowRoot.appendChild(
6
- document.importNode(this.constructor.template.content, true)
7
- )
8
- const slot = shadowRoot.querySelector('slot')!
9
-
10
- slot.addEventListener('slotchange', () => {
11
- const sv = this.querySelector<HTMLElement>(':scope > scroll-view')
12
- if (!sv) return
13
-
14
- const st = parseInt(sv?.dataset?.scrolltop ?? '0')
15
-
16
- requestAnimationFrame(() => (sv.scrollTop = st))
17
- }) */
18
- // const template = document.createElement('template')
19
- // template.innerHTML = this.constructor.#template
20
- // const template = document.getElementById('element-details-template')
21
- // // Named slot for toolbar
22
- // const toolbarSlot = document.createElement('slot');
23
- // toolbarSlot.name = 'toolbar';
24
- // // Default slot for everything else
25
- // const defaultSlot = document.createElement('slot');
26
- // shadow.appendChild(toolbarSlot);
27
- // shadow.appendChild(defaultSlot);
28
- // this.attachShadow({ mode: 'open' }).append(template.content.cloneNode(true))
29
- ////this.constructor.template.content.cloneNode(true)
30
- // shadowRoot.appendChild(document.importNode(template.content, true))
31
- // alert(9)
32
- // const t = this
33
5
  }
34
6
  disconnectedCallback() {
35
7
  console.debug(`${NavigationStack.name} ⚡️ disconnect`);
8
+ super.disconnectedCallback();
36
9
  }
37
10
  connectedCallback() {
38
- // this.attachShadow({ mode: "open" });
39
- // this.shadowRoot.innerHTML = NavigationStack.template;
40
- // Access slotted elements
41
- // const toolbarSlot = this.shadowRoot.querySelector('slot[name="toolbar"]');
42
- // const defaultSlot = this.shadowRoot.querySelector('slot:not([name])');
43
- // // Get assigned nodes
44
- // const toolbarNodes = toolbarSlot.assignedNodes({ flatten: true });
45
- // const defaultNodes = defaultSlot.assignedNodes({ flatten: true });
46
- // console.log('Toolbar nodes:', toolbarNodes);
47
- // console.log('Default nodes:', defaultNodes);
48
- // const starRating = document.getElementById('star-rating-template').content;
49
- // const shadowRoot = this.attachShadow({
50
- // mode: 'open'
51
- // });
52
- // shadowRoot.appendChild(starRating.cloneNode(true));
53
- // this.innerHTML = `<div>gh</div><slot name="toolbar"><legend>Rate your experience:</legend></slot>`
54
- // this.appendChild(slottedToolbar)
55
- // console.log(99)
56
- // this.innerHTML = `
57
- // <header>
58
- // <label>New</label>
59
- // </header>
60
- // <p>
61
- // <h2>Welcome to the new page!</h2>
62
- // </p>
63
- // ${this.innerHTML}
64
- // `;
11
+ console.debug(`${NavigationStack.name} ⚡️ connect`);
12
+ super.connectedCallback();
13
+ }
14
+ attributeChangedCallback(name, oldValue, newValue) {
15
+ console.debug(`${NavigationStack.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
16
+ super.attributeChangedCallback(name, oldValue, newValue);
17
+ // Snapshot.waitReady.then(() => {
18
+ switch (name) {
19
+ case 'hidden':
20
+ break;
21
+ }
22
+ // })
65
23
  }
66
24
  }
67
- NavigationStack.observedAttributes = ['hidden'];
@@ -0,0 +1,8 @@
1
+ export declare class NavigationTitle extends HTMLElement {
2
+ #private;
3
+ static get observedAttributes(): string[];
4
+ constructor();
5
+ disconnectedCallback(): void;
6
+ connectedCallback(): void;
7
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
8
+ }
@@ -0,0 +1,66 @@
1
+ import { $ } from '../internal/utils';
2
+ export class NavigationTitle extends HTMLElement {
3
+ static get observedAttributes() {
4
+ return ['value', 'subtitle'];
5
+ }
6
+ constructor() {
7
+ super();
8
+ }
9
+ disconnectedCallback() {
10
+ console.debug(`${NavigationTitle.name} ⚡️ disconnect`);
11
+ }
12
+ connectedCallback() {
13
+ console.debug(`${NavigationTitle.name} ⚡️ connect`);
14
+ }
15
+ attributeChangedCallback(name, oldValue, newValue) {
16
+ console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
17
+ const sibling = this.closest('scroll-view') ?? undefined;
18
+ switch (name) {
19
+ case 'value':
20
+ if (null === newValue)
21
+ sibling?.removeAttribute('navigation-inline-title');
22
+ else
23
+ sibling?.setAttribute('navigation-inline-title', newValue);
24
+ this.#render(newValue, this.getAttribute('subtitle'));
25
+ break;
26
+ case 'subtitle':
27
+ if (null === newValue)
28
+ sibling?.removeAttribute('navigation-inline-subtitle');
29
+ else
30
+ sibling?.setAttribute('navigation-inline-subtitle', newValue);
31
+ this.#render(this.getAttribute('value'), newValue);
32
+ break;
33
+ }
34
+ }
35
+ #render = (title, subtitle) => {
36
+ const el = this.querySelector(':scope>:not([slot])') ??
37
+ this.appendChild($(`<navigation-large-title><v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack></navigation-large-title>`)), vStack = el.querySelector(':scope>v-stack') ??
38
+ el.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack>`));
39
+ let titleLabel = vStack.querySelector(':scope>label-view:nth-child(1)');
40
+ if (title) {
41
+ titleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view>`));
42
+ titleLabel.setAttribute('title', title);
43
+ }
44
+ else
45
+ titleLabel?.remove();
46
+ let subtitleLabel = vStack.querySelector(':scope>label-view:nth-child(2)');
47
+ if (subtitle) {
48
+ subtitleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="callout"></label-view>`));
49
+ subtitleLabel.setAttribute('title', subtitle);
50
+ }
51
+ else
52
+ subtitleLabel?.remove();
53
+ // for (const el of this.querySelectorAll(':scope>*')) el.remove()
54
+ // const el = this.appendChild(
55
+ // Object.assign(document.createElement('template'), {
56
+ // innerHTML: `<navigation-large-title><v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack></navigation-large-title>`,
57
+ // }).content.firstElementChild!
58
+ // ),
59
+ // titleLabel = el.querySelector('label-view:nth-child(1)'),
60
+ // subtitleLabel = el.querySelector('label-view:nth-child(2)')
61
+ // if (title) titleLabel?.setAttribute('label', title)
62
+ // else titleLabel?.remove()
63
+ // if (subtitle) subtitleLabel?.setAttribute('label', subtitle)
64
+ // else subtitleLabel?.remove()
65
+ };
66
+ }
@@ -0,0 +1,27 @@
1
+ import { FormAssociatedBase } from '../internal/class/form-associated-base';
2
+ declare const pickerStyles: readonly ["menu", "inline", "automatic"];
3
+ export type PickerStyle = (typeof pickerStyles)[number];
4
+ export declare class PickerView extends FormAssociatedBase {
5
+ #private;
6
+ static get ATTR(): {
7
+ PLACEHOLDER: string;
8
+ LABEL: string;
9
+ PICKER_STYLE: string;
10
+ SELECTION: string;
11
+ };
12
+ static get observedAttributes(): string[];
13
+ get template(): DocumentFragment;
14
+ constructor();
15
+ connectedCallback(): void;
16
+ disconnectedCallback(): void;
17
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
18
+ get pickerStyle(): PickerStyle;
19
+ static wrapTag(node: Element, slotName?: string): Element;
20
+ get name(): string;
21
+ setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
22
+ setCustomValidity: (message: string) => void;
23
+ formAssociatedCallback: (form: HTMLFormElement) => void;
24
+ formDisabledCallback: (disabled: boolean) => void;
25
+ formResetCallback: () => void;
26
+ }
27
+ export {};