@elyracode/mini-lit 0.9.4
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 +21 -0
- package/README.md +22 -0
- package/dist/Alert.d.ts +12 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +35 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Badge.d.ts +8 -0
- package/dist/Badge.d.ts.map +1 -0
- package/dist/Badge.js +19 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Button.d.ts +14 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +60 -0
- package/dist/Button.js.map +1 -0
- package/dist/Card.d.ts +19 -0
- package/dist/Card.d.ts.map +1 -0
- package/dist/Card.js +76 -0
- package/dist/Card.js.map +1 -0
- package/dist/Checkbox.d.ts +15 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +49 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/CodeBlock.d.ts +11 -0
- package/dist/CodeBlock.d.ts.map +1 -0
- package/dist/CodeBlock.js +90 -0
- package/dist/CodeBlock.js.map +1 -0
- package/dist/CopyButton.d.ts +11 -0
- package/dist/CopyButton.d.ts.map +1 -0
- package/dist/CopyButton.js +65 -0
- package/dist/CopyButton.js.map +1 -0
- package/dist/Dialog.d.ts +24 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +72 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/DialogBase.d.ts +13 -0
- package/dist/DialogBase.d.ts.map +1 -0
- package/dist/DialogBase.js +48 -0
- package/dist/DialogBase.js.map +1 -0
- package/dist/Diff.d.ts +8 -0
- package/dist/Diff.d.ts.map +1 -0
- package/dist/Diff.js +47 -0
- package/dist/Diff.js.map +1 -0
- package/dist/DownloadButton.d.ts +16 -0
- package/dist/DownloadButton.d.ts.map +1 -0
- package/dist/DownloadButton.js +53 -0
- package/dist/DownloadButton.js.map +1 -0
- package/dist/FileButton.d.ts +9 -0
- package/dist/FileButton.d.ts.map +1 -0
- package/dist/FileButton.js +53 -0
- package/dist/FileButton.js.map +1 -0
- package/dist/Input.d.ts +28 -0
- package/dist/Input.d.ts.map +1 -0
- package/dist/Input.js +58 -0
- package/dist/Input.js.map +1 -0
- package/dist/Label.d.ts +9 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +17 -0
- package/dist/Label.js.map +1 -0
- package/dist/LanguageSelector.d.ts +14 -0
- package/dist/LanguageSelector.d.ts.map +1 -0
- package/dist/LanguageSelector.js +92 -0
- package/dist/LanguageSelector.js.map +1 -0
- package/dist/MarkdownBlock.d.ts +10 -0
- package/dist/MarkdownBlock.d.ts.map +1 -0
- package/dist/MarkdownBlock.js +257 -0
- package/dist/MarkdownBlock.js.map +1 -0
- package/dist/ModeToggle.d.ts +14 -0
- package/dist/ModeToggle.d.ts.map +1 -0
- package/dist/ModeToggle.js +59 -0
- package/dist/ModeToggle.js.map +1 -0
- package/dist/PreviewCode.d.ts +12 -0
- package/dist/PreviewCode.d.ts.map +1 -0
- package/dist/PreviewCode.js +80 -0
- package/dist/PreviewCode.js.map +1 -0
- package/dist/PreviewCodeToggle.d.ts +15 -0
- package/dist/PreviewCodeToggle.d.ts.map +1 -0
- package/dist/PreviewCodeToggle.js +55 -0
- package/dist/PreviewCodeToggle.js.map +1 -0
- package/dist/Progress.d.ts +10 -0
- package/dist/Progress.d.ts.map +1 -0
- package/dist/Progress.js +27 -0
- package/dist/Progress.js.map +1 -0
- package/dist/PromptDialog.d.ts +20 -0
- package/dist/PromptDialog.d.ts.map +1 -0
- package/dist/PromptDialog.js +114 -0
- package/dist/PromptDialog.js.map +1 -0
- package/dist/Select.d.ts +25 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +335 -0
- package/dist/Select.js.map +1 -0
- package/dist/Separator.d.ts +10 -0
- package/dist/Separator.d.ts.map +1 -0
- package/dist/Separator.js +19 -0
- package/dist/Separator.js.map +1 -0
- package/dist/Sidebar.d.ts +27 -0
- package/dist/Sidebar.d.ts.map +1 -0
- package/dist/Sidebar.js +151 -0
- package/dist/Sidebar.js.map +1 -0
- package/dist/SplitPanel.d.ts +40 -0
- package/dist/SplitPanel.d.ts.map +1 -0
- package/dist/SplitPanel.js +275 -0
- package/dist/SplitPanel.js.map +1 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Switch.js +48 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Textarea.d.ts +21 -0
- package/dist/Textarea.d.ts.map +1 -0
- package/dist/Textarea.js +67 -0
- package/dist/Textarea.js.map +1 -0
- package/dist/ThemeToggle.d.ts +11 -0
- package/dist/ThemeToggle.d.ts.map +1 -0
- package/dist/ThemeToggle.js +91 -0
- package/dist/ThemeToggle.js.map +1 -0
- package/dist/component.d.ts +190 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +241 -0
- package/dist/component.js.map +1 -0
- package/dist/i18n.d.ts +73 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +146 -0
- package/dist/i18n.js.map +1 -0
- package/dist/icons.d.ts +7 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +21 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mini.d.ts +19 -0
- package/dist/mini.d.ts.map +1 -0
- package/dist/mini.js +29 -0
- package/dist/mini.js.map +1 -0
- package/llms.txt +681 -0
- package/package.json +69 -0
- package/src/styles/base.css +63 -0
- package/src/styles/themes/claude.css +155 -0
- package/src/styles/themes/default.css +102 -0
- package/src/styles/utils/markdown.css +104 -0
- package/src/styles/utils/math.css +7 -0
- package/src/styles/utils/syntax-highlighting.css +134 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @elyracode/mini-lit
|
|
2
|
+
|
|
3
|
+
Lightweight [Lit](https://lit.dev) components with shadcn-inspired theming and Tailwind CSS integration.
|
|
4
|
+
|
|
5
|
+
This package is a fork of [`@mariozechner/mini-lit`](https://github.com/badlogic/mini-lit) by Mario Zechner (MIT licensed), vendored into the Elyra monorepo so the project owns its development and maintenance. See `llms.txt` for a component reference.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Button, Dialog, i18n } from "@elyracode/mini-lit";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import the theme in your CSS entry point:
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
@import "@elyracode/mini-lit/styles/themes/default.css";
|
|
17
|
+
@source "../../../node_modules/@elyracode/mini-lit/dist";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT. Original work Copyright (c) Mario Zechner. Fork maintained by Knut W. Horne.
|
package/dist/Alert.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BaseComponentProps, type TemplateResult } from "./mini.js";
|
|
2
|
+
export type AlertVariant = "default" | "destructive";
|
|
3
|
+
export interface AlertProps extends BaseComponentProps {
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
}
|
|
6
|
+
export declare function Alert(props: AlertProps): TemplateResult;
|
|
7
|
+
export declare function Alert(children: TemplateResult | string, variant?: AlertVariant, className?: string): TemplateResult;
|
|
8
|
+
export declare function AlertTitle(props: BaseComponentProps): TemplateResult;
|
|
9
|
+
export declare function AlertTitle(children: TemplateResult | string, className?: string): TemplateResult;
|
|
10
|
+
export declare function AlertDescription(props: BaseComponentProps): TemplateResult;
|
|
11
|
+
export declare function AlertDescription(children: TemplateResult | string, className?: string): TemplateResult;
|
|
12
|
+
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../src/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAY,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;AAErD,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACnD,OAAO,CAAC,EAAE,YAAY,CAAC;CACzB;AAwBD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC;AACzD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAYrH,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWlG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AAC5E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC"}
|
package/dist/Alert.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { fc, html } from "./mini.js";
|
|
2
|
+
// Internal FC components with named args
|
|
3
|
+
const _Alert = fc(({ variant = "default", className = "", children }) => {
|
|
4
|
+
const variantClasses = {
|
|
5
|
+
default: "bg-background text-foreground border-border",
|
|
6
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
7
|
+
};
|
|
8
|
+
const baseClasses = "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground";
|
|
9
|
+
return html ` <div class="${baseClasses} ${variantClasses[variant]} ${className}" role="alert">${children}</div> `;
|
|
10
|
+
});
|
|
11
|
+
const _AlertTitle = fc(({ className = "", children }) => {
|
|
12
|
+
return html ` <h5 class="mb-1 font-medium leading-none tracking-tight ${className}">${children}</h5> `;
|
|
13
|
+
});
|
|
14
|
+
const _AlertDescription = fc(({ className = "", children }) => {
|
|
15
|
+
return html ` <div class="text-sm [&_p]:leading-relaxed ${className}">${children}</div> `;
|
|
16
|
+
});
|
|
17
|
+
export function Alert(propsOrChildren, variant = "default", className = "") {
|
|
18
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
19
|
+
return _Alert(propsOrChildren);
|
|
20
|
+
}
|
|
21
|
+
return _Alert({ children: propsOrChildren, variant, className });
|
|
22
|
+
}
|
|
23
|
+
export function AlertTitle(propsOrChildren, className = "") {
|
|
24
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
25
|
+
return _AlertTitle(propsOrChildren);
|
|
26
|
+
}
|
|
27
|
+
return _AlertTitle({ children: propsOrChildren, className });
|
|
28
|
+
}
|
|
29
|
+
export function AlertDescription(propsOrChildren, className = "") {
|
|
30
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
31
|
+
return _AlertDescription(propsOrChildren);
|
|
32
|
+
}
|
|
33
|
+
return _AlertDescription({ children: propsOrChildren, className });
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../src/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,EAAE,EAAE,IAAI,EAAuB,MAAM,WAAW,CAAC;AAQnF,yCAAyC;AACzC,MAAM,MAAM,GAAG,EAAE,CAAa,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,MAAM,cAAc,GAAG;QACpB,OAAO,EAAE,6CAA6C;QACtD,WAAW,EAAE,yFAAyF;KACxG,CAAC;IAEF,MAAM,WAAW,GACd,2JAA2J,CAAC;IAE/J,OAAO,IAAI,CAAA,gBAAgB,WAAW,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,SAAS,kBAAkB,QAAQ,SAAS,CAAC;AACrH,CAAC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,EAAE,CAAqB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,EAA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AAC;AACjG,CAAC"}
|
package/dist/Badge.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BaseComponentProps, type TemplateResult } from "./mini.js";
|
|
2
|
+
export type BadgeVariant = "default" | "secondary" | "destructive" | "outline";
|
|
3
|
+
export interface BadgeProps extends BaseComponentProps {
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
}
|
|
6
|
+
export declare function Badge(props: BadgeProps): TemplateResult;
|
|
7
|
+
export declare function Badge(children: TemplateResult | string, variant?: BadgeVariant, className?: string): TemplateResult;
|
|
8
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../src/Badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAY,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACnD,OAAO,CAAC,EAAE,YAAY,CAAC;CACzB;AAkBD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC;AACzD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC"}
|
package/dist/Badge.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fc, html } from "./mini.js";
|
|
2
|
+
// Internal FC component with named args
|
|
3
|
+
const _Badge = fc(({ variant = "default", className = "", children }) => {
|
|
4
|
+
const variantClasses = {
|
|
5
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
6
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
7
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
8
|
+
outline: "border-input text-foreground",
|
|
9
|
+
};
|
|
10
|
+
const baseClasses = "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden";
|
|
11
|
+
return html ` <span class="${baseClasses} ${variantClasses[variant]} ${className}"> ${children} </span> `;
|
|
12
|
+
});
|
|
13
|
+
export function Badge(propsOrChildren, variant = "default", className = "") {
|
|
14
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
15
|
+
return _Badge(propsOrChildren);
|
|
16
|
+
}
|
|
17
|
+
return _Badge({ children: propsOrChildren, variant, className });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../src/Badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,EAAE,EAAE,IAAI,EAAuB,MAAM,WAAW,CAAC;AAQnF,wCAAwC;AACxC,MAAM,MAAM,GAAG,EAAE,CAAa,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,MAAM,cAAc,GAAG;QACpB,OAAO,EAAE,2EAA2E;QACpF,SAAS,EAAE,iFAAiF;QAC5F,WAAW,EAAE,uFAAuF;QACpG,OAAO,EAAE,8BAA8B;KACzC,CAAC;IAEF,MAAM,WAAW,GACd,gZAAgZ,CAAC;IAEpZ,OAAO,IAAI,CAAA,iBAAiB,WAAW,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,SAAS,MAAM,QAAQ,WAAW,CAAC;AAC5G,CAAC,CAAC,CAAC;AAKH,MAAM,UAAU,KAAK,CAClB,eAAqD,EACrD,UAAwB,SAAS,EACjC,SAAS,GAAG,EAAE;IAEd,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,KAAK,IAAI,IAAI,UAAU,IAAI,eAAe,EAAE,CAAC;QACpG,OAAO,MAAM,CAAC,eAA6B,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,MAAM,CAAC,EAAE,QAAQ,EAAE,eAA0C,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC/F,CAAC"}
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type BaseComponentProps } from "./mini.js";
|
|
2
|
+
export type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
3
|
+
export type ButtonSize = "sm" | "md" | "lg" | "icon";
|
|
4
|
+
export interface ButtonProps extends BaseComponentProps {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
type?: "button" | "submit" | "reset";
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
onClick?: (e: Event) => void;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Button: import("./mini.js").Component<ButtonProps>;
|
|
14
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,WAAW,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AACnG,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACpD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,MAAM,4CA8ElB,CAAC"}
|
package/dist/Button.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { fc, html } from "./mini.js";
|
|
2
|
+
export const Button = fc(({ variant = "default", size = "md", disabled = false, type = "button", loading = false, onClick, title, className = "", children, }) => {
|
|
3
|
+
const sizeClasses = {
|
|
4
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
5
|
+
md: "h-9 rounded-md px-4 text-sm",
|
|
6
|
+
lg: "h-10 rounded-md px-8 text-sm",
|
|
7
|
+
icon: "size-8 rounded-md",
|
|
8
|
+
};
|
|
9
|
+
const variantClasses = {
|
|
10
|
+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
11
|
+
destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
|
|
12
|
+
outline: "border border-input bg-background text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
14
|
+
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
16
|
+
};
|
|
17
|
+
const baseClasses = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all cursor-pointer disabled:cursor-not-allowed disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive";
|
|
18
|
+
const gapClass = size === "icon" ? "" : "gap-2";
|
|
19
|
+
const paddingAdjustClass = size === "icon" ? "" : "has-[>svg]:px-2.5";
|
|
20
|
+
const variantClass = variantClasses[variant] || variantClasses.default;
|
|
21
|
+
const handleClick = (e) => {
|
|
22
|
+
if (disabled || loading) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
onClick?.(e);
|
|
28
|
+
};
|
|
29
|
+
return html `
|
|
30
|
+
<button
|
|
31
|
+
type="${type}"
|
|
32
|
+
class="${baseClasses} ${sizeClasses[size]} ${variantClass} ${gapClass} ${paddingAdjustClass} ${className}"
|
|
33
|
+
?disabled=${disabled || loading}
|
|
34
|
+
@click=${handleClick}
|
|
35
|
+
title="${title || ""}"
|
|
36
|
+
>
|
|
37
|
+
${loading
|
|
38
|
+
? html `
|
|
39
|
+
<svg class="animate-spin" fill="none" viewBox="0 0 24 24">
|
|
40
|
+
<circle
|
|
41
|
+
class="opacity-25"
|
|
42
|
+
cx="12"
|
|
43
|
+
cy="12"
|
|
44
|
+
r="10"
|
|
45
|
+
stroke="currentColor"
|
|
46
|
+
stroke-width="4"
|
|
47
|
+
></circle>
|
|
48
|
+
<path
|
|
49
|
+
class="opacity-75"
|
|
50
|
+
fill="currentColor"
|
|
51
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
52
|
+
></path>
|
|
53
|
+
</svg>
|
|
54
|
+
`
|
|
55
|
+
: ""}
|
|
56
|
+
${children}
|
|
57
|
+
</button>
|
|
58
|
+
`;
|
|
59
|
+
});
|
|
60
|
+
//# sourceMapping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AAC;YACpB,OAAO;QACV,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,IAAI,CAAA;;oBAEG,IAAI;qBACH,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,YAAY,IAAI,QAAQ,IAAI,kBAAkB,IAAI,SAAS;wBAC5F,QAAQ,IAAI,OAAO;qBACtB,WAAW;qBACX,KAAK,IAAI,EAAE;;cAGjB,OAAO;QACJ,CAAC,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;kBAgBN;QACA,CAAC,CAAC,EACR;cACE,QAAQ;;OAEf,CAAC;AACL,CAAC,CACH,CAAC"}
|
package/dist/Card.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type BaseComponentProps, type TemplateResult } from "./mini.js";
|
|
2
|
+
export interface CardProps extends BaseComponentProps {
|
|
3
|
+
hoverable?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function Card(props: CardProps): TemplateResult;
|
|
6
|
+
export declare function Card(children: TemplateResult | string, hoverable?: boolean, className?: string): TemplateResult;
|
|
7
|
+
export declare function CardHeader(props: BaseComponentProps): TemplateResult;
|
|
8
|
+
export declare function CardHeader(children: TemplateResult | string, className?: string): TemplateResult;
|
|
9
|
+
export declare function CardAction(props: BaseComponentProps): TemplateResult;
|
|
10
|
+
export declare function CardAction(children: TemplateResult | string, className?: string): TemplateResult;
|
|
11
|
+
export declare function CardTitle(props: BaseComponentProps): TemplateResult;
|
|
12
|
+
export declare function CardTitle(children: TemplateResult | string, className?: string): TemplateResult;
|
|
13
|
+
export declare function CardDescription(props: BaseComponentProps): TemplateResult;
|
|
14
|
+
export declare function CardDescription(children: TemplateResult | string, className?: string): TemplateResult;
|
|
15
|
+
export declare function CardContent(props: BaseComponentProps): TemplateResult;
|
|
16
|
+
export declare function CardContent(children: TemplateResult | string, className?: string): TemplateResult;
|
|
17
|
+
export declare function CardFooter(props: BaseComponentProps): TemplateResult;
|
|
18
|
+
export declare function CardFooter(children: TemplateResult | string, className?: string): TemplateResult;
|
|
19
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../src/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAY,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnF,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;CACtB;AA2CD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,cAAc,CAAC;AACvD,wBAAgB,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAYjH,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWlG,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWlG,wBAAgB,SAAS,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACrE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWjG,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AAC3E,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWvG,wBAAgB,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACvE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;AAWnG,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC"}
|
package/dist/Card.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { fc, html } from "./mini.js";
|
|
2
|
+
// Internal FC components with named args
|
|
3
|
+
const _Card = fc(({ hoverable = false, className = "", children }) => {
|
|
4
|
+
const baseClasses = "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-border shadow-xs";
|
|
5
|
+
const hoverClasses = hoverable ? "hover:shadow-md transition-shadow" : "";
|
|
6
|
+
return html ` <div class="${baseClasses} ${hoverClasses} py-6 ${className}">${children}</div> `;
|
|
7
|
+
});
|
|
8
|
+
const _CardHeader = fc(({ className = "", children }) => {
|
|
9
|
+
return html `
|
|
10
|
+
<div
|
|
11
|
+
class="grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-[ui-card-action]:grid-cols-[1fr_auto] ${className}"
|
|
12
|
+
>
|
|
13
|
+
${children}
|
|
14
|
+
</div>
|
|
15
|
+
`;
|
|
16
|
+
});
|
|
17
|
+
const _CardAction = fc(({ className = "", children }) => {
|
|
18
|
+
return html `
|
|
19
|
+
<div class="col-start-2 row-span-2 row-start-1 self-start justify-self-end ${className}">${children}</div>
|
|
20
|
+
`;
|
|
21
|
+
});
|
|
22
|
+
const _CardTitle = fc(({ className = "", children }) => {
|
|
23
|
+
return html ` <h3 class="leading-none font-semibold ${className}">${children}</h3> `;
|
|
24
|
+
});
|
|
25
|
+
const _CardDescription = fc(({ className = "", children }) => {
|
|
26
|
+
return html ` <div class="text-muted-foreground text-sm ${className}">${children}</div> `;
|
|
27
|
+
});
|
|
28
|
+
const _CardContent = fc(({ className = "", children }) => {
|
|
29
|
+
return html ` <div class="px-6 ${className}">${children}</div> `;
|
|
30
|
+
});
|
|
31
|
+
const _CardFooter = fc(({ className = "", children }) => {
|
|
32
|
+
return html ` <div class="flex items-center px-6 ${className}">${children}</div> `;
|
|
33
|
+
});
|
|
34
|
+
export function Card(propsOrChildren, hoverable = false, className = "") {
|
|
35
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
36
|
+
return _Card(propsOrChildren);
|
|
37
|
+
}
|
|
38
|
+
return _Card({ children: propsOrChildren, hoverable, className });
|
|
39
|
+
}
|
|
40
|
+
export function CardHeader(propsOrChildren, className = "") {
|
|
41
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
42
|
+
return _CardHeader(propsOrChildren);
|
|
43
|
+
}
|
|
44
|
+
return _CardHeader({ children: propsOrChildren, className });
|
|
45
|
+
}
|
|
46
|
+
export function CardAction(propsOrChildren, className = "") {
|
|
47
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
48
|
+
return _CardAction(propsOrChildren);
|
|
49
|
+
}
|
|
50
|
+
return _CardAction({ children: propsOrChildren, className });
|
|
51
|
+
}
|
|
52
|
+
export function CardTitle(propsOrChildren, className = "") {
|
|
53
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
54
|
+
return _CardTitle(propsOrChildren);
|
|
55
|
+
}
|
|
56
|
+
return _CardTitle({ children: propsOrChildren, className });
|
|
57
|
+
}
|
|
58
|
+
export function CardDescription(propsOrChildren, className = "") {
|
|
59
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
60
|
+
return _CardDescription(propsOrChildren);
|
|
61
|
+
}
|
|
62
|
+
return _CardDescription({ children: propsOrChildren, className });
|
|
63
|
+
}
|
|
64
|
+
export function CardContent(propsOrChildren, className = "") {
|
|
65
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
66
|
+
return _CardContent(propsOrChildren);
|
|
67
|
+
}
|
|
68
|
+
return _CardContent({ children: propsOrChildren, className });
|
|
69
|
+
}
|
|
70
|
+
export function CardFooter(propsOrChildren, className = "") {
|
|
71
|
+
if (typeof propsOrChildren === "object" && propsOrChildren !== null && "children" in propsOrChildren) {
|
|
72
|
+
return _CardFooter(propsOrChildren);
|
|
73
|
+
}
|
|
74
|
+
return _CardFooter({ children: propsOrChildren, className });
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=Card.js.map
|
package/dist/Card.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../src/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,EAAE,EAAE,IAAI,EAAuB,MAAM,WAAW,CAAC;AAMnF,yCAAyC;AACzC,MAAM,KAAK,GAAG,EAAE,CAAY,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,4FAA4F,CAAC;IACjH,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1E,OAAO,IAAI,CAAA,gBAAgB,WAAW,IAAI,YAAY,SAAS,SAAS,KAAK,QAAQ,SAAS,CAAC;AAClG,CAAC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,EAAE,CAAqB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzE,OAAO,IAAI,CAAA;;8HAEgH,SAAS;;WAE5H,QAAQ;;IAEf,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,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0C,EAAE,SAAS,EAAE,CAAC,CAAC;AAChG,CAAC;AAID,MAAM,UAAU,WAAW,CACxB,eAA6D,EAC7D,SAAS,GAAG,EAAE;IAEd,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,KAAK,IAAI,IAAI,UAAU,IAAI,eAAe,EAAE,CAAC;QACpG,OAAO,YAAY,CAAC,eAAqC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,YAAY,CAAC,EAAE,QAAQ,EAAE,eAA0C,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5F,CAAC;AAID,MAAM,UAAU,UAAU,CACvB,eAA6D,EAC7D,SAAS,GAAG,EAAE;IAEd,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,KAAK,IAAI,IAAI,UAAU,IAAI,eAAe,EAAE,CAAC;QACpG,OAAO,WAAW,CAAC,eAAqC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,WAAW,CAAC,EAAE,QAAQ,EAAE,eAA0C,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutChildren, type TemplateResult } from "./mini.js";
|
|
2
|
+
interface CheckboxProps extends ComponentPropsWithoutChildren {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
indeterminate?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: TemplateResult | string;
|
|
7
|
+
name?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
onChange?: (checked: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function Checkbox(props: CheckboxProps): TemplateResult;
|
|
13
|
+
export declare function Checkbox(checked?: boolean, onChange?: (checked: boolean) => void, label?: TemplateResult | string, disabled?: boolean, className?: string): TemplateResult;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../src/Checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,6BAA6B,EAA4B,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAE9G,UAAU,aAAc,SAAQ,6BAA6B;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAgED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAAC;AAC/D,wBAAgB,QAAQ,CACrB,OAAO,CAAC,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACrC,KAAK,CAAC,EAAE,cAAc,GAAG,MAAM,EAC/B,QAAQ,CAAC,EAAE,OAAO,EAClB,SAAS,CAAC,EAAE,MAAM,GAClB,cAAc,CAAC"}
|
package/dist/Checkbox.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRef, fc, html, ref } from "./mini.js";
|
|
2
|
+
const _Checkbox = fc(({ checked = false, indeterminate = false, disabled = false, label = "", name = "", value = "", id = "", onChange, className = "", }) => {
|
|
3
|
+
const inputRef = createRef();
|
|
4
|
+
// Generate a unique ID if label is provided but ID is not
|
|
5
|
+
const checkboxId = id || (label ? `checkbox-${Math.random().toString(36).substr(2, 9)}` : "");
|
|
6
|
+
const handleChange = (e) => {
|
|
7
|
+
const target = e.target;
|
|
8
|
+
onChange?.(target.checked);
|
|
9
|
+
};
|
|
10
|
+
const baseClasses = "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";
|
|
11
|
+
const checkedClasses = "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground";
|
|
12
|
+
// Set indeterminate state after render
|
|
13
|
+
if (inputRef.value) {
|
|
14
|
+
inputRef.value.indeterminate = indeterminate;
|
|
15
|
+
}
|
|
16
|
+
return html `
|
|
17
|
+
<div class="flex space-x-2 items-start ${className}">
|
|
18
|
+
<input
|
|
19
|
+
${ref(inputRef)}
|
|
20
|
+
type="checkbox"
|
|
21
|
+
id="${checkboxId}"
|
|
22
|
+
class="${baseClasses} ${checkedClasses}"
|
|
23
|
+
.checked=${checked}
|
|
24
|
+
?disabled=${disabled}
|
|
25
|
+
name="${name}"
|
|
26
|
+
value="${value}"
|
|
27
|
+
data-state="${checked ? "checked" : "unchecked"}"
|
|
28
|
+
@change=${handleChange}
|
|
29
|
+
/>
|
|
30
|
+
${label
|
|
31
|
+
? html `
|
|
32
|
+
<label
|
|
33
|
+
for="${checkboxId}"
|
|
34
|
+
class="text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer select-none"
|
|
35
|
+
>
|
|
36
|
+
${label}
|
|
37
|
+
</label>
|
|
38
|
+
`
|
|
39
|
+
: ""}
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
});
|
|
43
|
+
export function Checkbox(propsOrChecked = false, onChange, label = "", disabled = false, className = "") {
|
|
44
|
+
if (typeof propsOrChecked === "object" && propsOrChecked !== null) {
|
|
45
|
+
return _Checkbox(propsOrChecked);
|
|
46
|
+
}
|
|
47
|
+
return _Checkbox({ checked: propsOrChecked, onChange, label, disabled, className });
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","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,SAAS,CAAC,CAAC,CAAC,WAAW;yBACrC,YAAY;;cAGtB,KAAK;QACF,CAAC,CAAC,IAAI,CAAA;;8BAEM,UAAU;;;yBAGf,KAAK;;kBAEZ;QACA,CAAC,CAAC,EACR;;OAEL,CAAC;AACL,CAAC,CACH,CAAC;AAWF,MAAM,UAAU,QAAQ,CACrB,iBAA0C,KAAK,EAC/C,QAAqC,EACrC,QAAiC,EAAE,EACnC,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,EAAE;IAEd,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QACjE,OAAO,SAAS,CAAC,cAA+B,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,SAAS,CAAC,EAAE,OAAO,EAAE,cAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./CopyButton.js";
|
|
3
|
+
export declare class CodeBlock extends LitElement {
|
|
4
|
+
code: string;
|
|
5
|
+
language: string;
|
|
6
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
private getDecodedCode;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CodeBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../src/CodeBlock.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAIlD,OAAO,iBAAiB,CAAC;AAazB,qBACa,SAAU,SAAQ,UAAU;IAC1B,IAAI,SAAM;IACV,QAAQ,SAAM;cAEP,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;IAI5D,iBAAiB;IAM1B,OAAO,CAAC,cAAc;IAUb,MAAM;CA4BjB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import hljs from "highlight.js/lib/core";
|
|
8
|
+
import bash from "highlight.js/lib/languages/bash";
|
|
9
|
+
import css from "highlight.js/lib/languages/css";
|
|
10
|
+
import javascript from "highlight.js/lib/languages/javascript";
|
|
11
|
+
import json from "highlight.js/lib/languages/json";
|
|
12
|
+
import python from "highlight.js/lib/languages/python";
|
|
13
|
+
import sql from "highlight.js/lib/languages/sql";
|
|
14
|
+
import typescript from "highlight.js/lib/languages/typescript";
|
|
15
|
+
import html from "highlight.js/lib/languages/xml"; // HTML uses xml
|
|
16
|
+
import { LitElement, html as litHtml } from "lit";
|
|
17
|
+
import { customElement, property } from "lit/decorators.js";
|
|
18
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
19
|
+
import { i18n } from "./i18n.js";
|
|
20
|
+
import "./CopyButton.js";
|
|
21
|
+
// Register only the languages we need
|
|
22
|
+
hljs.registerLanguage("javascript", javascript);
|
|
23
|
+
hljs.registerLanguage("typescript", typescript);
|
|
24
|
+
hljs.registerLanguage("python", python);
|
|
25
|
+
hljs.registerLanguage("html", html);
|
|
26
|
+
hljs.registerLanguage("xml", html); // Also register as xml
|
|
27
|
+
hljs.registerLanguage("css", css);
|
|
28
|
+
hljs.registerLanguage("json", json);
|
|
29
|
+
hljs.registerLanguage("bash", bash);
|
|
30
|
+
hljs.registerLanguage("sql", sql);
|
|
31
|
+
let CodeBlock = class CodeBlock extends LitElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.code = "";
|
|
35
|
+
this.language = "";
|
|
36
|
+
}
|
|
37
|
+
createRenderRoot() {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
super.connectedCallback();
|
|
42
|
+
// Make sure the custom element displays as a block element
|
|
43
|
+
this.style.display = "block";
|
|
44
|
+
}
|
|
45
|
+
getDecodedCode() {
|
|
46
|
+
try {
|
|
47
|
+
// Decode from base64
|
|
48
|
+
return decodeURIComponent(escape(atob(this.code)));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Fallback if not encoded
|
|
52
|
+
return this.code;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
const decodedCode = this.getDecodedCode();
|
|
57
|
+
// Highlight the code
|
|
58
|
+
const highlighted = this.language && hljs.getLanguage(this.language)
|
|
59
|
+
? hljs.highlight(decodedCode, { language: this.language }).value
|
|
60
|
+
: hljs.highlightAuto(decodedCode).value;
|
|
61
|
+
// Format language name for display
|
|
62
|
+
const displayLanguage = this.language || "plaintext";
|
|
63
|
+
return litHtml `
|
|
64
|
+
<div class="border border-border rounded-lg overflow-hidden">
|
|
65
|
+
<!-- Title bar -->
|
|
66
|
+
<div class="flex items-center justify-between px-3 py-1">
|
|
67
|
+
<span class="text-xs text-muted-foreground font-mono">${displayLanguage}</span>
|
|
68
|
+
<copy-button class="[&>button]:!bg-transparent [&>button]:hover:!bg-accent" .text=${decodedCode} title="${i18n("Copy code")}" .showText=${true}></copy-button>
|
|
69
|
+
</div>
|
|
70
|
+
<!-- Code content -->
|
|
71
|
+
<div class="overflow-auto max-h-96">
|
|
72
|
+
<pre
|
|
73
|
+
class="!bg-transparent !border-0 !rounded-none m-0 px-4 pb-4 text-xs text-foreground font-mono"
|
|
74
|
+
><code class="hljs language-${this.language || "plaintext"}">${unsafeHTML(highlighted)}</code></pre>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
__decorate([
|
|
81
|
+
property()
|
|
82
|
+
], CodeBlock.prototype, "code", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
property()
|
|
85
|
+
], CodeBlock.prototype, "language", void 0);
|
|
86
|
+
CodeBlock = __decorate([
|
|
87
|
+
customElement("code-block")
|
|
88
|
+
], CodeBlock);
|
|
89
|
+
export { CodeBlock };
|
|
90
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../src/CodeBlock.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,IAAI,MAAM,uBAAuB,CAAC;AACzC,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,GAAG,MAAM,gCAAgC,CAAC;AACjD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,IAAI,MAAM,gCAAgC,CAAC,CAAC,gBAAgB;AACnE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,iBAAiB,CAAC;AAEzB,sCAAsC;AACtC,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,U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I,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC7C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK;YAChE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC;QAE9C,mCAAmC;QACnC,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC;QAErD,OAAO,OAAO,CAAA;;;;6DAIyC,eAAe;yFACa,WAAW,WAAW,IAAI,CAAC,WAAW,CAAC,eAAe,IAAI;;;;;;mCAMhH,IAAI,CAAC,QAAQ,IAAI,WAAW,KAAK,UAAU,CAAC,WAAW,CAAC;;;GAGxF,CAAC;IACD,CAAC;CACH,CAAA;AAnDc;IAAX,QAAQ,EAAE;uCAAW;AACV;IAAX,QAAQ,EAAE;2CAAe;AAFhB,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoDrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class CopyButton extends LitElement {
|
|
3
|
+
text: string;
|
|
4
|
+
title: string;
|
|
5
|
+
showText: boolean;
|
|
6
|
+
private copied;
|
|
7
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
8
|
+
private handleCopy;
|
|
9
|
+
render(): import("lit-html").TemplateResult;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../src/CopyButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAOvC,qBACa,UAAW,SAAQ,UAAU;IAC3B,IAAI,SAAM;IACD,KAAK,SAAgB;IACW,QAAQ,UAAS;IAE7D,OAAO,CAAC,MAAM,CAAS;cAEb,gBAAgB,IAAI,WAAW,GAAG,gBAAgB;YAIvD,UAAU;IAYf,MAAM;CAYjB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { Check, Copy } from "lucide";
|
|
10
|
+
import { Button } from "./Button.js";
|
|
11
|
+
import { i18n } from "./i18n.js";
|
|
12
|
+
import { icon } from "./icons.js";
|
|
13
|
+
let CopyButton = class CopyButton extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.text = "";
|
|
17
|
+
this.title = i18n("Copy");
|
|
18
|
+
this.showText = false;
|
|
19
|
+
this.copied = false;
|
|
20
|
+
}
|
|
21
|
+
createRenderRoot() {
|
|
22
|
+
return this; // light DOM
|
|
23
|
+
}
|
|
24
|
+
async handleCopy() {
|
|
25
|
+
try {
|
|
26
|
+
await navigator.clipboard.writeText(this.text);
|
|
27
|
+
this.copied = true;
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
this.copied = false;
|
|
30
|
+
}, 2000);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.error("Failed to copy:", err);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return Button({
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
size: "sm",
|
|
40
|
+
onClick: () => this.handleCopy(),
|
|
41
|
+
title: this.title,
|
|
42
|
+
children: html `
|
|
43
|
+
${this.copied ? icon(Check, "sm") : icon(Copy, "sm")}
|
|
44
|
+
${this.copied && this.showText ? html `<span>${i18n("Copied!")}</span>` : ""}
|
|
45
|
+
`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
__decorate([
|
|
50
|
+
property()
|
|
51
|
+
], CopyButton.prototype, "text", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
property()
|
|
54
|
+
], CopyButton.prototype, "title", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ type: Boolean, attribute: "show-text" })
|
|
57
|
+
], CopyButton.prototype, "showText", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
state()
|
|
60
|
+
], CopyButton.prototype, "copied", void 0);
|
|
61
|
+
CopyButton = __decorate([
|
|
62
|
+
customElement("copy-button")
|
|
63
|
+
], CopyButton);
|
|
64
|
+
export { CopyButton };
|
|
65
|
+
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../src/CopyButton.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAG3B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACQ,SAAI,GAAG,EAAE,CAAC;QAC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