@swiftwc/ui 0.0.0-dev.32 → 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.
- package/generated/components/bordered-button.js +1 -1
- package/generated/components/bordered-prominent-button.js +1 -1
- package/generated/components/borderless-button.js +1 -1
- package/generated/components/glass-button.js +1 -1
- package/generated/components/glass-prominent-button.js +1 -1
- package/generated/components/tool-bar-item.js +1 -1
- package/generated/css/index.css +11 -7
- package/generated/internal/utils/button-role.d.ts +1 -1
- package/generated/internal/utils/button-role.js +11 -6
- package/package.json +1 -1
- package/scss/components/_confirmation-dialog.scss +16 -49
- package/scss/transitions/_confirmation-dialog.scss +9 -0
|
@@ -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
|
}
|
package/generated/css/index.css
CHANGED
|
@@ -1710,15 +1710,15 @@
|
|
|
1710
1710
|
color: var(--text, );
|
|
1711
1711
|
touch-action: none;
|
|
1712
1712
|
position: fixed;
|
|
1713
|
-
inline-size:
|
|
1713
|
+
inline-size: var(--confirmation--dialog-inline-size, anchor-size());
|
|
1714
1714
|
block-size: fit-content;
|
|
1715
1715
|
height: auto;
|
|
1716
|
-
min-inline-size: var(--confirmation--dialog-min-inline-size, );
|
|
1717
1716
|
max-inline-size: var(--confirmation--dialog-max-inline-size, );
|
|
1718
1717
|
max-block-size: var(--confirmation--dialog-max-block-size, );
|
|
1719
1718
|
margin-block: var(--confirmation--dialog-margin-block, );
|
|
1720
1719
|
margin-inline: var(--confirmation--dialog-margin-inline, );
|
|
1721
1720
|
transform: var(--confirmation--dialog-scale, );
|
|
1721
|
+
opacity: var(--confirmation--dialog-opacity, );
|
|
1722
1722
|
position-anchor: --confirmation-dialog;
|
|
1723
1723
|
position-area: center;
|
|
1724
1724
|
overflow: clip;
|
|
@@ -1728,26 +1728,30 @@
|
|
|
1728
1728
|
padding-block: 1rem;
|
|
1729
1729
|
padding-inline: 1rem;
|
|
1730
1730
|
gap: 1rem;
|
|
1731
|
-
--confirmation--dialog-scale: scale(0);
|
|
1731
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
1732
|
+
--confirmation--dialog-opacity: 0.8;
|
|
1732
1733
|
}
|
|
1733
1734
|
:where([is=confirmation-dialog][open]) {
|
|
1734
|
-
--confirmation--dialog-
|
|
1735
|
+
--confirmation--dialog-inline-size: min(20rem, 80vw);
|
|
1735
1736
|
--confirmation--dialog-max-inline-size: min(20rem, 80vw);
|
|
1736
1737
|
--confirmation--dialog-max-block-size: 80vh;
|
|
1737
1738
|
--confirmation--dialog-margin-block: max(env(safe-area-inset-top), var(--menu-spacing)) max(env(safe-area-inset-bottom), var(--menu-spacing));
|
|
1738
1739
|
--confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
|
|
1739
1740
|
--confirmation--dialog-scale: scale(1);
|
|
1741
|
+
--confirmation--dialog-opacity: 1;
|
|
1740
1742
|
}
|
|
1741
1743
|
@starting-style {
|
|
1742
1744
|
:where([is=confirmation-dialog][open]) {
|
|
1743
|
-
--confirmation--dialog-scale: scale(0);
|
|
1745
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
1746
|
+
--confirmation--dialog-opacity: 0.8;
|
|
1744
1747
|
}
|
|
1745
1748
|
}
|
|
1746
1749
|
:where([is=confirmation-dialog][closing]) {
|
|
1747
|
-
--confirmation--dialog-
|
|
1750
|
+
--confirmation--dialog-inline-size: anchor-size();
|
|
1748
1751
|
--confirmation--dialog-max-inline-size: anchor-size();
|
|
1749
1752
|
--confirmation--dialog-max-block-size: anchor-size();
|
|
1750
|
-
--confirmation--dialog-scale: scale(0);
|
|
1753
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
1754
|
+
--confirmation--dialog-opacity: 0;
|
|
1751
1755
|
}
|
|
1752
1756
|
}
|
|
1753
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;
|
|
@@ -3,7 +3,8 @@ import { Snapshot } from '../../snapshot';
|
|
|
3
3
|
import { CleanupRegistry } from '../class/cleanup-registry';
|
|
4
4
|
import { default as $ } from './cash';
|
|
5
5
|
import onoff from './onoff';
|
|
6
|
-
|
|
6
|
+
const observing = new WeakMap();
|
|
7
|
+
function ensurePlaceholder(el, role, titleKey) {
|
|
7
8
|
// if (!el.isConnected) return
|
|
8
9
|
// self.requestAnimationFrame(() => {
|
|
9
10
|
// if (!el.isConnected) return
|
|
@@ -47,11 +48,15 @@ function renderPlaceholder(el, role, titleKey) {
|
|
|
47
48
|
// } else label?.remove()
|
|
48
49
|
// })
|
|
49
50
|
}
|
|
50
|
-
export default function (target, role, titleKey) {
|
|
51
|
+
export default function (host, target, role, titleKey) {
|
|
51
52
|
const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
|
|
52
|
-
|
|
53
|
+
ensurePlaceholder(target, role, overiderTitle);
|
|
54
|
+
if (observing.has(host))
|
|
55
|
+
observing.get(host)?.disconnect();
|
|
53
56
|
CleanupRegistry.unregister(target, 'i18n');
|
|
54
|
-
CleanupRegistry.register(target, onoff('localechange', () =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
CleanupRegistry.register(target, onoff('localechange', () => ensurePlaceholder(target, role, overiderTitle), I18n.on).on(), 'i18n');
|
|
58
|
+
observing.set(host, new MutationObserver(() => ensurePlaceholder(target, role, overiderTitle)));
|
|
59
|
+
observing.get(host)?.observe(host, {
|
|
60
|
+
childList: true,
|
|
61
|
+
});
|
|
57
62
|
}
|
package/package.json
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
position: fixed;
|
|
14
14
|
|
|
15
|
-
inline-size:
|
|
15
|
+
inline-size: var(--confirmation--dialog-inline-size, anchor-size());
|
|
16
16
|
block-size: fit-content;
|
|
17
17
|
height: auto; // safari
|
|
18
18
|
|
|
19
|
-
min-inline-size: var(--confirmation--dialog-min-inline-size,);
|
|
19
|
+
// min-inline-size: var(--confirmation--dialog-min-inline-size,);
|
|
20
20
|
|
|
21
21
|
max-inline-size: var(--confirmation--dialog-max-inline-size,);
|
|
22
22
|
max-block-size: var(--confirmation--dialog-max-block-size,);
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
margin-inline: var(--confirmation--dialog-margin-inline,);
|
|
26
26
|
|
|
27
27
|
transform: var(--confirmation--dialog-scale,);
|
|
28
|
+
// transform-origin: top left;
|
|
29
|
+
|
|
30
|
+
opacity: var(--confirmation--dialog-opacity,);
|
|
28
31
|
|
|
29
32
|
position-anchor: --confirmation-dialog; // overriden
|
|
30
33
|
position-area: center;
|
|
@@ -40,12 +43,14 @@
|
|
|
40
43
|
gap: 1rem;
|
|
41
44
|
|
|
42
45
|
// finally
|
|
43
|
-
--confirmation--dialog-scale: scale(0);
|
|
46
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
47
|
+
--confirmation--dialog-opacity: 0.8;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
&[open] {
|
|
47
51
|
:where(&) {
|
|
48
|
-
--confirmation--dialog-
|
|
52
|
+
--confirmation--dialog-inline-size: min(20rem, 80vw);
|
|
53
|
+
// --confirmation--dialog-min-inline-size: min(20rem, 80svw);
|
|
49
54
|
|
|
50
55
|
--confirmation--dialog-max-inline-size: min(20rem, 80vw);
|
|
51
56
|
--confirmation--dialog-max-block-size: 80vh;
|
|
@@ -54,64 +59,26 @@
|
|
|
54
59
|
--confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
|
|
55
60
|
|
|
56
61
|
--confirmation--dialog-scale: scale(1);
|
|
62
|
+
--confirmation--dialog-opacity: 1;
|
|
57
63
|
|
|
58
64
|
@starting-style {
|
|
59
|
-
--confirmation--dialog-scale: scale(0);
|
|
65
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
66
|
+
--confirmation--dialog-opacity: 0.8;
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
&[closing] {
|
|
65
72
|
:where(&) {
|
|
66
|
-
--confirmation--dialog-
|
|
73
|
+
--confirmation--dialog-inline-size: anchor-size();
|
|
74
|
+
// --confirmation--dialog-min-inline-size: anchor-size();
|
|
67
75
|
|
|
68
76
|
--confirmation--dialog-max-inline-size: anchor-size();
|
|
69
77
|
--confirmation--dialog-max-block-size: anchor-size();
|
|
70
78
|
|
|
71
|
-
--confirmation--dialog-scale: scale(0);
|
|
79
|
+
--confirmation--dialog-scale: scale(0.7);
|
|
80
|
+
--confirmation--dialog-opacity: 0;
|
|
72
81
|
}
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
// SECTION: componentize
|
|
76
|
-
// > button {
|
|
77
|
-
// :where(&) {
|
|
78
|
-
// @include mixins.componentize(dialogbtn);
|
|
79
|
-
// }
|
|
80
|
-
// }
|
|
81
|
-
|
|
82
|
-
// :where(&) {
|
|
83
|
-
// --dialogbtnpadistart: 0.6rem;
|
|
84
|
-
// --dialogbtnpadiend: 0.6rem;
|
|
85
|
-
// --dialogbtnpadbstart: 0.6rem;
|
|
86
|
-
// --dialogbtnpadbend: 0.6rem;
|
|
87
|
-
// --dialogbtnradiustl: 1rem;
|
|
88
|
-
// --dialogbtnradiustr: 1rem;
|
|
89
|
-
// --dialogbtnradiusbl: 1rem;
|
|
90
|
-
// --dialogbtnradiusbr: 1rem;
|
|
91
|
-
// }
|
|
92
83
|
}
|
|
93
84
|
}
|
|
94
|
-
|
|
95
|
-
// @layer #{vars.$colors-layer} {
|
|
96
|
-
// // SECTION: componentize
|
|
97
|
-
// [is='confirmation-dialog'] {
|
|
98
|
-
// > button {
|
|
99
|
-
// @include mixins.add-focus-visible-state {
|
|
100
|
-
// --dialogbtnface: var(--dialogbtnhighlightface,);
|
|
101
|
-
// --dialogbtntext: var(--dialogbtnhighlighttext,);
|
|
102
|
-
// }
|
|
103
|
-
// }
|
|
104
|
-
// }
|
|
105
|
-
// }
|
|
106
|
-
|
|
107
|
-
// @layer #{vars.$ui-layer} {
|
|
108
|
-
// // SECTION: componentize
|
|
109
|
-
// [is='confirmation-dialog'] {
|
|
110
|
-
// > button {
|
|
111
|
-
// @include mixins.add-active-state {
|
|
112
|
-
// --dialogbtnface: var(--dialogbtnactiveface,);
|
|
113
|
-
// --dialogbtntext: var(--dialogbtnactivetext,);
|
|
114
|
-
// }
|
|
115
|
-
// }
|
|
116
|
-
// }
|
|
117
|
-
// }
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
@media (prefers-reduced-motion: no-preference) {
|
|
6
6
|
[is='confirmation-dialog'] {
|
|
7
7
|
:where(&) {
|
|
8
|
+
// transition:
|
|
9
|
+
// inset var(--menu-animation-duration) allow-discrete ease-out,
|
|
10
|
+
// width var(--menu-animation-duration) allow-discrete ease-out,
|
|
11
|
+
// height var(--menu-animation-duration) allow-discrete ease-out,
|
|
12
|
+
// block-size var(--menu-animation-duration) allow-discrete ease-out,
|
|
13
|
+
// inline-size var(--menu-animation-duration) allow-discrete ease-out,
|
|
14
|
+
// display var(--menu-animation-duration) allow-discrete ease-out,
|
|
15
|
+
// overlay var(--menu-animation-duration) allow-discrete ease-out,
|
|
16
|
+
// transform var(--menu-animation-duration) allow-discrete ease-out;
|
|
8
17
|
transition: all var(--touchglass-transition-duration) allow-discrete ease-out;
|
|
9
18
|
// will-change: block-size, inline-size, transform, overlay, display;
|
|
10
19
|
}
|