@swiftwc/ui 0.0.0-dev.19 → 0.0.0-dev.20

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.
@@ -1,6 +1,6 @@
1
- import { CleanupRegistry } from '#internal/class/cleanup-registry.js';
2
- import { $, onoff } from '#internal/utils/index.js';
3
1
  import { I18n } from '../i18n';
2
+ import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
+ import { $, onoff } from '../internal/utils';
4
4
  /**
5
5
  * @summary A message with a title and extra information that you show when part of your app can’t be used.
6
6
  *
@@ -10,21 +10,7 @@ const keyboardTypes = ['decimal-pad', 'number-pad', 'default'];
10
10
  */
11
11
  export class TextField extends FormAssociatedBase {
12
12
  static get observedAttributes() {
13
- return [
14
- 'prompt',
15
- 'minimum',
16
- 'maximum',
17
- 'min-length',
18
- 'max-length',
19
- 'label',
20
- 'name',
21
- 'text',
22
- 'text-input-autocapitalization',
23
- 'disable-autocorrection',
24
- 'keyboard-type',
25
- 'required',
26
- 'disabled',
27
- ];
13
+ return ['prompt', 'minimum', 'maximum', 'min-length', 'max-length', 'label', 'name', 'text', 'text-input-autocapitalization', 'disable-autocorrection', 'keyboard-type', 'required', 'disabled'];
28
14
  }
29
15
  static #template;
30
16
  static get template() {
@@ -181,9 +167,7 @@ export class TextField extends FormAssociatedBase {
181
167
  }
182
168
  }
183
169
  get keyboardType() {
184
- return keyboardTypes.includes(this.getAttribute('keyboard-type') ?? '')
185
- ? this.getAttribute('keyboard-type')
186
- : 'default';
170
+ return keyboardTypes.includes(this.getAttribute('keyboard-type') ?? '') ? this.getAttribute('keyboard-type') : 'default';
187
171
  }
188
172
  get text() {
189
173
  return this.#input?.value ?? '';
@@ -50,9 +50,8 @@
50
50
  --liquid-glass-bs-soft-bevel-blur: inset 1px 1px 0 -0.5px light-dark(#fff, #fff6);
51
51
  --liquid-glass-bs-outer: 0 0 25px 0 light-dark(#0003, #00000026);
52
52
  --liquid-glass-box-shadow:
53
- var(--liquid-glass-bs-bevel-highlight), var(--liquid-glass-bs-soft-bevel-blur), inset 3px 3px 10px -3px light-dark(#ddd, #262626),
54
- inset -3px -3px 10px -3px light-dark(#ddd, #262626), inset 0 0 5px 1px light-dark(#fff, #141414), inset 0 0 0 0.5px light-dark(#00000040, #ffffff26),
55
- inset 0 0 24px 0 light-dark(#0000001a, #ffffff0d), var(--liquid-glass-bs-outer);
53
+ var(--liquid-glass-bs-bevel-highlight), var(--liquid-glass-bs-soft-bevel-blur), inset 3px 3px 10px -3px light-dark(#ddd, #262626), inset -3px -3px 10px -3px light-dark(#ddd, #262626),
54
+ inset 0 0 5px 1px light-dark(#fff, #141414), inset 0 0 0 0.5px light-dark(#00000040, #ffffff26), inset 0 0 24px 0 light-dark(#0000001a, #ffffff0d), var(--liquid-glass-bs-outer);
56
55
  --navigation-bar-block-size: var(--tool-bar-block-size);
57
56
  --nav-split-view-sidebar-inline-size: 20rem;
58
57
  --nav-split-view-content-inline-size: 25rem;
@@ -320,9 +319,7 @@
320
319
  --menu-item-focus-bg: var(--accentColor);
321
320
  --menu-item-focus-bg-dark: var(--accentColor);
322
321
  --menu-item-active-bg: oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h);
323
- --menu-item-active-bg-dark: oklch(
324
- from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.2), c) h
325
- );
322
+ --menu-item-active-bg-dark: oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.2), c) h);
326
323
  --picker-affordance-size: 1rem;
327
324
  --picker-affordance-col-gap: 1rem;
328
325
  }
@@ -1378,9 +1375,7 @@
1378
1375
  @media (min-width: 43rem) {
1379
1376
  :where(navigation-split-view:has(> [is=sidebar-view]) detail-placeholder) {
1380
1377
  --nav-split-view--detail-placeholder-inset: 0 0 0 calc(var(--nav-split-view-sidebar-inline-size) + var(--nav-split-view--content-inline-size));
1381
- --nav-split-view--detail-placeholder-inline-size: calc(
1382
- 100lvw - var(--nav-split-view-sidebar-inline-size) - var(--nav-split-view--content-inline-size)
1383
- );
1378
+ --nav-split-view--detail-placeholder-inline-size: calc(100lvw - var(--nav-split-view-sidebar-inline-size) - var(--nav-split-view--content-inline-size));
1384
1379
  }
1385
1380
  }
1386
1381
  @media (min-width: 43rem) and (max-width: 63.9999rem) {
@@ -2039,9 +2034,7 @@
2039
2034
  grid-template-rows: auto 1fr auto;
2040
2035
  grid-template-areas: "top-bar" "spacer" "bottom-bar";
2041
2036
  }
2042
- :where(tool-bar > *:not(sidebar-toggle), tool-bar > sidebar-toggle > tool-bar-item,
2043
- tab-view > sidebar-toggle > tool-bar-item,
2044
- navigation-split-view > sidebar-toggle > tool-bar-item) {
2037
+ :where(tool-bar > *:not(sidebar-toggle), tool-bar > sidebar-toggle > tool-bar-item, tab-view > sidebar-toggle > tool-bar-item, navigation-split-view > sidebar-toggle > tool-bar-item) {
2045
2038
  backdrop-filter: var(--liquid-glass-backdrop-filter);
2046
2039
  box-shadow: var(--toolbar-cell-box-shadow);
2047
2040
  min-inline-size: var(--toolbar-cell-min-size);
@@ -7377,14 +7370,8 @@
7377
7370
  }
7378
7371
  :where([is=borderless-button]) {
7379
7372
  --btntext: var(--accentColor);
7380
- --btnhighlighttext: light-dark(
7381
- oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h),
7382
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h)
7383
- );
7384
- --btnactivetext: light-dark(
7385
- oklch(from var(--accentColor) max(calc(l * 0.5), 0) min(calc(c * 1.4), c) h),
7386
- oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.4), c) h)
7387
- );
7373
+ --btnhighlighttext: light-dark(oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h));
7374
+ --btnactivetext: light-dark(oklch(from var(--accentColor) max(calc(l * 0.5), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.4), c) h));
7388
7375
  }
7389
7376
  :where([is=bordered-button]) {
7390
7377
  --btntext: var(--accentEmphasis, var(--accentColor));
@@ -7411,14 +7398,8 @@
7411
7398
  --btnhighlighttext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
7412
7399
  --btnactivetext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
7413
7400
  --btnface: var(--accentColor);
7414
- --btnhighlightface: light-dark(
7415
- oklch(from var(--accentColor) max(calc(l * 0.9), 0) min(calc(c * 1.4), c) h),
7416
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.4), c) h)
7417
- );
7418
- --btnactiveface: light-dark(
7419
- oklch(from var(--accentColor) max(calc(l * 0.8), 0) min(calc(c * 1.4), c) h),
7420
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h)
7421
- );
7401
+ --btnhighlightface: light-dark(oklch(from var(--accentColor) max(calc(l * 0.9), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.4), c) h));
7402
+ --btnactiveface: light-dark(oklch(from var(--accentColor) max(calc(l * 0.8), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h));
7422
7403
  }
7423
7404
  :where([is=glass-button]) {
7424
7405
  --btntext: var(--accentEmphasis, var(--accentColor));
@@ -7439,14 +7420,8 @@
7439
7420
  --btnhighlighttext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
7440
7421
  --btnactivetext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
7441
7422
  --btnface: var(--accentColor);
7442
- --btnhighlightface: light-dark(
7443
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h),
7444
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h)
7445
- );
7446
- --btnactiveface: light-dark(
7447
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h),
7448
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h)
7449
- );
7423
+ --btnhighlightface: light-dark(oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h), oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h));
7424
+ --btnactiveface: light-dark(oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h));
7450
7425
  }
7451
7426
  /* list-view {
7452
7427
  :where(&) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.19",
3
+ "version": "0.0.0-dev.20",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -58,6 +58,7 @@
58
58
  "scripts": {
59
59
  "prebuild": "rm -rf generated",
60
60
  "build": "npm run build:ts && npm run build:scss && npm run build:manifest && npm run build:barrels && npm run build:barrels:i18n",
61
+ "postbuild": "npm run format:write",
61
62
  "build:ts:watch": "npm run prebuild && tsc --watch",
62
63
  "build:ts": "tsc",
63
64
  "build:scss": "sass --style=expanded --no-source-map scss/index.scss generated/css/index.css",
@@ -67,6 +68,8 @@
67
68
  "format:check": "prettier . --check",
68
69
  "format:write": "prettier . --write",
69
70
  "test": "vitest --dom",
71
+ "predeploy": "rm -rf generated",
72
+ "deploy":"npm run build:ts && npm run build:scss",
70
73
  "version:pkg": "npm version $npm_config_bump --no-git-tag-version --preid=dev"
71
74
  },
72
75
  "devDependencies": {
@@ -77,8 +80,5 @@
77
80
  "tsx": "^4.21.0",
78
81
  "vitest": "^4.0.18"
79
82
  },
80
- "customElements": "custom-elements/en.json",
81
- "imports": {
82
- "#internal/*": "./js/internal/*"
83
- }
83
+ "customElements": "custom-elements/en.json"
84
84
  }
@@ -80,9 +80,8 @@
80
80
  --liquid-glass-bs-soft-bevel-blur: inset 1px 1px 0 -0.5px light-dark(#fff, #fff6);
81
81
  --liquid-glass-bs-outer: 0 0 25px 0 light-dark(#0003, #00000026);
82
82
  --liquid-glass-box-shadow:
83
- var(--liquid-glass-bs-bevel-highlight), var(--liquid-glass-bs-soft-bevel-blur), inset 3px 3px 10px -3px light-dark(#ddd, #262626),
84
- inset -3px -3px 10px -3px light-dark(#ddd, #262626), inset 0 0 5px 1px light-dark(#fff, #141414), inset 0 0 0 0.5px light-dark(#00000040, #ffffff26),
85
- inset 0 0 24px 0 light-dark(#0000001a, #ffffff0d), var(--liquid-glass-bs-outer);
83
+ var(--liquid-glass-bs-bevel-highlight), var(--liquid-glass-bs-soft-bevel-blur), inset 3px 3px 10px -3px light-dark(#ddd, #262626), inset -3px -3px 10px -3px light-dark(#ddd, #262626),
84
+ inset 0 0 5px 1px light-dark(#fff, #141414), inset 0 0 0 0.5px light-dark(#00000040, #ffffff26), inset 0 0 24px 0 light-dark(#0000001a, #ffffff0d), var(--liquid-glass-bs-outer);
86
85
 
87
86
  --navigation-bar-block-size: var(--tool-bar-block-size);
88
87
 
@@ -373,9 +372,7 @@
373
372
  --menu-item-focus-bg-dark: var(--accentColor);
374
373
 
375
374
  --menu-item-active-bg: oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h); //color-mix(in oklch, black 10%, var(--accentColor));
376
- --menu-item-active-bg-dark: oklch(
377
- from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.2), c) h
378
- ); //color-mix(in oklch, white 10%, var(--accentColor));
375
+ --menu-item-active-bg-dark: oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.2), c) h); //color-mix(in oklch, white 10%, var(--accentColor));
379
376
 
380
377
  --picker-affordance-size: 1rem;
381
378
  --picker-affordance-col-gap: 1rem;
@@ -552,14 +552,8 @@ $colors: map.merge(
552
552
 
553
553
  :where([is='borderless-button']) {
554
554
  --btntext: var(--accentColor);
555
- --btnhighlighttext: light-dark(
556
- oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h),
557
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h)
558
- );
559
- --btnactivetext: light-dark(
560
- oklch(from var(--accentColor) max(calc(l * 0.5), 0) min(calc(c * 1.4), c) h),
561
- oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.4), c) h)
562
- );
555
+ --btnhighlighttext: light-dark(oklch(from var(--accentColor) max(calc(l * 0.7), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h));
556
+ --btnactivetext: light-dark(oklch(from var(--accentColor) max(calc(l * 0.5), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.3), 1) min(calc(c * 1.4), c) h));
563
557
  }
564
558
 
565
559
  :where([is='bordered-button']) {
@@ -590,14 +584,8 @@ $colors: map.merge(
590
584
  --btnactivetext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
591
585
 
592
586
  --btnface: var(--accentColor); //light-dark(var(--accentColor), var(--accentColor));
593
- --btnhighlightface: light-dark(
594
- oklch(from var(--accentColor) max(calc(l * 0.9), 0) min(calc(c * 1.4), c) h),
595
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.4), c) h)
596
- );
597
- --btnactiveface: light-dark(
598
- oklch(from var(--accentColor) max(calc(l * 0.8), 0) min(calc(c * 1.4), c) h),
599
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h)
600
- );
587
+ --btnhighlightface: light-dark(oklch(from var(--accentColor) max(calc(l * 0.9), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.4), c) h));
588
+ --btnactiveface: light-dark(oklch(from var(--accentColor) max(calc(l * 0.8), 0) min(calc(c * 1.4), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.4), c) h));
601
589
  }
602
590
 
603
591
  :where([is='glass-button']) {
@@ -622,14 +610,8 @@ $colors: map.merge(
622
610
  --btnactivetext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
623
611
 
624
612
  --btnface: var(--accentColor); //light-dark(var(--accentColor), var(--accentColor));
625
- --btnhighlightface: light-dark(
626
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h),
627
- oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h)
628
- );
629
- --btnactiveface: light-dark(
630
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h),
631
- oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h)
632
- );
613
+ --btnhighlightface: light-dark(oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h), oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h));
614
+ --btnactiveface: light-dark(oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h));
633
615
  }
634
616
 
635
617
  /* list-view {
@@ -72,9 +72,7 @@
72
72
  :where(&) {
73
73
  --nav-split-view--detail-placeholder-inset: 0 0 0 calc(var(--nav-split-view-sidebar-inline-size) + var(--nav-split-view--content-inline-size));
74
74
 
75
- --nav-split-view--detail-placeholder-inline-size: calc(
76
- 100lvw - var(--nav-split-view-sidebar-inline-size) - var(--nav-split-view--content-inline-size)
77
- );
75
+ --nav-split-view--detail-placeholder-inline-size: calc(100lvw - var(--nav-split-view-sidebar-inline-size) - var(--nav-split-view--content-inline-size));
78
76
  }
79
77
  }
80
78
 
@@ -39,8 +39,7 @@
39
39
  height: auto;
40
40
 
41
41
  inset-inline-start: calc(
42
- var(--inset-inline-start-resettor, 1) *
43
- calc(50lvw - calc(#{vars.$ipad-sheet-view-inline-size} / 2) - calc(calc(var(--safe-area-inset-left) + var(--safe-area-inset-right)) / 2))
42
+ var(--inset-inline-start-resettor, 1) * calc(50lvw - calc(#{vars.$ipad-sheet-view-inline-size} / 2) - calc(calc(var(--safe-area-inset-left) + var(--safe-area-inset-right)) / 2))
44
43
  );
45
44
 
46
45
  inset-block-start: calc(50lvh - calc(#{vars.$ipad-sheet-view-height} / 2) - calc(calc(var(--safe-area-inset-top) + var(--safe-area-inset-bottom)) / 2));
@@ -101,10 +101,7 @@
101
101
  display: none;
102
102
  }
103
103
 
104
- :where(
105
- navigation-split-view:has(> [is='sidebar-view']):not([preferred-compact-column='content']) > &,
106
- navigation-split-view:has(> [is='sidebar-view'])[column-visibility='double-column'] > &
107
- ) {
104
+ :where(navigation-split-view:has(> [is='sidebar-view']):not([preferred-compact-column='content']) > &, navigation-split-view:has(> [is='sidebar-view'])[column-visibility='double-column'] > &) {
108
105
  display: none;
109
106
  }
110
107
  }
@@ -98,9 +98,7 @@
98
98
 
99
99
  // overflow: clip;
100
100
 
101
- scroll-padding-left: calc(
102
- var(--sidebar-toggle-padding-inline-start, 0px) + var(--ipad-tabbar-block-padding-start) + var(--ipad-tabbar-block-padding-end)
103
- );
101
+ scroll-padding-left: calc(var(--sidebar-toggle-padding-inline-start, 0px) + var(--ipad-tabbar-block-padding-start) + var(--ipad-tabbar-block-padding-end));
104
102
 
105
103
  // overflow: auto clip;
106
104
 
@@ -24,7 +24,7 @@
24
24
  }
25
25
  }
26
26
  }
27
-
27
+
28
28
  // dissmantle list and turn it into a h-column row
29
29
  @container table (width > #{vars.$table-expanded-bp}) {
30
30
  :where(&) {
@@ -18,12 +18,7 @@
18
18
  'bottom-bar';
19
19
  }
20
20
 
21
- :where(
22
- & > *:not(sidebar-toggle),
23
- & > sidebar-toggle > tool-bar-item,
24
- tab-view > sidebar-toggle > tool-bar-item,
25
- navigation-split-view > sidebar-toggle > tool-bar-item
26
- ) {
21
+ :where(& > *:not(sidebar-toggle), & > sidebar-toggle > tool-bar-item, tab-view > sidebar-toggle > tool-bar-item, navigation-split-view > sidebar-toggle > tool-bar-item) {
27
22
  backdrop-filter: var(--liquid-glass-backdrop-filter);
28
23
  box-shadow: var(--toolbar-cell-box-shadow);
29
24
 
@@ -343,4 +343,4 @@
343
343
  ]
344
344
  }
345
345
  ]
346
- }
346
+ }