@sveltia/ui 0.16.0 → 0.17.1

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 (156) hide show
  1. package/package/components/alert/alert.svelte +22 -7
  2. package/package/components/alert/alert.svelte.d.ts +32 -28
  3. package/package/components/button/button-group.svelte +16 -6
  4. package/package/components/button/button-group.svelte.d.ts +23 -23
  5. package/package/components/button/button.svelte +41 -136
  6. package/package/components/button/button.svelte.d.ts +5 -146
  7. package/package/components/button/select-button-group.svelte +31 -37
  8. package/package/components/button/select-button-group.svelte.d.ts +76 -34
  9. package/package/components/button/select-button.svelte +19 -62
  10. package/package/components/button/select-button.svelte.d.ts +17 -73
  11. package/package/components/button/split-button.svelte +37 -47
  12. package/package/components/button/split-button.svelte.d.ts +40 -47
  13. package/package/components/calendar/calendar.svelte +80 -55
  14. package/package/components/calendar/calendar.svelte.d.ts +13 -10
  15. package/package/components/checkbox/checkbox-group.svelte +23 -20
  16. package/package/components/checkbox/checkbox-group.svelte.d.ts +49 -27
  17. package/package/components/checkbox/checkbox.svelte +57 -67
  18. package/package/components/checkbox/checkbox.svelte.d.ts +67 -55
  19. package/package/components/dialog/alert-dialog.svelte +9 -36
  20. package/package/components/dialog/alert-dialog.svelte.d.ts +5 -44
  21. package/package/components/dialog/confirmation-dialog.svelte +9 -41
  22. package/package/components/dialog/confirmation-dialog.svelte.d.ts +5 -46
  23. package/package/components/dialog/dialog.svelte +60 -105
  24. package/package/components/dialog/dialog.svelte.d.ts +5 -102
  25. package/package/components/dialog/prompt-dialog.svelte +32 -61
  26. package/package/components/dialog/prompt-dialog.svelte.d.ts +38 -62
  27. package/package/components/disclosure/disclosure.svelte +39 -34
  28. package/package/components/disclosure/disclosure.svelte.d.ts +74 -56
  29. package/package/components/divider/divider.svelte +18 -14
  30. package/package/components/divider/divider.svelte.d.ts +31 -10
  31. package/package/components/divider/spacer.svelte +13 -8
  32. package/package/components/divider/spacer.svelte.d.ts +20 -9
  33. package/package/components/drawer/drawer.svelte +63 -76
  34. package/package/components/drawer/drawer.svelte.d.ts +102 -84
  35. package/package/components/grid/grid-body.svelte +15 -10
  36. package/package/components/grid/grid-body.svelte.d.ts +30 -24
  37. package/package/components/grid/grid-cell.svelte +16 -6
  38. package/package/components/grid/grid-cell.svelte.d.ts +23 -23
  39. package/package/components/grid/grid-col-header.svelte +16 -6
  40. package/package/components/grid/grid-col-header.svelte.d.ts +23 -23
  41. package/package/components/grid/grid-foot.svelte +16 -6
  42. package/package/components/grid/grid-foot.svelte.d.ts +23 -23
  43. package/package/components/grid/grid-head.svelte +16 -6
  44. package/package/components/grid/grid-head.svelte.d.ts +23 -23
  45. package/package/components/grid/grid-row-header.svelte +16 -6
  46. package/package/components/grid/grid-row-header.svelte.d.ts +23 -23
  47. package/package/components/grid/grid-row.svelte +19 -23
  48. package/package/components/grid/grid-row.svelte.d.ts +48 -38
  49. package/package/components/grid/grid.svelte +28 -25
  50. package/package/components/grid/grid.svelte.d.ts +56 -32
  51. package/package/components/icon/icon.svelte +14 -9
  52. package/package/components/icon/icon.svelte.d.ts +20 -9
  53. package/package/components/listbox/listbox.svelte +46 -52
  54. package/package/components/listbox/listbox.svelte.d.ts +102 -40
  55. package/package/components/listbox/option-group.svelte +23 -19
  56. package/package/components/listbox/option-group.svelte.d.ts +49 -27
  57. package/package/components/listbox/option.svelte +44 -57
  58. package/package/components/listbox/option.svelte.d.ts +54 -84
  59. package/package/components/menu/menu-button.svelte +42 -63
  60. package/package/components/menu/menu-button.svelte.d.ts +18 -72
  61. package/package/components/menu/menu-item-checkbox.svelte +29 -41
  62. package/package/components/menu/menu-item-checkbox.svelte.d.ts +5 -44
  63. package/package/components/menu/menu-item-group.svelte +22 -19
  64. package/package/components/menu/menu-item-group.svelte.d.ts +41 -27
  65. package/package/components/menu/menu-item-radio.svelte +29 -41
  66. package/package/components/menu/menu-item-radio.svelte.d.ts +5 -44
  67. package/package/components/menu/menu-item.svelte +66 -75
  68. package/package/components/menu/menu-item.svelte.d.ts +5 -80
  69. package/package/components/menu/menu.svelte +27 -22
  70. package/package/components/menu/menu.svelte.d.ts +50 -30
  71. package/package/components/radio/radio-group.svelte +38 -42
  72. package/package/components/radio/radio-group.svelte.d.ts +85 -35
  73. package/package/components/radio/radio.svelte +45 -48
  74. package/package/components/radio/radio.svelte.d.ts +96 -42
  75. package/package/components/select/combobox.svelte +76 -101
  76. package/package/components/select/combobox.svelte.d.ts +5 -56
  77. package/package/components/select/select-tags.svelte +48 -59
  78. package/package/components/select/select-tags.svelte.d.ts +109 -28
  79. package/package/components/select/select.svelte +18 -37
  80. package/package/components/select/select.svelte.d.ts +5 -40
  81. package/package/components/slider/slider.svelte +71 -68
  82. package/package/components/slider/slider.svelte.d.ts +142 -31
  83. package/package/components/switch/switch.svelte +36 -46
  84. package/package/components/switch/switch.svelte.d.ts +83 -37
  85. package/package/components/table/table-body.svelte +15 -11
  86. package/package/components/table/table-body.svelte.d.ts +30 -24
  87. package/package/components/table/table-cell.svelte +16 -6
  88. package/package/components/table/table-cell.svelte.d.ts +23 -23
  89. package/package/components/table/table-col-header.svelte +16 -6
  90. package/package/components/table/table-col-header.svelte.d.ts +23 -23
  91. package/package/components/table/table-foot.svelte +16 -6
  92. package/package/components/table/table-foot.svelte.d.ts +23 -23
  93. package/package/components/table/table-head.svelte +16 -6
  94. package/package/components/table/table-head.svelte.d.ts +23 -23
  95. package/package/components/table/table-row-header.svelte +16 -6
  96. package/package/components/table/table-row-header.svelte.d.ts +23 -23
  97. package/package/components/table/table-row.svelte +16 -6
  98. package/package/components/table/table-row.svelte.d.ts +23 -23
  99. package/package/components/table/table.svelte +16 -6
  100. package/package/components/table/table.svelte.d.ts +23 -23
  101. package/package/components/tabs/tab-box.svelte +16 -9
  102. package/package/components/tabs/tab-box.svelte.d.ts +32 -22
  103. package/package/components/tabs/tab-list.svelte +36 -35
  104. package/package/components/tabs/tab-list.svelte.d.ts +65 -33
  105. package/package/components/tabs/tab-panel.svelte +16 -6
  106. package/package/components/tabs/tab-panel.svelte.d.ts +23 -23
  107. package/package/components/tabs/tab-panels.svelte +16 -6
  108. package/package/components/tabs/tab-panels.svelte.d.ts +23 -21
  109. package/package/components/tabs/tab.svelte +28 -25
  110. package/package/components/tabs/tab.svelte.d.ts +17 -63
  111. package/package/components/text-editor/lexical-root.svelte +38 -32
  112. package/package/components/text-editor/lexical-root.svelte.d.ts +74 -13
  113. package/package/components/text-editor/text-editor.svelte +63 -79
  114. package/package/components/text-editor/text-editor.svelte.d.ts +97 -20
  115. package/package/components/text-editor/toolbar/editor-toolbar.svelte +41 -24
  116. package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +32 -7
  117. package/package/components/text-editor/toolbar/format-text-button.svelte +15 -5
  118. package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +13 -6
  119. package/package/components/text-editor/toolbar/insert-link-button.svelte +18 -16
  120. package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +4 -8
  121. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +19 -7
  122. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +13 -6
  123. package/package/components/text-field/number-input.svelte +63 -81
  124. package/package/components/text-field/number-input.svelte.d.ts +48 -55
  125. package/package/components/text-field/password-input.svelte +38 -57
  126. package/package/components/text-field/password-input.svelte.d.ts +16 -45
  127. package/package/components/text-field/search-bar.svelte +45 -62
  128. package/package/components/text-field/search-bar.svelte.d.ts +25 -66
  129. package/package/components/text-field/text-area.svelte +38 -54
  130. package/package/components/text-field/text-area.svelte.d.ts +100 -35
  131. package/package/components/text-field/text-input.svelte +28 -86
  132. package/package/components/text-field/text-input.svelte.d.ts +4 -78
  133. package/package/components/toast/toast.svelte +36 -30
  134. package/package/components/toast/toast.svelte.d.ts +50 -28
  135. package/package/components/toolbar/toolbar.svelte +25 -25
  136. package/package/components/toolbar/toolbar.svelte.d.ts +57 -29
  137. package/package/components/util/app-shell.svelte +22 -10
  138. package/package/components/util/app-shell.svelte.d.ts +25 -29
  139. package/package/components/util/group.svelte +20 -15
  140. package/package/components/util/group.svelte.d.ts +40 -26
  141. package/package/components/util/modal.svelte +89 -105
  142. package/package/components/util/modal.svelte.d.ts +6 -71
  143. package/package/components/util/placeholder.svelte +21 -0
  144. package/package/components/util/{portal.svelte.d.ts → placeholder.svelte.d.ts} +17 -25
  145. package/package/components/util/popup.svelte +65 -62
  146. package/package/components/util/popup.svelte.d.ts +89 -77
  147. package/package/services/{group.js → group.svelte.js} +11 -12
  148. package/package/services/{popup.js → popup.svelte.js} +6 -5
  149. package/package/typedefs.d.ts +545 -0
  150. package/package/typedefs.js +202 -0
  151. package/package.json +12 -19
  152. package/package/components/util/portal.svelte +0 -36
  153. /package/package/services/{events.d.ts → events.svelte.d.ts} +0 -0
  154. /package/package/services/{events.js → events.svelte.js} +0 -0
  155. /package/package/services/{group.d.ts → group.svelte.d.ts} +0 -0
  156. /package/package/services/{popup.d.ts → popup.svelte.d.ts} +0 -0
@@ -1,48 +1,80 @@
1
1
  export default TabList;
2
- type TabList = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- name?: string | undefined;
6
- disabled?: boolean | undefined;
7
- hidden?: boolean | undefined;
8
- orientation?: "vertical" | "horizontal" | undefined;
9
- }, {
10
- default: {};
11
- }>, {
12
- change: CustomEvent<any>;
13
- } & {
2
+ type TabList = SvelteComponent<Props & Record<string, any>, {
14
3
  [evt: string]: CustomEvent<any>;
15
- }, {
16
- default: {};
17
- }> & {
18
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
19
6
  };
20
7
  /**
21
8
  * A tab list widget.
22
9
  * @see https://w3c.github.io/aria/#tablist
23
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
24
11
  */
25
- declare const TabList: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
26
- [x: string]: any;
12
+ declare const TabList: $$__sveltets_2_IsomorphicComponent<{
13
+ /**
14
+ * - The `class` attribute on the wrapper element.
15
+ */
27
16
  class?: string | undefined;
28
- name?: string | undefined;
29
- disabled?: boolean | undefined;
17
+ /**
18
+ * - Whether to hide the widget.
19
+ */
30
20
  hidden?: boolean | undefined;
21
+ /**
22
+ * - Whether to disable the widget. An alias of the `aria-disabled`
23
+ * attribute.
24
+ */
25
+ disabled?: boolean | undefined;
26
+ /**
27
+ * - Orientation of the widget. An alias of
28
+ * the `aria-orientation` attribute.
29
+ */
31
30
  orientation?: "vertical" | "horizontal" | undefined;
32
- }, {
33
- default: {};
34
- }>, {
35
- change: CustomEvent<any>;
36
- } & {
31
+ /**
32
+ * - The `data-name` attribute on the wrapper element.
33
+ */
34
+ name?: string | undefined;
35
+ /**
36
+ * - Primary slot content.
37
+ */
38
+ children?: import("svelte").Snippet<[]> | undefined;
39
+ /**
40
+ * - Custom `Change` event handler.
41
+ */
42
+ onChange?: ((event: CustomEvent) => void) | undefined;
43
+ } & Record<string, any>, {
37
44
  [evt: string]: CustomEvent<any>;
38
- }, {
39
- default: {};
40
- }, {}, string>;
41
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
42
- default: any;
43
- } ? Props extends Record<string, never> ? any : {
44
- children?: any;
45
- } : {});
45
+ }, {}, {}, "">;
46
+ type Props = {
47
+ /**
48
+ * - The `class` attribute on the wrapper element.
49
+ */
50
+ class?: string | undefined;
51
+ /**
52
+ * - Whether to hide the widget.
53
+ */
54
+ hidden?: boolean | undefined;
55
+ /**
56
+ * - Whether to disable the widget. An alias of the `aria-disabled`
57
+ * attribute.
58
+ */
59
+ disabled?: boolean | undefined;
60
+ /**
61
+ * - Orientation of the widget. An alias of
62
+ * the `aria-orientation` attribute.
63
+ */
64
+ orientation?: "vertical" | "horizontal" | undefined;
65
+ /**
66
+ * - The `data-name` attribute on the wrapper element.
67
+ */
68
+ name?: string | undefined;
69
+ /**
70
+ * - Primary slot content.
71
+ */
72
+ children?: import("svelte").Snippet<[]> | undefined;
73
+ /**
74
+ * - Custom `Change` event handler.
75
+ */
76
+ onChange?: ((event: CustomEvent) => void) | undefined;
77
+ };
46
78
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
47
79
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
48
80
  $$bindings?: Bindings;
@@ -6,15 +6,25 @@
6
6
  -->
7
7
  <script>
8
8
  /**
9
- * The `class` attribute on the wrapper element.
10
- * @type {string}
9
+ * @typedef {object} Props
10
+ * @property {string} [class] - The `class` attribute on the wrapper element.
11
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
11
12
  */
12
- let className = '';
13
- export { className as class };
13
+
14
+ /**
15
+ * @type {Props & Record<string, any>}
16
+ */
17
+ let {
18
+ /* eslint-disable prefer-const */
19
+ class: className,
20
+ children,
21
+ ...restProps
22
+ /* eslint-enable prefer-const */
23
+ } = $props();
14
24
  </script>
15
25
 
16
- <div role="tabpanel" class="sui tab-panel {className}" {...$$restProps}>
17
- <slot />
26
+ <div {...restProps} role="tabpanel" class="sui tab-panel {className}">
27
+ {@render children?.()}
18
28
  </div>
19
29
 
20
30
  <style>.tab-panel {
@@ -1,36 +1,36 @@
1
1
  export default TabPanel;
2
- type TabPanel = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- }, {
6
- default: {};
7
- }>, {
2
+ type TabPanel = SvelteComponent<Props & Record<string, any>, {
8
3
  [evt: string]: CustomEvent<any>;
9
- }, {
10
- default: {};
11
- }> & {
12
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
13
6
  };
14
7
  /**
15
8
  * A tab content panel.
16
9
  * @see https://w3c.github.io/aria/#tabpanel
17
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
18
11
  */
19
- declare const TabPanel: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
20
- [x: string]: any;
12
+ declare const TabPanel: $$__sveltets_2_IsomorphicComponent<{
13
+ /**
14
+ * - The `class` attribute on the wrapper element.
15
+ */
21
16
  class?: string | undefined;
22
- }, {
23
- default: {};
24
- }>, {
17
+ /**
18
+ * - Primary slot content.
19
+ */
20
+ children?: import("svelte").Snippet<[]> | undefined;
21
+ } & Record<string, any>, {
25
22
  [evt: string]: CustomEvent<any>;
26
- }, {
27
- default: {};
28
- }, {}, string>;
29
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
30
- default: any;
31
- } ? Props extends Record<string, never> ? any : {
32
- children?: any;
33
- } : {});
23
+ }, {}, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * - The `class` attribute on the wrapper element.
27
+ */
28
+ class?: string | undefined;
29
+ /**
30
+ * - Primary slot content.
31
+ */
32
+ children?: import("svelte").Snippet<[]> | undefined;
33
+ };
34
34
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
35
35
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
36
36
  $$bindings?: Bindings;
@@ -5,15 +5,25 @@
5
5
  -->
6
6
  <script>
7
7
  /**
8
- * The `class` attribute on the wrapper element.
9
- * @type {string}
8
+ * @typedef {object} Props
9
+ * @property {string} [class] - The `class` attribute on the wrapper element.
10
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
10
11
  */
11
- let className = '';
12
- export { className as class };
12
+
13
+ /**
14
+ * @type {Props & Record<string, any>}
15
+ */
16
+ let {
17
+ /* eslint-disable prefer-const */
18
+ class: className,
19
+ children,
20
+ ...restProps
21
+ /* eslint-enable prefer-const */
22
+ } = $props();
13
23
  </script>
14
24
 
15
- <div role="none" class="sui tab-panels {className}">
16
- <slot />
25
+ <div {...restProps} role="none" class="sui tab-panels {className}">
26
+ {@render children?.()}
17
27
  </div>
18
28
 
19
29
  <style>.tab-panels {
@@ -1,33 +1,35 @@
1
1
  export default TabPanels;
2
- type TabPanels = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- class?: string | undefined;
4
- }, {
5
- default: {};
6
- }>, {
2
+ type TabPanels = SvelteComponent<Props & Record<string, any>, {
7
3
  [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> & {
11
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
12
6
  };
13
7
  /**
14
8
  * The container of `<TabPanel>`s. The component name derives from XUL. This can be omitted if the
15
9
  * child tab panels don’t need a sliding animation.
16
10
  */
17
- declare const TabPanels: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
11
+ declare const TabPanels: $$__sveltets_2_IsomorphicComponent<{
12
+ /**
13
+ * - The `class` attribute on the wrapper element.
14
+ */
18
15
  class?: string | undefined;
19
- }, {
20
- default: {};
21
- }>, {
16
+ /**
17
+ * - Primary slot content.
18
+ */
19
+ children?: import("svelte").Snippet<[]> | undefined;
20
+ } & Record<string, any>, {
22
21
  [evt: string]: CustomEvent<any>;
23
- }, {
24
- default: {};
25
- }, {}, string>;
26
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
27
- default: any;
28
- } ? Props extends Record<string, never> ? any : {
29
- children?: any;
30
- } : {});
22
+ }, {}, {}, "">;
23
+ type Props = {
24
+ /**
25
+ * - The `class` attribute on the wrapper element.
26
+ */
27
+ class?: string | undefined;
28
+ /**
29
+ * - Primary slot content.
30
+ */
31
+ children?: import("svelte").Snippet<[]> | undefined;
32
+ };
31
33
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
32
34
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
33
35
  $$bindings?: Bindings;
@@ -8,41 +8,44 @@
8
8
  import Button from '../button/button.svelte';
9
9
 
10
10
  /**
11
- * The `class` attribute on the `<button>` element.
12
- * @type {string}
11
+ * @typedef {object} Props
12
+ * @property {boolean} [selected] - Whether to select the widget. An alias of the `aria-selected`
13
+ * attribute.
13
14
  */
14
- let className = '';
15
- export { className as class };
16
- /**
17
- * Whether to select the widget. An alias of the `aria-selected` attribute.
18
- * @type {boolean}
19
- */
20
- export let selected = false;
21
- /**
22
- * Whether to hide the widget. An alias of the `aria-hidden` attribute.
23
- * @type {boolean | undefined}
24
- */
25
- export let hidden = undefined;
15
+
26
16
  /**
27
- * Whether to disable the widget. An alias of the `aria-disabled` attribute.
28
- * @type {boolean}
17
+ * @type {import('../../typedefs').ButtonProps & import('../../typedefs').CommonEventHandlers &
18
+ * Props & Record<string, any>}
29
19
  */
30
- export let disabled = false;
20
+ let {
21
+ /* eslint-disable prefer-const */
22
+ class: className,
23
+ hidden = false,
24
+ disabled = false,
25
+ selected = false,
26
+ children: _children,
27
+ startIcon: _startIcon,
28
+ endIcon: _endIcon,
29
+ ...restProps
30
+ /* eslint-enable prefer-const */
31
+ } = $props();
31
32
  </script>
32
33
 
33
34
  <Button
35
+ {...restProps}
34
36
  role="tab"
35
37
  class="sui tab {className}"
36
38
  {hidden}
37
39
  {disabled}
38
40
  aria-selected={selected}
39
- {...$$restProps}
40
- on:focus
41
- on:blur
42
- on:select
43
- on:change
44
41
  >
45
- <slot name="start-icon" slot="start-icon" />
46
- <slot />
47
- <slot name="end-icon" slot="end-icon" />
42
+ {#snippet startIcon()}
43
+ {@render _startIcon?.()}
44
+ {/snippet}
45
+ {#snippet children()}
46
+ {@render _children?.()}
47
+ {/snippet}
48
+ {#snippet endIcon()}
49
+ {@render _endIcon?.()}
50
+ {/snippet}
48
51
  </Button>
@@ -1,76 +1,30 @@
1
1
  export default Tab;
2
- type Tab = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- disabled?: boolean | undefined;
6
- hidden?: boolean | undefined;
7
- selected?: boolean | undefined;
8
- }, {
9
- 'start-icon': {
10
- slot: string;
11
- };
12
- default: {};
13
- 'end-icon': {
14
- slot: string;
15
- };
16
- }>, {
17
- focus: FocusEvent;
18
- blur: FocusEvent;
19
- select: CustomEvent<any>;
20
- change: CustomEvent<any>;
21
- } & {
2
+ type Tab = SvelteComponent<ButtonProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Props & Record<string, any>, {
22
3
  [evt: string]: CustomEvent<any>;
23
- }, {
24
- 'start-icon': {
25
- slot: string;
26
- };
27
- default: {};
28
- 'end-icon': {
29
- slot: string;
30
- };
31
- }> & {
32
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
33
6
  };
34
7
  /**
35
8
  * A tab widget.
36
9
  * @see https://w3c.github.io/aria/#tab
37
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
38
11
  */
39
- declare const Tab: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
40
- [x: string]: any;
41
- class?: string | undefined;
42
- disabled?: boolean | undefined;
43
- hidden?: boolean | undefined;
12
+ declare const Tab: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").ButtonProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & {
13
+ /**
14
+ * - Whether to select the widget. An alias of the `aria-selected`
15
+ * attribute.
16
+ */
44
17
  selected?: boolean | undefined;
45
- }, {
46
- 'start-icon': {
47
- slot: string;
48
- };
49
- default: {};
50
- 'end-icon': {
51
- slot: string;
52
- };
53
- }>, {
54
- focus: FocusEvent;
55
- blur: FocusEvent;
56
- select: CustomEvent<any>;
57
- change: CustomEvent<any>;
58
- } & {
18
+ } & Record<string, any>, {
59
19
  [evt: string]: CustomEvent<any>;
60
- }, {
61
- 'start-icon': {
62
- slot: string;
63
- };
64
- default: {};
65
- 'end-icon': {
66
- slot: string;
67
- };
68
- }, {}, string>;
69
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
70
- default: any;
71
- } ? Props extends Record<string, never> ? any : {
72
- children?: any;
73
- } : {});
20
+ }, {}, {}, "">;
21
+ type Props = {
22
+ /**
23
+ * - Whether to select the widget. An alias of the `aria-selected`
24
+ * attribute.
25
+ */
26
+ selected?: boolean | undefined;
27
+ };
74
28
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
75
29
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
76
30
  $$bindings?: Bindings;
@@ -2,35 +2,37 @@
2
2
  import { getContext, onMount } from 'svelte';
3
3
 
4
4
  /**
5
- * Whether to hide the widget. An alias of the `aria-hidden` attribute.
6
- * @type {boolean | undefined}
5
+ * @typedef {object} Props
6
+ * @property {string | undefined} [value] - Input value.
7
+ * @property {string} [class] - The `class` attribute on the wrapper element.
8
+ * @property {boolean} [hidden] - Whether to hide the widget.
9
+ * @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
10
+ * attribute.
11
+ * @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
12
+ * `aria-readonly` attribute.
13
+ * @property {boolean} [required] - Whether to mark the widget required. An alias of the
14
+ * `aria-required` attribute.
15
+ * @property {boolean} [invalid] - Whether to mark the widget invalid. An alias of the
16
+ * `aria-invalid` attribute.
17
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
7
18
  */
8
- export let hidden = undefined;
9
- /**
10
- * Whether to disable the widget. An alias of the `aria-disabled` attribute.
11
- * @type {boolean}
12
- */
13
- export let disabled = false;
14
- /**
15
- * Whether to disable the widget. An alias of `aria-readonly` attribute.
16
- * @type {boolean}
17
- */
18
- export let readonly = false;
19
- /**
20
- * Whether to mark the widget required. An alias of the `aria-required` attribute.
21
- * @type {boolean}
22
- */
23
- export let required = false;
24
- /**
25
- * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
26
- * @type {boolean}
27
- */
28
- export let invalid = false;
19
+
29
20
  /**
30
- * Input value.
31
- * @type {string | undefined}
21
+ * @type {Props & Record<string, any>}
32
22
  */
33
- export let value = undefined;
23
+ let {
24
+ /* eslint-disable prefer-const */
25
+ value = $bindable(),
26
+ class: className,
27
+ hidden = false,
28
+ disabled = false,
29
+ readonly = false,
30
+ required = false,
31
+ invalid = false,
32
+ children,
33
+ ...restProps
34
+ /* eslint-enable prefer-const */
35
+ } = $props();
34
36
 
35
37
  /**
36
38
  * Text editor state.
@@ -43,10 +45,13 @@
43
45
  * Reference to the Lexical editor root element.
44
46
  * @type {HTMLElement | undefined}
45
47
  */
46
- let lexicalRoot = undefined;
48
+ let lexicalRoot = $state();
47
49
 
48
- $: editable = !(disabled || readonly);
49
- $: $editor?.setEditable(editable);
50
+ const editable = $derived(!(disabled || readonly));
51
+
52
+ $effect(() => {
53
+ $editor?.setEditable(editable);
54
+ });
50
55
 
51
56
  /**
52
57
  * Update {@link value} and other state variables whenever the editor content is updated.
@@ -88,14 +93,16 @@
88
93
  };
89
94
  });
90
95
 
91
- $: {
96
+ $effect(() => {
92
97
  if ($editor && lexicalRoot) {
93
98
  $editor.setRootElement(lexicalRoot);
94
99
  }
95
- }
100
+ });
96
101
  </script>
97
102
 
98
103
  <div
104
+ bind:this={lexicalRoot}
105
+ {...restProps}
99
106
  role="textbox"
100
107
  aria-multiline="true"
101
108
  aria-hidden={hidden}
@@ -107,7 +114,6 @@
107
114
  id="{$editorId}-lexical-root"
108
115
  contenteditable={editable}
109
116
  {hidden}
110
- bind:this={lexicalRoot}
111
117
  ></div>
112
118
 
113
119
  <style>.lexical-root {
@@ -1,26 +1,87 @@
1
1
  export default LexicalRoot;
2
- type LexicalRoot = SvelteComponent<{
3
- disabled?: boolean | undefined;
4
- invalid?: boolean | undefined;
5
- required?: boolean | undefined;
6
- value?: string | undefined;
7
- hidden?: boolean | undefined;
8
- readonly?: boolean | undefined;
9
- }, {
2
+ type LexicalRoot = SvelteComponent<Props & Record<string, any>, {
10
3
  [evt: string]: CustomEvent<any>;
11
4
  }, {}> & {
12
- $$bindings?: string | undefined;
5
+ $$bindings?: "value" | undefined;
13
6
  };
14
7
  declare const LexicalRoot: $$__sveltets_2_IsomorphicComponent<{
8
+ /**
9
+ * - Input value.
10
+ */
11
+ value?: string | undefined;
12
+ /**
13
+ * - The `class` attribute on the wrapper element.
14
+ */
15
+ class?: string | undefined;
16
+ /**
17
+ * - Whether to hide the widget.
18
+ */
19
+ hidden?: boolean | undefined;
20
+ /**
21
+ * - Whether to disable the widget. An alias of the `aria-disabled`
22
+ * attribute.
23
+ */
15
24
  disabled?: boolean | undefined;
16
- invalid?: boolean | undefined;
25
+ /**
26
+ * - Whether to make the widget read-only. An alias of the
27
+ * `aria-readonly` attribute.
28
+ */
29
+ readonly?: boolean | undefined;
30
+ /**
31
+ * - Whether to mark the widget required. An alias of the
32
+ * `aria-required` attribute.
33
+ */
17
34
  required?: boolean | undefined;
35
+ /**
36
+ * - Whether to mark the widget invalid. An alias of the
37
+ * `aria-invalid` attribute.
38
+ */
39
+ invalid?: boolean | undefined;
40
+ /**
41
+ * - Primary slot content.
42
+ */
43
+ children?: import("svelte").Snippet<[]> | undefined;
44
+ } & Record<string, any>, {
45
+ [evt: string]: CustomEvent<any>;
46
+ }, {}, {}, "value">;
47
+ type Props = {
48
+ /**
49
+ * - Input value.
50
+ */
18
51
  value?: string | undefined;
52
+ /**
53
+ * - The `class` attribute on the wrapper element.
54
+ */
55
+ class?: string | undefined;
56
+ /**
57
+ * - Whether to hide the widget.
58
+ */
19
59
  hidden?: boolean | undefined;
60
+ /**
61
+ * - Whether to disable the widget. An alias of the `aria-disabled`
62
+ * attribute.
63
+ */
64
+ disabled?: boolean | undefined;
65
+ /**
66
+ * - Whether to make the widget read-only. An alias of the
67
+ * `aria-readonly` attribute.
68
+ */
20
69
  readonly?: boolean | undefined;
21
- }, {
22
- [evt: string]: CustomEvent<any>;
23
- }, {}, {}, string>;
70
+ /**
71
+ * - Whether to mark the widget required. An alias of the
72
+ * `aria-required` attribute.
73
+ */
74
+ required?: boolean | undefined;
75
+ /**
76
+ * - Whether to mark the widget invalid. An alias of the
77
+ * `aria-invalid` attribute.
78
+ */
79
+ invalid?: boolean | undefined;
80
+ /**
81
+ * - Primary slot content.
82
+ */
83
+ children?: import("svelte").Snippet<[]> | undefined;
84
+ };
24
85
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
25
86
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
26
87
  $$bindings?: Bindings;