@swiftwc/ui 0.0.0-dev.33 → 0.0.0-dev.34

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.
@@ -31,7 +31,7 @@ export class BorderedButton extends ButtonBase {
31
31
  case 'title-key':
32
32
  case 'role':
33
33
  Snapshot.waitReady.then(() => {
34
- buttonRole(target, target.getAttribute('role'), target.getAttribute('title-key'));
34
+ buttonRole(target, target, target.getAttribute('role'), target.getAttribute('title-key'));
35
35
  });
36
36
  break;
37
37
  }
@@ -31,7 +31,7 @@ export class BorderedProminentButton extends ButtonBase {
31
31
  case 'title-key':
32
32
  case 'role':
33
33
  Snapshot.waitReady.then(() => {
34
- buttonRole(target, target.getAttribute('role'), target.getAttribute('title-key'));
34
+ buttonRole(target, target, target.getAttribute('role'), target.getAttribute('title-key'));
35
35
  });
36
36
  break;
37
37
  }
@@ -31,7 +31,7 @@ export class BorderlessButton extends ButtonBase {
31
31
  case 'title-key':
32
32
  case 'role':
33
33
  Snapshot.waitReady.then(() => {
34
- buttonRole(target, target.getAttribute('role'), target.getAttribute('title-key'));
34
+ buttonRole(target, target, target.getAttribute('role'), target.getAttribute('title-key'));
35
35
  });
36
36
  break;
37
37
  }
@@ -31,7 +31,7 @@ export class GlassButton extends ButtonBase {
31
31
  case 'title-key':
32
32
  case 'role':
33
33
  Snapshot.waitReady.then(() => {
34
- buttonRole(target, target.getAttribute('role'), target.getAttribute('title-key'));
34
+ buttonRole(target, target, target.getAttribute('role'), target.getAttribute('title-key'));
35
35
  });
36
36
  break;
37
37
  }
@@ -31,7 +31,7 @@ export class GlassProminentButton extends ButtonBase {
31
31
  case 'title-key':
32
32
  case 'role':
33
33
  Snapshot.waitReady.then(() => {
34
- buttonRole(target, target.getAttribute('role'), target.getAttribute('title-key'));
34
+ buttonRole(target, target, target.getAttribute('role'), target.getAttribute('title-key'));
35
35
  });
36
36
  break;
37
37
  }
@@ -45,7 +45,7 @@ export class ToolBarItem extends HTMLElement {
45
45
  const target = this.querySelector(':scope>button'), nv = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '';
46
46
  if (target && ['confirmation-action', 'cancellation-action'].includes(nv))
47
47
  Snapshot.waitReady.then(() => {
48
- buttonRole(target, nv, this.getAttribute('title-key'));
48
+ buttonRole(this, target, nv, this.getAttribute('title-key'));
49
49
  });
50
50
  break;
51
51
  }
@@ -1710,7 +1710,7 @@
1710
1710
  color: var(--text, );
1711
1711
  touch-action: none;
1712
1712
  position: fixed;
1713
- inline-size: max-content;
1713
+ inline-size: var(--confirmation--dialog-inline-size, anchor-size());
1714
1714
  block-size: fit-content;
1715
1715
  height: auto;
1716
1716
  max-inline-size: var(--confirmation--dialog-max-inline-size, );
@@ -1718,6 +1718,7 @@
1718
1718
  margin-block: var(--confirmation--dialog-margin-block, );
1719
1719
  margin-inline: var(--confirmation--dialog-margin-inline, );
1720
1720
  transform: var(--confirmation--dialog-scale, );
1721
+ opacity: var(--confirmation--dialog-opacity, );
1721
1722
  position-anchor: --confirmation-dialog;
1722
1723
  position-area: center;
1723
1724
  overflow: clip;
@@ -1727,24 +1728,30 @@
1727
1728
  padding-block: 1rem;
1728
1729
  padding-inline: 1rem;
1729
1730
  gap: 1rem;
1730
- --confirmation--dialog-scale: scale(0);
1731
+ --confirmation--dialog-scale: scale(0.7);
1732
+ --confirmation--dialog-opacity: 0.8;
1731
1733
  }
1732
1734
  :where([is=confirmation-dialog][open]) {
1735
+ --confirmation--dialog-inline-size: min(20rem, 80vw);
1733
1736
  --confirmation--dialog-max-inline-size: min(20rem, 80vw);
1734
1737
  --confirmation--dialog-max-block-size: 80vh;
1735
1738
  --confirmation--dialog-margin-block: max(env(safe-area-inset-top), var(--menu-spacing)) max(env(safe-area-inset-bottom), var(--menu-spacing));
1736
1739
  --confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
1737
1740
  --confirmation--dialog-scale: scale(1);
1741
+ --confirmation--dialog-opacity: 1;
1738
1742
  }
1739
1743
  @starting-style {
1740
1744
  :where([is=confirmation-dialog][open]) {
1741
- --confirmation--dialog-scale: scale(0);
1745
+ --confirmation--dialog-scale: scale(0.7);
1746
+ --confirmation--dialog-opacity: 0.8;
1742
1747
  }
1743
1748
  }
1744
1749
  :where([is=confirmation-dialog][closing]) {
1750
+ --confirmation--dialog-inline-size: anchor-size();
1745
1751
  --confirmation--dialog-max-inline-size: anchor-size();
1746
1752
  --confirmation--dialog-max-block-size: anchor-size();
1747
- --confirmation--dialog-scale: scale(0);
1753
+ --confirmation--dialog-scale: scale(0.7);
1754
+ --confirmation--dialog-opacity: 0;
1748
1755
  }
1749
1756
  }
1750
1757
  @layer sw-components {
@@ -1 +1 @@
1
- export default function (target: HTMLElement, role: string | null, titleKey?: string | null): void;
1
+ export default function (host: HTMLElement, target: HTMLElement, role: string | null, titleKey?: string | null): void;
@@ -48,15 +48,15 @@ function ensurePlaceholder(el, role, titleKey) {
48
48
  // } else label?.remove()
49
49
  // })
50
50
  }
51
- export default function (target, role, titleKey) {
51
+ export default function (host, target, role, titleKey) {
52
52
  const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
53
53
  ensurePlaceholder(target, role, overiderTitle);
54
- if (observing.has(target))
55
- observing.get(target)?.disconnect();
54
+ if (observing.has(host))
55
+ observing.get(host)?.disconnect();
56
56
  CleanupRegistry.unregister(target, 'i18n');
57
57
  CleanupRegistry.register(target, onoff('localechange', () => ensurePlaceholder(target, role, overiderTitle), I18n.on).on(), 'i18n');
58
- observing.set(target, new MutationObserver(() => ensurePlaceholder(target, role, overiderTitle)));
59
- observing.get(target)?.observe(target, {
58
+ observing.set(host, new MutationObserver(() => ensurePlaceholder(target, role, overiderTitle)));
59
+ observing.get(host)?.observe(host, {
60
60
  childList: true,
61
61
  });
62
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.33",
3
+ "version": "0.0.0-dev.34",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,7 @@
12
12
 
13
13
  position: fixed;
14
14
 
15
- inline-size: max-content;
15
+ inline-size: var(--confirmation--dialog-inline-size, anchor-size());
16
16
  block-size: fit-content;
17
17
  height: auto; // safari
18
18
 
@@ -27,6 +27,8 @@
27
27
  transform: var(--confirmation--dialog-scale,);
28
28
  // transform-origin: top left;
29
29
 
30
+ opacity: var(--confirmation--dialog-opacity,);
31
+
30
32
  position-anchor: --confirmation-dialog; // overriden
31
33
  position-area: center;
32
34
 
@@ -41,11 +43,13 @@
41
43
  gap: 1rem;
42
44
 
43
45
  // finally
44
- --confirmation--dialog-scale: scale(0);
46
+ --confirmation--dialog-scale: scale(0.7);
47
+ --confirmation--dialog-opacity: 0.8;
45
48
  }
46
49
 
47
50
  &[open] {
48
51
  :where(&) {
52
+ --confirmation--dialog-inline-size: min(20rem, 80vw);
49
53
  // --confirmation--dialog-min-inline-size: min(20rem, 80svw);
50
54
 
51
55
  --confirmation--dialog-max-inline-size: min(20rem, 80vw);
@@ -55,21 +59,25 @@
55
59
  --confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
56
60
 
57
61
  --confirmation--dialog-scale: scale(1);
62
+ --confirmation--dialog-opacity: 1;
58
63
 
59
64
  @starting-style {
60
- --confirmation--dialog-scale: scale(0);
65
+ --confirmation--dialog-scale: scale(0.7);
66
+ --confirmation--dialog-opacity: 0.8;
61
67
  }
62
68
  }
63
69
  }
64
70
 
65
71
  &[closing] {
66
72
  :where(&) {
73
+ --confirmation--dialog-inline-size: anchor-size();
67
74
  // --confirmation--dialog-min-inline-size: anchor-size();
68
75
 
69
76
  --confirmation--dialog-max-inline-size: anchor-size();
70
77
  --confirmation--dialog-max-block-size: anchor-size();
71
78
 
72
- --confirmation--dialog-scale: scale(0);
79
+ --confirmation--dialog-scale: scale(0.7);
80
+ --confirmation--dialog-opacity: 0;
73
81
  }
74
82
  }
75
83
  }