OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.
TypeScript
feat(image): add layer panel enhancements, inner shadow, and noise fill
Augustus Otuda02f98cd8ed
diff --git a/apps/image/src/components/editor/canvas/Canvas.tsx b/apps/image/src/components/editor/canvas/Canvas.tsxindex 7d80fd32..de7875ce 100644--- a/apps/image/src/components/editor/canvas/Canvas.tsx+++ b/apps/image/src/components/editor/canvas/Canvas.tsx@@ -572,6 +572,7 @@ function renderLayer() {const { transform } = layer;const shadow = layer.shadow ?? { enabled: false, color: 'rgba(0, 0, 0, 0.5)', blur: 10, offsetX: 0, offsetY: 4 };+ const innerShadow = layer.innerShadow ?? { enabled: false, color: 'rgba(0, 0, 0, 0.5)', blur: 10, offsetX: 2, offsetY: 2 };const glow = layer.glow ?? { enabled: false, color: '#ffffff', blur: 20, intensity: 1 };const blendMode = layer.blendMode?.mode ?? 'normal';@@ -609,6 +610,10 @@ function renderLayer(ctx.shadowOffsetX = 0;ctx.shadowOffsetY = 0;+ if (innerShadow.enabled && innerShadow.blur > 0) {+ renderInnerShadow(ctx, layer, innerShadow);+ }+ctx.restore();}@@ -630,6 +635,46 @@ function renderLayerContent(}}+function renderInnerShadow(+ ctx: CanvasRenderingContext2D,+ layer: Layer,+ innerShadow: { color: string; blur: number; offsetX: number; offsetY: number }+) {+ const { width, height } = layer.transform;++ ctx.save();+ ctx.beginPath();+ ctx.rect(0, 0, width, height);+ ctx.clip();++ ctx.shadowColor = innerShadow.color;+ ctx.shadowBlur = innerShadow.blur;+ ctx.shadowOffsetX = innerShadow.offsetX;+ ctx.shadowOffsetY = innerShadow.offsetY;++ ctx.fillStyle = 'rgba(0, 0, 0, 1)';+ ctx.globalCompositeOperation = 'source-atop';++ const spread = innerShadow.blur + Math.max(Math.abs(innerShadow.offsetX), Math.abs(innerShadow.offsetY)) + 50;++ ctx.beginPath();+ ctx.moveTo(-spread, -spread);+ ctx.lineTo(width + spread, -spread);+ ctx.lineTo(width + spread, height + spread);+ ctx.lineTo(-spread, height + spread);+ ctx.closePath();++ ctx.moveTo(0, 0);+ ctx.lineTo(0, height);+ ctx.lineTo(width, height);+ ctx.lineTo(width, 0);+ ctx.closePath();++ ctx.fill('evenodd');++ ctx.restore();+}+function applyMotionBlur(ctx: CanvasRenderingContext2D,img: HTMLImageElement,@@ -991,10 +1036,62 @@ function renderShapeLayer(ctx: CanvasRenderingContext2D, layer: ShapeLayer) {ctx.rect(0, 0, width, height);}- if (shapeStyle.fill) {- ctx.fillStyle = shapeStyle.fill;+ const fillType = shapeStyle.fillType ?? 'solid';+ const hasFill = fillType === 'solid' ? !!shapeStyle.fill : fillType === 'gradient' ? !!shapeStyle.gradient : fillType === 'noise' ? !!shapeStyle.noise : false;++ if (hasFill) {ctx.globalAlpha *= shapeStyle.fillOpacity;- ctx.fill();++ if (fillType === 'noise' && shapeStyle.noise) {+ ctx.fillStyle = shapeStyle.noise.baseColor;+ ctx.fill();++ ctx.save();+ ctx.clip();++ const { noise } = shapeStyle;+ const noiseSize = noise.size;+ const density = noise.density;++ ctx.fillStyle = noise.noiseColor;+ for (let y = 0; y < height; y += noiseSize) {+ for (let x = 0; x < width; x += noiseSize) {+ if (Math.random() < density) {+ ctx.fillRect(x, y, noiseSize, noiseSize);+ }+ }+ }++ ctx.restore();+ } else if (fillType === 'gradient' && shapeStyle.gradient) {+ let gradient: CanvasGradient;+ if (shapeStyle.gradient.type === 'linear') {+ const angleRad = (shapeStyle.gradient.angle * Math.PI) / 180;+ const cos = Math.cos(angleRad);+ const sin = Math.sin(angleRad);+ const halfW = width / 2;+ const halfH = height / 2;+ const len = Math.abs(halfW * cos) + Math.abs(halfH * sin);+ gradient = ctx.createLinearGradient(+ halfW - len * cos,+ halfH - len * sin,+ halfW + len * cos,+ halfH + len * sin+ );+ } else {+ const radius = Math.max(width, height) / 2;+ gradient = ctx.createRadialGradient(width / 2, height / 2, 0, width / 2, height / 2, radius);+ }+ shapeStyle.gradient.stops.forEach((stop) => {+ gradient.addColorStop(stop.offset, stop.color);+ });+ ctx.fillStyle = gradient;+ ctx.fill();+ } else if (shapeStyle.fill) {+ ctx.fillStyle = shapeStyle.fill;+ ctx.fill();+ }+ctx.globalAlpha /= shapeStyle.fillOpacity;}diff --git a/apps/image/src/components/editor/inspector/EffectsSection.tsx b/apps/image/src/components/editor/inspector/EffectsSection.tsxindex 0f8106bc..10b5e4f2 100644--- a/apps/image/src/components/editor/inspector/EffectsSection.tsx+++ b/apps/image/src/components/editor/inspector/EffectsSection.tsx@@ -1,18 +1,20 @@import { useProjectStore } from '../../../stores/project-store';-import type { Layer, Shadow, Stroke, Glow } from '../../../types/project';+import type { Layer, Shadow, InnerShadow, Stroke, Glow } from '../../../types/project';import { Slider } from '@openreel/ui';import { Switch } from '@openreel/ui';import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@openreel/ui';-import { ChevronDown, Droplets, Pencil, Sparkles } from 'lucide-react';+import { ChevronDown, Droplets, Pencil, Sparkles, CircleDot } from 'lucide-react';import { useState } from 'react';interface Props {layer: Layer;}+type EffectSection = 'shadow' | 'innerShadow' | 'stroke' | 'glow' | null;+export function EffectsSection({ layer }: Props) {const { updateLayer } = useProjectStore();- const [openSection, setOpenSection] = useState<'shadow' | 'stroke' | 'glow' | null>('shadow');+ const [openSection, setOpenSection] = useState<EffectSection>('shadow');const handleShadowChange = (updates: Partial<Shadow>) => {updateLayer(layer.id, {@@ -20,6 +22,12 @@ export function EffectsSection({ layer }: Props) {});};+ const handleInnerShadowChange = (updates: Partial<InnerShadow>) => {+ updateLayer(layer.id, {+ innerShadow: { ...(layer.innerShadow ?? { enabled: false, color: 'rgba(0, 0, 0, 0.5)', blur: 10, offsetX: 2, offsetY: 2 }), ...updates },+ });+ };+const handleStrokeChange = (updates: Partial<Stroke>) => {updateLayer(layer.id, {stroke: { ...layer.stroke, ...updates },@@ -126,6 +134,94 @@ export function EffectsSection({ layer }: Props) {</CollapsibleContent></Collapsible>+ <Collapsible open={openSection === 'innerShadow'} onOpenChange={(open) => setOpenSection(open ? 'innerShadow' : null)}>+ <CollapsibleTrigger asChild>+ <button className="w-full flex items-center justify-between p-2 rounded-lg bg-secondary/50 hover:bg-secondary transition-colors">+ <div className="flex items-center gap-2">+ <CircleDot size={14} className="text-muted-foreground" />+ <span className="text-xs font-medium">Inner Shadow</span>+ </div>+ <div className="flex items-center gap-2">+ <Switch+ checked={layer.innerShadow?.enabled ?? false}+ onCheckedChange={(enabled) => handleInnerShadowChange({ enabled })}+ onClick={(e) => e.stopPropagation()}+ />+ <ChevronDown size={14} className={`text-muted-foreground transition-transform ${openSection === 'innerShadow' ? 'rotate-180' : ''}`} />+ </div>+ </button>+ </CollapsibleTrigger>+ <CollapsibleContent>+ <div className="p-3 space-y-3 bg-background/50 rounded-b-lg border border-t-0 border-border">+ <div>+ <label className="block text-[10px] text-muted-foreground mb-1.5">Color</label>+ <div className="flex items-center gap-2">+ <input+ type="color"+ value={(layer.innerShadow?.color ?? 'rgba(0, 0, 0, 0.5)').startsWith('rgba') ? '#000000' : layer.innerShadow?.color ?? '#000000'}+ onChange={(e) => handleInnerShadowChange({ color: e.target.value })}+ className="w-8 h-8 rounded border border-input cursor-pointer"+ disabled={!layer.innerShadow?.enabled}+ />+ <input+ type="text"+ value={layer.innerShadow?.color ?? 'rgba(0, 0, 0, 0.5)'}+ onChange={(e) => handleInnerShadowChange({ color: e.target.value })}+ className="flex-1 px-2 py-1.5 text-xs bg-background border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-primary font-mono disabled:opacity-50"+ disabled={!layer.innerShadow?.enabled}+ />+ </div>+ </div>++ <div>+ <div className="flex items-center justify-between mb-1.5">+ <label className="text-[10px] text-muted-foreground">Blur</label>+ <span className="text-[10px] text-muted-foreground">{layer.innerShadow?.blur ?? 10}px</span>+ </div>+ <Slider+ value={[layer.innerShadow?.blur ?? 10]}+ onValueChange={([blur]) => handleInnerShadowChange({ blur })}+ min={0}+ max={50}+ step={1}+ disabled={!layer.innerShadow?.enabled}+ />+ </div>++ <div className="grid grid-cols-2 gap-3">+ <div>+ <div className="flex items-center justify-between mb-1.5">+ <label className="text-[10px] text-muted-foreground">Offset X</label>+ <span className="text-[10px] text-muted-foreground">{layer.innerShadow?.offsetX ?? 2}px</span>+ </div>+ <Slider+ value={[layer.innerShadow?.offsetX ?? 2]}+ onValueChange={([offsetX]) => handleInnerShadowChange({ offsetX })}+ min={-30}+ max={30}+ step={1}+ disabled={!layer.innerShadow?.enabled}+ />+ </div>+ <div>+ <div className="flex items-center justify-between mb-1.5">+ <label className="text-[10px] text-muted-foreground">Offset Y</label>+ <span className="text-[10px] text-muted-foreground">{layer.innerShadow?.offsetY ?? 2}px</span>+ </div>+ <Slider+ value={[layer.innerShadow?.offsetY ?? 2]}+ onValueChange={([offsetY]) => handleInnerShadowChange({ offsetY })}+ min={-30}+ max={30}+ step={1}+ disabled={!layer.innerShadow?.enabled}+ />+ </div>+ </div>+ </div>+ </CollapsibleContent>+ </Collapsible>+<Collapsible open={openSection === 'stroke'} onOpenChange={(open) => setOpenSection(open ? 'stroke' : null)}><CollapsibleTrigger asChild><button className="w-full flex items-center justify-between p-2 rounded-lg bg-secondary/50 hover:bg-secondary transition-colors">diff --git a/apps/image/src/components/editor/inspector/ShapeSection.tsx b/apps/image/src/components/editor/inspector/ShapeSection.tsxindex 399436c2..b20faf7a 100644--- a/apps/image/src/components/editor/inspector/ShapeSection.tsx+++ b/apps/image/src/components/editor/inspector/ShapeSection.tsx@@ -1,6 +1,7 @@import { useState } from 'react';import { useProjectStore } from '../../../stores/project-store';-import type { ShapeLayer, ShapeStyle, Gradient, FillType, StrokeDashType } from '../../../types/project';+import type { ShapeLayer, ShapeStyle, Gradient, FillType, StrokeDashType, NoiseFill } from '../../../types/project';+import { DEFAULT_NOISE_FILL } from '../../../types/project';import { Slider } from '@openreel/ui';import { GradientPicker } from '../../ui/GradientPicker';import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@openreel/ui';@@ -42,11 +43,25 @@ export function ShapeSection({ layer }: Props) {],},});+ } else if (fillType === 'noise' && !layer.shapeStyle.noise) {+ handleStyleChange({+ fillType,+ noise: {+ ...DEFAULT_NOISE_FILL,+ baseColor: layer.shapeStyle.fill ?? DEFAULT_NOISE_FILL.baseColor,+ },+ });} else {handleStyleChange({ fillType });}};+ const handleNoiseChange = (updates: Partial<NoiseFill>) => {+ handleStyleChange({+ noise: { ...(layer.shapeStyle.noise ?? DEFAULT_NOISE_FILL), ...updates },+ });+ };+const handleGradientChange = (gradient: Gradient) => {handleStyleChange({ gradient });};@@ -79,10 +94,10 @@ export function ShapeSection({ layer }: Props) {</CollapsibleTrigger><CollapsibleContent><div className="p-3 space-y-3 bg-background/50 rounded-b-lg border border-t-0 border-border">- <div className="grid grid-cols-2 gap-1">+ <div className="grid grid-cols-3 gap-1"><buttononClick={() => handleFillTypeChange('solid')}- className={`px-3 py-1.5 text-xs rounded-md transition-colors ${+ className={`px-2 py-1.5 text-xs rounded-md transition-colors ${layer.shapeStyle.fillType === 'solid'? 'bg-primary text-primary-foreground': 'bg-secondary text-secondary-foreground hover:bg-accent'@@ -92,7 +107,7 @@ export function ShapeSection({ layer }: Props) {</button><buttononClick={() => handleFillTypeChange('gradient')}- className={`px-3 py-1.5 text-xs rounded-md transition-colors ${+ className={`px-2 py-1.5 text-xs rounded-md transition-colors ${layer.shapeStyle.fillType === 'gradient'? 'bg-primary text-primary-foreground': 'bg-secondary text-secondary-foreground hover:bg-accent'@@ -100,9 +115,19 @@ export function ShapeSection({ layer }: Props) {>Gradient</button>+ <button+ onClick={() => handleFillTypeChange('noise')}+ className={`px-2 py-1.5 text-xs rounded-md transition-colors ${+ layer.shapeStyle.fillType === 'noise'+ ? 'bg-primary text-primary-foreground'+ : 'bg-secondary text-secondary-foreground hover:bg-accent'+ }`}+ >+ Noise+ </button></div>- {layer.shapeStyle.fillType === 'solid' ? (+ {layer.shapeStyle.fillType === 'solid' && (<div><div className="flex items-center gap-2"><button@@ -135,13 +160,80 @@ export function ShapeSection({ layer }: Props) {)}</div></div>- ) : (+ )}++ {layer.shapeStyle.fillType === 'gradient' && (<GradientPickervalue={layer.shapeStyle.gradient}onChange={handleGradientChange}/>)}+ {layer.shapeStyle.fillType === 'noise' && (+ <div className="space-y-3">+ <div>+ <label className="block text-[10px] text-muted-foreground mb-1.5">Base Color</label>+ <div className="flex items-center gap-2">+ <input+ type="color"+ value={layer.shapeStyle.noise?.baseColor ?? DEFAULT_NOISE_FILL.baseColor}+ onChange={(e) => handleNoiseChange({ baseColor: e.target.value })}+ className="w-8 h-8 rounded border border-input cursor-pointer"+ />+ <input+ type="text"+ value={layer.shapeStyle.noise?.baseColor ?? DEFAULT_NOISE_FILL.baseColor}+ onChange={(e) => handleNoiseChange({ baseColor: e.target.value })}+ className="flex-1 px-2 py-1.5 text-xs bg-background border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-primary font-mono"+ />+ </div>+ </div>+ <div>+ <label className="block text-[10px] text-muted-foreground mb-1.5">Noise Color</label>+ <div className="flex items-center gap-2">+ <input+ type="color"+ value={layer.shapeStyle.noise?.noiseColor ?? DEFAULT_NOISE_FILL.noiseColor}+ onChange={(e) => handleNoiseChange({ noiseColor: e.target.value })}+ className="w-8 h-8 rounded border border-input cursor-pointer"+ />+ <input+ type="text"+ value={layer.shapeStyle.noise?.noiseColor ?? DEFAULT_NOISE_FILL.noiseColor}+ onChange={(e) => handleNoiseChange({ noiseColor: e.target.value })}+ className="flex-1 px-2 py-1.5 text-xs bg-background border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-primary font-mono"+ />+ </div>+ </div>+ <div>+ <div className="flex items-center justify-between mb-1.5">+ <label className="text-[10px] text-muted-foreground">Density</label>+ <span className="text-[10px] text-muted-foreground">{Math.round((layer.shapeStyle.noise?.density ?? 0.5) * 100)}%</span>+ </div>+ <Slider+ value={[(layer.shapeStyle.noise?.density ?? 0.5) * 100]}+ onValueChange={([density]) => handleNoiseChange({ density: density / 100 })}+ min={5}+ max={100}+ step={1}+ />+ </div>+ <div>+ <div className="flex items-center justify-between mb-1.5">+ <label className="text-[10px] text-muted-foreground">Grain Size</label>+ <span className="text-[10px] text-muted-foreground">{layer.shapeStyle.noise?.size ?? 2}px</span>+ </div>+ <Slider+ value={[layer.shapeStyle.noise?.size ?? 2]}+ onValueChange={([size]) => handleNoiseChange({ size })}+ min={1}+ max={10}+ step={1}+ />+ </div>+ </div>+ )}+<div><div className="flex items-center justify-between mb-1.5"><label className="text-[10px] text-muted-foreground">Opacity</label>diff --git a/apps/image/src/components/editor/layers/LayerPanel.tsx b/apps/image/src/components/editor/layers/LayerPanel.tsxindex 6f309d54..9670925e 100644--- a/apps/image/src/components/editor/layers/LayerPanel.tsx+++ b/apps/image/src/components/editor/layers/LayerPanel.tsx@@ -1,6 +1,7 @@-import { Eye, EyeOff, Lock, Unlock, Trash2, Copy, ChevronUp, ChevronDown, ArrowUp, ArrowDown, ArrowUpToLine, ArrowDownToLine, Clipboard, ClipboardCopy, Scissors, Paintbrush } from 'lucide-react';+import { useState, useRef, useEffect } from 'react';+import { Eye, EyeOff, Lock, Unlock, Trash2, Copy, ChevronUp, ChevronDown, ArrowUp, ArrowDown, ArrowUpToLine, ArrowDownToLine, Clipboard, ClipboardCopy, Scissors, Paintbrush, Search, X, Image, Type, Hexagon, Folder } from 'lucide-react';import { useProjectStore } from '../../../stores/project-store';-import type { Layer } from '../../../types/project';+import type { Layer, LayerType } from '../../../types/project';import {ContextMenu,ContextMenuTrigger,@@ -9,8 +10,18 @@ import {ContextMenuSeparator,ContextMenuShortcut,ContextMenuCheckboxItem,+ Slider,} from '@openreel/ui';+type FilterType = 'all' | LayerType;++const LAYER_TYPE_ICONS: Record<LayerType, React.ReactNode> = {+ image: <Image size={12} />,+ text: <Type size={12} />,+ shape: <Hexagon size={12} />,+ group: <Folder size={12} />,+};+export function LayerPanel() {const {project,@@ -18,7 +29,9 @@ export function LayerPanel() {selectedArtboardId,copiedStyle,selectLayer,+ selectLayers,updateLayer,+ updateLayerTransform,removeLayer,duplicateLayer,moveLayerUp,@@ -32,8 +45,56 @@ export function LayerPanel() {pasteLayerStyle,} = useProjectStore();+ const [searchQuery, setSearchQuery] = useState('');+ const [filterType, setFilterType] = useState<FilterType>('all');+ const [editingLayerId, setEditingLayerId] = useState<string | null>(null);+ const [editingName, setEditingName] = useState('');+ const editInputRef = useRef<HTMLInputElement>(null);+const artboard = project?.artboards.find((a) => a.id === selectedArtboardId);- const layers = artboard?.layerIds.map((id) => project?.layers[id]).filter(Boolean) as Layer[] ?? [];+ const allLayers = artboard?.layerIds.map((id) => project?.layers[id]).filter(Boolean) as Layer[] ?? [];++ const layers = allLayers.filter((layer) => {+ const matchesSearch = searchQuery === '' || layer.name.toLowerCase().includes(searchQuery.toLowerCase());+ const matchesType = filterType === 'all' || layer.type === filterType;+ return matchesSearch && matchesType;+ });++ const handleSelectAllByType = (type: LayerType) => {+ const layerIds = allLayers.filter((l) => l.type === type).map((l) => l.id);+ if (layerIds.length > 0) {+ selectLayers(layerIds);+ }+ };++ const handleStartRename = (layer: Layer) => {+ setEditingLayerId(layer.id);+ setEditingName(layer.name);+ };++ const handleFinishRename = () => {+ if (editingLayerId && editingName.trim()) {+ updateLayer(editingLayerId, { name: editingName.trim() });+ }+ setEditingLayerId(null);+ setEditingName('');+ };++ const handleRenameKeyDown = (e: React.KeyboardEvent) => {+ if (e.key === 'Enter') {+ handleFinishRename();+ } else if (e.key === 'Escape') {+ setEditingLayerId(null);+ setEditingName('');+ }+ };++ useEffect(() => {+ if (editingLayerId && editInputRef.current) {+ editInputRef.current.focus();+ editInputRef.current.select();+ }+ }, [editingLayerId]);const handleToggleVisibility = (layer: Layer, e: React.MouseEvent) => {e.stopPropagation();@@ -75,10 +136,55 @@ export function LayerPanel() {<div className="flex items-center justify-between px-3 py-2 border-b border-border"><h3 className="text-xs font-medium text-foreground">Layers</h3><span className="text-[10px] text-muted-foreground">- {layers.length} {layers.length === 1 ? 'layer' : 'layers'}+ {layers.length}/{allLayers.length}</span></div>+ <div className="px-2 py-2 border-b border-border space-y-2">+ <div className="relative">+ <Search size={12} className="absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground" />+ <input+ type="text"+ placeholder="Search layers..."+ value={searchQuery}+ onChange={(e) => setSearchQuery(e.target.value)}+ className="w-full pl-7 pr-7 py-1.5 text-[11px] bg-background border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-primary"+ />+ {searchQuery && (+ <button+ onClick={() => setSearchQuery('')}+ className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"+ >+ <X size={12} />+ </button>+ )}+ </div>++ <div className="flex gap-1">+ <button+ onClick={() => setFilterType('all')}+ className={`flex-1 px-1.5 py-1 text-[10px] rounded transition-colors ${+ filterType === 'all' ? 'bg-primary text-primary-foreground' : 'bg-secondary text-secondary-foreground hover:bg-accent'+ }`}+ >+ All+ </button>+ {(['image', 'text', 'shape', 'group'] as LayerType[]).map((type) => (+ <button+ key={type}+ onClick={() => setFilterType(filterType === type ? 'all' : type)}+ onDoubleClick={() => handleSelectAllByType(type)}+ className={`p-1.5 rounded transition-colors ${+ filterType === type ? 'bg-primary text-primary-foreground' : 'bg-secondary text-secondary-foreground hover:bg-accent'+ }`}+ title={`Filter ${type}s (double-click to select all)`}+ >+ {LAYER_TYPE_ICONS[type]}+ </button>+ ))}+ </div>+ </div>+<div className="flex-1 overflow-y-auto">{layers.length === 0 ? (<div className="flex flex-col items-center justify-center h-full text-center p-4">@@ -111,13 +217,31 @@ export function LayerPanel() {{getLayerIcon(layer.type)}</span>- <span- className={`flex-1 text-xs truncate ${- layer.visible ? 'text-foreground' : 'text-muted-foreground'- } ${layer.locked ? 'italic' : ''}`}- >- {layer.name}- </span>+ {editingLayerId === layer.id ? (+ <input+ ref={editInputRef}+ type="text"+ value={editingName}+ onChange={(e) => setEditingName(e.target.value)}+ onBlur={handleFinishRename}+ onKeyDown={handleRenameKeyDown}+ onClick={(e) => e.stopPropagation()}+ className="flex-1 text-xs bg-background border border-primary rounded px-1 py-0.5 focus:outline-none"+ />+ ) : (+ <span+ onDoubleClick={(e) => {+ e.stopPropagation();+ handleStartRename(layer);+ }}+ className={`flex-1 text-xs truncate ${+ layer.visible ? 'text-foreground' : 'text-muted-foreground'+ } ${layer.locked ? 'italic' : ''}`}+ title="Double-click to rename"+ >+ {layer.name}+ </span>+ )}<div className="flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity"><button@@ -238,21 +362,37 @@ export function LayerPanel() {</div>{selectedLayerIds.length === 1 && (- <div className="flex items-center justify-center gap-1 p-2 border-t border-border">- <button- onClick={() => moveLayerUp(selectedLayerIds[0])}- className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground"- title="Move up (Cmd+])"- >- <ChevronUp size={14} />- </button>- <button- onClick={() => moveLayerDown(selectedLayerIds[0])}- className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground"- title="Move down (Cmd+[)"- >- <ChevronDown size={14} />- </button>+ <div className="p-2 border-t border-border space-y-2">+ <div className="flex items-center gap-2">+ <span className="text-[10px] text-muted-foreground w-12">Opacity</span>+ <Slider+ value={[project?.layers[selectedLayerIds[0]]?.transform.opacity ?? 1]}+ onValueChange={([opacity]) => updateLayerTransform(selectedLayerIds[0], { opacity })}+ min={0}+ max={1}+ step={0.01}+ className="flex-1"+ />+ <span className="text-[10px] text-muted-foreground w-8 text-right">+ {Math.round((project?.layers[selectedLayerIds[0]]?.transform.opacity ?? 1) * 100)}%+ </span>+ </div>+ <div className="flex items-center justify-center gap-1">+ <button+ onClick={() => moveLayerUp(selectedLayerIds[0])}+ className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground"+ title="Move up (Cmd+])"+ >+ <ChevronUp size={14} />+ </button>+ <button+ onClick={() => moveLayerDown(selectedLayerIds[0])}+ className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground"+ title="Move down (Cmd+[)"+ >+ <ChevronDown size={14} />+ </button>+ </div></div>)}</div>diff --git a/apps/image/src/stores/project-store.ts b/apps/image/src/stores/project-store.tsindex cac36763..8cc5002a 100644--- a/apps/image/src/stores/project-store.ts+++ b/apps/image/src/stores/project-store.ts@@ -14,6 +14,7 @@ import {DEFAULT_TRANSFORM,DEFAULT_BLEND_MODE,DEFAULT_SHADOW,+ DEFAULT_INNER_SHADOW,DEFAULT_STROKE,DEFAULT_GLOW,DEFAULT_FILTER,@@ -26,6 +27,7 @@ import {interface LayerStyle {blendMode: Layer['blendMode'];shadow: Layer['shadow'];+ innerShadow: Layer['innerShadow'];stroke: Layer['stroke'];glow: Layer['glow'];filters: Layer['filters'];@@ -230,6 +232,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(},blendMode: DEFAULT_BLEND_MODE,shadow: DEFAULT_SHADOW,+ innerShadow: DEFAULT_INNER_SHADOW,stroke: DEFAULT_STROKE,glow: DEFAULT_GLOW,filters: DEFAULT_FILTER,@@ -272,6 +275,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(},blendMode: DEFAULT_BLEND_MODE,shadow: DEFAULT_SHADOW,+ innerShadow: DEFAULT_INNER_SHADOW,stroke: DEFAULT_STROKE,glow: DEFAULT_GLOW,filters: DEFAULT_FILTER,@@ -313,6 +317,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(},blendMode: DEFAULT_BLEND_MODE,shadow: DEFAULT_SHADOW,+ innerShadow: DEFAULT_INNER_SHADOW,stroke: DEFAULT_STROKE,glow: DEFAULT_GLOW,filters: DEFAULT_FILTER,@@ -364,6 +369,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(},blendMode: DEFAULT_BLEND_MODE,shadow: DEFAULT_SHADOW,+ innerShadow: DEFAULT_INNER_SHADOW,stroke: DEFAULT_STROKE,glow: DEFAULT_GLOW,filters: DEFAULT_FILTER,@@ -403,6 +409,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(transform: DEFAULT_TRANSFORM,blendMode: DEFAULT_BLEND_MODE,shadow: DEFAULT_SHADOW,+ innerShadow: DEFAULT_INNER_SHADOW,stroke: DEFAULT_STROKE,glow: DEFAULT_GLOW,filters: DEFAULT_FILTER,@@ -723,6 +730,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(copiedStyle: {blendMode: layer.blendMode ? JSON.parse(JSON.stringify(layer.blendMode)) : DEFAULT_BLEND_MODE,shadow: layer.shadow ? JSON.parse(JSON.stringify(layer.shadow)) : DEFAULT_SHADOW,+ innerShadow: layer.innerShadow ? JSON.parse(JSON.stringify(layer.innerShadow)) : DEFAULT_INNER_SHADOW,stroke: layer.stroke ? JSON.parse(JSON.stringify(layer.stroke)) : DEFAULT_STROKE,glow: layer.glow ? JSON.parse(JSON.stringify(layer.glow)) : DEFAULT_GLOW,filters: layer.filters ? JSON.parse(JSON.stringify(layer.filters)) : DEFAULT_FILTER,@@ -742,6 +750,7 @@ export const useProjectStore = create<ProjectState & ProjectActions>()(if (layer) {layer.blendMode = copiedStyle.blendMode ? JSON.parse(JSON.stringify(copiedStyle.blendMode)) : DEFAULT_BLEND_MODE;layer.shadow = copiedStyle.shadow ? JSON.parse(JSON.stringify(copiedStyle.shadow)) : DEFAULT_SHADOW;+ layer.innerShadow = copiedStyle.innerShadow ? JSON.parse(JSON.stringify(copiedStyle.innerShadow)) : DEFAULT_INNER_SHADOW;layer.stroke = copiedStyle.stroke ? JSON.parse(JSON.stringify(copiedStyle.stroke)) : DEFAULT_STROKE;layer.glow = copiedStyle.glow ? JSON.parse(JSON.stringify(copiedStyle.glow)) : DEFAULT_GLOW;layer.filters = copiedStyle.filters ? JSON.parse(JSON.stringify(copiedStyle.filters)) : DEFAULT_FILTER;diff --git a/apps/image/src/types/project.ts b/apps/image/src/types/project.tsindex 9ec89b57..2c6c31d3 100644--- a/apps/image/src/types/project.ts+++ b/apps/image/src/types/project.ts@@ -37,6 +37,14 @@ export interface Glow {intensity: number;}+export interface InnerShadow {+ enabled: boolean;+ color: string;+ blur: number;+ offsetX: number;+ offsetY: number;+}+export type BlurType = 'gaussian' | 'motion' | 'radial';export interface Filter {@@ -63,6 +71,7 @@ export interface BaseLayer {transform: Transform;blendMode: BlendMode;shadow: Shadow;+ innerShadow: InnerShadow;stroke: Stroke;glow: Glow;filters: Filter;@@ -128,7 +137,7 @@ export interface Gradient {stops: GradientStop[];}-export type FillType = 'solid' | 'gradient';+export type FillType = 'solid' | 'gradient' | 'noise';export type StrokeDashType = 'solid' | 'dashed' | 'dotted' | 'dash-dot' | 'long-dash';@@ -139,10 +148,18 @@ export interface CornerRadius {bottomLeft: number;}+export interface NoiseFill {+ baseColor: string;+ noiseColor: string;+ density: number;+ size: number;+}+export interface ShapeStyle {fillType: FillType;fill: string | null;gradient: Gradient | null;+ noise: NoiseFill | null;fillOpacity: number;stroke: string | null;strokeWidth: number;@@ -265,6 +282,14 @@ export const DEFAULT_GLOW: Glow = {intensity: 1,};+export const DEFAULT_INNER_SHADOW: InnerShadow = {+ enabled: false,+ color: 'rgba(0, 0, 0, 0.5)',+ blur: 10,+ offsetX: 2,+ offsetY: 2,+};+export const DEFAULT_FILTER: Filter = {brightness: 100,contrast: 100,@@ -307,10 +332,18 @@ export const DEFAULT_TEXT_STYLE: TextStyle = {},};+export const DEFAULT_NOISE_FILL: NoiseFill = {+ baseColor: '#3b82f6',+ noiseColor: '#1e40af',+ density: 0.5,+ size: 2,+};+export const DEFAULT_SHAPE_STYLE: ShapeStyle = {fillType: 'solid',fill: '#3b82f6',gradient: null,+ noise: null,fillOpacity: 1,stroke: null,strokeWidth: 2,