Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

various editor improvements (#379)

Brendan Allan51c80482b671
diff --git a/apps/desktop/src/components/Tooltip.tsx b/apps/desktop/src/components/Tooltip.tsx
index a3bd4e27e..060f4d60f 100644
--- a/apps/desktop/src/components/Tooltip.tsx
+++ b/apps/desktop/src/components/Tooltip.tsx
@@ -1,33 +1,24 @@
-import { Tooltip as CapTooltip } from "@kobalte/core";
-import { TooltipRootProps } from "@kobalte/core/tooltip";
+import { Tooltip as KTooltip } from "@kobalte/core";
import { cx } from "cva";
-import { JSX } from "solid-js";
+import { ComponentProps, JSX } from "solid-js";
-interface Props {
- children: JSX.Element;
+interface Props extends ComponentProps<typeof KTooltip.Root> {
content: JSX.Element;
- placement?: TooltipRootProps["placement"];
childClass?: string;
- openDelay?: number;
- closeDelay?: number;
}
export default function Tooltip(props: Props) {
return (
- <CapTooltip.Root
- placement={props.placement}
- openDelay={props.openDelay ?? 500}
- closeDelay={props.closeDelay ?? 0}
- >
- <CapTooltip.Trigger class={cx(props.childClass)}>
+ <KTooltip.Root {...props} openDelay={props.openDelay ?? 200}>
+ <KTooltip.Trigger class={cx(props.childClass)}>
{props.children}
- </CapTooltip.Trigger>
- <CapTooltip.Portal>
- <CapTooltip.Content class="z-50 px-2 py-1 text-xs text-gray-50 bg-gray-500 rounded shadow-lg duration-100 animate-in fade-in">
+ </KTooltip.Trigger>
+ <KTooltip.Portal>
+ <KTooltip.Content class="z-50 px-1.5 py-1 text-xs border border-gray-200 bg-gray-50 dark:bg-gray-50 text-[--text-secondary] rounded shadow-lg duration-100 animate-in fade-in slide-in-from-top-1 min-w-6 text-center">
{props.content}
- <CapTooltip.Arrow class="fill-gray-500" />
- </CapTooltip.Content>
- </CapTooltip.Portal>
- </CapTooltip.Root>
+ <KTooltip.Arrow size={16} />
+ </KTooltip.Content>
+ </KTooltip.Portal>
+ </KTooltip.Root>
);
}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 531a2f354..94ac0493a 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -188,7 +188,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
return (
<div class="flex flex-col w-full h-full">
- <div class="overflow-y-auto flex-1 custom-scroll">
+ <div class="flex-1 custom-scroll">
<div class="p-4 space-y-2 divide-y divide-gray-200">
<AppearanceSection
currentTheme={settings.theme ?? "system"}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
index b8d8cfd5c..770fdb226 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
@@ -143,7 +143,7 @@ export default function Recordings() {
</For>
</div>
</div>
- <div class="flex overflow-auto flex-col flex-1 custom-scroll">
+ <div class="flex flex-col flex-1 custom-scroll">
<ul class="p-4 flex flex-col gap-[0.5rem] w-full text-[--text-primary]">
<For each={filteredRecordings()}>
{(recording) => (
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index de647769b..66662315f 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -405,7 +405,7 @@ export function ConfigSidebar() {
return (
<KTabs
value={selectedTab()}
- class="flex flex-col shrink-0 flex-1 max-w-[26rem] overflow-hidden rounded-t-xl z-10 bg-gray-100 relative"
+ class="flex flex-col shrink-0 flex-1 max-w-[26rem] overflow-hidden rounded-xl z-10 bg-gray-100 relative"
>
<KTabs.List class="flex overflow-hidden relative z-40 flex-row items-center h-16 text-lg border-b border-gray-200 shrink-0">
<For
@@ -458,9 +458,9 @@ export function ConfigSidebar() {
</KTabs.List>
<div
ref={scrollRef}
- class="p-4 custom-scroll overflow-x-hidden overflow-y-auto text-[0.875rem] h-full"
+ class="p-4 custom-scroll overflow-x-hidden overflow-y-scroll text-[0.875rem] h-full"
>
- <KTabs.Content value="background" class="flex flex-col gap-8">
+ <KTabs.Content value="background" class="flex flex-col gap-6">
<Field icon={<IconCapImage class="size-4" />} name="Background Image">
<KTabs
value={project.background.source.type}
@@ -518,7 +518,7 @@ export function ConfigSidebar() {
}
}}
>
- <KTabs.List class="flex flex-row gap-2 items-center rounded-[0.5rem] relative">
+ <KTabs.List class="flex flex-row gap-2 items-center rounded-[0.5rem] relative">
<For each={BACKGROUND_SOURCES_LIST}>
{(item) => {
const el = (props?: object) => (
@@ -586,11 +586,12 @@ export function ConfigSidebar() {
if (convertedPath) {
imageSrc = convertedPath;
}
- }
+ }
// Only override for "wallpaper" if a valid wallpaper is found
else if (
item === "wallpaper" &&
- project.background.source.type === "wallpaper" &&
+ project.background.source.type ===
+ "wallpaper" &&
project.background.source.path
) {
const selectedWallpaper = wallpapers()?.find(
@@ -649,7 +650,7 @@ export function ConfigSidebar() {
<KTabs class="overflow-hidden relative" value={backgroundTab()}>
<KTabs.List
ref={setBackgroundRef}
- class="flex overflow-x-auto overscroll-contain relative z-40 flex-row gap-2 items-center mb-5 text-xs hide-scroll"
+ class="flex overflow-x-auto overscroll-contain relative z-40 flex-row gap-2 items-center mb-3 text-xs hide-scroll"
style={{
"-webkit-mask-image": `linear-gradient(to right, transparent, black ${
scrollX() > 0 ? "24px" : "0"
@@ -897,20 +898,22 @@ export function ConfigSidebar() {
project.background.source
}
>
- <div class="flex flex-col flex-wrap gap-4">
- <RgbInput
- value={
- project.background.source.type === "color"
- ? project.background.source.value
- : [0, 0, 0]
- }
- onChange={(value) => {
- setProject("background", "source", {
- type: "color",
- value,
- });
- }}
- />
+ <div class="flex flex-col flex-wrap gap-3">
+ <div class="w-full h-10 flex flex-row items-center">
+ <RgbInput
+ value={
+ project.background.source.type === "color"
+ ? project.background.source.value
+ : [0, 0, 0]
+ }
+ onChange={(value) => {
+ setProject("background", "source", {
+ type: "color",
+ value,
+ });
+ }}
+ />
+ </div>
<div class="flex flex-wrap gap-2">
<For each={BACKGROUND_COLORS}>
@@ -935,7 +938,7 @@ export function ConfigSidebar() {
}}
/>
<div
- class="rounded-lg transition-all duration-200 cursor-pointer size-6 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"
+ class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"
style={{ "background-color": color }}
/>
</label>
@@ -977,8 +980,8 @@ export function ConfigSidebar() {
return (
<>
- <div class="flex flex-col gap-6">
- <div class="flex gap-5">
+ <div class="flex flex-col gap-3">
+ <div class="flex gap-5 h-10">
<RgbInput
value={source().from}
onChange={(from) => {
@@ -999,6 +1002,56 @@ export function ConfigSidebar() {
});
}}
/>
+ <div
+ class="ml-auto flex relative flex-col items-center p-1 bg-gray-50 rounded-full border border-gray-200 size-10 cursor-ns-resize shrink-0"
+ style={{ transform: `rotate(${angle()}deg)` }}
+ onMouseDown={(downEvent) => {
+ const start = angle();
+ const resumeHistory = history.pause();
+
+ createRoot((dispose) =>
+ createEventListenerMap(window, {
+ mouseup: () => dispose(),
+ mousemove: (moveEvent) => {
+ const rawNewAngle =
+ Math.round(
+ start +
+ (downEvent.clientY -
+ moveEvent.clientY)
+ ) % max;
+ const newAngle = moveEvent.shiftKey
+ ? rawNewAngle
+ : Math.round(rawNewAngle / 45) * 45;
+
+ if (
+ !moveEvent.shiftKey &&
+ hapticsEnabled() &&
+ project.background.source.type ===
+ "gradient"
+ ) {
+ if (previousAngle() !== newAngle) {
+ commands.performHapticFeedback(
+ "Alignment",
+ "Now"
+ );
+ }
+ setPreviousAngle(newAngle);
+ }
+
+ setProject("background", "source", {
+ type: "gradient",
+ angle:
+ newAngle < 0
+ ? newAngle + max
+ : newAngle,
+ });
+ },
+ })
+ );
+ }}
+ >
+ <div class="bg-blue-300 rounded-full size-1.5" />
+ </div>
</div>
<div class="flex flex-wrap gap-2">
<For each={BACKGROUND_GRADIENTS}>
@@ -1024,7 +1077,7 @@ export function ConfigSidebar() {
}}
/>
<div
- class="rounded-lg transition-all duration-200 cursor-pointer size-6 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"
+ class="rounded-lg transition-all duration-200 cursor-pointer size-8 peer-checked:hover:opacity-100 peer-hover:opacity-70 peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:ring-offset-2 peer-checked:ring-offset-gray-200"
style={{
background: `linear-gradient(${angle()}deg, rgb(${gradient.from.join(
","
@@ -1036,53 +1089,6 @@ export function ConfigSidebar() {
</For>
</div>
</div>
- <div
- class="flex relative flex-col items-center p-1 bg-gray-50 rounded-full border border-gray-200 size-12 cursor-ns-resize shrink-0"
- style={{ transform: `rotate(${angle()}deg)` }}
- onMouseDown={(downEvent) => {
- const start = angle();
- const resumeHistory = history.pause();
-
- createRoot((dispose) =>
- createEventListenerMap(window, {
- mouseup: () => dispose(),
- mousemove: (moveEvent) => {
- const rawNewAngle =
- Math.round(
- start +
- (downEvent.clientY - moveEvent.clientY)
- ) % max;
- const newAngle = moveEvent.shiftKey
- ? rawNewAngle
- : Math.round(rawNewAngle / 45) * 45;
-
- if (
- !moveEvent.shiftKey &&
- hapticsEnabled() &&
- project.background.source.type ===
- "gradient"
- ) {
- if (previousAngle() !== newAngle) {
- commands.performHapticFeedback(
- "Alignment",
- "Now"
- );
- }
- setPreviousAngle(newAngle);
- }
-
- setProject("background", "source", {
- type: "gradient",
- angle:
- newAngle < 0 ? newAngle + max : newAngle,
- });
- },
- })
- );
- }}
- >
- <div class="bg-blue-300 rounded-full size-2" />
- </div>
</>
);
}}
@@ -1098,6 +1104,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={100}
step={0.1}
+ formatTooltip="%"
/>
</Field>
{/** Dashed divider */}
@@ -1109,6 +1116,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={40}
step={0.1}
+ formatTooltip="%"
/>
</Field>
<Field
@@ -1121,6 +1129,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={100}
step={0.1}
+ formatTooltip="%"
/>
</Field>
<Field name="Shadow" icon={<IconCapShadow class="size-4" />}>
@@ -1142,6 +1151,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={100}
step={0.1}
+ formatTooltip="%"
/>
<ShadowSettings
scrollRef={scrollRef}
@@ -1198,9 +1208,9 @@ export function ConfigSidebar() {
</Field>
</ComingSoonTooltip> */}
</KTabs.Content>
- <KTabs.Content value="camera" class="flex flex-col gap-8">
+ <KTabs.Content value="camera" class="flex flex-col gap-6">
<Field icon={<IconCapCamera class="size-4" />} name="Camera">
- <div class="flex flex-col gap-8">
+ <div class="flex flex-col gap-6">
<div>
<Subfield name="Position" />
<KRadioGroup
@@ -1236,7 +1246,7 @@ export function ConfigSidebar() {
)}
onClick={() => setProject("camera", "position", item)}
>
- <div class="size-[0.5rem] shrink-0 bg-white rounded-full" />
+ <div class="size-[0.5rem] shrink-0 bg-solid-white rounded-full" />
</RadioGroup.ItemControl>
</RadioGroup.Item>
)}
@@ -1259,23 +1269,19 @@ export function ConfigSidebar() {
</Field>
{/** Dashed divider */}
<div class="w-full border-t border-gray-300 border-dashed" />
- <Field
- name="Size"
- icon={<IconCapEnlarge class="size-4" />}
- value={`${project.camera.size}%`}
- >
+ <Field name="Size" icon={<IconCapEnlarge class="size-4" />}>
<Slider
value={[project.camera.size]}
onChange={(v) => setProject("camera", "size", v[0])}
minValue={20}
maxValue={80}
step={0.1}
+ formatTooltip="%"
/>
</Field>
<Field
name="Size During Zoom"
icon={<IconCapEnlarge class="size-4" />}
- value={`${project.camera.zoom_size}%`}
>
<Slider
value={[project.camera.zoom_size ?? 60]}
@@ -1283,6 +1289,7 @@ export function ConfigSidebar() {
minValue={10}
maxValue={60}
step={0.1}
+ formatTooltip="%"
/>
</Field>
<Field
@@ -1295,6 +1302,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={100}
step={0.1}
+ formatTooltip="%"
/>
</Field>
<Field name="Shadow" icon={<IconCapShadow class="size-4" />}>
@@ -1305,6 +1313,7 @@ export function ConfigSidebar() {
minValue={0}
maxValue={100}
step={0.1}
+ formatTooltip="%"
/>
<ShadowSettings
scrollRef={scrollRef}
@@ -1562,7 +1571,7 @@ export function ConfigSidebar() {
return (
<div
data-visible={state.timelineSelection?.type === "zoom"}
- class="absolute inset-0 p-[0.75rem] text-[0.875rem] space-y-6 bg-gray-50 z-50 animate-in slide-in-from-bottom-2 fade-in"
+ class="absolute inset-0 p-[0.75rem] text-[0.875rem] space-y-6 bg-gray-100 z-50 animate-in slide-in-from-bottom-2 fade-in"
>
<div class="flex flex-row justify-between items-center">
<div class="flex gap-2 items-center">
@@ -1595,10 +1604,7 @@ export function ConfigSidebar() {
Delete
</EditorButton>
</div>
- <Field
- name={`Zoom Amount (${zoomPercentage()})`}
- icon={<IconLucideSearch />}
- >
+ <Field name="Zoom Amount" icon={<IconLucideSearch />}>
<Slider
value={[value().segment.amount]}
onChange={(v) =>
@@ -1613,6 +1619,7 @@ export function ConfigSidebar() {
minValue={1}
maxValue={4.5}
step={0.001}
+ formatTooltip="x"
/>
</Field>
<Field name="Zoom Mode" icon={<IconCapSettings />}>
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index ac13fa840..1d0727687 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -123,11 +123,11 @@ function Inner() {
<div class="flex flex-col w-screen h-screen">
<Header />
<div
- class="flex overflow-y-hidden flex-col flex-1 gap-4 p-5 w-full leading-5 bg-gray-50 backdrop-blur-md animate-in fade-in"
+ class="flex overflow-y-hidden flex-col flex-1 gap-4 p-4 w-full leading-5 bg-gray-100 dark:bg-gray-50 backdrop-blur-md animate-in fade-in"
data-tauri-drag-region
>
- <div class="flex overflow-hidden flex-col flex-1 bg-gray-50">
- <div class="flex overflow-y-hidden flex-row flex-1">
+ <div class="flex overflow-hidden flex-col flex-1">
+ <div class="flex overflow-y-hidden flex-row flex-1 gap-4">
<Player />
<ConfigSidebar />
</div>
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index 20263751f..018016ddb 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -5,24 +5,21 @@ import {
batch,
createEffect,
createSignal,
- JSX,
onCleanup,
onMount,
} from "solid-js";
+import { remove } from "@tauri-apps/plugin-fs";
+import { ask } from "@tauri-apps/plugin-dialog";
+import { getCurrentWindow } from "@tauri-apps/api/window";
+import { revealItemInDir } from "@tauri-apps/plugin-opener";
import Titlebar from "~/components/titlebar/Titlebar";
-import { createLicenseQuery } from "~/utils/queries";
import { initializeTitlebar, setTitlebar } from "~/utils/titlebar-state";
-import AspectRatioSelect from "./AspectRatioSelect";
import { useEditorContext } from "./context";
import ExportButton from "./ExportButton";
import PresetsDropdown from "./PresetsDropdown";
import ShareButton from "./ShareButton";
import { EditorButton } from "./ui";
-import { remove } from "@tauri-apps/plugin-fs";
-import { ask } from "@tauri-apps/plugin-dialog";
-import { commands } from "~/utils/tauri";
-import { getCurrentWindow } from "@tauri-apps/api/window";
export type ResolutionOption = {
label: string;
@@ -43,80 +40,6 @@ export interface ExportEstimates {
estimated_size_mb: number;
}
-// Menu configuration for the header
-const Menu = {
- left: [
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => (
- <EditorButton
- tooltipText="Captions"
- leftIcon={<IconCapCaptions class="w-5" />}
- comingSoon
- />
- ),
- },
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => (
- <EditorButton
- tooltipText="Performance"
- leftIcon={<IconCapGauge class="w-[18px]" />}
- comingSoon
- />
- ),
- },
- ],
- center: [
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => <PresetsDropdown />,
- },
- ],
- right: [
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => {
- const { history } = props.editorContext;
- return (
- <EditorButton
- onClick={() => history.undo()}
- disabled={!history.canUndo()}
- tooltipText="Undo"
- leftIcon={<IconCapUndo class="w-5" />}
- />
- );
- },
- },
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => {
- const { history } = props.editorContext;
- return (
- <EditorButton
- onClick={() => history.redo()}
- disabled={!history.canRedo()}
- tooltipText="Redo"
- leftIcon={<IconCapRedo class="w-5" />}
- />
- );
- },
- },
- ],
-} satisfies Record<
- "left" | "center" | "right",
- {
- button: (props: {
- editorContext: ReturnType<typeof useEditorContext>;
- }) => JSX.Element;
- }[]
->;
-
export function Header() {
const editorContext = useEditorContext();
@@ -178,20 +101,33 @@ export function Header() {
class="absolute flex gap-4 h-full w-full items-start left-[5.5rem] z-10"
>
<div class="flex gap-2 items-center h-full">
- <EditorButton
- onClick={async () => {
- const currentWindow = getCurrentWindow();
- if (!editorContext?.editorInstance.path) return ;
- if (!(await ask("Are you sure you want to delete this recording?")))
- return;
- await remove(editorContext?.editorInstance.path, { recursive: true });
- await currentWindow.close();
- }}
- tooltipText="Delete recording"
- leftIcon={<IconCapTrash class="w-5" />}
- />
+ <EditorButton
+ onClick={async () => {
+ const currentWindow = getCurrentWindow();
+ if (!editorContext?.editorInstance.path) return;
+ if (
+ !(await ask("Are you sure you want to delete this recording?"))
+ )
+ return;
+ await remove(editorContext?.editorInstance.path, {
+ recursive: true,
+ });
+ await currentWindow.close();
+ }}
+ tooltipText="Delete recording"
+ leftIcon={<IconCapTrash class="w-5" />}
+ />
+ <EditorButton
+ onClick={() =>
+ revealItemInDir(`${editorContext.editorInstance.path}/`)
+ }
+ tooltipText="Open recording bundle"
+ leftIcon={<IconLucideFolder class="w-5" />}
+ />
+
<p class="text-sm text-gray-500">
- {editorContext.editorInstance.prettyName}<span class="text-sm text-gray-400">.cap</span>
+ {editorContext.editorInstance.prettyName}
+ <span class="text-sm text-gray-400">.cap</span>
</p>
{/* <ErrorBoundary fallback={<></>}>
<Suspense>
@@ -217,25 +153,51 @@ export function Header() {
</ErrorBoundary> */}
</div>
</div>
- <div
- data-tauri-drag-region
- class="flex absolute inset-x-0 z-10 items-center mx-auto h-full w-fit"
- >
- {Object.values(Menu).map((section) => (
- <div
- class={cx(
- "flex gap-4 items-center px-4 h-full",
- section === Menu.center &&
- "border-r border-l border-r-gray-200 border-l-gray-200"
- )}
- >
- {section.map((item) => (
- <>{item.button({ editorContext })}</>
- ))}
- </div>
- ))}
- </div>
+ <TopBar />
<Titlebar />
</div>
);
}
+
+function TopBar() {
+ const editorContext = useEditorContext();
+
+ return (
+ <div
+ data-tauri-drag-region
+ class="flex absolute inset-x-0 z-10 items-center mx-auto h-full w-fit"
+ >
+ <div class="flex gap-4 items-center px-4 h-full">
+ <EditorButton
+ tooltipText="Captions"
+ leftIcon={<IconCapCaptions class="w-5" />}
+ comingSoon
+ />
+ <EditorButton
+ tooltipText="Performance"
+ leftIcon={<IconCapGauge class="w-[18px]" />}
+ comingSoon
+ />
+ </div>
+
+ <div class="flex gap-4 items-center px-4 border-r border-l border-r-gray-200 border-l-gray-200 my-2">
+ <PresetsDropdown />
+ </div>
+
+ <div class="flex gap-4 items-center px-4 h-full">
+ <EditorButton
+ onClick={() => editorContext.history.undo()}
+ disabled={!editorContext.history.canUndo()}
+ tooltipText="Undo"
+ leftIcon={<IconCapUndo class="w-5" />}
+ />
+ <EditorButton
+ onClick={() => editorContext.history.redo()}
+ disabled={!editorContext.history.canRedo()}
+ tooltipText="Redo"
+ leftIcon={<IconCapRedo class="w-5" />}
+ />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsx
index 51e62eaa8..7c32304b8 100644
--- a/apps/desktop/src/routes/editor/Player.tsx
+++ b/apps/desktop/src/routes/editor/Player.tsx
@@ -1,7 +1,7 @@
import { ToggleButton as KToggleButton } from "@kobalte/core/toggle-button";
import { createElementBounds } from "@solid-primitives/bounds";
import { createEventListener } from "@solid-primitives/event-listener";
-import { Show, createEffect, createSignal } from "solid-js";
+import { Setter, Show, createEffect, createSignal } from "solid-js";
import { cx } from "cva";
import Tooltip from "~/components/Tooltip";
@@ -32,19 +32,6 @@ export function Player() {
zoomOutLimit,
} = useEditorContext();
- let canvasRef!: HTMLCanvasElement;
-
- createEffect(() => {
- const frame = latestFrame();
- if (!frame) return;
- const ctx = canvasRef.getContext("2d");
- ctx?.putImageData(frame.data, 0, 0);
- });
-
- const [canvasContainerRef, setCanvasContainerRef] =
- createSignal<HTMLDivElement>();
- const containerBounds = createElementBounds(canvasContainerRef);
-
const splitButton = () => (
<EditorButton<typeof KToggleButton>
disabled={!window.FLAGS.split}
@@ -108,87 +95,33 @@ export function Player() {
});
return (
- <div class="flex flex-col flex-1">
- <div class="flex w-[calc(100%-40px)] mx-auto gap-3 justify-center p-5 bg-gray-100 rounded-t-xl">
+ <div class="flex flex-col flex-1 bg-gray-100 dark:bg-gray-100 rounded-xl">
+ <div class="flex gap-3 justify-center p-3">
<AspectRatioSelect />
<EditorButton
onClick={() => {
const display = editorInstance.recordings.segments[0].display;
setDialog({
- open: true,
- type: "crop",
- position: {
- ...(project.background.crop?.position ?? { x: 0, y: 0 }),
- },
- size: {
- ...(project.background.crop?.size ?? {
- x: display.width,
- y: display.height,
- }),
- },
- });
- }}
- leftIcon={<IconCapCrop class="w-5 text-gray-500" />}
- >
- Crop
- </EditorButton>
- </div>
- <div ref={setCanvasContainerRef} class="relative flex-1 justify-center items-center bg-gray-50">
- <Show when={latestFrame()}>
- {(currentFrame) => {
- const padding = 4;
-
- const containerAspect = () => {
- if (containerBounds.width && containerBounds.height) {
- return (
- (containerBounds.width - padding * 2) /
- (containerBounds.height - padding * 2)
- );
- }
-
- return 1;
- };
-
- const frameAspect = () =>
- currentFrame().width / currentFrame().data.height;
-
- const size = () => {
- if (frameAspect() < containerAspect()) {
- const height = (containerBounds.height ?? 0) - padding * 1;
-
- return {
- width: height * frameAspect(),
- height,
- };
- }
-
- const width = (containerBounds.width ?? 0) - padding * 2;
-
- return {
- width,
- height: width / frameAspect(),
- };
- };
-
- return (
- <div class="relative w-[calc(100%-40px)] overflow-hidden flex items-center justify-center mx-auto h-full bg-gray-100">
- <canvas
- style={{
- width: `${size().width - padding * 2}px`,
- height: `${size().height}px`,
- }}
- class="bg-blue-50 rounded"
- ref={canvasRef}
- id="canvas"
- width={currentFrame().width}
- height={currentFrame().data.height}
- />
- </div>
- );
+ open: true,
+ type: "crop",
+ position: {
+ ...(project.background.crop?.position ?? { x: 0, y: 0 }),
+ },
+ size: {
+ ...(project.background.crop?.size ?? {
+ x: display.width,
+ y: display.height,
+ }),
+ },
+ });
}}
- </Show>
+ leftIcon={<IconCapCrop class="w-5 text-gray-500" />}
+ >
+ Crop
+ </EditorButton>
</div>
- <div class="flex z-10 overflow-hidden flex-row gap-3 justify-between items-center p-5 w-[calc(100%-40px)] mx-auto bg-gray-100 rounded-b-xl">
+ <PreviewCanvas />
+ <div class="flex z-10 overflow-hidden flex-row gap-3 justify-between items-center p-5">
<div class="flex-1">
<Time
class="text-gray-500"
@@ -239,6 +172,7 @@ export function Player() {
) : (
<ComingSoonTooltip>{splitButton()}</ComingSoonTooltip>
)}
+ <div class="w-px h-8 rounded-full bg-gray-200" />
<Tooltip content="Zoom out">
<IconCapZoomOut
onClick={() => {
@@ -261,12 +195,6 @@ export function Player() {
class="text-gray-500 size-5 will-change-[opacity] transition-opacity hover:opacity-70"
/>
</Tooltip>
- <p class="text-sm tabular-nums text-gray-500">
- {Math.min(
- Math.max(1 - state.timelineTransform.zoom / zoomOutLimit(), 0),
- 1
- ).toFixed(2) + "x"}
- </p>
<Slider
class="w-24"
minValue={0}
@@ -284,6 +212,9 @@ export function Player() {
playbackTime()
);
}}
+ formatTooltip={() =>
+ `${state.timelineTransform.zoom.toFixed(0)} seconds visible`
+ }
/>
</div>
</div>
@@ -291,6 +222,85 @@ export function Player() {
);
}
+function PreviewCanvas() {
+ const { latestFrame } = useEditorContext();
+
+ let canvasRef: HTMLCanvasElement | undefined;
+
+ const [canvasContainerRef, setCanvasContainerRef] =
+ createSignal<HTMLDivElement>();
+ const containerBounds = createElementBounds(canvasContainerRef);
+
+ createEffect(() => {
+ const frame = latestFrame();
+ if (!frame) return;
+ if (!canvasRef) return;
+ const ctx = canvasRef.getContext("2d");
+ ctx?.putImageData(frame.data, 0, 0);
+ });
+
+ return (
+ <div
+ ref={setCanvasContainerRef}
+ class="relative flex-1 justify-center items-center"
+ >
+ <Show when={latestFrame()}>
+ {(currentFrame) => {
+ const padding = 4;
+
+ const containerAspect = () => {
+ if (containerBounds.width && containerBounds.height) {
+ return (
+ (containerBounds.width - padding * 2) /
+ (containerBounds.height - padding * 2)
+ );
+ }
+
+ return 1;
+ };
+
+ const frameAspect = () =>
+ currentFrame().width / currentFrame().data.height;
+
+ const size = () => {
+ if (frameAspect() < containerAspect()) {
+ const height = (containerBounds.height ?? 0) - padding * 1;
+
+ return {
+ width: height * frameAspect(),
+ height,
+ };
+ }
+
+ const width = (containerBounds.width ?? 0) - padding * 2;
+
+ return {
+ width,
+ height: width / frameAspect(),
+ };
+ };
+
+ return (
+ <div class="absolute inset-0 overflow-hidden flex items-center justify-center h-full">
+ <canvas
+ style={{
+ width: `${size().width - padding * 2}px`,
+ height: `${size().height}px`,
+ }}
+ class="bg-blue-50 rounded"
+ ref={canvasRef}
+ id="canvas"
+ width={currentFrame().width}
+ height={currentFrame().data.height}
+ />
+ </div>
+ );
+ }}
+ </Show>
+ </div>
+ );
+}
+
function Time(props: { seconds: number; fps?: number; class?: string }) {
return (
<span class={cx("text-gray-400 text-sm tabular-nums", props.class)}>
diff --git a/apps/desktop/src/routes/editor/PresetsDropdown.tsx b/apps/desktop/src/routes/editor/PresetsDropdown.tsx
index 6a3a0b0bd..aa217cd99 100644
--- a/apps/desktop/src/routes/editor/PresetsDropdown.tsx
+++ b/apps/desktop/src/routes/editor/PresetsDropdown.tsx
@@ -11,17 +11,18 @@ import {
MenuItemList,
PopperContent,
dropdownContainerClasses,
- topLeftAnimateClasses,
+ topCenterAnimateClasses,
} from "./ui";
-function PresetsDropdown() {
+export function PresetsDropdown() {
const { setDialog, presets, setProject } = useEditorContext();
return (
- <KDropdownMenu gutter={8}>
+ <KDropdownMenu gutter={8} placement="bottom">
<EditorButton<typeof KDropdownMenu.Trigger>
as={KDropdownMenu.Trigger}
leftIcon={<IconCapPresets />}
+ rightIcon={<IconCapChevronDown />}
>
Presets
</EditorButton>
@@ -29,7 +30,7 @@ function PresetsDropdown() {
<Suspense>
<PopperContent<typeof KDropdownMenu.Content>
as={KDropdownMenu.Content}
- class={cx("w-72 max-h-56", topLeftAnimateClasses)}
+ class={cx("w-72 max-h-56", topCenterAnimateClasses)}
>
<MenuItemList<typeof KDropdownMenu.Group>
as={KDropdownMenu.Group}
diff --git a/apps/desktop/src/routes/editor/ShadowSettings.tsx b/apps/desktop/src/routes/editor/ShadowSettings.tsx
index bbac0fb50..778b17a8e 100644
--- a/apps/desktop/src/routes/editor/ShadowSettings.tsx
+++ b/apps/desktop/src/routes/editor/ShadowSettings.tsx
@@ -1,6 +1,6 @@
import { cx } from "cva";
import { createSignal } from "solid-js";
-import { Slider } from "./ui";
+import { Field, Slider } from "./ui";
interface Props {
size: {
@@ -50,9 +50,8 @@ const ShadowSettings = (props: Props) => {
</button>
{isOpen() && (
- <div class="mt-4 space-y-8 font-medium">
- <div class="flex flex-col gap-6">
- <span class="text-sm text-gray-500">Size</span>
+ <div class="mt-4 space-y-6 font-medium">
+ <Field name="Size">
<Slider
value={props.size.value}
onChange={props.size.onChange}
@@ -60,9 +59,8 @@ const ShadowSettings = (props: Props) => {
maxValue={100}
step={0.1}
/>
- </div>
- <div class="flex flex-col gap-6">
- <span class="text-sm text-gray-500">Opacity</span>
+ </Field>
+ <Field name="Opacity">
<Slider
value={props.opacity.value}
onChange={props.opacity.onChange}
@@ -70,9 +68,8 @@ const ShadowSettings = (props: Props) => {
maxValue={100}
step={0.1}
/>
- </div>
- <div class="flex flex-col gap-6">
- <span class="text-sm text-gray-500">Blur</span>
+ </Field>
+ <Field name="Blur">
<Slider
value={props.blur.value}
onChange={props.blur.onChange}
@@ -80,7 +77,7 @@ const ShadowSettings = (props: Props) => {
maxValue={100}
step={0.1}
/>
- </div>
+ </Field>
</div>
)}
</div>
diff --git a/apps/desktop/src/routes/editor/Timeline.tsx b/apps/desktop/src/routes/editor/Timeline.tsx
index 4566df4d1..96e595881 100644
--- a/apps/desktop/src/routes/editor/Timeline.tsx
+++ b/apps/desktop/src/routes/editor/Timeline.tsx
@@ -139,7 +139,7 @@ export function Timeline() {
timelineBounds={timelineBounds}
>
<div
- class="py-[2rem] relative overflow-hidden"
+ class="pt-[2rem] relative overflow-hidden"
style={{
"padding-left": `${xPadding}px`,
"padding-right": `${xPadding}px`,
@@ -211,7 +211,7 @@ export function Timeline() {
{(time) => (
<div
class={cx(
- "flex absolute bottom-0 top-4 left-5 z-10 justify-center items-center w-px bg-gradient-to-b h-[70%] from-gray-400 to-transparent pointer-events-none",
+ "flex absolute bottom-0 top-4 left-5 z-10 justify-center items-center w-px pointer-events-none bg-gradient-to-b to-[120%] from-gray-400",
split() ? "text-red-300" : "text-black-transparent-20"
)}
style={{
@@ -232,7 +232,7 @@ export function Timeline() {
</Show>
<Show when={!split()}>
<div
- class="absolute bottom-0 top-4 h-[70%] z-10 w-px bg-gradient-to-b from-[#66D0FF] pointer-events-none to-blue-transparent-0"
+ class="absolute bottom-0 top-4 h-full rounded-full z-10 w-px pointer-events-none bg-gradient-to-b to-[120%] from-[rgb(226,64,64)]"
style={{
left: `${xPadding}px`,
transform: `translateX(${Math.min(
@@ -242,7 +242,7 @@ export function Timeline() {
)}px)`,
}}
>
- <div class="size-3 bg-[#66D0FF] rounded-full -mt-2 -ml-[calc(0.37rem-0.5px)]" />
+ <div class="size-3 bg-[rgb(226,64,64)] rounded-full -mt-2 -ml-[calc(0.37rem-0.5px)]" />
</div>
</Show>
<ClipTrack ref={setTimelineRef} />
@@ -327,8 +327,6 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
state.timelineTransform.updateZoom(totalDuration(), previewTime()!);
}
}
-
-
return (
<TrackRoot ref={props.ref}>
@@ -422,8 +420,9 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
})()}
<SegmentHandle
+ position="start"
class={cx(
- "absolute opacity-0 top-[50%] bg-gradient-to-r -translate-y-1/2 left-2.5 z-10 w-[3px] h-8 bg-solid-white rounded-full",
+ "absolute opacity-0 inset-y-0 z-10",
"group-hover:opacity-100"
)}
onMouseDown={(downEvent) => {
@@ -484,22 +483,39 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
});
}}
/>
- <SegmentContent class="justify-between relative bg-gradient-to-r timeline-gradient-border from-[#2675DB] via-[#5CA3FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]">
- <Show when={segment.start > 0}>
- <span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] left-5">
- {formatTime(segment.start)}
- </span>
- </Show>
+ <SegmentContent class="justify-center items-center relative dark:text-black-transparent-60 text-white-transparent-60 bg-gradient-to-r timeline-gradient-border from-[#2675DB] via-[#4FA0FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]">
+ <Show when={segment.start > 0}>
+ <span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] left-5">
+ {formatTime(segment.start)}
+ </span>
+ </Show>
<div class="absolute inset-0 -top-[120px] dark:bg-gray-500 bg-gray-50 w-[500px] h-[150px] rounded-full mx-auto blur-[50px] mix-blend-overlay opacity-30" />
- <Show when={segment.end < editorInstance.recordingDuration}>
- <span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] right-5">
- {formatTime(segment.end)}
- </span>
- </Show>
+ {(() => {
+ const ctx = useSegmentContext();
+
+ return (
+ <Show when={ctx.width() > 100}>
+ <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-500 whitespace-nowrap">
+ <span class="text-solid-white opacity-60">Clip</span>
+ <div class="flex gap-1 items-center text-gray-50 dark:text-gray-500 text-md">
+ <IconLucideClock class="size-3.5" />{" "}
+ {(segment.end - segment.start).toFixed(1)}s
+ </div>
+ </div>
+ </Show>
+ );
+ })()}
+
+ <Show when={segment.end < editorInstance.recordingDuration}>
+ <span class="text-[0.625rem] absolute top-[18px] right-5">
+ {formatTime(segment.end)}
+ </span>
+ </Show>
</SegmentContent>
<SegmentHandle
+ position="end"
class={cx(
- "absolute top-[50%] opacity-0 -translate-y-1/2 right-2.5 z-10 w-[3px] h-8 bg-solid-white rounded-full",
+ "absolute opacity-0 inset-y-0 z-10",
"group-hover:opacity-100"
)}
onMouseDown={(downEvent) => {
@@ -679,8 +695,8 @@ function ZoomTrack(props: {
end: time() + 1,
}}
>
- <SegmentContent class="bg-gradient-to-r zoom-gradient-border bg-[#adadad] transition-colors group shadow-[inset_0_-5px_20px_3px_rgba(255,255,255,0.8)]">
- <p class="w-full text-center text-gray-500 text-md text-primary dark:text-gray-50">
+ <SegmentContent class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]">
+ <p class="w-full text-center dark:text-gray-500 text-md text-primary text-gray-50">
+
</p>
</SegmentContent>
@@ -774,9 +790,8 @@ function ZoomTrack(props: {
}}
>
<SegmentHandle
- class={cx(
- "absolute top-[50%] group-hover:opacity-100 opacity-0 -translate-y-1/2 left-2.5 z-10 w-[3px] h-8 dark:bg-gray-500 bg-gray-50 rounded-full"
- )}
+ position="start"
+ class="absolute group-hover:opacity-100 opacity-0"
onMouseDown={createMouseDownDrag(
() => {
const start = segment.start;
@@ -857,8 +872,9 @@ function ZoomTrack(props: {
return (
<Show when={ctx.width() > 100}>
- <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-500 whitespace-nowrap">
- <div class="flex gap-1 items-center text-gray-50 dark:text-gray-500 text-md">
+ <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 dark:text-gray-500 whitespace-nowrap">
+ <span class="opacity-70">Zoom</span>
+ <div class="flex gap-1 items-center text-md">
<IconLucideSearch class="size-3.5" />{" "}
{zoomPercentage()}{" "}
</div>
@@ -868,9 +884,8 @@ function ZoomTrack(props: {
})()}
</SegmentContent>
<SegmentHandle
- class={cx(
- "absolute top-[50%] group-hover:opacity-100 opacity-0 -translate-y-1/2 right-2.5 z-10 w-[3px] h-8 dark:bg-gray-500 bg-gray-50 rounded-full"
- )}
+ position="end"
+ class="absolute group-hover:opacity-100 opacity-0"
onMouseDown={createMouseDownDrag(
() => {
const end = segment.end;
@@ -924,7 +939,7 @@ function TrackRoot(props: ComponentProps<"div">) {
<div
{...props}
ref={mergeRefs(setRef, props.ref)}
- class={cx("flex flex-row relative h-[3rem]", props.class)}
+ class={cx("flex flex-row relative h-14", props.class)}
>
{props.children}
</div>
@@ -972,7 +987,7 @@ function SegmentRoot(
<div
{...props}
class={cx(
- "absolute border rounded-[calc(0.75rem+1px)] h-14 w-full",
+ "absolute border rounded-[calc(0.75rem+1px)] inset-y-0 w-full",
props.class,
isSelected() && "wobble-wrapper border border-gray-500"
)}
@@ -1008,16 +1023,23 @@ function SegmentContent(props: ComponentProps<"div">) {
);
}
-function SegmentHandle(props: ComponentProps<"div">) {
+function SegmentHandle(
+ props: ComponentProps<"div"> & { position: "start" | "end" }
+) {
const ctx = useSegmentContext();
return (
<div
{...props}
class={cx(
- "w-[0.5rem] cursor-col-resize shrink-0 data-[hidden='true']:opacity-0 transition-opacity",
+ "w-3 cursor-col-resize shrink-0 data-[hidden='true']:opacity-0 transition-opacity h-full flex flex-row items-center",
+ props.position === "start"
+ ? "left-0 justify-end"
+ : "right-0 justify-start",
props.class
)}
data-hidden={ctx.width() < 50}
- />
+ >
+ <div class="w-[3px] h-8 bg-solid-white rounded-full" />
+ </div>
);
}
diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.ts
index 54587d1cf..8b6a96f87 100644
--- a/apps/desktop/src/routes/editor/context.ts
+++ b/apps/desktop/src/routes/editor/context.ts
@@ -1,4 +1,3 @@
-// @refresh reload
import { createElementBounds, NullableBounds } from "@solid-primitives/bounds";
import { createContextProvider } from "@solid-primitives/context";
import { trackStore } from "@solid-primitives/deep";
@@ -11,7 +10,7 @@ import {
createEffect,
createResource,
createSignal,
- on
+ on,
} from "solid-js";
import { createStore, reconcile, unwrap } from "solid-js/store";
@@ -22,7 +21,7 @@ import {
events,
type ProjectConfiguration,
type SerializedEditorInstance,
- type XY
+ type XY,
} from "~/utils/tauri";
export type CurrentDialog =
@@ -41,14 +40,13 @@ export const OUTPUT_SIZE = {
};
export const BACKGROUND_THEMES = {
- macOS: "Macos",
+ macOS: "macOS",
dark: "Dark",
blue: "Blue",
purple: "Purple",
orange: "Orange",
};
-
export const MAX_ZOOM_IN = 3;
export const [EditorContextProvider, useEditorContext] = createContextProvider(
@@ -74,9 +72,9 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
"background" | "camera" | "transcript" | "audio" | "cursor" | "hotkeys"
>("background");
- //Background tabs
- const [backgroundTab, setBackgroundTab] =
- createSignal<keyof typeof BACKGROUND_THEMES>("macOS");
+ //Background tabs
+ const [backgroundTab, setBackgroundTab] =
+ createSignal<keyof typeof BACKGROUND_THEMES>("macOS");
const [dialog, setDialog] = createSignal<DialogState>({
open: false,
@@ -293,7 +291,7 @@ export const [TimelineContextProvider, useTimelineContext] =
(props: {
duration: number;
secsPerPixel: number;
- timelineBounds: Readonly<NullableBounds>;
+ timelineBounds: Readonly<NullableBounds>;
}) => {
return {
duration: () => props.duration,
diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx
index 341ee8fac..7a0847ed9 100644
--- a/apps/desktop/src/routes/editor/ui.tsx
+++ b/apps/desktop/src/routes/editor/ui.tsx
@@ -3,10 +3,15 @@ import { Dialog as KDialog } from "@kobalte/core/dialog";
import { DropdownMenu } from "@kobalte/core/dropdown-menu";
import { Polymorphic, type PolymorphicProps } from "@kobalte/core/polymorphic";
import { Slider as KSlider } from "@kobalte/core/slider";
-import { Switch as KSwitch } from "@kobalte/core/switch";
+import { Switch as KSwitch, Thumb } from "@kobalte/core/switch";
import { Tooltip as KTooltip } from "@kobalte/core/tooltip";
+import { createElementBounds } from "@solid-primitives/bounds";
+import { createEventListener } from "@solid-primitives/event-listener";
import { cva, cx, type VariantProps } from "cva";
+
import {
+ createRoot,
+ createSignal,
mergeProps,
splitProps,
type ComponentProps,
@@ -22,7 +27,7 @@ export function Field(
props: ParentProps<{ name: string; icon?: JSX.Element; value?: JSX.Element }>
) {
return (
- <div class="flex flex-col gap-5">
+ <div class="flex flex-col gap-4">
<span class="flex flex-row items-center gap-[0.375rem] text-gray-500 font-medium text-sm">
{props.icon}
{props.name}
@@ -45,7 +50,9 @@ export function Subfield(
>
<span>
{props.name}
- {props.required && <span class="ml-[2px] text-xs text-blue-500">*</span>}
+ {props.required && (
+ <span class="ml-[2px] text-xs text-blue-500">*</span>
+ )}
</span>
{props.children}
</div>
@@ -63,16 +70,29 @@ export function Toggle(props: ComponentProps<typeof KSwitch>) {
);
}
-export function Slider(props: ComponentProps<typeof KSlider>) {
+export function Slider(
+ props: ComponentProps<typeof KSlider> & {
+ formatTooltip?: string | ((v: number) => string);
+ }
+) {
const { history } = useEditorContext();
// Pause history when slider is being dragged
let resumeHistory: (() => void) | null = null;
+ const [thumbRef, setThumbRef] = createSignal<HTMLDivElement>();
+
+ const thumbBounds = createElementBounds(thumbRef);
+
+ const [dragging, setDragging] = createSignal(false);
+
return (
<KSlider
{...props}
- class={cx("relative px-1 bg-gray-200 rounded-full", props.class)}
+ class={cx(
+ "relative px-1 h-4 flex flex-row justify-stretch items-center",
+ props.class
+ )}
onChange={(v) => {
if (!resumeHistory) resumeHistory = history.pause();
props.onChange?.(v);
@@ -83,13 +103,61 @@ export function Slider(props: ComponentProps<typeof KSlider>) {
props.onChangeEnd?.(e);
}}
>
- <KSlider.Track class="h-[0.2rem] relative mx-1">
- <KSlider.Fill class="absolute -ml-2 h-full bg-gray-400 rounded-full ui-disabled:bg-gray-300" />
- <KSlider.Thumb
- class={cx(
- "bg-gray-500 rounded-full outline-none size-4 -top-[6.5px] transition-shadow duration-200 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 focus:ring-offset-gray-200 ui-disabled:bg-gray-400"
- )}
+ <KSlider.Track
+ class="h-[0.3rem] transition-[height] relative mx-1 bg-gray-200 rounded-full w-full"
+ onPointerDown={() => {
+ setDragging(true);
+ console.log("set dragging true");
+ createRoot((dispose) => {
+ createEventListener(window, "mouseup", () => {
+ setDragging(false);
+ console.log("set dragging false");
+ dispose();
+ });
+ });
+ }}
+ >
+ <KSlider.Fill
+ onPointerDown={() => {
+ console.log("MOUSE DOWN FILL");
+ }}
+ class="absolute -ml-2 h-full bg-blue-300 rounded-full ui-disabled:bg-gray-300"
/>
+ <Tooltip
+ open={dragging() ? true : undefined}
+ getAnchorRect={() => {
+ return {
+ x: thumbBounds.left ?? undefined,
+ y: thumbBounds.top ?? undefined,
+ width: thumbBounds.width ?? undefined,
+ height: thumbBounds.height ?? undefined,
+ };
+ }}
+ content={
+ props.value?.[0] !== undefined
+ ? typeof props.formatTooltip === "string"
+ ? `${props.value[0].toFixed(1)}${props.formatTooltip}`
+ : props.formatTooltip
+ ? props.formatTooltip(props.value[0])
+ : props.value[0].toFixed(1)
+ : undefined
+ }
+ >
+ <KSlider.Thumb
+ ref={setThumbRef}
+ onPointerDown={() => {
+ setDragging(true);
+ console.log("set dragging true");
+ }}
+ onPointerUp={() => {
+ setDragging(false);
+ console.log("set dragging false");
+ }}
+ class={cx(
+ "bg-solid-white shadow-xl border border-gray-300 rounded-full outline-none size-4 -top-[6.3px] ui-disabled:bg-gray-400"
+ )}
+ />
+ </Tooltip>
</KSlider.Track>
</KSlider>
);
@@ -143,7 +211,7 @@ export const Dialog = {
},
ConfirmButton(_props: ComponentProps<typeof Button>) {
const props = mergeProps(
- { variant: "primary"} as ComponentProps<typeof Button>,
+ { variant: "primary" } as ComponentProps<typeof Button>,
_props
);
return <Button {...props} />;
@@ -349,6 +417,9 @@ export const dropdownContainerClasses =
export const topLeftAnimateClasses =
"ui-expanded:animate-in ui-expanded:fade-in ui-expanded:zoom-in-95 ui-closed:animate-out ui-closed:fade-out ui-closed:zoom-out-95 origin-top-left";
+export const topCenterAnimateClasses =
+ "ui-expanded:animate-in ui-expanded:fade-in ui-expanded:zoom-in-95 ui-closed:animate-out ui-closed:fade-out ui-closed:zoom-out-95 origin-top-center";
+
export const topRightAnimateClasses =
"ui-expanded:animate-in ui-expanded:fade-in ui-expanded:zoom-in-95 ui-closed:animate-out ui-closed:fade-out ui-closed:zoom-out-95 origin-top-right";
diff --git a/apps/desktop/src/styles/theme.css b/apps/desktop/src/styles/theme.css
index 2bdc65246..29cb7a664 100644
--- a/apps/desktop/src/styles/theme.css
+++ b/apps/desktop/src/styles/theme.css
@@ -1,7 +1,6 @@
@tailwind utilities;
:root {
-
/* Light theme variables */
--gray-50: #ffffff; /* Pure white background */
--gray-100: #f8f9fb; /* Soft background */
@@ -19,7 +18,6 @@
--gray-450-transparent-50: rgba(234, 236, 239, 0.5);
--gray-500-transparent-50: rgba(22, 27, 38, 0.5);
-
--text-primary: rgba(18, 22, 31, 0.95); /* Section titles, headings */
--text-secondary: rgba(18, 22, 31, 0.85); /* Important labels */
--text-tertiary: rgba(18, 22, 31, 0.65); /* Descriptions */
@@ -30,14 +28,13 @@
--black-transparent-40: rgba(18, 22, 31, 0.4);
--black-transparent-60: rgba(18, 22, 31, 0.6);
--black-transparent-80: rgba(18, 22, 31, 0.8);
-
+
--white-transparent-5: rgba(255, 255, 255, 0.05);
--white-transparent-10: rgba(255, 255, 255, 0.1);
--white-transparent-20: rgba(255, 255, 255, 0.2);
--white-transparent-40: rgba(255, 255, 255, 0.4);
--white-transparent-60: rgba(255, 255, 255, 0.6);
--white-transparent-80: rgba(255, 255, 255, 0.8);
-
--solid-white: #ffffff;
@@ -61,7 +58,6 @@
--red-transparent-20: rgba(255, 71, 102, 0.2);
--shadow-s: 0px 8px 16px 0px rgba(18, 22, 31, 0.04);
-
}
/* Dark theme variables */
@@ -72,8 +68,8 @@
--gray-200: #222222; /* Borders and dividers */
--gray-300: #323232; /* Subtle highlights */
--gray-400: #868686; /* Secondary text - slightly softer */
- --gray-450: #EAEAEA; /* Adjusted to be more balanced */
- --gray-500: #FFFFFF; /* Primary text - titles/headings */
+ --gray-450: #eaeaea; /* Adjusted to be more balanced */
+ --gray-500: #ffffff; /* Primary text - titles/headings */
--gray-50-transparent-50: rgba(20, 20, 20, 0.5);
--gray-100-transparent-50: rgba(24, 24, 24, 0.5);
@@ -83,7 +79,6 @@
--gray-450-transparent-50: rgba(234, 234, 234, 0.5);
--gray-500-transparent-50: rgba(255, 255, 255, 0.5);
-
/* Add new variables for text hierarchy */
--text-primary: rgba(255, 255, 255, 0.95); /* Section titles, headings */
--text-secondary: rgba(255, 255, 255, 0.85); /* Important labels */
@@ -107,7 +102,6 @@
--solid-white: #ffffff;
-
/* Accent colors remain mostly the same but adjusted for dark theme */
--blue-50: #1a2438;
--blue-100: #243352;
@@ -140,7 +134,7 @@
/* Custom scrollbar */
.custom-scroll {
margin-right: 3px; /* Add margin to create space between scrollbar and window edge */
- padding-right: 3px; /* Add padding to create space between content and scrollbar */
+ overflow-y: scroll;
}
.custom-scroll::-webkit-scrollbar {
@@ -179,14 +173,24 @@
/* Tabs container with mask-based fade-out effect */
.tabs-mask-content {
- -webkit-mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
- mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
+ -webkit-mask-image: linear-gradient(
+ to right,
+ transparent,
+ black 24px,
+ black calc(100% - 24px),
+ transparent
+ );
+ mask-image: linear-gradient(
+ to right,
+ transparent,
+ black 24px,
+ black calc(100% - 24px),
+ transparent
+ );
}
@layer utilities {
-
.platform-windows .overflow-y-auto {
@apply scrollbar-thin scrollbar-track-transparent scrollbar-thumb-black-transparent-40;
}
-
}
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index a8f95c022..be2330dec 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -229,7 +229,11 @@ export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall"
export type Audio = { duration: number; sample_rate: number; channels: number }
export type AudioConfiguration = { mute: boolean; improve: boolean }
export type AudioInputLevelChange = number
-export type AudioMeta = { path: string; start_time?: number | null }
+export type AudioMeta = { path: string;
+/**
+ * unix time of the first frame
+ */
+start_time?: number | null }
export type AuthStore = { token: string; user_id: string | null; expires: number; plan: Plan | null; intercom_hash: string | null }
export type AuthenticationInvalid = null
export type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; inset: number; crop: Crop | null; shadow?: number; advancedShadow?: ShadowConfiguration | null }
diff --git a/apps/web/components/pages/HomePage/index.tsx b/apps/web/components/pages/HomePage/index.tsx
index 028d1b50f..186877694 100644
--- a/apps/web/components/pages/HomePage/index.tsx
+++ b/apps/web/components/pages/HomePage/index.tsx
@@ -180,7 +180,7 @@ export const HomePage = () => {
repeatType: "reverse",
ease: "linear",
}}
- className="absolute opacity-70 top-[340px] -left-[200px] z-[9]
+ className="absolute opacity-70 top-[340px] -left-[200px] z-[9]
w-full max-w-[1800px] h-[100px] bg-gradient-to-l from-transparent via-white/90 to-white"
style={{
borderRadius: "100%",
@@ -243,7 +243,7 @@ export const HomePage = () => {
repeat: Infinity,
repeatType: "reverse",
}}
- className="absolute
+ className="absolute
top-[180px] w-full max-w-[280px] z-[4] right-[60px] md:right-[600px] select-none"
src="./illustrations/smallcloudthree.webp"
alt="smallcloudfour"
@@ -266,7 +266,7 @@ export const HomePage = () => {
alt="bottomcloudthree"
/>
<img
- className="absolute
+ className="absolute
top-[180px] w-full max-w-[400px] z-0 select-none right-[60px] opacity-30 pointer-events-none"
src="./illustrations/smallcloudthree.webp"
alt="smallcloudthree"
@@ -284,7 +284,7 @@ export const HomePage = () => {
repeatType: "reverse",
ease: "linear",
}}
- className="absolute
+ className="absolute
bottom-[240px] w-full max-w-[430px] z-[1] right-[40px] select-none opacity-80 brightness-125 pointer-events-none"
src="./illustrations/smallcloudtwo.webp"
alt="smallcloudtwo"
@@ -293,7 +293,7 @@ export const HomePage = () => {
style={{
mixBlendMode: "screen",
}}
- className="absolute
+ className="absolute
w-full max-w-[500px] top-[210px] right-[300px] z-[2] select-none brightness-125 pointer-events-none"
src="./illustrations/chipcloud.webp"
alt="chipcloudtwo"
@@ -315,13 +315,13 @@ export const HomePage = () => {
repeatType: "reverse",
ease: "linear",
}}
- className="absolute
+ className="absolute
w-full max-w-[500px] bottom-[15px] select-none left-[-200px] lg:left-[30px] z-[10] pointer-events-none"
src="./illustrations/chipcloud.webp"
alt="chipcloudfour"
/>
<img
- className="absolute
+ className="absolute
w-full max-w-[500px] top-[160px] select-none mix-blend-screen left-[-200px] lg:left-[30px] z-[10] pointer-events-none"
src="./illustrations/chipcloud.webp"
alt="chipcloud"
@@ -339,7 +339,7 @@ export const HomePage = () => {
</div>
{/** Right Blue Hue */}
<div
- className="w-[868px] h-[502px] bg-gradient-to-l rounded-full blur-[100px]
+ className="w-[868px] h-[502px] bg-gradient-to-l rounded-full blur-[100px]
absolute top-20 z-[0] right-0 from-[#A6D7FF] to-transparent"
/>
</div>
diff --git a/packages/ui-solid/icons/bg-blur.svg b/packages/ui-solid/icons/bg-blur.svg
index df1837ac9..4068228ae 100644
--- a/packages/ui-solid/icons/bg-blur.svg
+++ b/packages/ui-solid/icons/bg-blur.svg
@@ -1,7 +1,7 @@
<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect x="0.5" y="6.61108" width="7.93592" height="7.88889" rx="1.5" stroke="white"/>
+<rect x="0.5" y="6.61108" width="7.93592" height="7.88889" rx="1.5" stroke="currentColor"/>
<g filter="url(#filter0_f_941_2688)">
-<rect x="3.62793" y="3.5" width="7.93592" height="7.88889" rx="1.5" stroke="white"/>
+<rect x="3.62793" y="3.5" width="7.93592" height="7.88889" rx="1.5" stroke="currentColor"/>
</g>
<defs>
<filter id="filter0_f_941_2688" x="0.12793" y="0" width="14.936" height="14.8889" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">