@smoove/studio 0.1.1
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 +60 -0
- package/dist/components/brand/brand.d.ts +9 -0
- package/dist/components/brand/brand.d.ts.map +1 -0
- package/dist/components/brand/brand.js +11 -0
- package/dist/components/brand/brand.js.map +1 -0
- package/dist/components/button/button.d.ts +21 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +20 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/icon-button.d.ts +27 -0
- package/dist/components/button/icon-button.d.ts.map +1 -0
- package/dist/components/button/icon-button.js +19 -0
- package/dist/components/button/icon-button.js.map +1 -0
- package/dist/components/header/header-title.d.ts +8 -0
- package/dist/components/header/header-title.d.ts.map +1 -0
- package/dist/components/header/header-title.js +7 -0
- package/dist/components/header/header-title.js.map +1 -0
- package/dist/components/header/header.d.ts +7 -0
- package/dist/components/header/header.d.ts.map +1 -0
- package/dist/components/header/header.js +7 -0
- package/dist/components/header/header.js.map +1 -0
- package/dist/components/header/zoom.d.ts +3 -0
- package/dist/components/header/zoom.d.ts.map +1 -0
- package/dist/components/header/zoom.js +16 -0
- package/dist/components/header/zoom.js.map +1 -0
- package/dist/components/icon/icon.d.ts +11 -0
- package/dist/components/icon/icon.d.ts.map +1 -0
- package/dist/components/icon/icon.js +7 -0
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/icon/paths.d.ts +47 -0
- package/dist/components/icon/paths.d.ts.map +1 -0
- package/dist/components/icon/paths.js +54 -0
- package/dist/components/icon/paths.js.map +1 -0
- package/dist/components/left-panel/library.d.ts +8 -0
- package/dist/components/left-panel/library.d.ts.map +1 -0
- package/dist/components/left-panel/library.js +49 -0
- package/dist/components/left-panel/library.js.map +1 -0
- package/dist/components/left-panel/sidebar-group.d.ts +12 -0
- package/dist/components/left-panel/sidebar-group.d.ts.map +1 -0
- package/dist/components/left-panel/sidebar-group.js +11 -0
- package/dist/components/left-panel/sidebar-group.js.map +1 -0
- package/dist/components/left-panel/sidebar-item.d.ts +17 -0
- package/dist/components/left-panel/sidebar-item.d.ts.map +1 -0
- package/dist/components/left-panel/sidebar-item.js +12 -0
- package/dist/components/left-panel/sidebar-item.js.map +1 -0
- package/dist/components/left-panel/sidebar.d.ts +8 -0
- package/dist/components/left-panel/sidebar.d.ts.map +1 -0
- package/dist/components/left-panel/sidebar.js +8 -0
- package/dist/components/left-panel/sidebar.js.map +1 -0
- package/dist/components/primitives/dialog.d.ts +33 -0
- package/dist/components/primitives/dialog.d.ts.map +1 -0
- package/dist/components/primitives/dialog.js +30 -0
- package/dist/components/primitives/dialog.js.map +1 -0
- package/dist/components/primitives/menu.d.ts +25 -0
- package/dist/components/primitives/menu.d.ts.map +1 -0
- package/dist/components/primitives/menu.js +31 -0
- package/dist/components/primitives/menu.js.map +1 -0
- package/dist/components/primitives/number-field.d.ts +12 -0
- package/dist/components/primitives/number-field.d.ts.map +1 -0
- package/dist/components/primitives/number-field.js +7 -0
- package/dist/components/primitives/number-field.js.map +1 -0
- package/dist/components/primitives/portal-context.d.ts +9 -0
- package/dist/components/primitives/portal-context.d.ts.map +1 -0
- package/dist/components/primitives/portal-context.js +10 -0
- package/dist/components/primitives/portal-context.js.map +1 -0
- package/dist/components/primitives/select.d.ts +14 -0
- package/dist/components/primitives/select.d.ts.map +1 -0
- package/dist/components/primitives/select.js +11 -0
- package/dist/components/primitives/select.js.map +1 -0
- package/dist/components/primitives/slider.d.ts +10 -0
- package/dist/components/primitives/slider.d.ts.map +1 -0
- package/dist/components/primitives/slider.js +7 -0
- package/dist/components/primitives/slider.js.map +1 -0
- package/dist/components/primitives/switch.d.ts +5 -0
- package/dist/components/primitives/switch.d.ts.map +1 -0
- package/dist/components/primitives/switch.js +6 -0
- package/dist/components/primitives/switch.js.map +1 -0
- package/dist/components/primitives/tabs.d.ts +23 -0
- package/dist/components/primitives/tabs.d.ts.map +1 -0
- package/dist/components/primitives/tabs.js +17 -0
- package/dist/components/primitives/tabs.js.map +1 -0
- package/dist/components/primitives/tooltip.d.ts +9 -0
- package/dist/components/primitives/tooltip.d.ts.map +1 -0
- package/dist/components/primitives/tooltip.js +11 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/render/export-frame-dialog.d.ts +8 -0
- package/dist/components/render/export-frame-dialog.d.ts.map +1 -0
- package/dist/components/render/export-frame-dialog.js +60 -0
- package/dist/components/render/export-frame-dialog.js.map +1 -0
- package/dist/components/render/render-dialog.d.ts +8 -0
- package/dist/components/render/render-dialog.d.ts.map +1 -0
- package/dist/components/render/render-dialog.js +95 -0
- package/dist/components/render/render-dialog.js.map +1 -0
- package/dist/components/render/render-queue.d.ts +5 -0
- package/dist/components/render/render-queue.d.ts.map +1 -0
- package/dist/components/render/render-queue.js +40 -0
- package/dist/components/render/render-queue.js.map +1 -0
- package/dist/components/right-panel/panel-handle.d.ts +3 -0
- package/dist/components/right-panel/panel-handle.d.ts.map +1 -0
- package/dist/components/right-panel/panel-handle.js +9 -0
- package/dist/components/right-panel/panel-handle.js.map +1 -0
- package/dist/components/right-panel/panel-tabs.d.ts +3 -0
- package/dist/components/right-panel/panel-tabs.d.ts.map +1 -0
- package/dist/components/right-panel/panel-tabs.js +26 -0
- package/dist/components/right-panel/panel-tabs.js.map +1 -0
- package/dist/components/right-panel/panel.d.ts +8 -0
- package/dist/components/right-panel/panel.d.ts.map +1 -0
- package/dist/components/right-panel/panel.js +16 -0
- package/dist/components/right-panel/panel.js.map +1 -0
- package/dist/components/schema-form/field.d.ts +9 -0
- package/dist/components/schema-form/field.d.ts.map +1 -0
- package/dist/components/schema-form/field.js +102 -0
- package/dist/components/schema-form/field.js.map +1 -0
- package/dist/components/schema-form/schema-form.d.ts +3 -0
- package/dist/components/schema-form/schema-form.d.ts.map +1 -0
- package/dist/components/schema-form/schema-form.js +18 -0
- package/dist/components/schema-form/schema-form.js.map +1 -0
- package/dist/components/stage/stage.d.ts +12 -0
- package/dist/components/stage/stage.d.ts.map +1 -0
- package/dist/components/stage/stage.js +103 -0
- package/dist/components/stage/stage.js.map +1 -0
- package/dist/components/studio/features.d.ts +4 -0
- package/dist/components/studio/features.d.ts.map +1 -0
- package/dist/components/studio/features.js +18 -0
- package/dist/components/studio/features.js.map +1 -0
- package/dist/components/studio/layout.d.ts +19 -0
- package/dist/components/studio/layout.d.ts.map +1 -0
- package/dist/components/studio/layout.js +17 -0
- package/dist/components/studio/layout.js.map +1 -0
- package/dist/components/studio/studio-context.d.ts +53 -0
- package/dist/components/studio/studio-context.d.ts.map +1 -0
- package/dist/components/studio/studio-context.js +3 -0
- package/dist/components/studio/studio-context.js.map +1 -0
- package/dist/components/studio/studio.d.ts +21 -0
- package/dist/components/studio/studio.d.ts.map +1 -0
- package/dist/components/studio/studio.js +38 -0
- package/dist/components/studio/studio.js.map +1 -0
- package/dist/components/timeline/layered-body.d.ts +8 -0
- package/dist/components/timeline/layered-body.d.ts.map +1 -0
- package/dist/components/timeline/layered-body.js +75 -0
- package/dist/components/timeline/layered-body.js.map +1 -0
- package/dist/components/timeline/region-handles.d.ts +8 -0
- package/dist/components/timeline/region-handles.d.ts.map +1 -0
- package/dist/components/timeline/region-handles.js +13 -0
- package/dist/components/timeline/region-handles.js.map +1 -0
- package/dist/components/timeline/ruler.d.ts +7 -0
- package/dist/components/timeline/ruler.d.ts.map +1 -0
- package/dist/components/timeline/ruler.js +19 -0
- package/dist/components/timeline/ruler.js.map +1 -0
- package/dist/components/timeline/scrubber.d.ts +6 -0
- package/dist/components/timeline/scrubber.d.ts.map +1 -0
- package/dist/components/timeline/scrubber.js +25 -0
- package/dist/components/timeline/scrubber.js.map +1 -0
- package/dist/components/timeline/timeline-header.d.ts +3 -0
- package/dist/components/timeline/timeline-header.d.ts.map +1 -0
- package/dist/components/timeline/timeline-header.js +36 -0
- package/dist/components/timeline/timeline-header.js.map +1 -0
- package/dist/components/timeline/timeline.d.ts +5 -0
- package/dist/components/timeline/timeline.d.ts.map +1 -0
- package/dist/components/timeline/timeline.js +16 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/timeline/transport.d.ts +5 -0
- package/dist/components/timeline/transport.d.ts.map +1 -0
- package/dist/components/timeline/transport.js +21 -0
- package/dist/components/timeline/transport.js.map +1 -0
- package/dist/components/timeline/use-scrub-surface.d.ts +20 -0
- package/dist/components/timeline/use-scrub-surface.d.ts.map +1 -0
- package/dist/components/timeline/use-scrub-surface.js +56 -0
- package/dist/components/timeline/use-scrub-surface.js.map +1 -0
- package/dist/components/toasts/toasts.d.ts +4 -0
- package/dist/components/toasts/toasts.d.ts.map +1 -0
- package/dist/components/toasts/toasts.js +22 -0
- package/dist/components/toasts/toasts.js.map +1 -0
- package/dist/hooks/use-composition.d.ts +10 -0
- package/dist/hooks/use-composition.d.ts.map +1 -0
- package/dist/hooks/use-composition.js +13 -0
- package/dist/hooks/use-composition.js.map +1 -0
- package/dist/hooks/use-layers.d.ts +9 -0
- package/dist/hooks/use-layers.d.ts.map +1 -0
- package/dist/hooks/use-layers.js +34 -0
- package/dist/hooks/use-layers.js.map +1 -0
- package/dist/hooks/use-playback.d.ts +15 -0
- package/dist/hooks/use-playback.d.ts.map +1 -0
- package/dist/hooks/use-playback.js +38 -0
- package/dist/hooks/use-playback.js.map +1 -0
- package/dist/hooks/use-props-form.d.ts +15 -0
- package/dist/hooks/use-props-form.d.ts.map +1 -0
- package/dist/hooks/use-props-form.js +22 -0
- package/dist/hooks/use-props-form.js.map +1 -0
- package/dist/hooks/use-real-fps.d.ts +3 -0
- package/dist/hooks/use-real-fps.d.ts.map +1 -0
- package/dist/hooks/use-real-fps.js +27 -0
- package/dist/hooks/use-real-fps.js.map +1 -0
- package/dist/hooks/use-shortcuts.d.ts +7 -0
- package/dist/hooks/use-shortcuts.d.ts.map +1 -0
- package/dist/hooks/use-shortcuts.js +53 -0
- package/dist/hooks/use-shortcuts.js.map +1 -0
- package/dist/hooks/use-studio.d.ts +4 -0
- package/dist/hooks/use-studio.d.ts.map +1 -0
- package/dist/hooks/use-studio.js +10 -0
- package/dist/hooks/use-studio.js.map +1 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +8 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/constants.d.ts +28 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +38 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/cva.d.ts +25 -0
- package/dist/lib/cva.d.ts.map +1 -0
- package/dist/lib/cva.js +23 -0
- package/dist/lib/cva.js.map +1 -0
- package/dist/lib/format.d.ts +13 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +25 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/ids.d.ts +3 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +6 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/registry/define-registry.d.ts +8 -0
- package/dist/registry/define-registry.d.ts.map +1 -0
- package/dist/registry/define-registry.js +71 -0
- package/dist/registry/define-registry.js.map +1 -0
- package/dist/registry/props-signal.d.ts +9 -0
- package/dist/registry/props-signal.d.ts.map +1 -0
- package/dist/registry/props-signal.js +25 -0
- package/dist/registry/props-signal.js.map +1 -0
- package/dist/schema/kf.d.ts +28 -0
- package/dist/schema/kf.d.ts.map +1 -0
- package/dist/schema/kf.js +82 -0
- package/dist/schema/kf.js.map +1 -0
- package/dist/schema/types.d.ts +69 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +4 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +7 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/map.d.ts +19 -0
- package/dist/server/map.d.ts.map +1 -0
- package/dist/server/map.js +63 -0
- package/dist/server/map.js.map +1 -0
- package/dist/server/render-queue.d.ts +46 -0
- package/dist/server/render-queue.d.ts.map +1 -0
- package/dist/server/render-queue.js +147 -0
- package/dist/server/render-queue.js.map +1 -0
- package/dist/server/temp-storage.d.ts +13 -0
- package/dist/server/temp-storage.d.ts.map +1 -0
- package/dist/server/temp-storage.js +55 -0
- package/dist/server/temp-storage.js.map +1 -0
- package/dist/server/types.d.ts +57 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/signals/signal-bridge.d.ts +18 -0
- package/dist/signals/signal-bridge.d.ts.map +1 -0
- package/dist/signals/signal-bridge.js +39 -0
- package/dist/signals/signal-bridge.js.map +1 -0
- package/dist/store/store.d.ts +74 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +276 -0
- package/dist/store/store.js.map +1 -0
- package/dist/styles/studio.css +2 -0
- package/dist/types.d.ts +112 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { usePlayback } from "../../hooks/use-playback.js";
|
|
3
|
+
import { useStudio } from "../../hooks/use-studio.js";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { fmtTime } from "../../lib/format.js";
|
|
6
|
+
import { useSignalValue } from "../../signals/signal-bridge.js";
|
|
7
|
+
import { IconButton } from "../button/icon-button.js";
|
|
8
|
+
import { StSlider } from "../primitives/slider.js";
|
|
9
|
+
import { StTooltip } from "../primitives/tooltip.js";
|
|
10
|
+
/** Transport bar: play/step, volume, time, loop, fullscreen. */
|
|
11
|
+
export function Transport({ className }) {
|
|
12
|
+
const store = useStudio();
|
|
13
|
+
const { player, playing, loop, volume, muted, fullscreen, durSec, timeSec } = usePlayback();
|
|
14
|
+
const region = useSignalValue(store.region);
|
|
15
|
+
const regionActive = region.in != null || region.out != null;
|
|
16
|
+
return (_jsxs("div", { className: cn("flex items-center gap-1 px-3 h-[50px] flex-none", className), children: [_jsx(StTooltip, { content: "Restart", children: _jsx(IconButton, { size: "sm", icon: "prev", onClick: () => player?.seekTo(region.in ?? 0) }) }), _jsx(StTooltip, { content: playing ? "Pause (Space)" : "Play (Space)", children: _jsx(IconButton, { icon: playing ? "pause" : "play", iconSize: 20, className: "text-white", onClick: () => player?.toggle() }) }), _jsx(StTooltip, { content: "Step forward (\u2192)", children: _jsx(IconButton, { size: "sm", icon: "next", onClick: () => player?.stepBy(1) }) }), _jsxs("div", { className: "flex items-center group ml-1", children: [_jsx(StTooltip, { content: muted ? "Unmute" : "Mute", children: _jsx(IconButton, { size: "sm", icon: muted || volume === 0 ? "mute" : "volume", onClick: () => player?.setMuted(!muted) }) }), _jsx("div", { className: "w-0 group-hover:w-[78px] overflow-hidden transition-[width] flex items-center", children: _jsx(StSlider, { value: muted ? 0 : Math.round(volume * 100), min: 0, max: 100, className: "w-[70px] mx-1", onValueChange: (v) => {
|
|
17
|
+
player?.setVolume(v / 100);
|
|
18
|
+
player?.setMuted(v === 0);
|
|
19
|
+
} }) })] }), _jsxs("div", { className: "font-mono text-[12.5px] text-ink-2 ml-2 whitespace-nowrap tracking-tight tabular-nums", children: [_jsx("span", { className: "text-ink-1 inline-block text-right", style: { minWidth: "3.5ch" }, children: fmtTime(timeSec) }), _jsx("span", { className: "text-ink-3 mx-0.5", children: "/" }), fmtTime(durSec)] }), _jsx("div", { className: "flex-1" }), _jsx(StTooltip, { content: loop ? `Looping ${regionActive ? "region" : "playback"}` : "Loop off", children: _jsx(IconButton, { size: "sm", icon: "loop", active: loop, onClick: () => player?.toggleLoop(), className: "relative", children: regionActive && (_jsx("span", { className: "absolute top-1 right-1 size-1.5 rounded-full bg-accent-2 shadow-[0_0_6px_var(--color-accent-soft)]" })) }) }), _jsx(StTooltip, { content: fullscreen ? "Exit fullscreen (F)" : "Fullscreen (F)", children: _jsx(IconButton, { size: "sm", icon: fullscreen ? "fullscreenExit" : "fullscreen", onClick: () => player?.toggleFullscreen() }) })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/components/timeline/transport.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,gEAAgE;AAChE,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAA0B;IAC7D,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC;IAC5F,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,IAAI,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC;IAE7D,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,iDAAiD,EAAE,SAAS,CAAC,aAC9E,KAAC,SAAS,IAAC,OAAO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,0 +1,20 @@
|
|
|
1
|
+
export type DragKind = "seek" | "in" | "out";
|
|
2
|
+
/**
|
|
3
|
+
* Shared pointer→frame drag handling for a scrub surface. Seeking maps the
|
|
4
|
+
* cursor to a frame; dragging the loop in/out grips snaps the playhead to the
|
|
5
|
+
* cursor too (per the design's "snap to cursor" requirement).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useScrubSurface(total: number): {
|
|
8
|
+
ref: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
9
|
+
drag: DragKind | null;
|
|
10
|
+
setDrag: import("react").Dispatch<import("react").SetStateAction<DragKind | null>>;
|
|
11
|
+
hover: number | null;
|
|
12
|
+
setHover: import("react").Dispatch<import("react").SetStateAction<number | null>>;
|
|
13
|
+
frac: (clientX: number) => number;
|
|
14
|
+
frameAt: (clientX: number) => number;
|
|
15
|
+
seekTo: (clientX: number) => void;
|
|
16
|
+
inFrame: number;
|
|
17
|
+
outFrame: number;
|
|
18
|
+
den: number;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=use-scrub-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scrub-surface.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/use-scrub-surface.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM;;;;;;oBAYpB,MAAM,KAAG,MAAM;uBAKZ,MAAM,KAAG,MAAM;sBAChB,MAAM,KAAG,IAAI;;;;EA2BvC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useStudio } from "../../hooks/use-studio.js";
|
|
3
|
+
import { clamp01 } from "../../lib/format.js";
|
|
4
|
+
import { useSignalValue } from "../../signals/signal-bridge.js";
|
|
5
|
+
/**
|
|
6
|
+
* Shared pointer→frame drag handling for a scrub surface. Seeking maps the
|
|
7
|
+
* cursor to a frame; dragging the loop in/out grips snaps the playhead to the
|
|
8
|
+
* cursor too (per the design's "snap to cursor" requirement).
|
|
9
|
+
*/
|
|
10
|
+
export function useScrubSurface(total) {
|
|
11
|
+
const store = useStudio();
|
|
12
|
+
const player = useSignalValue(store.player);
|
|
13
|
+
const region = useSignalValue(store.region);
|
|
14
|
+
const ref = useRef(null);
|
|
15
|
+
const [drag, setDrag] = useState(null);
|
|
16
|
+
const [hover, setHover] = useState(null);
|
|
17
|
+
const den = Math.max(1, total - 1);
|
|
18
|
+
const inFrame = region.in ?? 0;
|
|
19
|
+
const outFrame = region.out ?? den;
|
|
20
|
+
const frac = (clientX) => {
|
|
21
|
+
const r = ref.current?.getBoundingClientRect();
|
|
22
|
+
if (!r || r.width === 0)
|
|
23
|
+
return 0;
|
|
24
|
+
return clamp01((clientX - r.left) / r.width);
|
|
25
|
+
};
|
|
26
|
+
const frameAt = (clientX) => Math.round(frac(clientX) * den);
|
|
27
|
+
const seekTo = (clientX) => player?.seekTo(frameAt(clientX));
|
|
28
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: store/player stable refs
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!drag)
|
|
31
|
+
return;
|
|
32
|
+
const move = (e) => {
|
|
33
|
+
const f = frameAt(e.clientX);
|
|
34
|
+
if (drag === "seek") {
|
|
35
|
+
player?.seekTo(f);
|
|
36
|
+
}
|
|
37
|
+
else if (drag === "in") {
|
|
38
|
+
store.setRegionIn(f);
|
|
39
|
+
player?.seekTo(f);
|
|
40
|
+
}
|
|
41
|
+
else if (drag === "out") {
|
|
42
|
+
store.setRegionOut(f);
|
|
43
|
+
player?.seekTo(f);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const up = () => setDrag(null);
|
|
47
|
+
window.addEventListener("mousemove", move);
|
|
48
|
+
window.addEventListener("mouseup", up);
|
|
49
|
+
return () => {
|
|
50
|
+
window.removeEventListener("mousemove", move);
|
|
51
|
+
window.removeEventListener("mouseup", up);
|
|
52
|
+
};
|
|
53
|
+
}, [drag, den, player, store]);
|
|
54
|
+
return { ref, drag, setDrag, hover, setHover, frac, frameAt, seekTo, inFrame, outFrame, den };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=use-scrub-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scrub-surface.js","sourceRoot":"","sources":["../../../src/components/timeline/use-scrub-surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIhE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC;IAEnC,MAAM,IAA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AI,CAAC,CAAC;QAC/B,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YAC9C,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC5C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../../../src/components/toasts/toasts.tsx"],"names":[],"mappings":"AASA;uEACuE;AACvE,wBAAgB,MAAM,4CAqCrB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Toast } from "@base-ui/react/toast";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useStudio } from "../../hooks/use-studio.js";
|
|
5
|
+
import { Icon } from "../icon/icon.js";
|
|
6
|
+
import { usePortalContainer } from "../primitives/portal-context.js";
|
|
7
|
+
/** Toast viewport (Base UI Toast). Registers the store's toast sink so
|
|
8
|
+
store.addToast routes through the manager (auto-dismiss + a11y). */
|
|
9
|
+
export function Toasts() {
|
|
10
|
+
const store = useStudio();
|
|
11
|
+
const container = usePortalContainer();
|
|
12
|
+
const manager = Toast.useToastManager();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
store.setToastSink((title, icon) => manager.add({ title, data: { icon }, timeout: 3600 }));
|
|
15
|
+
return () => store.setToastSink(null);
|
|
16
|
+
}, [manager, store]);
|
|
17
|
+
return (_jsx(Toast.Portal, { container: container, children: _jsx(Toast.Viewport, { className: "fixed bottom-5 left-1/2 -translate-x-1/2 z-[60] flex flex-col gap-2 w-[320px] outline-none", children: manager.toasts.map((t) => {
|
|
18
|
+
const icon = t.data?.icon ?? "check";
|
|
19
|
+
return (_jsxs(Toast.Root, { toast: t, className: "flex items-center gap-2.5 bg-bg-1/97 backdrop-blur-xl border border-line-2 rounded-ui px-3.5 py-2.5 text-[13px] font-medium text-ink-1 shadow-[0_18px_44px_-12px_rgba(0,0,0,.7)] data-[starting-style]:opacity-0 data-[starting-style]:translate-y-3 data-[ending-style]:opacity-0 transition-all", style: { "--gap": "8px" }, children: [_jsx("span", { className: "size-[18px] grid place-items-center text-accent-2 flex-none", children: _jsx(Icon, { name: icon, size: 14 }) }), _jsx(Toast.Title, { className: "flex-1" }), _jsx(Toast.Close, { className: "text-ink-3 hover:text-ink-1", children: _jsx(Icon, { name: "close", size: 13 }) })] }, t.id));
|
|
20
|
+
}) }) }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=toasts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.js","sourceRoot":"","sources":["../../../src/components/toasts/toasts.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAsB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE;uEACuE;AACvE,MAAM,UAAU,MAAM;IACpB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAG,kBA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}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LoadStatus } from "../store/store.js";
|
|
2
|
+
/** Read the active composition + its load status from the store. */
|
|
3
|
+
export declare function useComposition(): {
|
|
4
|
+
composition: import("@smoove/core").Composition<Record<string, unknown>> | null;
|
|
5
|
+
selectedId: string;
|
|
6
|
+
status: LoadStatus;
|
|
7
|
+
error: string | null;
|
|
8
|
+
entry: import("../types.js").RegistryEntry<Record<string, unknown>> | undefined;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-composition.d.ts","sourceRoot":"","sources":["../../src/hooks/use-composition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,oEAAoE;AACpE,wBAAgB,cAAc;;;;;;EAQ7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useSignalValue } from "../signals/signal-bridge.js";
|
|
2
|
+
import { useStudio } from "./use-studio.js";
|
|
3
|
+
/** Read the active composition + its load status from the store. */
|
|
4
|
+
export function useComposition() {
|
|
5
|
+
const store = useStudio();
|
|
6
|
+
const composition = useSignalValue(store.composition);
|
|
7
|
+
const selectedId = useSignalValue(store.selectedId);
|
|
8
|
+
const status = useSignalValue(store.loadStatus)[selectedId] ?? "idle";
|
|
9
|
+
const error = useSignalValue(store.loadError);
|
|
10
|
+
const entry = store.getEntry(selectedId);
|
|
11
|
+
return { composition, selectedId, status, error, entry };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=use-composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-composition.js","sourceRoot":"","sources":["../../src/hooks/use-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,oEAAoE;AACpE,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpD,MAAM,MAAM,GAAe,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC;IAClF,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Composition, Sequence } from "@smoove/core";
|
|
2
|
+
import type { StudioLayer } from "../types.js";
|
|
3
|
+
/** Top-level `Sequence`s of a composition, in tree order. */
|
|
4
|
+
export declare function sequencesOf(comp: Composition): Sequence[];
|
|
5
|
+
/** Derive timeline tracks from a composition's top-level Sequences. */
|
|
6
|
+
export declare function deriveLayers(comp: Composition): StudioLayer[];
|
|
7
|
+
/** Apply per-layer enable/disable to the real Konva Sequences (opacity). */
|
|
8
|
+
export declare function applyLayerVisibility(comp: Composition, off: Set<number>): void;
|
|
9
|
+
//# sourceMappingURL=use-layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C,6DAA6D;AAC7D,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,EAAE,CAEzD;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAY7D;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAQ9E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Sequence } from "@smoove/core";
|
|
2
|
+
import { clamp01 } from "../lib/format.js";
|
|
3
|
+
const KIND_RE = /^(audio|video|group|transition|sequence):/i;
|
|
4
|
+
function inferKind(name) {
|
|
5
|
+
const m = KIND_RE.exec(name);
|
|
6
|
+
return m?.[1]?.toLowerCase() ?? "sequence";
|
|
7
|
+
}
|
|
8
|
+
const stripPrefix = (name) => name.replace(KIND_RE, "").trim();
|
|
9
|
+
/** Top-level `Sequence`s of a composition, in tree order. */
|
|
10
|
+
export function sequencesOf(comp) {
|
|
11
|
+
return comp.getChildren((n) => n instanceof Sequence);
|
|
12
|
+
}
|
|
13
|
+
/** Derive timeline tracks from a composition's top-level Sequences. */
|
|
14
|
+
export function deriveLayers(comp) {
|
|
15
|
+
const total = comp.durationInFrames.get() || 1;
|
|
16
|
+
return sequencesOf(comp).map((s, i) => {
|
|
17
|
+
const raw = s.name() || s.id() || `Layer ${i + 1}`;
|
|
18
|
+
return {
|
|
19
|
+
name: stripPrefix(raw) || `Layer ${i + 1}`,
|
|
20
|
+
kind: inferKind(raw),
|
|
21
|
+
start: clamp01(s.from / total),
|
|
22
|
+
end: clamp01((s.from + s.durationInFrames) / total),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Apply per-layer enable/disable to the real Konva Sequences (opacity). */
|
|
27
|
+
export function applyLayerVisibility(comp, off) {
|
|
28
|
+
const seqs = sequencesOf(comp);
|
|
29
|
+
seqs.forEach((s, i) => {
|
|
30
|
+
s.opacity(off.has(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IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;YAC1C,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC;YACpB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;YAC9B,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;SACpD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,oBAAoB,CAAC,IAAiB,EAAE,GAAgB;IACtE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** All live playback values, sourced from the mounted player's signals. */
|
|
2
|
+
export declare function usePlayback(): {
|
|
3
|
+
player: import("@smoove/player").PlayerApi | null;
|
|
4
|
+
frame: number;
|
|
5
|
+
total: number;
|
|
6
|
+
playing: boolean;
|
|
7
|
+
loop: boolean;
|
|
8
|
+
volume: number;
|
|
9
|
+
muted: boolean;
|
|
10
|
+
fullscreen: boolean;
|
|
11
|
+
fps: number;
|
|
12
|
+
durSec: number;
|
|
13
|
+
timeSec: number;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-playback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-playback.d.ts","sourceRoot":"","sources":["../../src/hooks/use-playback.ts"],"names":[],"mappings":"AAcA,2EAA2E;AAC3E,wBAAgB,WAAW;;;;;;;;;;;;EAwB1B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { usePlayerSignal, useSignalValue } from "../signals/signal-bridge.js";
|
|
2
|
+
import { useStudio } from "./use-studio.js";
|
|
3
|
+
const numSig = (v) => ({ get: () => v, subscribe: () => () => { } });
|
|
4
|
+
const boolSig = (v) => ({
|
|
5
|
+
get: () => v,
|
|
6
|
+
subscribe: () => () => { },
|
|
7
|
+
});
|
|
8
|
+
const ZERO = numSig(0);
|
|
9
|
+
const ONE = numSig(1);
|
|
10
|
+
const FALSE = boolSig(false);
|
|
11
|
+
const VOL = numSig(1);
|
|
12
|
+
/** All live playback values, sourced from the mounted player's signals. */
|
|
13
|
+
export function usePlayback() {
|
|
14
|
+
const store = useStudio();
|
|
15
|
+
const player = useSignalValue(store.player);
|
|
16
|
+
const frame = usePlayerSignal(player?.state.frame ?? ZERO);
|
|
17
|
+
const total = usePlayerSignal(player?.state.duration ?? ONE);
|
|
18
|
+
const playing = usePlayerSignal(player?.state.playing ?? FALSE);
|
|
19
|
+
const loop = usePlayerSignal(player?.state.loop ?? FALSE);
|
|
20
|
+
const volume = usePlayerSignal(player?.state.volume ?? VOL);
|
|
21
|
+
const muted = usePlayerSignal(player?.state.muted ?? FALSE);
|
|
22
|
+
const fullscreen = usePlayerSignal(player?.state.fullscreen ?? FALSE);
|
|
23
|
+
const fps = player?.fps || 30;
|
|
24
|
+
return {
|
|
25
|
+
player,
|
|
26
|
+
frame,
|
|
27
|
+
total,
|
|
28
|
+
playing,
|
|
29
|
+
loop,
|
|
30
|
+
volume,
|
|
31
|
+
muted,
|
|
32
|
+
fullscreen,
|
|
33
|
+
fps,
|
|
34
|
+
durSec: total / fps,
|
|
35
|
+
timeSec: frame / fps,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=use-playback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-playback.js","sourceRoot":"","sources":["../../src/hooks/use-playback.ts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D,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;IAC9B,OAAO;QACL,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;QACP,IAAI;QACJ,MAAM;QACN,KAAK;QACL,UAAU;QACV,GAAG;QACH,MAAM,EAAE,KAAK,GAAG,GAAG;QACnB,OAAO,EAAE,KAAK,GAAG,GAAG;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SmooveSchema } from "../schema/types.js";
|
|
2
|
+
export type PropsForm = {
|
|
3
|
+
schema?: SmooveSchema;
|
|
4
|
+
values: Record<string, unknown>;
|
|
5
|
+
setValue: (key: string, value: unknown) => void;
|
|
6
|
+
setValues: (next: Record<string, unknown>) => void;
|
|
7
|
+
reset: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Bridge a composition's props signal to the form: reading `values` re-renders
|
|
11
|
+
* on edits, writing pushes into the signal (which the studio has wired to
|
|
12
|
+
* `comp.refresh()`, so the preview updates with the playhead preserved).
|
|
13
|
+
*/
|
|
14
|
+
export declare function usePropsForm(id: string): PropsForm;
|
|
15
|
+
//# sourceMappingURL=use-props-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-props-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-props-form.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAYlD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolveDefaults } from "../schema/kf.js";
|
|
2
|
+
import { usePlayerSignal } from "../signals/signal-bridge.js";
|
|
3
|
+
import { useStudio } from "./use-studio.js";
|
|
4
|
+
/**
|
|
5
|
+
* Bridge a composition's props signal to the form: reading `values` re-renders
|
|
6
|
+
* on edits, writing pushes into the signal (which the studio has wired to
|
|
7
|
+
* `comp.refresh()`, so the preview updates with the playhead preserved).
|
|
8
|
+
*/
|
|
9
|
+
export function usePropsForm(id) {
|
|
10
|
+
const store = useStudio();
|
|
11
|
+
const sig = store.getPropsSignal(id);
|
|
12
|
+
const values = usePlayerSignal(sig);
|
|
13
|
+
const entry = store.getEntry(id);
|
|
14
|
+
return {
|
|
15
|
+
schema: entry?.propsSchema,
|
|
16
|
+
values,
|
|
17
|
+
setValue: (key, value) => sig.set({ ...sig.get(), [key]: value }),
|
|
18
|
+
setValues: (next) => sig.set(next),
|
|
19
|
+
reset: () => sig.set(resolveDefaults(entry?.propsSchema, entry?.defaultProps)),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=use-props-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-props-form.js","sourceRoot":"","sources":["../../src/hooks/use-props-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjC,OAAO;QACL,MAAM,EAAE,KAAK,EAAE,WAAW;QAC1B,MAAM;QACN,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;QACjE,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;QAClC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;KAC/E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-real-fps.d.ts","sourceRoot":"","sources":["../../src/hooks/use-real-fps.ts"],"names":[],"mappings":"AAIA,8EAA8E;AAC9E,wBAAgB,UAAU,IAAI,MAAM,CAoBnC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useSignalValue } from "../signals/signal-bridge.js";
|
|
3
|
+
import { useStudio } from "./use-studio.js";
|
|
4
|
+
/** Measure realtime fps by counting how often the player's frame advances. */
|
|
5
|
+
export function useRealFps() {
|
|
6
|
+
const store = useStudio();
|
|
7
|
+
const player = useSignalValue(store.player);
|
|
8
|
+
const [real, setReal] = useState(0);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!player)
|
|
11
|
+
return;
|
|
12
|
+
let count = 0;
|
|
13
|
+
const unsub = player.state.frame.subscribe(() => {
|
|
14
|
+
count++;
|
|
15
|
+
});
|
|
16
|
+
const id = setInterval(() => {
|
|
17
|
+
setReal(count * 2);
|
|
18
|
+
count = 0;
|
|
19
|
+
}, 500);
|
|
20
|
+
return () => {
|
|
21
|
+
unsub();
|
|
22
|
+
clearInterval(id);
|
|
23
|
+
};
|
|
24
|
+
}, [player]);
|
|
25
|
+
return real;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=use-real-fps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-real-fps.js","sourceRoot":"","sources":["../../src/hooks/use-real-fps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,8EAA8E;AAC9E,MAAM,UAAU,UAAU;IACxB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAC9C,KAAK,EAAE,CAAC;QACV,CAAC,CAAC,CAAC;QACH,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE;YAC1B,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACnB,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,OAAO,GAAG,EAAE;YACV,KAAK,EAAE,CAAC;YACR,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global keyboard shortcuts. The studio owns them (the `<smoove-player>` is mounted
|
|
3
|
+
* with `no-keyboard`): space play/pause, ←/→ step, f fullscreen, l loop,
|
|
4
|
+
* i/o set loop in/out at the playhead. Ignored while typing in a field.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useShortcuts(): void;
|
|
7
|
+
//# sourceMappingURL=use-shortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-shortcuts.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shortcuts.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,IAAI,CA0CnC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useStudio } from "./use-studio.js";
|
|
3
|
+
/**
|
|
4
|
+
* Global keyboard shortcuts. The studio owns them (the `<smoove-player>` is mounted
|
|
5
|
+
* with `no-keyboard`): space play/pause, ←/→ step, f fullscreen, l loop,
|
|
6
|
+
* i/o set loop in/out at the playhead. Ignored while typing in a field.
|
|
7
|
+
*/
|
|
8
|
+
export function useShortcuts() {
|
|
9
|
+
const store = useStudio();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const onKey = (e) => {
|
|
12
|
+
const t = e.target;
|
|
13
|
+
if (t && (/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) || t.isContentEditable))
|
|
14
|
+
return;
|
|
15
|
+
const api = store.player.get();
|
|
16
|
+
if (!api)
|
|
17
|
+
return;
|
|
18
|
+
switch (e.key) {
|
|
19
|
+
case " ":
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
api.toggle();
|
|
22
|
+
break;
|
|
23
|
+
case "ArrowRight":
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
api.stepBy(1);
|
|
26
|
+
break;
|
|
27
|
+
case "ArrowLeft":
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
api.stepBy(-1);
|
|
30
|
+
break;
|
|
31
|
+
case "f":
|
|
32
|
+
case "F":
|
|
33
|
+
api.toggleFullscreen();
|
|
34
|
+
break;
|
|
35
|
+
case "l":
|
|
36
|
+
case "L":
|
|
37
|
+
api.toggleLoop();
|
|
38
|
+
break;
|
|
39
|
+
case "i":
|
|
40
|
+
case "I":
|
|
41
|
+
store.setRegionIn(api.getCurrentFrame());
|
|
42
|
+
break;
|
|
43
|
+
case "o":
|
|
44
|
+
case "O":
|
|
45
|
+
store.setRegionOut(api.getCurrentFrame());
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
window.addEventListener("keydown", onKey);
|
|
50
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
51
|
+
}, [store]);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=use-shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-shortcuts.js","sourceRoot":"","sources":["../../src/hooks/use-shortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,SAAS,CAAC,GAAG,E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AC;QAC1C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-studio.d.ts","sourceRoot":"","sources":["../../src/hooks/use-studio.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,qEAAqE;AACrE,wBAAgB,SAAS,IAAI,WAAW,CAIvC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { StudioContext } from "../components/studio/studio-context.js";
|
|
3
|
+
/** Read the central studio store. Must be used inside `<Studio>`. */
|
|
4
|
+
export function useStudio() {
|
|
5
|
+
const ctx = useContext(StudioContext);
|
|
6
|
+
if (!ctx)
|
|
7
|
+
throw new Error("useStudio() must be used inside <Studio>");
|
|
8
|
+
return ctx;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=use-studio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-studio.js","sourceRoot":"","sources":["../../src/hooks/use-studio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE,qEAAqE;AACrE,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC"}
|