@swiftwc/ui 0.0.0-dev.11 → 0.0.0-dev.110

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 (300) hide show
  1. package/generated/buses/alert-dialog.d.ts +2 -0
  2. package/generated/buses/alert-dialog.js +1 -0
  3. package/generated/buses/confirmation-dialog.d.ts +2 -0
  4. package/generated/buses/confirmation-dialog.js +1 -0
  5. package/generated/buses/index.d.ts +6 -0
  6. package/generated/buses/index.js +6 -0
  7. package/generated/buses/lifecycle-observer.d.ts +2 -0
  8. package/generated/buses/lifecycle-observer.js +1 -0
  9. package/generated/client/index.d.ts +24 -10
  10. package/generated/client/index.js +179 -194
  11. package/generated/components/alert-dialog.d.ts +11 -0
  12. package/generated/components/alert-dialog.js +94 -0
  13. package/generated/components/body-view.d.ts +8 -0
  14. package/generated/components/body-view.js +6 -2
  15. package/generated/components/bordered-button.d.ts +10 -0
  16. package/generated/components/bordered-button.js +36 -3
  17. package/generated/components/bordered-prominent-button.d.ts +10 -0
  18. package/generated/components/bordered-prominent-button.js +36 -3
  19. package/generated/components/borderless-button.d.ts +9 -1
  20. package/generated/components/borderless-button.js +29 -11
  21. package/generated/components/color-scheme.d.ts +12 -0
  22. package/generated/components/color-scheme.js +51 -0
  23. package/generated/components/confirmation-dialog.d.ts +4 -1
  24. package/generated/components/confirmation-dialog.js +38 -32
  25. package/generated/components/content-unavailable.d.ts +30 -0
  26. package/generated/components/content-unavailable.js +79 -0
  27. package/generated/components/date-picker.d.ts +21 -15
  28. package/generated/components/date-picker.js +126 -88
  29. package/generated/components/detail-placeholder.d.ts +11 -0
  30. package/generated/components/detail-placeholder.js +15 -0
  31. package/generated/components/disclosure-group.d.ts +8 -0
  32. package/generated/components/disclosure-group.js +18 -7
  33. package/generated/components/fine-tooltip.d.ts +15 -0
  34. package/generated/components/fine-tooltip.js +108 -0
  35. package/generated/components/form-view.d.ts +10 -0
  36. package/generated/components/form-view.js +8 -3
  37. package/generated/components/glass-button.d.ts +10 -0
  38. package/generated/components/glass-button.js +36 -3
  39. package/generated/components/glass-prominent-button.d.ts +10 -0
  40. package/generated/components/glass-prominent-button.js +36 -3
  41. package/generated/components/h-divider.d.ts +11 -0
  42. package/generated/components/h-divider.js +15 -0
  43. package/generated/components/h-stack.d.ts +22 -0
  44. package/generated/components/h-stack.js +24 -0
  45. package/generated/components/image-view.d.ts +18 -0
  46. package/generated/components/image-view.js +65 -0
  47. package/generated/components/index.d.ts +15 -3
  48. package/generated/components/index.js +15 -3
  49. package/generated/components/label-view.d.ts +19 -1
  50. package/generated/components/label-view.js +63 -62
  51. package/generated/components/labeled-content.d.ts +33 -0
  52. package/generated/components/labeled-content.js +160 -0
  53. package/generated/components/list-view.d.ts +14 -0
  54. package/generated/components/list-view.js +12 -17
  55. package/generated/components/menu-view.d.ts +12 -1
  56. package/generated/components/menu-view.js +63 -65
  57. package/generated/components/navigation-large-title.d.ts +11 -0
  58. package/generated/components/navigation-large-title.js +11 -5
  59. package/generated/components/navigation-split-view.d.ts +9 -1
  60. package/generated/components/navigation-split-view.js +10 -6
  61. package/generated/components/navigation-stack.d.ts +9 -1
  62. package/generated/components/navigation-stack.js +13 -11
  63. package/generated/components/navigation-title.d.ts +11 -1
  64. package/generated/components/navigation-title.js +58 -55
  65. package/generated/components/picker-view.d.ts +48 -7
  66. package/generated/components/picker-view.js +971 -261
  67. package/generated/components/plain-button.js +3 -3
  68. package/generated/components/progress-view.d.ts +20 -0
  69. package/generated/components/progress-view.js +120 -0
  70. package/generated/components/screen-view.js +2 -1
  71. package/generated/components/scroll-view-proxy.d.ts +13 -0
  72. package/generated/components/scroll-view-proxy.js +15 -0
  73. package/generated/components/scroll-view.d.ts +13 -1
  74. package/generated/components/scroll-view.js +140 -97
  75. package/generated/components/search-view.d.ts +12 -0
  76. package/generated/components/search-view.js +24 -0
  77. package/generated/components/section-view.d.ts +13 -1
  78. package/generated/components/section-view.js +38 -58
  79. package/generated/components/sheet-view.d.ts +4 -2
  80. package/generated/components/sheet-view.js +10 -39
  81. package/generated/components/sidebar-toggle.d.ts +9 -1
  82. package/generated/components/sidebar-toggle.js +46 -69
  83. package/generated/components/sidebar-view.d.ts +3 -0
  84. package/generated/components/sidebar-view.js +16 -9
  85. package/generated/components/sticky-container.d.ts +6 -1
  86. package/generated/components/sticky-container.js +9 -7
  87. package/generated/components/tab-bar.d.ts +3 -0
  88. package/generated/components/tab-bar.js +17 -13
  89. package/generated/components/tab-item.d.ts +3 -0
  90. package/generated/components/tab-item.js +20 -13
  91. package/generated/components/tab-view.d.ts +13 -4
  92. package/generated/components/tab-view.js +25 -89
  93. package/generated/components/table-view.d.ts +19 -0
  94. package/generated/components/table-view.js +88 -107
  95. package/generated/components/text-field.d.ts +19 -6
  96. package/generated/components/text-field.js +127 -99
  97. package/generated/components/text-view.d.ts +11 -0
  98. package/generated/components/text-view.js +16 -0
  99. package/generated/components/toggle-view.d.ts +43 -0
  100. package/generated/components/toggle-view.js +366 -0
  101. package/generated/components/tool-bar-item-group.d.ts +8 -0
  102. package/generated/components/tool-bar-item-group.js +22 -4
  103. package/generated/components/tool-bar-item.d.ts +12 -1
  104. package/generated/components/tool-bar-item.js +57 -10
  105. package/generated/components/tool-bar.d.ts +19 -0
  106. package/generated/components/tool-bar.js +48 -33
  107. package/generated/components/v-divider.d.ts +11 -0
  108. package/generated/components/v-divider.js +15 -0
  109. package/generated/components/v-keyboard.d.ts +8 -1
  110. package/generated/components/v-keyboard.js +11 -9
  111. package/generated/components/v-stack.d.ts +20 -0
  112. package/generated/components/v-stack.js +18 -2
  113. package/generated/css/index.css +4617 -1266
  114. package/generated/events/alert-dialog.d.ts +13 -0
  115. package/generated/events/alert-dialog.js +1 -0
  116. package/generated/events/confirmation-dialog.d.ts +7 -2
  117. package/generated/events/date-picker.d.ts +6 -1
  118. package/generated/events/index.d.ts +2 -0
  119. package/generated/events/index.js +2 -0
  120. package/generated/events/lifecycle-observer.d.ts +10 -2
  121. package/generated/events/picker-view.d.ts +22 -1
  122. package/generated/events/scroll-view.d.ts +10 -2
  123. package/generated/events/tab-view.d.ts +38 -8
  124. package/generated/events/text-field.d.ts +6 -1
  125. package/generated/events/toggle-view.d.ts +14 -0
  126. package/generated/events/toggle-view.js +1 -0
  127. package/generated/i18n/index.d.ts +19 -10
  128. package/generated/i18n/index.js +79 -54
  129. package/generated/i18n/locales/el.d.ts +16 -0
  130. package/generated/i18n/locales/el.js +16 -0
  131. package/generated/i18n/locales/en.d.ts +16 -0
  132. package/generated/i18n/locales/en.js +16 -0
  133. package/generated/i18n/locales/index.d.ts +4 -0
  134. package/generated/i18n/locales/index.js +4 -0
  135. package/generated/internal/class/css-style-observer.js +2 -2
  136. package/generated/internal/class/form-associated-base.d.ts +0 -4
  137. package/generated/internal/class/form-associated-base.js +22 -39
  138. package/generated/internal/class/mutation-observer-set.d.ts +9 -0
  139. package/generated/internal/class/mutation-observer-set.js +42 -0
  140. package/generated/internal/class/mutation-observer-singleton.js +18 -0
  141. package/generated/internal/class/navigation-view.d.ts +1 -1
  142. package/generated/internal/class/navigation-view.js +36 -43
  143. package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
  144. package/generated/internal/decorators/adaptive-slot.js +47 -0
  145. package/generated/internal/decorators/custom-element.d.ts +1 -1
  146. package/generated/internal/decorators/custom-element.js +2 -1
  147. package/generated/internal/decorators/index.d.ts +6 -0
  148. package/generated/internal/decorators/index.js +6 -0
  149. package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
  150. package/generated/internal/decorators/microtask-on-connected.js +67 -0
  151. package/generated/internal/flags.d.ts +4 -0
  152. package/generated/internal/flags.js +1 -0
  153. package/generated/internal/privateNamespace.d.ts +10 -0
  154. package/generated/internal/privateNamespace.js +159 -1
  155. package/generated/internal/utils/$.d.ts +9 -0
  156. package/generated/internal/utils/$.js +11 -0
  157. package/generated/internal/utils/compare-big-decimals.js +7 -17
  158. package/generated/internal/utils/debug.d.ts +1 -0
  159. package/generated/internal/utils/debug.js +4 -0
  160. package/generated/internal/utils/define-translations.d.ts +1 -0
  161. package/generated/internal/utils/define-translations.js +3 -0
  162. package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
  163. package/generated/internal/utils/ensure-placeholder.js +41 -0
  164. package/generated/internal/utils/index.d.ts +39 -2
  165. package/generated/internal/utils/index.js +39 -3
  166. package/generated/internal/utils/is-inside.d.ts +1 -0
  167. package/generated/internal/utils/is-inside.js +4 -0
  168. package/generated/internal/utils/kebab-case.js +6 -9
  169. package/generated/internal/utils/list-active.js +67 -12
  170. package/generated/internal/utils/touch-glass.js +5 -5
  171. package/generated/internal/vendor/morphdom.d.ts +6 -0
  172. package/generated/internal/vendor/morphdom.js +720 -0
  173. package/generated/morphdom/index.d.ts +8 -0
  174. package/generated/morphdom/index.js +8 -0
  175. package/generated/morphdom/morph.d.ts +4 -0
  176. package/generated/morphdom/morph.js +10 -0
  177. package/generated/morphdom/query-morph.d.ts +5 -0
  178. package/generated/morphdom/query-morph.js +12 -0
  179. package/generated/morphdom/render-to-string.d.ts +12 -0
  180. package/generated/morphdom/render-to-string.js +48 -0
  181. package/generated/morphdom/unsafe-html.d.ts +2 -0
  182. package/generated/morphdom/unsafe-html.js +4 -0
  183. package/generated/namespace-browser/base.d.ts +12 -3
  184. package/generated/namespace-browser/base.js +41 -18
  185. package/generated/namespace-browser/event.d.ts +10 -0
  186. package/generated/namespace-browser/event.js +1 -0
  187. package/generated/snapshot/index.d.ts +3 -1
  188. package/generated/snapshot/index.js +23 -2
  189. package/generated/tpl/html.d.ts +5 -0
  190. package/generated/tpl/html.js +7 -0
  191. package/generated/tpl/index.d.ts +6 -0
  192. package/generated/tpl/index.js +6 -0
  193. package/generated/tpl/is-template-result.d.ts +3 -0
  194. package/generated/tpl/is-template-result.js +1 -0
  195. package/generated/tpl/render.d.ts +2 -0
  196. package/generated/tpl/render.js +132 -0
  197. package/package.json +32 -7
  198. package/scss/_components.scss +15 -0
  199. package/scss/_functions.scss +10 -0
  200. package/scss/_maps.scss +293 -0
  201. package/scss/_mixins.scss +4 -0
  202. package/scss/_transitions.scss +6 -1
  203. package/scss/_utils.scss +2 -0
  204. package/scss/_vars.scss +9 -115
  205. package/scss/base/_layout.scss +17 -7
  206. package/scss/base/_reboot.scss +34 -1
  207. package/scss/base/_root.scss +143 -124
  208. package/scss/colors/_index.scss +328 -88
  209. package/scss/components/_alert-dialog.scss +111 -0
  210. package/scss/components/_bordered-button.scss +37 -0
  211. package/scss/components/_bordered-prominent-button.scss +46 -0
  212. package/scss/components/_borderless-button.scss +26 -0
  213. package/scss/components/_confirmation-dialog.scss +41 -49
  214. package/scss/components/_content-unavailable.scss +57 -0
  215. package/scss/components/_date-picker.scss +15 -15
  216. package/scss/components/_detail-placeholder.scss +1 -3
  217. package/scss/components/_disclosure-group.scss +85 -34
  218. package/scss/components/_fine-tooltip.scss +84 -0
  219. package/scss/components/_form-view.scss +63 -24
  220. package/scss/components/_glass-button.scss +37 -0
  221. package/scss/components/_glass-prominent-button.scss +47 -0
  222. package/scss/components/_group-box.scss +27 -0
  223. package/scss/components/_h-flex-stack.scss +23 -0
  224. package/scss/components/_h-stack.scss +6 -17
  225. package/scss/components/_image-view.scss +20 -0
  226. package/scss/components/_index.scss +69 -36
  227. package/scss/components/_label-view copy.scss.txt +420 -0
  228. package/scss/components/_label-view.scss +105 -120
  229. package/scss/components/_label-view.scss.txt +536 -0
  230. package/scss/components/_labeled-content.scss +67 -1
  231. package/scss/components/_list-view.scss +70 -29
  232. package/scss/components/_menu-view.scss +96 -61
  233. package/scss/components/_navigation-large-title.scss +23 -0
  234. package/scss/components/_navigation-split-view.scss +3 -3
  235. package/scss/components/_navigation-title.scss +1 -1
  236. package/scss/components/_picker-view.scss +270 -63
  237. package/scss/components/_plain-button.scss +8 -0
  238. package/scss/components/_progress-view.scss +98 -0
  239. package/scss/components/_scroll-view-proxy.scss +24 -22
  240. package/scss/components/_scroll-view-toolbars.scss +8 -2
  241. package/scss/components/_scroll-view.scss +16 -0
  242. package/scss/components/_search-view.scss +23 -0
  243. package/scss/components/_section-view.scss +23 -22
  244. package/scss/components/_sheet-view.scss +16 -6
  245. package/scss/components/_sidebar-toggle.scss +1 -4
  246. package/scss/components/_sticky-container.scss +1 -1
  247. package/scss/components/_tab-bar.scss +17 -3
  248. package/scss/components/_tab-view.scss +12 -2
  249. package/scss/components/_table-column.scss +4 -2
  250. package/scss/components/_table-row.scss +71 -3
  251. package/scss/components/_table-view.scss +27 -18
  252. package/scss/components/_text-field.scss +37 -17
  253. package/scss/components/_text-view.scss +57 -0
  254. package/scss/components/_toggle-view.scss +171 -0
  255. package/scss/components/_tool-bar-item.scss +34 -82
  256. package/scss/components/_tool-bar.scss +77 -57
  257. package/scss/components/_v-stack.scss +8 -2
  258. package/scss/final/_touch-glass.scss +31 -0
  259. package/scss/mixins/_button.scss +44 -0
  260. package/scss/mixins/_color.scss +16 -0
  261. package/scss/mixins/_dialog.scss +1 -0
  262. package/scss/mixins/_index.scss +73 -5
  263. package/scss/placeholders/_buttons.scss +46 -11
  264. package/scss/placeholders/_lists.scss +159 -126
  265. package/scss/transitions/_alert-dialog.scss +18 -0
  266. package/scss/transitions/_confirmation-dialog.scss +8 -0
  267. package/scss/transitions/_fine-tooltip.scss +21 -0
  268. package/scss/transitions/_menu-view.scss +17 -15
  269. package/scss/transitions/_progress-view.scss +23 -0
  270. package/scss/transitions/_sheet-view.scss +30 -0
  271. package/scss/transitions/_tab-bar.scss +6 -5
  272. package/scss/utils/_background.scss +52 -0
  273. package/scss/utils/_frame.scss +59 -40
  274. package/scss/utils/_index.scss +45 -56
  275. package/scss/utils/_scroll-view.scss +1 -1
  276. package/scss/utils/_spacing.scss +1 -1
  277. package/scss/utils/_stacks.scss +34 -164
  278. package/web-components.css-data/en.json +28 -0
  279. package/web-components.html-data/en.json +2456 -166
  280. package/generated/confirmation-dialog/index.d.ts +0 -1
  281. package/generated/confirmation-dialog/index.js +0 -1
  282. package/generated/internal/utils/cash/index.d.ts +0 -22
  283. package/generated/internal/utils/cash/index.js +0 -23
  284. package/generated/lifecycle-observer/index.d.ts +0 -1
  285. package/generated/lifecycle-observer/index.js +0 -1
  286. package/scss/transitions/_dialog.scss +0 -28
  287. /package/generated/internal/utils/{cash/ancestors.d.ts → ancestors.d.ts} +0 -0
  288. /package/generated/internal/utils/{cash/ancestors.js → ancestors.js} +0 -0
  289. /package/generated/internal/utils/{cash/next-all.d.ts → next-all.d.ts} +0 -0
  290. /package/generated/internal/utils/{cash/next-all.js → next-all.js} +0 -0
  291. /package/generated/internal/utils/{cash/next.d.ts → next.d.ts} +0 -0
  292. /package/generated/internal/utils/{cash/next.js → next.js} +0 -0
  293. /package/generated/internal/utils/{cash/prev-all.d.ts → prev-all.d.ts} +0 -0
  294. /package/generated/internal/utils/{cash/prev-all.js → prev-all.js} +0 -0
  295. /package/generated/internal/utils/{cash/prev.d.ts → prev.d.ts} +0 -0
  296. /package/generated/internal/utils/{cash/prev.js → prev.js} +0 -0
  297. /package/generated/internal/utils/{cash/prop.d.ts → prop.d.ts} +0 -0
  298. /package/generated/internal/utils/{cash/prop.js → prop.js} +0 -0
  299. /package/generated/internal/utils/{cash/siblings.d.ts → siblings.d.ts} +0 -0
  300. /package/generated/internal/utils/{cash/siblings.js → siblings.js} +0 -0
@@ -0,0 +1,366 @@
1
+ var _a;
2
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
+ import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
4
+ import { MutationObserverSet } from '../internal/class/mutation-observer-set';
5
+ import { $, debug, kebabCase, onoff, touchGlass } from '../internal/utils';
6
+ import { queryMorph } from '../morphdom';
7
+ import { html } from '../tpl';
8
+ const toggleStyles = ['switch', 'button'];
9
+ /**
10
+ * @summary A control that switches between on and off states.
11
+ *
12
+ * @example <toggle-view label="Custom Label"></toggle-view> — Creates a toggle that displays a custom label
13
+ *
14
+ * @fires toggle:change — User toggled the control
15
+ *
16
+ * @slot label
17
+ * @slot {HTMLOptionElement[]} validity-options
18
+ */
19
+ export class ToggleView extends FormAssociatedBase {
20
+ static get observedAttributes() {
21
+ return [
22
+ 'label',
23
+ 'name',
24
+ 'value',
25
+ /**
26
+ * @type {boolean}
27
+ */
28
+ 'is-on',
29
+ /**
30
+ * @type {boolean}
31
+ */
32
+ 'required',
33
+ /**
34
+ * @type {boolean}
35
+ */
36
+ 'disabled',
37
+ ];
38
+ }
39
+ static #template;
40
+ static get template() {
41
+ return (this.#template ??= $(html `<label part="root toggle-stack">
42
+ <div part="root toggle-label-stack">
43
+ <slot name="label"></slot>
44
+ </div>
45
+ <div part="root toggle-input-stack">
46
+ <div part="root toggle-track" tabindex="0"></div>
47
+ </div>
48
+ <slot name="validity-options" hidden></slot>
49
+ </label>`));
50
+ }
51
+ #renderValidityMsgs = (entries) => {
52
+ debug(`${_a.name} ⚡️ mutation`);
53
+ this.setValidity(this.validity, this.validationMessage);
54
+ };
55
+ #shadowRoot;
56
+ #customValidity = '';
57
+ #slots = new Map();
58
+ #validityObservers = new MutationObserverSet(this.#renderValidityMsgs);
59
+ #track;
60
+ #value = 'on';
61
+ #isOn = false;
62
+ #didDrag = false;
63
+ #trackWidth = 0;
64
+ #dotSize = 0;
65
+ get #trackMinX() {
66
+ return 0;
67
+ }
68
+ get #trackMaxX() {
69
+ return this.#trackWidth - this.#dotSize;
70
+ }
71
+ #handleMeasure = ([{ target, borderBoxSize }]) => {
72
+ debug(`${_a.name} ⚡️ measure`);
73
+ if (!(target instanceof HTMLElement))
74
+ return;
75
+ this.#trackWidth = borderBoxSize.at(0)?.inlineSize ?? 0;
76
+ this.#dotSize = borderBoxSize.at(0)?.blockSize ?? 0;
77
+ };
78
+ #resizeObserver = new ResizeObserver(this.#handleMeasure);
79
+ #dragOffsetX = 0;
80
+ get #isDragging() {
81
+ return '0ms' === this.#track?.style.getPropertyValue('--toggle--dot-transition-duration');
82
+ }
83
+ get #internals() {
84
+ return getInternals(this);
85
+ }
86
+ constructor() {
87
+ super();
88
+ this.#shadowRoot = this.attachShadow({ mode: 'closed' });
89
+ this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
90
+ for (const slot of this.#shadowRoot.querySelectorAll('slot'))
91
+ this.#slots?.set(slot.name, slot);
92
+ CleanupRegistry.register(this, () => {
93
+ this.#slots = new Map();
94
+ });
95
+ CleanupRegistry.unregister(this, 'validities');
96
+ CleanupRegistry.register(this, onoff('slotchange', this.#handleValiditiesSlotchange, this.#slots?.get('validity-options')).on(), 'validities');
97
+ this.#track = this.#shadowRoot.querySelector('[part*=toggle-track]') ?? undefined;
98
+ CleanupRegistry.register(this, onoff([{ types: 'focusin', listener: this.#handleFocusin }], this).on());
99
+ CleanupRegistry.register(this, onoff([
100
+ { types: 'keydown', listener: this.#handleTrackKeydown },
101
+ { types: 'click', listener: this.#handleTrackClick },
102
+ { types: 'pointerdown', listener: this.#handleTrackPointerdown },
103
+ { types: 'pointerup', listener: this.#handleTrackPointerup },
104
+ { types: 'pointercancel', listener: this.#handleTrackPointercancel },
105
+ { types: 'pointermove', listener: this.#handleTrackPointermove },
106
+ { types: 'lostpointercapture', listener: this.#handleTrackPointercancel },
107
+ ], this.#track).on());
108
+ CleanupRegistry.register(this, onoff([
109
+ { types: 'blur', listener: this.#handleWindowBlur },
110
+ { types: 'focus', listener: this.#handleWindowFocus },
111
+ ], self).on());
112
+ }
113
+ attributeChangedCallback(name, oldValue, newValue) {
114
+ debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
115
+ switch (name) {
116
+ case 'value':
117
+ this.value = String(newValue); // this.#input?.setAttribute('checked', newValue ?? '')
118
+ this.#sendValueToForm(false);
119
+ break;
120
+ case 'is-on':
121
+ this.isOn = newValue !== null; // this.#input?.setAttribute('checked', newValue ?? '')
122
+ this.#sendValueToForm(false);
123
+ break;
124
+ case 'required':
125
+ // this.#input?.setAttribute(name, newValue ?? '')
126
+ this.#sendValueToForm(false);
127
+ break;
128
+ case 'name':
129
+ this.#sendValueToForm(false);
130
+ break;
131
+ case 'label':
132
+ queryMorph('[slot=label]', html `<label-view slot="label">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this);
133
+ break;
134
+ case 'disabled':
135
+ for (const el of this.#shadowRoot.querySelectorAll('input'))
136
+ el.toggleAttribute('disabled', !newValue);
137
+ break;
138
+ }
139
+ }
140
+ disconnectedCallback() {
141
+ super.disconnectedCallback();
142
+ if (this.#track)
143
+ this.#resizeObserver.unobserve(this.#track);
144
+ this.#validityObservers.unobserveAll();
145
+ }
146
+ connectedCallback() {
147
+ super.connectedCallback();
148
+ if (this.hasAttribute('is-on'))
149
+ this.isOn = this.hasAttribute('is-on');
150
+ this.#sendValueToForm(false);
151
+ if (this.#track)
152
+ this.#resizeObserver.observe(this.#track);
153
+ CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, ({ clientX, clientY }) => this.#measurePointerIsOverDot(clientX, clientY) ?? false), this).on());
154
+ }
155
+ get toggleStyle() {
156
+ return toggleStyles.includes(this.getAttribute('toggle-style') ?? '') ? this.getAttribute('toggle-style') : 'switch';
157
+ }
158
+ get isOn() {
159
+ return this.#isOn;
160
+ }
161
+ set isOn(v) {
162
+ this.#isOn = Boolean(v);
163
+ this.#value = this.#isOn ? (this.getAttribute('value') ?? 'on') : null;
164
+ this.ariaChecked = `${this.#isOn}`;
165
+ }
166
+ #handleValiditiesSlotchange = ({ type, target: slot }) => {
167
+ debug(`${_a.name} ⚡️ ${type}`);
168
+ if (!(slot instanceof HTMLSlotElement))
169
+ return;
170
+ const assigned = slot.assignedElements();
171
+ this.#validityObservers.syncObservations(assigned, ['value', 'label']);
172
+ this.#renderValidityMsgs([]);
173
+ };
174
+ #handleFocusin = ({ type, target }) => {
175
+ debug(`${_a.name} ⚡️ ${type}`);
176
+ if (target === this)
177
+ this.#track?.focus();
178
+ };
179
+ #handleTrackClick = ({ type }) => {
180
+ debug(`${_a.name} ⚡️ ${type}`);
181
+ if (this.#didDrag)
182
+ return (this.#didDrag = false);
183
+ this.#applyIsOnWithFlip(!this.isOn);
184
+ this.#sendValueToForm(true);
185
+ };
186
+ #measurePointerIsOverDot = (clientX, clientY) => {
187
+ if (!this.#track)
188
+ return;
189
+ const { left, top, height } = this.#track.getBoundingClientRect();
190
+ const dotLeft = left + parseFloat(self.getComputedStyle(this.#track, '::before').left);
191
+ const dotCenterX = dotLeft + this.#dotSize / 2;
192
+ const dotCenterY = top + height / 2;
193
+ return Math.hypot(clientX - dotCenterX, clientY - dotCenterY) <= this.#dotSize / 2;
194
+ };
195
+ get #baseX() {
196
+ return this.isOn ? this.#trackMaxX : this.#trackMinX;
197
+ }
198
+ #handleTrackPointerdown = ({ type, pointerId, clientX, clientY }) => {
199
+ debug(`${_a.name} ⚡️ ${type}`);
200
+ if (!this.#track)
201
+ return;
202
+ if (!this.#measurePointerIsOverDot(clientX, clientY))
203
+ return; // ignore taps elsewhere on the track
204
+ this.#didDrag = true; // dot was engaged — settle() will own the outcome, click must be swallowed
205
+ const currentDelta = parseFloat(self.getComputedStyle(this.#track).getPropertyValue('--toggle--dot-translate-x')) || 0, currentAbsoluteX = this.#baseX + currentDelta;
206
+ this.#dragOffsetX = clientX - this.#track.getBoundingClientRect().left - currentAbsoluteX;
207
+ this.#track.style.setProperty('--toggle--dot-transition-duration', '0ms');
208
+ this.#track.setPointerCapture(pointerId);
209
+ };
210
+ #handleTrackPointermove = ({ type, clientX }) => {
211
+ debug(`${_a.name} ⚡️ ${type}`);
212
+ if (!this.#isDragging)
213
+ return;
214
+ this.#updateFromEvent(clientX);
215
+ };
216
+ #handleTrackPointerup = ({ type, pointerId }) => {
217
+ debug(`${_a.name} ⚡️ ${type}`);
218
+ if (!this.#isDragging)
219
+ return; // pointerdown never engaged (missed the dot) — plain click, nothing to settle
220
+ this.#track?.style.removeProperty('--toggle--dot-transition-duration');
221
+ this.#track?.releasePointerCapture(pointerId);
222
+ this.#settle();
223
+ };
224
+ #handleTrackPointercancel = ({ type }) => {
225
+ debug(`${_a.name} ⚡️ ${type}`);
226
+ if (!this.#isDragging)
227
+ return; // already settled via pointerup, or nothing to settle
228
+ this.#track?.style.removeProperty('--toggle--dot-transition-duration');
229
+ this.#settle();
230
+ };
231
+ #handleWindowBlur = () => {
232
+ this.toggleAttribute('js-window-inactive', true);
233
+ if (!this.#isDragging)
234
+ return;
235
+ this.#track?.style.removeProperty('--toggle--dot-transition-duration');
236
+ this.#settle();
237
+ };
238
+ #handleWindowFocus = async () => {
239
+ this.toggleAttribute('js-window-inactive', false);
240
+ };
241
+ #updateFromEvent = (clientX) => {
242
+ if (!this.#track)
243
+ return;
244
+ const { left } = this.#track.getBoundingClientRect();
245
+ const scaleShiftStart = this.#isOn ? 5 : 0, scaleShiftEnd = this.#isOn ? 0 : 4;
246
+ const absoluteX = Math.min(Math.max(clientX - left - this.#dragOffsetX, this.#trackMinX + scaleShiftStart), this.#trackMaxX - scaleShiftEnd);
247
+ this.#track.style.setProperty('--toggle--dot-translate-x', `${Math.round(absoluteX - this.#baseX)}px`);
248
+ };
249
+ #settle = () => {
250
+ if (!this.#track)
251
+ return;
252
+ const deltaX = parseFloat(self.getComputedStyle(this.#track).getPropertyValue('--toggle--dot-translate-x')) || 0;
253
+ const absoluteX = this.#baseX + deltaX;
254
+ const nextIsOn = absoluteX > this.#trackMaxX / 2;
255
+ if (nextIsOn === this.isOn)
256
+ return this.#track.style.removeProperty('--toggle--dot-translate-x'); // pure transform animation back to rest, inset untouched
257
+ this.#applyIsOnWithFlip(nextIsOn);
258
+ this.#sendValueToForm(true);
259
+ };
260
+ #handleTrackKeydown = (evt) => {
261
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
262
+ if (' ' !== evt.key)
263
+ return;
264
+ evt.preventDefault();
265
+ this.#applyIsOnWithFlip(!this.isOn);
266
+ this.#sendValueToForm(true);
267
+ };
268
+ #applyIsOnWithFlip = (nextIsOn) => {
269
+ if (!this.#track || nextIsOn === this.isOn)
270
+ return;
271
+ // capture current visual position under the OLD base, before flipping state
272
+ const deltaX = parseFloat(self.getComputedStyle(this.#track).getPropertyValue('--toggle--dot-translate-x')) || 0, oldAbsoluteX = this.#baseX + deltaX;
273
+ this.isOn = nextIsOn; // changes --toggle--dot-inset-inline-start/-end via aria-checked
274
+ const compensationX = oldAbsoluteX - this.#baseX; // baseX now reflects the NEW state
275
+ // make inset + transform jump together, instantly, so nothing is visibly out of sync
276
+ this.#track.style.setProperty('--toggle--dot-transition-duration', '0ms');
277
+ this.#track.style.setProperty('--toggle--dot-translate-x', `${Math.round(compensationX)}px`);
278
+ void this.#track.offsetWidth; // force reflow so the instant jump is committed before re-enabling transitions
279
+ this.#track.style.removeProperty('--toggle--dot-transition-duration');
280
+ self.requestAnimationFrame(() => {
281
+ this.#track?.style.removeProperty('--toggle--dot-translate-x'); // only transform animates from here — single source of motion
282
+ });
283
+ };
284
+ #sendValueToForm = (dispatchEvent = true) => {
285
+ // input.value has already been updated/synced !!
286
+ if (this.matches(':disabled'))
287
+ return this.setValidity({});
288
+ if (this.hasAttribute('required') && !this.isOn) {
289
+ this.setValidity({ valueMissing: true });
290
+ }
291
+ else
292
+ this.setValidity({});
293
+ const entries = new FormData();
294
+ if (this.value)
295
+ entries.append(this.name, this.value);
296
+ this.#internals.setFormValue(entries);
297
+ if (dispatchEvent)
298
+ this.dispatchEvent(new CustomEvent('toggle:change', { detail: { value: this.value, isOn: this.isOn }, bubbles: true, composed: true }));
299
+ };
300
+ /**
301
+ * Form participation property
302
+ */
303
+ get name() {
304
+ return this.getAttribute('name') ?? this.getAttribute('label') ?? this.querySelector(':scope>[slot=label]')?.textContent ?? '';
305
+ }
306
+ get value() {
307
+ return this.#value;
308
+ }
309
+ set value(v) {
310
+ this.#value = this.isOn ? String(v) : null;
311
+ }
312
+ setValidity = (flags, message, anchor) => {
313
+ // let msg
314
+ // if (message)
315
+ for (const k in flags) {
316
+ const key = k; // ✅ type-safe cast
317
+ if (true !== flags[key])
318
+ continue;
319
+ for (const el of this.#slots?.get('validity-options')?.assignedElements({ flatten: true }) ?? []) {
320
+ if (!el.matches('option'))
321
+ continue;
322
+ const { label, value } = el;
323
+ if (`${kebabCase(key)}` === value) {
324
+ message = label;
325
+ break;
326
+ }
327
+ else if (`${kebabCase(key)}:${message}` === value) {
328
+ message = label;
329
+ break;
330
+ }
331
+ }
332
+ }
333
+ if (!message)
334
+ for (const k in flags) {
335
+ const key = k; // ✅ type-safe cast
336
+ if (true !== flags[key])
337
+ continue;
338
+ message = kebabCase(key);
339
+ break;
340
+ }
341
+ debug(`${_a.name} ⚡️ validity-change`);
342
+ return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#track);
343
+ };
344
+ setCustomValidity = (message) => {
345
+ this.#customValidity = message;
346
+ if (this.#customValidity)
347
+ this.#internals.setValidity({ ...this.#internals.validity, customError: true }, message);
348
+ else
349
+ this.#sendValueToForm(false);
350
+ };
351
+ formStateRestoreCallback(state, reason) {
352
+ this.value = state;
353
+ }
354
+ formAssociatedCallback(form) {
355
+ this.#sendValueToForm(false);
356
+ }
357
+ formDisabledCallback(disabled) {
358
+ for (const el of this.#shadowRoot.querySelectorAll('input'))
359
+ el.toggleAttribute('disabled', !disabled);
360
+ }
361
+ formResetCallback() {
362
+ this.value = '';
363
+ this.#sendValueToForm(false);
364
+ }
365
+ }
366
+ _a = ToggleView;
@@ -1,5 +1,13 @@
1
+ /**
2
+ * @summary A container view that groups items together in the toolbar or navigation bar.
3
+ */
1
4
  export declare class ToolBarItemGroup extends HTMLElement {
2
5
  constructor();
3
6
  connectedCallback(): void;
4
7
  disconnectedCallback(): void;
5
8
  }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'tool-bar-item-group': ToolBarItemGroup;
12
+ }
13
+ }
@@ -1,11 +1,29 @@
1
- export class ToolBarItemGroup extends HTMLElement {
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var ToolBarItemGroup_1;
8
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
9
+ import { adaptiveSlot } from '../internal/decorators';
10
+ import { debug } from '../internal/utils';
11
+ /**
12
+ * @summary A container view that groups items together in the toolbar or navigation bar.
13
+ */
14
+ let ToolBarItemGroup = ToolBarItemGroup_1 = class ToolBarItemGroup extends HTMLElement {
2
15
  constructor() {
3
16
  super();
4
17
  }
5
18
  connectedCallback() {
6
- console.debug(`${ToolBarItemGroup.name} ⚡️ connect`);
19
+ debug(`${ToolBarItemGroup_1.name} ⚡️ connect`);
7
20
  }
8
21
  disconnectedCallback() {
9
- console.debug(`${ToolBarItemGroup.name} ⚡️ disconnect`);
22
+ debug(`${ToolBarItemGroup_1.name} ⚡️ disconnect`);
23
+ CleanupRegistry.unregister(this);
10
24
  }
11
- }
25
+ };
26
+ ToolBarItemGroup = ToolBarItemGroup_1 = __decorate([
27
+ adaptiveSlot()
28
+ ], ToolBarItemGroup);
29
+ export { ToolBarItemGroup };
@@ -1,5 +1,16 @@
1
+ /**
2
+ * @summary A view placed in the toolbar or navigation bar.
3
+ */
1
4
  export declare class ToolBarItem extends HTMLElement {
5
+ #private;
6
+ static get observedAttributes(): string[];
2
7
  constructor();
3
- connectedCallback(): void;
8
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
4
9
  disconnectedCallback(): void;
10
+ connectedCallback(): void;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ 'tool-bar-item': ToolBarItem;
15
+ }
5
16
  }
@@ -1,19 +1,66 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var ToolBarItem_1;
1
8
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { onoff, touchGlass } from '../internal/utils';
3
- export class ToolBarItem extends HTMLElement {
9
+ import { adaptiveSlot } from '../internal/decorators';
10
+ import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
11
+ import { Snapshot } from '../snapshot';
12
+ /**
13
+ * @summary A view placed in the toolbar or navigation bar.
14
+ */
15
+ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
16
+ static get observedAttributes() {
17
+ return ['slot', 'data-previous-slot', 'title-key'];
18
+ }
19
+ #mutationObserver;
4
20
  constructor() {
5
21
  super();
6
22
  }
23
+ attributeChangedCallback(name, oldValue, newValue) {
24
+ debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
25
+ switch (name) {
26
+ case 'slot':
27
+ case 'data-previous-slot':
28
+ case 'title-key': {
29
+ this.#mutationObserver?.disconnect();
30
+ const role = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '', tKey = this.getAttribute('title-key');
31
+ if (['confirmation-action', 'cancellation-action'].includes(role))
32
+ Snapshot.waitReady.then(() => {
33
+ ensurePlaceholder(this.querySelector(':scope>button:not(:has(> :not([slot])))'), role, tKey, Snapshot.config);
34
+ this.#mutationObserver = new MutationObserver((mutations) => {
35
+ for (const { target } of mutations)
36
+ if (target instanceof HTMLElement)
37
+ ensurePlaceholder(this.querySelector(':scope>button:not(:has(> :not([slot])))'), role, tKey, Snapshot.config);
38
+ });
39
+ this.#mutationObserver.observe(this, {
40
+ childList: true,
41
+ });
42
+ });
43
+ break;
44
+ }
45
+ }
46
+ }
47
+ disconnectedCallback() {
48
+ debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
49
+ this.#mutationObserver?.disconnect();
50
+ CleanupRegistry.unregister(this);
51
+ }
7
52
  connectedCallback() {
8
- console.debug(`${ToolBarItem.name} ⚡️ connect`);
9
- CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, (event) => {
10
- if (event.target.closest('menu-view[open]'))
53
+ debug(`${ToolBarItem_1.name} ⚡️ connect`);
54
+ CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, ({ target }) => {
55
+ if (!(target instanceof HTMLElement))
56
+ return true;
57
+ if (target.closest('menu-view[open]'))
11
58
  return false;
12
59
  return true;
13
60
  }), this).on());
14
61
  }
15
- disconnectedCallback() {
16
- console.debug(`${ToolBarItem.name} ⚡️ disconnect`);
17
- CleanupRegistry.unregister(this);
18
- }
19
- }
62
+ };
63
+ ToolBarItem = ToolBarItem_1 = __decorate([
64
+ adaptiveSlot((el) => !el.closest('tool-bar-item-group'))
65
+ ], ToolBarItem);
66
+ export { ToolBarItem };
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @summary A list of items placed into the toolbar or navigation bar around your content.
3
+ *
4
+ * @slot cancellation-action — The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
5
+ * @slot primary-action — The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
6
+ * @slot confirmation-action — The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
7
+ * @slot destructive-action — The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
8
+ * @slot top-bar-leading — Places the item in the leading edge of the top bar
9
+ * @slot top-bar-principal — Places the item in the middle of the top bar
10
+ * @slot top-bar-trailing — Places the item in the trailing edge of the top bar
11
+ * @slot bottom-bar-leading — Places the item in the leading edge of the bottom bar
12
+ * @slot bottom-bar-principal — Places the item in the middle of the bottom bar
13
+ * @slot bottom-bar-trailing — Places the item in the trailing edge of the bottom bar
14
+ */
1
15
  export declare class ToolBar extends HTMLElement {
2
16
  #private;
3
17
  static get template(): DocumentFragment;
@@ -5,3 +19,8 @@ export declare class ToolBar extends HTMLElement {
5
19
  connectedCallback(): void;
6
20
  disconnectedCallback(): void;
7
21
  }
22
+ declare global {
23
+ interface HTMLElementTagNameMap {
24
+ 'tool-bar': ToolBar;
25
+ }
26
+ }
@@ -1,49 +1,64 @@
1
1
  var _a;
2
2
  import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
3
- import { $ } from '../internal/utils';
3
+ import { $, debug } from '../internal/utils';
4
+ import { html } from '../tpl';
4
5
  const observers = new ResizeObserverSingleton();
6
+ /**
7
+ * @summary A list of items placed into the toolbar or navigation bar around your content.
8
+ *
9
+ * @slot cancellation-action — The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
10
+ * @slot primary-action — The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
11
+ * @slot confirmation-action — The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
12
+ * @slot destructive-action — The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
13
+ * @slot top-bar-leading — Places the item in the leading edge of the top bar
14
+ * @slot top-bar-principal — Places the item in the middle of the top bar
15
+ * @slot top-bar-trailing — Places the item in the trailing edge of the top bar
16
+ * @slot bottom-bar-leading — Places the item in the leading edge of the bottom bar
17
+ * @slot bottom-bar-principal — Places the item in the middle of the bottom bar
18
+ * @slot bottom-bar-trailing — Places the item in the trailing edge of the bottom bar
19
+ */
5
20
  export class ToolBar extends HTMLElement {
6
21
  static #template;
7
22
  static get template() {
8
23
  // <!--exportparts="toolbar-leading-stack,toolbar-principal-stack,toolbar-trailing-stack"-->
9
- return (this.#template ??= $(String.raw `
10
- <div part="root top-bar">
11
- <div part="root toolbar-leading-stack">
12
- <slot name="top-bar-leading"></slot>
13
- </div>
14
- <div part="root toolbar-principal-stack">
15
- <slot name="top-bar-principal"></slot>
16
- </div>
17
- <div part="root toolbar-trailing-stack">
18
- <slot name="top-bar-trailing"></slot>
19
- </div>
20
- </div>
21
- <div part="root bottom-bar">
22
- <div part="root toolbar-leading-stack">
23
- <slot name="bottom-bar-leading"></slot>
24
- </div>
25
- <div part="root toolbar-principal-stack">
26
- <slot name="bottom-bar-principal"></slot>
27
- </div>
28
- <div part="root toolbar-trailing-stack">
29
- <slot name="bottom-bar-trailing"></slot>
30
- </div>
31
- </div>`, ''));
24
+ return (this.#template ??= $(html `<div part="root top-bar">
25
+ <div part="root toolbar-leading-stack">
26
+ <slot name="cancellation-action"></slot>
27
+ <slot name="destructive-action"></slot>
28
+ <slot name="top-bar-leading"></slot>
29
+ </div>
30
+ <div part="root toolbar-principal-stack">
31
+ <slot name="top-bar-principal"></slot>
32
+ </div>
33
+ <div part="root toolbar-trailing-stack">
34
+ <slot name="top-bar-trailing"></slot>
35
+ <slot name="primary-action"></slot>
36
+ <slot name="confirmation-action"></slot>
37
+ </div>
38
+ </div>
39
+ <div part="root bottom-bar">
40
+ <div part="root toolbar-leading-stack">
41
+ <slot name="bottom-bar-leading"></slot>
42
+ </div>
43
+ <div part="root toolbar-principal-stack">
44
+ <slot name="bottom-bar-principal"></slot>
45
+ </div>
46
+ <div part="root toolbar-trailing-stack">
47
+ <slot name="bottom-bar-trailing"></slot>
48
+ </div>
49
+ </div>`));
32
50
  }
33
51
  #shadowRoot;
34
52
  get #scrollView() {
35
- return this.parentElement?.querySelector(':scope > scroll-view') ?? undefined; //this.previousElementSibling ?? undefined
53
+ return this.parentElement?.querySelector(':scope>scroll-view') ?? undefined; //this.previousElementSibling ?? undefined
36
54
  }
37
55
  constructor() {
38
56
  super();
39
57
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
40
- // NOTE: wait for config
41
- // Snapshot.waitReady.then(() => {
42
58
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
43
- // })
44
59
  }
45
60
  connectedCallback() {
46
- console.debug(`${_a.name} ⚡️ connect`);
61
+ debug(`${_a.name} ⚡️ connect`);
47
62
  // NOTE: wait for config
48
63
  // Snapshot.waitReady.then(() => {
49
64
  for (const el of this.#shadowRoot.querySelectorAll(`[part*="toolbar-leading-stack"],[part*="toolbar-trailing-stack"]`))
@@ -51,11 +66,11 @@ export class ToolBar extends HTMLElement {
51
66
  // })
52
67
  }
53
68
  disconnectedCallback() {
54
- console.debug(`${_a.name} ⚡️ disconnect`);
69
+ debug(`${_a.name} ⚡️ disconnect`);
55
70
  observers.unobserve(this);
56
71
  }
57
72
  #measureStacks(entry) {
58
- console.debug(`${_a.name} ⚡️ measure`);
73
+ debug(`${_a.name} ⚡️ measure`);
59
74
  if (this.closest('[hidden]'))
60
75
  return;
61
76
  const leading = 'toolbar-leading-stack', trailing = 'toolbar-trailing-stack';
@@ -63,7 +78,7 @@ export class ToolBar extends HTMLElement {
63
78
  'top-bar': 'navbar',
64
79
  'bottom-bar': 'toolbar', //'bottombar',
65
80
  };
66
- const { contentRect, target } = entry;
81
+ const { contentRect: { width }, target, } = entry;
67
82
  const parentPart = target.parentElement?.part.contains('top-bar') ? 'top-bar' : target.parentElement?.part.contains('bottom-bar') ? 'bottom-bar' : null;
68
83
  if (!parentPart)
69
84
  return;
@@ -71,7 +86,7 @@ export class ToolBar extends HTMLElement {
71
86
  if (!side)
72
87
  return;
73
88
  const prop = `--${parentMap[parentPart]}-padding-${side}`;
74
- $.prop(prop, `${Math.round(contentRect.width)}px`, this.#scrollView); //;(this.#scrollView as HTMLElement)?.style?.setProperty(prop, `${Math.round(contentRect.width)}px`)
89
+ this.#scrollView?.style?.setProperty(prop, `${Math.round(width)}px`); // $.prop(prop, `${Math.round(width)}px`, this.#scrollView) //
75
90
  }
76
91
  }
77
92
  _a = ToolBar;