@svelte-atoms/core 1.0.0-alpha.39 → 1.0.0-alpha.41
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/calendar/calendar-day.css +6 -6
- package/dist/components/combobox/combobox-trigger.svelte +34 -45
- package/dist/components/combobox/combobox-trigger.svelte.d.ts +1 -6
- package/dist/components/datagrid/datagrid-footer.svelte +34 -34
- package/dist/components/datagrid/datagrid-root.svelte +59 -59
- package/dist/components/datagrid/tr/datagrid-tr.svelte +90 -90
- package/dist/components/dropdown/dropdown-trigger.svelte +30 -41
- package/dist/components/element/element.stories.svelte +37 -0
- package/dist/components/element/element.stories.svelte.d.ts +3 -0
- package/dist/components/element/html-element.svelte +17 -17
- package/dist/components/element/index.d.ts +0 -4
- package/dist/components/element/index.js +0 -4
- package/dist/components/element/svg-element.svelte +17 -16
- package/dist/components/element/types.d.ts +5 -6
- package/dist/components/icon/icon.css +4 -4
- package/dist/components/icon/icon.svelte +8 -6
- package/dist/components/lazy/lazy.svelte +29 -28
- package/dist/components/lazy/lazy.svelte.d.ts +1 -1
- package/dist/components/lazy/types.d.ts +1 -1
- package/dist/components/popover/popover-trigger.svelte +0 -12
- package/dist/components/root/root.svelte +1 -12
- package/dist/components/stepper/README.md +38 -38
- package/dist/components/tabs/index.d.ts +3 -1
- package/dist/components/tabs/index.js +3 -1
- package/dist/components/tabs/tab/index.d.ts +2 -0
- package/dist/components/tabs/tab/index.js +2 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +39 -39
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/package.json +490 -490
- package/dist/components/element/mathml-element.svelte +0 -90
- package/dist/components/element/mathml-element.svelte.d.ts +0 -25
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.calendar-day:nth-child(7n + 1) {
|
|
2
|
-
border-left: none;
|
|
3
|
-
}
|
|
4
|
-
.calendar-day:nth-last-child(-n + 7) {
|
|
5
|
-
border-bottom: none;
|
|
6
|
-
}
|
|
1
|
+
.calendar-day:nth-child(7n + 1) {
|
|
2
|
+
border-left: none;
|
|
3
|
+
}
|
|
4
|
+
.calendar-day:nth-last-child(-n + 7) {
|
|
5
|
+
border-bottom: none;
|
|
6
|
+
}
|
|
@@ -1,45 +1,34 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { ComboboxBond } from './bond.svelte';
|
|
3
|
-
import { Trigger } from '../dropdown/atoms';
|
|
4
|
-
import type { Base } from '../atom';
|
|
5
|
-
|
|
6
|
-
const bond = ComboboxBond.get();
|
|
7
|
-
|
|
8
|
-
if (!bond) {
|
|
9
|
-
throw new Error('Combobox atom was not found');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let {
|
|
13
|
-
class: klass = '',
|
|
14
|
-
as = 'button',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onmount={onmount?.bind(bond.state)}
|
|
36
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
37
|
-
onclick={(ev: Event) => {
|
|
38
|
-
ev.preventDefault();
|
|
39
|
-
|
|
40
|
-
bond?.state?.open();
|
|
41
|
-
}}
|
|
42
|
-
{...restProps}
|
|
43
|
-
>
|
|
44
|
-
{@render children?.({ dropdown: bond })}
|
|
45
|
-
</Trigger>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { ComboboxBond } from './bond.svelte';
|
|
3
|
+
import { Trigger } from '../dropdown/atoms';
|
|
4
|
+
import type { Base } from '../atom';
|
|
5
|
+
|
|
6
|
+
const bond = ComboboxBond.get();
|
|
7
|
+
|
|
8
|
+
if (!bond) {
|
|
9
|
+
throw new Error('Combobox atom was not found');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: klass = '',
|
|
14
|
+
as = 'button',
|
|
15
|
+
preset = 'combobox.trigger',
|
|
16
|
+
children = undefined,
|
|
17
|
+
...restProps
|
|
18
|
+
} = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Trigger
|
|
22
|
+
{as}
|
|
23
|
+
{bond}
|
|
24
|
+
preset={preset}
|
|
25
|
+
class={['border-border h-8 w-40', '$preset', klass]}
|
|
26
|
+
onclick={(ev: Event) => {
|
|
27
|
+
ev.preventDefault();
|
|
28
|
+
|
|
29
|
+
bond?.state?.open();
|
|
30
|
+
}}
|
|
31
|
+
{...restProps}
|
|
32
|
+
>
|
|
33
|
+
{@render children?.({ dropdown: bond })}
|
|
34
|
+
</Trigger>
|
|
@@ -3,13 +3,8 @@ declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B exten
|
|
|
3
3
|
props: {
|
|
4
4
|
class?: string;
|
|
5
5
|
as?: string;
|
|
6
|
+
preset?: string;
|
|
6
7
|
children?: any;
|
|
7
|
-
onmount?: any;
|
|
8
|
-
ondestroy?: any;
|
|
9
|
-
animate?: any;
|
|
10
|
-
enter?: any;
|
|
11
|
-
exit?: any;
|
|
12
|
-
initial?: any;
|
|
13
8
|
} & Record<string, any>;
|
|
14
9
|
exports: {};
|
|
15
10
|
bindings: "";
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
-
import { DataGridBond } from './bond.svelte';
|
|
4
|
-
import type { DatagridFooterProps } from './types';
|
|
5
|
-
|
|
6
|
-
const bond = DataGridBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
children = undefined,
|
|
11
|
-
onmount = undefined,
|
|
12
|
-
ondestroy = undefined,
|
|
13
|
-
animate = undefined,
|
|
14
|
-
enter = undefined,
|
|
15
|
-
exit = undefined,
|
|
16
|
-
initial = undefined,
|
|
17
|
-
...restProps
|
|
18
|
-
}: DatagridFooterProps<T> = $props();
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<HtmlAtom
|
|
22
|
-
{bond}
|
|
23
|
-
preset="datagrid.footer"
|
|
24
|
-
class={['border-border', '$preset', klass, 'contents']}
|
|
25
|
-
enter={enter?.bind(bond.state)}
|
|
26
|
-
exit={exit?.bind(bond.state)}
|
|
27
|
-
initial={initial?.bind(bond.state)}
|
|
28
|
-
animate={animate?.bind(bond.state)}
|
|
29
|
-
onmount={onmount?.bind(bond.state)}
|
|
30
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
31
|
-
{...restProps}
|
|
32
|
-
>
|
|
33
|
-
{@render children?.({ datagrid: bond })}
|
|
34
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
+
import { DataGridBond } from './bond.svelte';
|
|
4
|
+
import type { DatagridFooterProps } from './types';
|
|
5
|
+
|
|
6
|
+
const bond = DataGridBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
children = undefined,
|
|
11
|
+
onmount = undefined,
|
|
12
|
+
ondestroy = undefined,
|
|
13
|
+
animate = undefined,
|
|
14
|
+
enter = undefined,
|
|
15
|
+
exit = undefined,
|
|
16
|
+
initial = undefined,
|
|
17
|
+
...restProps
|
|
18
|
+
}: DatagridFooterProps<T> = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<HtmlAtom
|
|
22
|
+
{bond}
|
|
23
|
+
preset="datagrid.footer"
|
|
24
|
+
class={['border-border', '$preset', klass, 'contents']}
|
|
25
|
+
enter={enter?.bind(bond.state)}
|
|
26
|
+
exit={exit?.bind(bond.state)}
|
|
27
|
+
initial={initial?.bind(bond.state)}
|
|
28
|
+
animate={animate?.bind(bond.state)}
|
|
29
|
+
onmount={onmount?.bind(bond.state)}
|
|
30
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
31
|
+
{...restProps}
|
|
32
|
+
>
|
|
33
|
+
{@render children?.({ datagrid: bond })}
|
|
34
|
+
</HtmlAtom>
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
-
import { defineProperty, defineState } from '../../utils';
|
|
3
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
4
|
-
import { DataGridBond, DataGridBondState, type DataGridStateProps } from './bond.svelte';
|
|
5
|
-
import type { DatagridRootProps } from './types';
|
|
6
|
-
|
|
7
|
-
import './datagrid.css';
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
class: klass = '',
|
|
11
|
-
values = $bindable([]),
|
|
12
|
-
template = undefined,
|
|
13
|
-
fallbackTemplate = 'auto',
|
|
14
|
-
factory = _factory,
|
|
15
|
-
children = undefined,
|
|
16
|
-
onmount = undefined,
|
|
17
|
-
ondestroy = undefined,
|
|
18
|
-
animate = undefined,
|
|
19
|
-
enter = undefined,
|
|
20
|
-
exit = undefined,
|
|
21
|
-
initial = undefined,
|
|
22
|
-
...restProps
|
|
23
|
-
}: DatagridRootProps<T> = $props();
|
|
24
|
-
|
|
25
|
-
const bondProps = defineState<DataGridStateProps<T>>([
|
|
26
|
-
defineProperty('template', () => template),
|
|
27
|
-
defineProperty(
|
|
28
|
-
'values',
|
|
29
|
-
() => values,
|
|
30
|
-
(v) => (values = v)
|
|
31
|
-
)
|
|
32
|
-
]);
|
|
33
|
-
const bond = factory(bondProps).share();
|
|
34
|
-
|
|
35
|
-
function _factory(props: typeof bondProps) {
|
|
36
|
-
const dataGridState = new DataGridBondState(() => props);
|
|
37
|
-
return new DataGridBond(dataGridState);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getBond() {
|
|
41
|
-
return bond;
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<HtmlAtom
|
|
46
|
-
{bond}
|
|
47
|
-
preset="datagrid"
|
|
48
|
-
class={['border-border', 'datagrid-root w-full gap-x-0 gap-y-0', '$preset', klass]}
|
|
49
|
-
style="--template-columns:{bond.state.template ?? fallbackTemplate}"
|
|
50
|
-
enter={enter?.bind(bond.state)}
|
|
51
|
-
exit={exit?.bind(bond.state)}
|
|
52
|
-
initial={initial?.bind(bond.state)}
|
|
53
|
-
animate={animate?.bind(bond.state)}
|
|
54
|
-
onmount={onmount?.bind(bond.state)}
|
|
55
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
56
|
-
{...restProps}
|
|
57
|
-
>
|
|
58
|
-
{@render children?.({ datagrid: bond })}
|
|
59
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
+
import { defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
4
|
+
import { DataGridBond, DataGridBondState, type DataGridStateProps } from './bond.svelte';
|
|
5
|
+
import type { DatagridRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
import './datagrid.css';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: klass = '',
|
|
11
|
+
values = $bindable([]),
|
|
12
|
+
template = undefined,
|
|
13
|
+
fallbackTemplate = 'auto',
|
|
14
|
+
factory = _factory,
|
|
15
|
+
children = undefined,
|
|
16
|
+
onmount = undefined,
|
|
17
|
+
ondestroy = undefined,
|
|
18
|
+
animate = undefined,
|
|
19
|
+
enter = undefined,
|
|
20
|
+
exit = undefined,
|
|
21
|
+
initial = undefined,
|
|
22
|
+
...restProps
|
|
23
|
+
}: DatagridRootProps<T> = $props();
|
|
24
|
+
|
|
25
|
+
const bondProps = defineState<DataGridStateProps<T>>([
|
|
26
|
+
defineProperty('template', () => template),
|
|
27
|
+
defineProperty(
|
|
28
|
+
'values',
|
|
29
|
+
() => values,
|
|
30
|
+
(v) => (values = v)
|
|
31
|
+
)
|
|
32
|
+
]);
|
|
33
|
+
const bond = factory(bondProps).share();
|
|
34
|
+
|
|
35
|
+
function _factory(props: typeof bondProps) {
|
|
36
|
+
const dataGridState = new DataGridBondState(() => props);
|
|
37
|
+
return new DataGridBond(dataGridState);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getBond() {
|
|
41
|
+
return bond;
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<HtmlAtom
|
|
46
|
+
{bond}
|
|
47
|
+
preset="datagrid"
|
|
48
|
+
class={['border-border', 'datagrid-root w-full gap-x-0 gap-y-0', '$preset', klass]}
|
|
49
|
+
style="--template-columns:{bond.state.template ?? fallbackTemplate}"
|
|
50
|
+
enter={enter?.bind(bond.state)}
|
|
51
|
+
exit={exit?.bind(bond.state)}
|
|
52
|
+
initial={initial?.bind(bond.state)}
|
|
53
|
+
animate={animate?.bind(bond.state)}
|
|
54
|
+
onmount={onmount?.bind(bond.state)}
|
|
55
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
56
|
+
{...restProps}
|
|
57
|
+
>
|
|
58
|
+
{@render children?.({ datagrid: bond })}
|
|
59
|
+
</HtmlAtom>
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<script lang="ts" generics="T, E extends HtmlElementTagName, B extends Base = Base">
|
|
2
|
-
import { untrack } from 'svelte';
|
|
3
|
-
import { nanoid } from 'nanoid';
|
|
4
|
-
import { defineProperty, defineState } from '../../../utils';
|
|
5
|
-
import { HtmlAtom, type Base } from '../../atom';
|
|
6
|
-
import type { HtmlElementTagName } from '../../element';
|
|
7
|
-
import { DataGridTrBond, DataGridTrBondState, type DataGridTrBondProps } from './bond.svelte';
|
|
8
|
-
import type { DatagridTrProps } from '../types';
|
|
9
|
-
import { type DatagridContext } from '../context';
|
|
10
|
-
|
|
11
|
-
import './datagrid-tr.css';
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
class: klass = '',
|
|
15
|
-
value = nanoid(),
|
|
16
|
-
rows = 'auto',
|
|
17
|
-
data = undefined,
|
|
18
|
-
header = false,
|
|
19
|
-
factory = _factory,
|
|
20
|
-
children = undefined,
|
|
21
|
-
onmount = undefined,
|
|
22
|
-
ondestroy = undefined,
|
|
23
|
-
animate = undefined,
|
|
24
|
-
enter = undefined,
|
|
25
|
-
exit = undefined,
|
|
26
|
-
initial = undefined,
|
|
27
|
-
onclick = undefined,
|
|
28
|
-
...restProps
|
|
29
|
-
}: DatagridTrProps<T, E, B> = $props();
|
|
30
|
-
|
|
31
|
-
const bondProps = defineState<DataGridTrBondProps>([
|
|
32
|
-
defineProperty('data', () => data),
|
|
33
|
-
defineProperty('value', () => value),
|
|
34
|
-
defineProperty('header', () => header)
|
|
35
|
-
]);
|
|
36
|
-
const bond = factory(bondProps).share();
|
|
37
|
-
|
|
38
|
-
const isHeader = $derived(bond?.state.isHeader ?? false);
|
|
39
|
-
const isSelected = $derived(bond.state.isSelected);
|
|
40
|
-
|
|
41
|
-
const headerProps = $derived({
|
|
42
|
-
...bond.root(),
|
|
43
|
-
...restProps
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const unmount = untrack(() => {
|
|
47
|
-
if (!isHeader) {
|
|
48
|
-
return bond.mount();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
$effect(() => unmount);
|
|
53
|
-
|
|
54
|
-
function _factory(props: typeof bondProps) {
|
|
55
|
-
const datagridTrState = new DataGridTrBondState(() => props);
|
|
56
|
-
return new DataGridTrBond(datagridTrState);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function onclick_(ev: Event) {
|
|
60
|
-
onclick?.(ev, { tr: bond as unknown as DatagridContext<T> });
|
|
61
|
-
|
|
62
|
-
if (!ev.defaultPrevented) {
|
|
63
|
-
//
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<HtmlAtom
|
|
69
|
-
{bond}
|
|
70
|
-
preset="datagrid.tr"
|
|
71
|
-
class={[
|
|
72
|
-
'datagrid-tr border-border items-center border-b bg-transparent',
|
|
73
|
-
!isHeader && 'hover:bg-foreground/2 active:bg-foreground/4 transition-colors duration-100',
|
|
74
|
-
isHeader && 'header-tr',
|
|
75
|
-
isSelected && 'bg-primary/2 hover:bg-primary/4 active:bg-primary/6',
|
|
76
|
-
'$preset',
|
|
77
|
-
klass
|
|
78
|
-
]}
|
|
79
|
-
style="--rows:{rows}"
|
|
80
|
-
enter={enter?.bind(bond.state)}
|
|
81
|
-
exit={exit?.bind(bond.state)}
|
|
82
|
-
initial={initial?.bind(bond.state)}
|
|
83
|
-
animate={animate?.bind(bond.state)}
|
|
84
|
-
onmount={onmount?.bind(bond.state)}
|
|
85
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
86
|
-
onclick={onclick_}
|
|
87
|
-
{...headerProps}
|
|
88
|
-
>
|
|
89
|
-
{@render children?.({ tr: bond as unknown as DatagridContext<T> })}
|
|
90
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T, E extends HtmlElementTagName, B extends Base = Base">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import { nanoid } from 'nanoid';
|
|
4
|
+
import { defineProperty, defineState } from '../../../utils';
|
|
5
|
+
import { HtmlAtom, type Base } from '../../atom';
|
|
6
|
+
import type { HtmlElementTagName } from '../../element';
|
|
7
|
+
import { DataGridTrBond, DataGridTrBondState, type DataGridTrBondProps } from './bond.svelte';
|
|
8
|
+
import type { DatagridTrProps } from '../types';
|
|
9
|
+
import { type DatagridContext } from '../context';
|
|
10
|
+
|
|
11
|
+
import './datagrid-tr.css';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
class: klass = '',
|
|
15
|
+
value = nanoid(),
|
|
16
|
+
rows = 'auto',
|
|
17
|
+
data = undefined,
|
|
18
|
+
header = false,
|
|
19
|
+
factory = _factory,
|
|
20
|
+
children = undefined,
|
|
21
|
+
onmount = undefined,
|
|
22
|
+
ondestroy = undefined,
|
|
23
|
+
animate = undefined,
|
|
24
|
+
enter = undefined,
|
|
25
|
+
exit = undefined,
|
|
26
|
+
initial = undefined,
|
|
27
|
+
onclick = undefined,
|
|
28
|
+
...restProps
|
|
29
|
+
}: DatagridTrProps<T, E, B> = $props();
|
|
30
|
+
|
|
31
|
+
const bondProps = defineState<DataGridTrBondProps>([
|
|
32
|
+
defineProperty('data', () => data),
|
|
33
|
+
defineProperty('value', () => value),
|
|
34
|
+
defineProperty('header', () => header)
|
|
35
|
+
]);
|
|
36
|
+
const bond = factory(bondProps).share();
|
|
37
|
+
|
|
38
|
+
const isHeader = $derived(bond?.state.isHeader ?? false);
|
|
39
|
+
const isSelected = $derived(bond.state.isSelected);
|
|
40
|
+
|
|
41
|
+
const headerProps = $derived({
|
|
42
|
+
...bond.root(),
|
|
43
|
+
...restProps
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const unmount = untrack(() => {
|
|
47
|
+
if (!isHeader) {
|
|
48
|
+
return bond.mount();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
$effect(() => unmount);
|
|
53
|
+
|
|
54
|
+
function _factory(props: typeof bondProps) {
|
|
55
|
+
const datagridTrState = new DataGridTrBondState(() => props);
|
|
56
|
+
return new DataGridTrBond(datagridTrState);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function onclick_(ev: Event) {
|
|
60
|
+
onclick?.(ev, { tr: bond as unknown as DatagridContext<T> });
|
|
61
|
+
|
|
62
|
+
if (!ev.defaultPrevented) {
|
|
63
|
+
//
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<HtmlAtom
|
|
69
|
+
{bond}
|
|
70
|
+
preset="datagrid.tr"
|
|
71
|
+
class={[
|
|
72
|
+
'datagrid-tr border-border items-center border-b bg-transparent',
|
|
73
|
+
!isHeader && 'hover:bg-foreground/2 active:bg-foreground/4 transition-colors duration-100',
|
|
74
|
+
isHeader && 'header-tr',
|
|
75
|
+
isSelected && 'bg-primary/2 hover:bg-primary/4 active:bg-primary/6',
|
|
76
|
+
'$preset',
|
|
77
|
+
klass
|
|
78
|
+
]}
|
|
79
|
+
style="--rows:{rows}"
|
|
80
|
+
enter={enter?.bind(bond.state)}
|
|
81
|
+
exit={exit?.bind(bond.state)}
|
|
82
|
+
initial={initial?.bind(bond.state)}
|
|
83
|
+
animate={animate?.bind(bond.state)}
|
|
84
|
+
onmount={onmount?.bind(bond.state)}
|
|
85
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
86
|
+
onclick={onclick_}
|
|
87
|
+
{...headerProps}
|
|
88
|
+
>
|
|
89
|
+
{@render children?.({ tr: bond as unknown as DatagridContext<T> })}
|
|
90
|
+
</HtmlAtom>
|
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { Trigger } from '../popover/atoms';
|
|
3
|
-
import type { Base } from '../atom';
|
|
4
|
-
import { DropdownBond } from './bond.svelte';
|
|
5
|
-
import type { DropdownTriggerProps } from './types';
|
|
6
|
-
|
|
7
|
-
const bond = DropdownBond.get();
|
|
8
|
-
|
|
9
|
-
if (!bond) {
|
|
10
|
-
throw new Error('dropdown atom was not found');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
class: klass = '',
|
|
15
|
-
as = 'button' as T,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{bond}
|
|
30
|
-
|
|
31
|
-
class={['border-border relative flex h-auto min-h-10 flex-wrap items-center', '$preset', klass]}
|
|
32
|
-
onmount={onmount?.bind(bond.state)}
|
|
33
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
34
|
-
enter={enter?.bind(bond.state)}
|
|
35
|
-
exit={exit?.bind(bond.state)}
|
|
36
|
-
initial={initial?.bind(bond.state)}
|
|
37
|
-
animate={animate?.bind(bond.state)}
|
|
38
|
-
{...restProps}
|
|
39
|
-
>
|
|
40
|
-
{@render children?.({ dropdown: bond })}
|
|
41
|
-
</Trigger>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { Trigger } from '../popover/atoms';
|
|
3
|
+
import type { Base } from '../atom';
|
|
4
|
+
import { DropdownBond } from './bond.svelte';
|
|
5
|
+
import type { DropdownTriggerProps } from './types';
|
|
6
|
+
|
|
7
|
+
const bond = DropdownBond.get();
|
|
8
|
+
|
|
9
|
+
if (!bond) {
|
|
10
|
+
throw new Error('dropdown atom was not found');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
class: klass = '',
|
|
15
|
+
as = 'button' as T,
|
|
16
|
+
preset = 'dropdown.trigger',
|
|
17
|
+
children = undefined,
|
|
18
|
+
...restProps
|
|
19
|
+
}: DropdownTriggerProps<T, B> = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Trigger
|
|
23
|
+
{as}
|
|
24
|
+
{bond}
|
|
25
|
+
preset={preset}
|
|
26
|
+
class={['border-border relative flex h-auto min-h-10 flex-wrap items-center', '$preset', klass]}
|
|
27
|
+
{...restProps}
|
|
28
|
+
>
|
|
29
|
+
{@render children?.({ dropdown: bond })}
|
|
30
|
+
</Trigger>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import HtmlElement from './html-element.svelte';
|
|
4
|
+
import { Button } from '../button';
|
|
5
|
+
import { fade } from 'svelte/transition';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Atoms/Element',
|
|
10
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
+
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen'
|
|
15
|
+
},
|
|
16
|
+
args: {}
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let showElement = $state(true);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Story name="Element" args={{}}>
|
|
25
|
+
<!-- Multi-select dropdown with search functionality -->
|
|
26
|
+
<div class="flex flex-col gap-4">
|
|
27
|
+
{#if showElement}
|
|
28
|
+
<HtmlElement enter={node=> ()=> fade(node, { duration: 500 })} exit={node => fade(node, { duration: 500 })} class="p-4 bg-blue-100 rounded" as="section">
|
|
29
|
+
Hello, I am an HtmlElement component! I can be used to render any HTML element with custom props and transitions.
|
|
30
|
+
</HtmlElement>
|
|
31
|
+
{/if}
|
|
32
|
+
|
|
33
|
+
<Button onclick={() => showElement = !showElement}>
|
|
34
|
+
{showElement ? 'Hide' : 'Show'} HtmlElement
|
|
35
|
+
</Button>
|
|
36
|
+
</div>
|
|
37
|
+
</Story>
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
[createAttachmentKey()]: (n: Element) => {
|
|
49
49
|
node = n;
|
|
50
50
|
},
|
|
51
|
-
class: cn(toClassValue(klass)),
|
|
52
51
|
onintroend: (ev: TransitionEvent) => {
|
|
53
52
|
onintroend?.(ev);
|
|
54
53
|
if (ev.defaultPrevented) return;
|
|
@@ -56,30 +55,31 @@
|
|
|
56
55
|
hasEntered = true;
|
|
57
56
|
},
|
|
58
57
|
...restProps
|
|
59
|
-
})
|
|
58
|
+
}) as Record<string, any>;
|
|
59
|
+
|
|
60
|
+
const transitionSnippet = $derived(global ? globalTransition : localTransition);
|
|
60
61
|
|
|
61
|
-
function
|
|
62
|
+
function enterTransition(node: Element) {
|
|
62
63
|
initial?.(node);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return { duration, delay, easing };
|
|
66
|
-
};
|
|
64
|
+
|
|
65
|
+
return enter?.(node) ?? {};
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
function
|
|
70
|
-
return ()
|
|
71
|
-
const { duration = 0, delay = 0, easing = undefined } = exit?.(node) ?? {};
|
|
72
|
-
return { duration, delay, easing };
|
|
73
|
-
};
|
|
68
|
+
function exitTransition(node: Element) {
|
|
69
|
+
return exit?.(node) ?? {};
|
|
74
70
|
}
|
|
75
71
|
</script>
|
|
76
72
|
|
|
77
|
-
{#
|
|
78
|
-
<svelte:element this={as} in:
|
|
73
|
+
{#snippet globalTransition()}
|
|
74
|
+
<svelte:element this={as} class={cn(toClassValue(klass))} in:enterTransition|global out:exitTransition|global {...elementProps}>
|
|
79
75
|
{@render children?.()}
|
|
80
76
|
</svelte:element>
|
|
81
|
-
{
|
|
82
|
-
|
|
77
|
+
{/snippet}
|
|
78
|
+
|
|
79
|
+
{#snippet localTransition()}
|
|
80
|
+
<svelte:element this={as} class={cn(toClassValue(klass))} in:enterTransition out:exitTransition {...elementProps}>
|
|
83
81
|
{@render children?.()}
|
|
84
82
|
</svelte:element>
|
|
85
|
-
{/
|
|
83
|
+
{/snippet}
|
|
84
|
+
|
|
85
|
+
{@render transitionSnippet()}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export { default as HtmlElement } from './html-element.svelte';
|
|
2
2
|
export { default as SvgElement } from './svg-element.svelte';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
*/
|
|
6
|
-
export { default as MathmlElement } from './mathml-element.svelte';
|
|
7
3
|
export * as Element from './atoms';
|
|
8
4
|
export * from './types';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export { default as HtmlElement } from './html-element.svelte';
|
|
2
2
|
export { default as SvgElement } from './svg-element.svelte';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
*/
|
|
6
|
-
export { default as MathmlElement } from './mathml-element.svelte';
|
|
7
3
|
export * as Element from './atoms';
|
|
8
4
|
export * from './types';
|