svelora 3.0.7 → 3.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelora",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "Modern primitive-based UI component library for Svelte 5",
5
5
  "packageManager": "bun@1.3.14",
6
6
  "author": "asphum",
@@ -126,7 +126,8 @@
126
126
  "tiptap-markdown": "^0.9.0",
127
127
  "valibot": "^1.0.0",
128
128
  "yup": "^1.7.0",
129
- "zod": "^3.24.0 || ^4.0.0"
129
+ "zod": "^3.24.0 || ^4.0.0",
130
+ "mode-watcher": "^1.1.0"
130
131
  },
131
132
  "peerDependenciesMeta": {
132
133
  "@tiptap/core": {
@@ -259,16 +260,14 @@
259
260
  "@internationalized/date": "^3.12.2",
260
261
  "@modelcontextprotocol/sdk": "^1.29.0",
261
262
  "@standard-schema/spec": "^1.1.0",
263
+ "apexcharts": "^5.15.2",
262
264
  "bits-ui": "^2.18.1",
263
- "chart.js": "^4.5.1",
264
265
  "embla-carousel": "9.0.0-rc02",
265
266
  "embla-carousel-autoplay": "9.0.0-rc02",
266
267
  "embla-carousel-class-names": "9.0.0-rc02",
267
268
  "embla-carousel-fade": "9.0.0-rc02",
268
269
  "embla-carousel-svelte": "9.0.0-rc02",
269
- "mode-watcher": "^1.1.0",
270
270
  "shiki": "^4.3.0",
271
- "svelte-chartjs": "^4.0.1",
272
271
  "svelte-sonner": "^1.1.1",
273
272
  "tailwind-merge": "^3.6.0",
274
273
  "tailwind-variants": "^3.2.2",
@@ -1,3 +0,0 @@
1
- import { type VariantProps } from 'tailwind-variants';
2
- export declare const chartVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "w-full h-full relative", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "w-full h-full relative", unknown, unknown, undefined>>;
3
- export type ChartVariantProps = VariantProps<typeof chartVariants>;
@@ -1,4 +0,0 @@
1
- import { tv } from 'tailwind-variants';
2
- export const chartVariants = tv({
3
- base: 'w-full h-full relative'
4
- });
@@ -1,134 +0,0 @@
1
- <script lang="ts">import { twMerge } from "tailwind-merge";
2
- import Icon from "../Icon/Icon.svelte";
3
- import { menuVariants } from "./menu.variants.js";
4
- let { items = [], variant = "default", accordion = false, autoActive = false, class: className, children } = $props();
5
- let styles = $derived(menuVariants({ variant }));
6
- // Track open state for groups
7
- let openGroupLabel = $state(null);
8
- let openGroups = $state(new Set());
9
- // Initialize open groups based on prop
10
- $effect(() => {
11
- if (!accordion) {
12
- items.forEach((item) => {
13
- if (item.type === "group" && item.open && item.label) {
14
- openGroups.add(item.label);
15
- }
16
- });
17
- openGroups = new Set(openGroups);
18
- }
19
- });
20
- function handleGroupToggle(groupItem) {
21
- if (accordion) {
22
- if (openGroupLabel === groupItem.label) {
23
- openGroupLabel = null;
24
- } else {
25
- openGroupLabel = groupItem.label || null;
26
- }
27
- } else {
28
- toggleGroup(groupItem);
29
- }
30
- }
31
- function toggleGroup(groupItem) {
32
- if (!groupItem.label) return;
33
- if (openGroups.has(groupItem.label)) {
34
- openGroups.delete(groupItem.label);
35
- } else {
36
- openGroups.add(groupItem.label);
37
- }
38
- openGroups = new Set(openGroups);
39
- }
40
- function isGroupOpen(groupItem) {
41
- if (accordion) {
42
- return openGroupLabel === groupItem.label;
43
- }
44
- if (!groupItem.label) return false;
45
- return openGroups.has(groupItem.label);
46
- }
47
- // Auto active logic
48
- let currentPath = $state("");
49
- $effect(() => {
50
- if (autoActive && typeof window !== "undefined") {
51
- currentPath = window.location.pathname;
52
- // Optionally listen to popstate for SPA navigation if not using SvelteKit stores
53
- const onPopState = () => {
54
- currentPath = window.location.pathname;
55
- };
56
- window.addEventListener("popstate", onPopState);
57
- return () => window.removeEventListener("popstate", onPopState);
58
- }
59
- });
60
- function isActive(item) {
61
- if (item.active) return true;
62
- if (autoActive && item.type !== "group" && item.href) {
63
- return currentPath === item.href || currentPath.startsWith(item.href + "/");
64
- }
65
- return false;
66
- }
67
- </script>
68
-
69
- {#snippet renderActionItem(item: MenuItemType)}
70
- <li>
71
- <!-- svelte-ignore a11y_no_static_element_interactions -->
72
- <svelte:element
73
- this={item.type !== 'group' && item.href ? 'a' : 'button'}
74
- href={item.type !== 'group' ? item.href : undefined}
75
- type={item.type !== 'group' && !item.href ? 'button' : undefined}
76
- target={item.type !== 'group' ? item.target : undefined}
77
- class={twMerge(styles.item(), isActive(item) ? styles.itemActive() : '', item.class)}
78
- disabled={item.disabled}
79
- onclick={item.type !== 'group' ? item.onClick : undefined}
80
- >
81
- {#if item.icon}
82
- <Icon name={item.icon} class={styles.icon()} />
83
- {/if}
84
- <span class="truncate">{item.label}</span>
85
- </svelte:element>
86
- </li>
87
- {/snippet}
88
-
89
- {#snippet renderGroupItem(item: MenuGroupItem)}
90
- <li class={styles.group()}>
91
- <button
92
- type="button"
93
- class={twMerge(styles.groupTrigger(), isGroupOpen(item) ? styles.groupTriggerActive() : '', item.class)}
94
- disabled={item.disabled}
95
- onclick={() => handleGroupToggle(item)}
96
- >
97
- <div class="flex items-center truncate">
98
- {#if item.icon}
99
- <Icon name={item.icon} class={styles.icon()} />
100
- {/if}
101
- <span class="truncate">{item.label}</span>
102
- </div>
103
- <Icon
104
- name="lucide:chevron-down"
105
- class={twMerge(styles.chevron(), isGroupOpen(item) ? 'rotate-180' : '')}
106
- />
107
- </button>
108
- {#if isGroupOpen(item)}
109
- <ul class={styles.groupContent()}>
110
- {#each item.items as subItem}
111
- {#if subItem.type === 'group'}
112
- {@render renderGroupItem(subItem)}
113
- {:else}
114
- {@render renderActionItem(subItem)}
115
- {/if}
116
- {/each}
117
- </ul>
118
- {/if}
119
- </li>
120
- {/snippet}
121
-
122
- <ul class={twMerge(styles.base(), className)}>
123
- {#if children}
124
- {@render children()}
125
- {:else}
126
- {#each items as item}
127
- {#if item.type === 'group'}
128
- {@render renderGroupItem(item)}
129
- {:else}
130
- {@render renderActionItem(item)}
131
- {/if}
132
- {/each}
133
- {/if}
134
- </ul>
@@ -1,4 +0,0 @@
1
- import type { MenuProps } from './menu.types.js';
2
- declare const Menu: import("svelte").Component<MenuProps, {}, "">;
3
- type Menu = ReturnType<typeof Menu>;
4
- export default Menu;
@@ -1,4 +0,0 @@
1
- import Menu from './Menu.svelte';
2
- export { Menu };
3
- export * from './menu.types.js';
4
- export * from './menu.variants.js';
@@ -1,4 +0,0 @@
1
- import Menu from './Menu.svelte';
2
- export { Menu };
3
- export * from './menu.types.js';
4
- export * from './menu.variants.js';
@@ -1,82 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- import type { MenuVariantProps } from './menu.variants.js';
4
- export interface MenuItemBase {
5
- /**
6
- * Text to display in the menu item.
7
- */
8
- label?: string;
9
- /**
10
- * Icon to display before the label.
11
- */
12
- icon?: string;
13
- /**
14
- * Whether the menu item is disabled.
15
- */
16
- disabled?: boolean;
17
- /**
18
- * Whether the menu item is active/selected.
19
- */
20
- active?: boolean;
21
- /**
22
- * Additional CSS classes.
23
- */
24
- class?: ClassNameValue;
25
- }
26
- export interface MenuActionItem extends MenuItemBase {
27
- type?: 'action' | 'item';
28
- /**
29
- * The URL to navigate to when the item is clicked.
30
- */
31
- href?: string;
32
- /**
33
- * Click handler for the item.
34
- */
35
- onClick?: (event: MouseEvent) => void;
36
- /**
37
- * Target attribute for link items.
38
- */
39
- target?: string;
40
- }
41
- export interface MenuGroupItem extends MenuItemBase {
42
- type: 'group';
43
- /**
44
- * Child items to display when the group is expanded.
45
- */
46
- items: MenuItems;
47
- /**
48
- * Whether the group is currently open/expanded.
49
- */
50
- open?: boolean;
51
- }
52
- export type MenuItemType = MenuActionItem | MenuGroupItem;
53
- export type MenuItems = MenuItemType[];
54
- export interface MenuProps {
55
- /**
56
- * The array of menu items to render.
57
- */
58
- items?: MenuItems;
59
- /**
60
- * Style variant of the menu.
61
- */
62
- variant?: MenuVariantProps['variant'];
63
- /**
64
- * Whether the menu allows multiple groups to be open at once (false)
65
- * or acts as an accordion, closing other groups when one opens (true).
66
- * @default false
67
- */
68
- accordion?: boolean;
69
- /**
70
- * Auto-detect active state from current URL if using SvelteKit.
71
- * @default false
72
- */
73
- autoActive?: boolean;
74
- /**
75
- * Additional CSS classes.
76
- */
77
- class?: ClassNameValue;
78
- /**
79
- * Custom slot for completely custom rendering of items.
80
- */
81
- children?: Snippet;
82
- }
@@ -1,46 +0,0 @@
1
- import { type VariantProps } from 'tailwind-variants';
2
- export declare const menuVariants: import("tailwind-variants").TVReturnType<{
3
- variant: {
4
- default: {};
5
- };
6
- }, {
7
- base: string;
8
- group: string;
9
- groupTrigger: string[];
10
- groupTriggerActive: string;
11
- groupContent: string;
12
- item: string[];
13
- itemActive: string;
14
- icon: string;
15
- chevron: string;
16
- }, undefined, {
17
- variant: {
18
- default: {};
19
- };
20
- }, {
21
- base: string;
22
- group: string;
23
- groupTrigger: string[];
24
- groupTriggerActive: string;
25
- groupContent: string;
26
- item: string[];
27
- itemActive: string;
28
- icon: string;
29
- chevron: string;
30
- }, import("tailwind-variants").TVReturnType<{
31
- variant: {
32
- default: {};
33
- };
34
- }, {
35
- base: string;
36
- group: string;
37
- groupTrigger: string[];
38
- groupTriggerActive: string;
39
- groupContent: string;
40
- item: string[];
41
- itemActive: string;
42
- icon: string;
43
- chevron: string;
44
- }, undefined, unknown, unknown, undefined>>;
45
- export type MenuVariantProps = VariantProps<typeof menuVariants>;
46
- export type MenuSlots = keyof typeof menuVariants.slots;
@@ -1,32 +0,0 @@
1
- import { tv } from 'tailwind-variants';
2
- export const menuVariants = tv({
3
- slots: {
4
- base: 'flex flex-col gap-1 w-full',
5
- group: 'flex flex-col w-full',
6
- groupTrigger: [
7
- 'flex items-center justify-between w-full px-3 py-2 text-sm font-medium rounded-md',
8
- 'transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-outline',
9
- 'text-on-surface hover:bg-surface-container-highest',
10
- 'disabled:opacity-50 disabled:cursor-not-allowed'
11
- ],
12
- groupTriggerActive: 'bg-primary-container text-on-primary-container',
13
- groupContent: 'flex flex-col gap-1 pl-4 mt-1',
14
- item: [
15
- 'flex items-center w-full px-3 py-2 text-sm font-medium rounded-md',
16
- 'transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-outline',
17
- 'text-on-surface hover:bg-surface-container-highest',
18
- 'disabled:opacity-50 disabled:cursor-not-allowed'
19
- ],
20
- itemActive: 'bg-primary-container text-on-primary-container hover:bg-primary-container/90',
21
- icon: 'size-5 mr-3 shrink-0',
22
- chevron: 'size-4 shrink-0 transition-transform duration-200'
23
- },
24
- variants: {
25
- variant: {
26
- default: {}
27
- }
28
- },
29
- defaultVariants: {
30
- variant: 'default'
31
- }
32
- });