lithesome 0.5.0 → 0.6.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.
- package/dist/components/Accordion/Accordion.svelte +3 -4
- package/dist/components/Accordion/Accordion.svelte.d.ts +1 -1
- package/dist/components/Accordion/AccordionButton.svelte +1 -1
- package/dist/components/Accordion/AccordionContent.svelte +1 -1
- package/dist/components/Accordion/AccordionHeading.svelte +1 -1
- package/dist/components/Accordion/AccordionItem.svelte +1 -1
- package/dist/components/Checkbox/Checkbox.svelte +2 -2
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/components/Combobox/Combobox.svelte +4 -5
- package/dist/components/Combobox/Combobox.svelte.d.ts +1 -1
- package/dist/components/Combobox/ComboboxDropdown.svelte +1 -1
- package/dist/components/Combobox/ComboboxDropdown.svelte.d.ts +2 -18
- package/dist/components/Combobox/ComboboxInput.svelte +1 -1
- package/dist/components/Combobox/ComboboxOption.svelte +1 -1
- package/dist/components/Hovercard/Hovercard.svelte +5 -24
- package/dist/components/Hovercard/Hovercard.svelte.d.ts +1 -5
- package/dist/components/Hovercard/HovercardContent.svelte +6 -5
- package/dist/components/Hovercard/HovercardContent.svelte.d.ts +2 -17
- package/dist/components/Hovercard/HovercardTrigger.svelte +1 -1
- package/dist/components/Hovercard/context.svelte.d.ts +2 -6
- package/dist/components/Hovercard/context.svelte.js +2 -3
- package/dist/components/Menu/Menu.svelte +3 -4
- package/dist/components/Menu/Menu.svelte.d.ts +1 -1
- package/dist/components/Menu/MenuDropdown.svelte +1 -1
- package/dist/components/Menu/MenuDropdown.svelte.d.ts +2 -18
- package/dist/components/Menu/MenuItem.svelte +1 -1
- package/dist/components/Menu/MenuTrigger.svelte +1 -1
- package/dist/components/Modal/Modal.svelte +3 -4
- package/dist/components/Modal/Modal.svelte.d.ts +1 -1
- package/dist/components/Modal/ModalContent.svelte +1 -1
- package/dist/components/Modal/ModalDescription.svelte +1 -1
- package/dist/components/Modal/ModalOverlay.svelte +1 -1
- package/dist/components/Modal/ModalTitle.svelte +1 -1
- package/dist/components/Pin/Pin.svelte +3 -4
- package/dist/components/Pin/Pin.svelte.d.ts +1 -1
- package/dist/components/Pin/PinInput.svelte +1 -1
- package/dist/components/Pin/PinValue.svelte +1 -1
- package/dist/components/Popover/Popover.svelte +3 -4
- package/dist/components/Popover/Popover.svelte.d.ts +1 -1
- package/dist/components/Popover/PopoverContent.svelte +1 -1
- package/dist/components/Popover/PopoverContent.svelte.d.ts +2 -18
- package/dist/components/Popover/PopoverTrigger.svelte +1 -1
- package/dist/components/RadioGroup/RadioGroup.svelte +3 -4
- package/dist/components/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroupItem.svelte +1 -1
- package/dist/components/Select/Select.svelte +4 -5
- package/dist/components/Select/Select.svelte.d.ts +1 -1
- package/dist/components/Select/SelectDropdown.svelte +1 -1
- package/dist/components/Select/SelectDropdown.svelte.d.ts +2 -18
- package/dist/components/Select/SelectOption.svelte +1 -1
- package/dist/components/Select/SelectTrigger.svelte +1 -1
- package/dist/components/Select/SelectValue.svelte +1 -1
- package/dist/components/Tabs/Tabs.svelte +4 -5
- package/dist/components/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/components/Tabs/TabsButton.svelte +1 -1
- package/dist/components/Tabs/TabsContent.svelte +1 -1
- package/dist/components/Tabs/TabsList.svelte +1 -1
- package/dist/internal/helpers/context.svelte.d.ts +13 -0
- package/dist/internal/helpers/context.svelte.js +17 -1
- package/dist/internal/helpers/utils.svelte.d.ts +1 -1
- package/dist/internal/types.d.ts +18 -1
- package/package.json +2 -2
- package/dist/components/Tags/context.svelte.d.ts +0 -15
- package/dist/components/Tags/context.svelte.js +0 -15
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { AccordionContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "accordion
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("accordion");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let { children, use = [], class: klass, self = $bindable(), single = $bindable(false), ...props } = $props();
|
|
10
9
|
const ctx = new AccordionContext({ single });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { AccordionContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => AccordionContext;
|
|
3
|
+
export declare const context: () => AccordionContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Accordion.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Accordion.svelte";
|
|
2
2
|
import { useActions, classProp } from "../../internal/index.js";
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
let { children, class: klass, use = [], self = $bindable(), onClick, ...props } = $props();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Accordion.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Accordion.svelte";
|
|
2
2
|
import { useActions, getTransition, classProp } from "../../internal/index.js";
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
let { children, class: klass, use = [], self = $bindable(), transition, ...props } = $props();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Accordion.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Accordion.svelte";
|
|
2
2
|
import { log, useActions, createUID, classProp } from "../../internal/index.js";
|
|
3
3
|
import { onMount, setContext } from "svelte";
|
|
4
4
|
let { children, class: klass, use = [], self = $bindable(), disabled = $bindable(false), ...props } = $props();
|
|
@@ -12,7 +12,7 @@ declare const __propDef: {
|
|
|
12
12
|
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
|
13
13
|
}) | undefined;
|
|
14
14
|
use?: import("../../internal/index.js").HTMLActionArray | undefined;
|
|
15
|
-
class?: import("../../internal/
|
|
15
|
+
class?: import("../../internal/index.js").ClassProp<{
|
|
16
16
|
checked: Checked;
|
|
17
17
|
}>;
|
|
18
18
|
self?: HTMLButtonElement | undefined;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { ComboboxContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "combobox
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("combobox");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script generics="ValueType">import { useActions, classProp } from "../../internal/index.js";
|
|
8
|
-
import { setContext } from "svelte";
|
|
6
|
+
<script lang="ts" generics="ValueType">import { useActions, classProp } from "../../internal/index.js";
|
|
7
|
+
import { setContext, onMount, tick } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
11
10
|
use = [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { ComboboxContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => ComboboxContext<any
|
|
3
|
+
export declare const context: () => ComboboxContext<any>, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare class __sveltets_Render<ValueType> {
|
|
6
6
|
props(): BaseProps<HTMLDivElement, {
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
|
+
import { type BaseProps, type DropdownProps } from '../../internal/index.js';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: BaseProps<HTMLDivElement, {
|
|
6
5
|
visible: boolean;
|
|
7
|
-
}> &
|
|
8
|
-
/**
|
|
9
|
-
* The `svelte/transtion` you wish to use.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lithesome.dev/docs/api#transition-prop
|
|
12
|
-
*/
|
|
13
|
-
transition?: Transition | undefined;
|
|
14
|
-
/** The element to portal the dropdown menu to. */
|
|
15
|
-
portalTarget?: string | HTMLElement | undefined;
|
|
16
|
-
/** The anchor point of the dropdown relative to the trigger. */
|
|
17
|
-
placement?: Placement | undefined;
|
|
18
|
-
/** Keeps the dropdown from ever growing outside of the viewport. */
|
|
19
|
-
constrainViewport?: boolean | undefined;
|
|
20
|
-
/** Makes the dropdown the same width as the trigger. */
|
|
21
|
-
sameWidth?: boolean | undefined;
|
|
22
|
-
};
|
|
6
|
+
}> & DropdownProps;
|
|
23
7
|
events: {
|
|
24
8
|
[evt: string]: CustomEvent<any>;
|
|
25
9
|
};
|
|
@@ -1,33 +1,14 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { HovercardContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "hovercard
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("hovercard");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp, parseDelay } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp, parseDelay } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
|
-
let {
|
|
10
|
-
children,
|
|
11
|
-
use = [],
|
|
12
|
-
class: klass,
|
|
13
|
-
visible = $bindable(false),
|
|
14
|
-
self = $bindable(),
|
|
15
|
-
delay = 700,
|
|
16
|
-
...props
|
|
17
|
-
} = $props();
|
|
8
|
+
let { children, use = [], class: klass, self = $bindable(), delay = 700, ...props } = $props();
|
|
18
9
|
const delays = parseDelay(delay);
|
|
19
|
-
const ctx = new HovercardContext(
|
|
20
|
-
{ visible, delays },
|
|
21
|
-
{
|
|
22
|
-
onChange(val) {
|
|
23
|
-
visible = val;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
);
|
|
10
|
+
const ctx = new HovercardContext({ delays });
|
|
27
11
|
setContext(contextName, ctx);
|
|
28
|
-
$effect(() => {
|
|
29
|
-
ctx.visible = visible;
|
|
30
|
-
});
|
|
31
12
|
</script>
|
|
32
13
|
|
|
33
14
|
<div
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { HovercardContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => HovercardContext;
|
|
3
|
+
export declare const context: () => HovercardContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
7
7
|
visible: boolean;
|
|
8
8
|
}> & {
|
|
9
|
-
/**
|
|
10
|
-
* Whether or not the content is visible or not.
|
|
11
|
-
*/
|
|
12
|
-
visible?: boolean | undefined;
|
|
13
9
|
/**
|
|
14
10
|
* The delay between the the content being visible or not.
|
|
15
11
|
*
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script>import { context } from "./Hovercard.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Hovercard.svelte";
|
|
2
2
|
import {
|
|
3
3
|
clickOutside,
|
|
4
4
|
anchorElement,
|
|
5
5
|
portal,
|
|
6
6
|
useActions,
|
|
7
|
-
trap,
|
|
8
7
|
getTransition,
|
|
9
8
|
classProp
|
|
10
9
|
} from "../../internal/index.js";
|
|
@@ -31,9 +30,7 @@ const attrs = $derived({
|
|
|
31
30
|
id: ctx.uid("content"),
|
|
32
31
|
"aria-labelledby": ctx.uid("trigger"),
|
|
33
32
|
class: classProp(klass, { visible: ctx.visible }),
|
|
34
|
-
"data-
|
|
35
|
-
role: "menu",
|
|
36
|
-
tabindex: -1
|
|
33
|
+
"data-hovercardcontent": ""
|
|
37
34
|
});
|
|
38
35
|
onMount(async () => {
|
|
39
36
|
if (!ctx)
|
|
@@ -83,6 +80,8 @@ const handleMouseleave = (e) => {
|
|
|
83
80
|
out:_transition.out.fn={_transition.out.params}
|
|
84
81
|
onmouseenter={handleMouseenter}
|
|
85
82
|
onmouseleave={handleMouseleave}
|
|
83
|
+
role="menu"
|
|
84
|
+
tabindex={-1}
|
|
86
85
|
{...attrs}
|
|
87
86
|
{...props}
|
|
88
87
|
>
|
|
@@ -102,6 +101,8 @@ const handleMouseleave = (e) => {
|
|
|
102
101
|
use:useActions={use}
|
|
103
102
|
onmouseenter={handleMouseenter}
|
|
104
103
|
onmouseleave={handleMouseleave}
|
|
104
|
+
role="menu"
|
|
105
|
+
tabindex={-1}
|
|
105
106
|
{...attrs}
|
|
106
107
|
{...props}
|
|
107
108
|
>
|
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
|
+
import { type BaseProps, type Handler, type DropdownProps } from '../../internal/index.js';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: BaseProps<HTMLDivElement, {
|
|
6
5
|
visible: boolean;
|
|
7
|
-
}> & {
|
|
8
|
-
/**
|
|
9
|
-
* The `svelte/transtion` you wish to use.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lithesome.dev/docs/api#transition-prop
|
|
12
|
-
*/
|
|
13
|
-
transition?: Transition | undefined;
|
|
14
|
-
/** The element to portal the content menu to. */
|
|
15
|
-
portalTarget?: string | HTMLElement | undefined;
|
|
16
|
-
/** The anchor point of the content relative to the trigger. */
|
|
17
|
-
placement?: Placement | undefined;
|
|
18
|
-
/** Keeps the content from ever growing outside of the viewport. */
|
|
19
|
-
constrainViewport?: boolean | undefined;
|
|
20
|
-
/** Makes the content the same width as the trigger. */
|
|
21
|
-
sameWidth?: boolean | undefined;
|
|
6
|
+
}> & DropdownProps & {
|
|
22
7
|
onMouseenter?: Handler<MouseEvent, HTMLDivElement> | undefined;
|
|
23
8
|
onMouseleave?: Handler<MouseEvent, HTMLDivElement> | undefined;
|
|
24
9
|
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { Context } from '../../internal/index.js';
|
|
2
2
|
interface Init {
|
|
3
|
-
visible: boolean;
|
|
4
3
|
delays: {
|
|
5
4
|
in: number;
|
|
6
5
|
out: number;
|
|
7
6
|
};
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
onChange: (value: boolean) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare class HovercardContext extends Context<Hooks> {
|
|
8
|
+
export declare class HovercardContext extends Context {
|
|
13
9
|
#private;
|
|
14
10
|
visible: boolean;
|
|
15
11
|
trigger: HTMLElement | null;
|
|
@@ -20,7 +16,7 @@ export declare class HovercardContext extends Context<Hooks> {
|
|
|
20
16
|
out: number;
|
|
21
17
|
};
|
|
22
18
|
hovered: boolean;
|
|
23
|
-
constructor(init: Init
|
|
19
|
+
constructor(init: Init);
|
|
24
20
|
open(): void;
|
|
25
21
|
close(): void;
|
|
26
22
|
}
|
|
@@ -6,9 +6,8 @@ export class HovercardContext extends Context {
|
|
|
6
6
|
timeout = $state(null);
|
|
7
7
|
delays = $state({ in: 700, out: 700 });
|
|
8
8
|
hovered = $state(false);
|
|
9
|
-
constructor(init
|
|
10
|
-
super('hovercard'
|
|
11
|
-
this.visible = init.visible;
|
|
9
|
+
constructor(init) {
|
|
10
|
+
super('hovercard');
|
|
12
11
|
this.delays = init.delays;
|
|
13
12
|
}
|
|
14
13
|
open() {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { MenuContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "menu
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("menu");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let { children, use = [], class: klass, self = $bindable(), ...props } = $props();
|
|
10
9
|
const ctx = new MenuContext();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { MenuContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => MenuContext;
|
|
3
|
+
export declare const context: () => MenuContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
|
+
import { type BaseProps, type DropdownProps } from '../../internal/index.js';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: BaseProps<HTMLDivElement, {
|
|
6
5
|
visible: boolean;
|
|
7
|
-
}> &
|
|
8
|
-
/**
|
|
9
|
-
* The `svelte/transtion` you wish to use.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lithesome.dev/docs/api#transition-prop
|
|
12
|
-
*/
|
|
13
|
-
transition?: Transition | undefined;
|
|
14
|
-
/** The element to portal the dropdown menu to. */
|
|
15
|
-
portalTarget?: string | HTMLElement | undefined;
|
|
16
|
-
/** The anchor point of the dropdown relative to the trigger. */
|
|
17
|
-
placement?: Placement | undefined;
|
|
18
|
-
/** Keeps the dropdown from ever growing outside of the viewport. */
|
|
19
|
-
constrainViewport?: boolean | undefined;
|
|
20
|
-
/** Makes the dropdown the same width as the trigger. */
|
|
21
|
-
sameWidth?: boolean | undefined;
|
|
22
|
-
};
|
|
6
|
+
}> & DropdownProps;
|
|
23
7
|
events: {
|
|
24
8
|
[evt: string]: CustomEvent<any>;
|
|
25
9
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { ModalContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "modal
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("modal");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { createUID, useActions, portal, KEYS, isBrowser, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { createUID, useActions, portal, KEYS, isBrowser, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { ModalContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => ModalContext;
|
|
3
|
+
export declare const context: () => ModalContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, any> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { useActions, getTransition, classProp, trap } from "../../internal/index.js";
|
|
1
|
+
<script lang="ts">import { useActions, getTransition, classProp, trap } from "../../internal/index.js";
|
|
2
2
|
import { context } from "./Modal.svelte";
|
|
3
3
|
let { children, class: klass, use = [], self = $bindable(), transition, ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
1
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
2
2
|
import { context } from "./Modal.svelte";
|
|
3
3
|
let { children, class: klass, use = [], self = $bindable(), ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
1
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
2
2
|
import { context } from "./Modal.svelte";
|
|
3
3
|
let { children, class: klass, use = [], self = $bindable(), ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { PinContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "pin
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("pin");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { PinContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => PinContext;
|
|
3
|
+
export declare const context: () => PinContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Pin.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Pin.svelte";
|
|
2
2
|
import { log, useActions, classProp } from "../../internal/index.js";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
4
|
let { class: klass, use = [], self = $bindable(), name, ...props } = $props();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { PopoverContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "popover
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("popover");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import {
|
|
6
|
+
<script lang="ts">import { useActions, KEYS, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let { children, use = [], class: klass, self = $bindable(), visible = $bindable(false), ...props } = $props();
|
|
10
9
|
const ctx = new PopoverContext(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { PopoverContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => PopoverContext;
|
|
3
|
+
export declare const context: () => PopoverContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
|
+
import { type BaseProps, type DropdownProps } from '../../internal/index.js';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: BaseProps<HTMLDivElement, {
|
|
6
5
|
visible: boolean;
|
|
7
|
-
}> &
|
|
8
|
-
/**
|
|
9
|
-
* The `svelte/transtion` you wish to use.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lithesome.dev/docs/api#transition-prop
|
|
12
|
-
*/
|
|
13
|
-
transition?: Transition | undefined;
|
|
14
|
-
/** The element to portal the content menu to. */
|
|
15
|
-
portalTarget?: string | HTMLElement | undefined;
|
|
16
|
-
/** The anchor point of the content relative to the trigger. */
|
|
17
|
-
placement?: Placement | undefined;
|
|
18
|
-
/** Keeps the content from ever growing outside of the viewport. */
|
|
19
|
-
constrainViewport?: boolean | undefined;
|
|
20
|
-
/** Makes the content the same width as the trigger. */
|
|
21
|
-
sameWidth?: boolean | undefined;
|
|
22
|
-
};
|
|
6
|
+
}> & DropdownProps;
|
|
23
7
|
events: {
|
|
24
8
|
[evt: string]: CustomEvent<any>;
|
|
25
9
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { RadiogroupContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "radiogroup
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("radiogroup");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { RadiogroupContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => RadiogroupContext;
|
|
3
|
+
export declare const context: () => RadiogroupContext, contextName: string;
|
|
4
4
|
import { type BaseProps, type JsonValue } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, any> & {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { SelectContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "select
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("select");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script generics="ValueType">import { useActions, classProp } from "../../internal/index.js";
|
|
8
|
-
import { setContext } from "svelte";
|
|
6
|
+
<script lang="ts" generics="ValueType">import { useActions, classProp } from "../../internal/index.js";
|
|
7
|
+
import { setContext, onMount, tick } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
11
10
|
use = [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { SelectContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => SelectContext<any
|
|
3
|
+
export declare const context: () => SelectContext<any>, contextName: string;
|
|
4
4
|
import { type BaseProps, type JsonValue } from '../../internal/index.js';
|
|
5
5
|
declare class __sveltets_Render<ValueType> {
|
|
6
6
|
props(): BaseProps<HTMLDivElement, {
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
|
+
import { type BaseProps, type DropdownProps } from '../../internal/index.js';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: BaseProps<HTMLDivElement, {
|
|
6
5
|
visible: boolean;
|
|
7
|
-
}> &
|
|
8
|
-
/**
|
|
9
|
-
* The `svelte/transtion` you wish to use.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lithesome.dev/docs/api#transition-prop
|
|
12
|
-
*/
|
|
13
|
-
transition?: Transition | undefined;
|
|
14
|
-
/** The element to portal the dropdown menu to. */
|
|
15
|
-
portalTarget?: string | HTMLElement | undefined;
|
|
16
|
-
/** The anchor point of the dropdown relative to the trigger. */
|
|
17
|
-
placement?: Placement | undefined;
|
|
18
|
-
/** Keeps the dropdown from ever growing outside of the viewport. */
|
|
19
|
-
constrainViewport?: boolean | undefined;
|
|
20
|
-
/** Makes the dropdown the same width as the trigger. */
|
|
21
|
-
sameWidth?: boolean | undefined;
|
|
22
|
-
};
|
|
6
|
+
}> & DropdownProps;
|
|
23
7
|
events: {
|
|
24
8
|
[evt: string]: CustomEvent<any>;
|
|
25
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Select.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Select.svelte";
|
|
2
2
|
import { useActions, classProp } from "../../internal/index.js";
|
|
3
3
|
let { class: klass, use = [], self = $bindable(), placeholder = "Select an option...", ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
<script context="module">import {
|
|
1
|
+
<script lang="ts" context="module">import { setupContext } from "../../internal/index.js";
|
|
2
2
|
import { TabsContext } from "./context.svelte.js";
|
|
3
|
-
const contextName = "tabs
|
|
4
|
-
export const context = () => getContext(contextName);
|
|
3
|
+
export const { context, contextName } = setupContext("tabs");
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<script>import { useActions, classProp } from "../../internal/index.js";
|
|
6
|
+
<script lang="ts">import { useActions, classProp } from "../../internal/index.js";
|
|
8
7
|
import { setContext } from "svelte";
|
|
9
8
|
let {
|
|
10
9
|
children,
|
|
11
10
|
use = [],
|
|
12
11
|
class: klass,
|
|
13
|
-
self,
|
|
12
|
+
self = $bindable(),
|
|
14
13
|
orientation = "horizontal",
|
|
15
14
|
value = $bindable(""),
|
|
16
15
|
...props
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { TabsContext } from './context.svelte.js';
|
|
3
|
-
export declare const context: () => TabsContext;
|
|
3
|
+
export declare const context: () => TabsContext, contextName: string;
|
|
4
4
|
import { type BaseProps } from '../../internal/index.js';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: BaseProps<HTMLDivElement, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Tabs.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Tabs.svelte";
|
|
2
2
|
import { useActions, classProp } from "../../internal/index.js";
|
|
3
3
|
let { children, class: klass, use = [], self = $bindable(), value, ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { context } from "./Tabs.svelte";
|
|
1
|
+
<script lang="ts">import { context } from "./Tabs.svelte";
|
|
2
2
|
import { useActions, classProp } from "../../internal/index.js";
|
|
3
3
|
let { children, class: klass, use = [], self, ...props } = $props();
|
|
4
4
|
const ctx = context();
|
|
@@ -4,4 +4,17 @@ export declare class Context<H = any> {
|
|
|
4
4
|
protected hooks: H | null;
|
|
5
5
|
constructor(name: string, hooks?: H);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to create a svelte context with a
|
|
9
|
+
* unique name to avoid naming collisions.
|
|
10
|
+
* @param name The name of the context
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare const setupContext: <T>(name: string) => {
|
|
14
|
+
contextName: string;
|
|
15
|
+
context: () => T;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Auto cleanup effects when the component is unmounted from the DOM.
|
|
19
|
+
*/
|
|
7
20
|
export declare const effects: (fn: () => void) => () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createUID } from './utils.svelte.js';
|
|
2
|
-
import { onDestroy } from 'svelte';
|
|
2
|
+
import { onDestroy, getContext } from 'svelte';
|
|
3
3
|
export class Context {
|
|
4
4
|
uid = $state();
|
|
5
5
|
hooks = null;
|
|
@@ -10,6 +10,22 @@ export class Context {
|
|
|
10
10
|
this.hooks = hooks;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to create a svelte context with a
|
|
15
|
+
* unique name to avoid naming collisions.
|
|
16
|
+
* @param name The name of the context
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export const setupContext = (name) => {
|
|
20
|
+
let { uid } = createUID(name + 'Context');
|
|
21
|
+
return {
|
|
22
|
+
contextName: uid(),
|
|
23
|
+
context: () => getContext(uid())
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Auto cleanup effects when the component is unmounted from the DOM.
|
|
28
|
+
*/
|
|
13
29
|
export const effects = (fn) => {
|
|
14
30
|
let cleanUp = $effect.root(fn);
|
|
15
31
|
const destroy = () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { JsonValue, ClassProp } from '../types.js';
|
|
2
2
|
export type CalcIndexAction = 'prev' | 'next' | 'first' | 'last';
|
|
3
|
+
export type UID = (component?: string) => string;
|
|
3
4
|
/**
|
|
4
5
|
* Calculates the index position of the action given.
|
|
5
6
|
* @param action Which direction to navigate the index.
|
|
@@ -8,7 +9,6 @@ export type CalcIndexAction = 'prev' | 'next' | 'first' | 'last';
|
|
|
8
9
|
* @param loop Loops around the items array if true.
|
|
9
10
|
*/
|
|
10
11
|
export declare const calculateIndex: (action: CalcIndexAction, items: any[], index: number, loop?: boolean) => number;
|
|
11
|
-
export type UID = (component?: string) => string;
|
|
12
12
|
/**
|
|
13
13
|
* Creates a unique ID to be used for accessability.
|
|
14
14
|
*/
|
package/dist/internal/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type { HTMLActionArray } from './index.js';
|
|
3
|
+
import type { HTMLActionArray, Transition } from './index.js';
|
|
4
|
+
import type { Placement } from '@floating-ui/dom';
|
|
4
5
|
export type JsonObject = {
|
|
5
6
|
[key: string]: JsonValue;
|
|
6
7
|
};
|
|
@@ -34,3 +35,19 @@ export interface BaseProps<T extends HTMLElement, C extends Record<string, any>
|
|
|
34
35
|
self?: T;
|
|
35
36
|
}
|
|
36
37
|
export type BasePropsNoChildren<T extends HTMLElement, C extends Record<string, any> = any> = Omit<BaseProps<T, C>, 'children'>;
|
|
38
|
+
export interface DropdownProps {
|
|
39
|
+
/**
|
|
40
|
+
* The `svelte/transtion` you wish to use.
|
|
41
|
+
*
|
|
42
|
+
* @see https://lithesome.dev/docs/api#transition-prop
|
|
43
|
+
*/
|
|
44
|
+
transition?: Transition;
|
|
45
|
+
/** The element to portal the dropdown menu to. */
|
|
46
|
+
portalTarget?: string | HTMLElement;
|
|
47
|
+
/** The anchor point of the dropdown relative to the trigger. */
|
|
48
|
+
placement?: Placement;
|
|
49
|
+
/** Keeps the dropdown from ever growing outside of the viewport. */
|
|
50
|
+
constrainViewport?: boolean;
|
|
51
|
+
/** Makes the dropdown the same width as the trigger. */
|
|
52
|
+
sameWidth?: boolean;
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lithesome",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Gibbu/lithesome.git"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"rehype-slug": "^6.0.0",
|
|
49
49
|
"remark-external-links": "^9.0.1",
|
|
50
50
|
"shiki": "^1.2.0",
|
|
51
|
-
"svelte": "5.0.0-next.
|
|
51
|
+
"svelte": "5.0.0-next.94",
|
|
52
52
|
"svelte-check": "^3.6.6",
|
|
53
53
|
"tailwind-merge": "^2.2.1",
|
|
54
54
|
"tailwindcss": "^3.4.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context } from '../../internal/helpers/context.svelte.js';
|
|
2
|
-
interface Hooks {
|
|
3
|
-
onChange: (value: string[]) => void;
|
|
4
|
-
}
|
|
5
|
-
interface Init {
|
|
6
|
-
value: string[];
|
|
7
|
-
disabled: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class TagsContext extends Context<Hooks> {
|
|
10
|
-
#private;
|
|
11
|
-
value: string[];
|
|
12
|
-
disabled: boolean;
|
|
13
|
-
constructor(init: Init, hooks: Hooks);
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context, effects } from '../../internal/helpers/context.svelte.js';
|
|
2
|
-
export class TagsContext extends Context {
|
|
3
|
-
value = $state([]);
|
|
4
|
-
disabled = $state(false);
|
|
5
|
-
constructor(init, hooks) {
|
|
6
|
-
super('tags', hooks);
|
|
7
|
-
this.value = init.value;
|
|
8
|
-
this.disabled = init.disabled;
|
|
9
|
-
}
|
|
10
|
-
#cleanup = effects(() => {
|
|
11
|
-
$effect(() => {
|
|
12
|
-
this.hooks?.onChange(this.value);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}
|