@swiftwc/ui 0.0.0-dev.3 → 0.0.0-dev.31

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 (302) hide show
  1. package/README.md +15 -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 +31 -2
  11. package/generated/client/index.js +415 -8
  12. package/generated/components/alert-dialog.d.ts +8 -0
  13. package/generated/components/alert-dialog.js +94 -0
  14. package/generated/components/body-view.d.ts +5 -0
  15. package/generated/components/body-view.js +11 -0
  16. package/generated/components/bordered-button.d.ts +13 -0
  17. package/generated/components/bordered-button.js +42 -0
  18. package/generated/components/bordered-prominent-button.d.ts +13 -0
  19. package/generated/components/bordered-prominent-button.js +42 -0
  20. package/generated/components/borderless-button.d.ts +13 -0
  21. package/generated/components/borderless-button.js +42 -0
  22. package/generated/components/confirmation-dialog.d.ts +9 -0
  23. package/generated/components/confirmation-dialog.js +108 -0
  24. package/generated/components/content-unavailable-view.d.ts +24 -0
  25. package/generated/components/content-unavailable-view.js +78 -0
  26. package/generated/components/date-picker.d.ts +46 -0
  27. package/generated/components/date-picker.js +442 -0
  28. package/generated/components/disclosure-group.d.ts +9 -0
  29. package/generated/components/disclosure-group.js +54 -0
  30. package/generated/components/fine-tooltip.d.ts +7 -0
  31. package/generated/components/fine-tooltip.js +104 -0
  32. package/generated/components/form-view.d.ts +6 -0
  33. package/generated/components/form-view.js +58 -0
  34. package/generated/components/glass-button.d.ts +12 -0
  35. package/generated/components/glass-button.js +39 -0
  36. package/generated/components/glass-prominent-button.d.ts +12 -0
  37. package/generated/components/glass-prominent-button.js +39 -0
  38. package/generated/components/index.d.ts +41 -1
  39. package/generated/components/index.js +41 -6
  40. package/generated/components/label-view.d.ts +9 -0
  41. package/generated/components/label-view.js +56 -0
  42. package/generated/components/list-view.d.ts +5 -0
  43. package/generated/components/list-view.js +29 -0
  44. package/generated/components/menu-view.d.ts +9 -0
  45. package/generated/components/menu-view.js +138 -0
  46. package/generated/components/navigation-large-title.d.ts +6 -0
  47. package/generated/components/navigation-large-title.js +177 -0
  48. package/generated/components/navigation-split-view.d.ts +10 -0
  49. package/generated/components/navigation-split-view.js +21 -0
  50. package/generated/components/navigation-stack.d.ts +10 -0
  51. package/generated/components/navigation-stack.js +27 -0
  52. package/generated/components/navigation-title.d.ts +8 -0
  53. package/generated/components/navigation-title.js +49 -0
  54. package/generated/components/picker-view.d.ts +27 -0
  55. package/generated/components/picker-view.js +452 -0
  56. package/generated/components/plain-button.d.ts +7 -0
  57. package/generated/components/plain-button.js +20 -0
  58. package/generated/components/progress-view.d.ts +13 -0
  59. package/generated/components/progress-view.js +122 -0
  60. package/generated/components/screen-view.d.ts +5 -0
  61. package/generated/components/screen-view.js +9 -0
  62. package/generated/components/scroll-view-proxy.d.ts +8 -0
  63. package/generated/components/scroll-view-proxy.js +14 -0
  64. package/generated/components/scroll-view.d.ts +10 -0
  65. package/generated/components/scroll-view.js +197 -0
  66. package/generated/components/section-view.d.ts +9 -0
  67. package/generated/components/section-view.js +81 -0
  68. package/generated/components/sheet-view.d.ts +8 -0
  69. package/generated/components/sheet-view.js +85 -0
  70. package/generated/components/sidebar-toggle.d.ts +7 -0
  71. package/generated/components/sidebar-toggle.js +82 -0
  72. package/generated/components/sidebar-view.d.ts +7 -0
  73. package/generated/components/sidebar-view.js +35 -0
  74. package/generated/components/sticky-container.d.ts +6 -0
  75. package/generated/components/sticky-container.js +24 -0
  76. package/generated/components/tab-bar.d.ts +10 -0
  77. package/generated/components/tab-bar.js +42 -0
  78. package/generated/components/tab-item.d.ts +7 -0
  79. package/generated/components/tab-item.js +125 -0
  80. package/generated/components/tab-view.d.ts +22 -0
  81. package/generated/components/tab-view.js +259 -0
  82. package/generated/components/table-view.d.ts +7 -0
  83. package/generated/components/table-view.js +187 -0
  84. package/generated/components/text-field.d.ts +29 -0
  85. package/generated/components/text-field.js +478 -0
  86. package/generated/components/tool-bar-item-group.d.ts +5 -0
  87. package/generated/components/tool-bar-item-group.js +28 -0
  88. package/generated/components/tool-bar-item.d.ts +7 -0
  89. package/generated/components/tool-bar-item.js +53 -0
  90. package/generated/components/tool-bar.d.ts +19 -0
  91. package/generated/components/tool-bar.js +90 -0
  92. package/generated/components/v-keyboard.d.ts +11 -0
  93. package/generated/components/v-keyboard.js +81 -0
  94. package/generated/components/v-stack.d.ts +10 -0
  95. package/generated/components/v-stack.js +16 -0
  96. package/generated/css/index.css +8067 -0
  97. package/generated/events/alert-dialog.d.ts +8 -0
  98. package/generated/events/alert-dialog.js +1 -0
  99. package/generated/events/confirmation-dialog.d.ts +9 -0
  100. package/generated/events/confirmation-dialog.js +1 -0
  101. package/generated/events/date-picker.d.ts +8 -0
  102. package/generated/events/date-picker.js +1 -0
  103. package/generated/events/index.d.ts +8 -0
  104. package/generated/events/index.js +8 -0
  105. package/generated/events/lifecycle-observer.d.ts +10 -0
  106. package/generated/events/lifecycle-observer.js +1 -0
  107. package/generated/events/picker-view.d.ts +8 -0
  108. package/generated/events/picker-view.js +1 -0
  109. package/generated/events/scroll-view.d.ts +10 -0
  110. package/generated/events/scroll-view.js +1 -0
  111. package/generated/events/tab-view.d.ts +28 -0
  112. package/generated/events/tab-view.js +1 -0
  113. package/generated/events/text-field.d.ts +8 -0
  114. package/generated/events/text-field.js +1 -0
  115. package/generated/i18n/index.d.ts +34 -0
  116. package/generated/i18n/index.js +167 -0
  117. package/generated/i18n/locales/el.d.ts +15 -0
  118. package/generated/i18n/locales/el.js +15 -0
  119. package/generated/i18n/locales/en.d.ts +15 -0
  120. package/generated/i18n/locales/en.js +15 -0
  121. package/generated/i18n/locales/index.d.ts +4 -0
  122. package/generated/i18n/locales/index.js +4 -0
  123. package/generated/index.js +1 -1
  124. package/generated/internal/class/cleanup-registry.d.ts +5 -0
  125. package/generated/internal/class/cleanup-registry.js +38 -0
  126. package/generated/internal/class/css-style-observer.d.ts +8 -0
  127. package/generated/internal/class/css-style-observer.js +25 -0
  128. package/generated/internal/class/form-associated-base.d.ts +20 -0
  129. package/generated/internal/class/form-associated-base.js +96 -0
  130. package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
  131. package/generated/internal/class/mutation-observer-singleton.js +46 -0
  132. package/generated/internal/class/navigation-path.d.ts +15 -0
  133. package/generated/internal/class/navigation-path.js +84 -0
  134. package/generated/internal/class/navigation-view.d.ts +8 -0
  135. package/generated/internal/class/navigation-view.js +77 -0
  136. package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
  137. package/generated/internal/class/resize-observer-singleton.js +22 -0
  138. package/generated/internal/decorators/custom-element.d.ts +5 -0
  139. package/generated/internal/decorators/custom-element.js +4 -0
  140. package/generated/internal/privateNamespace.d.ts +4 -0
  141. package/generated/internal/privateNamespace.js +1 -0
  142. package/generated/internal/utils/add.d.ts +1 -0
  143. package/generated/internal/utils/add.js +7 -0
  144. package/generated/internal/utils/button-role.d.ts +1 -0
  145. package/generated/internal/utils/button-role.js +59 -0
  146. package/generated/internal/utils/cash/ancestors.d.ts +1 -0
  147. package/generated/internal/utils/cash/ancestors.js +27 -0
  148. package/generated/internal/utils/cash/index.d.ts +23 -0
  149. package/generated/internal/utils/cash/index.js +25 -0
  150. package/generated/internal/utils/cash/next-all.d.ts +1 -0
  151. package/generated/internal/utils/cash/next-all.js +10 -0
  152. package/generated/internal/utils/cash/next.d.ts +1 -0
  153. package/generated/internal/utils/cash/next.js +9 -0
  154. package/generated/internal/utils/cash/prev-all.d.ts +1 -0
  155. package/generated/internal/utils/cash/prev-all.js +10 -0
  156. package/generated/internal/utils/cash/prev.d.ts +1 -0
  157. package/generated/internal/utils/cash/prev.js +9 -0
  158. package/generated/internal/utils/cash/prop.d.ts +18 -0
  159. package/generated/internal/utils/cash/prop.js +30 -0
  160. package/generated/internal/utils/cash/siblings.d.ts +1 -0
  161. package/generated/internal/utils/cash/siblings.js +10 -0
  162. package/generated/internal/utils/clamp.d.ts +1 -0
  163. package/generated/internal/utils/clamp.js +4 -0
  164. package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
  165. package/generated/internal/utils/compare-big-decimals.js +90 -0
  166. package/generated/internal/utils/css-time.d.ts +1 -0
  167. package/generated/internal/utils/css-time.js +3 -0
  168. package/generated/internal/utils/debounce.d.ts +1 -0
  169. package/generated/internal/utils/debounce.js +13 -0
  170. package/generated/internal/utils/frame.d.ts +1 -0
  171. package/generated/internal/utils/frame.js +6 -0
  172. package/generated/internal/utils/index.d.ts +19 -1
  173. package/generated/internal/utils/index.js +20 -1
  174. package/generated/internal/utils/is-inside.d.ts +1 -0
  175. package/generated/internal/utils/is-inside.js +4 -0
  176. package/generated/internal/utils/kebab-case.d.ts +1 -1
  177. package/generated/internal/utils/kebab-case.js +3 -3
  178. package/generated/internal/utils/list-active.d.ts +7 -0
  179. package/generated/internal/utils/list-active.js +83 -0
  180. package/generated/internal/utils/microtask.d.ts +1 -0
  181. package/generated/internal/utils/microtask.js +3 -0
  182. package/generated/internal/utils/onoff.d.ts +45 -0
  183. package/generated/internal/utils/onoff.js +31 -0
  184. package/generated/internal/utils/set.d.ts +1 -0
  185. package/generated/internal/utils/set.js +7 -0
  186. package/generated/internal/utils/sleep.d.ts +1 -0
  187. package/generated/internal/utils/sleep.js +3 -0
  188. package/generated/internal/utils/slow-hide-show.d.ts +1 -0
  189. package/generated/internal/utils/slow-hide-show.js +16 -0
  190. package/generated/internal/utils/timeout.d.ts +5 -0
  191. package/generated/internal/utils/timeout.js +16 -0
  192. package/generated/internal/utils/touch-glass.d.ts +7 -0
  193. package/generated/internal/utils/touch-glass.js +19 -0
  194. package/generated/namespace-browser/base.d.ts +36 -0
  195. package/generated/namespace-browser/base.js +92 -0
  196. package/generated/namespace-browser/index.d.ts +7 -0
  197. package/generated/namespace-browser/index.js +1 -0
  198. package/generated/snapshot/index.d.ts +9 -0
  199. package/generated/snapshot/index.js +58 -0
  200. package/package.json +36 -9
  201. package/scss/_base.scss +5 -0
  202. package/scss/_components.scss +82 -0
  203. package/scss/_final.scss +1 -0
  204. package/scss/_functions.scss +31 -0
  205. package/scss/_mixins.scss +7 -0
  206. package/scss/_placeholders.scss +3 -0
  207. package/scss/_transitions.scss +32 -0
  208. package/scss/_utils.scss +9 -0
  209. package/scss/_vars.scss +179 -3
  210. package/scss/base/_layout.scss +56 -0
  211. package/scss/base/_reboot.scss +191 -0
  212. package/scss/base/_root.scss +397 -0
  213. package/scss/colors/_index.scss +704 -0
  214. package/scss/components/_alert-dialog.scss +111 -0
  215. package/scss/components/_body-view.scss +17 -0
  216. package/scss/components/_bordered-button.scss +57 -0
  217. package/scss/components/_bordered-prominent-button.scss +63 -0
  218. package/scss/components/_borderless-button.scss +44 -0
  219. package/scss/components/_confirmation-dialog.scss +117 -0
  220. package/scss/components/_content-unavailable-view.scss +45 -0
  221. package/scss/components/_date-picker.scss +30 -0
  222. package/scss/components/_detail-placeholder.scss +153 -0
  223. package/scss/components/_disclosure-group.scss +175 -0
  224. package/scss/components/_fine-tooltip.scss +82 -0
  225. package/scss/components/_form-view.scss +195 -0
  226. package/scss/components/_full-screen.scss +15 -0
  227. package/scss/components/_glass-button.scss +59 -0
  228. package/scss/components/_glass-prominent-button.scss +68 -0
  229. package/scss/components/_h-divider.scss +13 -0
  230. package/scss/components/_h-flex-stack.scss +23 -0
  231. package/scss/components/_h-stack.scss +29 -0
  232. package/scss/components/_index.scss +249 -0
  233. package/scss/components/_label-view copy.scss.txt +420 -0
  234. package/scss/components/_label-view.scss +355 -0
  235. package/scss/components/_label-view.scss.txt +536 -0
  236. package/scss/components/_labeled-content.scss +9 -0
  237. package/scss/components/_list-view.scss +229 -0
  238. package/scss/components/_menu-view.scss +205 -0
  239. package/scss/components/_navigation-large-title.scss +27 -0
  240. package/scss/components/_navigation-split-view.scss +424 -0
  241. package/scss/components/_navigation-stack.scss +11 -0
  242. package/scss/components/_navigation-title.scss +10 -0
  243. package/scss/components/_picker-view.scss +122 -0
  244. package/scss/components/_plain-button.scss +18 -0
  245. package/scss/components/_progress-view.scss +98 -0
  246. package/scss/components/_scroll-view-proxy.scss +79 -0
  247. package/scss/components/_scroll-view-toolbars.scss +126 -0
  248. package/scss/components/_scroll-view.scss +130 -0
  249. package/scss/components/_section-view.scss +119 -0
  250. package/scss/components/_sheet-view.scss +102 -0
  251. package/scss/components/_sidebar-toggle.scss +121 -0
  252. package/scss/components/_sidebar-view.scss +53 -0
  253. package/scss/components/_sticky-container.scss +42 -0
  254. package/scss/components/_tab-bar.scss +260 -0
  255. package/scss/components/_tab-item.scss +25 -0
  256. package/scss/components/_tab-view.scss +312 -0
  257. package/scss/components/_table-column.scss +52 -0
  258. package/scss/components/_table-row.scss +172 -0
  259. package/scss/components/_table-view.scss +223 -0
  260. package/scss/components/_text-field.scss +37 -0
  261. package/scss/components/_tool-bar-item-group.scss +48 -0
  262. package/scss/components/_tool-bar-item.scss +97 -0
  263. package/scss/components/_tool-bar.scss +153 -0
  264. package/scss/components/_v-divider.scss +13 -0
  265. package/scss/components/_v-flex-stack.scss +29 -0
  266. package/scss/components/_v-keyboard.scss +14 -0
  267. package/scss/components/_v-stack.scss +25 -0
  268. package/scss/final/_touch-glass.scss +91 -0
  269. package/scss/index.scss +15 -6
  270. package/scss/mixins/_button.scss +44 -0
  271. package/scss/mixins/_color.scss +16 -0
  272. package/scss/mixins/_dialog.scss +89 -0
  273. package/scss/mixins/_index.scss +422 -0
  274. package/scss/placeholders/_buttons.scss +117 -0
  275. package/scss/placeholders/_lists.scss +561 -0
  276. package/scss/transitions/_alert-dialog.scss +18 -0
  277. package/scss/transitions/_bwd.navbar.scss +19 -0
  278. package/scss/transitions/_bwd.scss +39 -0
  279. package/scss/transitions/_confirmation-dialog.scss +13 -0
  280. package/scss/transitions/_disclosure-group.scss +35 -0
  281. package/scss/transitions/_fine-tooltip.scss +21 -0
  282. package/scss/transitions/_fwd.navbar.scss +41 -0
  283. package/scss/transitions/_fwd.scss +24 -0
  284. package/scss/transitions/_glass-button.scss +12 -0
  285. package/scss/transitions/_glass-prominent-button.scss +12 -0
  286. package/scss/transitions/_index.scss +74 -0
  287. package/scss/transitions/_menu-view.scss +26 -0
  288. package/scss/transitions/_navigation-split-view.scss +23 -0
  289. package/scss/transitions/_progress-view.scss +23 -0
  290. package/scss/transitions/_sheet-view.scss +30 -0
  291. package/scss/transitions/_sidebar-view.scss +36 -0
  292. package/scss/transitions/_tab-bar.scss +20 -0
  293. package/scss/utils/_frame.scss +91 -0
  294. package/scss/utils/_index.scss +77 -0
  295. package/scss/utils/_scroll-view.scss +14 -0
  296. package/scss/utils/_spacing.scss +25 -0
  297. package/scss/utils/_stacks.scss +247 -0
  298. package/web-components.html-data/en.json +458 -0
  299. package/generated/internal/snapshot.d.ts +0 -5
  300. package/generated/internal/snapshot.js +0 -23
  301. package/generated/styles.css +0 -8
  302. package/scss/_reboot.scss +0 -11
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @swiftwc/ui
2
+
3
+ [README](https://github.com/swiftwc/ui/blob/main/README.md)
4
+
5
+ ## Documentation
6
+
7
+ Visit [swiftwc.github.io/ui/](https://swiftwc.github.io/ui/) to view the documentation.
8
+
9
+ ## Contributing
10
+
11
+ Please read the [contributing guide](https://github.com/swiftwc/ui/blob/main/CONTRIBUTING.md).
12
+
13
+ ## License
14
+
15
+ Licensed under the [MIT license](https://github.com/swiftwc/ui/blob/main/LICENSE.md).
@@ -0,0 +1,2 @@
1
+ declare const _default: EventTarget;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default new EventTarget();
@@ -0,0 +1,2 @@
1
+ declare const _default: EventTarget;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default new EventTarget();
@@ -0,0 +1,6 @@
1
+ export { default as alertDialog } from './alert-dialog';
2
+ export * from './alert-dialog';
3
+ export { default as confirmationDialog } from './confirmation-dialog';
4
+ export * from './confirmation-dialog';
5
+ export { default as lifecycleObserver } from './lifecycle-observer';
6
+ export * from './lifecycle-observer';
@@ -0,0 +1,6 @@
1
+ export { default as alertDialog } from './alert-dialog';
2
+ export * from './alert-dialog';
3
+ export { default as confirmationDialog } from './confirmation-dialog';
4
+ export * from './confirmation-dialog';
5
+ export { default as lifecycleObserver } from './lifecycle-observer';
6
+ export * from './lifecycle-observer';
@@ -0,0 +1,2 @@
1
+ declare const _default: EventTarget;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default new EventTarget();
@@ -1,2 +1,31 @@
1
- import { Snapshot } from "../internal/snapshot";
2
- export { Snapshot };
1
+ import { lifecycleObserver } from '../buses';
2
+ import { I18n } from '../i18n';
3
+ import { NavigationPath } from '../internal/class/navigation-path';
4
+ import { type NavigationHost } from '../internal/privateNamespace';
5
+ import { type WebComponentCtor } from '../namespace-browser';
6
+ import { Snapshot } from '../snapshot';
7
+ export declare const polyfills: Map<string, WebComponentCtor>;
8
+ type TransitionType = 'forwards' | 'backwards' | 'reload';
9
+ type UpdateCallback = () => void | Promise<void>;
10
+ type NavigateOptions = {
11
+ updateCallback?: UpdateCallback;
12
+ tos?: () => NavigationPath[];
13
+ };
14
+ export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
15
+ export declare const alert: (title?: string, message?: string, actions?: {
16
+ label?: string;
17
+ image?: string;
18
+ role?: string;
19
+ }[], options?: {
20
+ titleVisibility?: boolean;
21
+ }) => Promise<void>;
22
+ export declare const confirmationDialog: (trigger: HTMLElement, title: string, message?: string, actions?: {
23
+ label?: string;
24
+ image?: string;
25
+ role?: string;
26
+ }[], options?: {
27
+ controller?: AbortController;
28
+ titleVisibility?: boolean;
29
+ }) => Promise<string>;
30
+ export { I18n, lifecycleObserver, NavigationPath, Snapshot };
31
+ export { type NavigationHost };
@@ -1,8 +1,415 @@
1
- import { kebabCase } from "../internal/utils";
2
- console.log(kebabCase(`Hello client!`));
3
- import { Snapshot } from "../internal/snapshot";
4
- console.log(77, Snapshot);
5
- console.log(88, Snapshot.count);
6
- Snapshot.getSnapshot();
7
- console.log(99, Snapshot);
8
- export { Snapshot };
1
+ import { alertDialog, confirmationDialog as confirmationDialogBus, lifecycleObserver } from '../buses';
2
+ import * as Components from '../components';
3
+ import { I18n } from '../i18n';
4
+ import { NavigationPath } from '../internal/class/navigation-path';
5
+ import { $, kebabCase, onoff } from '../internal/utils';
6
+ import { Snapshot } from '../snapshot';
7
+ export const polyfills = new Map();
8
+ for (const [k, Ctor] of Object.entries(Components)) {
9
+ const is = kebabCase(k);
10
+ if ('polyfillExtends' in Ctor && 'string' === typeof Ctor.polyfillExtends) {
11
+ if (customElements.get(is))
12
+ continue;
13
+ customElements.define(is, Ctor, { extends: Ctor.polyfillExtends });
14
+ if (!(document.createElement(Ctor.polyfillExtends, { is }) instanceof Ctor))
15
+ polyfills.set(is, Ctor);
16
+ // const testEl = document.createElement('template')
17
+ // testEl.innerHTML = `<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`
18
+ // const testNode = testEl.content.firstElementChild,
19
+ if (!($(`<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`, '>1') instanceof Ctor))
20
+ polyfills.set(is, Ctor);
21
+ continue;
22
+ }
23
+ if (!customElements.get(is))
24
+ customElements.define(is, Ctor);
25
+ }
26
+ console.debug(polyfills);
27
+ if (0 < polyfills.size) {
28
+ const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
29
+ const handlers = new WeakMap();
30
+ const observe = (el, polyfill) => {
31
+ if (!Array.isArray(polyfill.observedAttributes))
32
+ return;
33
+ if (0 === polyfill?.observedAttributes.length)
34
+ return;
35
+ if (!polyfill.polyfillAttributeChangedCallback)
36
+ return;
37
+ const observer = new MutationObserver(polyfill.polyfillAttributeChangedCallback);
38
+ observer.observe(el, {
39
+ attributes: true,
40
+ attributeFilter: polyfill.observedAttributes,
41
+ attributeOldValue: true,
42
+ });
43
+ handlers.set(el, observer);
44
+ for (const attributeName of polyfill.observedAttributes)
45
+ if (el.hasAttribute(attributeName)) {
46
+ const entry = {
47
+ attributeName,
48
+ oldValue: null,
49
+ target: el,
50
+ };
51
+ polyfill.polyfillAttributeChangedCallback([entry]);
52
+ }
53
+ }, unobserve = (el) => {
54
+ handlers.delete(el);
55
+ }, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
56
+ console.debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
57
+ for (const [is, polyfill] of polyfills)
58
+ for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
59
+ polyfill.polyfillConnectedCallback(el);
60
+ observe(el, polyfill);
61
+ }
62
+ // observer callback
63
+ const observer = new MutationObserver((mutations) => {
64
+ for (const { addedNodes, removedNodes } of mutations) {
65
+ for (const root of addedNodes) {
66
+ if (!(root instanceof HTMLElement))
67
+ continue;
68
+ for (const node of flatten(root)) {
69
+ if (!(node instanceof HTMLElement))
70
+ continue;
71
+ if (!polyfillTagNamesCache.has(node.tagName))
72
+ continue;
73
+ const is = node?.getAttribute('is') ?? '';
74
+ if (!polyfills.has(is))
75
+ continue;
76
+ polyfills.get(is)?.polyfillConnectedCallback(node);
77
+ observe(node, polyfills.get(is));
78
+ }
79
+ }
80
+ for (const root of removedNodes) {
81
+ if (!(root instanceof HTMLElement))
82
+ continue;
83
+ for (const node of flatten(root)) {
84
+ if (!(node instanceof HTMLElement))
85
+ continue;
86
+ if (!polyfillTagNamesCache.has(node.tagName))
87
+ continue;
88
+ const is = node?.getAttribute('is') ?? '';
89
+ if (!polyfills.has(is))
90
+ continue;
91
+ polyfills.get(is)?.polyfillDisconnectedCallback(node);
92
+ unobserve(node);
93
+ }
94
+ }
95
+ }
96
+ });
97
+ observer.observe(document.body, {
98
+ childList: true,
99
+ subtree: true,
100
+ });
101
+ }
102
+ // SECTION: Safari polyfill
103
+ document.addEventListener('touchstart', () => { }, { passive: true });
104
+ // SECTION
105
+ const handleHelp = ({ target, relatedTarget }) => {
106
+ if (!(target instanceof HTMLElement && target))
107
+ return;
108
+ const trigger = target.closest('[help]');
109
+ if (!trigger)
110
+ return;
111
+ if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
112
+ return;
113
+ const newAnchorName = `--help-${self.crypto.randomUUID()}`;
114
+ const tooltip = $(`<fine-tooltip></fine-tooltip>`, '>1');
115
+ trigger.style.setProperty('anchor-name', newAnchorName);
116
+ tooltip.style.setProperty('position-anchor', newAnchorName);
117
+ document.body.appendChild(tooltip);
118
+ // setInterval(() => {
119
+ // trigger.setAttribute('help', trigger.getAttribute('help') + 'h')
120
+ // }, 2000)
121
+ // console.log(999, trigger)
122
+ }, handleDone = ({ target, relatedTarget }) => {
123
+ if (!(target instanceof HTMLElement && target))
124
+ return;
125
+ const trigger = target.closest('[help]');
126
+ if (!trigger)
127
+ return;
128
+ if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
129
+ return;
130
+ const anchorName = trigger.style.anchorName;
131
+ if (!anchorName.startsWith('--help-'))
132
+ return;
133
+ // for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
134
+ // for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
135
+ // return
136
+ // }
137
+ const tooltip = document.querySelector(`[style*="${CSS.escape(anchorName)}"]:not([help])`);
138
+ if (!tooltip)
139
+ return;
140
+ // for (const el of document.querySelectorAll<HTMLElement>(`[style*="--help-${CSS.escape(anchorName)}"][help]`)) el.style.removeProperty('anchor-name') //trigger.style.removeProperty('anchor-name')
141
+ // for (const el of document.querySelectorAll(`[style*="${CSS.escape(anchorName)}"]:not([help])`)) el.remove()
142
+ // return
143
+ // }
144
+ // trigger.style.removeProperty('anchor-name')
145
+ tooltip.hidePopover(); // tooltip.remove?.()
146
+ };
147
+ const mediaQueryList = self.matchMedia(`(pointer: fine)`);
148
+ mediaQueryList.addEventListener('change', ({ matches }) => {
149
+ for (const [k, v] of [
150
+ ['pointerover', handleHelp],
151
+ ['pointerout', handleDone],
152
+ ])
153
+ document.removeEventListener(k, v);
154
+ if (matches)
155
+ for (const [k, v] of [
156
+ ['pointerover', handleHelp],
157
+ ['pointerout', handleDone],
158
+ ])
159
+ document.addEventListener(k, v, { passive: true });
160
+ });
161
+ if (mediaQueryList.matches)
162
+ for (const [k, v] of [
163
+ ['pointerover', handleHelp],
164
+ ['pointerout', handleDone],
165
+ ])
166
+ document.addEventListener(k, v, { passive: true });
167
+ // SECTION: Transitions
168
+ const cleanup = (lm, type) => {
169
+ let arr = [Snapshot.config['vt-fwd-class-name'], 'fwdd', 'fwn', 'fwnn', 'bwd', 'bwdd', 'bwn', 'bwnn'];
170
+ if (['backwards', 'forwards'].includes(type ?? ''))
171
+ for (let i = arr.length - 1; i >= 0; i--)
172
+ if (arr[i].startsWith('backwards' === type ? 'fw' : 'bw'))
173
+ arr.splice(i, 1);
174
+ for (const el of [...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? [])])
175
+ el.classList.remove(...arr);
176
+ };
177
+ export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
178
+ console.debug(`startViewTransition (${type})`, target);
179
+ if (!(target instanceof HTMLElement))
180
+ throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
181
+ if (!['forwards', 'backwards', 'reload'].includes(type))
182
+ throw new TypeError("Argument 2 ('type') to client.startViewTransition must be of TransitionType");
183
+ const options = typeof updateCallbackOrOptions === 'function'
184
+ ? {
185
+ updateCallback: updateCallbackOrOptions,
186
+ }
187
+ : (updateCallbackOrOptions ?? {}), updateCallback = options.updateCallback ?? (async () => { });
188
+ await Snapshot.waitReady;
189
+ const from = new NavigationPath(target); //const from = closestBody(target) //event.target as HTMLElement)
190
+ if ('forwards' === type) {
191
+ await updateCallback(); // updatetheDOMSomehow
192
+ // Snapshot.getSnapshot(from)
193
+ // const root = getRootViewController(from)
194
+ // const oldPath = new NavigationPath(from)
195
+ const root = [from, ...from.parents()]
196
+ .map((item) => item.component)
197
+ .filter(Boolean)
198
+ .at(-1);
199
+ // const { toolBarConfig: oldToolbars } = getComputedView(from) // const { toolBarConfig: oldToolbars, slot: oldSLot, page: oldPage } = getComputedView(from) //
200
+ // console.log(88, oldPage, oldPath.page, oldSLot, oldPath.slot, oldToolbars, oldPath.toolBarConfig)
201
+ // const oldToolbars = Snapshot.toolbarItems
202
+ // const { toolBarConfig: oldToolbars, host: oldHost } = getComputedView(from)
203
+ const tos = options.tos?.() ?? [...from.children()].map((item) => item?.hydrate()), //queryBodyAll(oldSLot), //[...oldPath.children()].map((item) => item.body).filter(Boolean),//
204
+ to = tos.at(-1),
205
+ // to = newPath?.body, //tos.slice(-1)?.pop?.(), //Snapshot.leaf, //
206
+ // newHost = newPath?.component, //{ host: newHost } = getComputedView(to),
207
+ newToolbars = tos.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item),
208
+ // .map((item) => item.toolBarConfig)
209
+ // .flat()
210
+ // .filter(Boolean), //queryToolbarConfigAll(oldSLot),
211
+ modalViews = tos.map((item) => item.component).filter((item) => !!item && item.matches('dialog')); //[...queryHostAll(oldPage)].filter?.((item) => item?.matches('dialog'))
212
+ // toFrame = Snapshot.leafContainer, //queryHostAll(from).slice(-1)?.pop?.(),
213
+ // toToolbars = Snapshot.leafToolbarItems
214
+ // dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
215
+ // if ('DIALOG' === newHost?.tagName) {
216
+ // ;(newHost as HTMLDialogElement).showModal()
217
+ // console.debug(`⚡️ view-transition-start (${type})`)
218
+ // await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
219
+ // console.debug(`⚡️ view-transition-end (${type})`)
220
+ // return
221
+ // }
222
+ // purge
223
+ cleanup(root, 'backwards');
224
+ // prepare old
225
+ from.body?.classList.add(Snapshot.config['vt-fwd-class-name']);
226
+ from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
227
+ for (const oldToolbar of from.toolBarConfig ?? [])
228
+ oldToolbar.classList.add('fwn'); // prepare navbs
229
+ // prepare new
230
+ const toolbarExclusion = 0 < modalViews.length
231
+ ? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar,body-view ~ tool-bar)')
232
+ : (value, index, array) => value.parentElement?.matches('tool-bar:not(body-view ~ tool-bar)'), bodyExclusion = 0 < modalViews.length ? (item) => item.body?.matches('scroll-view:not(dialog scroll-view)') : (value, index, array) => value;
233
+ for (const bti of newToolbars?.filter?.(toolbarExclusion) ?? [])
234
+ bti.classList.add('fwnn'); // for (const ti of newToolbars ?? []) ti.classList.add('fwnn') //
235
+ for (const bt of tos?.filter?.(bodyExclusion) ?? []) {
236
+ bt.body?.classList.add('fwdd'); //to?.classList.add('fwdd')
237
+ bt.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: bt.body }, bubbles: true, composed: true }));
238
+ }
239
+ if (0 < modalViews.length) {
240
+ for await (const el of modalViews)
241
+ el.showModal();
242
+ console.debug(`⚡️ view-dialog-transition-start (${type})`);
243
+ await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
244
+ console.debug(`⚡️ view-dialog-transition-end (${type})`);
245
+ }
246
+ else {
247
+ console.debug(`⚡️ view-transition-start (${type})`);
248
+ await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
249
+ console.debug(`⚡️ view-transition-end (${type})`);
250
+ }
251
+ if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
252
+ return;
253
+ cleanup(root);
254
+ }
255
+ else {
256
+ // Snapshot.getSnapshot(from)
257
+ // const oldPath = new NavigationPath(from)
258
+ const root = [from, ...from.parents()]
259
+ .map((item) => item.component)
260
+ .filter(Boolean)
261
+ .at(-1); // const root = getRootViewController(from)
262
+ //const { toolBarConfig: oldToolbars, host: oldHost, page: oldPage, slot: oldSlot } = getComputedView(from)
263
+ const froms = [...from.children()].map((item) => item?.hydrate());
264
+ const oldToolbars = froms.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item), oldBodies = froms.map((item) => item.body).filter((item) => !!item);
265
+ // console.log(99, queryToolbarConfigAll(oldSlot), oldToolbars)
266
+ // if most-top effect is closing a modal, skip everything
267
+ if ('DIALOG' === from.component?.tagName) {
268
+ from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
269
+ from.component.close();
270
+ console.debug(`⚡️ view-dialog-transition-start (${type})`);
271
+ await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
272
+ console.debug(`⚡️ view-dialog-transition-end (${type})`);
273
+ if (from.component.matches('[open]'))
274
+ return;
275
+ await updateCallback();
276
+ return; // just close modal
277
+ }
278
+ const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
279
+ // console.log(99, to)
280
+ if (!to)
281
+ return console.debug('Can not go backwards.'); // nothing to go back to
282
+ const tv = to.body?.closest('tab-view');
283
+ if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
284
+ if ('bottom-bar' !== tv.tabBarPlacement)
285
+ return;
286
+ // const { toolBarConfig: newToolbars } = getComputedView(to.body)
287
+ // purge
288
+ cleanup(root, 'forwards');
289
+ // prepare new
290
+ for (const ti of to.toolBarConfig ?? [])
291
+ ti.classList.add('bwnn');
292
+ to.body?.classList.add('bwdd');
293
+ to.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: to.body }, bubbles: true, composed: true }));
294
+ // prepare old
295
+ const inbetweenModals = froms.map((item) => item.component).filter((item) => !!item && item.matches('dialog[open]')), //queryHostAll(oldPage).filter?.((item) => item.matches('dialog[open]')) ?? [], // FIXME: TEst this, added oldHost too
296
+ toolbarExclusion = 0 < inbetweenModals.length
297
+ ? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar)')
298
+ : (value, index, array) => value, bodyExclusion = 0 < inbetweenModals.length ? (item) => item?.matches('scroll-view:not(dialog scroll-view)') : (item) => item;
299
+ for (const ti of [...(from.toolBarConfig ?? []), ...(oldToolbars?.filter?.(toolbarExclusion) ?? [])])
300
+ ti.classList.add('bwn');
301
+ for (const nn of [from.body, ...oldBodies?.filter?.(bodyExclusion)]) {
302
+ nn?.classList.add('bwd'); //from?.classList.add('bwd')
303
+ nn?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: nn }, bubbles: true, composed: true }));
304
+ }
305
+ for (const el of inbetweenModals)
306
+ el.close(); // close old inbetween modals
307
+ // capture trans
308
+ console.debug(`⚡️ view-transition-start (${type})`);
309
+ await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
310
+ console.debug(`⚡️ view-transition-end (${type})`);
311
+ if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
312
+ return;
313
+ cleanup(root);
314
+ // remove or hide
315
+ await updateCallback();
316
+ }
317
+ };
318
+ export const alert = async (title, message, actions, options) => {
319
+ await navigator.locks.request('alert:', async () => {
320
+ const dialog = $(`<dialog is="alert-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(`<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
321
+ if (title) {
322
+ const label = $(`<label-view font="headline"></label-view>`, '>1');
323
+ label.setAttribute('title', title);
324
+ vStack.insertAdjacentElement('beforeend', label);
325
+ }
326
+ if (message) {
327
+ const label = $(`<label-view foreground="secondary" font="callout"></label-view>`, '>1');
328
+ label.setAttribute('title', message);
329
+ vStack.insertAdjacentElement('beforeend', label);
330
+ }
331
+ for (const [index, action] of (actions ?? [
332
+ {
333
+ role: 'close',
334
+ },
335
+ ]).entries()) {
336
+ const btn = $(`<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
337
+ btn.setAttribute('value', `${index}`);
338
+ if (action?.role)
339
+ btn.setAttribute('role', action.role);
340
+ if (action.label || action.image) {
341
+ const label = $(`<label-view></label-view>`, '>1');
342
+ if (action.label)
343
+ label.setAttribute('title', action.label);
344
+ if (action.image)
345
+ label.setAttribute('system-image', action.image);
346
+ btn.appendChild(label);
347
+ }
348
+ dialog.insertAdjacentElement('beforeend', btn);
349
+ }
350
+ document.body.insertAdjacentElement('beforeend', dialog);
351
+ dialog.showModal();
352
+ const { promise, resolve } = Promise.withResolvers(), off = onoff('alert:return', (evt) => {
353
+ off();
354
+ resolve(evt.detail.returnValue);
355
+ }, alertDialog, { once: true }).on();
356
+ return promise;
357
+ });
358
+ };
359
+ export const confirmationDialog = async (trigger, title, message, actions, options) => {
360
+ const newAnchorName = `--confirmation-dialog-${self.crypto.randomUUID()}`;
361
+ const dialog = $(`<dialog is="confirmation-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(`<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
362
+ trigger.style.setProperty('anchor-name', newAnchorName, 'important'); //$.prop('anchor-name', newAnchorName, trigger, 'important')
363
+ dialog.style.setProperty('position-anchor', newAnchorName); //$.prop('position-anchor', newAnchorName, dialog)
364
+ if (title && false !== options?.titleVisibility) {
365
+ const label = $(`<label-view font="headline"></label-view>`, '>1');
366
+ label.setAttribute('title', title);
367
+ vStack.insertAdjacentElement('beforeend', label);
368
+ }
369
+ if (message && false !== options?.titleVisibility) {
370
+ const label = $(`<label-view foreground="secondary" font="callout"></label-view>`, '>1');
371
+ label.setAttribute('title', message);
372
+ vStack.insertAdjacentElement('beforeend', label);
373
+ }
374
+ for (const [index, action] of (actions ?? []).entries()) {
375
+ const btn = $(`<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
376
+ btn.setAttribute('value', `${index}`);
377
+ if (action?.role)
378
+ btn.setAttribute('role', action.role);
379
+ if (action.label || action.image) {
380
+ const label = $(`<label-view></label-view>`, '>1');
381
+ if (action.label)
382
+ label.setAttribute('title', action.label);
383
+ if (action.image)
384
+ label.setAttribute('system-image', action.image);
385
+ btn.appendChild(label);
386
+ }
387
+ dialog.insertAdjacentElement('beforeend', btn);
388
+ }
389
+ trigger.closest('body-view,dialog')?.insertAdjacentElement('beforeend', dialog); // dialog.showModal()
390
+ const { promise, resolve } = Promise.withResolvers(), off = onoff('confirmation:return', (evt) => {
391
+ off();
392
+ resolve(evt.detail.returnValue);
393
+ }, confirmationDialogBus, { once: true }).on();
394
+ return promise;
395
+ // return await new Promise((resolve, reject) => {
396
+ // const onClose = (evt: any) => {
397
+ // off()
398
+ // resolve(evt.detail.returnValue)
399
+ // },
400
+ // off = onoff('return', onClose, ConfirmationDialog, { once: true }).on()
401
+ // // const onAbort = () => {
402
+ // // cleanup()
403
+ // // reject(new DOMException('aborted', 'AbortError'))
404
+ // // }
405
+ // // const cleanup = () => {
406
+ // // ConfirmationDialog.removeEventListener('close', onClose)
407
+ // // // controller.signal.removeEventListener('abort', onAbort)
408
+ // // }
409
+ // // ConfirmationDialog.addEventListener('close', onClose, { once: true })
410
+ // // controller.signal.addEventListener('abort', onAbort, { once: true })
411
+ // })
412
+ };
413
+ void Snapshot.waitReady; // void Snapshot.setOwnConfig()
414
+ // SECTION
415
+ export { I18n, lifecycleObserver, NavigationPath, Snapshot };
@@ -0,0 +1,8 @@
1
+ import { DialogBase } from '../namespace-browser/base';
2
+ export declare class AlertDialog extends DialogBase {
3
+ #private;
4
+ constructor();
5
+ static polyfillDisconnectedCallback(el: AlertDialog): void;
6
+ static polyfillConnectedCallback(el: AlertDialog): void;
7
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
8
+ }
@@ -0,0 +1,94 @@
1
+ import { alertDialog } from '../buses';
2
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
+ import { onoff, touchGlass } from '../internal/utils';
4
+ import { DialogBase } from '../namespace-browser/base';
5
+ export class AlertDialog extends DialogBase {
6
+ constructor() {
7
+ super();
8
+ }
9
+ static polyfillDisconnectedCallback(el) {
10
+ console.debug(`${AlertDialog.name} ⚡️ disconnect`);
11
+ CleanupRegistry.unregister(el);
12
+ alertDialog.dispatchEvent(new CustomEvent('alert:return', {
13
+ detail: { returnValue: el.returnValue },
14
+ bubbles: true,
15
+ composed: true,
16
+ }));
17
+ }
18
+ static polyfillConnectedCallback(el) {
19
+ console.debug(`${AlertDialog.name} ⚡️ connect`);
20
+ CleanupRegistry.register(el, onoff([
21
+ { types: 'click', listener: this.#handleDialogClick },
22
+ { types: 'close', listener: this.#handleDialogClose },
23
+ { types: 'cancel', listener: this.#handleDialogCancel },
24
+ ], el).on());
25
+ CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
26
+ const target = evt.target instanceof HTMLElement && evt.target;
27
+ if (!target)
28
+ return true;
29
+ if (target.matches('[is=alert-dialog]'))
30
+ return false;
31
+ return true;
32
+ }), el).on());
33
+ console.debug(`${AlertDialog.name} ⚡️ will-open`);
34
+ el.removeAttribute('closing');
35
+ el.scrollTop = 0;
36
+ el.returnValue = '';
37
+ el.autofocus = true;
38
+ el.showModal();
39
+ }
40
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
41
+ console.debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
42
+ switch (attributeName) {
43
+ case 'label':
44
+ //
45
+ break;
46
+ }
47
+ }
48
+ static #handleDialogClick = (evt) => {
49
+ console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
50
+ const dialog = evt.currentTarget instanceof HTMLDialogElement && evt.currentTarget;
51
+ if (!dialog)
52
+ return;
53
+ const target = evt.target instanceof HTMLElement && evt.target;
54
+ if (!target)
55
+ return;
56
+ const button = target.closest('button');
57
+ if (!button)
58
+ return;
59
+ button.scrollIntoView({
60
+ behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
61
+ block: 'nearest',
62
+ inline: 'nearest',
63
+ });
64
+ dialog.returnValue = button.value;
65
+ dialog.requestClose(button.value);
66
+ evt.stopPropagation();
67
+ evt.stopImmediatePropagation();
68
+ };
69
+ static #handleDialogCancel = (evt) => {
70
+ console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
71
+ if (!evt.cancelable)
72
+ return;
73
+ const target = evt.target instanceof HTMLDialogElement && evt.target;
74
+ if (!target)
75
+ return;
76
+ evt.preventDefault();
77
+ target.inert = true;
78
+ console.debug(`${AlertDialog.name} ⚡️ will-close`);
79
+ target.setAttribute('closing', '');
80
+ Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
81
+ if (!target.hasAttribute('closing'))
82
+ return;
83
+ target?.close(target?.returnValue);
84
+ target.removeAttribute('closing');
85
+ });
86
+ };
87
+ static #handleDialogClose = (evt) => {
88
+ console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
89
+ const target = evt.target instanceof HTMLDialogElement && evt.target;
90
+ if (!target)
91
+ return;
92
+ target.remove();
93
+ };
94
+ }
@@ -0,0 +1,5 @@
1
+ export declare class BodyView extends HTMLElement {
2
+ constructor();
3
+ disconnectedCallback(): void;
4
+ connectedCallback(): void;
5
+ }
@@ -0,0 +1,11 @@
1
+ export class BodyView extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ }
5
+ disconnectedCallback() {
6
+ console.debug(`${BodyView.name} ⚡️ disconnect`);
7
+ }
8
+ connectedCallback() {
9
+ console.debug(`${BodyView.name} ⚡️ connect`);
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ import { ButtonBase } from '../namespace-browser/base';
2
+ /**
3
+ * @slot overlay
4
+ *
5
+ */
6
+ export declare class BorderedButton extends ButtonBase {
7
+ #private;
8
+ static get observedAttributes(): string[];
9
+ constructor();
10
+ static polyfillDisconnectedCallback(el: BorderedButton): void;
11
+ static polyfillConnectedCallback(el: BorderedButton): void;
12
+ static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
13
+ }