@sveltia/ui 0.3.1 → 0.4.0

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.
Files changed (27) hide show
  1. package/package/components/calendar/calendar.svelte +1 -2
  2. package/package/components/checkbox/checkbox.svelte +2 -1
  3. package/package/components/checkbox/checkbox.svelte.d.ts +2 -0
  4. package/package/components/dialog/dialog.svelte +2 -1
  5. package/package/components/dialog/dialog.svelte.d.ts +2 -0
  6. package/package/components/disclosure/disclosure.svelte +7 -1
  7. package/package/components/disclosure/disclosure.svelte.d.ts +2 -0
  8. package/package/components/divider/divider.svelte +6 -1
  9. package/package/components/divider/divider.svelte.d.ts +2 -0
  10. package/package/components/divider/spacer.svelte +1 -1
  11. package/package/components/divider/spacer.svelte.d.ts +2 -0
  12. package/package/components/drawer/drawer.svelte +2 -1
  13. package/package/components/drawer/drawer.svelte.d.ts +2 -0
  14. package/package/components/icon/icon.svelte +1 -0
  15. package/package/components/icon/icon.svelte.d.ts +2 -0
  16. package/package/components/radio/radio-group.svelte +1 -0
  17. package/package/components/radio/radio-group.svelte.d.ts +2 -0
  18. package/package/components/radio/radio.svelte +2 -1
  19. package/package/components/radio/radio.svelte.d.ts +2 -0
  20. package/package/components/select/combobox.svelte +1 -1
  21. package/package/components/slider/slider.svelte +7 -3
  22. package/package/components/slider/slider.svelte.d.ts +2 -0
  23. package/package/components/switch/switch.svelte +1 -0
  24. package/package/components/switch/switch.svelte.d.ts +2 -0
  25. package/package/components/util/app-shell.svelte +7 -2
  26. package/package/components/util/popup.d.ts +1 -0
  27. package/package.json +13 -13
@@ -55,8 +55,7 @@
55
55
  aria-haspopup="dialog"
56
56
  >
57
57
  <Icon slot="end-icon" name="arrow_drop_down" />
58
- <!-- svelte-ignore a11y-click-events-have-key-events -->
59
- <div slot="popup" class="popup-inner" on:click|stopPropagation>
58
+ <div slot="popup" class="popup-inner" role="none" on:click|stopPropagation>
60
59
  <div role="group" aria-label={$_('_sui.calendar.year')}>
61
60
  <div class="header">
62
61
  <Button
@@ -47,12 +47,13 @@
47
47
  <input type="hidden" {name} {value} />
48
48
  {/if}
49
49
 
50
- <!-- svelte-ignore a11y-click-events-have-key-events -->
51
50
  <span
52
51
  class="sui checkbox {className}"
53
52
  class:checked
54
53
  class:indeterminate
55
54
  class:disabled
55
+ role="none"
56
+ {...$$restProps}
56
57
  on:click|preventDefault|stopPropagation={(event) => {
57
58
  if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
58
59
  buttonComponent.element.click();
@@ -8,6 +8,7 @@
8
8
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
9
9
  */
10
10
  export default class Checkbox extends SvelteComponentTyped<{
11
+ [x: string]: any;
11
12
  label?: string;
12
13
  disabled?: boolean;
13
14
  name?: string;
@@ -29,6 +30,7 @@ export type CheckboxSlots = typeof __propDef.slots;
29
30
  import { SvelteComponentTyped } from "svelte";
30
31
  declare const __propDef: {
31
32
  props: {
33
+ [x: string]: any;
32
34
  label?: string | null;
33
35
  disabled?: boolean;
34
36
  name?: string;
@@ -126,11 +126,12 @@
126
126
  });
127
127
  </script>
128
128
 
129
- <!-- svelte-ignore a11y-click-events-have-key-events -->
129
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
130
130
  <dialog
131
131
  bind:this={dialog}
132
132
  class="sui dialog {className} {size}"
133
133
  class:open={showDialog}
134
+ {...$$restProps}
134
135
  on:click={({ target }) => {
135
136
  if (closeOnBackdropClick && /** @type {HTMLElement?} */ (target)?.matches('dialog')) {
136
137
  dialog.returnValue = 'cancel';
@@ -7,6 +7,7 @@
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
8
8
  */
9
9
  export default class Dialog extends SvelteComponentTyped<{
10
+ [x: string]: any;
10
11
  title?: string;
11
12
  open?: boolean;
12
13
  class?: string;
@@ -41,6 +42,7 @@ export type DialogSlots = typeof __propDef.slots;
41
42
  import { SvelteComponentTyped } from "svelte";
42
43
  declare const __propDef: {
43
44
  props: {
45
+ [x: string]: any;
44
46
  title?: string;
45
47
  open?: boolean;
46
48
  class?: string;
@@ -24,7 +24,13 @@
24
24
  const id = getRandomId('disclosure');
25
25
  </script>
26
26
 
27
- <div class="sui disclosure {className}" {id} role="group" aria-labelledby="{id}-header">
27
+ <div
28
+ class="sui disclosure {className}"
29
+ {id}
30
+ role="group"
31
+ aria-labelledby="{id}-header"
32
+ {...$$restProps}
33
+ >
28
34
  <Button
29
35
  class="header"
30
36
  id="{id}-header"
@@ -7,6 +7,7 @@
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
8
8
  */
9
9
  export default class Disclosure extends SvelteComponentTyped<{
10
+ [x: string]: any;
10
11
  label?: string;
11
12
  class?: string;
12
13
  expanded?: boolean;
@@ -22,6 +23,7 @@ export type DisclosureSlots = typeof __propDef.slots;
22
23
  import { SvelteComponentTyped } from "svelte";
23
24
  declare const __propDef: {
24
25
  props: {
26
+ [x: string]: any;
25
27
  label?: string;
26
28
  class?: string;
27
29
  expanded?: boolean;
@@ -16,7 +16,12 @@
16
16
  export { className as class };
17
17
  </script>
18
18
 
19
- <div role="separator" class="sui divider {className}" aria-orientation={orientation} />
19
+ <div
20
+ role="separator"
21
+ class="sui divider {className}"
22
+ aria-orientation={orientation}
23
+ {...$$restProps}
24
+ />
20
25
 
21
26
  <style>.divider {
22
27
  flex: none;
@@ -6,6 +6,7 @@
6
6
  * @see https://w3c.github.io/aria/#separator
7
7
  */
8
8
  export default class Divider extends SvelteComponentTyped<{
9
+ [x: string]: any;
9
10
  class?: string;
10
11
  orientation?: "vertical" | "horizontal";
11
12
  }, {
@@ -18,6 +19,7 @@ export type DividerSlots = typeof __propDef.slots;
18
19
  import { SvelteComponentTyped } from "svelte";
19
20
  declare const __propDef: {
20
21
  props: {
22
+ [x: string]: any;
21
23
  class?: string;
22
24
  orientation?: ('horizontal' | 'vertical');
23
25
  };
@@ -15,7 +15,7 @@
15
15
  export let flex = false;
16
16
  </script>
17
17
 
18
- <div class="sui spacer {className}" class:flex />
18
+ <div class="sui spacer {className}" class:flex {...$$restProps} />
19
19
 
20
20
  <style>.spacer.flex {
21
21
  flex: auto;
@@ -3,6 +3,7 @@
3
3
  /** @typedef {typeof __propDef.slots} SpacerSlots */
4
4
  /** A content divider with no line. It can be flexible. */
5
5
  export default class Spacer extends SvelteComponentTyped<{
6
+ [x: string]: any;
6
7
  class?: string;
7
8
  flex?: boolean;
8
9
  }, {
@@ -15,6 +16,7 @@ export type SpacerSlots = typeof __propDef.slots;
15
16
  import { SvelteComponentTyped } from "svelte";
16
17
  declare const __propDef: {
17
18
  props: {
19
+ [x: string]: any;
18
20
  class?: string;
19
21
  flex?: boolean;
20
22
  };
@@ -128,11 +128,12 @@
128
128
  });
129
129
  </script>
130
130
 
131
- <!-- svelte-ignore a11y-click-events-have-key-events -->
131
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
132
132
  <dialog
133
133
  bind:this={dialog}
134
134
  class="sui dialog {className} {size} {position} {orientation}"
135
135
  class:open={showDialog}
136
+ {...$$restProps}
136
137
  on:click={({ target }) => {
137
138
  if (closeOnBackdropClick && /** @type {HTMLElement?} */ (target)?.matches('dialog')) {
138
139
  dialog.returnValue = 'cancel';
@@ -7,6 +7,7 @@
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
8
8
  */
9
9
  export default class Drawer extends SvelteComponentTyped<{
10
+ [x: string]: any;
10
11
  title?: string;
11
12
  position?: "top" | "right" | "bottom" | "left";
12
13
  open?: boolean;
@@ -34,6 +35,7 @@ export type DrawerSlots = typeof __propDef.slots;
34
35
  import { SvelteComponentTyped } from "svelte";
35
36
  declare const __propDef: {
36
37
  props: {
38
+ [x: string]: any;
37
39
  title?: string;
38
40
  position?: ('top' | 'right' | 'bottom' | 'left');
39
41
  open?: boolean;
@@ -21,6 +21,7 @@
21
21
  class="sui icon material-symbols-outlined {className}"
22
22
  aria-label={label || undefined}
23
23
  aria-hidden={label ? undefined : true}
24
+ {...$$restProps}
24
25
  >
25
26
  {name}
26
27
  </span>
@@ -6,6 +6,7 @@
6
6
  * @see https://developers.google.com/fonts/docs/material_symbols
7
7
  */
8
8
  export default class Icon extends SvelteComponentTyped<{
9
+ [x: string]: any;
9
10
  label?: string;
10
11
  name?: string;
11
12
  class?: string;
@@ -19,6 +20,7 @@ export type IconSlots = typeof __propDef.slots;
19
20
  import { SvelteComponentTyped } from "svelte";
20
21
  declare const __propDef: {
21
22
  props: {
23
+ [x: string]: any;
22
24
  label?: string;
23
25
  name?: string;
24
26
  class?: string;
@@ -27,6 +27,7 @@
27
27
  tabindex="-1"
28
28
  role="radiogroup"
29
29
  aria-orientation={orientation}
30
+ {...$$restProps}
30
31
  bind:this={element}
31
32
  on:select
32
33
  use:activateGroup
@@ -7,6 +7,7 @@
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
8
8
  */
9
9
  export default class RadioGroup extends SvelteComponentTyped<{
10
+ [x: string]: any;
10
11
  class?: string;
11
12
  element?: HTMLElement;
12
13
  orientation?: "vertical" | "horizontal";
@@ -24,6 +25,7 @@ export type RadioGroupSlots = typeof __propDef.slots;
24
25
  import { SvelteComponentTyped } from "svelte";
25
26
  declare const __propDef: {
26
27
  props: {
28
+ [x: string]: any;
27
29
  class?: string;
28
30
  element?: HTMLElement | null;
29
31
  orientation?: ('horizontal' | 'vertical');
@@ -42,9 +42,10 @@
42
42
  <input type="hidden" {name} {value} />
43
43
  {/if}
44
44
 
45
- <!-- svelte-ignore a11y-click-events-have-key-events -->
46
45
  <span
47
46
  class="sui radio {className}"
47
+ role="none"
48
+ {...$$restProps}
48
49
  on:click={(event) => {
49
50
  if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
50
51
  buttonComponent.element.click();
@@ -8,6 +8,7 @@
8
8
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
9
9
  */
10
10
  export default class Radio extends SvelteComponentTyped<{
11
+ [x: string]: any;
11
12
  label?: string;
12
13
  disabled?: boolean;
13
14
  name?: string;
@@ -26,6 +27,7 @@ export type RadioSlots = typeof __propDef.slots;
26
27
  import { SvelteComponentTyped } from "svelte";
27
28
  declare const __propDef: {
28
29
  props: {
30
+ [x: string]: any;
29
31
  label?: string | null;
30
32
  disabled?: boolean;
31
33
  name?: string;
@@ -54,7 +54,7 @@
54
54
  let isPopupOpen = writable(false);
55
55
  </script>
56
56
 
57
- <div class="sui combobox {className}">
57
+ <div class="sui combobox {className}" {...$$restProps}>
58
58
  {#if readOnly}
59
59
  <div
60
60
  class:selected={value !== undefined}
@@ -215,11 +215,15 @@
215
215
  }}
216
216
  />
217
217
 
218
- <!-- svelte-ignore a11y-click-events-have-key-events -->
219
- <div class="sui slider {className}" on:click|preventDefault|stopPropagation>
220
- <!-- svelte-ignore a11y-click-events-have-key-events -->
218
+ <div
219
+ class="sui slider {className}"
220
+ role="none"
221
+ {...$$restProps}
222
+ on:click|preventDefault|stopPropagation
223
+ >
221
224
  <div
222
225
  class="base"
226
+ role="none"
223
227
  bind:this={base}
224
228
  on:click|preventDefault|stopPropagation={(event) => {
225
229
  onClick(event);
@@ -10,6 +10,7 @@
10
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
11
11
  */
12
12
  export default class Slider extends SvelteComponentTyped<{
13
+ [x: string]: any;
13
14
  value?: number;
14
15
  class?: string;
15
16
  sliderLabel?: string;
@@ -32,6 +33,7 @@ export type SliderSlots = typeof __propDef.slots;
32
33
  import { SvelteComponentTyped } from "svelte";
33
34
  declare const __propDef: {
34
35
  props: {
36
+ [x: string]: any;
35
37
  value?: number;
36
38
  class?: string;
37
39
  sliderLabel?: string;
@@ -26,6 +26,7 @@
26
26
  role="switch"
27
27
  aria-disabled={disabled}
28
28
  aria-checked={checked}
29
+ {...$$restProps}
29
30
  on:click={() => {
30
31
  checked = !checked;
31
32
  }}
@@ -7,6 +7,7 @@
7
7
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/switch/
8
8
  */
9
9
  export default class Switch extends SvelteComponentTyped<{
10
+ [x: string]: any;
10
11
  label?: string;
11
12
  disabled?: boolean;
12
13
  class?: string;
@@ -23,6 +24,7 @@ export type SwitchSlots = typeof __propDef.slots;
23
24
  import { SvelteComponentTyped } from "svelte";
24
25
  declare const __propDef: {
25
26
  props: {
27
+ [x: string]: any;
26
28
  label?: string;
27
29
  disabled?: boolean;
28
30
  class?: string;
@@ -33,11 +33,16 @@
33
33
 
34
34
  <div
35
35
  class="sui app-shell"
36
+ role="none"
37
+ {...$$restProps}
36
38
  on:dragover|preventDefault
37
39
  on:drop|preventDefault
38
40
  on:contextmenu={(event) => {
39
- // Disable the native context menu
40
- if (!(/** @type {HTMLElement} */ (event.target)?.matches('input[type="text"], textarea'))) {
41
+ // Enable the native context menu only in the developer mode or on text fields
42
+ if (
43
+ !document.documentElement.matches('[data-env="dev"]') &&
44
+ !(/** @type {HTMLElement} */ (event.target)?.matches('input[type="text"], textarea'))
45
+ ) {
41
46
  event.preventDefault();
42
47
  }
43
48
  }}
@@ -1,3 +1,4 @@
1
+ /// <reference types="svelte" />
1
2
  export function activatePopup(...args: any[]): Popup;
2
3
  /**
3
4
  * Implement the popup handler.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -22,37 +22,37 @@
22
22
  "test": "playwright test",
23
23
  "test:unit": "vitest"
24
24
  },
25
- "peerDependencies": {
26
- "svelte": "^3.55.1"
25
+ "dependencies": {
26
+ "svelte": "^4.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@playwright/test": "^1.35.0",
29
+ "@playwright/test": "^1.35.1",
30
30
  "@sveltejs/adapter-auto": "2.1.0",
31
- "@sveltejs/kit": "1.20.2",
32
- "@sveltejs/package": "^2.0.2",
31
+ "@sveltejs/kit": "^1.20.5",
32
+ "@sveltejs/package": "^2.1.0",
33
33
  "cspell": "^6.31.1",
34
- "eslint": "^8.42.0",
34
+ "eslint": "^8.43.0",
35
35
  "eslint-config-airbnb-base": "^15.0.0",
36
36
  "eslint-config-prettier": "^8.8.0",
37
37
  "eslint-plugin-import": "^2.27.5",
38
38
  "eslint-plugin-jsdoc": "^46.2.6",
39
- "eslint-plugin-svelte": "^2.30.0",
39
+ "eslint-plugin-svelte": "^2.31.1",
40
40
  "npm-run-all": "^4.1.5",
41
41
  "postcss": "^8.4.24",
42
42
  "postcss-html": "^1.5.0",
43
43
  "prettier": "^2.8.8",
44
44
  "prettier-plugin-svelte": "^2.10.1",
45
- "sass": "^1.63.3",
46
- "stylelint": "^15.7.0",
45
+ "sass": "^1.63.4",
46
+ "stylelint": "^15.8.0",
47
47
  "stylelint-config-recommended-scss": "^12.0.0",
48
48
  "stylelint-scss": "^5.0.1",
49
- "svelte-check": "^3.4.3",
49
+ "svelte-check": "^3.4.4",
50
50
  "svelte-i18n": "^3.6.0",
51
- "svelte-migrate": "^1.2.1",
51
+ "svelte-migrate": "^1.2.4",
52
52
  "svelte-preprocess": "^5.0.4",
53
53
  "tslib": "^2.5.3",
54
54
  "vite": "^4.3.9",
55
- "vitest": "^0.32.0"
55
+ "vitest": "^0.32.2"
56
56
  },
57
57
  "exports": {
58
58
  "./package.json": "./package.json",