@pixel-point/toolcraft 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -9
- package/package.json +1 -1
- package/src/generate.mjs +14 -6
- package/src/generate.test.mjs +28 -0
- package/templates/runtime/contracts/component-contracts.test.ts +148 -34
- package/templates/runtime/contracts/component-contracts.ts +79 -38
- package/templates/runtime/contracts/decision-contracts.test.ts +33 -1
- package/templates/runtime/contracts/decision-contracts.ts +19 -6
- package/templates/runtime/export/export.test.ts +63 -0
- package/templates/runtime/export/export.ts +55 -0
- package/templates/runtime/index.ts +1 -0
- package/templates/runtime/react/canvas-shell.test.tsx +58 -4
- package/templates/runtime/react/canvas-shell.tsx +31 -9
- package/templates/runtime/react/controls-panel.test.tsx +474 -27
- package/templates/runtime/react/controls-panel.tsx +71 -26
- package/templates/runtime/react/runtime-public-api.test.tsx +1 -1
- package/templates/runtime/react/settings-transfer.test.ts +4 -0
- package/templates/runtime/react/settings-transfer.ts +6 -1
- package/templates/runtime/react/timeline-panel.test.tsx +14 -0
- package/templates/runtime/react/timeline-panel.tsx +44 -7
- package/templates/runtime/react/toolcraft-app.integration.test.tsx +9 -1
- package/templates/runtime/react/toolcraft-app.test.tsx +112 -3
- package/templates/runtime/react/toolcraft-app.tsx +56 -37
- package/templates/runtime/schema/define-toolcraft.test.ts +225 -173
- package/templates/runtime/schema/define-toolcraft.ts +117 -247
- package/templates/runtime/schema/runtime-targets.ts +21 -0
- package/templates/runtime/schema/types.ts +41 -0
- package/templates/runtime/state/create-template-state.test.ts +156 -0
- package/templates/runtime/state/create-template-state.ts +38 -8
- package/templates/runtime/state/media-defaults.ts +105 -0
- package/templates/runtime/state/persistence.test.ts +58 -0
- package/templates/runtime/state/persistence.ts +105 -1
- package/templates/runtime/state/reducer.test.ts +280 -4
- package/templates/runtime/state/reducer.ts +195 -9
- package/templates/runtime/state/timeline-loop.test.ts +71 -0
- package/templates/runtime/state/timeline-loop.ts +35 -0
- package/templates/runtime/state/types.ts +27 -0
- package/templates/runtime/testing/performance.test.ts +657 -2
- package/templates/runtime/testing/performance.ts +789 -49
- package/templates/starter/AGENTS.md +22 -16
- package/templates/starter/docs/toolcraft/README.md +8 -4
- package/templates/starter/docs/toolcraft/acceptance-testing.md +38 -7
- package/templates/starter/docs/toolcraft/agent-worklog.md +1 -0
- package/templates/starter/docs/toolcraft/assembly-workflow.md +51 -20
- package/templates/starter/docs/toolcraft/component-rules.md +49 -37
- package/templates/starter/docs/toolcraft/decision-contract.md +2 -0
- package/templates/starter/docs/toolcraft/performance.md +30 -10
- package/templates/starter/docs/toolcraft/schema-reference.md +134 -33
- package/templates/starter/docs/toolcraft/workflow.md +5 -2
- package/templates/starter/e2e/app-browser-acceptance.spec.ts +3 -3
- package/templates/starter/e2e/app-performance.spec.ts +55 -2
- package/templates/starter/e2e/performance-helpers.ts +45 -0
- package/templates/starter/index.html +1 -0
- package/templates/starter/package.json +1 -0
- package/templates/starter/playwright.config.ts +1 -1
- package/templates/starter/scripts/check-toolcraft-docs.mjs +1 -0
- package/templates/starter/scripts/run-vite-on-free-port.mjs +82 -16
- package/templates/starter/scripts/toolcraft-port.mjs +178 -0
- package/templates/starter/scripts/toolcraft-port.test.mjs +147 -0
- package/templates/starter/src/app/starter-acceptance.test.ts +2573 -313
- package/templates/starter/src/app/starter-acceptance.ts +978 -81
- package/templates/starter/src/app/starter-performance.test.ts +111 -7
- package/templates/starter/src/app/starter-performance.ts +5 -0
- package/templates/starter/src/app/starter-schema.test.ts +32 -7
- package/templates/starter/src/app/starter-schema.ts +6 -2
- package/templates/starter/vite.config.ts +58 -2
- package/templates/ui/components/controls/actions/actions-control.tsx +46 -3
- package/templates/ui/components/controls/color/palette-control.tsx +34 -4
- package/templates/ui/components/controls/file-drop/file-drop-control.tsx +186 -14
- package/templates/ui/components/controls/file-drop/index.ts +6 -1
- package/templates/ui/components/controls/index.ts +2 -0
- package/templates/ui/components/controls/range-slider/range-slider-value.ts +3 -1
- package/templates/ui/components/controls/select/select-control.tsx +4 -26
- package/templates/ui/components/controls/vector/vector-control.tsx +25 -4
- package/templates/ui/components/panel/panel-actions.tsx +1 -1
|
@@ -13,6 +13,7 @@ import { ToolcraftRoot } from "./toolcraft-root";
|
|
|
13
13
|
import { LayersPanel } from "./layers-panel";
|
|
14
14
|
import { TimelinePanel } from "./timeline-panel";
|
|
15
15
|
import { ToolbarPanel } from "./toolbar-panel";
|
|
16
|
+
import { useToolcraft } from "./use-toolcraft";
|
|
16
17
|
|
|
17
18
|
export type ToolcraftAppProps = {
|
|
18
19
|
canvasContent?: React.ReactNode;
|
|
@@ -30,52 +31,70 @@ function cn(...classNames: Array<string | false | null | undefined>): string {
|
|
|
30
31
|
return classNames.filter(Boolean).join(" ");
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
function ToolcraftAppContent({
|
|
34
35
|
canvasContent,
|
|
35
36
|
className,
|
|
36
37
|
controlRenderers,
|
|
37
38
|
onPanelAction,
|
|
38
39
|
renderDefaultCanvasMedia = true,
|
|
39
|
-
schema,
|
|
40
40
|
style,
|
|
41
|
-
}: ToolcraftAppProps): React.JSX.Element {
|
|
42
|
-
const
|
|
41
|
+
}: Omit<ToolcraftAppProps, "schema">): React.JSX.Element {
|
|
42
|
+
const { state } = useToolcraft();
|
|
43
|
+
const surfaces = state.schema.assembly.surfaces;
|
|
44
|
+
const timelinePanelHidden = state.panels.timeline.hidden === true;
|
|
45
|
+
const timelinePanelVariant =
|
|
46
|
+
state.panels.timeline.extended === true ? "extended" : "compact";
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
className={cn(
|
|
51
|
+
"relative min-h-[640px] w-full overflow-hidden bg-[color:var(--background)]",
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
data-slot="toolcraft-runtime-app"
|
|
55
|
+
style={{
|
|
56
|
+
...style,
|
|
57
|
+
minWidth: toolcraftMinAppWidthPx,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{surfaces.canvas.enabled ? (
|
|
61
|
+
<CanvasShell renderDefaultMedia={renderDefaultCanvasMedia}>
|
|
62
|
+
{canvasContent}
|
|
63
|
+
</CanvasShell>
|
|
64
|
+
) : null}
|
|
65
|
+
{surfaces.panels.layers?.enabled ? (
|
|
66
|
+
<LayersPanel panelPlacement="floating" />
|
|
67
|
+
) : null}
|
|
68
|
+
{surfaces.panels.controls?.enabled ? (
|
|
69
|
+
<ControlsPanel
|
|
70
|
+
controlRenderers={controlRenderers}
|
|
71
|
+
onPanelAction={onPanelAction}
|
|
72
|
+
panelPlacement="floating"
|
|
73
|
+
/>
|
|
74
|
+
) : null}
|
|
75
|
+
{surfaces.panels.timeline?.enabled ? (
|
|
76
|
+
<div
|
|
77
|
+
data-toolcraft-timeline-panel-hidden={timelinePanelHidden ? "true" : undefined}
|
|
78
|
+
data-toolcraft-timeline-panel-variant={timelinePanelVariant}
|
|
79
|
+
hidden={timelinePanelHidden}
|
|
80
|
+
>
|
|
81
|
+
<TimelinePanel panelPlacement="floating" variant={timelinePanelVariant} />
|
|
82
|
+
</div>
|
|
83
|
+
) : null}
|
|
84
|
+
{surfaces.panels.toolbar.enabled ? (
|
|
85
|
+
<ToolbarPanel panelPlacement="floating" />
|
|
86
|
+
) : null}
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
43
90
|
|
|
91
|
+
export function ToolcraftApp({
|
|
92
|
+
schema,
|
|
93
|
+
...props
|
|
94
|
+
}: ToolcraftAppProps): React.JSX.Element {
|
|
44
95
|
return (
|
|
45
96
|
<ToolcraftRoot schema={schema}>
|
|
46
|
-
<
|
|
47
|
-
className={cn(
|
|
48
|
-
"relative min-h-[640px] w-full overflow-hidden bg-[color:var(--background)]",
|
|
49
|
-
className,
|
|
50
|
-
)}
|
|
51
|
-
data-slot="toolcraft-runtime-app"
|
|
52
|
-
style={{
|
|
53
|
-
...style,
|
|
54
|
-
minWidth: toolcraftMinAppWidthPx,
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
{surfaces.canvas.enabled ? (
|
|
58
|
-
<CanvasShell renderDefaultMedia={renderDefaultCanvasMedia}>
|
|
59
|
-
{canvasContent}
|
|
60
|
-
</CanvasShell>
|
|
61
|
-
) : null}
|
|
62
|
-
{surfaces.panels.layers?.enabled ? (
|
|
63
|
-
<LayersPanel panelPlacement="floating" />
|
|
64
|
-
) : null}
|
|
65
|
-
{surfaces.panels.controls?.enabled ? (
|
|
66
|
-
<ControlsPanel
|
|
67
|
-
controlRenderers={controlRenderers}
|
|
68
|
-
onPanelAction={onPanelAction}
|
|
69
|
-
panelPlacement="floating"
|
|
70
|
-
/>
|
|
71
|
-
) : null}
|
|
72
|
-
{surfaces.panels.timeline?.enabled ? (
|
|
73
|
-
<TimelinePanel panelPlacement="floating" />
|
|
74
|
-
) : null}
|
|
75
|
-
{surfaces.panels.toolbar.enabled ? (
|
|
76
|
-
<ToolbarPanel panelPlacement="floating" />
|
|
77
|
-
) : null}
|
|
78
|
-
</div>
|
|
97
|
+
<ToolcraftAppContent {...props} />
|
|
79
98
|
</ToolcraftRoot>
|
|
80
99
|
);
|
|
81
100
|
}
|