@sveltia/ui 0.6.4 → 0.6.6

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.
@@ -135,6 +135,7 @@
135
135
  line-height: var(--sui-control-line-height);
136
136
  font-weight: normal;
137
137
  text-align: left;
138
+ white-space: nowrap;
138
139
  cursor: pointer;
139
140
  transition: all 200ms;
140
141
  }
@@ -167,7 +168,7 @@ button:global(.primary) {
167
168
  color: var(--sui-primary-accent-color-foreground);
168
169
  background-color: var(--sui-primary-accent-color);
169
170
  }
170
- button:global(.primary):hover, button:global(.primary):focus-visible {
171
+ button:global(.primary):hover, button:global(.primary):focus-visible, button:global(.primary)[aria-expanded=true] {
171
172
  background-color: var(--sui-primary-accent-color-lighter);
172
173
  }
173
174
  button:global(.primary):active {
@@ -178,7 +179,7 @@ button:global(.secondary) {
178
179
  color: var(--sui-primary-accent-color-lighter);
179
180
  background-color: var(--sui-tertiary-background-color);
180
181
  }
181
- button:global(.secondary):hover, button:global(.secondary):focus-visible {
182
+ button:global(.secondary):hover, button:global(.secondary):focus-visible, button:global(.secondary)[aria-expanded=true] {
182
183
  background-color: var(--sui-highlight-background-color);
183
184
  }
184
185
  button:global(.secondary)[aria-pressed=true] {
@@ -189,13 +190,13 @@ button:global(.tertiary) {
189
190
  color: var(--sui-highlight-foreground-color);
190
191
  background-color: var(--sui-tertiary-background-color);
191
192
  }
192
- button:global(.tertiary):hover, button:global(.tertiary):focus-visible {
193
+ button:global(.tertiary):hover, button:global(.tertiary):focus-visible, button:global(.tertiary)[aria-expanded=true] {
193
194
  background-color: var(--sui-highlight-background-color);
194
195
  }
195
196
  button:global(.tertiary)[aria-pressed=true] {
196
197
  background-color: var(--sui-highlight-background-color);
197
198
  }
198
- button:global(.ghost):hover, button:global(.ghost):focus-visible {
199
+ button:global(.ghost):hover, button:global(.ghost):focus-visible, button:global(.ghost)[aria-expanded=true] {
199
200
  background-color: var(--sui-highlight-background-color);
200
201
  }
201
202
  button:global(.ghost)[aria-pressed=true] {
@@ -145,7 +145,7 @@
145
145
  value = '';
146
146
  }}
147
147
  >
148
- {$_('_sui._.clear')}
148
+ {$_('_sui.clear')}
149
149
  </Button>
150
150
  <Spacer flex={true} />
151
151
  <Button
@@ -118,6 +118,7 @@
118
118
  width: 20px;
119
119
  height: 20px;
120
120
  color: var(--sui-primary-accent-color-lighter);
121
+ background-color: var(--sui-checkbox-background-color);
121
122
  transition: all 200ms;
122
123
  }
123
124
  .checkbox :global(button) :global(.icon) {
@@ -125,7 +126,7 @@
125
126
  }
126
127
  .checkbox :global(button[aria-checked="true"]) {
127
128
  border-color: var(--sui-primary-accent-color-lighter);
128
- color: var(--sui-control-background-color);
129
+ color: var(--sui-primary-accent-color-foreground);
129
130
  background-color: var(--sui-primary-accent-color-lighter);
130
131
  }
131
132
  .checkbox :global(button[aria-checked="mixed"]) {
@@ -165,7 +165,7 @@
165
165
  open = false;
166
166
  }}
167
167
  >
168
- <Icon slot="start-icon" name="close" label={$_('_sui._.close')} />
168
+ <Icon slot="start-icon" name="close" label={$_('_sui.close')} />
169
169
  </Button>
170
170
  {/if}
171
171
  {/if}
@@ -186,7 +186,7 @@
186
186
  {#if showOk}
187
187
  <Button
188
188
  class="primary"
189
- label={okLabel || $_('_sui._.ok')}
189
+ label={okLabel || $_('_sui.ok')}
190
190
  disabled={okDisabled}
191
191
  on:click={() => {
192
192
  dialog.returnValue = 'ok';
@@ -197,7 +197,7 @@
197
197
  {#if showCancel}
198
198
  <Button
199
199
  class="secondary"
200
- label={cancelLabel || $_('_sui._.cancel')}
200
+ label={cancelLabel || $_('_sui.cancel')}
201
201
  disabled={cancelDisabled}
202
202
  on:click={() => {
203
203
  dialog.returnValue = 'cancel';
@@ -248,6 +248,7 @@ dialog form {
248
248
  flex-direction: column;
249
249
  border-radius: 4px;
250
250
  background-color: var(--sui-secondary-background-color-translucent);
251
+ -webkit-backdrop-filter: blur(16px);
251
252
  backdrop-filter: blur(16px);
252
253
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
253
254
  will-change: opacity, transform;
@@ -155,7 +155,7 @@
155
155
  open = false;
156
156
  }}
157
157
  >
158
- <Icon slot="start-icon" name="close" label={$_('_sui._.close')} />
158
+ <Icon slot="start-icon" name="close" label={$_('_sui.close')} />
159
159
  </Button>
160
160
  {/if}
161
161
  </div>
@@ -180,7 +180,7 @@
180
180
  open = false;
181
181
  }}
182
182
  >
183
- <Icon slot="start-icon" name="close" label={$_('_sui._.close')} />
183
+ <Icon slot="start-icon" name="close" label={$_('_sui.close')} />
184
184
  </Button>
185
185
  {/if}
186
186
  {/if}
@@ -233,6 +233,7 @@ dialog form {
233
233
  flex-direction: column;
234
234
  border-radius: 4px;
235
235
  background-color: var(--sui-secondary-background-color-translucent);
236
+ -webkit-backdrop-filter: blur(16px);
236
237
  backdrop-filter: blur(16px);
237
238
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
238
239
  will-change: opacity, transform;
@@ -10,8 +10,8 @@ export default class Drawer extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
12
  title?: string;
13
- position?: "top" | "right" | "bottom" | "left";
14
13
  size?: "small" | "medium" | "large" | "x-large";
14
+ position?: "top" | "right" | "bottom" | "left";
15
15
  open?: boolean;
16
16
  showClose?: false | "inside" | "outside";
17
17
  closeOnBackdropClick?: boolean;
@@ -38,8 +38,8 @@ declare const __propDef: {
38
38
  [x: string]: any;
39
39
  class?: string;
40
40
  title?: string;
41
- position?: ('top' | 'right' | 'bottom' | 'left');
42
41
  size?: ('small' | 'medium' | 'large' | 'x-large');
42
+ position?: ('top' | 'right' | 'bottom' | 'left');
43
43
  open?: boolean;
44
44
  showClose?: ('inside' | 'outside' | false);
45
45
  closeOnBackdropClick?: boolean;
@@ -106,7 +106,7 @@
106
106
  <Icon
107
107
  slot="start-icon"
108
108
  name="expand_more"
109
- label={$isPopupOpen ? $_('_sui._.collapse') : $_('_sui._.expand')}
109
+ label={$isPopupOpen ? $_('_sui.collapse') : $_('_sui.expand')}
110
110
  />
111
111
  </Button>
112
112
  </div>
@@ -207,6 +207,7 @@
207
207
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
208
208
  overflow: auto;
209
209
  background-color: var(--sui-secondary-background-color);
210
+ -webkit-backdrop-filter: blur(16px);
210
211
  backdrop-filter: blur(16px);
211
212
  /* Add .1s delay before the position can be determined */
212
213
  transition: opacity 100ms 100ms;
@@ -10,10 +10,10 @@ export default class Combobox extends SvelteComponent<{
10
10
  [x: string]: any;
11
11
  class?: string;
12
12
  label?: string;
13
- position?: PopupPosition;
14
13
  disabled?: boolean;
15
14
  readOnly?: boolean;
16
15
  value?: string | number;
16
+ position?: PopupPosition;
17
17
  }, {
18
18
  change: CustomEvent<any>;
19
19
  } & {
@@ -27,17 +27,14 @@ export type ComboboxEvents = typeof __propDef.events;
27
27
  export type ComboboxSlots = typeof __propDef.slots;
28
28
  import { SvelteComponent } from "svelte";
29
29
  declare const __propDef: {
30
- /**
31
- * Where to show the dropdown menu.
32
- * @type {PopupPosition}
33
- */ props: {
30
+ props: {
34
31
  [x: string]: any;
35
32
  class?: string;
36
33
  label?: string;
37
- position?: PopupPosition;
38
34
  disabled?: boolean;
39
35
  readOnly?: boolean;
40
36
  value?: (string | number | undefined);
37
+ position?: PopupPosition;
41
38
  };
42
39
  events: {
43
40
  change: CustomEvent<any>;
@@ -60,7 +60,7 @@
60
60
  });
61
61
  }}
62
62
  >
63
- <Icon slot="start-icon" name="close" label={$_('_sui._.clear')} />
63
+ <Icon slot="start-icon" name="close" label={$_('_sui.clear')} />
64
64
  </Button>
65
65
  {/if}
66
66
  </div>
@@ -58,8 +58,8 @@
58
58
  </svelte:head>
59
59
 
60
60
  <!-- Preload fonts, including the icons -->
61
- <div class="font-loader" aria-hidden="true" bind:this={fontLoader}>
62
- Sveltia UI <span class="material-symbols-outlined">favorite</span>
61
+ <div class="font-loader" aria-hidden="true" bind:this={fontLoader} style:opacity="0">
62
+ <strong>Sveltia</strong> <em>UI</em> <span class="material-symbols-outlined">favorite</span>
63
63
  </div>
64
64
 
65
65
  <div
@@ -195,6 +195,7 @@
195
195
  --sui-primary-border-color: hsl(var(--sui-border-color-1-hsl));
196
196
  --sui-secondary-border-color: hsl(var(--sui-border-color-2-hsl));
197
197
  --sui-checkbox-border-color: hsl(var(--sui-foreground-color-4-hsl));
198
+ --sui-checkbox-background-color: hsl(var(--sui-background-color-5-hsl));
198
199
  --sui-error-border-color: hsl(
199
200
  var(--sui-error-color-hue) var(--sui-alert-border-color-saturation)
200
201
  var(--sui-alert-border-color-lightness)
@@ -358,6 +359,7 @@
358
359
  :global(.font-loader) {
359
360
  position: absolute;
360
361
  left: -99999px;
362
+ font-family: var(--sui-font-family-default);
361
363
  }
362
364
 
363
365
  :global(.app-shell) {
@@ -17,7 +17,9 @@ class Popup {
17
17
  return;
18
18
  }
19
19
 
20
- const contentHeight = this.popupElement.querySelector('.content').scrollHeight;
20
+ const { scrollHeight: contentHeight, scrollWidth: contentWidth } =
21
+ this.popupElement.querySelector('.content');
22
+
21
23
  const topMargin = intersectionRect.top - 8;
22
24
  const bottomMargin = rootBounds.height - intersectionRect.bottom - 8;
23
25
  let { position } = this;
@@ -36,6 +38,13 @@ class Popup {
36
38
  }
37
39
  }
38
40
 
41
+ // If the popup overflows the viewport, change the position
42
+ if (position.endsWith('-left')) {
43
+ if (intersectionRect.left + contentWidth > rootBounds.width - 8) {
44
+ position = /** @type {PopupPosition} */ (position.replace('-left', '-right'));
45
+ }
46
+ }
47
+
39
48
  const top = position.startsWith('bottom-')
40
49
  ? `${Math.round(intersectionRect.bottom)}px`
41
50
  : position.endsWith('-top')
@@ -156,6 +156,7 @@
156
156
  outline-width: 0 !important;
157
157
  color: var(--sui-primary-foreground-color);
158
158
  background-color: var(--sui-secondary-background-color-translucent);
159
+ -webkit-backdrop-filter: blur(16px);
159
160
  backdrop-filter: blur(16px);
160
161
  box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
161
162
  will-change: opacity, transform;
@@ -1,13 +1,11 @@
1
1
  export namespace strings {
2
- namespace _ {
3
- const ok: string;
4
- const cancel: string;
5
- const close: string;
6
- const clear: string;
7
- const remove: string;
8
- const collapse: string;
9
- const expand: string;
10
- }
2
+ const ok: string;
3
+ const cancel: string;
4
+ const close: string;
5
+ const clear: string;
6
+ const remove: string;
7
+ const collapse: string;
8
+ const expand: string;
11
9
  namespace calendar {
12
10
  const year: string;
13
11
  const previous_decade: string;
@@ -1,13 +1,11 @@
1
1
  export const strings = {
2
- _: {
3
- ok: 'OK',
4
- cancel: 'Cancel',
5
- close: 'Close',
6
- clear: 'Clear',
7
- remove: 'Remove',
8
- collapse: 'Collapse',
9
- expand: 'Expand',
10
- },
2
+ ok: 'OK',
3
+ cancel: 'Cancel',
4
+ close: 'Close',
5
+ clear: 'Clear',
6
+ remove: 'Remove',
7
+ collapse: 'Collapse',
8
+ expand: 'Expand',
11
9
  calendar: {
12
10
  year: 'Year',
13
11
  previous_decade: 'Previous Decade',
@@ -1,13 +1,11 @@
1
1
  export namespace strings {
2
- namespace _ {
3
- const ok: string;
4
- const cancel: string;
5
- const close: string;
6
- const clear: string;
7
- const remove: string;
8
- const collapse: string;
9
- const expand: string;
10
- }
2
+ const ok: string;
3
+ const cancel: string;
4
+ const close: string;
5
+ const clear: string;
6
+ const remove: string;
7
+ const collapse: string;
8
+ const expand: string;
11
9
  namespace calendar {
12
10
  const year: string;
13
11
  const previous_decade: string;
@@ -1,13 +1,11 @@
1
1
  export const strings = {
2
- _: {
3
- ok: 'OK',
4
- cancel: 'キャンセル',
5
- close: '閉じる',
6
- clear: 'クリア',
7
- remove: '削除',
8
- collapse: '折り畳む',
9
- expand: '広げる',
10
- },
2
+ ok: 'OK',
3
+ cancel: 'キャンセル',
4
+ close: '閉じる',
5
+ clear: 'クリア',
6
+ remove: '削除',
7
+ collapse: '折り畳む',
8
+ expand: '広げる',
11
9
  calendar: {
12
10
  year: '年',
13
11
  previous_decade: '前の 10 年',
@@ -118,6 +118,7 @@
118
118
  --sui-primary-border-color: hsl(var(--sui-border-color-1-hsl));
119
119
  --sui-secondary-border-color: hsl(var(--sui-border-color-2-hsl));
120
120
  --sui-checkbox-border-color: hsl(var(--sui-foreground-color-4-hsl));
121
+ --sui-checkbox-background-color: hsl(var(--sui-background-color-5-hsl));
121
122
  --sui-error-border-color: hsl(
122
123
  var(--sui-error-color-hue) var(--sui-alert-border-color-saturation)
123
124
  var(--sui-alert-border-color-lightness)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -23,36 +23,36 @@
23
23
  "test:unit": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "svelte": "^4.2.0"
26
+ "svelte": "^4.2.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@playwright/test": "^1.38.0",
29
+ "@playwright/test": "^1.39.0",
30
30
  "@sveltejs/adapter-auto": "2.1.0",
31
- "@sveltejs/kit": "^1.25.0",
31
+ "@sveltejs/kit": "^1.27.2",
32
32
  "@sveltejs/package": "^2.2.2",
33
- "cspell": "^7.3.6",
34
- "eslint": "^8.49.0",
33
+ "cspell": "^7.3.8",
34
+ "eslint": "^8.52.0",
35
35
  "eslint-config-airbnb-base": "^15.0.0",
36
36
  "eslint-config-prettier": "^9.0.0",
37
- "eslint-plugin-import": "^2.28.1",
38
- "eslint-plugin-jsdoc": "^46.8.1",
39
- "eslint-plugin-svelte": "^2.33.1",
37
+ "eslint-plugin-import": "^2.29.0",
38
+ "eslint-plugin-jsdoc": "^46.8.2",
39
+ "eslint-plugin-svelte": "^2.34.0",
40
40
  "npm-run-all": "^4.1.5",
41
- "postcss": "^8.4.29",
41
+ "postcss": "^8.4.31",
42
42
  "postcss-html": "^1.5.0",
43
43
  "prettier": "^3.0.3",
44
44
  "prettier-plugin-svelte": "^3.0.3",
45
- "sass": "^1.67.0",
46
- "stylelint": "^15.10.3",
45
+ "sass": "^1.69.5",
46
+ "stylelint": "^15.11.0",
47
47
  "stylelint-config-recommended-scss": "^13.0.0",
48
- "stylelint-scss": "^5.2.1",
49
- "svelte-check": "^3.5.1",
50
- "svelte-i18n": "^3.7.4",
51
- "svelte-migrate": "^1.2.6",
48
+ "stylelint-scss": "^5.3.0",
49
+ "svelte-check": "^3.5.2",
50
+ "svelte-i18n": "^4.0.0",
51
+ "svelte-migrate": "^1.2.7",
52
52
  "svelte-preprocess": "^5.0.4",
53
53
  "tslib": "^2.6.2",
54
- "vite": "^4.4.9",
55
- "vitest": "^0.34.4"
54
+ "vite": "^4.5.0",
55
+ "vitest": "^0.34.6"
56
56
  },
57
57
  "exports": {
58
58
  "./package.json": "./package.json",