@pixel-point/toolcraft 0.0.2
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.md +98 -0
- package/README.md +41 -0
- package/bin/create-toolcraft-app.mjs +8 -0
- package/bin/toolcraft.mjs +8 -0
- package/package.json +24 -0
- package/scripts/prepare-pack.mjs +29 -0
- package/src/cli.mjs +392 -0
- package/src/cli.test.mjs +284 -0
- package/src/copy-recursive.mjs +86 -0
- package/src/generate.mjs +212 -0
- package/src/generate.test.mjs +322 -0
- package/src/import-map.mjs +14 -0
- package/src/package-json.mjs +80 -0
- package/src/package-json.test.mjs +67 -0
- package/src/rewrite-imports.mjs +85 -0
- package/src/rewrite-imports.test.mjs +58 -0
- package/templates/runtime/contracts/component-contracts.test.ts +1165 -0
- package/templates/runtime/contracts/component-contracts.ts +1340 -0
- package/templates/runtime/contracts/decision-contracts.test.ts +206 -0
- package/templates/runtime/contracts/decision-contracts.ts +283 -0
- package/templates/runtime/contracts/index.test.ts +14 -0
- package/templates/runtime/contracts/index.ts +3 -0
- package/templates/runtime/contracts/types.ts +56 -0
- package/templates/runtime/export/export.test.ts +203 -0
- package/templates/runtime/export/export.ts +132 -0
- package/templates/runtime/export/index.ts +1 -0
- package/templates/runtime/index.ts +14 -0
- package/templates/runtime/react/canvas-shell.test.tsx +424 -0
- package/templates/runtime/react/canvas-shell.tsx +408 -0
- package/templates/runtime/react/control-renderers.ts +31 -0
- package/templates/runtime/react/controls-panel.test.tsx +3736 -0
- package/templates/runtime/react/controls-panel.tsx +2327 -0
- package/templates/runtime/react/curve-geometry.test.ts +70 -0
- package/templates/runtime/react/index.ts +15 -0
- package/templates/runtime/react/layer-tree.ts +96 -0
- package/templates/runtime/react/layers-panel.test.tsx +487 -0
- package/templates/runtime/react/layers-panel.tsx +1348 -0
- package/templates/runtime/react/media-file.ts +82 -0
- package/templates/runtime/react/panel-host-config.ts +80 -0
- package/templates/runtime/react/panel-host-geometry.test.ts +66 -0
- package/templates/runtime/react/panel-host-geometry.ts +109 -0
- package/templates/runtime/react/panel-host-types.ts +74 -0
- package/templates/runtime/react/panel-host.test.tsx +102 -0
- package/templates/runtime/react/panel-host.tsx +353 -0
- package/templates/runtime/react/runtime-public-api.test.tsx +132 -0
- package/templates/runtime/react/settings-transfer.test.ts +150 -0
- package/templates/runtime/react/settings-transfer.ts +279 -0
- package/templates/runtime/react/storage-key-migration.ts +48 -0
- package/templates/runtime/react/theme-runtime.tsx +177 -0
- package/templates/runtime/react/timeline-panel.test.tsx +668 -0
- package/templates/runtime/react/timeline-panel.tsx +2953 -0
- package/templates/runtime/react/toolbar-panel.test.tsx +212 -0
- package/templates/runtime/react/toolbar-panel.tsx +205 -0
- package/templates/runtime/react/toolcraft-app.integration.test.tsx +350 -0
- package/templates/runtime/react/toolcraft-app.test.tsx +339 -0
- package/templates/runtime/react/toolcraft-app.tsx +81 -0
- package/templates/runtime/react/toolcraft-root.test.tsx +347 -0
- package/templates/runtime/react/toolcraft-root.tsx +203 -0
- package/templates/runtime/react/use-toolcraft.ts +41 -0
- package/templates/runtime/schema/define-toolcraft.test.ts +1524 -0
- package/templates/runtime/schema/define-toolcraft.ts +1442 -0
- package/templates/runtime/schema/keyframe-capability.test.ts +90 -0
- package/templates/runtime/schema/keyframe-capability.ts +51 -0
- package/templates/runtime/schema/runtime-targets.ts +40 -0
- package/templates/runtime/schema/types.ts +370 -0
- package/templates/runtime/state/canvas-zoom.ts +8 -0
- package/templates/runtime/state/create-template-state.test.ts +242 -0
- package/templates/runtime/state/create-template-state.ts +95 -0
- package/templates/runtime/state/keyframe-evaluation.test.ts +141 -0
- package/templates/runtime/state/keyframe-evaluation.ts +203 -0
- package/templates/runtime/state/persistence.test.ts +217 -0
- package/templates/runtime/state/persistence.ts +511 -0
- package/templates/runtime/state/reducer.test.ts +937 -0
- package/templates/runtime/state/reducer.ts +1212 -0
- package/templates/runtime/state/timeline-readiness.ts +43 -0
- package/templates/runtime/state/types.ts +242 -0
- package/templates/runtime/styles.css +125 -0
- package/templates/runtime/testing/performance.test.ts +1058 -0
- package/templates/runtime/testing/performance.ts +1078 -0
- package/templates/starter/AGENTS.md +186 -0
- package/templates/starter/LICENSE.md +98 -0
- package/templates/starter/NOTICE.md +8 -0
- package/templates/starter/docs/toolcraft/README.md +41 -0
- package/templates/starter/docs/toolcraft/acceptance-testing.md +205 -0
- package/templates/starter/docs/toolcraft/agent-worklog.md +81 -0
- package/templates/starter/docs/toolcraft/assembly-workflow.md +206 -0
- package/templates/starter/docs/toolcraft/component-rules.md +299 -0
- package/templates/starter/docs/toolcraft/custom-controls.md +71 -0
- package/templates/starter/docs/toolcraft/decision-contract.md +71 -0
- package/templates/starter/docs/toolcraft/performance.md +112 -0
- package/templates/starter/docs/toolcraft/renderer-technique.md +48 -0
- package/templates/starter/docs/toolcraft/schema-reference.md +265 -0
- package/templates/starter/docs/toolcraft/workflow.md +87 -0
- package/templates/starter/e2e/app-browser-acceptance.spec.ts +785 -0
- package/templates/starter/e2e/app-controls.spec.ts +41 -0
- package/templates/starter/e2e/app-performance.spec.ts +326 -0
- package/templates/starter/e2e/canvas-handle-helpers.ts +244 -0
- package/templates/starter/e2e/performance-helpers.ts +612 -0
- package/templates/starter/e2e/product-observable-helpers.ts +170 -0
- package/templates/starter/index.html +12 -0
- package/templates/starter/package.json +52 -0
- package/templates/starter/playwright.config.ts +43 -0
- package/templates/starter/scripts/check-ai-skills.mjs +95 -0
- package/templates/starter/scripts/check-toolcraft-docs.mjs +159 -0
- package/templates/starter/scripts/check-toolcraft-integrity.mjs +232 -0
- package/templates/starter/scripts/run-vite-on-free-port.mjs +48 -0
- package/templates/starter/scripts/toolcraft-port.mjs +54 -0
- package/templates/starter/scripts/toolcraft-port.test.mjs +73 -0
- package/templates/starter/src/app/starter-acceptance.test.ts +5959 -0
- package/templates/starter/src/app/starter-acceptance.ts +2646 -0
- package/templates/starter/src/app/starter-performance.test.ts +1390 -0
- package/templates/starter/src/app/starter-performance.ts +12 -0
- package/templates/starter/src/app/starter-schema.test.ts +70 -0
- package/templates/starter/src/app/starter-schema.ts +15 -0
- package/templates/starter/src/main.tsx +18 -0
- package/templates/starter/src/router.tsx +16 -0
- package/templates/starter/src/routes/index.tsx +7 -0
- package/templates/starter/src/routes/root.tsx +19 -0
- package/templates/starter/src/styles.css +120 -0
- package/templates/starter/tsconfig.json +11 -0
- package/templates/starter/vite.config.ts +13 -0
- package/templates/ui/components/composites/accordion.tsx +73 -0
- package/templates/ui/components/composites/alert-dialog.tsx +190 -0
- package/templates/ui/components/composites/alert.tsx +74 -0
- package/templates/ui/components/composites/aspect-ratio.tsx +22 -0
- package/templates/ui/components/composites/avatar.tsx +98 -0
- package/templates/ui/components/composites/badge.tsx +69 -0
- package/templates/ui/components/composites/breadcrumb.tsx +106 -0
- package/templates/ui/components/composites/card.tsx +91 -0
- package/templates/ui/components/composites/combobox.tsx +486 -0
- package/templates/ui/components/composites/command.tsx +296 -0
- package/templates/ui/components/composites/context-menu.tsx +247 -0
- package/templates/ui/components/composites/dialog.tsx +282 -0
- package/templates/ui/components/composites/dropdown-menu.tsx +299 -0
- package/templates/ui/components/composites/empty.tsx +110 -0
- package/templates/ui/components/composites/hover-card.tsx +44 -0
- package/templates/ui/components/composites/index.ts +30 -0
- package/templates/ui/components/composites/menubar.tsx +214 -0
- package/templates/ui/components/composites/navigation-menu.tsx +167 -0
- package/templates/ui/components/composites/pagination.tsx +131 -0
- package/templates/ui/components/composites/progress.tsx +72 -0
- package/templates/ui/components/composites/radio-group.tsx +84 -0
- package/templates/ui/components/composites/resizable.tsx +42 -0
- package/templates/ui/components/composites/sheet.tsx +153 -0
- package/templates/ui/components/composites/sidebar-structural.tsx +310 -0
- package/templates/ui/components/composites/sidebar.tsx +431 -0
- package/templates/ui/components/composites/sonner.tsx +35 -0
- package/templates/ui/components/composites/spinner.tsx +43 -0
- package/templates/ui/components/composites/table.tsx +108 -0
- package/templates/ui/components/composites/tabs.tsx +83 -0
- package/templates/ui/components/control-layout/index.tsx +437 -0
- package/templates/ui/components/controls/actions/actions-control.tsx +139 -0
- package/templates/ui/components/controls/actions/index.ts +9 -0
- package/templates/ui/components/controls/anchor-grid/anchor-grid-control.tsx +107 -0
- package/templates/ui/components/controls/anchor-grid/index.ts +4 -0
- package/templates/ui/components/controls/boolean/boolean-controls.tsx +79 -0
- package/templates/ui/components/controls/boolean/index.ts +4 -0
- package/templates/ui/components/controls/channel-mixer/channel-mixer-control.tsx +95 -0
- package/templates/ui/components/controls/channel-mixer/index.ts +4 -0
- package/templates/ui/components/controls/channel-tabs/channel-tabs.tsx +42 -0
- package/templates/ui/components/controls/channel-tabs/index.ts +6 -0
- package/templates/ui/components/controls/code-textarea/code-textarea-control.tsx +90 -0
- package/templates/ui/components/controls/code-textarea/index.ts +4 -0
- package/templates/ui/components/controls/color/color-control.tsx +571 -0
- package/templates/ui/components/controls/color/color-picker-popover.tsx +104 -0
- package/templates/ui/components/controls/color/index.ts +41 -0
- package/templates/ui/components/controls/color/palette-control-data.ts +436 -0
- package/templates/ui/components/controls/color/palette-control.tsx +535 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-channel-utils.ts +162 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-interactions.ts +190 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-logic.ts +485 -0
- package/templates/ui/components/controls/color/style-guide-color-picker-parts.tsx +710 -0
- package/templates/ui/components/controls/color/style-guide-color-picker.tsx +503 -0
- package/templates/ui/components/controls/control-types.ts +43 -0
- package/templates/ui/components/controls/curves/curve-geometry.ts +355 -0
- package/templates/ui/components/controls/curves/curve-graph.tsx +390 -0
- package/templates/ui/components/controls/curves/curves-control.tsx +445 -0
- package/templates/ui/components/controls/curves/index.ts +6 -0
- package/templates/ui/components/controls/file-drop/file-drop-control.tsx +191 -0
- package/templates/ui/components/controls/file-drop/index.ts +5 -0
- package/templates/ui/components/controls/font-picker/font-catalog.json +15360 -0
- package/templates/ui/components/controls/font-picker/font-catalog.ts +116 -0
- package/templates/ui/components/controls/font-picker/font-picker-control.tsx +1202 -0
- package/templates/ui/components/controls/font-picker/font-preview-loader.ts +336 -0
- package/templates/ui/components/controls/font-picker/index.ts +24 -0
- package/templates/ui/components/controls/font-picker/use-hover-intent.ts +46 -0
- package/templates/ui/components/controls/gradient/gradient-control-utils.ts +190 -0
- package/templates/ui/components/controls/gradient/gradient-control.tsx +612 -0
- package/templates/ui/components/controls/gradient/gradient-stop-list.tsx +400 -0
- package/templates/ui/components/controls/gradient/gradient-toolbar.tsx +152 -0
- package/templates/ui/components/controls/gradient/index.ts +4 -0
- package/templates/ui/components/controls/image-picker/image-picker-control.tsx +139 -0
- package/templates/ui/components/controls/image-picker/index.ts +7 -0
- package/templates/ui/components/controls/index.ts +192 -0
- package/templates/ui/components/controls/range-input/index.ts +4 -0
- package/templates/ui/components/controls/range-input/range-input-control.tsx +173 -0
- package/templates/ui/components/controls/range-slider/index.ts +4 -0
- package/templates/ui/components/controls/range-slider/range-slider-control.tsx +122 -0
- package/templates/ui/components/controls/range-slider/range-slider-value.ts +61 -0
- package/templates/ui/components/controls/segmented/index.ts +8 -0
- package/templates/ui/components/controls/segmented/segmented-control.tsx +94 -0
- package/templates/ui/components/controls/select/index.ts +4 -0
- package/templates/ui/components/controls/select/select-control.tsx +223 -0
- package/templates/ui/components/controls/slider/index.ts +4 -0
- package/templates/ui/components/controls/slider/slider-control.tsx +150 -0
- package/templates/ui/components/controls/slider/slider-value.ts +56 -0
- package/templates/ui/components/controls/text-input/index.ts +4 -0
- package/templates/ui/components/controls/text-input/text-input-control.tsx +158 -0
- package/templates/ui/components/controls/use-measured-element-width.ts +42 -0
- package/templates/ui/components/controls/vector/index.ts +8 -0
- package/templates/ui/components/controls/vector/vector-control.tsx +401 -0
- package/templates/ui/components/panel/index.ts +19 -0
- package/templates/ui/components/panel/panel-actions.tsx +165 -0
- package/templates/ui/components/panel/panel-header.tsx +61 -0
- package/templates/ui/components/panel/panel-icon-button.tsx +96 -0
- package/templates/ui/components/panel/panel-section.tsx +168 -0
- package/templates/ui/components/panel/panel-surface.tsx +206 -0
- package/templates/ui/components/panel/panel.tsx +210 -0
- package/templates/ui/components/primitives/animated-loader.tsx +61 -0
- package/templates/ui/components/primitives/button-group.tsx +134 -0
- package/templates/ui/components/primitives/button.tsx +429 -0
- package/templates/ui/components/primitives/checkbox.tsx +62 -0
- package/templates/ui/components/primitives/editable-slider-value-label.tsx +337 -0
- package/templates/ui/components/primitives/field.tsx +225 -0
- package/templates/ui/components/primitives/index.ts +82 -0
- package/templates/ui/components/primitives/input-group.tsx +298 -0
- package/templates/ui/components/primitives/input.tsx +61 -0
- package/templates/ui/components/primitives/internal/button-loading.tsx +178 -0
- package/templates/ui/components/primitives/label.tsx +16 -0
- package/templates/ui/components/primitives/popover.tsx +126 -0
- package/templates/ui/components/primitives/portal-layer-context.tsx +33 -0
- package/templates/ui/components/primitives/primitive-arrow-icon.tsx +38 -0
- package/templates/ui/components/primitives/scroll-fade-logic.ts +441 -0
- package/templates/ui/components/primitives/scroll-fade-render.tsx +75 -0
- package/templates/ui/components/primitives/scroll-fade-types.ts +41 -0
- package/templates/ui/components/primitives/scroll-fade.tsx +72 -0
- package/templates/ui/components/primitives/select.tsx +408 -0
- package/templates/ui/components/primitives/selection-state.ts +31 -0
- package/templates/ui/components/primitives/separator.tsx +21 -0
- package/templates/ui/components/primitives/slider/index.ts +4 -0
- package/templates/ui/components/primitives/slider/slider-interaction.tsx +96 -0
- package/templates/ui/components/primitives/slider/slider-parts.tsx +303 -0
- package/templates/ui/components/primitives/slider/slider-reset.ts +152 -0
- package/templates/ui/components/primitives/slider/slider-value.ts +114 -0
- package/templates/ui/components/primitives/slider/slider.tsx +511 -0
- package/templates/ui/components/primitives/switch.tsx +35 -0
- package/templates/ui/components/primitives/textarea.tsx +49 -0
- package/templates/ui/components/primitives/toggle-group.tsx +114 -0
- package/templates/ui/components/primitives/toggle.tsx +46 -0
- package/templates/ui/components/primitives/tooltip.tsx +100 -0
- package/templates/ui/hooks/use-mobile.ts +21 -0
- package/templates/ui/index.ts +31 -0
- package/templates/ui/lib/control-outline.ts +3 -0
- package/templates/ui/lib/input-control-style.ts +131 -0
- package/templates/ui/lib/style-guide-color-utils.ts +111 -0
- package/templates/ui/lib/utils.ts +6 -0
- package/templates/ui/styles.css +291 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineToolcraftPerformance,
|
|
3
|
+
type ToolcraftPerformanceConfig,
|
|
4
|
+
} from "@repo/toolcraft-runtime";
|
|
5
|
+
|
|
6
|
+
export const starterPerformance: ToolcraftPerformanceConfig = defineToolcraftPerformance({
|
|
7
|
+
rendererStrategy: "none",
|
|
8
|
+
rendererWorkload: "none",
|
|
9
|
+
scenarios: [],
|
|
10
|
+
usesCustomRenderer: false,
|
|
11
|
+
workloadTargets: [],
|
|
12
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { starterPerformance } from "./starter-performance";
|
|
4
|
+
import { starterSchema } from "./starter-schema";
|
|
5
|
+
|
|
6
|
+
describe("starterSchema", () => {
|
|
7
|
+
it("publishes the base Toolcraft template app contract for AI assembly", () => {
|
|
8
|
+
expect(starterSchema.canvas.draggable).toBe(true);
|
|
9
|
+
expect(starterSchema.canvas.enabled).toBe(true);
|
|
10
|
+
expect(starterSchema.canvas.sizing).toEqual({ mode: "intrinsic-media" });
|
|
11
|
+
expect(starterSchema.canvas.upload).toBe(true);
|
|
12
|
+
expect(starterSchema.panels.controls).toBeUndefined();
|
|
13
|
+
expect(starterSchema.panels.layers).toBeUndefined();
|
|
14
|
+
expect(starterSchema.panels.timeline).toBeUndefined();
|
|
15
|
+
expect(starterSchema.toolbar).toEqual({
|
|
16
|
+
history: true,
|
|
17
|
+
radar: true,
|
|
18
|
+
theme: true,
|
|
19
|
+
zoom: true,
|
|
20
|
+
});
|
|
21
|
+
expect(starterSchema.assembly.components).toEqual([
|
|
22
|
+
"canvas",
|
|
23
|
+
"toolbar",
|
|
24
|
+
]);
|
|
25
|
+
expect(starterSchema.assembly.capabilities).toEqual(
|
|
26
|
+
expect.arrayContaining([
|
|
27
|
+
"canvas.draggable",
|
|
28
|
+
"canvas.upload",
|
|
29
|
+
"toolbar.history",
|
|
30
|
+
"toolbar.radar",
|
|
31
|
+
"toolbar.theme",
|
|
32
|
+
"toolbar.zoom",
|
|
33
|
+
]),
|
|
34
|
+
);
|
|
35
|
+
expect(starterSchema.assembly.capabilities).not.toContain("controls.defaults");
|
|
36
|
+
expect(starterSchema.assembly.capabilities).not.toContain("timeline.playback");
|
|
37
|
+
expect(starterSchema.assembly.capabilities).not.toContain("timeline.keyframes");
|
|
38
|
+
expect(starterSchema.assembly.commands).toEqual(
|
|
39
|
+
expect.arrayContaining([
|
|
40
|
+
"canvas.center",
|
|
41
|
+
"canvas.setViewport",
|
|
42
|
+
"canvas.zoomIn",
|
|
43
|
+
"history.undo",
|
|
44
|
+
"media.delete",
|
|
45
|
+
"media.import",
|
|
46
|
+
]),
|
|
47
|
+
);
|
|
48
|
+
expect(starterSchema.assembly.commands).not.toContain("controls.reset");
|
|
49
|
+
expect(starterSchema.assembly.commands).not.toContain("controls.setValue");
|
|
50
|
+
expect(starterSchema.assembly.commands).not.toContain("timeline.setCurrentTime");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("starts without product-specific panels or controls", () => {
|
|
54
|
+
expect(starterSchema.panels.controls).toBeUndefined();
|
|
55
|
+
expect(starterSchema.panels.layers).toBeUndefined();
|
|
56
|
+
expect(starterSchema.panels.timeline).toBeUndefined();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("does not imply timeline behavior before a product needs it", () => {
|
|
60
|
+
expect(starterSchema.assembly.capabilities).not.toContain("timeline.playback");
|
|
61
|
+
expect(starterSchema.assembly.capabilities).not.toContain("timeline.keyframes");
|
|
62
|
+
expect(starterSchema.assembly.commands).not.toContain("timeline.toggleControlKeyframes");
|
|
63
|
+
expect(starterSchema.assembly.commands).not.toContain("timeline.moveKeyframe");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("keeps starter performance empty until the generated product adds controls", () => {
|
|
67
|
+
expect(starterPerformance.scenarios).toEqual([]);
|
|
68
|
+
expect(starterPerformance.workloadTargets).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineToolcraft } from "@repo/toolcraft-runtime";
|
|
2
|
+
|
|
3
|
+
export const starterSchema = defineToolcraft({
|
|
4
|
+
canvas: {
|
|
5
|
+
enabled: true,
|
|
6
|
+
sizing: { mode: "intrinsic-media" },
|
|
7
|
+
upload: true,
|
|
8
|
+
},
|
|
9
|
+
panels: {},
|
|
10
|
+
toolbar: {
|
|
11
|
+
history: true,
|
|
12
|
+
radar: true,
|
|
13
|
+
zoom: true,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { RouterProvider } from "@tanstack/react-router";
|
|
4
|
+
|
|
5
|
+
import { router } from "./router";
|
|
6
|
+
import "./styles.css";
|
|
7
|
+
|
|
8
|
+
const rootElement = document.getElementById("root");
|
|
9
|
+
|
|
10
|
+
if (!rootElement) {
|
|
11
|
+
throw new Error("Root element #root was not found.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
createRoot(rootElement).render(
|
|
15
|
+
<React.StrictMode>
|
|
16
|
+
<RouterProvider router={router} />
|
|
17
|
+
</React.StrictMode>,
|
|
18
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRouter } from "@tanstack/react-router";
|
|
2
|
+
|
|
3
|
+
import { routeTree } from "./routes/root";
|
|
4
|
+
|
|
5
|
+
export const router = createRouter({
|
|
6
|
+
defaultPreload: "intent",
|
|
7
|
+
defaultPreloadStaleTime: 0,
|
|
8
|
+
routeTree,
|
|
9
|
+
scrollRestoration: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
declare module "@tanstack/react-router" {
|
|
13
|
+
interface Register {
|
|
14
|
+
router: typeof router;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Outlet, createRootRoute, createRoute } from "@tanstack/react-router";
|
|
2
|
+
|
|
3
|
+
import { StarterHome } from "./index";
|
|
4
|
+
|
|
5
|
+
function RootLayout(): React.JSX.Element {
|
|
6
|
+
return <Outlet />;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const rootRoute = createRootRoute({
|
|
10
|
+
component: RootLayout,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const indexRoute = createRoute({
|
|
14
|
+
component: StarterHome,
|
|
15
|
+
getParentRoute: () => rootRoute,
|
|
16
|
+
path: "/",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const routeTree = rootRoute.addChildren([indexRoute]);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@source ".";
|
|
3
|
+
@source "../../packages/ui/src";
|
|
4
|
+
@source "../../packages/toolcraft-runtime/src";
|
|
5
|
+
@import "tw-animate-css";
|
|
6
|
+
@import "@fontsource-variable/inter";
|
|
7
|
+
@import "@repo/ui/styles.css";
|
|
8
|
+
@import "@repo/toolcraft-runtime/styles.css";
|
|
9
|
+
|
|
10
|
+
@theme {
|
|
11
|
+
--spacing-field-control: 0.3125rem;
|
|
12
|
+
--text-2xs: 0.6875rem;
|
|
13
|
+
--text-2xs--line-height: 0.875rem;
|
|
14
|
+
--text-xs-plus: 0.8125rem;
|
|
15
|
+
--text-xs-plus--line-height: 1.125rem;
|
|
16
|
+
--font-sans: "Inter Variable", sans-serif;
|
|
17
|
+
--font-mono:
|
|
18
|
+
ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
19
|
+
--radius-xs: 0.125rem;
|
|
20
|
+
--radius-sm: 0.25rem;
|
|
21
|
+
--radius-md: 0.375rem;
|
|
22
|
+
--radius-lg: 0.5rem;
|
|
23
|
+
--radius-xl: 0.75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
27
|
+
@custom-variant focus-visible (&:is([data-focus-visible-mode="keyboard"] *):focus-visible);
|
|
28
|
+
|
|
29
|
+
:root {
|
|
30
|
+
--background: oklch(0 0 0);
|
|
31
|
+
--foreground: oklch(0.977 0 0);
|
|
32
|
+
--card: oklch(0.205 0 0);
|
|
33
|
+
--card-foreground: oklch(0.985 0 0);
|
|
34
|
+
--popover: oklch(0.205 0 0);
|
|
35
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
36
|
+
--link: #70b0fa;
|
|
37
|
+
--primary: oklch(0.546 0.215 262.88);
|
|
38
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
39
|
+
--secondary: oklch(0.249 0.07 263.47);
|
|
40
|
+
--secondary-foreground: oklch(0.977 0 0);
|
|
41
|
+
--muted: #262626;
|
|
42
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
43
|
+
--accent: #0c8ce9;
|
|
44
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
45
|
+
--inspect: #9149f5;
|
|
46
|
+
--attention: #ea733a;
|
|
47
|
+
--attention-foreground: oklch(0.145 0 0);
|
|
48
|
+
--destructive: hsl(0 84% 60%);
|
|
49
|
+
--destructive-foreground: var(--foreground);
|
|
50
|
+
--border: oklch(0.311 0.013 279.19);
|
|
51
|
+
--input: oklch(0.311 0.013 279.19);
|
|
52
|
+
--ring: oklch(0.556 0 0);
|
|
53
|
+
--radius: 0.375rem;
|
|
54
|
+
--button-radius-xs: 0.125rem;
|
|
55
|
+
--button-radius-sm: 0.25rem;
|
|
56
|
+
--button-radius-md: 0.375rem;
|
|
57
|
+
--button-radius-lg: 0.5rem;
|
|
58
|
+
color-scheme: dark;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@layer base {
|
|
62
|
+
* {
|
|
63
|
+
border-color: var(--border);
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
outline-color: color-mix(in oklab, var(--ring) 50%, transparent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
html {
|
|
69
|
+
font-family: var(--font-sans);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
body {
|
|
73
|
+
background-color: var(--background);
|
|
74
|
+
color: var(--foreground);
|
|
75
|
+
font-optical-sizing: auto;
|
|
76
|
+
-webkit-font-smoothing: antialiased;
|
|
77
|
+
-moz-osx-font-smoothing: grayscale;
|
|
78
|
+
text-rendering: optimizeLegibility;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
html,
|
|
83
|
+
body,
|
|
84
|
+
#root {
|
|
85
|
+
margin: 0;
|
|
86
|
+
height: 100%;
|
|
87
|
+
min-height: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#root {
|
|
91
|
+
overflow: clip;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input,
|
|
95
|
+
button {
|
|
96
|
+
font-family: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
* {
|
|
100
|
+
scrollbar-width: thin;
|
|
101
|
+
scrollbar-color: color-mix(in oklab, var(--foreground) 10%, transparent) transparent;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
*::-webkit-scrollbar {
|
|
105
|
+
width: 4px;
|
|
106
|
+
height: 4px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
*::-webkit-scrollbar-track,
|
|
110
|
+
*::-webkit-scrollbar-corner {
|
|
111
|
+
background: transparent;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
*::-webkit-scrollbar-thumb {
|
|
115
|
+
min-height: 2.75rem;
|
|
116
|
+
border: 0 solid transparent;
|
|
117
|
+
border-radius: 999px;
|
|
118
|
+
background-color: color-mix(in oklab, var(--foreground) 10%, transparent);
|
|
119
|
+
background-clip: padding-box;
|
|
120
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { defineConfig } from "vite";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [tailwindcss(), react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
2
|
+
import { CaretDownIcon, CaretUpIcon } from "@phosphor-icons/react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) {
|
|
7
|
+
return (
|
|
8
|
+
<AccordionPrimitive.Root
|
|
9
|
+
data-slot="accordion"
|
|
10
|
+
className={cn("flex w-full flex-col overflow-hidden rounded-md", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {
|
|
17
|
+
return (
|
|
18
|
+
<AccordionPrimitive.Item
|
|
19
|
+
data-slot="accordion-item"
|
|
20
|
+
className={cn(
|
|
21
|
+
"not-last:border-b not-last:border-[color:color-mix(in_oklab,var(--border)_10%,transparent)]",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function AccordionTrigger({ className, children, ...props }: AccordionPrimitive.Trigger.Props) {
|
|
30
|
+
return (
|
|
31
|
+
<AccordionPrimitive.Header className="flex">
|
|
32
|
+
<AccordionPrimitive.Trigger
|
|
33
|
+
data-slot="accordion-trigger"
|
|
34
|
+
className={cn(
|
|
35
|
+
"group/accordion-trigger relative flex flex-1 cursor-pointer items-start justify-between gap-6 border border-transparent py-2 text-left text-base/relaxed font-medium transition-all outline-none hover:no-underline aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-[color:var(--muted-foreground)]",
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
<CaretDownIcon
|
|
42
|
+
data-slot="accordion-trigger-icon"
|
|
43
|
+
className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
|
|
44
|
+
/>
|
|
45
|
+
<CaretUpIcon
|
|
46
|
+
data-slot="accordion-trigger-icon"
|
|
47
|
+
className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
|
|
48
|
+
/>
|
|
49
|
+
</AccordionPrimitive.Trigger>
|
|
50
|
+
</AccordionPrimitive.Header>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props) {
|
|
55
|
+
return (
|
|
56
|
+
<AccordionPrimitive.Panel
|
|
57
|
+
data-slot="accordion-content"
|
|
58
|
+
className="overflow-hidden text-xs-plus/relaxed text-[color:color-mix(in_oklab,var(--foreground)_60%,transparent)] data-open:animate-accordion-down data-closed:animate-accordion-up"
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
className={cn(
|
|
63
|
+
"h-(--accordion-panel-height) pt-0 pb-4 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-[color:var(--foreground)] [&_p:not(:last-child)]:mb-4",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
</div>
|
|
69
|
+
</AccordionPrimitive.Panel>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
PortalLayerContainerProvider,
|
|
8
|
+
type PortalLayerContainer,
|
|
9
|
+
usePortalLayerContainer,
|
|
10
|
+
} from "../primitives";
|
|
11
|
+
import { cn } from "../../lib/utils";
|
|
12
|
+
import { Button } from "../primitives";
|
|
13
|
+
|
|
14
|
+
function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) {
|
|
15
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) {
|
|
19
|
+
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function AlertDialogPortal({
|
|
23
|
+
children,
|
|
24
|
+
container,
|
|
25
|
+
...props
|
|
26
|
+
}: AlertDialogPrimitive.Portal.Props): React.JSX.Element {
|
|
27
|
+
const resolvedContainer = usePortalLayerContainer(container);
|
|
28
|
+
const portalNodeRef = React.useRef<HTMLDivElement | null>(null);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<AlertDialogPrimitive.Portal
|
|
32
|
+
data-slot="alert-dialog-portal"
|
|
33
|
+
container={resolvedContainer}
|
|
34
|
+
ref={portalNodeRef}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
<PortalLayerContainerProvider container={portalNodeRef}>
|
|
38
|
+
{children}
|
|
39
|
+
</PortalLayerContainerProvider>
|
|
40
|
+
</AlertDialogPrimitive.Portal>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) {
|
|
45
|
+
return (
|
|
46
|
+
<AlertDialogPrimitive.Backdrop
|
|
47
|
+
data-slot="alert-dialog-overlay"
|
|
48
|
+
className={cn(
|
|
49
|
+
"fixed inset-0 isolate z-50 bg-black/72 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function AlertDialogContent({
|
|
58
|
+
className,
|
|
59
|
+
portalContainer,
|
|
60
|
+
size = "default",
|
|
61
|
+
...props
|
|
62
|
+
}: AlertDialogPrimitive.Popup.Props & {
|
|
63
|
+
portalContainer?: PortalLayerContainer;
|
|
64
|
+
size?: "default" | "sm";
|
|
65
|
+
}) {
|
|
66
|
+
return (
|
|
67
|
+
<AlertDialogPortal container={portalContainer}>
|
|
68
|
+
<AlertDialogOverlay />
|
|
69
|
+
<AlertDialogPrimitive.Popup
|
|
70
|
+
data-slot="alert-dialog-content"
|
|
71
|
+
data-size={size}
|
|
72
|
+
className={cn(
|
|
73
|
+
"floating-popup-surface group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-2xl border p-5 popup-text-xs-plus text-[color:var(--popover-foreground)] duration-100 outline-none data-[size=default]:max-w-sm data-[size=sm]:max-w-72 data-[size=default]:sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
</AlertDialogPortal>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="alert-dialog-header"
|
|
86
|
+
className={cn(
|
|
87
|
+
"group/alert-dialog-header grid justify-items-center gap-x-3 gap-y-2 text-center sm:justify-items-start sm:text-left has-[>[data-slot=alert-dialog-media]]:grid-cols-[auto_1fr] has-[>[data-slot=alert-dialog-media]]:items-start has-[>[data-slot=alert-dialog-media]]:justify-items-start has-[>[data-slot=alert-dialog-media]]:text-left",
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
data-slot="alert-dialog-footer"
|
|
99
|
+
className={cn(
|
|
100
|
+
"mt-1 flex flex-col-reverse gap-2 border-t border-[color:color-mix(in_oklab,var(--border)_10%,transparent)] pt-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 group-data-[size=sm]/alert-dialog-content:[&>[data-slot=alert-dialog-action]]:w-full group-data-[size=sm]/alert-dialog-content:[&>[data-slot=alert-dialog-cancel]]:w-full sm:flex sm:justify-end sm:[&>[data-slot=alert-dialog-action]]:w-auto sm:[&>[data-slot=alert-dialog-cancel]]:w-auto",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">) {
|
|
109
|
+
return (
|
|
110
|
+
<div
|
|
111
|
+
data-slot="alert-dialog-media"
|
|
112
|
+
className={cn(
|
|
113
|
+
"inline-flex size-10 items-center justify-center rounded-full border border-[color:color-mix(in_oklab,var(--border)_50%,transparent)] bg-[color:color-mix(in_oklab,var(--muted)_60%,transparent)] text-[color:var(--foreground)] shadow-xs group-has-[>[data-slot=alert-dialog-media]]/alert-dialog-header:row-span-2 *:[svg:not([class*='size-'])]:size-4",
|
|
114
|
+
className,
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function AlertDialogTitle({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
125
|
+
return (
|
|
126
|
+
<AlertDialogPrimitive.Title
|
|
127
|
+
data-slot="alert-dialog-title"
|
|
128
|
+
className={cn(
|
|
129
|
+
"popup-text-xs-plus leading-tight font-semibold tracking-tight group-has-[>[data-slot=alert-dialog-media]]/alert-dialog-header:col-start-2",
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function AlertDialogDescription({
|
|
138
|
+
className,
|
|
139
|
+
...props
|
|
140
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
141
|
+
return (
|
|
142
|
+
<AlertDialogPrimitive.Description
|
|
143
|
+
data-slot="alert-dialog-description"
|
|
144
|
+
className={cn(
|
|
145
|
+
"popup-text-xs-plus leading-relaxed text-balance text-[color:var(--muted-foreground)] group-has-[>[data-slot=alert-dialog-media]]/alert-dialog-header:col-start-2 md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-[color:var(--foreground)]",
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof Button>) {
|
|
154
|
+
return <Button data-slot="alert-dialog-action" className={cn(className)} {...props} />;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function AlertDialogCancel({
|
|
158
|
+
className,
|
|
159
|
+
variant = "outline",
|
|
160
|
+
size = "default",
|
|
161
|
+
...props
|
|
162
|
+
}: AlertDialogPrimitive.Close.Props &
|
|
163
|
+
Pick<
|
|
164
|
+
React.ComponentProps<typeof Button>,
|
|
165
|
+
"loading" | "loadingHeight" | "loadingIndicatorClassName" | "loadingWidth" | "size" | "variant"
|
|
166
|
+
>) {
|
|
167
|
+
return (
|
|
168
|
+
<AlertDialogPrimitive.Close
|
|
169
|
+
data-slot="alert-dialog-cancel"
|
|
170
|
+
className={cn(className)}
|
|
171
|
+
render={<Button variant={variant} size={size} />}
|
|
172
|
+
{...props}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export {
|
|
178
|
+
AlertDialog,
|
|
179
|
+
AlertDialogAction,
|
|
180
|
+
AlertDialogCancel,
|
|
181
|
+
AlertDialogContent,
|
|
182
|
+
AlertDialogDescription,
|
|
183
|
+
AlertDialogFooter,
|
|
184
|
+
AlertDialogHeader,
|
|
185
|
+
AlertDialogMedia,
|
|
186
|
+
AlertDialogOverlay,
|
|
187
|
+
AlertDialogPortal,
|
|
188
|
+
AlertDialogTitle,
|
|
189
|
+
AlertDialogTrigger,
|
|
190
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(
|
|
7
|
+
"group/alert relative grid w-full gap-0.5 rounded-lg border border-[color:color-mix(in_oklab,var(--border)_12%,transparent)] px-2 py-1.5 text-left text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-[color:var(--card)] text-[color:var(--card-foreground)]",
|
|
12
|
+
destructive:
|
|
13
|
+
"border-[color:color-mix(in_oklab,var(--destructive)_40%,transparent)] bg-[color:color-mix(in_oklab,var(--destructive)_10%,transparent)] text-[color:var(--foreground)] [&>svg]:text-[color:var(--destructive)]",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
function Alert({
|
|
23
|
+
className,
|
|
24
|
+
variant,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
data-slot="alert"
|
|
30
|
+
data-variant={variant ?? undefined}
|
|
31
|
+
role="alert"
|
|
32
|
+
className={cn(alertVariants({ variant }), className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
data-slot="alert-title"
|
|
42
|
+
className={cn(
|
|
43
|
+
"font-medium group-has-[>svg]/alert:col-start-2 group-data-[variant=destructive]/alert:text-[color:var(--destructive)] [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-[color:var(--foreground)]",
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="alert-description"
|
|
55
|
+
className={cn(
|
|
56
|
+
"text-xs/relaxed text-balance text-[color:var(--muted-foreground)] group-data-[variant=destructive]/alert:text-[color:color-mix(in_oklab,var(--destructive)_90%,transparent)] md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-[color:var(--foreground)] [&_p:not(:last-child)]:mb-4",
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="alert-action"
|
|
68
|
+
className={cn("absolute top-1.5 right-2", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils";
|
|
2
|
+
|
|
3
|
+
function AspectRatio({
|
|
4
|
+
ratio,
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<"div"> & { ratio: number }) {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
data-slot="aspect-ratio"
|
|
11
|
+
style={
|
|
12
|
+
{
|
|
13
|
+
"--ratio": ratio,
|
|
14
|
+
} as React.CSSProperties
|
|
15
|
+
}
|
|
16
|
+
className={cn("relative aspect-(--ratio)", className)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { AspectRatio };
|