@casinogate/ui 1.5.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/css/root.css +52 -0
- package/dist/assets/css/theme.css +2 -0
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +0 -2
- package/dist/components/data-table/utils/render-helper.d.ts +0 -77
- package/dist/components/data-table/utils/render-helper.js +0 -77
- package/dist/components/dialog/_ui/basic-dialog/basic-dialog.svelte +89 -0
- package/dist/components/dialog/_ui/basic-dialog/basic-dialog.svelte.d.ts +6 -0
- package/dist/components/dialog/_ui/basic-dialog/index.d.ts +1 -0
- package/dist/components/dialog/_ui/basic-dialog/index.js +1 -0
- package/dist/components/dialog/_ui/nested-dialog/index.d.ts +1 -0
- package/dist/components/dialog/_ui/nested-dialog/index.js +1 -0
- package/dist/components/dialog/_ui/nested-dialog/nested-dialog.svelte +26 -0
- package/dist/components/dialog/_ui/nested-dialog/nested-dialog.svelte.d.ts +18 -0
- package/dist/components/dialog/components/dialog.close.svelte +17 -0
- package/dist/components/dialog/components/dialog.close.svelte.d.ts +4 -0
- package/dist/components/dialog/components/dialog.content.svelte +36 -0
- package/dist/components/dialog/components/dialog.content.svelte.d.ts +4 -0
- package/dist/components/dialog/components/dialog.overlay.svelte +32 -0
- package/dist/components/dialog/components/dialog.overlay.svelte.d.ts +4 -0
- package/dist/components/dialog/components/dialog.portal.svelte +10 -0
- package/dist/components/dialog/components/dialog.portal.svelte.d.ts +3 -0
- package/dist/components/dialog/components/dialog.positioner.svelte +34 -0
- package/dist/components/dialog/components/dialog.positioner.svelte.d.ts +4 -0
- package/dist/components/dialog/components/dialog.root.svelte +21 -0
- package/dist/components/dialog/components/dialog.root.svelte.d.ts +3 -0
- package/dist/components/dialog/components/dialog.svelte.d.ts +46 -0
- package/dist/components/dialog/components/dialog.svelte.js +72 -0
- package/dist/components/dialog/dialog-host-item.svelte +61 -0
- package/dist/components/dialog/dialog-host-item.svelte.d.ts +5 -0
- package/dist/components/dialog/dialog-host.svelte +38 -0
- package/dist/components/dialog/dialog-host.svelte.d.ts +5 -0
- package/dist/components/dialog/dialog.stories.svelte +102 -0
- package/dist/components/dialog/dialog.stories.svelte.d.ts +3 -0
- package/dist/components/dialog/exports-primitive.d.ts +6 -0
- package/dist/components/dialog/exports-primitive.js +6 -0
- package/dist/components/dialog/exports.d.ts +1 -0
- package/dist/components/dialog/exports.js +1 -0
- package/dist/components/dialog/index.d.ts +5 -0
- package/dist/components/dialog/index.js +4 -0
- package/dist/components/dialog/model/dialog-manager.svelte.d.ts +28 -0
- package/dist/components/dialog/model/dialog-manager.svelte.js +156 -0
- package/dist/components/dialog/model/index.d.ts +1 -0
- package/dist/components/dialog/model/index.js +1 -0
- package/dist/components/dialog/styles.d.ts +60 -0
- package/dist/components/dialog/styles.js +54 -0
- package/dist/components/dialog/types.d.ts +76 -0
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/icons/cross.svelte +12 -0
- package/dist/components/icons/cross.svelte.d.ts +3 -0
- package/dist/components/icons/exports.d.ts +1 -0
- package/dist/components/icons/exports.js +1 -0
- package/dist/components/icons/sort.svelte +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input-group/components/input-group.root.svelte +0 -0
- package/dist/components/input-group/components/input-group.root.svelte.d.ts +26 -0
- package/dist/components/input-group/exports-primitive.d.ts +1 -0
- package/dist/components/input-group/exports-primitive.js +1 -0
- package/dist/components/input-group/index.d.ts +1 -0
- package/dist/components/input-group/index.js +1 -0
- package/dist/components/input-group/styles.d.ts +1 -0
- package/dist/components/input-group/styles.js +1 -0
- package/dist/components/input-group/types.d.ts +1 -0
- package/dist/components/input-group/types.js +1 -0
- package/dist/components/select/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/types/common.d.ts +1 -1
- package/dist/internal/utils/attrs.d.ts +1 -0
- package/dist/internal/utils/attrs.js +3 -0
- package/dist/internal/utils/event-dispatcher.d.ts +12 -0
- package/dist/internal/utils/event-dispatcher.js +50 -0
- package/dist/internal/utils/index.d.ts +2 -0
- package/dist/internal/utils/index.js +2 -0
- package/dist/internal/utils/render.d.ts +13 -0
- package/dist/internal/utils/render.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
|
+
export const dialogPositionerStyles = tv({
|
|
3
|
+
base: [
|
|
4
|
+
'cgui:pointer-events-none cgui:fixed cgui:top-0 cgui:left-0 cgui:z-(--z-index-dialog) cgui:overflow-hidden',
|
|
5
|
+
'cgui:flex cgui:flex-col cgui:size-full',
|
|
6
|
+
],
|
|
7
|
+
variants: {
|
|
8
|
+
align: {
|
|
9
|
+
center: ['cgui:items-center cgui:justify-center'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
align: 'center',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const dialogOverlayStyles = tv({
|
|
17
|
+
base: [
|
|
18
|
+
'cgui:pointer-events-none cgui:fixed cgui:top-0 cgui:left-0 cgui:z-(--z-index-dialog) cgui:overflow-hidden',
|
|
19
|
+
'cgui:size-full',
|
|
20
|
+
'cgui:bg-black/50',
|
|
21
|
+
'cgui:data-[state=open]:animate-in cgui:data-[state=closed]:animate-out cgui:data-[state=closed]:fade-out-0 cgui:data-[state=open]:fade-in-0',
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
export const dialogContentStyles = tv({
|
|
25
|
+
base: [
|
|
26
|
+
'cgui:z-(--z-index-dialog) cgui:outline-none cgui:overflow-hidden',
|
|
27
|
+
'cgui:data-[state=open]:animate-in cgui:data-[state=open]:fade-in-0 cgui:data-[state=open]:slide-in-from-bottom-20',
|
|
28
|
+
'cgui:data-[state=closed]:animate-out cgui:data-[state=closed]:fade-out-0 cgui:data-[state=closed]:slide-out-to-bottom-20',
|
|
29
|
+
],
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: ['cgui:shadow-dialog cgui:bg-surface-white'],
|
|
33
|
+
clean: [],
|
|
34
|
+
},
|
|
35
|
+
rounded: {
|
|
36
|
+
default: ['cgui:rounded-md'],
|
|
37
|
+
sm: ['cgui:rounded-sm'],
|
|
38
|
+
lg: ['cgui:rounded-lg'],
|
|
39
|
+
xl: ['cgui:rounded-xl'],
|
|
40
|
+
full: ['cgui:rounded-full'],
|
|
41
|
+
clean: [],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: 'default',
|
|
46
|
+
rounded: 'default',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
export const dialogCloseStyles = tv({
|
|
50
|
+
base: [
|
|
51
|
+
'cgui:flex cgui:cursor-pointer cgui:items-center cgui:justify-center',
|
|
52
|
+
'cgui:text-icon-regular cgui:disabled:cursor-not-allowed cgui:disabled:opacity-50',
|
|
53
|
+
],
|
|
54
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Fn } from '../../internal/types/common.js';
|
|
2
|
+
import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
|
|
3
|
+
import type { DialogCloseProps as DialogClosePropsPrimitive, DialogContentProps as DialogContentPropsPrimitive, DialogOverlayProps as DialogOverlayPropsPrimitive, DialogPortalProps as DialogPortalPropsPrimitive, DialogRootProps as DialogRootPropsPrimitive } from 'bits-ui';
|
|
4
|
+
import type { Component, ComponentProps } from 'svelte';
|
|
5
|
+
import type { WithChildren, WithElementRef, Without } from 'svelte-toolbelt';
|
|
6
|
+
import type { DialogCloseVariants, DialogContentVariants, DialogOverlayVariants, DialogPositionerVariants } from './styles.js';
|
|
7
|
+
export type DialogRootProps = DialogRootPropsPrimitive;
|
|
8
|
+
export type DialogPortalProps = DialogPortalPropsPrimitive;
|
|
9
|
+
export type DialogContentProps = DialogContentPropsPrimitive & DialogContentVariants;
|
|
10
|
+
export type DialogOverlayProps = DialogOverlayPropsPrimitive & DialogOverlayVariants;
|
|
11
|
+
type DialogPositionerPropsWithoutHTML = WithElementRef<WithChildren<{}>> & DialogPositionerVariants;
|
|
12
|
+
export type DialogPositionerProps = DialogPositionerPropsWithoutHTML & Without<PrimitiveDivAttributes, DialogPositionerPropsWithoutHTML>;
|
|
13
|
+
export type DialogCloseProps = DialogClosePropsPrimitive & DialogCloseVariants;
|
|
14
|
+
export type DialogHostProps = {
|
|
15
|
+
register?: Record<string, DialogRegistrationValue>;
|
|
16
|
+
};
|
|
17
|
+
export type DialogComponent = Component<any>;
|
|
18
|
+
export interface RegisteredDialogsOverride {
|
|
19
|
+
}
|
|
20
|
+
export type RegisteredDialogCollectionOverwritten = RegisteredDialogsOverride extends {
|
|
21
|
+
dialogs: Record<string, DialogComponent>;
|
|
22
|
+
} ? RegisteredDialogsOverride : {
|
|
23
|
+
dialogs: Record<string, DialogComponent>;
|
|
24
|
+
};
|
|
25
|
+
export type RegisteredDialogCollection = RegisteredDialogCollectionOverwritten['dialogs'];
|
|
26
|
+
export type RegisteredDialogKeys = keyof RegisteredDialogCollectionOverwritten['dialogs'];
|
|
27
|
+
export type DialogRegistrationValue<TKey extends string = string, TComponent extends DialogComponent = DialogComponent> = {
|
|
28
|
+
key: TKey;
|
|
29
|
+
component: TComponent;
|
|
30
|
+
options?: Partial<DialogRegistrationOptions>;
|
|
31
|
+
};
|
|
32
|
+
export type DialogRegistrationOptions = {
|
|
33
|
+
escapeKeydownBehavior?: DialogContentProps['escapeKeydownBehavior'];
|
|
34
|
+
interactOutsideBehavior?: DialogContentProps['interactOutsideBehavior'];
|
|
35
|
+
};
|
|
36
|
+
export type DialogOptions = Omit<DialogRootProps, 'open' | 'onOpenChangeComplete' | 'children'> & {
|
|
37
|
+
escapeKeydownBehavior?: Extract<DialogContentProps['escapeKeydownBehavior'], 'close' | 'ignore'>;
|
|
38
|
+
interactOutsideBehavior?: Extract<DialogContentProps['interactOutsideBehavior'], 'close' | 'ignore'>;
|
|
39
|
+
};
|
|
40
|
+
export type DialogItemState = {
|
|
41
|
+
id: string;
|
|
42
|
+
open: boolean;
|
|
43
|
+
props: Record<string, unknown>;
|
|
44
|
+
component: DialogComponent;
|
|
45
|
+
options: Partial<DialogOptions>;
|
|
46
|
+
update: (fn: (currentProps: Record<string, unknown>, currentOptions: Partial<DialogOptions>) => {
|
|
47
|
+
props: Record<string, unknown>;
|
|
48
|
+
options: Partial<DialogOptions>;
|
|
49
|
+
}) => void;
|
|
50
|
+
close: Fn;
|
|
51
|
+
};
|
|
52
|
+
export type OpenRegisteredDialogPayload<TKey extends RegisteredDialogKeys = RegisteredDialogKeys, TProps extends ComponentProps<RegisteredDialogCollection[TKey]> = ComponentProps<RegisteredDialogCollection[TKey]>> = {
|
|
53
|
+
key: TKey;
|
|
54
|
+
props: TProps;
|
|
55
|
+
options?: Partial<DialogOptions>;
|
|
56
|
+
};
|
|
57
|
+
export type OpenRegisteredDialogCommandPayload<TKey extends RegisteredDialogKeys = RegisteredDialogKeys, TProps extends ComponentProps<RegisteredDialogCollection[TKey]> = ComponentProps<RegisteredDialogCollection[TKey]>> = {
|
|
58
|
+
key: TKey;
|
|
59
|
+
props: Omit<TProps, 'id'>;
|
|
60
|
+
options?: Partial<DialogOptions>;
|
|
61
|
+
};
|
|
62
|
+
export type OpenDialogCommandPayload<TComponent extends DialogComponent = DialogComponent> = {
|
|
63
|
+
component: TComponent;
|
|
64
|
+
props: Omit<ComponentProps<TComponent>, 'id'>;
|
|
65
|
+
options?: Partial<DialogOptions>;
|
|
66
|
+
};
|
|
67
|
+
export type CloseDialogCommandPayload = {
|
|
68
|
+
id: string;
|
|
69
|
+
};
|
|
70
|
+
export type RegistereDialogProps<T extends Record<string, unknown>> = {
|
|
71
|
+
id: string;
|
|
72
|
+
} & T;
|
|
73
|
+
export type ExtractRegisterdDialogs<TData extends Record<string, DialogRegistrationValue>> = {
|
|
74
|
+
[TKey in keyof TData]: TData[TKey]['component'];
|
|
75
|
+
};
|
|
76
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { width = 24, height = 24, color = 'currentColor', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {width} {height} {...props}>
|
|
8
|
+
<path
|
|
9
|
+
d="M17.6346 8.05809L13.6926 12L17.6346 15.9419C17.7489 16.0523 17.8401 16.1844 17.9028 16.3305C17.9655 16.4765 17.9986 16.6336 18 16.7925C18.0013 16.9515 17.971 17.1091 17.9109 17.2562C17.8507 17.4033 17.7618 17.537 17.6494 17.6494C17.537 17.7618 17.4033 17.8507 17.2562 17.9109C17.1091 17.971 16.9515 18.0013 16.7925 18C16.6336 17.9986 16.4765 17.9655 16.3305 17.9028C16.1844 17.8401 16.0523 17.7489 15.9419 17.6346L12 13.6926L8.05809 17.6346C7.94766 17.7489 7.81557 17.8401 7.66953 17.9028C7.52348 17.9655 7.3664 17.9986 7.20746 18C7.04852 18.0013 6.89089 17.971 6.74377 17.9109C6.59666 17.8507 6.463 17.7618 6.35061 17.6494C6.23821 17.537 6.14933 17.4033 6.08914 17.2562C6.02895 17.1091 5.99866 16.9515 6.00005 16.7925C6.00143 16.6336 6.03445 16.4765 6.09719 16.3305C6.15992 16.1844 6.25112 16.0523 6.36545 15.9419L10.3074 12L6.36545 8.05809C6.25112 7.94766 6.15992 7.81557 6.09719 7.66953C6.03445 7.52348 6.00143 7.3664 6.00005 7.20746C5.99866 7.04852 6.02895 6.89089 6.08914 6.74377C6.14933 6.59666 6.23821 6.463 6.35061 6.35061C6.463 6.23821 6.59666 6.14933 6.74377 6.08914C6.89089 6.02895 7.04852 5.99866 7.20746 6.00005C7.3664 6.00143 7.52348 6.03445 7.66953 6.09719C7.81557 6.15992 7.94766 6.25112 8.05809 6.36545L12 10.3074L15.9419 6.36545C16.0523 6.25112 16.1844 6.15992 16.3305 6.09719C16.4765 6.03445 16.6336 6.00143 16.7925 6.00005C16.9515 5.99866 17.1091 6.02895 17.2562 6.08914C17.4033 6.14933 17.537 6.23821 17.6494 6.35061C17.7618 6.463 17.8507 6.59666 17.9109 6.74377C17.971 6.89089 18.0013 7.04852 18 7.20746C17.9986 7.3664 17.9655 7.52348 17.9028 7.66953C17.8401 7.81557 17.7489 7.94766 17.6346 8.05809Z"
|
|
10
|
+
fill={color}
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -11,6 +11,7 @@ export { default as ChevronSmallLeft } from './chevron-small-left.svelte';
|
|
|
11
11
|
export { default as ChevronSmallRight } from './chevron-small-right.svelte';
|
|
12
12
|
export { default as ChevronSmallUp } from './chevron-small-up.svelte';
|
|
13
13
|
export { default as ChevronUp } from './chevron-up.svelte';
|
|
14
|
+
export { default as Cross } from './cross.svelte';
|
|
14
15
|
export { default as Dots } from './dots.svelte';
|
|
15
16
|
export { default as Error } from './error.svelte';
|
|
16
17
|
export { default as EyeCrossed } from './eye-crossed.svelte';
|
|
@@ -11,6 +11,7 @@ export { default as ChevronSmallLeft } from './chevron-small-left.svelte';
|
|
|
11
11
|
export { default as ChevronSmallRight } from './chevron-small-right.svelte';
|
|
12
12
|
export { default as ChevronSmallUp } from './chevron-small-up.svelte';
|
|
13
13
|
export { default as ChevronUp } from './chevron-up.svelte';
|
|
14
|
+
export { default as Cross } from './cross.svelte';
|
|
14
15
|
export { default as Dots } from './dots.svelte';
|
|
15
16
|
export { default as Error } from './error.svelte';
|
|
16
17
|
export { default as EyeCrossed } from './eye-crossed.svelte';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
let { width = 17, height = 16, color = 'currentColor', ...props }: IconProps = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<svg viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
<svg viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg" {width} {height} {...props}>
|
|
8
8
|
<path
|
|
9
9
|
d="M11.1452 5.90609L9.92195 4.11401L9.17504 3.01419C8.85875 2.55082 8.34429 2.55082 8.028 3.01419L6.05402 5.90609C5.79489 6.28572 5.98161 6.93333 6.34364 6.93333H10.8556C11.2214 6.93333 11.4043 6.28572 11.1452 5.90609Z"
|
|
10
10
|
fill={color}
|
|
@@ -5,6 +5,7 @@ export * from './button/index.js';
|
|
|
5
5
|
export * from './checkbox/index.js';
|
|
6
6
|
export * from './collapsible/index.js';
|
|
7
7
|
export * from './data-table/index.js';
|
|
8
|
+
export * from './dialog/index.js';
|
|
8
9
|
export * from './field/index.js';
|
|
9
10
|
export * from './icons/index.js';
|
|
10
11
|
export * from './input/index.js';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './button/index.js';
|
|
|
5
5
|
export * from './checkbox/index.js';
|
|
6
6
|
export * from './collapsible/index.js';
|
|
7
7
|
export * from './data-table/index.js';
|
|
8
|
+
export * from './dialog/index.js';
|
|
8
9
|
export * from './field/index.js';
|
|
9
10
|
export * from './icons/index.js';
|
|
10
11
|
export * from './input/index.js';
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default InputGroup;
|
|
2
|
+
type InputGroup = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const InputGroup: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * as SelectPrimitive from './exports-primitive.js';
|
|
2
2
|
export * as Select from './exports.js';
|
|
3
|
-
export type { SelectAsyncCallback, SelectAsyncCallbackParams, SelectAsyncCallbackResult, SelectAsyncProps, SelectContentProps, SelectGroupHeadingProps, SelectGroupProps, SelectItem, SelectItemData, SelectItemGroup, SelectItemProps, SelectRootProps, SelectTriggerProps, SelectViewportProps, } from './types.js';
|
|
3
|
+
export type { SelectAsyncCallback, SelectAsyncCallbackParams, SelectAsyncCallbackResult, SelectAsyncProps, SelectBaseItem, SelectContentProps, SelectData, SelectGroupHeadingProps, SelectGroupProps, SelectItem, SelectItemData, SelectItemGroup, SelectItemProps, SelectPortalProps, SelectProps, SelectRootProps, SelectTriggerProps, SelectViewportProps, } from './types.js';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/index.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { attachRef } from 'svelte-toolbelt';
|
|
2
2
|
export type Without<T extends object, U extends object> = Omit<T, keyof U>;
|
|
3
3
|
export type Arrayable<T> = T[] | T;
|
|
4
|
-
export type Fn = () =>
|
|
4
|
+
export type Fn<TArgs extends any[] = any[], TReturn = void> = (...args: TArgs) => TReturn;
|
|
5
5
|
export type AnyFn = (...args: any[]) => any;
|
|
6
6
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
7
|
interface DecrementMap {
|
|
@@ -2,3 +2,4 @@ export declare function getDataDisabled(condition: boolean): '' | undefined;
|
|
|
2
2
|
export declare function getDataActive(condition: boolean): '' | undefined;
|
|
3
3
|
export declare function getDataIsResizing(condition: boolean): '' | undefined;
|
|
4
4
|
export declare function boolAttr(condition: boolean): '' | undefined;
|
|
5
|
+
export declare function getDataOpenState(condition: boolean): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class EventDispatcher<TEventMap extends Record<string, any>> {
|
|
2
|
+
private target;
|
|
3
|
+
constructor(target?: EventTarget);
|
|
4
|
+
dispatch<K extends keyof TEventMap>(type: K, ...[detail]: TEventMap[K] extends void ? [] : [detail: TEventMap[K]]): boolean;
|
|
5
|
+
on<K extends keyof TEventMap>(type: K, listener: (event: CustomEvent<TEventMap[K]>) => void, options?: AddEventListenerOptions): () => void;
|
|
6
|
+
off<K extends keyof TEventMap>(type: K, listener: EventListenerOrEventListenerObject, options?: EventListenerOptions): void;
|
|
7
|
+
once<K extends keyof TEventMap>(type: K, listener: (event: CustomEvent<TEventMap[K]>) => void): () => void;
|
|
8
|
+
wait<K extends keyof TEventMap>(type: K, timeout?: number): Promise<TEventMap[K]>;
|
|
9
|
+
subscribe<K extends keyof TEventMap>(listeners: Partial<{
|
|
10
|
+
[K in keyof TEventMap]: (event: CustomEvent<TEventMap[K]>) => void;
|
|
11
|
+
}>): () => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class EventDispatcher {
|
|
2
|
+
target;
|
|
3
|
+
constructor(target) {
|
|
4
|
+
if (typeof window === 'undefined') {
|
|
5
|
+
this.target = new EventTarget();
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
this.target = target || window;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
dispatch(type, ...[detail]) {
|
|
12
|
+
const event = new CustomEvent(type, {
|
|
13
|
+
detail,
|
|
14
|
+
});
|
|
15
|
+
return this.target.dispatchEvent(event);
|
|
16
|
+
}
|
|
17
|
+
on(type, listener, options) {
|
|
18
|
+
const wrappedListener = (event) => {
|
|
19
|
+
listener(event);
|
|
20
|
+
};
|
|
21
|
+
this.target.addEventListener(type, wrappedListener, options);
|
|
22
|
+
return () => this.off(type, wrappedListener);
|
|
23
|
+
}
|
|
24
|
+
off(type, listener, options) {
|
|
25
|
+
this.target.removeEventListener(type, listener, options);
|
|
26
|
+
}
|
|
27
|
+
once(type, listener) {
|
|
28
|
+
return this.on(type, listener, { once: true });
|
|
29
|
+
}
|
|
30
|
+
async wait(type, timeout) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
let timeoutId;
|
|
33
|
+
const cleanup = this.once(type, (event) => {
|
|
34
|
+
if (timeoutId)
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
resolve(event.detail);
|
|
37
|
+
});
|
|
38
|
+
if (timeout) {
|
|
39
|
+
timeoutId = setTimeout(() => {
|
|
40
|
+
cleanup();
|
|
41
|
+
reject(new Error(`Event ${String(type)} timeout after ${timeout}ms`));
|
|
42
|
+
}, timeout);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
subscribe(listeners) {
|
|
47
|
+
const cleanupFns = Object.entries(listeners).map(([type, listener]) => this.on(type, listener));
|
|
48
|
+
return () => cleanupFns.forEach((cleanup) => cleanup());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Component, ComponentProps, Snippet } from 'svelte';
|
|
2
|
+
export declare class RenderComponentConfig<TComponent extends Component> {
|
|
3
|
+
component: TComponent;
|
|
4
|
+
props: ComponentProps<TComponent> | Record<string, never>;
|
|
5
|
+
constructor(component: TComponent, props?: ComponentProps<TComponent> | Record<string, never>);
|
|
6
|
+
}
|
|
7
|
+
export declare class RenderSnippetConfig<TProps> {
|
|
8
|
+
snippet: Snippet<[TProps]>;
|
|
9
|
+
params: TProps;
|
|
10
|
+
constructor(snippet: Snippet<[TProps]>, params: TProps);
|
|
11
|
+
}
|
|
12
|
+
export declare function renderComponent<T extends Component<any>, Props extends ComponentProps<T>>(component: T, props?: Props): RenderComponentConfig<T>;
|
|
13
|
+
export declare function renderSnippet<TProps>(snippet: Snippet<[TProps]>, params?: TProps): RenderSnippetConfig<TProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class RenderComponentConfig {
|
|
2
|
+
component;
|
|
3
|
+
props;
|
|
4
|
+
constructor(component, props = {}) {
|
|
5
|
+
this.component = component;
|
|
6
|
+
this.props = props;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class RenderSnippetConfig {
|
|
10
|
+
snippet;
|
|
11
|
+
params;
|
|
12
|
+
constructor(snippet, params) {
|
|
13
|
+
this.snippet = snippet;
|
|
14
|
+
this.params = params;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function renderComponent(component, props = {}) {
|
|
18
|
+
return new RenderComponentConfig(component, props);
|
|
19
|
+
}
|
|
20
|
+
export function renderSnippet(snippet, params = {}) {
|
|
21
|
+
return new RenderSnippetConfig(snippet, params);
|
|
22
|
+
}
|