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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/README.md +15 -0
  2. package/generated/client/index.d.ts +13 -3
  3. package/generated/client/index.js +228 -158
  4. package/generated/components/bordered-button.d.ts +7 -0
  5. package/generated/components/bordered-button.js +20 -0
  6. package/generated/components/bordered-prominent-button.d.ts +7 -0
  7. package/generated/components/bordered-prominent-button.js +20 -0
  8. package/generated/components/borderless-button.d.ts +4 -4
  9. package/generated/components/borderless-button.js +26 -16
  10. package/generated/components/confirmation-dialog.d.ts +9 -0
  11. package/generated/components/confirmation-dialog.js +102 -0
  12. package/generated/components/date-picker.d.ts +46 -0
  13. package/generated/components/date-picker.js +430 -0
  14. package/generated/components/disclosure-group.d.ts +4 -7
  15. package/generated/components/disclosure-group.js +41 -66
  16. package/generated/components/form-view.d.ts +6 -0
  17. package/generated/components/form-view.js +58 -0
  18. package/generated/components/glass-button.d.ts +6 -0
  19. package/generated/components/glass-button.js +17 -0
  20. package/generated/components/glass-prominent-button.d.ts +6 -0
  21. package/generated/components/glass-prominent-button.js +17 -0
  22. package/generated/components/index.d.ts +34 -10
  23. package/generated/components/index.js +33 -14
  24. package/generated/components/label-view.d.ts +9 -0
  25. package/generated/components/label-view.js +83 -0
  26. package/generated/components/list-view.d.ts +5 -0
  27. package/generated/components/list-view.js +29 -0
  28. package/generated/components/menu-view.d.ts +9 -0
  29. package/generated/components/menu-view.js +133 -0
  30. package/generated/components/navigation-large-title.d.ts +6 -0
  31. package/generated/components/navigation-large-title.js +177 -0
  32. package/generated/components/navigation-split-view.d.ts +4 -2
  33. package/generated/components/navigation-split-view.js +11 -2
  34. package/generated/components/navigation-stack.d.ts +3 -2
  35. package/generated/components/navigation-stack.js +15 -58
  36. package/generated/components/navigation-title.d.ts +8 -0
  37. package/generated/components/navigation-title.js +66 -0
  38. package/generated/components/picker-view.d.ts +27 -0
  39. package/generated/components/picker-view.js +442 -0
  40. package/generated/components/plain-button.d.ts +7 -0
  41. package/generated/components/plain-button.js +20 -0
  42. package/generated/components/screen-view.d.ts +1 -1
  43. package/generated/components/screen-view.js +1 -1
  44. package/generated/components/scroll-view.d.ts +4 -2
  45. package/generated/components/scroll-view.js +169 -62
  46. package/generated/components/section-view.d.ts +9 -0
  47. package/generated/components/section-view.js +81 -0
  48. package/generated/components/sheet-view.d.ts +4 -4
  49. package/generated/components/sheet-view.js +59 -16
  50. package/generated/components/sidebar-toggle.d.ts +1 -1
  51. package/generated/components/sidebar-toggle.js +89 -63
  52. package/generated/components/sidebar-view.d.ts +2 -4
  53. package/generated/components/sidebar-view.js +20 -17
  54. package/generated/components/sticky-container.d.ts +6 -0
  55. package/generated/components/sticky-container.js +22 -0
  56. package/generated/components/tab-bar.d.ts +2 -4
  57. package/generated/components/tab-bar.js +24 -17
  58. package/generated/components/tab-item.d.ts +4 -3
  59. package/generated/components/tab-item.js +114 -29
  60. package/generated/components/tab-view.d.ts +17 -2
  61. package/generated/components/tab-view.js +244 -17
  62. package/generated/components/table-view.d.ts +7 -0
  63. package/generated/components/table-view.js +175 -0
  64. package/generated/components/text-field.d.ts +29 -0
  65. package/generated/components/text-field.js +489 -0
  66. package/generated/components/tool-bar-item-group.d.ts +5 -0
  67. package/generated/components/tool-bar-item-group.js +11 -0
  68. package/generated/components/tool-bar-item.d.ts +5 -0
  69. package/generated/components/tool-bar-item.js +19 -0
  70. package/generated/components/tool-bar.d.ts +7 -0
  71. package/generated/components/tool-bar.js +77 -0
  72. package/generated/components/v-keyboard.d.ts +2 -0
  73. package/generated/components/v-keyboard.js +64 -68
  74. package/generated/components/v-stack.d.ts +5 -0
  75. package/generated/components/v-stack.js +11 -0
  76. package/generated/confirmation-dialog/index.d.ts +1 -0
  77. package/generated/confirmation-dialog/index.js +1 -0
  78. package/generated/css/index.css +7463 -0
  79. package/generated/events/confirmation-dialog.d.ts +9 -0
  80. package/generated/events/date-picker.d.ts +8 -0
  81. package/generated/events/date-picker.js +1 -0
  82. package/generated/events/index.d.ts +7 -0
  83. package/generated/events/index.js +7 -0
  84. package/generated/events/lifecycle-observer.d.ts +10 -0
  85. package/generated/events/lifecycle-observer.js +1 -0
  86. package/generated/events/picker-view.d.ts +8 -0
  87. package/generated/events/picker-view.js +1 -0
  88. package/generated/events/scroll-view.d.ts +10 -0
  89. package/generated/events/scroll-view.js +1 -0
  90. package/generated/events/tab-view.d.ts +24 -0
  91. package/generated/events/tab-view.js +1 -0
  92. package/generated/events/text-field.d.ts +8 -0
  93. package/generated/events/text-field.js +1 -0
  94. package/generated/i18n/index.d.ts +24 -0
  95. package/generated/i18n/index.js +139 -0
  96. package/generated/internal/class/cleanup-registry.d.ts +5 -0
  97. package/generated/internal/class/cleanup-registry.js +38 -0
  98. package/generated/internal/class/css-style-observer.d.ts +8 -0
  99. package/generated/internal/class/css-style-observer.js +25 -0
  100. package/generated/internal/class/form-associated-base.d.ts +20 -0
  101. package/generated/internal/class/form-associated-base.js +93 -0
  102. package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
  103. package/generated/internal/class/mutation-observer-singleton.js +46 -0
  104. package/generated/internal/class/navigation-path.d.ts +15 -0
  105. package/generated/internal/class/navigation-path.js +84 -0
  106. package/generated/internal/class/navigation-view.d.ts +8 -0
  107. package/generated/internal/class/navigation-view.js +77 -0
  108. package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
  109. package/generated/internal/class/resize-observer-singleton.js +22 -0
  110. package/generated/internal/decorators/custom-element.d.ts +5 -0
  111. package/generated/internal/decorators/custom-element.js +4 -0
  112. package/generated/internal/privateNamespace.d.ts +4 -0
  113. package/generated/internal/privateNamespace.js +1 -0
  114. package/generated/internal/utils/add.d.ts +1 -0
  115. package/generated/internal/utils/add.js +7 -0
  116. package/generated/internal/utils/cash/ancestors.d.ts +1 -0
  117. package/generated/internal/utils/cash/ancestors.js +27 -0
  118. package/generated/internal/utils/cash/index.d.ts +22 -0
  119. package/generated/internal/utils/cash/index.js +23 -0
  120. package/generated/internal/utils/cash/next-all.d.ts +1 -0
  121. package/generated/internal/utils/cash/next-all.js +10 -0
  122. package/generated/internal/utils/cash/next.d.ts +1 -0
  123. package/generated/internal/utils/cash/next.js +9 -0
  124. package/generated/internal/utils/cash/prev-all.d.ts +1 -0
  125. package/generated/internal/utils/cash/prev-all.js +10 -0
  126. package/generated/internal/utils/cash/prev.d.ts +1 -0
  127. package/generated/internal/utils/cash/prev.js +9 -0
  128. package/generated/internal/utils/cash/prop.d.ts +18 -0
  129. package/generated/internal/utils/cash/prop.js +30 -0
  130. package/generated/internal/utils/cash/siblings.d.ts +1 -0
  131. package/generated/internal/utils/cash/siblings.js +10 -0
  132. package/generated/internal/utils/clamp.d.ts +1 -0
  133. package/generated/internal/utils/clamp.js +4 -0
  134. package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
  135. package/generated/internal/utils/compare-big-decimals.js +90 -0
  136. package/generated/internal/utils/debounce.d.ts +1 -0
  137. package/generated/internal/utils/debounce.js +13 -0
  138. package/generated/internal/utils/frame.d.ts +1 -0
  139. package/generated/internal/utils/frame.js +6 -0
  140. package/generated/internal/utils/index.d.ts +16 -1
  141. package/generated/internal/utils/index.js +17 -1
  142. package/generated/internal/utils/kebab-case.d.ts +1 -1
  143. package/generated/internal/utils/list-active.d.ts +7 -0
  144. package/generated/internal/utils/list-active.js +28 -0
  145. package/generated/internal/utils/microtask.d.ts +1 -0
  146. package/generated/internal/utils/microtask.js +3 -0
  147. package/generated/internal/utils/onoff.d.ts +45 -0
  148. package/generated/internal/utils/onoff.js +31 -0
  149. package/generated/internal/utils/set.d.ts +1 -0
  150. package/generated/internal/utils/set.js +7 -0
  151. package/generated/internal/utils/sleep.d.ts +1 -0
  152. package/generated/internal/utils/sleep.js +3 -0
  153. package/generated/internal/utils/slow-hide-show.d.ts +1 -0
  154. package/generated/internal/utils/slow-hide-show.js +16 -0
  155. package/generated/internal/utils/timeout.d.ts +5 -0
  156. package/generated/internal/utils/timeout.js +16 -0
  157. package/generated/internal/utils/touch-glass.d.ts +7 -0
  158. package/generated/internal/utils/touch-glass.js +19 -0
  159. package/generated/lifecycle-observer/index.d.ts +1 -0
  160. package/generated/lifecycle-observer/index.js +1 -0
  161. package/generated/namespace-browser/base.d.ts +36 -0
  162. package/generated/namespace-browser/base.js +92 -0
  163. package/generated/namespace-browser/index.d.ts +7 -0
  164. package/generated/namespace-browser/index.js +1 -0
  165. package/generated/snapshot/index.d.ts +2 -11
  166. package/generated/snapshot/index.js +31 -144
  167. package/package.json +19 -8
  168. package/scss/_components.scss +52 -16
  169. package/scss/_final.scss +1 -0
  170. package/scss/_mixins.scss +2 -171
  171. package/scss/_placeholders.scss +3 -0
  172. package/scss/_transitions.scss +16 -0
  173. package/scss/_utils.scss +9 -0
  174. package/scss/_vars.scss +137 -23
  175. package/scss/base/_layout.scss +31 -15
  176. package/scss/base/_reboot.scss +118 -15
  177. package/scss/base/_root.scss +355 -25
  178. package/scss/colors/_index.scss +624 -70
  179. package/scss/components/_body-view.scss +12 -3
  180. package/scss/components/_bordered-button.scss +22 -0
  181. package/scss/components/_bordered-prominent-button.scss +19 -0
  182. package/scss/components/_borderless-button.scss +11 -6
  183. package/scss/components/_confirmation-dialog.scss +110 -0
  184. package/scss/components/_date-picker.scss +30 -0
  185. package/scss/components/_detail-placeholder.scss +155 -0
  186. package/scss/components/_disclosure-group.scss +100 -52
  187. package/scss/components/_form-view.scss +195 -0
  188. package/scss/components/_full-screen.scss +7 -5
  189. package/scss/components/_glass-button.scss +24 -0
  190. package/scss/components/_glass-prominent-button.scss +24 -0
  191. package/scss/components/_h-divider.scss +13 -0
  192. package/scss/components/_h-stack.scss +39 -0
  193. package/scss/components/_index.scss +224 -7
  194. package/scss/components/_label-view.scss +386 -0
  195. package/scss/components/_labeled-content.scss +9 -0
  196. package/scss/components/_list-view.scss +229 -0
  197. package/scss/components/_menu-view.scss +188 -0
  198. package/scss/components/_navigation-large-title.scss +27 -0
  199. package/scss/components/_navigation-split-view.scss +329 -269
  200. package/scss/components/_navigation-stack.scss +6 -6
  201. package/scss/components/_navigation-title.scss +10 -0
  202. package/scss/components/_picker-view.scss +122 -0
  203. package/scss/components/_plain-button.scss +11 -0
  204. package/scss/components/_scroll-view-proxy.scss +79 -0
  205. package/scss/components/_scroll-view-toolbars.scss +126 -0
  206. package/scss/components/_scroll-view.scss +110 -66
  207. package/scss/components/_section-view.scss +119 -0
  208. package/scss/components/_sheet-view.scss +68 -35
  209. package/scss/components/_sidebar-toggle.scss +90 -27
  210. package/scss/components/_sidebar-view.scss +30 -40
  211. package/scss/components/_sticky-container.scss +42 -0
  212. package/scss/components/_tab-bar.scss +201 -84
  213. package/scss/components/_tab-item.scss +25 -0
  214. package/scss/components/_tab-view.scss +268 -126
  215. package/scss/components/_table-column.scss +52 -0
  216. package/scss/components/_table-row.scss +172 -0
  217. package/scss/components/_table-view.scss +223 -0
  218. package/scss/components/_text-field.scss +37 -0
  219. package/scss/components/_tool-bar-item-group.scss +30 -19
  220. package/scss/components/_tool-bar-item.scss +128 -70
  221. package/scss/components/_tool-bar.scss +107 -64
  222. package/scss/components/_v-divider.scss +13 -0
  223. package/scss/components/_v-flex-stack.scss +29 -0
  224. package/scss/components/_v-keyboard.scss +6 -4
  225. package/scss/components/_v-stack.scss +8 -9
  226. package/scss/final/_touch-glass.scss +67 -0
  227. package/scss/index.scss +6 -2
  228. package/scss/mixins/_dialog.scss +88 -0
  229. package/scss/mixins/_index.scss +405 -0
  230. package/scss/placeholders/_buttons.scss +83 -0
  231. package/scss/placeholders/_lists.scss +589 -0
  232. package/scss/transitions/_bwd.navbar.scss +3 -13
  233. package/scss/transitions/_bwd.scss +4 -20
  234. package/scss/transitions/_confirmation-dialog.scss +19 -0
  235. package/scss/transitions/_dialog.scss +7 -11
  236. package/scss/transitions/_disclosure-group.scss +35 -0
  237. package/scss/transitions/_fwd.navbar.scss +4 -9
  238. package/scss/transitions/_fwd.scss +4 -34
  239. package/scss/transitions/_glass-button.scss +12 -0
  240. package/scss/transitions/_glass-prominent-button.scss +12 -0
  241. package/scss/transitions/_index.scss +35 -143
  242. package/scss/transitions/_menu-view.scss +26 -0
  243. package/scss/transitions/_navigation-split-view.scss +23 -0
  244. package/scss/transitions/_sidebar-view.scss +36 -0
  245. package/scss/transitions/_tab-bar.scss +19 -0
  246. package/scss/utils/_frame.scss +84 -0
  247. package/scss/utils/_index.scss +68 -0
  248. package/scss/utils/_scroll-view.scss +14 -0
  249. package/scss/utils/_spacing.scss +25 -0
  250. package/scss/utils/_stacks.scss +242 -0
  251. package/web-components.html-data/en.json +330 -0
  252. package/generated/components/bottom-bar.d.ts +0 -10
  253. package/generated/components/bottom-bar.js +0 -73
  254. package/generated/components/navigation-bar.d.ts +0 -10
  255. package/generated/components/navigation-bar.js +0 -80
  256. package/generated/internal/class.d.ts +0 -18
  257. package/generated/internal/class.js +0 -18
  258. package/generated/namespace/index.d.ts +0 -6
  259. package/generated/styles.css +0 -1305
  260. package/scss/_dev.scss +0 -68
  261. package/scss/components/_tab-bar-stack.scss +0 -101
  262. package/scss/components/_toolbars.scss +0 -100
  263. /package/generated/{namespace/index.js → events/confirmation-dialog.js} +0 -0
@@ -0,0 +1 @@
1
+ export default function <T extends object, K extends keyof T>(obj: T, key: K, value: T[K]): boolean;
@@ -0,0 +1,7 @@
1
+ export default function (obj, key, value) {
2
+ if (!Object.is(obj[key], value)) {
3
+ obj[key] = value;
4
+ return true;
5
+ }
6
+ return false;
7
+ }
@@ -0,0 +1 @@
1
+ export default function (ms: number): Promise<void>;
@@ -0,0 +1,3 @@
1
+ export default function (ms) {
2
+ return new Promise((r) => self.setTimeout(r, ms));
3
+ }
@@ -0,0 +1 @@
1
+ export default function (to: 'show' | 'hide', el?: HTMLElement): void;
@@ -0,0 +1,16 @@
1
+ import frame from './frame';
2
+ export default function (to, el) {
3
+ const transcleanup = ({ propertyName }) => {
4
+ if ('opacity' !== propertyName)
5
+ return;
6
+ el?.removeAttribute('slow');
7
+ };
8
+ for (const eventType of ['transitionend', 'transitioncancel'])
9
+ el?.addEventListener(eventType, transcleanup, {
10
+ once: true,
11
+ });
12
+ el?.setAttribute('slow', '');
13
+ frame(el).then(() => {
14
+ el?.setAttribute('slow', to);
15
+ }); //self.requestAnimationFrame(() => el?.setAttribute('slow', to))
16
+ }
@@ -0,0 +1,5 @@
1
+ export default function (): {
2
+ next: (fn: () => void, ms: number) => void;
3
+ cancel: () => void;
4
+ pending: () => boolean;
5
+ };
@@ -0,0 +1,16 @@
1
+ export default function () {
2
+ let id;
3
+ const cancel = () => {
4
+ if (!id)
5
+ return;
6
+ self.clearTimeout(id);
7
+ id = undefined;
8
+ }, next = (fn, ms) => {
9
+ cancel();
10
+ id = self.setTimeout(() => {
11
+ fn();
12
+ id = undefined;
13
+ }, ms);
14
+ }, pending = () => undefined !== id;
15
+ return { next, cancel, pending };
16
+ }
@@ -0,0 +1,7 @@
1
+ export default function (t: HTMLElement, targetCallback: (target: HTMLElement) => HTMLElement, checkCallback: (evt: PointerEvent) => boolean): {
2
+ types: string;
3
+ listener: EventListener;
4
+ addOptions: {
5
+ passive: boolean;
6
+ };
7
+ }[];
@@ -0,0 +1,19 @@
1
+ const makePointerDownHandler = (target, targetCallback, checkCallback) => {
2
+ return function (evt) {
3
+ // if (event.pointerType !== 'touch') return
4
+ if (!checkCallback(evt))
5
+ return;
6
+ targetCallback(target).toggleAttribute('touch-glass', true);
7
+ };
8
+ }, makePointerCancelHandler = (target, targetCallback) => {
9
+ return function (evt) {
10
+ targetCallback(target).toggleAttribute('touch-glass', false);
11
+ };
12
+ };
13
+ export default function (t, targetCallback, checkCallback) {
14
+ const onListener = makePointerDownHandler(t, targetCallback, checkCallback), offListener = makePointerCancelHandler(t, targetCallback);
15
+ return [
16
+ { types: 'pointerdown', listener: onListener, addOptions: { passive: true } },
17
+ { types: 'pointerup pointercancel pointerleave', listener: offListener, addOptions: { passive: true } },
18
+ ];
19
+ }
@@ -0,0 +1 @@
1
+ export declare const LifecycleObserver: EventTarget;
@@ -0,0 +1 @@
1
+ export const LifecycleObserver = new EventTarget();
@@ -0,0 +1,36 @@
1
+ export declare abstract class DialogBase extends HTMLDialogElement {
2
+ static polyfillExtends: "dialog";
3
+ static polyfillConnectedCallback(el: HTMLDialogElement): void;
4
+ static polyfillDisconnectedCallback(el: HTMLDialogElement): void;
5
+ static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
6
+ disconnectedCallback(): void;
7
+ connectedCallback(): void;
8
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
9
+ }
10
+ export declare abstract class ButtonBase extends HTMLButtonElement {
11
+ static polyfillExtends: "button";
12
+ static polyfillConnectedCallback(el: HTMLButtonElement): void;
13
+ static polyfillDisconnectedCallback(el: HTMLButtonElement): void;
14
+ static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
15
+ disconnectedCallback(): void;
16
+ connectedCallback(): void;
17
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
18
+ }
19
+ export declare abstract class DetailsBase extends HTMLDetailsElement {
20
+ static polyfillExtends: "details";
21
+ static polyfillConnectedCallback(el: HTMLDetailsElement): void;
22
+ static polyfillDisconnectedCallback(el: HTMLDetailsElement): void;
23
+ static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
24
+ disconnectedCallback(): void;
25
+ connectedCallback(): void;
26
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
27
+ }
28
+ export declare abstract class FormBase extends HTMLFormElement {
29
+ static polyfillExtends: "form";
30
+ static polyfillConnectedCallback(el: HTMLFormElement): void;
31
+ static polyfillDisconnectedCallback(el: HTMLFormElement): void;
32
+ static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
33
+ disconnectedCallback(): void;
34
+ connectedCallback(): void;
35
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
36
+ }
@@ -0,0 +1,92 @@
1
+ export class DialogBase extends HTMLDialogElement {
2
+ static polyfillExtends = 'dialog';
3
+ static polyfillConnectedCallback(el) { }
4
+ static polyfillDisconnectedCallback(el) { }
5
+ static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
6
+ disconnectedCallback() {
7
+ const ctor = this.constructor;
8
+ ctor.polyfillDisconnectedCallback(this);
9
+ }
10
+ connectedCallback() {
11
+ const ctor = this.constructor;
12
+ ctor.polyfillConnectedCallback(this);
13
+ }
14
+ attributeChangedCallback(name, oldValue, newValue) {
15
+ const ctor = this.constructor;
16
+ const entry = {
17
+ attributeName: name,
18
+ oldValue,
19
+ target: this,
20
+ };
21
+ ctor.polyfillAttributeChangedCallback([entry]);
22
+ }
23
+ }
24
+ export class ButtonBase extends HTMLButtonElement {
25
+ static polyfillExtends = 'button';
26
+ static polyfillConnectedCallback(el) { }
27
+ static polyfillDisconnectedCallback(el) { }
28
+ static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
29
+ disconnectedCallback() {
30
+ const ctor = this.constructor;
31
+ ctor.polyfillDisconnectedCallback(this);
32
+ }
33
+ connectedCallback() {
34
+ const ctor = this.constructor;
35
+ ctor.polyfillConnectedCallback(this);
36
+ }
37
+ attributeChangedCallback(name, oldValue, newValue) {
38
+ const ctor = this.constructor;
39
+ const entry = {
40
+ attributeName: name,
41
+ oldValue,
42
+ target: this,
43
+ };
44
+ ctor.polyfillAttributeChangedCallback([entry]);
45
+ }
46
+ }
47
+ export class DetailsBase extends HTMLDetailsElement {
48
+ static polyfillExtends = 'details';
49
+ static polyfillConnectedCallback(el) { }
50
+ static polyfillDisconnectedCallback(el) { }
51
+ static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
52
+ disconnectedCallback() {
53
+ const ctor = this.constructor;
54
+ ctor.polyfillDisconnectedCallback(this);
55
+ }
56
+ connectedCallback() {
57
+ const ctor = this.constructor;
58
+ ctor.polyfillConnectedCallback(this);
59
+ }
60
+ attributeChangedCallback(name, oldValue, newValue) {
61
+ const ctor = this.constructor;
62
+ const entry = {
63
+ attributeName: name,
64
+ oldValue,
65
+ target: this,
66
+ };
67
+ ctor.polyfillAttributeChangedCallback([entry]);
68
+ }
69
+ }
70
+ export class FormBase extends HTMLFormElement {
71
+ static polyfillExtends = 'form';
72
+ static polyfillConnectedCallback(el) { }
73
+ static polyfillDisconnectedCallback(el) { }
74
+ static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
75
+ disconnectedCallback() {
76
+ const ctor = this.constructor;
77
+ ctor.polyfillDisconnectedCallback(this);
78
+ }
79
+ connectedCallback() {
80
+ const ctor = this.constructor;
81
+ ctor.polyfillConnectedCallback(this);
82
+ }
83
+ attributeChangedCallback(name, oldValue, newValue) {
84
+ const ctor = this.constructor;
85
+ const entry = {
86
+ attributeName: name,
87
+ oldValue,
88
+ target: this,
89
+ };
90
+ ctor.polyfillAttributeChangedCallback([entry]);
91
+ }
92
+ }
@@ -0,0 +1,7 @@
1
+ export type WebComponentCtor = typeof HTMLElement & {
2
+ observedAttributes?: string[];
3
+ polyfillExtends?: string;
4
+ polyfillConnectedCallback(el: HTMLElement): void;
5
+ polyfillDisconnectedCallback(el: HTMLElement): void;
6
+ polyfillAttributeChangedCallback?(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,7 @@
1
- import type * as Components from '../components';
2
1
  export declare class Snapshot {
3
2
  #private;
3
+ static readonly waitReady: Promise<[unknown, void]>;
4
+ static waitReadyFor<T extends HTMLElement>(element: T): Promise<T | null>;
4
5
  static get config(): Record<string, string> | undefined;
5
6
  static setOwnConfig(): Promise<void>;
6
- static get parent(): Components.ScrollView | undefined;
7
- static get root(): HTMLElement | undefined;
8
- static get leaf(): Components.ScrollView | undefined;
9
- static get parentContainer(): HTMLElement | undefined;
10
- static get leafContainer(): HTMLElement | undefined;
11
- static get container(): HTMLElement | undefined;
12
- static get toolbarItems(): NodeListOf<Element> | undefined;
13
- static get parentToolbarItems(): NodeListOf<Element> | undefined;
14
- static get leafToolbarItems(): NodeListOf<Element> | undefined;
15
- static getSnapshot(scrollView?: Components.ScrollView): void;
16
7
  }
@@ -1,150 +1,37 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _a, _Snapshot_config, _Snapshot_getOwnConfig, _Snapshot_parent, _Snapshot_leaf, _Snapshot_root, _Snapshot_parentContainer, _Snapshot_container, _Snapshot_leafContainer, _Snapshot_parentToolbarItems, _Snapshot_toolbarItems, _Snapshot_leafToolbarItems, _Snapshot_queryScrollViewRels;
13
1
  export class Snapshot {
2
+ static #readyCalled = false;
3
+ static #config;
4
+ static waitReady = Promise.all([
5
+ 'complete' === document.readyState ? Promise.resolve() : new Promise((r) => self.addEventListener('load', r, { once: true })),
6
+ (async () => {
7
+ if (!this.#readyCalled)
8
+ await this.setOwnConfig();
9
+ })(), // Lazy config read promise, triggered on first access
10
+ ]);
11
+ static async waitReadyFor(element) {
12
+ if (!element.isConnected)
13
+ return null;
14
+ await this.waitReady;
15
+ return element.isConnected ? element : null;
16
+ }
14
17
  static get config() {
15
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_config);
18
+ return this.#config;
16
19
  }
17
20
  static async setOwnConfig() {
18
- if ('complete' === document.readyState)
19
- return __classPrivateFieldGet(_a, _a, "m", _Snapshot_getOwnConfig).call(_a); // Page already loaded
20
- await new Promise((resolve) => self.addEventListener('load', resolve)); // Wait for window load
21
- return __classPrivateFieldGet(_a, _a, "m", _Snapshot_getOwnConfig).call(_a);
22
- }
23
- static get parent() {
24
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_parent);
25
- }
26
- static get root() {
27
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_root);
28
- }
29
- static get leaf() {
30
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_leaf);
31
- }
32
- static get parentContainer() {
33
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_parentContainer);
34
- }
35
- static get leafContainer() {
36
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_leafContainer);
37
- }
38
- static get container() {
39
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_container);
40
- }
41
- static get toolbarItems() {
42
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_toolbarItems);
43
- }
44
- static get parentToolbarItems() {
45
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_parentToolbarItems);
46
- }
47
- static get leafToolbarItems() {
48
- return __classPrivateFieldGet(this, _a, "f", _Snapshot_leafToolbarItems);
49
- }
50
- static getSnapshot(scrollView) {
51
- console.debug(`${_a.name} ⚡️ getSnapshot`);
52
- // root
53
- for (let e = scrollView; e; e = e.parentElement)
54
- e.matches('navigation-stack,navigation-split-view') && (__classPrivateFieldSet(this, _a, e, "f", _Snapshot_root));
55
- // current
56
- const { frame, toolbarElements: toolbarItems } = __classPrivateFieldGet(this, _a, "f", _Snapshot_queryScrollViewRels).call(this, scrollView);
57
- __classPrivateFieldSet(this, _a, frame, "f", _Snapshot_container);
58
- __classPrivateFieldSet(this, _a, toolbarItems, "f", _Snapshot_toolbarItems);
59
- // parent
60
- const possibleParent = __classPrivateFieldGet(this, _a, "f", _Snapshot_container)?.parentElement;
61
- __classPrivateFieldSet(this, _a, possibleParent?.querySelector(`:scope > scroll-view,:scope > [is=sidebar-view] > scroll-view`) ?? undefined, "f", _Snapshot_parent); //const sv2 = pr.parentElement.querySelector(`:scope > scroll-view`) //pr.previousElementSibling
62
- const { frame: parentFrame, toolbarElements: parentToolbarItems } = __classPrivateFieldGet(this, _a, "f", _Snapshot_queryScrollViewRels).call(this, __classPrivateFieldGet(this, _a, "f", _Snapshot_parent));
63
- __classPrivateFieldSet(this, _a, parentFrame, "f", _Snapshot_parentContainer);
64
- __classPrivateFieldSet(this, _a, parentToolbarItems, "f", _Snapshot_parentToolbarItems);
65
- // const possibleParent =
66
- // this.#container?.parentElement?.querySelector<HTMLElement>(
67
- // `:scope > scroll-view,:scope > [is=sidebar-view] > scroll-view`
68
- // ) ?? undefined, //const sv2 = pr.parentElement.querySelector(`:scope > scroll-view`) //pr.previousElementSibling
69
- // {
70
- // landmark: parentLm,
71
- // frame: parentFrame,
72
- // toolbarElements: parentToolbarItems,
73
- // } = this.#queryScrollViewRels(possibleParent)
74
- // this.#parent = parentLm
75
- // this.#parentContainer = parentFrame
76
- // this.#parentToolbarItems = parentToolbarItems
77
- // detect children
78
- let possibleNest = scrollView?.nextElementSibling;
79
- if ('NAVIGATION-SPLIT-VIEW' === __classPrivateFieldGet(this, _a, "f", _Snapshot_root)?.tagName)
80
- if (scrollView?.matches(`navigation-split-view > scroll-view${null !== __classPrivateFieldGet(this, _a, "f", _Snapshot_root).querySelector(':scope > [is=sidebar-view]') ? ',navigation-split-view > [is=sidebar-view] > scroll-view,navigation-split-view > body-view > scroll-view' : ''}`))
81
- possibleNest = (scrollView?.parentElement?.matches('dialog[is=sidebar-view]')
82
- ? scrollView?.parentElement
83
- : scrollView)?.previousElementSibling; // look for prev sibling instead
84
- // const possibleNest = scrollView?.nextElementSibling as HTMLElement | null
85
- __classPrivateFieldSet(this, _a, [
86
- ...(possibleNest?.querySelectorAll('scroll-view:not(navigation-stack[hidden] scroll-view,navigation-split-view[hidden] scroll-view)') ?? []),
87
- ]?.pop?.(), "f", _Snapshot_leaf); //'navigation-stack:not([hidden]) scroll-view'
88
- const { frame: leafFrame, toolbarElements: leafToolbarItems } = __classPrivateFieldGet(this, _a, "f", _Snapshot_queryScrollViewRels).call(this, __classPrivateFieldGet(this, _a, "f", _Snapshot_leaf));
89
- __classPrivateFieldSet(this, _a, leafFrame, "f", _Snapshot_leafContainer);
90
- __classPrivateFieldSet(this, _a, leafToolbarItems, "f", _Snapshot_leafToolbarItems);
91
- // const {
92
- // landmark: leafLm,
93
- // frame: leafFrame,
94
- // toolbarElements: leafToolbarItems,
95
- // } = this.#queryScrollViewRels(
96
- // [
97
- // ...(possibleNest?.querySelectorAll<Components.ScrollView>(
98
- // 'scroll-view:not(navigation-stack[hidden] scroll-view,navigation-split-view[hidden] scroll-view)'
99
- // ) ?? []),
100
- // ]?.pop?.()
101
- // ) //'navigation-stack:not([hidden]) scroll-view'
102
- // this.#leaf = leafLm
103
- // this.#leafContainer = leafFrame
104
- // this.#leafToolbarItems = leafToolbarItems
105
- console.debug(`${__classPrivateFieldGet(this, _a, "f", _Snapshot_root)?.tagName}
106
- / \\
107
- B ${__classPrivateFieldGet(this, _a, "f", _Snapshot_parentContainer)?.tagName}
108
- / \\
109
- D ${__classPrivateFieldGet(this, _a, "f", _Snapshot_container)?.tagName}
110
- / \\
111
- H ${__classPrivateFieldGet(this, _a, "f", _Snapshot_leafContainer)?.tagName}
112
- `);
113
- // this.#childFrame = ['BODY-VIEW', 'NAVIGATION-STACK'].includes(
114
- // possibleNest?.tagName ?? ''
115
- // )
116
- // ? (possibleNest ?? undefined)
117
- // : undefined
118
- // this.#childToolbarItems = this.#childFrame?.querySelectorAll(
119
- // `:scope > navigation-bar > tool-bar-item,:scope > bottom-bar > tool-bar-item`
120
- // )
21
+ if (!this.#readyCalled)
22
+ this.#readyCalled = true;
23
+ if ('complete' !== document.readyState)
24
+ await new Promise((r) => self.addEventListener('load', r, { once: true }));
25
+ this.#getOwnConfig();
26
+ }
27
+ static #getOwnConfig() {
28
+ const style = self.getComputedStyle(document.documentElement, '::before'), content = style.getPropertyValue('content'), unquoted = content.replace(/^"(.*)"$/, '$1'); // Remove quotes around the content
29
+ try {
30
+ this.#config = Object.fromEntries(new URLSearchParams(unquoted).entries()); // {"none": ""}
31
+ }
32
+ catch {
33
+ console.error('could-not-parse-config');
34
+ }
35
+ console.debug(this.#config);
121
36
  }
122
37
  }
123
- _a = Snapshot, _Snapshot_getOwnConfig = function _Snapshot_getOwnConfig() {
124
- const style = getComputedStyle(document.documentElement, '::before'), content = style.getPropertyValue('content'), unquoted = content.replace(/^"(.*)"$/, '$1'); // Remove quotes around the content
125
- try {
126
- __classPrivateFieldSet(this, _a, Object.fromEntries(new URLSearchParams(unquoted).entries()), "f", _Snapshot_config); // {"none": ""}
127
- }
128
- catch {
129
- console.error('could-not-parse-config');
130
- }
131
- console.debug(__classPrivateFieldGet(this, _a, "f", _Snapshot_config));
132
- };
133
- _Snapshot_config = { value: void 0 };
134
- //////
135
- _Snapshot_parent = { value: void 0 };
136
- _Snapshot_leaf = { value: void 0 };
137
- _Snapshot_root = { value: void 0 };
138
- _Snapshot_parentContainer = { value: void 0 };
139
- _Snapshot_container = { value: void 0 };
140
- _Snapshot_leafContainer = { value: void 0 };
141
- _Snapshot_parentToolbarItems = { value: void 0 };
142
- _Snapshot_toolbarItems = { value: void 0 };
143
- _Snapshot_leafToolbarItems = { value: void 0 };
144
- _Snapshot_queryScrollViewRels = { value: (sv) => {
145
- const isSidebarWrapped = sv?.parentElement?.matches('dialog[is=sidebar-view]');
146
- return {
147
- frame: (isSidebarWrapped ? sv?.parentElement : sv)?.parentElement ?? undefined,
148
- toolbarElements: sv?.parentElement?.querySelectorAll(`:scope > navigation-bar > tool-bar-item,:scope > bottom-bar > tool-bar-item,:scope > navigation-bar > tool-bar-item-group,:scope > bottom-bar > tool-bar-item-group`),
149
- };
150
- } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.7",
3
+ "version": "0.0.0-dev.8",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "files": [
22
22
  "generated",
23
- "scss"
23
+ "scss",
24
+ "web-components.html-data"
24
25
  ],
25
26
  "sass": "scss/index.scss",
26
27
  "keywords": [
@@ -42,9 +43,10 @@
42
43
  "types": "./generated/client/index.d.ts",
43
44
  "default": "./generated/client/index.js"
44
45
  },
45
- "./styles.css": "./generated/styles.css",
46
+ "./css": "./generated/css/index.css",
46
47
  "./scss": "./scss/index.scss",
47
- "./scss/*": "./scss/*.scss"
48
+ "./scss/*": "./scss/*.scss",
49
+ "./customElements/en": "./custom-elements/en.json"
48
50
  },
49
51
  "bin": {
50
52
  "swiftwc": "./generated/index.js"
@@ -54,11 +56,20 @@
54
56
  "build": "npm run build:ts && npm run build:scss",
55
57
  "build:ts:watch": "npm run prebuild && tsc --watch",
56
58
  "build:ts": "tsc",
57
- "build:scss": "sass --no-source-map scss/index.scss generated/styles.css",
59
+ "build:scss": "sass --style=expanded --no-source-map scss/index.scss generated/css/index.css",
60
+ "build:manifest": "tsx scripts/make-manifest.ts",
61
+ "build:barrels": "barrelsby -D -q -S -d ./js/components -e \".\\.test\\.ts\"",
58
62
  "format:check": "prettier . --check",
59
- "format:write": "prettier . --write"
63
+ "format:write": "prettier . --write",
64
+ "test": "vitest --dom"
60
65
  },
61
66
  "devDependencies": {
62
- "sass": "^1.97.2"
63
- }
67
+ "doctrine": "^3.0.0",
68
+ "happy-dom": "^20.7.0",
69
+ "sass": "^1.98.0",
70
+ "ts-morph": "^28.0.0",
71
+ "tsx": "^4.21.0",
72
+ "vitest": "^4.0.18"
73
+ },
74
+ "customElements": "custom-elements/en.json"
64
75
  }
@@ -4,36 +4,72 @@
4
4
 
5
5
  @forward 'components/disclosure-group';
6
6
 
7
- @forward 'components/body-view';
8
-
9
- @forward 'components/tab-view';
10
-
11
- @forward 'components/tab-bar';
12
-
13
- @forward 'components/tab-bar-stack';
14
-
15
- @forward 'components/sidebar-toggle';
7
+ @forward 'components/h-divider';
8
+ @forward 'components/v-divider';
16
9
 
17
10
  @forward 'components/full-screen';
18
11
 
19
- @forward 'components/sheet-view';
20
-
21
- @forward 'components/navigation-stack';
12
+ @forward 'components/detail-placeholder';
22
13
 
23
- @forward 'components/navigation-split-view';
14
+ @forward 'components/sticky-container';
24
15
 
25
- @forward 'components/toolbars';
16
+ @forward 'components/sheet-view';
26
17
 
27
- @forward 'components/sidebar-view';
18
+ @forward 'components/confirmation-dialog';
28
19
 
29
20
  @forward 'components/scroll-view';
21
+ @forward 'components/scroll-view-proxy';
30
22
 
23
+ @forward 'components/h-stack';
31
24
  @forward 'components/v-stack';
25
+ @forward 'components/v-flex-stack';
32
26
 
33
- @forward 'components/tool-bar';
27
+ @forward 'components/scroll-view-toolbars';
34
28
 
35
29
  @forward 'components/tool-bar-item';
36
30
 
37
31
  @forward 'components/tool-bar-item-group';
38
32
 
33
+ @forward 'components/plain-button';
39
34
  @forward 'components/borderless-button';
35
+ @forward 'components/bordered-button';
36
+ @forward 'components/bordered-prominent-button';
37
+ @forward 'components/glass-button';
38
+ @forward 'components/glass-prominent-button';
39
+
40
+ @forward 'components/tool-bar';
41
+
42
+ @forward 'components/label-view';
43
+
44
+ @forward 'components/labeled-content';
45
+
46
+ // @forward 'components/button-view';
47
+
48
+ @forward 'components/body-view';
49
+
50
+ @forward 'components/navigation-large-title';
51
+ @forward 'components/navigation-title';
52
+
53
+ @forward 'components/sidebar-toggle';
54
+
55
+ @forward 'components/menu-view';
56
+
57
+ @forward 'components/sidebar-view';
58
+
59
+ @forward 'components/list-view';
60
+ @forward 'components/form-view';
61
+ @forward 'components/section-view';
62
+ @forward 'components/table-view';
63
+ @forward 'components/table-row';
64
+ @forward 'components/table-column';
65
+
66
+ @forward 'components/text-field';
67
+ @forward 'components/date-picker';
68
+ @forward 'components/picker-view';
69
+
70
+ @forward 'components/navigation-stack';
71
+ @forward 'components/navigation-split-view';
72
+
73
+ @forward 'components/tab-view';
74
+ @forward 'components/tab-bar';
75
+ @forward 'components/tab-item';
@@ -0,0 +1 @@
1
+ @forward 'final/touch-glass';