yaxa-svelte 2.0.4 → 2.1.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/README.md +4 -2
- package/dist/components/blocks/FAQ.svelte.d.ts +1 -1
- package/dist/components/blocks/FeatureGrid.svelte.d.ts +1 -1
- package/dist/components/blocks/Testimonials.svelte.d.ts +1 -1
- package/dist/components/elements/Avatar.svelte.d.ts +7 -25
- package/dist/components/elements/Badge.svelte.d.ts +15 -57
- package/dist/components/elements/Button.svelte.d.ts +19 -77
- package/dist/components/elements/Carousel.svelte.d.ts +2 -54
- package/dist/components/elements/CodeBlock.svelte +237 -8
- package/dist/components/elements/CodeBlock.test.js +227 -0
- package/dist/components/elements/CodeDiff.svelte +14 -0
- package/dist/components/elements/CodeDiff.test.js +16 -0
- package/dist/components/elements/EmptyState.svelte.d.ts +6 -26
- package/dist/components/elements/Icon.svelte.d.ts +6 -22
- package/dist/components/elements/Kbd.svelte.d.ts +5 -19
- package/dist/components/elements/Progress.svelte.d.ts +9 -35
- package/dist/components/elements/Skeleton.svelte.d.ts +8 -32
- package/dist/components/elements/Terminal.svelte.d.ts +1 -1
- package/dist/components/elements/Timeline.svelte.d.ts +4 -16
- package/dist/components/elements/Tree.svelte.d.ts +3 -13
- package/dist/components/elements/VirtualList.svelte.d.ts +3 -13
- package/dist/components/forms/Combobox.svelte.d.ts +7 -29
- package/dist/components/forms/Input.svelte.d.ts +9 -35
- package/dist/components/forms/MultiSelect.svelte.d.ts +7 -29
- package/dist/components/forms/NumberInput.svelte.d.ts +7 -29
- package/dist/components/forms/Select.svelte.d.ts +7 -29
- package/dist/components/forms/Switch.svelte.d.ts +8 -32
- package/dist/components/forms/Textarea.svelte.d.ts +11 -45
- package/dist/components/layout/Card.svelte.d.ts +10 -42
- package/dist/components/layout/Container.svelte.d.ts +7 -25
- package/dist/components/layout/DashboardShell.svelte.d.ts +1 -31
- package/dist/components/layout/ResizablePanels.svelte.d.ts +1 -35
- package/dist/components/navigation/CommandPalette.dom.test.d.ts +1 -0
- package/dist/components/navigation/CommandPalette.dom.test.js +76 -0
- package/dist/components/navigation/Stepper.svelte.d.ts +3 -13
- package/dist/components/overlays/Alert.svelte.d.ts +5 -19
- package/dist/components/overlays/Drawer.svelte.d.ts +3 -13
- package/dist/components/overlays/Modal.svelte.d.ts +6 -22
- package/dist/components/overlays/NotificationCenter.svelte.d.ts +1 -1
- package/dist/components/overlays/Slideover.svelte.d.ts +5 -19
- package/dist/components/overlays/Toast.svelte.d.ts +12 -44
- package/dist/components/saas/OrgSwitcher.svelte.d.ts +1 -1
- package/dist/components/saas/PasskeyUI.svelte.d.ts +1 -1
- package/dist/server/polar/index.d.ts +2 -1
- package/dist/server/polar/index.js +9 -8
- package/dist/server/polar/webhook.js +14 -11
- package/dist/server/polar/webhook.test.js +81 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +12 -1
- package/dist/utils/cn.d.ts +2 -2
- package/package.json +11 -13
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ _Nuxt UI v4 & Nuxt UI Pro Equivalent for SvelteKit 2 & 3 & Svelte 5 with Built-i
|
|
|
12
12
|
[](https://tailwindcss.com)
|
|
13
13
|
[](https://bits-ui.com)
|
|
14
14
|
[](LICENSE)
|
|
15
|
+
[](SECURITY.md)
|
|
16
|
+
[](CONTRIBUTING.md)
|
|
15
17
|
|
|
16
18
|
[**Live Documentation & Playground →**](https://yaxa.vercel.app)
|
|
17
19
|
|
|
@@ -293,12 +295,12 @@ theme.setAccent('sky'); // Sky Cyan (#0ea5e9)
|
|
|
293
295
|
|
|
294
296
|
## 🤝 Contributing
|
|
295
297
|
|
|
296
|
-
Contributions are always welcome!
|
|
298
|
+
Contributions are always welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) and [Security Policy](SECURITY.md) before submitting pull requests.
|
|
297
299
|
|
|
298
300
|
1. Fork the repository: `git clone https://github.com/FuntionalFrost/yaxa.git`
|
|
299
301
|
2. Install dependencies: `pnpm install`
|
|
300
302
|
3. Start development server: `pnpm dev`
|
|
301
|
-
4. Run
|
|
303
|
+
4. Run verification gates: `pnpm lint && pnpm check && pnpm test && pnpm build`
|
|
302
304
|
|
|
303
305
|
---
|
|
304
306
|
|
|
@@ -5,7 +5,7 @@ export interface FAQItem {
|
|
|
5
5
|
answer: string;
|
|
6
6
|
category?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const faqVariants: import("tailwind-variants").TVReturnType<{}
|
|
8
|
+
export declare const faqVariants: import("tailwind-variants").TVReturnType<{}, undefined, "w-full py-12 max-w-3xl mx-auto", undefined, undefined, undefined>;
|
|
9
9
|
export type FAQProps = VariantProps<typeof faqVariants> & {
|
|
10
10
|
title?: string;
|
|
11
11
|
description?: string;
|
|
@@ -8,7 +8,7 @@ export interface FeatureItem {
|
|
|
8
8
|
tag?: string;
|
|
9
9
|
href?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const featureGridVariants: import("tailwind-variants").TVReturnType<{}
|
|
11
|
+
export declare const featureGridVariants: import("tailwind-variants").TVReturnType<{}, undefined, "w-full py-12", undefined, undefined, undefined>;
|
|
12
12
|
export type FeatureGridProps = VariantProps<typeof featureGridVariants> & {
|
|
13
13
|
title?: string;
|
|
14
14
|
description?: string;
|
|
@@ -8,7 +8,7 @@ export interface TestimonialItem {
|
|
|
8
8
|
avatar?: string;
|
|
9
9
|
rating?: number;
|
|
10
10
|
}
|
|
11
|
-
export declare const testimonialsVariants: import("tailwind-variants").TVReturnType<{}
|
|
11
|
+
export declare const testimonialsVariants: import("tailwind-variants").TVReturnType<{}, undefined, "w-full py-12", undefined, undefined, undefined>;
|
|
12
12
|
export type TestimonialsProps = VariantProps<typeof testimonialsVariants> & {
|
|
13
13
|
title?: string;
|
|
14
14
|
description?: string;
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
2
|
export declare const avatarVariants: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
size: {
|
|
4
|
-
xs:
|
|
5
|
-
sm:
|
|
6
|
-
md:
|
|
7
|
-
lg:
|
|
8
|
-
xl:
|
|
9
|
-
'2xl':
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
md: string;
|
|
7
|
+
lg: string;
|
|
8
|
+
xl: string;
|
|
9
|
+
'2xl': string;
|
|
10
10
|
};
|
|
11
|
-
}, undefined, "relative inline-flex shrink-0 items-center justify-center font-medium select-none overflow-hidden rounded-full bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",
|
|
12
|
-
size: {
|
|
13
|
-
xs: "h-6 w-6 text-[10px]";
|
|
14
|
-
sm: "h-8 w-8 text-xs";
|
|
15
|
-
md: "h-10 w-10 text-sm";
|
|
16
|
-
lg: "h-12 w-12 text-base";
|
|
17
|
-
xl: "h-14 w-14 text-lg";
|
|
18
|
-
'2xl': "h-16 w-16 text-xl";
|
|
19
|
-
};
|
|
20
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
21
|
-
size: {
|
|
22
|
-
xs: "h-6 w-6 text-[10px]";
|
|
23
|
-
sm: "h-8 w-8 text-xs";
|
|
24
|
-
md: "h-10 w-10 text-sm";
|
|
25
|
-
lg: "h-12 w-12 text-base";
|
|
26
|
-
xl: "h-14 w-14 text-lg";
|
|
27
|
-
'2xl': "h-16 w-16 text-xl";
|
|
28
|
-
};
|
|
29
|
-
}, undefined>>;
|
|
11
|
+
}, undefined, "relative inline-flex shrink-0 items-center justify-center font-medium select-none overflow-hidden rounded-full bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300", undefined, undefined, undefined>;
|
|
30
12
|
export type AvatarProps = VariantProps<typeof avatarVariants> & {
|
|
31
13
|
src?: string;
|
|
32
14
|
alt?: string;
|
|
@@ -3,68 +3,26 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { IconSource } from './Icon.svelte';
|
|
4
4
|
export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
variant: {
|
|
6
|
-
solid:
|
|
7
|
-
outline:
|
|
8
|
-
soft:
|
|
9
|
-
subtle:
|
|
6
|
+
solid: string;
|
|
7
|
+
outline: string;
|
|
8
|
+
soft: string;
|
|
9
|
+
subtle: string;
|
|
10
10
|
};
|
|
11
11
|
color: {
|
|
12
|
-
primary:
|
|
13
|
-
neutral:
|
|
14
|
-
success:
|
|
15
|
-
warning:
|
|
16
|
-
error:
|
|
17
|
-
info:
|
|
12
|
+
primary: string;
|
|
13
|
+
neutral: string;
|
|
14
|
+
success: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
error: string;
|
|
17
|
+
info: string;
|
|
18
18
|
};
|
|
19
19
|
size: {
|
|
20
|
-
xs:
|
|
21
|
-
sm:
|
|
22
|
-
md:
|
|
23
|
-
lg:
|
|
20
|
+
xs: string;
|
|
21
|
+
sm: string;
|
|
22
|
+
md: string;
|
|
23
|
+
lg: string;
|
|
24
24
|
};
|
|
25
|
-
}, undefined, "inline-flex items-center font-medium select-none transition-colors duration-150",
|
|
26
|
-
variant: {
|
|
27
|
-
solid: "text-white";
|
|
28
|
-
outline: "border bg-transparent";
|
|
29
|
-
soft: "";
|
|
30
|
-
subtle: "border";
|
|
31
|
-
};
|
|
32
|
-
color: {
|
|
33
|
-
primary: "";
|
|
34
|
-
neutral: "";
|
|
35
|
-
success: "";
|
|
36
|
-
warning: "";
|
|
37
|
-
error: "";
|
|
38
|
-
info: "";
|
|
39
|
-
};
|
|
40
|
-
size: {
|
|
41
|
-
xs: "text-[10px] px-1.5 py-0.5 gap-1 rounded";
|
|
42
|
-
sm: "text-xs px-2.5 py-0.5 gap-1.5 rounded-md";
|
|
43
|
-
md: "text-xs px-2.5 py-1 gap-1.5 rounded-md";
|
|
44
|
-
lg: "text-sm px-3 py-1.5 gap-2 rounded-lg";
|
|
45
|
-
};
|
|
46
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
47
|
-
variant: {
|
|
48
|
-
solid: "text-white";
|
|
49
|
-
outline: "border bg-transparent";
|
|
50
|
-
soft: "";
|
|
51
|
-
subtle: "border";
|
|
52
|
-
};
|
|
53
|
-
color: {
|
|
54
|
-
primary: "";
|
|
55
|
-
neutral: "";
|
|
56
|
-
success: "";
|
|
57
|
-
warning: "";
|
|
58
|
-
error: "";
|
|
59
|
-
info: "";
|
|
60
|
-
};
|
|
61
|
-
size: {
|
|
62
|
-
xs: "text-[10px] px-1.5 py-0.5 gap-1 rounded";
|
|
63
|
-
sm: "text-xs px-2.5 py-0.5 gap-1.5 rounded-md";
|
|
64
|
-
md: "text-xs px-2.5 py-1 gap-1.5 rounded-md";
|
|
65
|
-
lg: "text-sm px-3 py-1.5 gap-2 rounded-lg";
|
|
66
|
-
};
|
|
67
|
-
}, undefined>>;
|
|
25
|
+
}, undefined, "inline-flex items-center font-medium select-none transition-colors duration-150", undefined, undefined, undefined>;
|
|
68
26
|
export type BadgeProps = VariantProps<typeof badgeVariants> & {
|
|
69
27
|
dot?: boolean;
|
|
70
28
|
icon?: IconSource;
|
|
@@ -3,92 +3,34 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { IconSource } from './Icon.svelte';
|
|
4
4
|
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
variant: {
|
|
6
|
-
solid:
|
|
7
|
-
outline:
|
|
8
|
-
soft:
|
|
9
|
-
subtle:
|
|
10
|
-
ghost:
|
|
11
|
-
link:
|
|
6
|
+
solid: string;
|
|
7
|
+
outline: string;
|
|
8
|
+
soft: string;
|
|
9
|
+
subtle: string;
|
|
10
|
+
ghost: string;
|
|
11
|
+
link: string;
|
|
12
12
|
};
|
|
13
13
|
color: {
|
|
14
|
-
primary:
|
|
15
|
-
neutral:
|
|
16
|
-
success:
|
|
17
|
-
warning:
|
|
18
|
-
error:
|
|
14
|
+
primary: string;
|
|
15
|
+
neutral: string;
|
|
16
|
+
success: string;
|
|
17
|
+
warning: string;
|
|
18
|
+
error: string;
|
|
19
19
|
};
|
|
20
20
|
size: {
|
|
21
|
-
xs:
|
|
22
|
-
sm:
|
|
23
|
-
md:
|
|
24
|
-
lg:
|
|
25
|
-
xl:
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
26
|
};
|
|
27
27
|
block: {
|
|
28
|
-
true:
|
|
28
|
+
true: string;
|
|
29
29
|
};
|
|
30
30
|
square: {
|
|
31
|
-
true:
|
|
31
|
+
true: string;
|
|
32
32
|
};
|
|
33
|
-
}, undefined, "inline-flex items-center justify-center font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 select-none active:scale-[0.98] whitespace-nowrap max-w-full overflow-hidden text-ellipsis shrink-0 [&>svg]:shrink-0",
|
|
34
|
-
variant: {
|
|
35
|
-
solid: "shadow-xs text-white";
|
|
36
|
-
outline: "border bg-transparent shadow-xs";
|
|
37
|
-
soft: "";
|
|
38
|
-
subtle: "border";
|
|
39
|
-
ghost: "bg-transparent";
|
|
40
|
-
link: "p-0 underline-offset-4 hover:underline";
|
|
41
|
-
};
|
|
42
|
-
color: {
|
|
43
|
-
primary: "";
|
|
44
|
-
neutral: "";
|
|
45
|
-
success: "";
|
|
46
|
-
warning: "";
|
|
47
|
-
error: "";
|
|
48
|
-
};
|
|
49
|
-
size: {
|
|
50
|
-
xs: "text-xs px-2 py-1 gap-1 rounded-md";
|
|
51
|
-
sm: "text-sm px-2.5 py-1.5 gap-1.5 rounded-md";
|
|
52
|
-
md: "text-sm px-3.5 py-2 gap-2 rounded-lg";
|
|
53
|
-
lg: "text-base px-4 py-2.5 gap-2 rounded-lg";
|
|
54
|
-
xl: "text-base px-5 py-3 gap-2.5 rounded-xl";
|
|
55
|
-
};
|
|
56
|
-
block: {
|
|
57
|
-
true: "w-full";
|
|
58
|
-
};
|
|
59
|
-
square: {
|
|
60
|
-
true: "aspect-square p-0";
|
|
61
|
-
};
|
|
62
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
63
|
-
variant: {
|
|
64
|
-
solid: "shadow-xs text-white";
|
|
65
|
-
outline: "border bg-transparent shadow-xs";
|
|
66
|
-
soft: "";
|
|
67
|
-
subtle: "border";
|
|
68
|
-
ghost: "bg-transparent";
|
|
69
|
-
link: "p-0 underline-offset-4 hover:underline";
|
|
70
|
-
};
|
|
71
|
-
color: {
|
|
72
|
-
primary: "";
|
|
73
|
-
neutral: "";
|
|
74
|
-
success: "";
|
|
75
|
-
warning: "";
|
|
76
|
-
error: "";
|
|
77
|
-
};
|
|
78
|
-
size: {
|
|
79
|
-
xs: "text-xs px-2 py-1 gap-1 rounded-md";
|
|
80
|
-
sm: "text-sm px-2.5 py-1.5 gap-1.5 rounded-md";
|
|
81
|
-
md: "text-sm px-3.5 py-2 gap-2 rounded-lg";
|
|
82
|
-
lg: "text-base px-4 py-2.5 gap-2 rounded-lg";
|
|
83
|
-
xl: "text-base px-5 py-3 gap-2.5 rounded-xl";
|
|
84
|
-
};
|
|
85
|
-
block: {
|
|
86
|
-
true: "w-full";
|
|
87
|
-
};
|
|
88
|
-
square: {
|
|
89
|
-
true: "aspect-square p-0";
|
|
90
|
-
};
|
|
91
|
-
}, undefined>>;
|
|
33
|
+
}, undefined, "inline-flex items-center justify-center font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 select-none active:scale-[0.98] whitespace-nowrap max-w-full overflow-hidden text-ellipsis shrink-0 [&>svg]:shrink-0", undefined, undefined, undefined>;
|
|
92
34
|
export type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
93
35
|
type?: 'button' | 'submit' | 'reset';
|
|
94
36
|
href?: string;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
export declare const carouselVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
-
[key: string]: {
|
|
5
|
-
[key: string]: import("tailwind-variants").ClassValue | {
|
|
6
|
-
viewport?: import("tailwind-variants").ClassValue;
|
|
7
|
-
root?: import("tailwind-variants").ClassValue;
|
|
8
|
-
slide?: import("tailwind-variants").ClassValue;
|
|
9
|
-
controls?: import("tailwind-variants").ClassValue;
|
|
10
|
-
arrowBtn?: import("tailwind-variants").ClassValue;
|
|
11
|
-
dots?: import("tailwind-variants").ClassValue;
|
|
12
|
-
dotBtn?: import("tailwind-variants").ClassValue;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
} | {
|
|
16
|
-
[x: string]: {
|
|
17
|
-
[x: string]: import("tailwind-variants").ClassValue | {
|
|
18
|
-
viewport?: import("tailwind-variants").ClassValue;
|
|
19
|
-
root?: import("tailwind-variants").ClassValue;
|
|
20
|
-
slide?: import("tailwind-variants").ClassValue;
|
|
21
|
-
controls?: import("tailwind-variants").ClassValue;
|
|
22
|
-
arrowBtn?: import("tailwind-variants").ClassValue;
|
|
23
|
-
dots?: import("tailwind-variants").ClassValue;
|
|
24
|
-
dotBtn?: import("tailwind-variants").ClassValue;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
} | {}, {
|
|
3
|
+
export declare const carouselVariants: import("tailwind-variants").TVReturnType<{}, {
|
|
28
4
|
root: string;
|
|
29
5
|
viewport: string;
|
|
30
6
|
slide: string;
|
|
@@ -32,35 +8,7 @@ export declare const carouselVariants: import("tailwind-variants").TVReturnType<
|
|
|
32
8
|
arrowBtn: string;
|
|
33
9
|
dots: string;
|
|
34
10
|
dotBtn: string;
|
|
35
|
-
}, undefined,
|
|
36
|
-
[key: string]: {
|
|
37
|
-
[key: string]: import("tailwind-variants").ClassValue | {
|
|
38
|
-
viewport?: import("tailwind-variants").ClassValue;
|
|
39
|
-
root?: import("tailwind-variants").ClassValue;
|
|
40
|
-
slide?: import("tailwind-variants").ClassValue;
|
|
41
|
-
controls?: import("tailwind-variants").ClassValue;
|
|
42
|
-
arrowBtn?: import("tailwind-variants").ClassValue;
|
|
43
|
-
dots?: import("tailwind-variants").ClassValue;
|
|
44
|
-
dotBtn?: import("tailwind-variants").ClassValue;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
} | {}, {
|
|
48
|
-
root: string;
|
|
49
|
-
viewport: string;
|
|
50
|
-
slide: string;
|
|
51
|
-
controls: string;
|
|
52
|
-
arrowBtn: string;
|
|
53
|
-
dots: string;
|
|
54
|
-
dotBtn: string;
|
|
55
|
-
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
56
|
-
root: string;
|
|
57
|
-
viewport: string;
|
|
58
|
-
slide: string;
|
|
59
|
-
controls: string;
|
|
60
|
-
arrowBtn: string;
|
|
61
|
-
dots: string;
|
|
62
|
-
dotBtn: string;
|
|
63
|
-
}>>;
|
|
11
|
+
}, undefined, undefined, undefined, undefined>;
|
|
64
12
|
export type CarouselProps<T> = VariantProps<typeof carouselVariants> & {
|
|
65
13
|
items: T[];
|
|
66
14
|
currentIndex?: number;
|
|
@@ -46,10 +46,15 @@
|
|
|
46
46
|
const isSvelte = ['svelte', 'svelte5', 'sv'].includes(lang);
|
|
47
47
|
const isHtml = ['html', 'xml', 'svg'].includes(lang);
|
|
48
48
|
const isPython = ['python', 'py'].includes(lang);
|
|
49
|
-
const
|
|
49
|
+
const isRust = ['rust', 'rs'].includes(lang);
|
|
50
|
+
const isGo = ['go', 'golang'].includes(lang);
|
|
51
|
+
const isSql = ['sql', 'pgsql', 'postgres', 'postgresql', 'mysql', 'sqlite'].includes(lang);
|
|
52
|
+
const isGraphQL = ['graphql', 'gql'].includes(lang);
|
|
50
53
|
const isBash = ['bash', 'sh', 'zsh', 'shell'].includes(lang);
|
|
51
54
|
const isJson = ['json', 'jsonc', 'json5'].includes(lang);
|
|
52
55
|
const isCss = ['css', 'scss', 'postcss', 'tailwind', 'tailwindcss'].includes(lang);
|
|
56
|
+
const isYaml = ['yaml', 'yml'].includes(lang);
|
|
57
|
+
const isToml = ['toml', 'cargo'].includes(lang);
|
|
53
58
|
|
|
54
59
|
let multilineState:
|
|
55
60
|
| null
|
|
@@ -179,7 +184,7 @@
|
|
|
179
184
|
|
|
180
185
|
if (
|
|
181
186
|
(!isLatex && remaining.startsWith('//')) ||
|
|
182
|
-
((isPython || isBash || lang === 'env' ||
|
|
187
|
+
((isPython || isBash || lang === 'env' || isYaml || isToml || isGraphQL) &&
|
|
183
188
|
remaining.startsWith('#')) ||
|
|
184
189
|
(isLatex && remaining.startsWith('%')) ||
|
|
185
190
|
(isSql && remaining.startsWith('--'))
|
|
@@ -188,8 +193,8 @@
|
|
|
188
193
|
break;
|
|
189
194
|
}
|
|
190
195
|
|
|
191
|
-
// 2. Python Triple-Quoted Strings (Docstrings)
|
|
192
|
-
if (isPython && (remaining.startsWith('"""') || remaining.startsWith("'''"))) {
|
|
196
|
+
// 2. Python & TOML Triple-Quoted Strings (Docstrings / Multiline)
|
|
197
|
+
if ((isPython || isToml) && (remaining.startsWith('"""') || remaining.startsWith("'''"))) {
|
|
193
198
|
const delim = remaining.startsWith('"""') ? '"""' : "'''";
|
|
194
199
|
const closeIdx = remaining.indexOf(delim, 3);
|
|
195
200
|
if (closeIdx !== -1) {
|
|
@@ -228,6 +233,110 @@
|
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
235
|
|
|
236
|
+
// 4b. YAML Key-Value Pairs, Anchors, Aliases & Directives
|
|
237
|
+
if (isYaml) {
|
|
238
|
+
// Anchors & Aliases (&anchor, *alias)
|
|
239
|
+
const anchorMatch = remaining.match(/^([&*][\w.-]+)/);
|
|
240
|
+
if (anchorMatch) {
|
|
241
|
+
tokens.push({ text: anchorMatch[0], type: 'macro' });
|
|
242
|
+
remaining = remaining.slice(anchorMatch[0].length);
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Tags (!!str, !!int, !!map, !custom)
|
|
247
|
+
const yamlTagMatch = remaining.match(/^(!{1,2}[\w.-]+)/);
|
|
248
|
+
if (yamlTagMatch) {
|
|
249
|
+
tokens.push({ text: yamlTagMatch[0], type: 'directive' });
|
|
250
|
+
remaining = remaining.slice(yamlTagMatch[0].length);
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Document start/end markers (--- or ...)
|
|
255
|
+
if (remaining === line) {
|
|
256
|
+
const docMarkerMatch = remaining.match(/^(\s*(?:---|(?:\.\.\.))\s*)$/);
|
|
257
|
+
if (docMarkerMatch) {
|
|
258
|
+
tokens.push({ text: docMarkerMatch[1], type: 'punctuation' });
|
|
259
|
+
remaining = remaining.slice(docMarkerMatch[1].length);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Quoted keys before ':'
|
|
265
|
+
const yamlQuotedKeyMatch = remaining.match(
|
|
266
|
+
/^("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=\s*:(?:\s|$))/
|
|
267
|
+
);
|
|
268
|
+
if (yamlQuotedKeyMatch) {
|
|
269
|
+
tokens.push({ text: yamlQuotedKeyMatch[1], type: 'attr' });
|
|
270
|
+
remaining = remaining.slice(yamlQuotedKeyMatch[1].length);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Bare keys before ':'
|
|
275
|
+
const yamlKeyMatch = remaining.match(/^([\w.-]+)(?=\s*:(?:\s|$))/);
|
|
276
|
+
if (yamlKeyMatch) {
|
|
277
|
+
tokens.push({ text: yamlKeyMatch[0], type: 'attr' });
|
|
278
|
+
remaining = remaining.slice(yamlKeyMatch[0].length);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// YAML booleans, nulls & block scalar indicators
|
|
283
|
+
const yamlKwMatch = remaining.match(/^(true|false|yes|no|on|off|null|~|[|>][+-]?)\b/i);
|
|
284
|
+
if (yamlKwMatch) {
|
|
285
|
+
tokens.push({ text: yamlKwMatch[0], type: 'keyword' });
|
|
286
|
+
remaining = remaining.slice(yamlKwMatch[0].length);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 4c. TOML Table Headers & Key-Value Pairs
|
|
292
|
+
if (isToml) {
|
|
293
|
+
// Table headers ([table] or [[array_of_tables]])
|
|
294
|
+
const tomlTableMatch = remaining.match(/^(\[\[?[\w.:"-]+\]\]?)/);
|
|
295
|
+
if (tomlTableMatch) {
|
|
296
|
+
tokens.push({ text: tomlTableMatch[0], type: 'directive' });
|
|
297
|
+
remaining = remaining.slice(tomlTableMatch[0].length);
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Quoted keys before '='
|
|
302
|
+
const tomlQuotedKeyMatch = remaining.match(
|
|
303
|
+
/^("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=\s*=)/
|
|
304
|
+
);
|
|
305
|
+
if (tomlQuotedKeyMatch) {
|
|
306
|
+
tokens.push({ text: tomlQuotedKeyMatch[1], type: 'attr' });
|
|
307
|
+
remaining = remaining.slice(tomlQuotedKeyMatch[1].length);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Bare or dotted keys before '='
|
|
312
|
+
const tomlKeyMatch = remaining.match(/^([\w.-]+)(?=\s*=)/);
|
|
313
|
+
if (tomlKeyMatch) {
|
|
314
|
+
tokens.push({ text: tomlKeyMatch[0], type: 'attr' });
|
|
315
|
+
remaining = remaining.slice(tomlKeyMatch[0].length);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Special TOML float constants (+inf, -inf, nan)
|
|
320
|
+
const tomlFloatMatch = remaining.match(/^([+-]?(?:inf|nan))\b/i);
|
|
321
|
+
if (tomlFloatMatch) {
|
|
322
|
+
tokens.push({ text: tomlFloatMatch[0], type: 'number' });
|
|
323
|
+
remaining = remaining.slice(tomlFloatMatch[0].length);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// 4d. ISO Dates / Timestamps for YAML & TOML
|
|
329
|
+
if (isYaml || isToml) {
|
|
330
|
+
const dateMatch = remaining.match(
|
|
331
|
+
/^(\d{4}-\d{2}-\d{2}(?:[Tt\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})?)?|\d{2}:\d{2}:\d{2}(?:\.\d+)?)\b/
|
|
332
|
+
);
|
|
333
|
+
if (dateMatch) {
|
|
334
|
+
tokens.push({ text: dateMatch[0], type: 'number' });
|
|
335
|
+
remaining = remaining.slice(dateMatch[0].length);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
231
340
|
// 5. CSS & Tailwind CSS v4 At-Rules, Variables & Colors
|
|
232
341
|
if (isCss) {
|
|
233
342
|
// Tailwind v4 & CSS At-rules (@theme, @utility, @source, @plugin, @import, @custom-variant, etc.)
|
|
@@ -316,10 +425,10 @@
|
|
|
316
425
|
}
|
|
317
426
|
}
|
|
318
427
|
|
|
319
|
-
// 9. Python Built-in Types
|
|
428
|
+
// 9. Python Built-in Types & Modern Typing Constructs (Python 3.0 to 3.13+)
|
|
320
429
|
if (isPython) {
|
|
321
430
|
const pyTypeMatch = remaining.match(
|
|
322
|
-
/^(str|int|float|bool|dict|list|tuple|set|bytes|Any|Optional|Union|Callable|Literal)\b/
|
|
431
|
+
/^(str|int|float|bool|dict|list|tuple|set|bytes|Any|Optional|Union|Callable|Literal|TypeIs|TypeGuard|Self)\b/
|
|
323
432
|
);
|
|
324
433
|
if (pyTypeMatch) {
|
|
325
434
|
tokens.push({ text: pyTypeMatch[0], type: 'macro' });
|
|
@@ -340,6 +449,126 @@
|
|
|
340
449
|
}
|
|
341
450
|
}
|
|
342
451
|
|
|
452
|
+
// 10b. Rust Attributes, Macro Invocations, Lifetimes & Standard Types
|
|
453
|
+
if (isRust) {
|
|
454
|
+
// Rust Attributes (#[derive(Debug, Clone)], #![no_std])
|
|
455
|
+
const rustAttrMatch = remaining.match(/^#(!?\[[\w:,()=\s"-]+\])/);
|
|
456
|
+
if (rustAttrMatch) {
|
|
457
|
+
tokens.push({ text: rustAttrMatch[0], type: 'decorator' });
|
|
458
|
+
remaining = remaining.slice(rustAttrMatch[0].length);
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Rust Macro Invocations (println!, vec!, format!, panic!, etc.)
|
|
463
|
+
const rustMacroMatch = remaining.match(
|
|
464
|
+
/^(println|eprintln|print|eprint|format|vec|panic|assert|assert_eq|assert_ne|todo|unimplemented|unreachable|write|writeln|cfg|include|env|concat)!/
|
|
465
|
+
);
|
|
466
|
+
if (rustMacroMatch) {
|
|
467
|
+
tokens.push({ text: rustMacroMatch[0], type: 'macro' });
|
|
468
|
+
remaining = remaining.slice(rustMacroMatch[0].length);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Rust Lifetimes ('a, 'static)
|
|
473
|
+
const lifetimeMatch = remaining.match(/^'(?:static|[a-z_]\w*)(?!')\b/);
|
|
474
|
+
if (lifetimeMatch) {
|
|
475
|
+
tokens.push({ text: lifetimeMatch[0], type: 'macro' });
|
|
476
|
+
remaining = remaining.slice(lifetimeMatch[0].length);
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Rust Primitive & Standard Types
|
|
481
|
+
const rustTypeMatch = remaining.match(
|
|
482
|
+
/^(i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str|String|Option|Result|Vec|Box|Rc|Arc|Cell|RefCell|Mutex|RwLock|HashMap|HashSet|BTreeMap|BTreeSet|Self|None|Some|Ok|Err)\b/
|
|
483
|
+
);
|
|
484
|
+
if (rustTypeMatch) {
|
|
485
|
+
tokens.push({ text: rustTypeMatch[0], type: 'macro' });
|
|
486
|
+
remaining = remaining.slice(rustTypeMatch[0].length);
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// 10c. Go Primitive Types & Built-ins
|
|
492
|
+
if (isGo) {
|
|
493
|
+
const goTypeMatch = remaining.match(
|
|
494
|
+
/^(string|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|uintptr|byte|rune|float32|float64|complex64|complex128|error|any|bool)\b/
|
|
495
|
+
);
|
|
496
|
+
if (goTypeMatch) {
|
|
497
|
+
tokens.push({ text: goTypeMatch[0], type: 'macro' });
|
|
498
|
+
remaining = remaining.slice(goTypeMatch[0].length);
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
const goBuiltinMatch = remaining.match(
|
|
503
|
+
/^(make|len|cap|new|append|copy|close|delete|panic|recover|print|println|complex|real|imag)\b(?=\s*\()/
|
|
504
|
+
);
|
|
505
|
+
if (goBuiltinMatch) {
|
|
506
|
+
tokens.push({ text: goBuiltinMatch[0], type: 'function' });
|
|
507
|
+
remaining = remaining.slice(goBuiltinMatch[0].length);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// 10d. SQL Data Types & Clauses
|
|
513
|
+
if (isSql) {
|
|
514
|
+
// SQL Standard Data Types
|
|
515
|
+
const sqlTypeMatch = remaining.match(
|
|
516
|
+
/^(INTEGER|INT|BIGINT|SMALLINT|TINYINT|SERIAL|BIGSERIAL|VARCHAR|TEXT|CHAR|CHARACTER|BOOLEAN|BOOL|DATE|TIME|TIMESTAMP|TIMESTAMPTZ|NUMERIC|DECIMAL|FLOAT|REAL|DOUBLE\s+PRECISION|DOUBLE|JSON|JSONB|UUID|BLOB|BYTEA|ARRAY|INTERVAL)\b/i
|
|
517
|
+
);
|
|
518
|
+
if (sqlTypeMatch) {
|
|
519
|
+
tokens.push({ text: sqlTypeMatch[0], type: 'macro' });
|
|
520
|
+
remaining = remaining.slice(sqlTypeMatch[0].length);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Comprehensive SQL Clauses & Keywords
|
|
525
|
+
const sqlKwMatch = remaining.match(
|
|
526
|
+
/^(CREATE|ALTER|DROP|TRUNCATE|TABLE|DATABASE|SCHEMA|VIEW|INDEX|TRIGGER|FUNCTION|PROCEDURE|PRIMARY|FOREIGN|KEY|REFERENCES|CONSTRAINT|CHECK|DEFAULT|UNIQUE|NOT|NULL|CASCADE|RESTRICT|SELECT|DISTINCT|FROM|WHERE|AND|OR|IN|BETWEEN|LIKE|ILIKE|IS|EXISTS|HAVING|GROUP|ORDER|BY|ASC|DESC|LIMIT|OFFSET|FETCH|FIRST|NEXT|ROWS|ONLY|JOIN|INNER|LEFT|RIGHT|FULL|OUTER|CROSS|ON|USING|INSERT|INTO|VALUES|UPDATE|SET|DELETE|RETURNING|UNION|INTERSECT|EXCEPT|ALL|CASE|WHEN|THEN|ELSE|END|AS|BEGIN|COMMIT|ROLLBACK|TRANSACTION|SAVEPOINT|GRANT|REVOKE|WITH|RECURSIVE|OVER|PARTITION)\b/i
|
|
527
|
+
);
|
|
528
|
+
if (sqlKwMatch) {
|
|
529
|
+
tokens.push({ text: sqlKwMatch[0], type: 'keyword' });
|
|
530
|
+
remaining = remaining.slice(sqlKwMatch[0].length);
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// 10e. GraphQL Variables, Directives & Scalars
|
|
536
|
+
if (isGraphQL) {
|
|
537
|
+
// GraphQL Variables ($id, $input)
|
|
538
|
+
const gqlVarMatch = remaining.match(/^(\$[\w]+)\b/);
|
|
539
|
+
if (gqlVarMatch) {
|
|
540
|
+
tokens.push({ text: gqlVarMatch[0], type: 'macro' });
|
|
541
|
+
remaining = remaining.slice(gqlVarMatch[0].length);
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Directives (@include, @skip, @deprecated, @specifiedBy)
|
|
546
|
+
const gqlDirMatch = remaining.match(/^(@(?:include|skip|deprecated|specifiedBy))\b/);
|
|
547
|
+
if (gqlDirMatch) {
|
|
548
|
+
tokens.push({ text: gqlDirMatch[0], type: 'decorator' });
|
|
549
|
+
remaining = remaining.slice(gqlDirMatch[0].length);
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Core Scalars
|
|
554
|
+
const gqlScalarMatch = remaining.match(/^(String|Int|Float|Boolean|ID)\b/);
|
|
555
|
+
if (gqlScalarMatch) {
|
|
556
|
+
tokens.push({ text: gqlScalarMatch[0], type: 'macro' });
|
|
557
|
+
remaining = remaining.slice(gqlScalarMatch[0].length);
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// GraphQL Keywords
|
|
562
|
+
const gqlKwMatch = remaining.match(
|
|
563
|
+
/^(query|mutation|subscription|fragment|on|type|input|interface|union|enum|scalar|schema|directive|extend)\b/
|
|
564
|
+
);
|
|
565
|
+
if (gqlKwMatch) {
|
|
566
|
+
tokens.push({ text: gqlKwMatch[0], type: 'keyword' });
|
|
567
|
+
remaining = remaining.slice(gqlKwMatch[0].length);
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
343
572
|
// 11. Bash / Shell Variables & CLI Flags
|
|
344
573
|
if (isBash) {
|
|
345
574
|
const bashVarMatch = remaining.match(/^(\$\{?[\w#?@*!$-]+\}?)/);
|
|
@@ -591,7 +820,7 @@
|
|
|
591
820
|
? 'text-neutral-800 dark:text-neutral-200'
|
|
592
821
|
: 'text-neutral-200'} {wrap ? 'whitespace-pre-wrap' : 'whitespace-pre'}"><code
|
|
593
822
|
class="language-{language}"
|
|
594
|
-
>{#each tokenizedLines as lineTokens, lineIdx}{@const lineNum =
|
|
823
|
+
>{#each tokenizedLines as lineTokens, lineIdx (lineIdx)}{@const lineNum =
|
|
595
824
|
lineIdx + 1}{@const isHighlighted = highlightLines.includes(lineNum)}<div
|
|
596
825
|
class="table-row {isHighlighted
|
|
597
826
|
? '-mx-4 block border-l-2 border-primary-500 bg-primary-500/10 px-4'
|
|
@@ -600,7 +829,7 @@
|
|
|
600
829
|
? 'text-neutral-400 dark:text-neutral-600'
|
|
601
830
|
: 'text-neutral-600 dark:text-neutral-500'}">{lineNum}</span
|
|
602
831
|
>{/if}<span class="table-cell"
|
|
603
|
-
>{#each lineTokens as token}{#if token.type === 'rune'}<span
|
|
832
|
+
>{#each lineTokens as token, tokenIdx (tokenIdx)}{#if token.type === 'rune'}<span
|
|
604
833
|
class="font-bold text-amber-500 dark:text-amber-400">{token.text}</span
|
|
605
834
|
>{:else if token.type === 'keyword'}<span class="font-semibold text-primary-500"
|
|
606
835
|
>{token.text}</span
|