@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,43 @@
|
|
|
1
|
+
import type { ResolvedToolcraftAppSchema } from "../schema/types";
|
|
2
|
+
import type {
|
|
3
|
+
ToolcraftMediaAsset,
|
|
4
|
+
ToolcraftTimelineState,
|
|
5
|
+
} from "./types";
|
|
6
|
+
|
|
7
|
+
export function doesTimelineRequireMedia(
|
|
8
|
+
schema: ResolvedToolcraftAppSchema,
|
|
9
|
+
): boolean {
|
|
10
|
+
return Boolean(
|
|
11
|
+
schema.panels.timeline?.enabled &&
|
|
12
|
+
schema.canvas.enabled &&
|
|
13
|
+
schema.canvas.upload &&
|
|
14
|
+
schema.canvas.sizing.mode === "intrinsic-media",
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isTimelineReadyForPlayback(
|
|
19
|
+
schema: ResolvedToolcraftAppSchema,
|
|
20
|
+
mediaAssets: readonly ToolcraftMediaAsset[],
|
|
21
|
+
): boolean {
|
|
22
|
+
return !doesTimelineRequireMedia(schema) || mediaAssets.length > 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getMediaReadyTimelineState(
|
|
26
|
+
schema: ResolvedToolcraftAppSchema,
|
|
27
|
+
timeline: ToolcraftTimelineState,
|
|
28
|
+
mediaAssets: readonly ToolcraftMediaAsset[],
|
|
29
|
+
): ToolcraftTimelineState {
|
|
30
|
+
if (isTimelineReadyForPlayback(schema, mediaAssets)) {
|
|
31
|
+
return timeline;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!timeline.isPlaying && timeline.currentTimeSeconds === 0) {
|
|
35
|
+
return timeline;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
...timeline,
|
|
40
|
+
currentTimeSeconds: 0,
|
|
41
|
+
isPlaying: false,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import type { ToolcraftCanvasSize, ResolvedToolcraftAppSchema } from "../schema/types";
|
|
2
|
+
|
|
3
|
+
export type ToolcraftCommand =
|
|
4
|
+
| {
|
|
5
|
+
history?: ToolcraftHistoryMode;
|
|
6
|
+
historyGroup?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
target: string;
|
|
9
|
+
type: "controls.setValue";
|
|
10
|
+
value: unknown;
|
|
11
|
+
}
|
|
12
|
+
| { type: "controls.apply" }
|
|
13
|
+
| { type: "controls.reset" }
|
|
14
|
+
| { insertIndex?: number; layer?: ToolcraftLayerDraft; type: "layers.add" }
|
|
15
|
+
| { layerId: string; type: "layers.delete" }
|
|
16
|
+
| { layerIds: string[]; parentGroupId: string | null; type: "layers.moveToGroup" }
|
|
17
|
+
| { layerId: string; type: "layers.select" }
|
|
18
|
+
| { layerId: string; name: string; type: "layers.rename" }
|
|
19
|
+
| { layerId: string; type: "layers.toggleCollapsed" }
|
|
20
|
+
| { layerId: string; type: "layers.toggleVisibility" }
|
|
21
|
+
| { layers: ToolcraftLayer[]; selectedLayerId?: string | null; type: "layers.reorder" }
|
|
22
|
+
| { delta: ToolcraftPoint; type: "canvas.panBy" }
|
|
23
|
+
| { offset: ToolcraftPoint; type: "canvas.setOffset" }
|
|
24
|
+
| { size: ToolcraftCanvasSize; type: "canvas.setSize" }
|
|
25
|
+
| { type: "canvas.center" }
|
|
26
|
+
| { type: "canvas.zoomIn" }
|
|
27
|
+
| { type: "canvas.zoomOut" }
|
|
28
|
+
| { type: "canvas.zoomReset" }
|
|
29
|
+
| { offset: ToolcraftPoint; type: "canvas.setViewport"; zoom: number }
|
|
30
|
+
| {
|
|
31
|
+
offset: ToolcraftPanelState["offset"];
|
|
32
|
+
panelId: ToolcraftPanelId;
|
|
33
|
+
type: "panels.setOffset";
|
|
34
|
+
}
|
|
35
|
+
| { panelId: ToolcraftPanelId; type: "panels.resetOffset" }
|
|
36
|
+
| {
|
|
37
|
+
asset: Omit<ToolcraftMediaAsset, "id" | "layerId"> & {
|
|
38
|
+
id?: string;
|
|
39
|
+
layerId?: string;
|
|
40
|
+
layerName?: string;
|
|
41
|
+
};
|
|
42
|
+
type: "media.import";
|
|
43
|
+
}
|
|
44
|
+
| { mediaId: string; type: "media.delete" }
|
|
45
|
+
| { currentTimeSeconds: number; type: "timeline.setCurrentTime" }
|
|
46
|
+
| { durationSeconds: number; type: "timeline.setDuration" }
|
|
47
|
+
| { expanded: boolean; type: "timeline.setExpanded" }
|
|
48
|
+
| { isPlaying: boolean; type: "timeline.setPlaying" }
|
|
49
|
+
| { type: "timeline.toggleExpanded" }
|
|
50
|
+
| { type: "timeline.togglePlayback" }
|
|
51
|
+
| { type: "timeline.toggleLoop" }
|
|
52
|
+
| { keyframeId: string | null; type: "timeline.selectKeyframe" }
|
|
53
|
+
| { keyframeId: string; type: "timeline.deleteKeyframe" }
|
|
54
|
+
| { controlId: string; type: "timeline.deleteControlKeyframes" }
|
|
55
|
+
| {
|
|
56
|
+
controlId: string;
|
|
57
|
+
controlLabel: string;
|
|
58
|
+
timeSeconds?: number;
|
|
59
|
+
type: "timeline.toggleControlKeyframes";
|
|
60
|
+
value: unknown;
|
|
61
|
+
valueLabel: string;
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
controlId: string;
|
|
65
|
+
controlLabel: string;
|
|
66
|
+
timeSeconds?: number;
|
|
67
|
+
type: "timeline.upsertControlKeyframe";
|
|
68
|
+
value: unknown;
|
|
69
|
+
valueLabel: string;
|
|
70
|
+
}
|
|
71
|
+
| { keyframeId: string; timeSeconds: number; type: "timeline.moveKeyframe" }
|
|
72
|
+
| {
|
|
73
|
+
easing: ToolcraftTimelineKeyframeEasing;
|
|
74
|
+
keyframeId: string;
|
|
75
|
+
type: "timeline.changeKeyframeEasing";
|
|
76
|
+
}
|
|
77
|
+
| { type: "history.undo" }
|
|
78
|
+
| { type: "history.redo" };
|
|
79
|
+
|
|
80
|
+
export const toolcraftRuntimeCommandTypes = [
|
|
81
|
+
"controls.setValue",
|
|
82
|
+
"controls.apply",
|
|
83
|
+
"controls.reset",
|
|
84
|
+
"layers.add",
|
|
85
|
+
"layers.delete",
|
|
86
|
+
"layers.moveToGroup",
|
|
87
|
+
"layers.select",
|
|
88
|
+
"layers.rename",
|
|
89
|
+
"layers.toggleCollapsed",
|
|
90
|
+
"layers.toggleVisibility",
|
|
91
|
+
"layers.reorder",
|
|
92
|
+
"canvas.panBy",
|
|
93
|
+
"canvas.setOffset",
|
|
94
|
+
"canvas.setSize",
|
|
95
|
+
"canvas.center",
|
|
96
|
+
"canvas.zoomIn",
|
|
97
|
+
"canvas.zoomOut",
|
|
98
|
+
"canvas.zoomReset",
|
|
99
|
+
"canvas.setViewport",
|
|
100
|
+
"panels.setOffset",
|
|
101
|
+
"panels.resetOffset",
|
|
102
|
+
"media.import",
|
|
103
|
+
"media.delete",
|
|
104
|
+
"timeline.setCurrentTime",
|
|
105
|
+
"timeline.setDuration",
|
|
106
|
+
"timeline.setExpanded",
|
|
107
|
+
"timeline.setPlaying",
|
|
108
|
+
"timeline.toggleExpanded",
|
|
109
|
+
"timeline.togglePlayback",
|
|
110
|
+
"timeline.toggleLoop",
|
|
111
|
+
"timeline.selectKeyframe",
|
|
112
|
+
"timeline.deleteKeyframe",
|
|
113
|
+
"timeline.deleteControlKeyframes",
|
|
114
|
+
"timeline.toggleControlKeyframes",
|
|
115
|
+
"timeline.upsertControlKeyframe",
|
|
116
|
+
"timeline.moveKeyframe",
|
|
117
|
+
"timeline.changeKeyframeEasing",
|
|
118
|
+
"history.undo",
|
|
119
|
+
"history.redo",
|
|
120
|
+
] as const satisfies readonly ToolcraftCommand["type"][];
|
|
121
|
+
|
|
122
|
+
export type ToolcraftPoint = {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type ToolcraftCanvasState = {
|
|
128
|
+
offset: ToolcraftPoint;
|
|
129
|
+
size: ToolcraftCanvasSize;
|
|
130
|
+
zoom: number;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export type ToolcraftLayerKind = "group" | "layer";
|
|
134
|
+
|
|
135
|
+
export type ToolcraftLayer = {
|
|
136
|
+
collapsed?: boolean;
|
|
137
|
+
displayName?: string;
|
|
138
|
+
id: string;
|
|
139
|
+
kind?: ToolcraftLayerKind;
|
|
140
|
+
name: string;
|
|
141
|
+
parentGroupId?: string;
|
|
142
|
+
visible: boolean;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type ToolcraftLayerDraft = {
|
|
146
|
+
collapsed?: boolean;
|
|
147
|
+
displayName?: string;
|
|
148
|
+
id?: string;
|
|
149
|
+
kind?: ToolcraftLayerKind;
|
|
150
|
+
name?: string;
|
|
151
|
+
parentGroupId?: string;
|
|
152
|
+
visible?: boolean;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type ToolcraftMediaAsset = {
|
|
156
|
+
dataUrl: string;
|
|
157
|
+
fileName: string;
|
|
158
|
+
id: string;
|
|
159
|
+
layerId: string;
|
|
160
|
+
mimeType: string;
|
|
161
|
+
position: ToolcraftPoint;
|
|
162
|
+
size: ToolcraftCanvasSize;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type ToolcraftHistoryPatch = {
|
|
166
|
+
after: Record<string, unknown>;
|
|
167
|
+
before: Record<string, unknown>;
|
|
168
|
+
group?: string;
|
|
169
|
+
label: string;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type ToolcraftHistoryMode = "merge" | "record" | "skip";
|
|
173
|
+
|
|
174
|
+
export type ToolcraftTimelineBezierControlPoints = [number, number, number, number];
|
|
175
|
+
|
|
176
|
+
export type ToolcraftTimelineKeyframeEasing =
|
|
177
|
+
| {
|
|
178
|
+
controlPoints: ToolcraftTimelineBezierControlPoints;
|
|
179
|
+
type: "bezier";
|
|
180
|
+
}
|
|
181
|
+
| {
|
|
182
|
+
type: "step";
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type ToolcraftTimelineKeyframe = {
|
|
186
|
+
controlId: string;
|
|
187
|
+
controlLabel: string;
|
|
188
|
+
easing?: ToolcraftTimelineKeyframeEasing;
|
|
189
|
+
id: string;
|
|
190
|
+
timeSeconds: number;
|
|
191
|
+
value?: unknown;
|
|
192
|
+
valueLabel: string;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type ToolcraftTimelineKeyframeGroup = {
|
|
196
|
+
controlId: string;
|
|
197
|
+
keyframes: ToolcraftTimelineKeyframe[];
|
|
198
|
+
label: string;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export type ToolcraftTimelineState = {
|
|
202
|
+
currentTimeSeconds: number;
|
|
203
|
+
durationSeconds: number;
|
|
204
|
+
expanded: boolean;
|
|
205
|
+
isLooping: boolean;
|
|
206
|
+
isPlaying: boolean;
|
|
207
|
+
keyframeGroups: ToolcraftTimelineKeyframeGroup[];
|
|
208
|
+
selectedKeyframeId: string | null;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export type ToolcraftPanelId = "controls" | "layers" | "timeline" | "toolbar";
|
|
212
|
+
|
|
213
|
+
export type ToolcraftPanelState = {
|
|
214
|
+
collapsed?: boolean;
|
|
215
|
+
offset: { x: number; y: number };
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export type ToolcraftState = {
|
|
219
|
+
canvas: ToolcraftCanvasState;
|
|
220
|
+
defaults: Record<string, unknown>;
|
|
221
|
+
history: {
|
|
222
|
+
redo: ToolcraftHistoryPatch[];
|
|
223
|
+
undo: ToolcraftHistoryPatch[];
|
|
224
|
+
};
|
|
225
|
+
layers: ToolcraftLayer[];
|
|
226
|
+
mediaAssets: ToolcraftMediaAsset[];
|
|
227
|
+
panels: Record<ToolcraftPanelId, ToolcraftPanelState>;
|
|
228
|
+
schema: ResolvedToolcraftAppSchema;
|
|
229
|
+
selectedLayerId: string | null;
|
|
230
|
+
timeline: ToolcraftTimelineState;
|
|
231
|
+
values: Record<string, unknown>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type ToolcraftInitialState = {
|
|
235
|
+
canvas?: Partial<ToolcraftCanvasState>;
|
|
236
|
+
layers?: ToolcraftLayer[];
|
|
237
|
+
mediaAssets?: ToolcraftMediaAsset[];
|
|
238
|
+
panels?: Partial<Record<ToolcraftPanelId, Partial<ToolcraftPanelState>>>;
|
|
239
|
+
selectedLayerId?: string | null;
|
|
240
|
+
timeline?: Partial<ToolcraftTimelineState>;
|
|
241
|
+
values?: Record<string, unknown>;
|
|
242
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[data-toolcraft-theme][data-toolcraft-theme] {
|
|
2
|
+
--background: oklch(1 0 0);
|
|
3
|
+
--foreground: oklch(0.145 0 0);
|
|
4
|
+
--bg-foreground: var(--foreground);
|
|
5
|
+
--card: oklch(1 0 0);
|
|
6
|
+
--card-foreground: oklch(0.145 0 0);
|
|
7
|
+
--popover: oklch(1 0 0);
|
|
8
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
9
|
+
--link: #70b0fa;
|
|
10
|
+
--primary: oklch(0.205 0 0);
|
|
11
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
12
|
+
--secondary: var(--foreground);
|
|
13
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
14
|
+
--muted: #f8f8f8;
|
|
15
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
16
|
+
--accent: #0c8ce9;
|
|
17
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
18
|
+
--inspect: #cbaaf9;
|
|
19
|
+
--attention: #ea733a;
|
|
20
|
+
--attention-foreground: oklch(0.145 0 0);
|
|
21
|
+
--destructive: hsl(0 84% 60%);
|
|
22
|
+
--destructive-foreground: var(--foreground);
|
|
23
|
+
--border: var(--foreground);
|
|
24
|
+
--input: var(--foreground);
|
|
25
|
+
--ring: oklch(0.708 0 0);
|
|
26
|
+
--chart-1: oklch(0.809 0.105 251.813);
|
|
27
|
+
--chart-2: oklch(0.623 0.214 259.815);
|
|
28
|
+
--chart-3: oklch(0.546 0.245 262.881);
|
|
29
|
+
--chart-4: oklch(0.488 0.243 264.376);
|
|
30
|
+
--chart-5: oklch(0.424 0.199 265.638);
|
|
31
|
+
--sidebar: oklch(0.985 0 0);
|
|
32
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
33
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
34
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
35
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
36
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
37
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
38
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
39
|
+
|
|
40
|
+
--color-background: var(--background);
|
|
41
|
+
--color-foreground: var(--foreground);
|
|
42
|
+
--color-card: var(--card);
|
|
43
|
+
--color-card-foreground: var(--card-foreground);
|
|
44
|
+
--color-popover: var(--popover);
|
|
45
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
46
|
+
--color-primary: var(--primary);
|
|
47
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
48
|
+
--color-secondary: var(--secondary);
|
|
49
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
50
|
+
--color-link: var(--link);
|
|
51
|
+
--color-muted: var(--muted);
|
|
52
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
53
|
+
--color-accent: var(--accent);
|
|
54
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
55
|
+
--color-destructive: var(--destructive);
|
|
56
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
57
|
+
--color-border: var(--border);
|
|
58
|
+
--color-input: var(--input);
|
|
59
|
+
--color-ring: var(--ring);
|
|
60
|
+
--color-chart-1: var(--chart-1);
|
|
61
|
+
--color-chart-2: var(--chart-2);
|
|
62
|
+
--color-chart-3: var(--chart-3);
|
|
63
|
+
--color-chart-4: var(--chart-4);
|
|
64
|
+
--color-chart-5: var(--chart-5);
|
|
65
|
+
|
|
66
|
+
color: var(--foreground);
|
|
67
|
+
color-scheme: light;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-toolcraft-theme][data-toolcraft-theme],
|
|
71
|
+
[data-toolcraft-theme][data-toolcraft-theme] *,
|
|
72
|
+
[data-toolcraft-theme][data-toolcraft-theme] *::before,
|
|
73
|
+
[data-toolcraft-theme][data-toolcraft-theme] *::after {
|
|
74
|
+
cursor: default !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[data-toolcraft-theme='dark'][data-toolcraft-theme] {
|
|
78
|
+
--background: oklch(0.145 0 0);
|
|
79
|
+
--foreground: oklch(0.985 0 0);
|
|
80
|
+
--bg-foreground: var(--foreground);
|
|
81
|
+
--card: oklch(0.205 0 0);
|
|
82
|
+
--card-foreground: oklch(0.985 0 0);
|
|
83
|
+
--popover: oklch(0.205 0 0);
|
|
84
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
85
|
+
--link: #70b0fa;
|
|
86
|
+
--primary: oklch(0.922 0 0);
|
|
87
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
88
|
+
--secondary: var(--foreground);
|
|
89
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
90
|
+
--muted: #262626;
|
|
91
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
92
|
+
--accent: #0c8ce9;
|
|
93
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
94
|
+
--inspect: #9149f5;
|
|
95
|
+
--attention: #ea733a;
|
|
96
|
+
--attention-foreground: oklch(0.145 0 0);
|
|
97
|
+
--destructive: hsl(0 84% 60%);
|
|
98
|
+
--destructive-foreground: var(--foreground);
|
|
99
|
+
--border: var(--foreground);
|
|
100
|
+
--input: var(--foreground);
|
|
101
|
+
--ring: oklch(0.556 0 0);
|
|
102
|
+
--chart-1: oklch(0.809 0.105 251.813);
|
|
103
|
+
--chart-2: oklch(0.623 0.214 259.815);
|
|
104
|
+
--chart-3: oklch(0.546 0.245 262.881);
|
|
105
|
+
--chart-4: oklch(0.488 0.243 264.376);
|
|
106
|
+
--chart-5: oklch(0.424 0.199 265.638);
|
|
107
|
+
--sidebar: oklch(0.205 0 0);
|
|
108
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
109
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
110
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
111
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
112
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
113
|
+
--sidebar-border: oklch(0.985 0 0);
|
|
114
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
115
|
+
|
|
116
|
+
color-scheme: dark;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[data-toolcraft-canvas-content] {
|
|
120
|
+
color-scheme: normal;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
[data-toolcraft-generated-output] {
|
|
124
|
+
color-scheme: normal;
|
|
125
|
+
}
|