reburn-ui 0.4.10 → 0.4.11

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 (143) hide show
  1. package/dist/core/CodeHighlight/CodeHighlight.context.svelte.d.ts +2 -5
  2. package/dist/core/CodeHighlight/CodeHighlight.context.svelte.js +4 -3
  3. package/dist/core/CodeHighlight/CodeHighlight.svelte +6 -10
  4. package/dist/core/CodeHighlight/CodeHighlightControl.svelte +51 -1
  5. package/dist/core/CodeHighlight/CopyCodeButton/CopyCodeButton.svelte +2 -2
  6. package/dist/core/Notifications/NotificationContainer.svelte +4 -3
  7. package/dist/core/Notifications/Notifications.svelte +2 -2
  8. package/dist/core/Notifications/NotificationsStore.svelte.d.ts +1 -1
  9. package/dist/core/Notifications/NotificationsStore.svelte.js +1 -1
  10. package/dist/core/charts/ChartRoot/ChartContext.svelte.d.ts +2 -13
  11. package/dist/core/charts/ChartRoot/ChartContext.svelte.js +4 -3
  12. package/dist/core/charts/ChartRoot/ChartRoot.svelte +6 -8
  13. package/dist/core/charts/ChartTooltip/ChartTooltip.svelte +21 -6
  14. package/dist/core/charts/ScatterChart/ScatterChartInner.svelte +7 -5
  15. package/dist/core/charts/ScatterChart/ScatterChartInner.svelte.d.ts +1 -1
  16. package/dist/core/components/Anchor/Anchor.svelte +65 -0
  17. package/dist/core/components/Anchor/Anchor.svelte.d.ts +9 -0
  18. package/dist/core/components/AppShell/AppShell.svelte +2 -4
  19. package/dist/core/components/AppShell/AppShellContext.svelte.d.ts +7 -12
  20. package/dist/core/components/AppShell/AppShellContext.svelte.js +4 -3
  21. package/dist/core/components/Checkbox/Checkbox.svelte +37 -18
  22. package/dist/core/components/Checkbox/CheckboxCard/CheckboxCard.svelte +1 -4
  23. package/dist/core/components/Checkbox/CheckboxCard/CheckboxCardContext.svelte.d.ts +1 -2
  24. package/dist/core/components/Checkbox/CheckboxCard/CheckboxCardContext.svelte.js +4 -3
  25. package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroup.svelte +4 -7
  26. package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroup.svelte.d.ts +2 -2
  27. package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroupContext.svelte.d.ts +1 -2
  28. package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroupContext.svelte.js +4 -3
  29. package/dist/core/components/Checkbox/CheckboxIndicator.svelte +5 -7
  30. package/dist/core/components/Chip/ChipGroup/ChipGroup.svelte +1 -4
  31. package/dist/core/components/Chip/ChipGroup/ChipGroupContext.svelte.d.ts +1 -2
  32. package/dist/core/components/Chip/ChipGroup/ChipGroupContext.svelte.js +4 -3
  33. package/dist/core/components/Combobox/Combobox.svelte +3 -6
  34. package/dist/core/components/Combobox/Combobox.svelte.d.ts +1 -1
  35. package/dist/core/components/Combobox/ComboboxContext.svelte.d.ts +1 -2
  36. package/dist/core/components/Combobox/ComboboxContext.svelte.js +4 -3
  37. package/dist/core/components/CopyButton/CopyButton.svelte +2 -3
  38. package/dist/core/components/Floating/CreateFloating.svelte.d.ts +1 -1
  39. package/dist/core/components/Floating/CreateFloating.svelte.js +4 -4
  40. package/dist/core/components/Input/Input.context.svelte.d.ts +1 -2
  41. package/dist/core/components/Input/Input.context.svelte.js +4 -3
  42. package/dist/core/components/Input/Input.svelte +2 -4
  43. package/dist/core/components/Input/InputWrapper.context.svelte.d.ts +1 -2
  44. package/dist/core/components/Input/InputWrapper.context.svelte.js +4 -3
  45. package/dist/core/components/Input/InputWrapper.svelte +2 -4
  46. package/dist/core/components/ModalBase/CreateModal.svelte.js +2 -2
  47. package/dist/core/components/ModalBase/LockScroll.svelte.js +2 -2
  48. package/dist/core/components/Overlay/Overlay.svelte +2 -4
  49. package/dist/core/components/Pill/PillGroup.svelte +1 -4
  50. package/dist/core/components/Pill/PillGroupContext.svelte.d.ts +4 -8
  51. package/dist/core/components/Pill/PillGroupContext.svelte.js +3 -2
  52. package/dist/core/components/Popover/Popover.svelte +8 -10
  53. package/dist/core/components/Popover/PopoverContext.svelte.d.ts +7 -7
  54. package/dist/core/components/Popover/PopoverContext.svelte.js +33 -56
  55. package/dist/core/components/Popover/PopoverDropdown.svelte +5 -5
  56. package/dist/core/components/Progress/ProgressContext.svelte.d.ts +1 -2
  57. package/dist/core/components/Progress/ProgressContext.svelte.js +4 -3
  58. package/dist/core/components/Progress/ProgressRoot.svelte +3 -5
  59. package/dist/core/components/ScrollArea/ScrollAreaCorner.svelte +3 -3
  60. package/dist/core/components/ScrollArea/ScrollAreaScrollbar/ScrollAreaScrollbarAuto.svelte +3 -3
  61. package/dist/core/components/ScrollArea/ScrollAreaScrollbar/Scrollbar.svelte +3 -3
  62. package/dist/core/components/Select/Select.svelte +2 -2
  63. package/dist/core/components/Slider/CreateRangeSlider.svelte.d.ts +1 -1
  64. package/dist/core/components/Slider/CreateRangeSlider.svelte.js +1 -1
  65. package/dist/core/components/Slider/CreateSlider.svelte.d.ts +1 -1
  66. package/dist/core/components/Slider/CreateSlider.svelte.js +1 -1
  67. package/dist/core/components/Stack/Stack.svelte +33 -0
  68. package/dist/core/components/Stack/Stack.svelte.d.ts +14 -0
  69. package/dist/core/components/Switch/SwitchGroup/SwitchGroup.svelte +2 -5
  70. package/dist/core/components/Switch/SwitchGroup/SwitchGroupContext.svelte.d.ts +1 -2
  71. package/dist/core/components/Switch/SwitchGroup/SwitchGroupContext.svelte.js +4 -3
  72. package/dist/core/components/Table/Table.svelte +1 -4
  73. package/dist/core/components/Table/TableContext.svelte.d.ts +1 -2
  74. package/dist/core/components/Table/TableContext.svelte.js +4 -3
  75. package/dist/core/components/Tabs/Tabs.svelte +87 -0
  76. package/dist/core/components/Tabs/Tabs.svelte.d.ts +41 -0
  77. package/dist/core/components/Tooltip/CreateTooltip.svelte.d.ts +1 -1
  78. package/dist/core/components/Tooltip/Tooltip.svelte +4 -3
  79. package/dist/core/components/Tooltip/Tooltip.svelte.d.ts +1 -1
  80. package/dist/core/components/Transitions/transitions.d.ts +31 -11
  81. package/dist/core/components/Transitions/transitions.js +13 -12
  82. package/dist/core/components/index.d.ts +3 -0
  83. package/dist/core/components/index.js +3 -0
  84. package/dist/core/hooks/index.d.ts +1 -0
  85. package/dist/core/hooks/index.js +1 -0
  86. package/dist/core/hooks/use-click-outside.svelte.d.ts +3 -5
  87. package/dist/core/hooks/use-click-outside.svelte.js +18 -15
  88. package/dist/core/hooks/use-clipboard.svelte.d.ts +6 -5
  89. package/dist/core/hooks/use-clipboard.svelte.js +17 -11
  90. package/dist/core/hooks/use-color-scheme.svelte.d.ts +3 -1
  91. package/dist/core/hooks/use-color-scheme.svelte.js +4 -1
  92. package/dist/core/hooks/use-counter.svelte.d.ts +3 -1
  93. package/dist/core/hooks/use-counter.svelte.js +4 -1
  94. package/dist/core/hooks/use-disclosur.svelte.d.ts +2 -1
  95. package/dist/core/hooks/use-disclosur.svelte.js +4 -1
  96. package/dist/core/hooks/use-focus-return.svelte.d.ts +3 -1
  97. package/dist/core/hooks/use-focus-return.svelte.js +4 -1
  98. package/dist/core/hooks/use-previous.svelte.d.ts +3 -1
  99. package/dist/core/hooks/use-previous.svelte.js +4 -1
  100. package/dist/core/hooks/use-reduced-motion.svelte.d.ts +1 -1
  101. package/dist/core/hooks/use-reduced-motion.svelte.js +1 -1
  102. package/dist/core/hooks/use-resize-observer.svelte.d.ts +3 -1
  103. package/dist/core/hooks/use-resize-observer.svelte.js +4 -1
  104. package/dist/core/hooks/utils/random-id.d.ts +1 -0
  105. package/dist/core/hooks/utils/random-id.js +3 -0
  106. package/dist/core/utils/data-attr.d.ts +1 -0
  107. package/dist/core/utils/data-attr.js +3 -0
  108. package/dist/docs/CodeDemo.svelte +23 -0
  109. package/dist/docs/CodeDemo.svelte.d.ts +7 -0
  110. package/dist/docs/DocsNavbar.svelte +47 -0
  111. package/dist/docs/DocsNavbar.svelte.d.ts +18 -0
  112. package/dist/docs/DocsTitle.svelte +36 -0
  113. package/dist/docs/DocsTitle.svelte.d.ts +6 -0
  114. package/dist/docs/StaticDemo.svelte +62 -0
  115. package/dist/docs/StaticDemo.svelte.d.ts +11 -0
  116. package/dist/docs/UsageDemo.svelte +65 -17
  117. package/dist/docs/UsageDemo.svelte.d.ts +15 -7
  118. package/dist/docs/UsageDemoSizeSlider.svelte +41 -0
  119. package/dist/docs/UsageDemoSizeSlider.svelte.d.ts +14 -0
  120. package/dist/docs/formatProps.d.ts +6 -0
  121. package/dist/docs/formatProps.js +37 -0
  122. package/dist/dropzone/Child.svelte +11 -0
  123. package/dist/dropzone/Child.svelte.d.ts +18 -0
  124. package/dist/dropzone/Dropzone.svelte +141 -0
  125. package/dist/dropzone/Dropzone.svelte.d.ts +90 -0
  126. package/dist/dropzone/DropzoneContext.svelte.d.ts +7 -0
  127. package/dist/dropzone/DropzoneContext.svelte.js +13 -0
  128. package/dist/index.d.ts +1 -0
  129. package/dist/index.js +1 -0
  130. package/dist/ports/index.d.ts +1 -0
  131. package/dist/ports/index.js +1 -0
  132. package/dist/ports/svelte-dropzone/CreateDropzone.svelte.d.ts +23 -0
  133. package/dist/ports/svelte-dropzone/CreateDropzone.svelte.js +402 -0
  134. package/dist/ports/svelte-dropzone/types.d.ts +28 -0
  135. package/dist/ports/svelte-dropzone/types.js +1 -0
  136. package/dist/ports/svelte-dropzone/utils.d.ts +133 -0
  137. package/dist/ports/svelte-dropzone/utils.js +235 -0
  138. package/dist/styles/default-css-variables.css +14 -6
  139. package/dist/svelte-utils/CreateSvelteEvent.svelte.d.ts +20 -0
  140. package/dist/svelte-utils/CreateSvelteEvent.svelte.js +13 -0
  141. package/dist/{core/context → svelte-utils}/extract.d.ts +8 -1
  142. package/package.json +20 -18
  143. /package/dist/{core/context → svelte-utils}/extract.js +0 -0
@@ -25,9 +25,8 @@
25
25
 
26
26
  <script lang="ts">
27
27
  import { getRadius } from '../../../utils/get-size.js';
28
- import { setContext } from 'svelte';
29
28
  import { getCheckboxGroupContext } from '../CheckboxGroup/CheckboxGroupContext.svelte.js';
30
- import { CHECKBOX_CARD_CONTEXT_KEY, CheckboxCardContext } from './CheckboxCardContext.svelte.js';
29
+ import { CheckboxCardContext } from './CheckboxCardContext.svelte.js';
31
30
 
32
31
  let {
33
32
  checked = $bindable(false),
@@ -51,8 +50,6 @@
51
50
  context?.change(value, !checkboxCardContext.checked);
52
51
  checked = !checkboxCardContext.checked;
53
52
  }
54
-
55
- setContext(CHECKBOX_CARD_CONTEXT_KEY, checkboxCardContext);
56
53
  </script>
57
54
 
58
55
  <button
@@ -1,5 +1,4 @@
1
- import { type MaybeGetter } from '../../../context/extract.js';
2
- export declare const CHECKBOX_CARD_CONTEXT_KEY: unique symbol;
1
+ import { type MaybeGetter } from '../../../../svelte-utils/extract.js';
3
2
  export declare class CheckboxCardContext {
4
3
  checked: boolean | undefined;
5
4
  constructor(checked: MaybeGetter<boolean | undefined>);
@@ -1,10 +1,11 @@
1
- import { extract } from '../../../context/extract.js';
2
- import { getContext } from 'svelte';
3
- export const CHECKBOX_CARD_CONTEXT_KEY = Symbol();
1
+ import { extract } from '../../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
+ const CHECKBOX_CARD_CONTEXT_KEY = Symbol();
4
4
  export class CheckboxCardContext {
5
5
  checked;
6
6
  constructor(checked) {
7
7
  this.checked = $derived(extract(checked));
8
+ setContext(CHECKBOX_CARD_CONTEXT_KEY, this);
8
9
  }
9
10
  }
10
11
  export function getCheckboxCardContext() {
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" module>
2
+ import type { DivElement } from '../../../element-types.js';
2
3
  import type { MantineSize } from '../../../MantineProvider/theme.types.js';
3
4
  import { type Snippet } from 'svelte';
4
5
  import type { InputWrapperProps } from '../../Input/InputWrapper.svelte';
@@ -17,7 +18,7 @@
17
18
  onChange?: (value: string[]) => void;
18
19
 
19
20
  /** Props passed down to the root element (`Input.Wrapper` component) */
20
- wrapperProps?: SvelteHTMLElements['div'];
21
+ wrapperProps?: DivElement;
21
22
 
22
23
  /** Controls size of the `Input.Wrapper`, `'sm'` by default */
23
24
  size?: MantineSize | (string & {});
@@ -28,10 +29,8 @@
28
29
  </script>
29
30
 
30
31
  <script lang="ts">
31
- import { setContext } from 'svelte';
32
- import type { SvelteHTMLElements } from 'svelte/elements';
33
32
  import Input from '../../Input/index.js';
34
- import { CHECKBOX_GROUP_CONTEXT_KEY, CheckboxGroupContext } from './CheckboxGroupContext.svelte.js';
33
+ import { CheckboxGroupContext } from './CheckboxGroupContext.svelte.js';
35
34
 
36
35
  let {
37
36
  children,
@@ -54,9 +53,7 @@
54
53
  onChange?.(value);
55
54
  }
56
55
 
57
- const context = new CheckboxGroupContext(() => value, handleChange);
58
-
59
- setContext(CHECKBOX_GROUP_CONTEXT_KEY, context);
56
+ new CheckboxGroupContext(() => value, handleChange);
60
57
  </script>
61
58
 
62
59
  <Input.Wrapper {...props} {size}>
@@ -1,3 +1,4 @@
1
+ import type { DivElement } from '../../../element-types.js';
1
2
  import type { MantineSize } from '../../../MantineProvider/theme.types.js';
2
3
  import { type Snippet } from 'svelte';
3
4
  import type { InputWrapperProps } from '../../Input/InputWrapper.svelte';
@@ -11,13 +12,12 @@ export interface CheckboxGroupProps extends InputWrapperProps {
11
12
  /** Called with an array of selected checkboxes values when value changes */
12
13
  onChange?: (value: string[]) => void;
13
14
  /** Props passed down to the root element (`Input.Wrapper` component) */
14
- wrapperProps?: SvelteHTMLElements['div'];
15
+ wrapperProps?: DivElement;
15
16
  /** Controls size of the `Input.Wrapper`, `'sm'` by default */
16
17
  size?: MantineSize | (string & {});
17
18
  /** If set, value cannot be changed */
18
19
  readOnly?: boolean;
19
20
  }
20
- import type { SvelteHTMLElements } from 'svelte/elements';
21
21
  declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "value">;
22
22
  type CheckboxGroup = ReturnType<typeof CheckboxGroup>;
23
23
  export default CheckboxGroup;
@@ -1,6 +1,5 @@
1
- import { type NonNullableGetter } from '../../../context/extract.js';
1
+ import { type NonNullableGetter } from '../../../../svelte-utils/extract.js';
2
2
  import type { CheckboxGroupProps } from './CheckboxGroup.svelte';
3
- export declare const CHECKBOX_GROUP_CONTEXT_KEY: unique symbol;
4
3
  export declare class CheckboxGroupContext {
5
4
  value: string[];
6
5
  change: (name: string, checked: boolean) => void;
@@ -1,12 +1,13 @@
1
- import { extract } from '../../../context/extract.js';
2
- import { getContext } from 'svelte';
3
- export const CHECKBOX_GROUP_CONTEXT_KEY = Symbol();
1
+ import { extract } from '../../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
+ const CHECKBOX_GROUP_CONTEXT_KEY = Symbol();
4
4
  export class CheckboxGroupContext {
5
5
  value;
6
6
  change;
7
7
  constructor(value, change) {
8
8
  this.value = $derived(extract(value));
9
9
  this.change = change;
10
+ setContext(CHECKBOX_GROUP_CONTEXT_KEY, this);
10
11
  }
11
12
  }
12
13
  export function getCheckboxGroupContext() {
@@ -66,12 +66,12 @@
66
66
  const context = getCheckboxCardContext();
67
67
 
68
68
  const _checked = $derived(
69
- typeof checked === 'boolean' || typeof indeterminate === 'boolean' ? checked || indeterminate : context?.checked || false
69
+ typeof checked === 'boolean' || typeof indeterminate === 'boolean' ? checked || indeterminate : context?.checked || false,
70
70
  );
71
71
 
72
72
  const parsedColor = $derived(parseThemeColor({ color: color || theme.primaryColor }));
73
73
  const outlineColor = $derived(
74
- parsedColor.isThemeColor && parsedColor.shade === undefined ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color
74
+ parsedColor.isThemeColor && parsedColor.shade === undefined ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color,
75
75
  );
76
76
 
77
77
  const dataAttributes = $derived({
@@ -97,11 +97,9 @@
97
97
  {...dataAttributes}
98
98
  >
99
99
  {#if _checked}
100
- {#if indeterminate}
101
- <IconMinus class={['icon', `icon--${variant}`]} {...dataAttributes} />
102
- {:else}
103
- <IconCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
104
- {/if}
100
+ <IconCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
101
+ {:else if indeterminate}
102
+ <IconMinus class={['icon', `icon--${variant}`]} {...dataAttributes} />
105
103
  {/if}
106
104
  </div>
107
105
 
@@ -22,8 +22,7 @@
22
22
  </script>
23
23
 
24
24
  <script lang="ts" generics="T extends boolean">
25
- import { setContext } from 'svelte';
26
- import { CHIP_GROUP_CONTEXT_KEY, ChipGroupContext } from './ChipGroupContext.svelte.js';
25
+ import { ChipGroupContext } from './ChipGroupContext.svelte.js';
27
26
 
28
27
  let {
29
28
  children,
@@ -53,8 +52,6 @@
53
52
  handleChange,
54
53
  () => multiple
55
54
  );
56
-
57
- setContext(CHIP_GROUP_CONTEXT_KEY, context);
58
55
  </script>
59
56
 
60
57
  {@render children?.()}
@@ -1,6 +1,5 @@
1
- import { type NonNullableGetter } from '../../../context/extract.js';
1
+ import { type NonNullableGetter } from '../../../../svelte-utils/extract.js';
2
2
  import type { ChipGroupProps } from './ChipGroup.svelte';
3
- export declare const CHIP_GROUP_CONTEXT_KEY: unique symbol;
4
3
  export declare class ChipGroupContext<T extends boolean = false> {
5
4
  value: (T extends true ? string[] : string | null) & {};
6
5
  change: (name: string, checked: boolean) => void;
@@ -1,6 +1,6 @@
1
- import { extract } from '../../../context/extract.js';
2
- import { getContext } from 'svelte';
3
- export const CHIP_GROUP_CONTEXT_KEY = Symbol();
1
+ import { extract } from '../../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
+ const CHIP_GROUP_CONTEXT_KEY = Symbol();
4
4
  export class ChipGroupContext {
5
5
  value;
6
6
  change;
@@ -9,6 +9,7 @@ export class ChipGroupContext {
9
9
  this.value = $derived(extract(value));
10
10
  this.change = change;
11
11
  this.multiple = $derived(extract(multiple));
12
+ setContext(CHIP_GROUP_CONTEXT_KEY, this);
12
13
  }
13
14
  }
14
15
  export function getChipGroupContext() {
@@ -1,13 +1,10 @@
1
1
  <script lang="ts" module>
2
2
  import type { __PopoverProps } from '../Popover/Popover.svelte';
3
- import Popover from '../Popover/Popover.svelte';
4
3
  import type { MantineSize } from '../../MantineProvider/theme.types.js';
5
4
  import type { Properties } from 'csstype';
6
5
  import { type Snippet } from 'svelte';
7
6
  import type { HTMLInputAttributes } from 'svelte/elements';
8
- import { COMBOBOX_CONTEXT_KEY, ComboboxContext } from './ComboboxContext.svelte.js';
9
7
  import type { ComboboxOptionProps } from './ComboboxOption.svelte';
10
- import { ComboboxStore } from './ComboboxStore.svelte.js';
11
8
 
12
9
  export type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';
13
10
 
@@ -36,7 +33,9 @@
36
33
  </script>
37
34
 
38
35
  <script lang="ts">
39
- import { setContext } from 'svelte';
36
+ import Popover from '../Popover/Popover.svelte';
37
+ import { ComboboxContext } from './ComboboxContext.svelte.js';
38
+ import { ComboboxStore } from './ComboboxStore.svelte.js';
40
39
 
41
40
  let {
42
41
  keepMounted = true,
@@ -64,8 +63,6 @@
64
63
  () => readOnly
65
64
  );
66
65
 
67
- setContext(COMBOBOX_CONTEXT_KEY, context);
68
-
69
66
  function onDropdownClose() {
70
67
  onclose?.();
71
68
  comboboxStore.closeDropdown();
@@ -4,7 +4,6 @@ import type { Properties } from 'csstype';
4
4
  import { type Snippet } from 'svelte';
5
5
  import type { HTMLInputAttributes } from 'svelte/elements';
6
6
  import type { ComboboxOptionProps } from './ComboboxOption.svelte';
7
- import { ComboboxStore } from './ComboboxStore.svelte.js';
8
7
  export type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';
9
8
  export interface ComboboxProps extends __PopoverProps {
10
9
  /** Combobox content */
@@ -22,6 +21,7 @@ export interface ComboboxProps extends __PopoverProps {
22
21
  /** Determines whether Combobox value can be changed */
23
22
  readOnly?: HTMLInputAttributes['readonly'];
24
23
  }
24
+ import { ComboboxStore } from './ComboboxStore.svelte.js';
25
25
  declare const Combobox: import("svelte").Component<ComboboxProps, {}, "">;
26
26
  type Combobox = ReturnType<typeof Combobox>;
27
27
  export default Combobox;
@@ -1,6 +1,5 @@
1
- import { type Getter, type NonNullableGetter } from '../../context/extract.js';
1
+ import { type Getter, type NonNullableGetter } from '../../../svelte-utils/extract.js';
2
2
  import type { ComboboxProps } from './Combobox.svelte';
3
- export declare const COMBOBOX_CONTEXT_KEY: unique symbol;
4
3
  export declare class ComboboxContext {
5
4
  store: import("./ComboboxStore.svelte.js").ComboboxStore;
6
5
  onoptionsubmit: ((value: string, optionProps: import("./ComboboxOption.svelte.js").ComboboxOptionProps) => void) | undefined;
@@ -1,6 +1,6 @@
1
- import { extract } from '../../context/extract.js';
2
- import { getContext } from 'svelte';
3
- export const COMBOBOX_CONTEXT_KEY = Symbol();
1
+ import { extract } from '../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
+ const COMBOBOX_CONTEXT_KEY = Symbol();
4
4
  export class ComboboxContext {
5
5
  store;
6
6
  onoptionsubmit;
@@ -13,6 +13,7 @@ export class ComboboxContext {
13
13
  this.size = $derived(extract(size));
14
14
  this.resetSelectionOnOptionHover = $derived(extract(resetSelectionOnOptionHover));
15
15
  this.readOnly = $derived(extract(readOnly));
16
+ setContext(COMBOBOX_CONTEXT_KEY, this);
16
17
  }
17
18
  }
18
19
  export function getComboboxContext() {
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" module>
2
+ import { useClipboard } from '../../hooks/use-clipboard.svelte.js';
2
3
  import type { Snippet } from 'svelte';
3
4
 
4
5
  export interface CopyButtonProps {
@@ -14,11 +15,9 @@
14
15
  </script>
15
16
 
16
17
  <script lang="ts">
17
- import { Clipboard } from '../../hooks/use-clipboard.svelte.js';
18
-
19
18
  let { children, value, timeout = 1000 }: CopyButtonProps = $props();
20
19
 
21
- const clipboard = new Clipboard({ timeout });
20
+ const clipboard = useClipboard({ timeout: () => timeout });
22
21
 
23
22
  $effect(() => {
24
23
  clipboard.options.timeout = timeout;
@@ -1,4 +1,4 @@
1
- import { type Getter, type MaybeGetter } from '../../context/extract.js';
1
+ import { type Getter, type MaybeGetter } from '../../../svelte-utils/extract.js';
2
2
  import type { Middleware } from '@floating-ui/dom';
3
3
  import { type MiddlewareData } from '@floating-ui/dom';
4
4
  import type { FloatingPosition, FloatingStrategy } from './types.js';
@@ -1,4 +1,4 @@
1
- import { extract } from '../../context/extract.js';
1
+ import { extract } from '../../../svelte-utils/extract.js';
2
2
  import { autoUpdate, computePosition } from '@floating-ui/dom';
3
3
  export class CreateFloating {
4
4
  #props;
@@ -31,12 +31,12 @@ export class CreateFloating {
31
31
  strategy: this.#strategy,
32
32
  placement: this.#placement,
33
33
  middleware: this.#middleware,
34
- }).then(({ x, y, middlewareData: mW, placement }) => {
34
+ }).then(({ x, y, middlewareData, placement }) => {
35
35
  this.x = x;
36
36
  this.y = y;
37
- this.middlewareData = mW;
37
+ this.middlewareData = middlewareData;
38
38
  this.#onpositionchange?.(placement);
39
- this.#onupdate?.({ x, y, middlewareData: mW });
39
+ this.#onupdate?.({ x, y, middlewareData });
40
40
  });
41
41
  };
42
42
  }
@@ -1,8 +1,7 @@
1
- import { type NonNullableGetter } from '../../context/extract.js';
1
+ import { type NonNullableGetter } from '../../../svelte-utils/extract.js';
2
2
  import type { __InputProps } from './Input.svelte';
3
3
  export declare class InputContext {
4
4
  size: string;
5
5
  constructor(size: NonNullableGetter<__InputProps['size']>);
6
6
  }
7
- export declare const INPUT_CONTEXT_KEY: unique symbol;
8
7
  export declare function getInputContext(): InputContext;
@@ -1,12 +1,13 @@
1
- import { extract } from '../../context/extract.js';
2
- import { getContext } from 'svelte';
1
+ import { extract } from '../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
3
  export class InputContext {
4
4
  size;
5
5
  constructor(size) {
6
6
  this.size = $derived(extract(size));
7
+ setContext(INPUT_CONTEXT_KEY, this);
7
8
  }
8
9
  }
9
- export const INPUT_CONTEXT_KEY = Symbol();
10
+ const INPUT_CONTEXT_KEY = Symbol();
10
11
  export function getInputContext() {
11
12
  return getContext(INPUT_CONTEXT_KEY);
12
13
  }
@@ -3,9 +3,9 @@
3
3
  import type { DivElement } from '../../element-types.js';
4
4
  import type { MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
5
5
  import type { Properties } from 'csstype';
6
- import { setContext, type Snippet } from 'svelte';
6
+ import { type Snippet } from 'svelte';
7
7
  import type { SvelteHTMLElements } from 'svelte/elements';
8
- import { INPUT_CONTEXT_KEY, InputContext } from './Input.context.svelte.js';
8
+ import { InputContext } from './Input.context.svelte.js';
9
9
  import type { __InputWrapperProps } from './InputWrapper.svelte';
10
10
 
11
11
  export interface __BaseInputProps extends __InputWrapperProps, Omit<__InputProps, 'wrapperProps'> {
@@ -146,8 +146,6 @@
146
146
 
147
147
  const context = new InputContext(() => size);
148
148
 
149
- setContext(INPUT_CONTEXT_KEY, context);
150
-
151
149
  const withRightSection = $derived(rightSection || (__clearable && __clearSection) || __defaultRightSection);
152
150
  </script>
153
151
 
@@ -1,5 +1,4 @@
1
- import { type Getter } from '../../context/extract.js';
2
- export declare const INPUT_WRAPPER_CONTEXT_KEY: unique symbol;
1
+ import { type Getter } from '../../../svelte-utils/extract.js';
3
2
  export declare class InputWrapperContext {
4
3
  describedBy: string | undefined;
5
4
  inputId: string | null;
@@ -1,6 +1,6 @@
1
- import { extract } from '../../context/extract.js';
2
- import { getContext } from 'svelte';
3
- export const INPUT_WRAPPER_CONTEXT_KEY = Symbol();
1
+ import { extract } from '../../../svelte-utils/extract.js';
2
+ import { getContext, setContext } from 'svelte';
3
+ const INPUT_WRAPPER_CONTEXT_KEY = Symbol();
4
4
  export class InputWrapperContext {
5
5
  describedBy;
6
6
  inputId;
@@ -13,6 +13,7 @@ export class InputWrapperContext {
13
13
  this.labelId = $derived(extract(labelId));
14
14
  this.offsetBottom = $derived(extract(offsetBottom));
15
15
  this.offsetTop = $derived(extract(offsetTop));
16
+ setContext(INPUT_WRAPPER_CONTEXT_KEY, this);
16
17
  }
17
18
  }
18
19
  export function getInputWrapperContext() {
@@ -1,12 +1,12 @@
1
1
  <script lang="ts" module>
2
2
  import type { DivElement } from '../../element-types.js';
3
3
  import type { MantineFontSize } from '../../MantineProvider/theme.types.js';
4
- import { setContext, type Snippet } from 'svelte';
4
+ import { type Snippet } from 'svelte';
5
5
  import { getInputOffsets } from './get-input-offsets.js';
6
6
  import InputDescription from './InputDescription.svelte';
7
7
  import InputError from './InputError.svelte';
8
8
  import InputLabel from './InputLabel.svelte';
9
- import { INPUT_WRAPPER_CONTEXT_KEY, InputWrapperContext } from './InputWrapper.context.svelte.js';
9
+ import { InputWrapperContext } from './InputWrapper.context.svelte.js';
10
10
 
11
11
  export interface __InputWrapperProps {
12
12
  /** Contents of `Input.Label` component. If not set, label is not rendered. */
@@ -99,8 +99,6 @@
99
99
  () => offset.offsetBottom,
100
100
  () => offset.offsetTop
101
101
  );
102
-
103
- setContext<InputWrapperContext>(INPUT_WRAPPER_CONTEXT_KEY, context);
104
102
  </script>
105
103
 
106
104
  <div {...props} class={['root', props.class]}>
@@ -1,6 +1,6 @@
1
- import { FocusReturn } from '../../hooks/use-focus-return.svelte.js';
2
1
  import { on } from 'svelte/events';
3
2
  import { LockScroll } from './LockScroll.svelte.js';
3
+ import { useFocusReturn } from '../../hooks/index.js';
4
4
  export class CreateModal {
5
5
  titleMounted = $state(false);
6
6
  bodyMounted = $state(false);
@@ -35,6 +35,6 @@ export class CreateModal {
35
35
  cleanup();
36
36
  };
37
37
  });
38
- new FocusReturn(() => this.opened, () => Boolean(this.trapFocus && this.returnFocus));
38
+ useFocusReturn(() => this.opened, () => Boolean(this.trapFocus && this.returnFocus));
39
39
  }
40
40
  }
@@ -1,4 +1,4 @@
1
- import { reducedMotion } from '../../hooks/use-reduced-motion.svelte.js';
1
+ import { useReducedMotion } from '../../hooks/use-reduced-motion.svelte.js';
2
2
  export class LockScroll {
3
3
  current = $state(false);
4
4
  #timeout = $state(-1);
@@ -6,7 +6,7 @@ export class LockScroll {
6
6
  #transitionDuration;
7
7
  constructor(input) {
8
8
  this.#opened = $derived(input.opened());
9
- this.#transitionDuration = $derived(reducedMotion ? 0 : input.transitionDuration());
9
+ this.#transitionDuration = $derived(useReducedMotion ? 0 : input.transitionDuration());
10
10
  $effect(() => {
11
11
  if (this.#opened) {
12
12
  this.current = true;
@@ -7,7 +7,7 @@
7
7
  import type { Properties } from 'csstype';
8
8
  import type { Snippet } from 'svelte';
9
9
  import type { SvelteHTMLElements } from 'svelte/elements';
10
- import { transitions, type TransitionOverrides } from '../Transitions/transitions.js';
10
+ import { fade, type TransitionOverrides } from '../Transitions/transitions.js';
11
11
 
12
12
  export type OverlayProps<T extends keyof SvelteHTMLElements = 'div'> = SvelteHTMLElements[T] & {
13
13
  /** Controls overlay `background-color` opacity 0–1, disregarded when `gradient` prop is set, `0.6` by default */
@@ -60,8 +60,6 @@
60
60
  transitionProps = {},
61
61
  ...props
62
62
  }: OverlayProps<T> = $props();
63
-
64
- const fadeTransition = transitions.fade;
65
63
  </script>
66
64
 
67
65
  <!-- TODO: maybe remove the background thingy for a css class, since the rgba function is pretty big -->
@@ -77,7 +75,7 @@
77
75
  style:--overlay-filter={blur ? `blur(${rem(blur)})` : undefined}
78
76
  style:--overlay-radius={radius ? getRadius(radius) : undefined}
79
77
  style:--overlay-z-index={zIndex?.toString()}
80
- transition:fadeTransition={transitionProps}
78
+ transition:fade={transitionProps}
81
79
  >
82
80
  {@render children?.()}
83
81
  </svelte:element>
@@ -16,8 +16,7 @@
16
16
 
17
17
  <script lang="ts">
18
18
  import { getSize } from '../../utils/get-size.js';
19
- import { setContext } from 'svelte';
20
- import { PILL_GROUP_CONTEXT_KEY, PillGroupContext } from './PillGroupContext.svelte.js';
19
+ import { PillGroupContext } from './PillGroupContext.svelte.js';
21
20
 
22
21
  let { children, gap, size = 'sm', disabled = false, ...props }: PillGroupProps = $props();
23
22
 
@@ -25,8 +24,6 @@
25
24
  size: () => size,
26
25
  disabled: () => disabled,
27
26
  });
28
-
29
- setContext(PILL_GROUP_CONTEXT_KEY, context);
30
27
  </script>
31
28
 
32
29
  <div {...props} class={['group', props.class]} style:--pg-gap={gap ? getSize(gap) : getSize(size, 'pg-gap')}>
@@ -1,15 +1,11 @@
1
- import type { MaybeGetter } from '../../context/extract.js';
1
+ import type { WithGetters } from '../../../svelte-utils/extract.js';
2
2
  import type { PillGroupProps } from './PillGroup.svelte';
3
- interface PillGroupContextProps {
4
- size: MaybeGetter<PillGroupProps['size']>;
5
- disabled: MaybeGetter<PillGroupProps['disabled']>;
6
- }
3
+ type PillGroupContextProps = Pick<WithGetters<PillGroupProps>, 'size' | 'disabled'>;
7
4
  export declare class PillGroupContext {
8
5
  #private;
9
- size: MaybeGetter<(string & {}) | import("../../index.js").MantineSize | undefined>;
10
- disabled: MaybeGetter<boolean | undefined>;
6
+ size: import("../../../svelte-utils/extract.js").Getter<(string & {}) | import("../../index.js").MantineSize | undefined> | undefined;
7
+ disabled: import("../../../svelte-utils/extract.js").Getter<boolean | undefined> | undefined;
11
8
  constructor(props: PillGroupContextProps);
12
9
  }
13
- export declare const PILL_GROUP_CONTEXT_KEY: unique symbol;
14
10
  export declare function getPillGroupContext(): PillGroupContext;
15
11
  export {};
@@ -1,13 +1,14 @@
1
- import { getContext } from 'svelte';
1
+ import { getContext, setContext } from 'svelte';
2
2
  export class PillGroupContext {
3
3
  #props;
4
4
  size = $derived(this.#props.size);
5
5
  disabled = $derived(this.#props.disabled);
6
6
  constructor(props) {
7
7
  this.#props = props;
8
+ setContext(PILL_GROUP_CONTEXT_KEY, this);
8
9
  }
9
10
  }
10
- export const PILL_GROUP_CONTEXT_KEY = Symbol();
11
+ const PILL_GROUP_CONTEXT_KEY = Symbol();
11
12
  export function getPillGroupContext() {
12
13
  return getContext(PILL_GROUP_CONTEXT_KEY) || {};
13
14
  }
@@ -1,9 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type { MantineRadius, MantineShadow } from '../../MantineProvider/theme.types.js';
3
- import { ClickOutside, type ClickOutsideEvents } from '../../hooks/use-click-outside.svelte.js';
3
+ import { useClickOutside, type ClickOutsideEvents } from '../../hooks/use-click-outside.svelte.js';
4
4
  import { getDefaultZIndex } from '../../utils/get-default-z-index.js';
5
5
  import { type Middleware } from '@floating-ui/dom';
6
- import { setContext, type Snippet } from 'svelte';
6
+ import { type Snippet } from 'svelte';
7
7
  import type { ArrowPosition, FloatingAxesOffsets, FloatingPosition, FloatingStrategy } from '../Floating/types.js';
8
8
  import Overlay, { type OverlayProps } from '../Overlay/Overlay.svelte';
9
9
  import OptionalPortal from '../Portal/OptionalPortal.svelte';
@@ -145,7 +145,7 @@
145
145
 
146
146
  <script lang="ts">
147
147
  import { CreateFloating, type UpdatePositionProps } from '../Floating/CreateFloating.svelte.js';
148
- import { POPOVER_CONTEXT_KEY, PopoverContext } from './PopoverContext.svelte.js';
148
+ import { PopoverContext } from './PopoverContext.svelte.js';
149
149
 
150
150
  let _id = $props.id();
151
151
 
@@ -203,10 +203,10 @@
203
203
  arrowSize: () => arrowSize,
204
204
  disabled: () => disabled,
205
205
  floatingStrategy: () => floatingStrategy,
206
- onclose,
207
- ondismiss,
208
- onopen,
209
- onpositionchange,
206
+ onclose: () => onclose,
207
+ ondismiss: () => ondismiss,
208
+ onopen: () => onopen,
209
+ onpositionchange: () => onpositionchange,
210
210
  opened: () => opened,
211
211
  portalProps: () => portalProps,
212
212
  width: () => width,
@@ -225,9 +225,7 @@
225
225
  transitionProps: () => transitionProps,
226
226
  });
227
227
 
228
- setContext(POPOVER_CONTEXT_KEY, context);
229
-
230
- new ClickOutside({
228
+ useClickOutside({
231
229
  callback: handleClickOutside,
232
230
  events: clickOutsideEvents,
233
231
  refs: [() => context.referenceElement, () => context.floatingElement],
@@ -1,4 +1,4 @@
1
- import { type MaybeGetter, type NonNullableGetter } from '../../context/extract.js';
1
+ import { type Getter, type MaybeGetter, type NonNullableGetter } from '../../../svelte-utils/extract.js';
2
2
  import type { PopoverProps } from './Popover.svelte';
3
3
  interface PopoverContextProps {
4
4
  opened: NonNullableGetter<PopoverProps['opened']>;
@@ -17,10 +17,10 @@ interface PopoverContextProps {
17
17
  closeOnEscape: NonNullableGetter<PopoverProps['closeOnEscape']>;
18
18
  returnFocus: NonNullableGetter<PopoverProps['returnFocus']>;
19
19
  position: NonNullableGetter<PopoverProps['position']>;
20
- onclose: PopoverProps['onclose'];
21
- ondismiss: PopoverProps['ondismiss'];
22
- onopen: PopoverProps['onopen'];
23
- onpositionchange: PopoverProps['onpositionchange'];
20
+ onclose: Getter<PopoverProps['onclose']>;
21
+ ondismiss: Getter<PopoverProps['ondismiss']>;
22
+ onopen: Getter<PopoverProps['onopen']>;
23
+ onpositionchange: MaybeGetter<PopoverProps['onpositionchange']>;
24
24
  withRoles: NonNullableGetter<PopoverProps['withRoles']>;
25
25
  id: NonNullableGetter<PopoverProps['id']>;
26
26
  toggle: () => void;
@@ -28,9 +28,9 @@ interface PopoverContextProps {
28
28
  shadow: MaybeGetter<PopoverProps['shadow']>;
29
29
  transitionProps: NonNullableGetter<PopoverProps['transitionProps']>;
30
30
  }
31
- export declare const POPOVER_CONTEXT_KEY: unique symbol;
32
31
  export declare function getPopoverContext(): PopoverContext;
33
32
  export declare class PopoverContext {
33
+ #private;
34
34
  readonly opened: NonNullable<boolean | undefined>;
35
35
  readonly disabled: boolean | undefined;
36
36
  readonly width: import("./Popover.types.js").PopoverWidth;
@@ -68,6 +68,6 @@ export declare class PopoverContext {
68
68
  arrowRef: HTMLDivElement | undefined;
69
69
  floatingElement: HTMLElement | undefined;
70
70
  referenceElement: HTMLElement | undefined;
71
- constructor({ opened, disabled, width, withArrow, arrowOffset, arrowSize, arrowRadius, arrowPosition, trapFocus, withinPortal, portalProps, floatingStrategy, zIndex, closeOnEscape, returnFocus, position, onclose, ondismiss, onopen, onpositionchange, withRoles, id, toggle, radius, shadow, transitionProps, }: PopoverContextProps);
71
+ constructor(props: PopoverContextProps);
72
72
  }
73
73
  export {};