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

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 (301) hide show
  1. package/css-data/en.json +28 -0
  2. package/generated/buses/alert-dialog.d.ts +2 -0
  3. package/generated/buses/alert-dialog.js +1 -0
  4. package/generated/buses/confirmation-dialog.d.ts +2 -0
  5. package/generated/buses/confirmation-dialog.js +1 -0
  6. package/generated/buses/index.d.ts +6 -0
  7. package/generated/buses/index.js +6 -0
  8. package/generated/buses/lifecycle-observer.d.ts +2 -0
  9. package/generated/buses/lifecycle-observer.js +1 -0
  10. package/generated/client/index.d.ts +24 -10
  11. package/generated/client/index.js +179 -194
  12. package/generated/components/alert-dialog.d.ts +11 -0
  13. package/generated/components/alert-dialog.js +94 -0
  14. package/generated/components/body-view.d.ts +8 -0
  15. package/generated/components/body-view.js +6 -2
  16. package/generated/components/bordered-button.d.ts +10 -0
  17. package/generated/components/bordered-button.js +36 -3
  18. package/generated/components/bordered-prominent-button.d.ts +10 -0
  19. package/generated/components/bordered-prominent-button.js +36 -3
  20. package/generated/components/borderless-button.d.ts +9 -1
  21. package/generated/components/borderless-button.js +29 -11
  22. package/generated/components/color-scheme.d.ts +12 -0
  23. package/generated/components/color-scheme.js +51 -0
  24. package/generated/components/confirmation-dialog.d.ts +4 -1
  25. package/generated/components/confirmation-dialog.js +38 -32
  26. package/generated/components/content-unavailable.d.ts +30 -0
  27. package/generated/components/content-unavailable.js +79 -0
  28. package/generated/components/date-picker.d.ts +21 -15
  29. package/generated/components/date-picker.js +126 -88
  30. package/generated/components/detail-placeholder.d.ts +11 -0
  31. package/generated/components/detail-placeholder.js +15 -0
  32. package/generated/components/disclosure-group.d.ts +8 -0
  33. package/generated/components/disclosure-group.js +18 -7
  34. package/generated/components/fine-tooltip.d.ts +15 -0
  35. package/generated/components/fine-tooltip.js +108 -0
  36. package/generated/components/form-view.d.ts +10 -0
  37. package/generated/components/form-view.js +8 -3
  38. package/generated/components/glass-button.d.ts +10 -0
  39. package/generated/components/glass-button.js +36 -3
  40. package/generated/components/glass-prominent-button.d.ts +10 -0
  41. package/generated/components/glass-prominent-button.js +36 -3
  42. package/generated/components/h-divider.d.ts +11 -0
  43. package/generated/components/h-divider.js +15 -0
  44. package/generated/components/h-stack.d.ts +22 -0
  45. package/generated/components/h-stack.js +24 -0
  46. package/generated/components/image-view.d.ts +18 -0
  47. package/generated/components/image-view.js +65 -0
  48. package/generated/components/index.d.ts +15 -3
  49. package/generated/components/index.js +15 -3
  50. package/generated/components/label-view.d.ts +19 -1
  51. package/generated/components/label-view.js +63 -62
  52. package/generated/components/labeled-content.d.ts +33 -0
  53. package/generated/components/labeled-content.js +160 -0
  54. package/generated/components/list-view.d.ts +14 -0
  55. package/generated/components/list-view.js +12 -17
  56. package/generated/components/menu-view.d.ts +12 -1
  57. package/generated/components/menu-view.js +63 -65
  58. package/generated/components/navigation-large-title.d.ts +11 -0
  59. package/generated/components/navigation-large-title.js +11 -5
  60. package/generated/components/navigation-split-view.d.ts +9 -1
  61. package/generated/components/navigation-split-view.js +10 -6
  62. package/generated/components/navigation-stack.d.ts +9 -1
  63. package/generated/components/navigation-stack.js +13 -11
  64. package/generated/components/navigation-title.d.ts +11 -1
  65. package/generated/components/navigation-title.js +58 -55
  66. package/generated/components/picker-view.d.ts +48 -7
  67. package/generated/components/picker-view.js +971 -261
  68. package/generated/components/plain-button.js +3 -3
  69. package/generated/components/progress-view.d.ts +20 -0
  70. package/generated/components/progress-view.js +120 -0
  71. package/generated/components/screen-view.js +2 -1
  72. package/generated/components/scroll-view-proxy.d.ts +13 -0
  73. package/generated/components/scroll-view-proxy.js +15 -0
  74. package/generated/components/scroll-view.d.ts +13 -1
  75. package/generated/components/scroll-view.js +140 -97
  76. package/generated/components/search-view.d.ts +12 -0
  77. package/generated/components/search-view.js +24 -0
  78. package/generated/components/section-view.d.ts +13 -1
  79. package/generated/components/section-view.js +38 -58
  80. package/generated/components/sheet-view.d.ts +4 -2
  81. package/generated/components/sheet-view.js +10 -39
  82. package/generated/components/sidebar-toggle.d.ts +9 -1
  83. package/generated/components/sidebar-toggle.js +46 -69
  84. package/generated/components/sidebar-view.d.ts +3 -0
  85. package/generated/components/sidebar-view.js +16 -9
  86. package/generated/components/sticky-container.d.ts +6 -1
  87. package/generated/components/sticky-container.js +9 -7
  88. package/generated/components/tab-bar.d.ts +3 -0
  89. package/generated/components/tab-bar.js +17 -13
  90. package/generated/components/tab-item.d.ts +3 -0
  91. package/generated/components/tab-item.js +20 -13
  92. package/generated/components/tab-view.d.ts +13 -4
  93. package/generated/components/tab-view.js +25 -89
  94. package/generated/components/table-view.d.ts +19 -0
  95. package/generated/components/table-view.js +88 -107
  96. package/generated/components/text-field.d.ts +19 -6
  97. package/generated/components/text-field.js +127 -99
  98. package/generated/components/text-view.d.ts +11 -0
  99. package/generated/components/text-view.js +16 -0
  100. package/generated/components/toggle-view.d.ts +43 -0
  101. package/generated/components/toggle-view.js +366 -0
  102. package/generated/components/tool-bar-item-group.d.ts +8 -0
  103. package/generated/components/tool-bar-item-group.js +22 -4
  104. package/generated/components/tool-bar-item.d.ts +12 -1
  105. package/generated/components/tool-bar-item.js +57 -10
  106. package/generated/components/tool-bar.d.ts +19 -0
  107. package/generated/components/tool-bar.js +48 -33
  108. package/generated/components/v-divider.d.ts +11 -0
  109. package/generated/components/v-divider.js +15 -0
  110. package/generated/components/v-keyboard.d.ts +8 -1
  111. package/generated/components/v-keyboard.js +11 -9
  112. package/generated/components/v-stack.d.ts +20 -0
  113. package/generated/components/v-stack.js +18 -2
  114. package/generated/css/index.css +4617 -1266
  115. package/generated/events/alert-dialog.d.ts +13 -0
  116. package/generated/events/alert-dialog.js +1 -0
  117. package/generated/events/confirmation-dialog.d.ts +7 -2
  118. package/generated/events/date-picker.d.ts +6 -1
  119. package/generated/events/index.d.ts +2 -0
  120. package/generated/events/index.js +2 -0
  121. package/generated/events/lifecycle-observer.d.ts +10 -2
  122. package/generated/events/picker-view.d.ts +22 -1
  123. package/generated/events/scroll-view.d.ts +10 -2
  124. package/generated/events/tab-view.d.ts +38 -8
  125. package/generated/events/text-field.d.ts +6 -1
  126. package/generated/events/toggle-view.d.ts +14 -0
  127. package/generated/events/toggle-view.js +1 -0
  128. package/generated/i18n/index.d.ts +19 -10
  129. package/generated/i18n/index.js +79 -54
  130. package/generated/i18n/locales/el.d.ts +16 -0
  131. package/generated/i18n/locales/el.js +16 -0
  132. package/generated/i18n/locales/en.d.ts +16 -0
  133. package/generated/i18n/locales/en.js +16 -0
  134. package/generated/i18n/locales/index.d.ts +4 -0
  135. package/generated/i18n/locales/index.js +4 -0
  136. package/generated/internal/class/css-style-observer.js +2 -2
  137. package/generated/internal/class/form-associated-base.d.ts +0 -4
  138. package/generated/internal/class/form-associated-base.js +22 -39
  139. package/generated/internal/class/mutation-observer-set.d.ts +9 -0
  140. package/generated/internal/class/mutation-observer-set.js +42 -0
  141. package/generated/internal/class/mutation-observer-singleton.js +18 -0
  142. package/generated/internal/class/navigation-view.d.ts +1 -1
  143. package/generated/internal/class/navigation-view.js +36 -43
  144. package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
  145. package/generated/internal/decorators/adaptive-slot.js +47 -0
  146. package/generated/internal/decorators/custom-element.d.ts +1 -1
  147. package/generated/internal/decorators/custom-element.js +2 -1
  148. package/generated/internal/decorators/index.d.ts +6 -0
  149. package/generated/internal/decorators/index.js +6 -0
  150. package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
  151. package/generated/internal/decorators/microtask-on-connected.js +67 -0
  152. package/generated/internal/flags.d.ts +4 -0
  153. package/generated/internal/flags.js +1 -0
  154. package/generated/internal/privateNamespace.d.ts +10 -0
  155. package/generated/internal/privateNamespace.js +159 -1
  156. package/generated/internal/utils/$.d.ts +9 -0
  157. package/generated/internal/utils/$.js +11 -0
  158. package/generated/internal/utils/compare-big-decimals.js +7 -17
  159. package/generated/internal/utils/debug.d.ts +1 -0
  160. package/generated/internal/utils/debug.js +4 -0
  161. package/generated/internal/utils/define-translations.d.ts +1 -0
  162. package/generated/internal/utils/define-translations.js +3 -0
  163. package/generated/internal/utils/ensure-placeholder.d.ts +1 -0
  164. package/generated/internal/utils/ensure-placeholder.js +41 -0
  165. package/generated/internal/utils/index.d.ts +39 -2
  166. package/generated/internal/utils/index.js +39 -3
  167. package/generated/internal/utils/is-inside.d.ts +1 -0
  168. package/generated/internal/utils/is-inside.js +4 -0
  169. package/generated/internal/utils/kebab-case.js +6 -9
  170. package/generated/internal/utils/list-active.js +67 -12
  171. package/generated/internal/utils/touch-glass.js +5 -5
  172. package/generated/internal/vendor/morphdom.d.ts +6 -0
  173. package/generated/internal/vendor/morphdom.js +720 -0
  174. package/generated/morphdom/index.d.ts +8 -0
  175. package/generated/morphdom/index.js +8 -0
  176. package/generated/morphdom/morph.d.ts +4 -0
  177. package/generated/morphdom/morph.js +10 -0
  178. package/generated/morphdom/query-morph.d.ts +5 -0
  179. package/generated/morphdom/query-morph.js +12 -0
  180. package/generated/morphdom/render-to-string.d.ts +12 -0
  181. package/generated/morphdom/render-to-string.js +48 -0
  182. package/generated/morphdom/unsafe-html.d.ts +2 -0
  183. package/generated/morphdom/unsafe-html.js +4 -0
  184. package/generated/namespace-browser/base.d.ts +12 -3
  185. package/generated/namespace-browser/base.js +41 -18
  186. package/generated/namespace-browser/event.d.ts +10 -0
  187. package/generated/namespace-browser/event.js +1 -0
  188. package/generated/snapshot/index.d.ts +3 -1
  189. package/generated/snapshot/index.js +23 -2
  190. package/generated/tpl/html.d.ts +5 -0
  191. package/generated/tpl/html.js +7 -0
  192. package/generated/tpl/index.d.ts +6 -0
  193. package/generated/tpl/index.js +6 -0
  194. package/generated/tpl/is-template-result.d.ts +3 -0
  195. package/generated/tpl/is-template-result.js +1 -0
  196. package/generated/tpl/render.d.ts +2 -0
  197. package/generated/tpl/render.js +132 -0
  198. package/html-data/en.json +2620 -0
  199. package/package.json +32 -7
  200. package/scss/_components.scss +15 -0
  201. package/scss/_functions.scss +10 -0
  202. package/scss/_maps.scss +293 -0
  203. package/scss/_mixins.scss +4 -0
  204. package/scss/_transitions.scss +6 -1
  205. package/scss/_utils.scss +2 -0
  206. package/scss/_vars.scss +9 -115
  207. package/scss/base/_layout.scss +17 -7
  208. package/scss/base/_reboot.scss +34 -1
  209. package/scss/base/_root.scss +143 -124
  210. package/scss/colors/_index.scss +328 -88
  211. package/scss/components/_alert-dialog.scss +111 -0
  212. package/scss/components/_bordered-button.scss +37 -0
  213. package/scss/components/_bordered-prominent-button.scss +46 -0
  214. package/scss/components/_borderless-button.scss +26 -0
  215. package/scss/components/_confirmation-dialog.scss +41 -49
  216. package/scss/components/_content-unavailable.scss +57 -0
  217. package/scss/components/_date-picker.scss +15 -15
  218. package/scss/components/_detail-placeholder.scss +1 -3
  219. package/scss/components/_disclosure-group.scss +85 -34
  220. package/scss/components/_fine-tooltip.scss +84 -0
  221. package/scss/components/_form-view.scss +63 -24
  222. package/scss/components/_glass-button.scss +37 -0
  223. package/scss/components/_glass-prominent-button.scss +47 -0
  224. package/scss/components/_group-box.scss +27 -0
  225. package/scss/components/_h-flex-stack.scss +23 -0
  226. package/scss/components/_h-stack.scss +6 -17
  227. package/scss/components/_image-view.scss +20 -0
  228. package/scss/components/_index.scss +69 -36
  229. package/scss/components/_label-view copy.scss.txt +420 -0
  230. package/scss/components/_label-view.scss +105 -120
  231. package/scss/components/_label-view.scss.txt +536 -0
  232. package/scss/components/_labeled-content.scss +67 -1
  233. package/scss/components/_list-view.scss +70 -29
  234. package/scss/components/_menu-view.scss +96 -61
  235. package/scss/components/_navigation-large-title.scss +23 -0
  236. package/scss/components/_navigation-split-view.scss +3 -3
  237. package/scss/components/_navigation-title.scss +1 -1
  238. package/scss/components/_picker-view.scss +270 -63
  239. package/scss/components/_plain-button.scss +8 -0
  240. package/scss/components/_progress-view.scss +98 -0
  241. package/scss/components/_scroll-view-proxy.scss +24 -22
  242. package/scss/components/_scroll-view-toolbars.scss +8 -2
  243. package/scss/components/_scroll-view.scss +16 -0
  244. package/scss/components/_search-view.scss +23 -0
  245. package/scss/components/_section-view.scss +23 -22
  246. package/scss/components/_sheet-view.scss +16 -6
  247. package/scss/components/_sidebar-toggle.scss +1 -4
  248. package/scss/components/_sticky-container.scss +1 -1
  249. package/scss/components/_tab-bar.scss +17 -3
  250. package/scss/components/_tab-view.scss +12 -2
  251. package/scss/components/_table-column.scss +4 -2
  252. package/scss/components/_table-row.scss +71 -3
  253. package/scss/components/_table-view.scss +27 -18
  254. package/scss/components/_text-field.scss +37 -17
  255. package/scss/components/_text-view.scss +57 -0
  256. package/scss/components/_toggle-view.scss +171 -0
  257. package/scss/components/_tool-bar-item.scss +34 -82
  258. package/scss/components/_tool-bar.scss +77 -57
  259. package/scss/components/_v-stack.scss +8 -2
  260. package/scss/final/_touch-glass.scss +31 -0
  261. package/scss/mixins/_button.scss +44 -0
  262. package/scss/mixins/_color.scss +16 -0
  263. package/scss/mixins/_dialog.scss +1 -0
  264. package/scss/mixins/_index.scss +73 -5
  265. package/scss/placeholders/_buttons.scss +46 -11
  266. package/scss/placeholders/_lists.scss +159 -126
  267. package/scss/transitions/_alert-dialog.scss +18 -0
  268. package/scss/transitions/_confirmation-dialog.scss +8 -0
  269. package/scss/transitions/_fine-tooltip.scss +21 -0
  270. package/scss/transitions/_menu-view.scss +17 -15
  271. package/scss/transitions/_progress-view.scss +23 -0
  272. package/scss/transitions/_sheet-view.scss +30 -0
  273. package/scss/transitions/_tab-bar.scss +6 -5
  274. package/scss/utils/_background.scss +52 -0
  275. package/scss/utils/_frame.scss +59 -40
  276. package/scss/utils/_index.scss +45 -56
  277. package/scss/utils/_scroll-view.scss +1 -1
  278. package/scss/utils/_spacing.scss +1 -1
  279. package/scss/utils/_stacks.scss +34 -164
  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/web-components.html-data/en.json +0 -330
  288. /package/generated/internal/utils/{cash/ancestors.d.ts → ancestors.d.ts} +0 -0
  289. /package/generated/internal/utils/{cash/ancestors.js → ancestors.js} +0 -0
  290. /package/generated/internal/utils/{cash/next-all.d.ts → next-all.d.ts} +0 -0
  291. /package/generated/internal/utils/{cash/next-all.js → next-all.js} +0 -0
  292. /package/generated/internal/utils/{cash/next.d.ts → next.d.ts} +0 -0
  293. /package/generated/internal/utils/{cash/next.js → next.js} +0 -0
  294. /package/generated/internal/utils/{cash/prev-all.d.ts → prev-all.d.ts} +0 -0
  295. /package/generated/internal/utils/{cash/prev-all.js → prev-all.js} +0 -0
  296. /package/generated/internal/utils/{cash/prev.d.ts → prev.d.ts} +0 -0
  297. /package/generated/internal/utils/{cash/prev.js → prev.js} +0 -0
  298. /package/generated/internal/utils/{cash/prop.d.ts → prop.d.ts} +0 -0
  299. /package/generated/internal/utils/{cash/prop.js → prop.js} +0 -0
  300. /package/generated/internal/utils/{cash/siblings.d.ts → siblings.d.ts} +0 -0
  301. /package/generated/internal/utils/{cash/siblings.js → siblings.js} +0 -0
@@ -0,0 +1,94 @@
1
+ import { alertDialog } from '../buses';
2
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
+ import { debug, onoff, touchGlass } from '../internal/utils';
4
+ import { DialogBase } from '../namespace-browser/base';
5
+ /**
6
+ * @summary A dialog that shows a message. Use it from the client module like `void alert('Save failed.')`.
7
+ */
8
+ export class AlertDialog extends DialogBase {
9
+ constructor() {
10
+ super();
11
+ }
12
+ static polyfillDisconnectedCallback(el) {
13
+ debug(`${AlertDialog.name} ⚡️ disconnect`);
14
+ CleanupRegistry.unregister(el);
15
+ alertDialog.dispatchEvent(new CustomEvent('alert:return', {
16
+ detail: { returnValue: el.returnValue },
17
+ bubbles: true,
18
+ composed: true,
19
+ }));
20
+ }
21
+ static polyfillConnectedCallback(el) {
22
+ debug(`${AlertDialog.name} ⚡️ connect`);
23
+ CleanupRegistry.register(el, onoff([
24
+ { types: 'click', listener: this.#handleDialogClick },
25
+ { types: 'close', listener: this.#handleDialogClose },
26
+ { types: 'cancel', listener: this.#handleDialogCancel },
27
+ ], el).on());
28
+ CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
29
+ if (!(target instanceof HTMLElement))
30
+ return true;
31
+ if (target.matches('[is=alert-dialog]'))
32
+ return false;
33
+ return true;
34
+ }), el).on());
35
+ debug(`${AlertDialog.name} ⚡️ will-open`);
36
+ el.removeAttribute('closing');
37
+ el.scrollTop = 0;
38
+ el.returnValue = '';
39
+ el.autofocus = true;
40
+ el.showModal();
41
+ }
42
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
43
+ debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
44
+ switch (attributeName) {
45
+ case 'label':
46
+ //
47
+ break;
48
+ }
49
+ }
50
+ static #handleDialogClick = (evt) => {
51
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
52
+ const { target, currentTarget: dialog } = evt;
53
+ if (!(dialog instanceof HTMLDialogElement))
54
+ return;
55
+ if (!(target instanceof HTMLElement))
56
+ return;
57
+ const button = target.closest('button');
58
+ if (!button)
59
+ return;
60
+ button.scrollIntoView({
61
+ behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
62
+ block: 'nearest',
63
+ inline: 'nearest',
64
+ });
65
+ dialog.returnValue = button.value;
66
+ dialog.requestClose(button.value);
67
+ evt.stopPropagation();
68
+ evt.stopImmediatePropagation();
69
+ };
70
+ static #handleDialogCancel = (evt) => {
71
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
72
+ if (!evt.cancelable)
73
+ return;
74
+ const { target } = evt;
75
+ if (!(target instanceof HTMLDialogElement))
76
+ return;
77
+ evt.preventDefault();
78
+ target.inert = true;
79
+ debug(`${AlertDialog.name} ⚡️ will-close`);
80
+ target.setAttribute('closing', '');
81
+ Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
82
+ if (!target.hasAttribute('closing'))
83
+ return;
84
+ target?.close(target?.returnValue);
85
+ target.removeAttribute('closing');
86
+ });
87
+ };
88
+ static #handleDialogClose = ({ type, target }) => {
89
+ debug(`${AlertDialog.name} ⚡️ ${type}`);
90
+ if (!(target instanceof HTMLDialogElement))
91
+ return;
92
+ target.remove();
93
+ };
94
+ }
@@ -1,5 +1,13 @@
1
+ /**
2
+ * @summary A container view that wraps a scroll view, marking it as a screen your app can navigate to.
3
+ */
1
4
  export declare class BodyView extends HTMLElement {
2
5
  constructor();
3
6
  disconnectedCallback(): void;
4
7
  connectedCallback(): void;
5
8
  }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'body-view': BodyView;
12
+ }
13
+ }
@@ -1,11 +1,15 @@
1
+ import { debug } from '../internal/utils';
2
+ /**
3
+ * @summary A container view that wraps a scroll view, marking it as a screen your app can navigate to.
4
+ */
1
5
  export class BodyView extends HTMLElement {
2
6
  constructor() {
3
7
  super();
4
8
  }
5
9
  disconnectedCallback() {
6
- console.debug(`${BodyView.name} ⚡️ disconnect`);
10
+ debug(`${BodyView.name} ⚡️ disconnect`);
7
11
  }
8
12
  connectedCallback() {
9
- console.debug(`${BodyView.name} ⚡️ connect`);
13
+ debug(`${BodyView.name} ⚡️ connect`);
10
14
  }
11
15
  }
@@ -1,7 +1,17 @@
1
1
  import { ButtonBase } from '../namespace-browser/base';
2
+ /**
3
+ * @summary A control that starts an action. Styled with a standard border, adapting to the button’s surroundings.
4
+ *
5
+ * @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a bordered button
6
+ *
7
+ * @slot overlay
8
+ *
9
+ */
2
10
  export declare class BorderedButton extends ButtonBase {
3
11
  #private;
12
+ static get observedAttributes(): string[];
4
13
  constructor();
5
14
  static polyfillDisconnectedCallback(el: BorderedButton): void;
6
15
  static polyfillConnectedCallback(el: BorderedButton): void;
16
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
7
17
  }
@@ -1,19 +1,52 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
+ import { Snapshot } from '../snapshot';
5
+ /**
6
+ * @summary A control that starts an action. Styled with a standard border, adapting to the button’s surroundings.
7
+ *
8
+ * @example <button is="bordered-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a bordered button
9
+ *
10
+ * @slot overlay
11
+ *
12
+ */
4
13
  export class BorderedButton extends ButtonBase {
14
+ static get observedAttributes() {
15
+ return [
16
+ /**
17
+ * A value that describes the purpose of a button
18
+ * @type {destructive|confirm}
19
+ */
20
+ 'role',
21
+ 'title-key',
22
+ ];
23
+ }
5
24
  constructor() {
6
25
  super();
7
26
  }
8
27
  static polyfillDisconnectedCallback(el) {
9
- console.debug(`${BorderedButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderedButton.name} ⚡️ disconnect`);
10
29
  CleanupRegistry.unregister(el);
11
30
  }
12
31
  static polyfillConnectedCallback(el) {
13
- console.debug(`${BorderedButton.name} ⚡️ connect`);
32
+ debug(`${BorderedButton.name} ⚡️ connect`);
14
33
  el.tabIndex = 0;
15
34
  CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
16
35
  }
36
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
37
+ debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
38
+ const node = target instanceof HTMLButtonElement;
39
+ if (!node)
40
+ return;
41
+ switch (attributeName) {
42
+ case 'title-key':
43
+ case 'role':
44
+ Snapshot.waitReady.then(() => {
45
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
46
+ });
47
+ break;
48
+ }
49
+ }
17
50
  static #handleClick = async (evt) => {
18
51
  //
19
52
  };
@@ -1,7 +1,17 @@
1
1
  import { ButtonBase } from '../namespace-browser/base';
2
+ /**
3
+ * @summary A control that starts an action. Styled with a prominent border, adapting to the button’s surroundings.
4
+ *
5
+ * @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a prominent bordered button
6
+ *
7
+ * @slot overlay
8
+ *
9
+ */
2
10
  export declare class BorderedProminentButton extends ButtonBase {
3
11
  #private;
12
+ static get observedAttributes(): string[];
4
13
  constructor();
5
14
  static polyfillDisconnectedCallback(el: BorderedProminentButton): void;
6
15
  static polyfillConnectedCallback(el: BorderedProminentButton): void;
16
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
7
17
  }
@@ -1,19 +1,52 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
+ import { Snapshot } from '../snapshot';
5
+ /**
6
+ * @summary A control that starts an action. Styled with a prominent border, adapting to the button’s surroundings.
7
+ *
8
+ * @example <button is="bordered-prominent-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Creating a prominent bordered button
9
+ *
10
+ * @slot overlay
11
+ *
12
+ */
4
13
  export class BorderedProminentButton extends ButtonBase {
14
+ static get observedAttributes() {
15
+ return [
16
+ /**
17
+ * A value that describes the purpose of a button
18
+ * @type {destructive|confirm}
19
+ */
20
+ 'role',
21
+ 'title-key',
22
+ ];
23
+ }
5
24
  constructor() {
6
25
  super();
7
26
  }
8
27
  static polyfillDisconnectedCallback(el) {
9
- console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
10
29
  CleanupRegistry.unregister(el);
11
30
  }
12
31
  static polyfillConnectedCallback(el) {
13
- console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
32
+ debug(`${BorderedProminentButton.name} ⚡️ connect`);
14
33
  el.tabIndex = 0;
15
34
  CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
16
35
  }
36
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
37
+ debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
38
+ const node = target instanceof HTMLButtonElement;
39
+ if (!node)
40
+ return;
41
+ switch (attributeName) {
42
+ case 'title-key':
43
+ case 'role':
44
+ Snapshot.waitReady.then(() => {
45
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
46
+ });
47
+ break;
48
+ }
49
+ }
17
50
  static #handleClick = async (evt) => {
18
51
  //
19
52
  };
@@ -1,9 +1,17 @@
1
1
  import { ButtonBase } from '../namespace-browser/base';
2
+ /**
3
+ * @summary A control that starts an action. Styled without any borders.
4
+ *
5
+ * @example <button is="borderless-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Use the `is` attribute to style a `button` as a `borderless-button`
6
+ *
7
+ * @slot overlay
8
+ *
9
+ */
2
10
  export declare class BorderlessButton extends ButtonBase {
3
11
  #private;
4
12
  static get observedAttributes(): string[];
5
13
  constructor();
6
14
  static polyfillDisconnectedCallback(el: BorderlessButton): void;
7
15
  static polyfillConnectedCallback(el: BorderlessButton): void;
8
- static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): Promise<void>;
16
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
9
17
  }
@@ -1,31 +1,49 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
+ import { Snapshot } from '../snapshot';
5
+ /**
6
+ * @summary A control that starts an action. Styled without any borders.
7
+ *
8
+ * @example <button is="borderless-button"><label-view system-image="hand-tap" title="Tap Me"></label-view></button> — Use the `is` attribute to style a `button` as a `borderless-button`
9
+ *
10
+ * @slot overlay
11
+ *
12
+ */
4
13
  export class BorderlessButton extends ButtonBase {
5
14
  static get observedAttributes() {
6
- return ['role'];
15
+ return [
16
+ /**
17
+ * A value that describes the purpose of a button
18
+ * @type {destructive|confirm}
19
+ */
20
+ 'role',
21
+ 'title-key',
22
+ ];
7
23
  }
8
24
  constructor() {
9
25
  super();
10
26
  }
11
27
  static polyfillDisconnectedCallback(el) {
12
- console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderlessButton.name} ⚡️ disconnect`);
13
29
  CleanupRegistry.unregister(el);
14
30
  }
15
31
  static polyfillConnectedCallback(el) {
16
- console.debug(`${BorderlessButton.name} ⚡️ connect`);
32
+ debug(`${BorderlessButton.name} ⚡️ connect`);
17
33
  el.tabIndex = 0;
18
34
  CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
19
35
  }
20
- static async polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
21
- console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
36
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
37
+ debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
38
+ const node = target instanceof HTMLButtonElement;
39
+ if (!node)
40
+ return;
22
41
  switch (attributeName) {
42
+ case 'title-key':
23
43
  case 'role':
24
- // let label = this.querySelector(':scope>[slot=label]')
25
- // if (newValue) {
26
- // label ??= this.appendChild($(`<label-view slot="label"></label-view>`))
27
- // label.setAttribute('title', newValue)
28
- // } else label?.remove()
44
+ Snapshot.waitReady.then(() => {
45
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
46
+ });
29
47
  break;
30
48
  }
31
49
  }
@@ -0,0 +1,12 @@
1
+ export declare class ColorScheme extends HTMLElement {
2
+ static get observedAttributes(): string[];
3
+ constructor();
4
+ connectedCallback(): void;
5
+ disconnectedCallback(): void;
6
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'color-scheme': ColorScheme;
11
+ }
12
+ }
@@ -0,0 +1,51 @@
1
+ import { debug } from '../internal/utils';
2
+ export class ColorScheme extends HTMLElement {
3
+ static get observedAttributes() {
4
+ return ['dark'];
5
+ }
6
+ constructor() {
7
+ super();
8
+ }
9
+ connectedCallback() {
10
+ debug(`${ColorScheme.name} ⚡️ connect`);
11
+ this.hidden = true;
12
+ this.inert = true;
13
+ }
14
+ disconnectedCallback() {
15
+ debug(`${ColorScheme.name} ⚡️ disconnect`);
16
+ }
17
+ attributeChangedCallback(name, oldValue, newValue) {
18
+ debug(`${ColorScheme.name} ⚡️ attr-change [${name}]`);
19
+ // self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
20
+ if (newValue)
21
+ self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
22
+ // @property --canvas {
23
+ // syntax: "<color>";
24
+ // initial-value: oklch(100% 0 0deg);
25
+ // inherits: false;
26
+ // }
27
+ // @media (prefers-color-scheme: dark) {
28
+ // @property --canvas {
29
+ // syntax: "<color>";
30
+ // initial-value: oklch(0% 0 0deg);
31
+ // inherits: false;
32
+ // }
33
+ // }
34
+ // @property --canvastext {
35
+ // syntax: "<color>";
36
+ // initial-value: oklch(0% 0 0deg);
37
+ // inherits: false;
38
+ // }
39
+ // @media (prefers-color-scheme: dark) {
40
+ // @property --canvastext {
41
+ // syntax: "<color>";
42
+ // initial-value: oklch(100% 0 0deg);
43
+ // inherits: false;
44
+ // }
45
+ // }
46
+ // if (CSS.supports('interpolate-size', 'allow-keywords')) {
47
+ // self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
48
+ if (null !== newValue)
49
+ self.CSS.registerProperty({ name: '--background', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
50
+ }
51
+ }
@@ -1,9 +1,12 @@
1
1
  import { DialogBase } from '../namespace-browser/base';
2
+ /**
3
+ * @summary A dialog that asks the user to confirm an action. Use it from the client module like `await confirmationDialog(trigger, 'Permanently erase the items in the Trash?')`.
4
+ */
2
5
  export declare class ConfirmationDialog extends DialogBase {
3
6
  #private;
4
7
  static get observedAttributes(): string[];
5
8
  constructor();
6
9
  static polyfillDisconnectedCallback(el: ConfirmationDialog): void;
7
10
  static polyfillConnectedCallback(el: ConfirmationDialog): void;
8
- static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): Promise<void>;
11
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
9
12
  }
@@ -1,7 +1,10 @@
1
- import { ConfirmationDialog as EvtBus } from '../confirmation-dialog';
1
+ import { confirmationDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, onoff, touchGlass } from '../internal/utils';
3
+ import { debug, isInside, onoff, touchGlass } from '../internal/utils';
4
4
  import { DialogBase } from '../namespace-browser/base';
5
+ /**
6
+ * @summary A dialog that asks the user to confirm an action. Use it from the client module like `await confirmationDialog(trigger, 'Permanently erase the items in the Trash?')`.
7
+ */
5
8
  export class ConfirmationDialog extends DialogBase {
6
9
  static get observedAttributes() {
7
10
  return ['anchor'];
@@ -10,38 +13,41 @@ export class ConfirmationDialog extends DialogBase {
10
13
  super();
11
14
  }
12
15
  static polyfillDisconnectedCallback(el) {
13
- console.debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
16
+ debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
14
17
  const positionAnchor = el.style.getPropertyValue('position-anchor');
15
- $.prop('anchor-name', null, document.querySelector(`[style*="${positionAnchor}"]`));
16
- $.prop('position-anchor', null, el);
18
+ document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
19
+ el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
17
20
  CleanupRegistry.unregister(el);
18
- EvtBus.dispatchEvent(new CustomEvent('return', {
21
+ confirmationDialog.dispatchEvent(new CustomEvent('confirmation:return', {
19
22
  detail: { returnValue: el.returnValue, positionAnchor },
20
23
  bubbles: true,
21
24
  composed: true,
22
25
  }));
23
26
  }
24
27
  static polyfillConnectedCallback(el) {
25
- console.debug(`${ConfirmationDialog.name} ⚡️ connect`);
28
+ debug(`${ConfirmationDialog.name} ⚡️ connect`);
26
29
  CleanupRegistry.register(el, onoff([
27
30
  { types: 'click', listener: this.#handleDialogClick },
28
31
  { types: 'close', listener: this.#handleDialogClose },
29
32
  { types: 'cancel', listener: this.#handleDialogCancel },
30
33
  ], el).on());
31
- CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
32
- if (evt.target.matches('[is=confirmation-dialog]'))
34
+ CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
35
+ if (!(target instanceof HTMLElement))
36
+ return true;
37
+ if (target.matches('[is=confirmation-dialog]'))
33
38
  return false;
34
39
  // if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
35
40
  return true;
36
41
  }), el).on());
37
- console.debug(`${ConfirmationDialog.name} ⚡️ will-open`);
42
+ debug(`${ConfirmationDialog.name} ⚡️ will-open`);
38
43
  el.removeAttribute('closing');
39
44
  el.scrollTop = 0;
40
45
  el.returnValue = '';
46
+ el.autofocus = true;
41
47
  el.showModal();
42
48
  }
43
- static async polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
44
- console.debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
49
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
50
+ debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
45
51
  // const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
46
52
  switch (attributeName) {
47
53
  case 'label':
@@ -54,16 +60,15 @@ export class ConfirmationDialog extends DialogBase {
54
60
  }
55
61
  }
56
62
  static #handleDialogClick = (evt) => {
57
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
58
- const dialog = evt.currentTarget;
59
- if (!dialog)
63
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
64
+ const { target, currentTarget: dialog } = evt;
65
+ if (!(dialog instanceof HTMLDialogElement))
60
66
  return;
61
- const target = evt.target;
62
- const rect = dialog.getBoundingClientRect();
63
- const isInside = evt.clientX >= rect.left && evt.clientX <= rect.right && evt.clientY >= rect.top && evt.clientY <= rect.bottom;
64
- if (target?.matches('dialog') && !isInside)
65
- return dialog?.requestClose(); // click outside
66
- const button = target?.closest('button');
67
+ if (!(target instanceof HTMLElement))
68
+ return;
69
+ if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
70
+ return dialog.requestClose(); // click outside
71
+ const button = target.closest('button');
67
72
  if (!button)
68
73
  return;
69
74
  button.scrollIntoView({
@@ -72,20 +77,20 @@ export class ConfirmationDialog extends DialogBase {
72
77
  inline: 'nearest',
73
78
  });
74
79
  dialog.returnValue = button.value;
75
- dialog?.requestClose(button.value);
76
- evt?.stopPropagation();
77
- evt?.stopImmediatePropagation();
80
+ dialog.requestClose(button.value);
81
+ evt.stopPropagation();
82
+ evt.stopImmediatePropagation();
78
83
  };
79
84
  static #handleDialogCancel = (evt) => {
80
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
85
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
81
86
  if (!evt.cancelable)
82
87
  return;
83
- const target = evt.target;
84
- if (!target)
88
+ const { target } = evt;
89
+ if (!(target instanceof HTMLDialogElement))
85
90
  return;
86
91
  evt.preventDefault();
87
92
  target.inert = true;
88
- console.debug(`${ConfirmationDialog.name} ⚡️ will-close`);
93
+ debug(`${ConfirmationDialog.name} ⚡️ will-close`);
89
94
  target.setAttribute('closing', '');
90
95
  Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
91
96
  if (!target.hasAttribute('closing'))
@@ -94,9 +99,10 @@ export class ConfirmationDialog extends DialogBase {
94
99
  target.removeAttribute('closing');
95
100
  });
96
101
  };
97
- static #handleDialogClose = (evt) => {
98
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
99
- const target = evt.target;
100
- target?.remove();
102
+ static #handleDialogClose = ({ type, target }) => {
103
+ debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
104
+ if (!(target instanceof HTMLDialogElement))
105
+ return;
106
+ target.remove();
101
107
  };
102
108
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @summary A message with a title and extra information that you show when part of your app can’t be used.
3
+ *
4
+ * @example <content-unavailable search></content-unavailable>
5
+ *
6
+ * @example <content-unavailable search="foo"></content-unavailable>
7
+ *
8
+ * @example <content-unavailable padding><label-view title="No Mail"><i class="ph ph-tray" slot="icon" foreground="secondary"></i></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
9
+ *
10
+ * @example <content-unavailable padding><label-view title="No Mail"><svg slot="icon" foreground="secondary" ...>...</svg></label-view><label-view title="New mails you receive will appear here." foreground="secondary" slot="description"></label-view><button is="borderless-button" type="button" tabindex="0" slot="actions"><label-view title="Switch Account"></label-view></button></content-unavailable>
11
+ *
12
+ * @slot — The default slot.
13
+ * @slot description
14
+ * @slot actions
15
+ *
16
+ */
17
+ export declare class ContentUnavailable extends HTMLElement {
18
+ #private;
19
+ static get observedAttributes(): string[];
20
+ static get template(): DocumentFragment;
21
+ constructor();
22
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
23
+ disconnectedCallback(): void;
24
+ connectedCallback(): void;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ 'content-unavailable': ContentUnavailable;
29
+ }
30
+ }