@swiftwc/ui 0.0.0-dev.27 → 0.0.0-dev.28

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.
@@ -19,7 +19,7 @@ export declare const alert: (title?: string, message?: string, actions?: {
19
19
  }[], options?: {
20
20
  titleVisibility?: boolean;
21
21
  }) => Promise<void>;
22
- export declare const confirmationDialog: (trigger: HTMLElement, title: string, actions?: {
22
+ export declare const confirmationDialog: (trigger: HTMLElement, title: string, message?: string, actions?: {
23
23
  label?: string;
24
24
  image?: string;
25
25
  role?: string;
@@ -356,15 +356,20 @@ export const alert = async (title, message, actions, options) => {
356
356
  return promise;
357
357
  });
358
358
  };
359
- export const confirmationDialog = async (trigger, title, actions, options) => {
359
+ export const confirmationDialog = async (trigger, title, message, actions, options) => {
360
360
  const newAnchorName = `--confirmation-dialog-${self.crypto.randomUUID()}`;
361
- const dialog = $(`<dialog is="confirmation-dialog"></dialog>`, '>1');
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
362
  trigger.style.setProperty('anchor-name', newAnchorName, 'important'); //$.prop('anchor-name', newAnchorName, trigger, 'important')
363
363
  dialog.style.setProperty('position-anchor', newAnchorName); //$.prop('position-anchor', newAnchorName, dialog)
364
364
  if (title && false !== options?.titleVisibility) {
365
- const label = $(`<label-view></label-view>`, '>1');
365
+ const label = $(`<label-view font="headline"></label-view>`, '>1');
366
366
  label.setAttribute('title', title);
367
- dialog.insertAdjacentElement('beforeend', label);
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);
368
373
  }
369
374
  for (const [index, action] of (actions ?? []).entries()) {
370
375
  const btn = $(`<button type="button" tabindex="0" is="bordered-button"></button>`, '>1');
@@ -43,7 +43,7 @@ export class ToolBarItem extends HTMLElement {
43
43
  case 'data-previous-slot':
44
44
  case 'title-key':
45
45
  const target = this.querySelector(':scope>button'), nv = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '';
46
- if (target && ['confirmation-action'].includes(nv))
46
+ if (target && ['confirmation-action', 'cancellation-action'].includes(nv))
47
47
  Snapshot.waitReady.then(() => {
48
48
  buttonRole(target, nv, this.getAttribute('title-key'));
49
49
  });
@@ -1695,12 +1695,12 @@
1695
1695
  color: var(--text, );
1696
1696
  touch-action: none;
1697
1697
  position: fixed;
1698
- inline-size: max-content;
1699
- block-size: max-content;
1698
+ inline-size: fit-content;
1699
+ block-size: fit-content;
1700
1700
  height: auto;
1701
1701
  min-inline-size: min(20rem, 80svw);
1702
- max-inline-size: var(--confirmation--dialog-max-inline-size, );
1703
- max-block-size: var(--confirmation--dialog-max-block-size, );
1702
+ max-inline-size: min(20rem, 80vw);
1703
+ max-block-size: 80vh;
1704
1704
  margin-block: var(--confirmation--dialog-margin-block, );
1705
1705
  margin-inline: var(--confirmation--dialog-margin-inline, );
1706
1706
  transform: var(--confirmation--dialog-scale, );
@@ -1712,12 +1712,10 @@
1712
1712
  box-shadow: var(--menu-popover-box-shadow, );
1713
1713
  padding-block: 1rem;
1714
1714
  padding-inline: 1rem;
1715
- gap: 0.5rem;
1715
+ gap: 1rem;
1716
1716
  --confirmation--dialog-scale: scale(0);
1717
1717
  }
1718
1718
  :where([is=confirmation-dialog][open]) {
1719
- --confirmation--dialog-max-inline-size: 100vw;
1720
- --confirmation--dialog-max-block-size: 100vh;
1721
1719
  --confirmation--dialog-margin-block: max(env(safe-area-inset-top), var(--menu-spacing)) max(env(safe-area-inset-bottom), var(--menu-spacing));
1722
1720
  --confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
1723
1721
  --confirmation--dialog-scale: scale(1);
@@ -1728,8 +1726,6 @@
1728
1726
  }
1729
1727
  }
1730
1728
  :where([is=confirmation-dialog][closing]) {
1731
- --confirmation--dialog-max-inline-size: anchor-size();
1732
- --confirmation--dialog-max-block-size: anchor-size();
1733
1729
  --confirmation--dialog-scale: scale(0);
1734
1730
  }
1735
1731
  }
@@ -2189,6 +2185,15 @@
2189
2185
  --accentColor4: var(--red4);
2190
2186
  --accentColor5: var(--red5);
2191
2187
  }
2188
+ :where([is=borderless-button][role=confirm]) {
2189
+ --accentColorEffective: var(--blue);
2190
+ --accentColorEffective4: var(--blue4);
2191
+ --accentColor: var(--blue);
2192
+ --accentColor2: var(--blue2);
2193
+ --accentColor3: var(--blue3);
2194
+ --accentColor4: var(--blue4);
2195
+ --accentColor5: var(--blue5);
2196
+ }
2192
2197
  }
2193
2198
  @layer sw-utils {
2194
2199
  :where([is=borderless-button]) {
@@ -2240,6 +2245,15 @@
2240
2245
  --accentColor4: var(--red4);
2241
2246
  --accentColor5: var(--red5);
2242
2247
  }
2248
+ :where([is=bordered-button][role=confirm]) {
2249
+ --accentColorEffective: var(--blue);
2250
+ --accentColorEffective4: var(--blue4);
2251
+ --accentColor: var(--blue);
2252
+ --accentColor2: var(--blue2);
2253
+ --accentColor3: var(--blue3);
2254
+ --accentColor4: var(--blue4);
2255
+ --accentColor5: var(--blue5);
2256
+ }
2243
2257
  }
2244
2258
  @layer sw-utils {
2245
2259
  :where([is=bordered-button]) {
@@ -2286,9 +2300,18 @@
2286
2300
  --accentColor4: var(--red4);
2287
2301
  --accentColor5: var(--red5);
2288
2302
  }
2303
+ :where([is=bordered-prominent-button][role=confirm]) {
2304
+ --accentColorEffective: var(--blue);
2305
+ --accentColorEffective4: var(--blue4);
2306
+ --accentColor: var(--blue);
2307
+ --accentColor2: var(--blue2);
2308
+ --accentColor3: var(--blue3);
2309
+ --accentColor4: var(--blue4);
2310
+ --accentColor5: var(--blue5);
2311
+ }
2289
2312
  }
2290
2313
  @layer sw-colors {
2291
- [is=bordered-prominent-button] {
2314
+ :where([is=bordered-prominent-button] > *) {
2292
2315
  --secondary: var(--btntext);
2293
2316
  --blue: var(--btntext);
2294
2317
  }
@@ -2341,6 +2364,15 @@
2341
2364
  --accentColor4: var(--red4);
2342
2365
  --accentColor5: var(--red5);
2343
2366
  }
2367
+ :where([is=glass-button][role=confirm]) {
2368
+ --accentColorEffective: var(--blue);
2369
+ --accentColorEffective4: var(--blue4);
2370
+ --accentColor: var(--blue);
2371
+ --accentColor2: var(--blue2);
2372
+ --accentColor3: var(--blue3);
2373
+ --accentColor4: var(--blue4);
2374
+ --accentColor5: var(--blue5);
2375
+ }
2344
2376
  }
2345
2377
  @layer sw-utils {
2346
2378
  :where([is=glass-button]) {
@@ -2390,9 +2422,18 @@
2390
2422
  --accentColor4: var(--red4);
2391
2423
  --accentColor5: var(--red5);
2392
2424
  }
2425
+ :where([is=glass-prominent-button][role=confirm]) {
2426
+ --accentColorEffective: var(--blue);
2427
+ --accentColorEffective4: var(--blue4);
2428
+ --accentColor: var(--blue);
2429
+ --accentColor2: var(--blue2);
2430
+ --accentColor3: var(--blue3);
2431
+ --accentColor4: var(--blue4);
2432
+ --accentColor5: var(--blue5);
2433
+ }
2393
2434
  }
2394
2435
  @layer sw-colors {
2395
- [is=glass-prominent-button] {
2436
+ :where([is=glass-prominent-button] > *) {
2396
2437
  --secondary: var(--btntext);
2397
2438
  --blue: var(--btntext);
2398
2439
  }
@@ -5,9 +5,9 @@ declare const _default: () => {
5
5
  readonly Description: "Ελέγξτε την ορθογραφία ή δοκιμάστε μια νέα αναζήτηση.";
6
6
  };
7
7
  readonly ButtonRole: {
8
- readonly Cancel: "Cancel";
9
- readonly Close: "Close";
10
- readonly Confirm: "Confirm";
8
+ readonly Cancel: "Ακύρωση";
9
+ readonly Close: "Κλείσιμο";
10
+ readonly Confirm: "Τέλος";
11
11
  readonly Destructive: "Διαγραφή";
12
12
  readonly OK: "OK";
13
13
  };
@@ -6,9 +6,9 @@ export default defineTranslations(() => ({
6
6
  Description: 'Ελέγξτε την ορθογραφία ή δοκιμάστε μια νέα αναζήτηση.',
7
7
  },
8
8
  ButtonRole: {
9
- Cancel: 'Cancel',
10
- Close: 'Close',
11
- Confirm: 'Confirm',
9
+ Cancel: 'Ακύρωση',
10
+ Close: 'Κλείσιμο',
11
+ Confirm: 'Τέλος',
12
12
  Destructive: 'Διαγραφή',
13
13
  OK: 'OK',
14
14
  },
@@ -32,6 +32,10 @@ function renderPlaceholder(el, role, titleKey) {
32
32
  label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm);
33
33
  label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
34
34
  break;
35
+ case 'cancellation-action':
36
+ label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel);
37
+ label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
38
+ break;
35
39
  case 'destructive':
36
40
  label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Destructive);
37
41
  label.setAttribute('system-image', Snapshot.config['delete-button-icon']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.27",
3
+ "version": "0.0.0-dev.28",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,6 +35,16 @@
35
35
  --accentColor4: var(--red4);
36
36
  --accentColor5: var(--red5);
37
37
  }
38
+ :where(&[role='confirm']) {
39
+ --accentColorEffective: var(--blue);
40
+ --accentColorEffective4: var(--blue4);
41
+
42
+ --accentColor: var(--blue);
43
+ --accentColor2: var(--blue2);
44
+ --accentColor3: var(--blue3);
45
+ --accentColor4: var(--blue4);
46
+ --accentColor5: var(--blue5);
47
+ }
38
48
  }
39
49
  }
40
50
 
@@ -32,13 +32,25 @@
32
32
  --accentColor4: var(--red4);
33
33
  --accentColor5: var(--red5);
34
34
  }
35
+ :where(&[role='confirm']) {
36
+ --accentColorEffective: var(--blue);
37
+ --accentColorEffective4: var(--blue4);
38
+
39
+ --accentColor: var(--blue);
40
+ --accentColor2: var(--blue2);
41
+ --accentColor3: var(--blue3);
42
+ --accentColor4: var(--blue4);
43
+ --accentColor5: var(--blue5);
44
+ }
35
45
  }
36
46
  }
37
47
 
38
48
  @layer #{vars.$colors-layer} {
39
- [is='bordered-prominent-button'] {
40
- --secondary: var(--btntext);
41
- --blue: var(--btntext);
49
+ [is='bordered-prominent-button'] > * {
50
+ :where(&) {
51
+ --secondary: var(--btntext);
52
+ --blue: var(--btntext);
53
+ }
42
54
  }
43
55
  }
44
56
 
@@ -22,6 +22,16 @@
22
22
  --accentColor4: var(--red4);
23
23
  --accentColor5: var(--red5);
24
24
  }
25
+ :where(&[role='confirm']) {
26
+ --accentColorEffective: var(--blue);
27
+ --accentColorEffective4: var(--blue4);
28
+
29
+ --accentColor: var(--blue);
30
+ --accentColor2: var(--blue2);
31
+ --accentColor3: var(--blue3);
32
+ --accentColor4: var(--blue4);
33
+ --accentColor5: var(--blue5);
34
+ }
25
35
  }
26
36
  }
27
37
 
@@ -12,14 +12,16 @@
12
12
 
13
13
  position: fixed;
14
14
 
15
- inline-size: max-content;
16
- block-size: max-content;
15
+ inline-size: fit-content;
16
+ block-size: fit-content;
17
17
  height: auto; // safari
18
18
 
19
19
  min-inline-size: min(20rem, 80svw);
20
20
 
21
- max-inline-size: var(--confirmation--dialog-max-inline-size,);
22
- max-block-size: var(--confirmation--dialog-max-block-size,);
21
+ max-inline-size: min(20rem, 80vw);
22
+ max-block-size: 80vh;
23
+ // max-inline-size: var(--confirmation--dialog-max-inline-size,);
24
+ // max-block-size: var(--confirmation--dialog-max-block-size,);
23
25
 
24
26
  margin-block: var(--confirmation--dialog-margin-block,);
25
27
  margin-inline: var(--confirmation--dialog-margin-inline,);
@@ -37,7 +39,7 @@
37
39
 
38
40
  padding-block: 1rem;
39
41
  padding-inline: 1rem;
40
- gap: 0.5rem;
42
+ gap: 1rem;
41
43
 
42
44
  // finally
43
45
  --confirmation--dialog-scale: scale(0);
@@ -45,8 +47,8 @@
45
47
 
46
48
  &[open] {
47
49
  :where(&) {
48
- --confirmation--dialog-max-inline-size: 100vw;
49
- --confirmation--dialog-max-block-size: 100vh;
50
+ // --confirmation--dialog-max-inline-size: 100vw;
51
+ // --confirmation--dialog-max-block-size: 100vh;
50
52
 
51
53
  --confirmation--dialog-margin-block: max(env(safe-area-inset-top), var(--menu-spacing)) max(env(safe-area-inset-bottom), var(--menu-spacing));
52
54
  --confirmation--dialog-margin-inline: max(env(safe-area-inset-left), var(--menu-spacing)) max(env(safe-area-inset-right), var(--menu-spacing));
@@ -61,8 +63,8 @@
61
63
 
62
64
  &[closing] {
63
65
  :where(&) {
64
- --confirmation--dialog-max-inline-size: anchor-size();
65
- --confirmation--dialog-max-block-size: anchor-size();
66
+ // --confirmation--dialog-max-inline-size: anchor-size();
67
+ // --confirmation--dialog-max-block-size: anchor-size();
66
68
 
67
69
  --confirmation--dialog-scale: scale(0);
68
70
  }
@@ -37,6 +37,16 @@
37
37
  --accentColor4: var(--red4);
38
38
  --accentColor5: var(--red5);
39
39
  }
40
+ :where(&[role='confirm']) {
41
+ --accentColorEffective: var(--blue);
42
+ --accentColorEffective4: var(--blue4);
43
+
44
+ --accentColor: var(--blue);
45
+ --accentColor2: var(--blue2);
46
+ --accentColor3: var(--blue3);
47
+ --accentColor4: var(--blue4);
48
+ --accentColor5: var(--blue5);
49
+ }
40
50
  }
41
51
  }
42
52
 
@@ -37,13 +37,25 @@
37
37
  --accentColor4: var(--red4);
38
38
  --accentColor5: var(--red5);
39
39
  }
40
+ :where(&[role='confirm']) {
41
+ --accentColorEffective: var(--blue);
42
+ --accentColorEffective4: var(--blue4);
43
+
44
+ --accentColor: var(--blue);
45
+ --accentColor2: var(--blue2);
46
+ --accentColor3: var(--blue3);
47
+ --accentColor4: var(--blue4);
48
+ --accentColor5: var(--blue5);
49
+ }
40
50
  }
41
51
  }
42
52
 
43
53
  @layer #{vars.$colors-layer} {
44
- [is='glass-prominent-button'] {
45
- --secondary: var(--btntext);
46
- --blue: var(--btntext);
54
+ [is='glass-prominent-button'] > * {
55
+ :where(&) {
56
+ --secondary: var(--btntext);
57
+ --blue: var(--btntext);
58
+ }
47
59
  }
48
60
  }
49
61