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

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 (243) 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 +21 -10
  10. package/generated/client/index.js +177 -194
  11. package/generated/components/alert-dialog.d.ts +8 -0
  12. package/generated/components/alert-dialog.js +99 -0
  13. package/generated/components/body-view.js +5 -2
  14. package/generated/components/bordered-button.d.ts +10 -0
  15. package/generated/components/bordered-button.js +39 -3
  16. package/generated/components/bordered-prominent-button.d.ts +10 -0
  17. package/generated/components/bordered-prominent-button.js +39 -3
  18. package/generated/components/borderless-button.d.ts +9 -1
  19. package/generated/components/borderless-button.js +32 -11
  20. package/generated/components/color-scheme.d.ts +7 -0
  21. package/generated/components/color-scheme.js +54 -0
  22. package/generated/components/confirmation-dialog.d.ts +1 -1
  23. package/generated/components/confirmation-dialog.js +43 -32
  24. package/generated/components/content-unavailable-view.d.ts +24 -0
  25. package/generated/components/content-unavailable-view.js +81 -0
  26. package/generated/components/date-picker.d.ts +2 -12
  27. package/generated/components/date-picker.js +96 -65
  28. package/generated/components/disclosure-group.d.ts +5 -0
  29. package/generated/components/disclosure-group.js +18 -7
  30. package/generated/components/fine-tooltip.d.ts +7 -0
  31. package/generated/components/fine-tooltip.js +107 -0
  32. package/generated/components/form-view.d.ts +3 -0
  33. package/generated/components/form-view.js +8 -3
  34. package/generated/components/glass-button.d.ts +10 -0
  35. package/generated/components/glass-button.js +39 -3
  36. package/generated/components/glass-prominent-button.d.ts +10 -0
  37. package/generated/components/glass-prominent-button.js +39 -3
  38. package/generated/components/h-stack.d.ts +14 -0
  39. package/generated/components/h-stack.js +23 -0
  40. package/generated/components/image-view.d.ts +9 -0
  41. package/generated/components/image-view.js +64 -0
  42. package/generated/components/index.d.ts +11 -3
  43. package/generated/components/index.js +11 -3
  44. package/generated/components/label-view.d.ts +6 -1
  45. package/generated/components/label-view.js +40 -60
  46. package/generated/components/labeled-content.d.ts +9 -0
  47. package/generated/components/labeled-content.js +116 -0
  48. package/generated/components/list-view.d.ts +3 -0
  49. package/generated/components/list-view.js +20 -17
  50. package/generated/components/menu-view.d.ts +4 -1
  51. package/generated/components/menu-view.js +60 -51
  52. package/generated/components/navigation-large-title.js +9 -5
  53. package/generated/components/navigation-split-view.d.ts +4 -1
  54. package/generated/components/navigation-split-view.js +13 -6
  55. package/generated/components/navigation-stack.d.ts +4 -1
  56. package/generated/components/navigation-stack.js +16 -9
  57. package/generated/components/navigation-title.d.ts +1 -1
  58. package/generated/components/navigation-title.js +58 -55
  59. package/generated/components/picker-view.d.ts +32 -4
  60. package/generated/components/picker-view.js +924 -234
  61. package/generated/components/plain-button.js +5 -3
  62. package/generated/components/progress-view.d.ts +13 -0
  63. package/generated/components/progress-view.js +120 -0
  64. package/generated/components/screen-view.js +3 -1
  65. package/generated/components/scroll-view-proxy.d.ts +8 -0
  66. package/generated/components/scroll-view-proxy.js +17 -0
  67. package/generated/components/scroll-view.d.ts +1 -1
  68. package/generated/components/scroll-view.js +101 -85
  69. package/generated/components/search-view.d.ts +7 -0
  70. package/generated/components/search-view.js +30 -0
  71. package/generated/components/section-view.d.ts +1 -1
  72. package/generated/components/section-view.js +35 -30
  73. package/generated/components/sheet-view.d.ts +1 -2
  74. package/generated/components/sheet-view.js +32 -39
  75. package/generated/components/sidebar-toggle.js +44 -66
  76. package/generated/components/sidebar-view.js +13 -8
  77. package/generated/components/sticky-container.js +8 -4
  78. package/generated/components/tab-bar.d.ts +3 -0
  79. package/generated/components/tab-bar.js +20 -10
  80. package/generated/components/tab-item.js +24 -13
  81. package/generated/components/tab-view.js +25 -17
  82. package/generated/components/table-view.d.ts +5 -0
  83. package/generated/components/table-view.js +55 -77
  84. package/generated/components/text-field.d.ts +2 -2
  85. package/generated/components/text-field.js +95 -88
  86. package/generated/components/toggle-view.d.ts +28 -0
  87. package/generated/components/toggle-view.js +224 -0
  88. package/generated/components/tool-bar-item-group.js +21 -4
  89. package/generated/components/tool-bar-item.d.ts +4 -1
  90. package/generated/components/tool-bar-item.js +57 -10
  91. package/generated/components/tool-bar.d.ts +12 -0
  92. package/generated/components/tool-bar.js +27 -11
  93. package/generated/components/v-keyboard.d.ts +3 -1
  94. package/generated/components/v-keyboard.js +12 -6
  95. package/generated/components/v-stack.d.ts +12 -0
  96. package/generated/components/v-stack.js +17 -2
  97. package/generated/css/index.css +2533 -941
  98. package/generated/events/alert-dialog.d.ts +8 -0
  99. package/generated/events/alert-dialog.js +1 -0
  100. package/generated/events/confirmation-dialog.d.ts +2 -2
  101. package/generated/events/index.d.ts +2 -0
  102. package/generated/events/index.js +2 -0
  103. package/generated/events/picker-view.d.ts +7 -0
  104. package/generated/events/scroll-view.js +4 -0
  105. package/generated/events/tab-view.d.ts +6 -2
  106. package/generated/events/text-field.js +3 -0
  107. package/generated/events/toggle-view.d.ts +9 -0
  108. package/generated/events/toggle-view.js +4 -0
  109. package/generated/i18n/index.d.ts +20 -10
  110. package/generated/i18n/index.js +82 -54
  111. package/generated/i18n/locales/el.d.ts +16 -0
  112. package/generated/i18n/locales/el.js +16 -0
  113. package/generated/i18n/locales/en.d.ts +16 -0
  114. package/generated/i18n/locales/en.js +16 -0
  115. package/generated/i18n/locales/index.d.ts +4 -0
  116. package/generated/i18n/locales/index.js +4 -0
  117. package/generated/internal/class/css-style-observer.js +3 -2
  118. package/generated/internal/class/form-associated-base.d.ts +0 -4
  119. package/generated/internal/class/form-associated-base.js +23 -38
  120. package/generated/internal/class/mutation-observer-set.d.ts +9 -0
  121. package/generated/internal/class/mutation-observer-set.js +42 -0
  122. package/generated/internal/class/mutation-observer-singleton.js +18 -0
  123. package/generated/internal/class/navigation-view.d.ts +1 -1
  124. package/generated/internal/class/navigation-view.js +38 -43
  125. package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
  126. package/generated/internal/decorators/adaptive-slot.js +50 -0
  127. package/generated/internal/decorators/custom-element.d.ts +1 -1
  128. package/generated/internal/decorators/custom-element.js +2 -1
  129. package/generated/internal/decorators/index.d.ts +6 -0
  130. package/generated/internal/decorators/index.js +6 -0
  131. package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
  132. package/generated/internal/decorators/microtask-on-connected.js +67 -0
  133. package/generated/internal/privateNamespace.d.ts +10 -0
  134. package/generated/internal/privateNamespace.js +168 -1
  135. package/generated/internal/utils/cash/index.d.ts +4 -3
  136. package/generated/internal/utils/cash/index.js +6 -4
  137. package/generated/internal/utils/dev-flags.d.ts +3 -0
  138. package/generated/internal/utils/dev-flags.js +5 -0
  139. package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
  140. package/generated/internal/utils/ensure-placeholder.js +55 -0
  141. package/generated/internal/utils/index.d.ts +7 -2
  142. package/generated/internal/utils/index.js +9 -2
  143. package/generated/internal/utils/is-inside.d.ts +1 -0
  144. package/generated/internal/utils/is-inside.js +4 -0
  145. package/generated/internal/utils/list-active.js +67 -12
  146. package/generated/internal/utils/render-label-icon.d.ts +2 -0
  147. package/generated/internal/utils/render-label-icon.js +19 -0
  148. package/generated/internal/utils/render-label-title.d.ts +2 -0
  149. package/generated/internal/utils/render-label-title.js +16 -0
  150. package/generated/internal/utils/render-label.d.ts +1 -0
  151. package/generated/internal/utils/render-label.js +19 -0
  152. package/generated/internal/utils/touch-glass.js +5 -5
  153. package/generated/namespace-browser/base.d.ts +12 -3
  154. package/generated/namespace-browser/base.js +41 -18
  155. package/generated/namespace-browser/event.d.ts +10 -0
  156. package/generated/namespace-browser/event.js +1 -0
  157. package/generated/snapshot/index.d.ts +3 -1
  158. package/generated/snapshot/index.js +25 -2
  159. package/generated/tpl/html.d.ts +5 -0
  160. package/generated/tpl/html.js +3 -0
  161. package/generated/tpl/index.d.ts +4 -0
  162. package/generated/tpl/index.js +4 -0
  163. package/generated/tpl/render.d.ts +2 -0
  164. package/generated/tpl/render.js +132 -0
  165. package/package.json +18 -4
  166. package/scss/_components.scss +14 -0
  167. package/scss/_functions.scss +10 -0
  168. package/scss/_mixins.scss +4 -0
  169. package/scss/_transitions.scss +6 -1
  170. package/scss/_vars.scss +9 -2
  171. package/scss/base/_layout.scss +17 -7
  172. package/scss/base/_reboot.scss +34 -1
  173. package/scss/base/_root.scss +117 -114
  174. package/scss/colors/_index.scss +304 -85
  175. package/scss/components/_alert-dialog.scss +111 -0
  176. package/scss/components/_bordered-button.scss +35 -0
  177. package/scss/components/_bordered-prominent-button.scss +45 -0
  178. package/scss/components/_borderless-button.scss +25 -0
  179. package/scss/components/_confirmation-dialog.scss +41 -49
  180. package/scss/components/_content-unavailable-view.scss +56 -0
  181. package/scss/components/_date-picker.scss +15 -15
  182. package/scss/components/_detail-placeholder.scss +1 -3
  183. package/scss/components/_disclosure-group.scss +84 -33
  184. package/scss/components/_fine-tooltip.scss +84 -0
  185. package/scss/components/_form-view.scss +58 -20
  186. package/scss/components/_glass-button.scss +35 -0
  187. package/scss/components/_glass-prominent-button.scss +46 -0
  188. package/scss/components/_group-box.scss +27 -0
  189. package/scss/components/_h-flex-stack.scss +23 -0
  190. package/scss/components/_h-stack.scss +21 -15
  191. package/scss/components/_image-view.scss +20 -0
  192. package/scss/components/_index.scss +40 -20
  193. package/scss/components/_label-view copy.scss.txt +420 -0
  194. package/scss/components/_label-view.scss +94 -110
  195. package/scss/components/_label-view.scss.txt +536 -0
  196. package/scss/components/_labeled-content.scss +59 -1
  197. package/scss/components/_list-view.scss +65 -25
  198. package/scss/components/_menu-view.scss +95 -60
  199. package/scss/components/_navigation-large-title.scss +17 -0
  200. package/scss/components/_navigation-split-view.scss +3 -3
  201. package/scss/components/_picker-view.scss +259 -59
  202. package/scss/components/_plain-button.scss +7 -0
  203. package/scss/components/_progress-view.scss +98 -0
  204. package/scss/components/_scroll-view-proxy.scss +22 -20
  205. package/scss/components/_scroll-view.scss +4 -0
  206. package/scss/components/_search-view.scss +22 -0
  207. package/scss/components/_section-view.scss +23 -22
  208. package/scss/components/_sheet-view.scss +16 -6
  209. package/scss/components/_sidebar-toggle.scss +1 -4
  210. package/scss/components/_sticky-container.scss +1 -1
  211. package/scss/components/_tab-bar.scss +17 -3
  212. package/scss/components/_tab-view.scss +4 -2
  213. package/scss/components/_table-column.scss +2 -0
  214. package/scss/components/_table-row.scss +69 -1
  215. package/scss/components/_table-view.scss +22 -14
  216. package/scss/components/_text-field.scss +37 -17
  217. package/scss/components/_toggle-view.scss +112 -0
  218. package/scss/components/_tool-bar-item.scss +34 -82
  219. package/scss/components/_tool-bar.scss +77 -57
  220. package/scss/components/_v-stack.scss +9 -2
  221. package/scss/final/_touch-glass.scss +24 -0
  222. package/scss/mixins/_button.scss +44 -0
  223. package/scss/mixins/_color.scss +16 -0
  224. package/scss/mixins/_dialog.scss +1 -0
  225. package/scss/mixins/_index.scss +64 -2
  226. package/scss/placeholders/_buttons.scss +44 -10
  227. package/scss/placeholders/_lists.scss +133 -126
  228. package/scss/transitions/_alert-dialog.scss +18 -0
  229. package/scss/transitions/_confirmation-dialog.scss +8 -0
  230. package/scss/transitions/_fine-tooltip.scss +21 -0
  231. package/scss/transitions/_menu-view.scss +17 -15
  232. package/scss/transitions/_progress-view.scss +23 -0
  233. package/scss/transitions/_sheet-view.scss +30 -0
  234. package/scss/transitions/_tab-bar.scss +6 -5
  235. package/scss/utils/_frame.scss +42 -0
  236. package/scss/utils/_index.scss +67 -52
  237. package/scss/utils/_stacks.scss +56 -73
  238. package/web-components.html-data/en.json +623 -24
  239. package/generated/confirmation-dialog/index.d.ts +0 -1
  240. package/generated/confirmation-dialog/index.js +0 -1
  241. package/generated/lifecycle-observer/index.d.ts +0 -1
  242. package/generated/lifecycle-observer/index.js +0 -1
  243. package/scss/transitions/_dialog.scss +0 -28
@@ -0,0 +1,224 @@
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 { $, devFlags, kebabCase, onoff, renderLabel } from '../internal/utils';
6
+ const toggleStyles = ['switch', 'button'];
7
+ /**
8
+ * @slot label
9
+ * @slot validity-options
10
+ */
11
+ export class ToggleView extends FormAssociatedBase {
12
+ // declare addEventListener: TypedEventTargetMethods<ToggleViewEventMap>['addEventListener']
13
+ // declare removeEventListener: TypedEventTargetMethods<ToggleViewEventMap>['removeEventListener']
14
+ static get observedAttributes() {
15
+ return ['label', 'name', 'value', 'is-on', 'keyboard-type', 'required', 'disabled'];
16
+ }
17
+ static #template;
18
+ static get template() {
19
+ return (this.#template ??= $(String.raw `
20
+ <label part="root toggle-stack">
21
+ <div part="root toggle-label-stack">
22
+ <slot name="label"></slot>
23
+ </div>
24
+ <div part="root toggle-input-stack">
25
+ <!--<input type="checkbox" part="root input toggle-form-input">-->
26
+ <div part="root toggle-form-input" tabindex="0"></div>
27
+ </div>
28
+ <slot name="validity-options" hidden></slot>
29
+ </label>`));
30
+ }
31
+ #renderValidityMsgs = (entries) => {
32
+ if (devFlags.debug)
33
+ console.debug(`${_a.name} ⚡️ mutation`);
34
+ this.setValidity(this.validity, this.validationMessage);
35
+ };
36
+ #shadowRoot;
37
+ #customValidity = '';
38
+ #slots = new Map();
39
+ #validityObservers = new MutationObserverSet(this.#renderValidityMsgs);
40
+ #input;
41
+ #value = 'on';
42
+ #isOn = false;
43
+ #connected = false;
44
+ get #internals() {
45
+ return getInternals(this);
46
+ }
47
+ constructor() {
48
+ super();
49
+ this.#shadowRoot = this.attachShadow({ mode: 'closed' });
50
+ this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
51
+ for (const slot of this.#shadowRoot.querySelectorAll('slot'))
52
+ this.#slots?.set(slot.name, slot);
53
+ CleanupRegistry.register(this, () => {
54
+ this.#slots = new Map();
55
+ });
56
+ CleanupRegistry.unregister(this, 'validities');
57
+ CleanupRegistry.register(this, onoff('slotchange', this.#handleValiditiesSlotchange, this.#slots?.get('validity-options')).on(), 'validities');
58
+ this.#input = this.#shadowRoot.querySelector('[part*=toggle-form-input]') ?? undefined;
59
+ this.#input?.addEventListener('click', () => {
60
+ this.isOn = !this.isOn;
61
+ this.#sendValueToForm(this.#connected);
62
+ });
63
+ CleanupRegistry.register(this, onoff([{ types: 'focusin', listener: this.#handleFocusin }], this).on());
64
+ CleanupRegistry.register(this, onoff([{ types: 'keydown', listener: this.#handleInputKeydown }], this.#input).on());
65
+ // CleanupRegistry.register(this, onoff([{ types: 'input', listener: this.#handleInputInput }], this.#input).on())
66
+ }
67
+ attributeChangedCallback(name, oldValue, newValue) {
68
+ if (devFlags.debug)
69
+ console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
70
+ switch (name) {
71
+ case 'value':
72
+ this.value = String(newValue); // this.#input?.setAttribute('checked', newValue ?? '')
73
+ this.#sendValueToForm(this.#connected);
74
+ break;
75
+ case 'is-on':
76
+ this.isOn = newValue !== null; // this.#input?.setAttribute('checked', newValue ?? '')
77
+ this.#sendValueToForm(this.#connected);
78
+ break;
79
+ case 'required':
80
+ // this.#input?.setAttribute(name, newValue ?? '')
81
+ this.#sendValueToForm(this.#connected);
82
+ break;
83
+ case 'name':
84
+ this.#sendValueToForm(this.#connected);
85
+ break;
86
+ case 'label':
87
+ renderLabel(':scope>label-view[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, newValue);
88
+ break;
89
+ case 'disabled':
90
+ for (const el of this.#shadowRoot.querySelectorAll('input'))
91
+ el.toggleAttribute('disabled', !newValue);
92
+ break;
93
+ }
94
+ }
95
+ disconnectedCallback() {
96
+ super.disconnectedCallback();
97
+ this.#validityObservers.unobserveAll();
98
+ }
99
+ connectedCallback() {
100
+ super.connectedCallback();
101
+ // finally
102
+ // if (this.hasAttribute('value')) this.value = this.getAttribute('value') ?? ''
103
+ if (this.hasAttribute('is-on'))
104
+ this.isOn = this.hasAttribute('is-on');
105
+ this.#sendValueToForm(false);
106
+ this.#connected = true;
107
+ }
108
+ get toggleStyle() {
109
+ return toggleStyles.includes(this.getAttribute('toggle-style') ?? '') ? this.getAttribute('toggle-style') : 'switch';
110
+ }
111
+ get isOn() {
112
+ return this.#isOn;
113
+ }
114
+ set isOn(v) {
115
+ this.#isOn = Boolean(v);
116
+ this.#value = this.#isOn ? (this.getAttribute('value') ?? 'on') : null;
117
+ this.ariaChecked = `${this.#isOn}`;
118
+ }
119
+ #handleValiditiesSlotchange = ({ type, target: slot }) => {
120
+ if (devFlags.debug)
121
+ console.debug(`${_a.name} ⚡️ ${type}`);
122
+ if (!(slot instanceof HTMLSlotElement))
123
+ return;
124
+ const assigned = slot.assignedElements();
125
+ this.#validityObservers.syncObservations(assigned, ['value', 'label']);
126
+ this.#renderValidityMsgs([]);
127
+ };
128
+ #handleFocusin = ({ type, target }) => {
129
+ if (devFlags.debug)
130
+ console.debug(`${_a.name} ⚡️ ${type}`);
131
+ if (target === this)
132
+ this.#input?.focus();
133
+ };
134
+ #sendValueToForm = (dispatchEvent = true) => {
135
+ // input.value has already been updated/synced !!
136
+ if (this.matches(':disabled'))
137
+ return this.setValidity({});
138
+ if (this.hasAttribute('required') && !this.isOn) {
139
+ this.setValidity({ valueMissing: true });
140
+ }
141
+ else {
142
+ this.setValidity({});
143
+ }
144
+ const entries = new FormData();
145
+ if (this.value)
146
+ entries.append(this.name, this.value);
147
+ this.#internals.setFormValue(entries);
148
+ if (dispatchEvent)
149
+ this.dispatchEvent(new CustomEvent('toggle:change', { detail: { value: this.value, isOn: this.isOn }, bubbles: true, composed: true }));
150
+ };
151
+ #handleInputKeydown = (evt) => {
152
+ if (devFlags.debug)
153
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
154
+ this.isOn = !this.isOn;
155
+ this.#sendValueToForm();
156
+ };
157
+ #handleInputInput = (evt) => {
158
+ if (devFlags.debug)
159
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
160
+ this.#sendValueToForm();
161
+ };
162
+ // Optional: form participation properties
163
+ get name() {
164
+ return this.getAttribute('name') ?? this.getAttribute('label') ?? this.querySelector(':scope>[slot=label]')?.textContent ?? '';
165
+ }
166
+ get value() {
167
+ return this.#value;
168
+ }
169
+ set value(v) {
170
+ this.#value = this.isOn ? String(v) : null;
171
+ }
172
+ setValidity = (flags, message, anchor) => {
173
+ // let msg
174
+ // if (message)
175
+ for (const k in flags) {
176
+ const key = k; // ✅ type-safe cast
177
+ if (true !== flags[key])
178
+ continue;
179
+ for (const el of this.#slots?.get('validity-options')?.assignedElements({ flatten: true }) ?? []) {
180
+ if (!el.matches('option'))
181
+ continue;
182
+ const { label, value } = el;
183
+ if (`${kebabCase(key)}` === value) {
184
+ message = label;
185
+ break;
186
+ }
187
+ else if (`${kebabCase(key)}:${message}` === value) {
188
+ message = label;
189
+ break;
190
+ }
191
+ }
192
+ }
193
+ if (!message)
194
+ for (const k in flags) {
195
+ const key = k; // ✅ type-safe cast
196
+ if (true !== flags[key])
197
+ continue;
198
+ message = kebabCase(key);
199
+ break;
200
+ }
201
+ if (devFlags.debug)
202
+ console.debug(`${_a.name} ⚡️ validity-change`);
203
+ return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#input);
204
+ };
205
+ setCustomValidity = (message) => {
206
+ this.#customValidity = message;
207
+ if (this.#customValidity)
208
+ this.#internals.setValidity({ ...this.#internals.validity, customError: true }, message);
209
+ else
210
+ this.#sendValueToForm(false);
211
+ };
212
+ formAssociatedCallback = (form) => {
213
+ this.#sendValueToForm();
214
+ };
215
+ formDisabledCallback = (disabled) => {
216
+ for (const el of this.#shadowRoot.querySelectorAll('input'))
217
+ el.toggleAttribute('disabled', !disabled);
218
+ };
219
+ formResetCallback = () => {
220
+ this.value = '';
221
+ this.#sendValueToForm();
222
+ };
223
+ }
224
+ _a = ToggleView;
@@ -1,11 +1,28 @@
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 { devFlags } from '../internal/utils';
11
+ let ToolBarItemGroup = ToolBarItemGroup_1 = class ToolBarItemGroup extends HTMLElement {
2
12
  constructor() {
3
13
  super();
4
14
  }
5
15
  connectedCallback() {
6
- console.debug(`${ToolBarItemGroup.name} ⚡️ connect`);
16
+ if (devFlags.debug)
17
+ console.debug(`${ToolBarItemGroup_1.name} ⚡️ connect`);
7
18
  }
8
19
  disconnectedCallback() {
9
- console.debug(`${ToolBarItemGroup.name} ⚡️ disconnect`);
20
+ if (devFlags.debug)
21
+ console.debug(`${ToolBarItemGroup_1.name} ⚡️ disconnect`);
22
+ CleanupRegistry.unregister(this);
10
23
  }
11
- }
24
+ };
25
+ ToolBarItemGroup = ToolBarItemGroup_1 = __decorate([
26
+ adaptiveSlot()
27
+ ], ToolBarItemGroup);
28
+ export { ToolBarItemGroup };
@@ -1,5 +1,8 @@
1
1
  export declare class ToolBarItem extends HTMLElement {
2
+ #private;
3
+ static get observedAttributes(): string[];
2
4
  constructor();
3
- connectedCallback(): void;
5
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
4
6
  disconnectedCallback(): void;
7
+ connectedCallback(): void;
5
8
  }
@@ -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 { devFlags, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
11
+ import { Snapshot } from '../snapshot';
12
+ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
13
+ static get observedAttributes() {
14
+ return ['slot', 'data-previous-slot', 'title-key'];
15
+ }
16
+ #mutationObserver;
4
17
  constructor() {
5
18
  super();
6
19
  }
20
+ attributeChangedCallback(name, oldValue, newValue) {
21
+ if (devFlags.debug)
22
+ console.debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
23
+ switch (name) {
24
+ case 'slot':
25
+ case 'data-previous-slot':
26
+ case 'title-key': {
27
+ this.#mutationObserver?.disconnect();
28
+ const role = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '', tKey = this.getAttribute('title-key');
29
+ if (['confirmation-action', 'cancellation-action'].includes(role))
30
+ Snapshot.waitReady.then(() => {
31
+ ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
32
+ this.#mutationObserver = new MutationObserver((mutations) => {
33
+ for (const { target } of mutations)
34
+ if (target instanceof HTMLElement)
35
+ ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
36
+ });
37
+ this.#mutationObserver.observe(this, {
38
+ childList: true,
39
+ });
40
+ });
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ disconnectedCallback() {
46
+ if (devFlags.debug)
47
+ console.debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
48
+ this.#mutationObserver?.disconnect();
49
+ CleanupRegistry.unregister(this);
50
+ }
7
51
  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]'))
52
+ if (devFlags.debug)
53
+ console.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,15 @@
1
+ /**
2
+ * @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
3
+ * @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
4
+ * @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
5
+ * @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
6
+ * @slot top-bar-leading - Places the item in the leading edge of the top bar
7
+ * @slot top-bar-principal - Places the item in the middle of the top bar
8
+ * @slot top-bar-trailing - Places the item in the trailing edge of the top bar
9
+ * @slot bottom-bar-leading - Places the item in the leading edge of the bottom bar
10
+ * @slot bottom-bar-principal - Places the item in the middle of the bottom bar
11
+ * @slot bottom-bar-trailing - Places the item in the trailing edge of the bottom bar
12
+ */
1
13
  export declare class ToolBar extends HTMLElement {
2
14
  #private;
3
15
  static get template(): DocumentFragment;
@@ -1,7 +1,19 @@
1
1
  var _a;
2
2
  import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
3
- import { $ } from '../internal/utils';
3
+ import { $, devFlags } from '../internal/utils';
4
4
  const observers = new ResizeObserverSingleton();
5
+ /**
6
+ * @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
7
+ * @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
8
+ * @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
9
+ * @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
10
+ * @slot top-bar-leading - Places the item in the leading edge of the top bar
11
+ * @slot top-bar-principal - Places the item in the middle of the top bar
12
+ * @slot top-bar-trailing - Places the item in the trailing edge of the top bar
13
+ * @slot bottom-bar-leading - Places the item in the leading edge of the bottom bar
14
+ * @slot bottom-bar-principal - Places the item in the middle of the bottom bar
15
+ * @slot bottom-bar-trailing - Places the item in the trailing edge of the bottom bar
16
+ */
5
17
  export class ToolBar extends HTMLElement {
6
18
  static #template;
7
19
  static get template() {
@@ -9,6 +21,8 @@ export class ToolBar extends HTMLElement {
9
21
  return (this.#template ??= $(String.raw `
10
22
  <div part="root top-bar">
11
23
  <div part="root toolbar-leading-stack">
24
+ <slot name="cancellation-action"></slot>
25
+ <slot name="destructive-action"></slot>
12
26
  <slot name="top-bar-leading"></slot>
13
27
  </div>
14
28
  <div part="root toolbar-principal-stack">
@@ -16,6 +30,8 @@ export class ToolBar extends HTMLElement {
16
30
  </div>
17
31
  <div part="root toolbar-trailing-stack">
18
32
  <slot name="top-bar-trailing"></slot>
33
+ <slot name="primary-action"></slot>
34
+ <slot name="confirmation-action"></slot>
19
35
  </div>
20
36
  </div>
21
37
  <div part="root bottom-bar">
@@ -28,22 +44,20 @@ export class ToolBar extends HTMLElement {
28
44
  <div part="root toolbar-trailing-stack">
29
45
  <slot name="bottom-bar-trailing"></slot>
30
46
  </div>
31
- </div>`, ''));
47
+ </div>`));
32
48
  }
33
49
  #shadowRoot;
34
50
  get #scrollView() {
35
- return this.parentElement?.querySelector(':scope > scroll-view') ?? undefined; //this.previousElementSibling ?? undefined
51
+ return this.parentElement?.querySelector(':scope>scroll-view') ?? undefined; //this.previousElementSibling ?? undefined
36
52
  }
37
53
  constructor() {
38
54
  super();
39
55
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
40
- // NOTE: wait for config
41
- // Snapshot.waitReady.then(() => {
42
56
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
43
- // })
44
57
  }
45
58
  connectedCallback() {
46
- console.debug(`${_a.name} ⚡️ connect`);
59
+ if (devFlags.debug)
60
+ console.debug(`${_a.name} ⚡️ connect`);
47
61
  // NOTE: wait for config
48
62
  // Snapshot.waitReady.then(() => {
49
63
  for (const el of this.#shadowRoot.querySelectorAll(`[part*="toolbar-leading-stack"],[part*="toolbar-trailing-stack"]`))
@@ -51,11 +65,13 @@ export class ToolBar extends HTMLElement {
51
65
  // })
52
66
  }
53
67
  disconnectedCallback() {
54
- console.debug(`${_a.name} ⚡️ disconnect`);
68
+ if (devFlags.debug)
69
+ console.debug(`${_a.name} ⚡️ disconnect`);
55
70
  observers.unobserve(this);
56
71
  }
57
72
  #measureStacks(entry) {
58
- console.debug(`${_a.name} ⚡️ measure`);
73
+ if (devFlags.debug)
74
+ console.debug(`${_a.name} ⚡️ measure`);
59
75
  if (this.closest('[hidden]'))
60
76
  return;
61
77
  const leading = 'toolbar-leading-stack', trailing = 'toolbar-trailing-stack';
@@ -63,7 +79,7 @@ export class ToolBar extends HTMLElement {
63
79
  'top-bar': 'navbar',
64
80
  'bottom-bar': 'toolbar', //'bottombar',
65
81
  };
66
- const { contentRect, target } = entry;
82
+ const { contentRect: { width }, target, } = entry;
67
83
  const parentPart = target.parentElement?.part.contains('top-bar') ? 'top-bar' : target.parentElement?.part.contains('bottom-bar') ? 'bottom-bar' : null;
68
84
  if (!parentPart)
69
85
  return;
@@ -71,7 +87,7 @@ export class ToolBar extends HTMLElement {
71
87
  if (!side)
72
88
  return;
73
89
  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`)
90
+ this.#scrollView?.style?.setProperty(prop, `${Math.round(width)}px`); // $.prop(prop, `${Math.round(width)}px`, this.#scrollView) //
75
91
  }
76
92
  }
77
93
  _a = ToolBar;
@@ -2,7 +2,9 @@
2
2
  * BUG: Safari on IOS reports inaccurate innerHeight (which is what we really want) on orientationchange.
3
3
  * So we live with a pescy body-scrollbar that shows up on resize on desktops.
4
4
  *
5
- * @summary Required component, must be BODY tag
5
+ * @summary Required component, used to handle the virtual keyboard on touch devices.
6
+ *
7
+ * @attr {Inter} system-font - Prefers the "Inter" font family, if loaded.
6
8
  */
7
9
  export declare class VKeyboard extends HTMLElement {
8
10
  #private;
@@ -1,12 +1,14 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, frame, onoff, sleep } from '../internal/utils';
3
+ import { $, devFlags, frame, onoff, sleep } from '../internal/utils';
4
4
  import { Snapshot } from '../snapshot';
5
5
  /**
6
6
  * BUG: Safari on IOS reports inaccurate innerHeight (which is what we really want) on orientationchange.
7
7
  * So we live with a pescy body-scrollbar that shows up on resize on desktops.
8
8
  *
9
- * @summary Required component, must be BODY tag
9
+ * @summary Required component, used to handle the virtual keyboard on touch devices.
10
+ *
11
+ * @attr {Inter} system-font - Prefers the "Inter" font family, if loaded.
10
12
  */
11
13
  export class VKeyboard extends HTMLElement {
12
14
  /**
@@ -20,11 +22,13 @@ export class VKeyboard extends HTMLElement {
20
22
  super();
21
23
  }
22
24
  disconnectedCallback() {
23
- console.debug(`${_a.name} ⚡️ disconnect`);
25
+ if (devFlags.debug)
26
+ console.debug(`${_a.name} ⚡️ disconnect`);
24
27
  CleanupRegistry.unregister(this);
25
28
  }
26
29
  connectedCallback() {
27
- console.debug(`${_a.name} ⚡️ connect`);
30
+ if (devFlags.debug)
31
+ console.debug(`${_a.name} ⚡️ connect`);
28
32
  this.inert = true;
29
33
  CleanupRegistry.register(this, onoff([
30
34
  { types: 'scroll', listener: this.#handleWindowScroll },
@@ -56,13 +60,15 @@ export class VKeyboard extends HTMLElement {
56
60
  self.scrollTo(0, 0);
57
61
  };
58
62
  #handleWindowOrientationchange = async () => {
59
- console.debug(`${_a.name} ⚡️ orientationchange`);
63
+ if (devFlags.debug)
64
+ console.debug(`${_a.name} ⚡️ orientationchange`);
60
65
  if (!(await frame(this)))
61
66
  return; //self.requestAnimationFrame(this.#ifKeyboardScrollIntoActiveElement)
62
67
  this.#ifKeyboardScrollIntoActiveElement();
63
68
  };
64
69
  #handleBodyFocusin = async () => {
65
- console.debug(`${_a.name} ⚡️ focusin`);
70
+ if (devFlags.debug)
71
+ console.debug(`${_a.name} ⚡️ focusin`);
66
72
  await sleep(100); // self.setTimeout(this.#ifKeyboardScrollIntoActiveElement, 100)
67
73
  if (!this.isConnected)
68
74
  return;
@@ -1,3 +1,15 @@
1
+ /**
2
+ * @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution - The distribution of cols
3
+ *
4
+ * @attr {"auto spacer"|"auto auto spacer"|"auto auto auto spacer"} template
5
+ *
6
+ * @attr {@spacingSet} spacing - The gap between the primary axis
7
+ *
8
+ * @attr {@alignmentSet} alignment - The cross-axis alignment
9
+ * @attr {@distributionSet} distribution - The main-axis alignment
10
+ * @attr {@placementSet} placement - The main-axis alignment
11
+ *
12
+ */
1
13
  export declare class VStack extends HTMLElement {
2
14
  constructor();
3
15
  connectedCallback(): void;
@@ -1,11 +1,26 @@
1
+ import { devFlags } from '../internal/utils';
2
+ /**
3
+ * @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution - The distribution of cols
4
+ *
5
+ * @attr {"auto spacer"|"auto auto spacer"|"auto auto auto spacer"} template
6
+ *
7
+ * @attr {@spacingSet} spacing - The gap between the primary axis
8
+ *
9
+ * @attr {@alignmentSet} alignment - The cross-axis alignment
10
+ * @attr {@distributionSet} distribution - The main-axis alignment
11
+ * @attr {@placementSet} placement - The main-axis alignment
12
+ *
13
+ */
1
14
  export class VStack extends HTMLElement {
2
15
  constructor() {
3
16
  super();
4
17
  }
5
18
  connectedCallback() {
6
- console.debug(`${VStack.name} ⚡️ connect`);
19
+ if (devFlags.debug)
20
+ console.debug(`${VStack.name} ⚡️ connect`);
7
21
  }
8
22
  disconnectedCallback() {
9
- console.debug(`${VStack.name} ⚡️ disconnect`);
23
+ if (devFlags.debug)
24
+ console.debug(`${VStack.name} ⚡️ disconnect`);
10
25
  }
11
26
  }