fluid-ui-svelte 0.2.3 → 0.3.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/LICENSE +22 -0
- package/README.md +16 -5
- package/dist/base/Button.svelte +35 -0
- package/dist/base/Button.svelte.d.ts +14 -0
- package/dist/base/Container.svelte +34 -0
- package/dist/base/Container.svelte.d.ts +14 -0
- package/dist/base/Image.svelte +21 -0
- package/dist/base/Image.svelte.d.ts +8 -0
- package/dist/base/InputField.svelte +33 -0
- package/dist/base/InputField.svelte.d.ts +10 -0
- package/dist/base/Link.svelte +23 -0
- package/dist/base/Link.svelte.d.ts +10 -0
- package/dist/base/List.svelte +39 -0
- package/dist/base/List.svelte.d.ts +33 -0
- package/dist/base/Table.svelte +80 -0
- package/dist/base/Table.svelte.d.ts +42 -0
- package/dist/base/Text.svelte +45 -0
- package/dist/base/Text.svelte.d.ts +11 -0
- package/dist/base/index.d.ts +8 -0
- package/dist/base/index.js +8 -0
- package/dist/components/Accordion.svelte +45 -1
- package/dist/components/Accordion.svelte.d.ts +14 -25
- package/dist/components/Calendar.svelte +63 -0
- package/dist/components/Calendar.svelte.d.ts +9 -25
- package/dist/components/{Badge.svelte.d.ts → Carousel.svelte.d.ts} +3 -3
- package/dist/components/CodeBlock.svelte +27 -0
- package/dist/components/CodeBlock.svelte.d.ts +8 -0
- package/dist/components/ImageCrop.svelte +65 -0
- package/dist/components/ImageCrop.svelte.d.ts +7 -0
- package/dist/components/Page.svelte +26 -0
- package/dist/components/Page.svelte.d.ts +11 -0
- package/dist/components/Switch.svelte +22 -20
- package/dist/components/Switch.svelte.d.ts +9 -4
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/index.d.ts +2 -33
- package/dist/index.js +2 -36
- package/dist/utilities/applyCharacterFilter.d.ts +1 -0
- package/dist/utilities/applyCharacterFilter.js +6 -0
- package/dist/utilities/calendar.d.ts +10 -0
- package/dist/utilities/calendar.js +112 -0
- package/dist/utilities/imageCrop.d.ts +33 -0
- package/dist/utilities/imageCrop.js +217 -0
- package/dist/utilities/mergeClasses.d.ts +1 -0
- package/dist/utilities/mergeClasses.js +3 -0
- package/package.json +50 -33
- package/dist/community/components/index.d.ts +0 -1
- package/dist/community/components/index.js +0 -1
- package/dist/community/prebuilt/index.d.ts +0 -1
- package/dist/community/prebuilt/index.js +0 -1
- package/dist/components/Breadcrumb.svelte +0 -1
- package/dist/components/Breadcrumb.svelte.d.ts +0 -26
- package/dist/components/Drawer.svelte +0 -33
- package/dist/components/Drawer.svelte.d.ts +0 -9
- package/dist/components/Dropdown.svelte +0 -59
- package/dist/components/Dropdown.svelte.d.ts +0 -20
- package/dist/components/Dropzone.svelte +0 -1
- package/dist/components/Dropzone.svelte.d.ts +0 -26
- package/dist/components/InteractiveScrollArea.svelte +0 -1
- package/dist/components/InteractiveScrollArea.svelte.d.ts +0 -26
- package/dist/components/Pagination.svelte +0 -1
- package/dist/components/Pagination.svelte.d.ts +0 -26
- package/dist/components/Progress.svelte +0 -1
- package/dist/components/Progress.svelte.d.ts +0 -26
- package/dist/components/Tabs.svelte +0 -1
- package/dist/components/Tabs.svelte.d.ts +0 -26
- package/dist/components/Tooltip.svelte +0 -1
- package/dist/components/Tooltip.svelte.d.ts +0 -26
- package/dist/components/charts/BatteryChart.svelte +0 -0
- package/dist/components/charts/BatteryChart.svelte.d.ts +0 -26
- package/dist/components/charts/LineChart.svelte +0 -0
- package/dist/components/charts/LineChart.svelte.d.ts +0 -26
- package/dist/components/charts/PieChart.svelte +0 -0
- package/dist/components/charts/PieChart.svelte.d.ts +0 -26
- package/dist/components/notification/NotificationArea.svelte +0 -21
- package/dist/components/notification/NotificationArea.svelte.d.ts +0 -7
- package/dist/prebuilt/FormBuilder.svelte +0 -1
- package/dist/prebuilt/FormBuilder.svelte.d.ts +0 -26
- package/dist/prebuilt/document/Document.svelte +0 -1
- package/dist/prebuilt/document/Document.svelte.d.ts +0 -26
- package/dist/prebuilt/document/DocumentBlock.svelte +0 -1
- package/dist/prebuilt/document/DocumentBlock.svelte.d.ts +0 -26
- package/dist/prebuilt/document/DocumentPage.svelte +0 -1
- package/dist/prebuilt/document/DocumentPage.svelte.d.ts +0 -26
- package/dist/prebuilt/timeline/Timeline.svelte +0 -0
- package/dist/prebuilt/timeline/Timeline.svelte.d.ts +0 -26
- package/dist/prebuilt/timeline/TimelineItem.svelte +0 -0
- package/dist/prebuilt/timeline/TimelineItem.svelte.d.ts +0 -26
- package/dist/primitives/Button.svelte +0 -53
- package/dist/primitives/Button.svelte.d.ts +0 -13
- package/dist/primitives/Container.svelte +0 -51
- package/dist/primitives/Container.svelte.d.ts +0 -10
- package/dist/primitives/Dialog.svelte +0 -39
- package/dist/primitives/Dialog.svelte.d.ts +0 -10
- package/dist/primitives/Divider.svelte +0 -14
- package/dist/primitives/Divider.svelte.d.ts +0 -6
- package/dist/primitives/Form.svelte +0 -18
- package/dist/primitives/Form.svelte.d.ts +0 -8
- package/dist/primitives/Image.svelte +0 -57
- package/dist/primitives/Image.svelte.d.ts +0 -12
- package/dist/primitives/Input.svelte +0 -23
- package/dist/primitives/Input.svelte.d.ts +0 -9
- package/dist/primitives/Label.svelte +0 -18
- package/dist/primitives/Label.svelte.d.ts +0 -8
- package/dist/primitives/Link.svelte +0 -18
- package/dist/primitives/Link.svelte.d.ts +0 -8
- package/dist/primitives/Table.svelte +0 -18
- package/dist/primitives/Table.svelte.d.ts +0 -8
- package/dist/primitives/TableBody.svelte +0 -17
- package/dist/primitives/TableBody.svelte.d.ts +0 -7
- package/dist/primitives/TableData.svelte +0 -18
- package/dist/primitives/TableData.svelte.d.ts +0 -8
- package/dist/primitives/TableFooter.svelte +0 -17
- package/dist/primitives/TableFooter.svelte.d.ts +0 -7
- package/dist/primitives/TableHead.svelte +0 -18
- package/dist/primitives/TableHead.svelte.d.ts +0 -8
- package/dist/primitives/TableHeader.svelte +0 -17
- package/dist/primitives/TableHeader.svelte.d.ts +0 -7
- package/dist/primitives/TableRow.svelte +0 -18
- package/dist/primitives/TableRow.svelte.d.ts +0 -8
- package/dist/primitives/Text.svelte +0 -46
- package/dist/primitives/Text.svelte.d.ts +0 -8
- package/dist/primitives/TextArea.svelte +0 -15
- package/dist/primitives/TextArea.svelte.d.ts +0 -7
- package/dist/types.d.ts +0 -4
- package/dist/types.js +0 -1
- /package/dist/components/{Badge.svelte → Carousel.svelte} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Container from '../base/Container.svelte';
|
|
3
|
+
import Button from '../base/Button.svelte';
|
|
4
|
+
import Text from '../base/Text.svelte';
|
|
5
|
+
import {
|
|
6
|
+
applyDate,
|
|
7
|
+
generateCalendarCellStyles,
|
|
8
|
+
generateDaysOfTheMonthFromDate
|
|
9
|
+
} from '../utilities/calendar.js';
|
|
10
|
+
import { mergeClasses } from '../utilities/mergeClasses.js';
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
variant = '',
|
|
14
|
+
currentDate = new Date().toISOString(),
|
|
15
|
+
startDate = $bindable(),
|
|
16
|
+
endDate = $bindable(),
|
|
17
|
+
hideRollingDays = false
|
|
18
|
+
}: {
|
|
19
|
+
variant?: string;
|
|
20
|
+
currentDate?: string;
|
|
21
|
+
startDate?: string;
|
|
22
|
+
endDate?: string;
|
|
23
|
+
hideRollingDays?: boolean;
|
|
24
|
+
} = $props();
|
|
25
|
+
|
|
26
|
+
const componentState = $state({
|
|
27
|
+
weekDays: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
28
|
+
calendarDays: generateDaysOfTheMonthFromDate(new Date().toISOString())
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function dateSelectionHandler(selectedDate: string) {
|
|
32
|
+
const result = applyDate({ startDate, endDate: endDate }, selectedDate);
|
|
33
|
+
startDate = result.startDate;
|
|
34
|
+
endDate = result.endDate;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
$effect(() => {
|
|
38
|
+
componentState.calendarDays = generateDaysOfTheMonthFromDate(currentDate);
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Container class={mergeClasses('fluid-calendar-wrapper', variant)}>
|
|
43
|
+
<Container class={mergeClasses('fluid-calendar-header', variant)}>
|
|
44
|
+
<Text>{new Date(currentDate).toLocaleString('default', { month: 'long' })}</Text>
|
|
45
|
+
</Container>
|
|
46
|
+
<Container class={mergeClasses('fluid-calendar-body', variant)}>
|
|
47
|
+
{#each componentState.weekDays as day}
|
|
48
|
+
<Text>{day}</Text>
|
|
49
|
+
{/each}
|
|
50
|
+
|
|
51
|
+
{#each componentState.calendarDays as cellDay}
|
|
52
|
+
<Button
|
|
53
|
+
onclick={async () => dateSelectionHandler(cellDay)}
|
|
54
|
+
class={mergeClasses(
|
|
55
|
+
variant,
|
|
56
|
+
generateCalendarCellStyles(currentDate, cellDay, startDate, endDate, hideRollingDays)
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
{new Date(cellDay).getDate()}
|
|
60
|
+
</Button>
|
|
61
|
+
{/each}
|
|
62
|
+
</Container>
|
|
63
|
+
</Container>
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$$bindings?: string | undefined;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
variant?: string;
|
|
3
|
+
currentDate?: string;
|
|
4
|
+
startDate?: string;
|
|
5
|
+
endDate?: string;
|
|
6
|
+
hideRollingDays?: boolean;
|
|
8
7
|
};
|
|
9
|
-
declare const Calendar:
|
|
10
|
-
|
|
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
|
-
}
|
|
8
|
+
declare const Calendar: import("svelte").Component<$$ComponentProps, {}, "startDate" | "endDate">;
|
|
9
|
+
type Calendar = ReturnType<typeof Calendar>;
|
|
10
|
+
export default Calendar;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default
|
|
2
|
-
type
|
|
1
|
+
export default Carousel;
|
|
2
|
+
type Carousel = SvelteComponent<{
|
|
3
3
|
[x: string]: never;
|
|
4
4
|
}, {
|
|
5
5
|
[evt: string]: CustomEvent<any>;
|
|
6
6
|
}, {}> & {
|
|
7
7
|
$$bindings?: string | undefined;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
9
|
+
declare const Carousel: $$__sveltets_2_IsomorphicComponent<{
|
|
10
10
|
[x: string]: never;
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Container from '../base/Container.svelte';
|
|
3
|
+
import Text from '../base/Text.svelte';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
variation,
|
|
7
|
+
code = '',
|
|
8
|
+
language = ''
|
|
9
|
+
}: {
|
|
10
|
+
variation?: string;
|
|
11
|
+
code?: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
} = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Container class="fluid-code-block-container">
|
|
17
|
+
{#each code.split('\n') as line, index}
|
|
18
|
+
<Container class="fluid-code-block-row">
|
|
19
|
+
<Container class="fluid-code-block-index"><Text class="select-none">{index}</Text></Container>
|
|
20
|
+
<Container class="fluid-code-block-content">
|
|
21
|
+
<Text type="pre">
|
|
22
|
+
<Text type="code" class={'language-' + language}>{line}</Text>
|
|
23
|
+
</Text>
|
|
24
|
+
</Container>
|
|
25
|
+
</Container>
|
|
26
|
+
{/each}
|
|
27
|
+
</Container>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Container from '../base/Container.svelte';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import { Text } from '../base/index.js';
|
|
5
|
+
import {
|
|
6
|
+
draw,
|
|
7
|
+
generateCropAreaState,
|
|
8
|
+
handleMouseDown,
|
|
9
|
+
handleMouseMove,
|
|
10
|
+
handleMouseUp
|
|
11
|
+
} from '../utilities/imageCrop.js';
|
|
12
|
+
const {
|
|
13
|
+
imageFile,
|
|
14
|
+
cropAreaShape = 'rectangle'
|
|
15
|
+
}: { imageFile: File; cropAreaShape?: 'rectangle' | 'circle' } = $props();
|
|
16
|
+
|
|
17
|
+
let canvasElement: HTMLCanvasElement;
|
|
18
|
+
let image: HTMLImageElement | undefined = $state();
|
|
19
|
+
|
|
20
|
+
const cropAreaState = $state(generateCropAreaState(cropAreaShape));
|
|
21
|
+
|
|
22
|
+
onMount(() => {
|
|
23
|
+
const fileReader = new FileReader();
|
|
24
|
+
fileReader.readAsDataURL(imageFile);
|
|
25
|
+
fileReader.onload = () => {
|
|
26
|
+
const loadedImage = new Image();
|
|
27
|
+
loadedImage.src = fileReader.result as string;
|
|
28
|
+
loadedImage.onload = () => {
|
|
29
|
+
// Set the reactive image state once it's fully loaded
|
|
30
|
+
image = loadedImage;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$effect(() => {
|
|
36
|
+
// Only run if the canvas and image are ready
|
|
37
|
+
if (canvasElement && image) {
|
|
38
|
+
// This block performs the ONE-TIME setup when the image first loads.
|
|
39
|
+
if (canvasElement.width !== image.naturalWidth) {
|
|
40
|
+
canvasElement.width = image.naturalWidth;
|
|
41
|
+
canvasElement.height = image.naturalHeight;
|
|
42
|
+
cropAreaState.cropArea.width = canvasElement.width / 2;
|
|
43
|
+
cropAreaState.cropArea.height = canvasElement.height / 2;
|
|
44
|
+
cropAreaState.cropArea.x = (canvasElement.width - cropAreaState.cropArea.width) / 2;
|
|
45
|
+
cropAreaState.cropArea.y = (canvasElement.height - cropAreaState.cropArea.height) / 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// This will now run on the initial setup AND any time cropAreaState changes.
|
|
49
|
+
draw(canvasElement, image, cropAreaState);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<Container>
|
|
55
|
+
<Text>Canvas to Draw On</Text>
|
|
56
|
+
<canvas
|
|
57
|
+
class="size-full"
|
|
58
|
+
bind:this={canvasElement}
|
|
59
|
+
onpointerdown={(event) => handleMouseDown(event, cropAreaState, canvasElement)}
|
|
60
|
+
onpointermove={(event) => handleMouseMove(event, cropAreaState, canvasElement)}
|
|
61
|
+
onpointerup={() => handleMouseUp(cropAreaState)}
|
|
62
|
+
onpointercancel={() => handleMouseUp(cropAreaState)}
|
|
63
|
+
onpointerleave={() => handleMouseUp(cropAreaState)}
|
|
64
|
+
></canvas>
|
|
65
|
+
</Container>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import Container from '../base/Container.svelte';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
title = '',
|
|
8
|
+
description = '',
|
|
9
|
+
children,
|
|
10
|
+
...rest
|
|
11
|
+
}: {
|
|
12
|
+
class?: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
} & HTMLAttributes<HTMLElement> = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<svelte:head>
|
|
20
|
+
<title>{title}</title>
|
|
21
|
+
<meta name="description" content={description} />
|
|
22
|
+
</svelte:head>
|
|
23
|
+
|
|
24
|
+
<Container class="fluid-page" type="section">
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
</Container>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
class?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
} & HTMLAttributes<HTMLElement>;
|
|
9
|
+
declare const Page: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type Page = ReturnType<typeof Page>;
|
|
11
|
+
export default Page;
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Button from "../primitives/Button.svelte";
|
|
5
|
-
import Container from "../primitives/Container.svelte";
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { Button } from '../base/index.js';
|
|
6
4
|
|
|
7
5
|
let {
|
|
8
|
-
|
|
6
|
+
onswitch,
|
|
9
7
|
checked = $bindable(false),
|
|
10
|
-
|
|
8
|
+
disabled = false,
|
|
9
|
+
class: className = '',
|
|
10
|
+
...rest
|
|
11
11
|
}: {
|
|
12
|
-
|
|
12
|
+
onswitch: (event: Event, checked: boolean) => Promise<void>;
|
|
13
13
|
checked?: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
class?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
} & Omit<HTMLAttributes<HTMLButtonElement>, 'onclick'> = $props();
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
20
|
<Button
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
role="switch"
|
|
22
|
+
aria-checked={checked}
|
|
23
|
+
class={'fluid-switch-button' + (checked ? ' checked' : '')}
|
|
24
|
+
onclick={async (event) => {
|
|
25
|
+
if (!disabled) {
|
|
26
|
+
await onswitch(event, checked);
|
|
27
|
+
checked = !checked;
|
|
28
|
+
}
|
|
21
29
|
}}
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
{...rest}
|
|
31
|
+
overrideDefaultStyling
|
|
24
32
|
>
|
|
25
|
-
<
|
|
26
|
-
overrideDefaultStyling={true}
|
|
27
|
-
class={(overrideDefaultStyling ? "" : "fluid-switch" + (checked ? " fluid-switch-checked" : "")) + (className ? (overrideDefaultStyling ? `${className}` : ` ${className}`) : "")}
|
|
28
|
-
>
|
|
29
|
-
<Input bind:checked type="checkbox" class="sr-only peer"></Input>
|
|
30
|
-
<div class="fluid-switch-slider"></div>
|
|
31
|
-
</Container>
|
|
33
|
+
<span class="fluid-switch-circle"></span>
|
|
32
34
|
</Button>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
onswitch: (event: Event, checked: boolean) => Promise<void>;
|
|
3
4
|
checked?: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
class?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
} & Omit<HTMLAttributes<HTMLButtonElement>, 'onclick'>;
|
|
9
|
+
declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
10
|
+
type Switch = ReturnType<typeof Switch>;
|
|
6
11
|
export default Switch;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion.svelte';
|
|
2
|
+
export { default as Calendar } from './Calendar.svelte';
|
|
3
|
+
export { default as CodeBlock } from './CodeBlock.svelte';
|
|
4
|
+
export { default as ImageCrop } from './ImageCrop.svelte';
|
|
5
|
+
export { default as Page } from './Page.svelte';
|
|
6
|
+
export { default as Switch } from './Switch.svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion.svelte';
|
|
2
|
+
export { default as Calendar } from './Calendar.svelte';
|
|
3
|
+
export { default as CodeBlock } from './CodeBlock.svelte';
|
|
4
|
+
export { default as ImageCrop } from './ImageCrop.svelte';
|
|
5
|
+
export { default as Page } from './Page.svelte';
|
|
6
|
+
export { default as Switch } from './Switch.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export { default as Button } from "./primitives/Button.svelte";
|
|
4
|
-
export { default as Container } from "./primitives/Container.svelte";
|
|
5
|
-
export { default as Dialog } from "./primitives/Dialog.svelte";
|
|
6
|
-
export { default as Form } from "./primitives/Form.svelte";
|
|
7
|
-
export { default as Image } from "./primitives/Image.svelte";
|
|
8
|
-
export { default as Input } from "./primitives/Input.svelte";
|
|
9
|
-
export { default as Label } from "./primitives/Label.svelte";
|
|
10
|
-
export { default as Table } from "./primitives/Table.svelte";
|
|
11
|
-
export { default as TableBody } from "./primitives/TableBody.svelte";
|
|
12
|
-
export { default as TableData } from "./primitives/TableData.svelte";
|
|
13
|
-
export { default as TableFooter } from "./primitives/TableFooter.svelte";
|
|
14
|
-
export { default as TableHead } from "./primitives/TableHead.svelte";
|
|
15
|
-
export { default as TableHeader } from "./primitives/TableHeader.svelte";
|
|
16
|
-
export { default as TableRow } from "./primitives/TableRow.svelte";
|
|
17
|
-
export { default as Text } from "./primitives/Text.svelte";
|
|
18
|
-
export { default as TextArea } from "./primitives/TextArea.svelte";
|
|
19
|
-
export { default as Accordion } from "./components/Accordion.svelte";
|
|
20
|
-
export { default as Breadcrumb } from "./components/Breadcrumb.svelte";
|
|
21
|
-
export { default as Drawer } from "./components/Drawer.svelte";
|
|
22
|
-
export { default as Dropdown } from "./components/Dropdown.svelte";
|
|
23
|
-
export { default as NotificationArea } from "./components/notification/NotificationArea.svelte";
|
|
24
|
-
export { default as Pagination } from "./components/Pagination.svelte";
|
|
25
|
-
export { default as Progress } from "./components/Progress.svelte";
|
|
26
|
-
export { default as Switch } from "./components/Switch.svelte";
|
|
27
|
-
export { default as Tabs } from "./components/Tabs.svelte";
|
|
28
|
-
export { default as Dropzone } from "./components/Dropzone.svelte";
|
|
29
|
-
export { default as FormBuilder } from "./prebuilt/FormBuilder.svelte";
|
|
30
|
-
export { default as InteractiveScrollArea } from "./components/InteractiveScrollArea.svelte";
|
|
31
|
-
export { default as Document } from "./prebuilt/document/Document.svelte";
|
|
32
|
-
export { default as DocumentBlock } from "./prebuilt/document/DocumentBlock.svelte";
|
|
33
|
-
export { default as DocumentPage } from "./prebuilt/document/DocumentPage.svelte";
|
|
1
|
+
export * from './base/index.js';
|
|
2
|
+
export * from './components/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { default as Link } from "./primitives/Link.svelte";
|
|
4
|
-
export { default as Button } from "./primitives/Button.svelte";
|
|
5
|
-
export { default as Container } from "./primitives/Container.svelte";
|
|
6
|
-
export { default as Dialog } from "./primitives/Dialog.svelte";
|
|
7
|
-
export { default as Form } from "./primitives/Form.svelte";
|
|
8
|
-
export { default as Image } from "./primitives/Image.svelte";
|
|
9
|
-
export { default as Input } from "./primitives/Input.svelte";
|
|
10
|
-
export { default as Label } from "./primitives/Label.svelte";
|
|
11
|
-
export { default as Table } from "./primitives/Table.svelte";
|
|
12
|
-
export { default as TableBody } from "./primitives/TableBody.svelte";
|
|
13
|
-
export { default as TableData } from "./primitives/TableData.svelte";
|
|
14
|
-
export { default as TableFooter } from "./primitives/TableFooter.svelte";
|
|
15
|
-
export { default as TableHead } from "./primitives/TableHead.svelte";
|
|
16
|
-
export { default as TableHeader } from "./primitives/TableHeader.svelte";
|
|
17
|
-
export { default as TableRow } from "./primitives/TableRow.svelte";
|
|
18
|
-
export { default as Text } from "./primitives/Text.svelte";
|
|
19
|
-
export { default as TextArea } from "./primitives/TextArea.svelte";
|
|
20
|
-
// Components
|
|
21
|
-
export { default as Accordion } from "./components/Accordion.svelte";
|
|
22
|
-
export { default as Breadcrumb } from "./components/Breadcrumb.svelte";
|
|
23
|
-
export { default as Drawer } from "./components/Drawer.svelte";
|
|
24
|
-
export { default as Dropdown } from "./components/Dropdown.svelte";
|
|
25
|
-
export { default as NotificationArea } from "./components/notification/NotificationArea.svelte";
|
|
26
|
-
export { default as Pagination } from "./components/Pagination.svelte";
|
|
27
|
-
export { default as Progress } from "./components/Progress.svelte";
|
|
28
|
-
export { default as Switch } from "./components/Switch.svelte";
|
|
29
|
-
export { default as Tabs } from "./components/Tabs.svelte";
|
|
30
|
-
export { default as Dropzone } from "./components/Dropzone.svelte";
|
|
31
|
-
// Prebuilt
|
|
32
|
-
export { default as FormBuilder } from "./prebuilt/FormBuilder.svelte";
|
|
33
|
-
export { default as InteractiveScrollArea } from "./components/InteractiveScrollArea.svelte";
|
|
34
|
-
export { default as Document } from "./prebuilt/document/Document.svelte";
|
|
35
|
-
export { default as DocumentBlock } from "./prebuilt/document/DocumentBlock.svelte";
|
|
36
|
-
export { default as DocumentPage } from "./prebuilt/document/DocumentPage.svelte";
|
|
1
|
+
export * from './base/index.js';
|
|
2
|
+
export * from './components/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyCharacterFilter(keys: Array<string>, value: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function applyDate(currentDates: {
|
|
2
|
+
startDate?: string;
|
|
3
|
+
endDate?: string;
|
|
4
|
+
}, selectedDate: string): {
|
|
5
|
+
startDate?: string;
|
|
6
|
+
endDate?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateDaysOfTheMonthFromDate(date: string): string[];
|
|
9
|
+
export declare function isBetweenDateRange(selectedDate: string, startDate?: string, endDate?: string): boolean;
|
|
10
|
+
export declare function generateCalendarCellStyles(currentDate: string, cellDate: string, startDate?: string, endDate?: string, hideRollingDays?: boolean): string;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export function applyDate(currentDates, selectedDate) {
|
|
2
|
+
// If selected already, second click action is to remove selection.
|
|
3
|
+
if (currentDates.endDate && currentDates.endDate === selectedDate) {
|
|
4
|
+
currentDates.endDate = undefined;
|
|
5
|
+
return currentDates;
|
|
6
|
+
}
|
|
7
|
+
// If selected already, second click action is to remove selection.
|
|
8
|
+
if (currentDates.startDate && currentDates.startDate === selectedDate) {
|
|
9
|
+
currentDates.startDate = undefined;
|
|
10
|
+
return currentDates;
|
|
11
|
+
}
|
|
12
|
+
// Nothing is selected, set start date.
|
|
13
|
+
if (!currentDates.startDate) {
|
|
14
|
+
currentDates.startDate = selectedDate;
|
|
15
|
+
}
|
|
16
|
+
// If start date is already there, apply range by setting end date.
|
|
17
|
+
else if (!currentDates.endDate) {
|
|
18
|
+
// If newly selected date earlier swap with start date..
|
|
19
|
+
if (selectedDate < currentDates.startDate) {
|
|
20
|
+
currentDates.endDate = currentDates.startDate;
|
|
21
|
+
currentDates.startDate = selectedDate;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
currentDates.endDate = selectedDate;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// If both exists, rearrange the range based on the selected date.
|
|
28
|
+
else {
|
|
29
|
+
// If newly selected date is smaller than start date, reset start date to selected date.
|
|
30
|
+
if (selectedDate < currentDates.startDate) {
|
|
31
|
+
currentDates.startDate = selectedDate;
|
|
32
|
+
}
|
|
33
|
+
// If newly selected date is bigger than start date, extend the range.
|
|
34
|
+
else {
|
|
35
|
+
currentDates.endDate = selectedDate;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return currentDates;
|
|
39
|
+
}
|
|
40
|
+
export function generateDaysOfTheMonthFromDate(date) {
|
|
41
|
+
const dateInstance = new Date(date);
|
|
42
|
+
// Get year and month for active date.
|
|
43
|
+
const year = dateInstance.getFullYear();
|
|
44
|
+
const month = dateInstance.getMonth();
|
|
45
|
+
// Get first day, last day and total number of days of active month.
|
|
46
|
+
const firstDayOfMonth = new Date(year, month, 1);
|
|
47
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
48
|
+
// Get day of the week for first day of the month and remove 1 for 0 indexed array.
|
|
49
|
+
let startDayOfWeek = firstDayOfMonth.getDay() - 1;
|
|
50
|
+
// If day of the week is Sunday index will be -1 because Sunday's index is 0.
|
|
51
|
+
// Our array has 6 as Sunday so we "roll over".
|
|
52
|
+
if (startDayOfWeek === -1) {
|
|
53
|
+
startDayOfWeek = 6; // Sunday
|
|
54
|
+
}
|
|
55
|
+
const days = [];
|
|
56
|
+
// Get last day of the previous month.
|
|
57
|
+
// Date constructors 'date' parameter starts from 1 so if we give 0 we go last day of previous month.
|
|
58
|
+
const prevMonthLastDay = new Date(year, month, 0).getDate();
|
|
59
|
+
// Go to previous month's first day.
|
|
60
|
+
const prevMonth = new Date(year, month - 1, 1);
|
|
61
|
+
// Add rolling over days of the last month to current array which will be used to render the current month's grid.
|
|
62
|
+
// This is reversed because it adds rollover days by subtracting it one by one.
|
|
63
|
+
// If start day of the week is Wednesday then it is equal to 4, basically adding 28th, 29th, 30th and 31st to first row as rolling over days.
|
|
64
|
+
for (let i = startDayOfWeek; i > 0; i--) {
|
|
65
|
+
const day = prevMonthLastDay - i + 1;
|
|
66
|
+
days.push(new Date(prevMonth.getFullYear(), prevMonth.getMonth(), day).toISOString());
|
|
67
|
+
}
|
|
68
|
+
// Adding days of the current month on top of rolled over days from last month.
|
|
69
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
70
|
+
days.push(new Date(year, month, i).toISOString());
|
|
71
|
+
}
|
|
72
|
+
// Adding rolling back days of the next month to current grid if month is not ending at Sunday.
|
|
73
|
+
const remainingDays = (startDayOfWeek + daysInMonth > 35 ? 42 : 35) - days.length; // 42 cells for a 6x7 grid
|
|
74
|
+
const nextMonth = new Date(year, month + 1, 1);
|
|
75
|
+
for (let i = 1; i <= remainingDays; i++) {
|
|
76
|
+
days.push(new Date(nextMonth.getFullYear(), nextMonth.getMonth(), i).toISOString());
|
|
77
|
+
}
|
|
78
|
+
return days;
|
|
79
|
+
}
|
|
80
|
+
export function isBetweenDateRange(selectedDate, startDate, endDate) {
|
|
81
|
+
if (!startDate || !endDate) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const startDateObj = new Date(startDate);
|
|
85
|
+
const endDateObj = new Date(endDate);
|
|
86
|
+
const selectedDateObj = new Date(selectedDate);
|
|
87
|
+
// Normalize all dates to midnight to compare only the date part.
|
|
88
|
+
const start = new Date(startDateObj.getFullYear(), startDateObj.getMonth(), startDateObj.getDate());
|
|
89
|
+
const end = new Date(endDateObj.getFullYear(), endDateObj.getMonth(), endDateObj.getDate());
|
|
90
|
+
const current = new Date(selectedDateObj.getFullYear(), selectedDateObj.getMonth(), selectedDateObj.getDate());
|
|
91
|
+
// Determine the actual earlier and later dates to handle incorrect order.
|
|
92
|
+
const earlierDate = start < end ? start : end;
|
|
93
|
+
const laterDate = start < end ? end : start;
|
|
94
|
+
// Perform the check to see if the current date is within the range .
|
|
95
|
+
return current > earlierDate && current < laterDate;
|
|
96
|
+
}
|
|
97
|
+
export function generateCalendarCellStyles(currentDate, cellDate, startDate, endDate, hideRollingDays = false) {
|
|
98
|
+
const styles = ['fluid-calendar-cell'];
|
|
99
|
+
if (new Date(currentDate).getMonth() !== new Date(cellDate).getMonth()) {
|
|
100
|
+
styles.push('fluid-calendar-cell-rolling-day');
|
|
101
|
+
if (hideRollingDays) {
|
|
102
|
+
styles.push('invisible');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (startDate === cellDate || endDate === cellDate) {
|
|
106
|
+
styles.push('fluid-calendar-cell-selected');
|
|
107
|
+
}
|
|
108
|
+
if (isBetweenDateRange(cellDate, startDate, endDate)) {
|
|
109
|
+
styles.push('fluid-calendar-cell-in-range');
|
|
110
|
+
}
|
|
111
|
+
return styles.join(' ');
|
|
112
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare function generateCropAreaState(shape?: 'circle' | 'rectangle', aspectRatio?: {
|
|
2
|
+
w: number;
|
|
3
|
+
h: number;
|
|
4
|
+
}): {
|
|
5
|
+
cropArea: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
shape: "circle" | "rectangle";
|
|
12
|
+
aspectRatio: {
|
|
13
|
+
w: number;
|
|
14
|
+
h: number;
|
|
15
|
+
};
|
|
16
|
+
activeAction: string;
|
|
17
|
+
lastMousePosition: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare function draw(canvasElement: HTMLCanvasElement, image: HTMLImageElement, cropAreaState: ReturnType<typeof generateCropAreaState>): void;
|
|
23
|
+
export declare function handleMouseDown(event: PointerEvent | MouseEvent, cropAreaState: ReturnType<typeof generateCropAreaState>, canvasElement?: HTMLCanvasElement): void;
|
|
24
|
+
export declare function handleMouseMove(event: PointerEvent | MouseEvent, cropAreaState: ReturnType<typeof generateCropAreaState>, canvasElement?: HTMLCanvasElement): void;
|
|
25
|
+
export declare function handleMouseUp(cropAreaState: ReturnType<typeof generateCropAreaState>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Export the currently selected crop as a PNG Blob.
|
|
28
|
+
* - If shape === 'rectangle' exports the rectangular region.
|
|
29
|
+
* - If shape === 'circle' exports a square canvas with a circular alpha mask (transparent outside circle).
|
|
30
|
+
*
|
|
31
|
+
* Returns Promise<Blob | null>.
|
|
32
|
+
*/
|
|
33
|
+
export declare function exportSelectionAsPNG(canvasElement: HTMLCanvasElement, image: HTMLImageElement, cropAreaState: ReturnType<typeof generateCropAreaState>): Promise<Blob | null>;
|