@aprovan/patchwork 0.1.0

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.
Files changed (225) hide show
  1. package/.eslintrc.json +22 -0
  2. package/.github/workflows/publish.yml +41 -0
  3. package/.prettierignore +17 -0
  4. package/LICENSE +373 -0
  5. package/README.md +15 -0
  6. package/apps/chat/.utcp_config.json +14 -0
  7. package/apps/chat/.working/widgets/27060b91-a2a5-4272-b243-6eb904bd4070/main.tsx +107 -0
  8. package/apps/chat/index.html +17 -0
  9. package/apps/chat/node_modules/.bin/autoprefixer +17 -0
  10. package/apps/chat/node_modules/.bin/browserslist +17 -0
  11. package/apps/chat/node_modules/.bin/conc +17 -0
  12. package/apps/chat/node_modules/.bin/concurrently +17 -0
  13. package/apps/chat/node_modules/.bin/copilot-proxy +17 -0
  14. package/apps/chat/node_modules/.bin/jiti +17 -0
  15. package/apps/chat/node_modules/.bin/tailwind +17 -0
  16. package/apps/chat/node_modules/.bin/tailwindcss +17 -0
  17. package/apps/chat/node_modules/.bin/tsc +17 -0
  18. package/apps/chat/node_modules/.bin/tsserver +17 -0
  19. package/apps/chat/node_modules/.bin/tsx +17 -0
  20. package/apps/chat/node_modules/.bin/vite +17 -0
  21. package/apps/chat/package.json +55 -0
  22. package/apps/chat/postcss.config.js +6 -0
  23. package/apps/chat/src/App.tsx +7 -0
  24. package/apps/chat/src/components/ui/avatar.tsx +48 -0
  25. package/apps/chat/src/components/ui/badge.tsx +36 -0
  26. package/apps/chat/src/components/ui/button.tsx +56 -0
  27. package/apps/chat/src/components/ui/card.tsx +86 -0
  28. package/apps/chat/src/components/ui/collapsible.tsx +9 -0
  29. package/apps/chat/src/components/ui/dialog.tsx +60 -0
  30. package/apps/chat/src/components/ui/input.tsx +25 -0
  31. package/apps/chat/src/components/ui/scroll-area.tsx +46 -0
  32. package/apps/chat/src/index.css +190 -0
  33. package/apps/chat/src/lib/utils.ts +6 -0
  34. package/apps/chat/src/main.tsx +10 -0
  35. package/apps/chat/src/pages/ChatPage.tsx +460 -0
  36. package/apps/chat/tailwind.config.js +71 -0
  37. package/apps/chat/tsconfig.json +25 -0
  38. package/apps/chat/vite.config.ts +26 -0
  39. package/package.json +35 -0
  40. package/packages/bobbin/node_modules/.bin/esbuild +14 -0
  41. package/packages/bobbin/node_modules/.bin/jiti +17 -0
  42. package/packages/bobbin/node_modules/.bin/tsc +17 -0
  43. package/packages/bobbin/node_modules/.bin/tsserver +17 -0
  44. package/packages/bobbin/node_modules/.bin/tsup +17 -0
  45. package/packages/bobbin/node_modules/.bin/tsup-node +17 -0
  46. package/packages/bobbin/node_modules/.bin/tsx +17 -0
  47. package/packages/bobbin/package.json +30 -0
  48. package/packages/bobbin/src/Bobbin.tsx +89 -0
  49. package/packages/bobbin/src/components/EditPanel/EditPanel.tsx +376 -0
  50. package/packages/bobbin/src/components/EditPanel/controls/ColorPicker.tsx +138 -0
  51. package/packages/bobbin/src/components/EditPanel/controls/QuickSelectDropdown.tsx +142 -0
  52. package/packages/bobbin/src/components/EditPanel/controls/SliderInput.tsx +94 -0
  53. package/packages/bobbin/src/components/EditPanel/controls/SpacingControl.tsx +285 -0
  54. package/packages/bobbin/src/components/EditPanel/controls/ToggleGroup.tsx +37 -0
  55. package/packages/bobbin/src/components/EditPanel/controls/TokenDropdown.tsx +33 -0
  56. package/packages/bobbin/src/components/EditPanel/sections/AnnotationSection.tsx +136 -0
  57. package/packages/bobbin/src/components/EditPanel/sections/BackgroundSection.tsx +79 -0
  58. package/packages/bobbin/src/components/EditPanel/sections/EffectsSection.tsx +85 -0
  59. package/packages/bobbin/src/components/EditPanel/sections/LayoutSection.tsx +224 -0
  60. package/packages/bobbin/src/components/EditPanel/sections/SectionWrapper.tsx +57 -0
  61. package/packages/bobbin/src/components/EditPanel/sections/SizeSection.tsx +166 -0
  62. package/packages/bobbin/src/components/EditPanel/sections/SpacingSection.tsx +69 -0
  63. package/packages/bobbin/src/components/EditPanel/sections/TypographySection.tsx +148 -0
  64. package/packages/bobbin/src/components/Inspector/Inspector.tsx +221 -0
  65. package/packages/bobbin/src/components/Overlay/ControlHandles.tsx +572 -0
  66. package/packages/bobbin/src/components/Overlay/MarginPaddingOverlay.tsx +229 -0
  67. package/packages/bobbin/src/components/Overlay/SelectionOverlay.tsx +73 -0
  68. package/packages/bobbin/src/components/Pill/Pill.tsx +155 -0
  69. package/packages/bobbin/src/components/ThemeToggle/ThemeToggle.tsx +72 -0
  70. package/packages/bobbin/src/core/changeSerializer.ts +139 -0
  71. package/packages/bobbin/src/core/useBobbin.ts +399 -0
  72. package/packages/bobbin/src/core/useChangeTracker.ts +186 -0
  73. package/packages/bobbin/src/core/useClipboard.ts +21 -0
  74. package/packages/bobbin/src/core/useElementSelection.ts +146 -0
  75. package/packages/bobbin/src/index.ts +46 -0
  76. package/packages/bobbin/src/tokens/borders.ts +19 -0
  77. package/packages/bobbin/src/tokens/colors.ts +150 -0
  78. package/packages/bobbin/src/tokens/index.ts +37 -0
  79. package/packages/bobbin/src/tokens/shadows.ts +10 -0
  80. package/packages/bobbin/src/tokens/spacing.ts +37 -0
  81. package/packages/bobbin/src/tokens/typography.ts +51 -0
  82. package/packages/bobbin/src/types.ts +157 -0
  83. package/packages/bobbin/src/utils/animation.ts +40 -0
  84. package/packages/bobbin/src/utils/dom.ts +36 -0
  85. package/packages/bobbin/src/utils/selectors.ts +76 -0
  86. package/packages/bobbin/tsconfig.json +10 -0
  87. package/packages/bobbin/tsup.config.ts +10 -0
  88. package/packages/compiler/node_modules/.bin/esbuild +17 -0
  89. package/packages/compiler/node_modules/.bin/jiti +17 -0
  90. package/packages/compiler/node_modules/.bin/tsc +17 -0
  91. package/packages/compiler/node_modules/.bin/tsserver +17 -0
  92. package/packages/compiler/node_modules/.bin/tsup +17 -0
  93. package/packages/compiler/node_modules/.bin/tsup-node +17 -0
  94. package/packages/compiler/node_modules/.bin/tsx +17 -0
  95. package/packages/compiler/package.json +38 -0
  96. package/packages/compiler/src/compiler.ts +258 -0
  97. package/packages/compiler/src/images/index.ts +13 -0
  98. package/packages/compiler/src/images/loader.ts +234 -0
  99. package/packages/compiler/src/images/registry.ts +112 -0
  100. package/packages/compiler/src/index.ts +141 -0
  101. package/packages/compiler/src/mount/bridge.ts +399 -0
  102. package/packages/compiler/src/mount/embedded.ts +306 -0
  103. package/packages/compiler/src/mount/iframe.ts +433 -0
  104. package/packages/compiler/src/mount/index.ts +18 -0
  105. package/packages/compiler/src/schemas.ts +169 -0
  106. package/packages/compiler/src/transforms/cdn.ts +411 -0
  107. package/packages/compiler/src/transforms/index.ts +4 -0
  108. package/packages/compiler/src/transforms/vfs.ts +138 -0
  109. package/packages/compiler/src/types.ts +233 -0
  110. package/packages/compiler/src/vfs/backends/indexeddb.ts +66 -0
  111. package/packages/compiler/src/vfs/backends/local-fs.ts +41 -0
  112. package/packages/compiler/src/vfs/backends/s3.ts +60 -0
  113. package/packages/compiler/src/vfs/index.ts +11 -0
  114. package/packages/compiler/src/vfs/project.ts +56 -0
  115. package/packages/compiler/src/vfs/store.ts +53 -0
  116. package/packages/compiler/src/vfs/types.ts +20 -0
  117. package/packages/compiler/tsconfig.json +8 -0
  118. package/packages/compiler/tsup.config.ts +14 -0
  119. package/packages/editor/node_modules/.bin/jiti +17 -0
  120. package/packages/editor/node_modules/.bin/tsc +17 -0
  121. package/packages/editor/node_modules/.bin/tsserver +17 -0
  122. package/packages/editor/node_modules/.bin/tsup +17 -0
  123. package/packages/editor/node_modules/.bin/tsup-node +17 -0
  124. package/packages/editor/node_modules/.bin/tsx +17 -0
  125. package/packages/editor/package.json +45 -0
  126. package/packages/editor/src/components/CodeBlockExtension.tsx +190 -0
  127. package/packages/editor/src/components/CodePreview.tsx +344 -0
  128. package/packages/editor/src/components/MarkdownEditor.tsx +270 -0
  129. package/packages/editor/src/components/ServicesInspector.tsx +118 -0
  130. package/packages/editor/src/components/edit/EditHistory.tsx +89 -0
  131. package/packages/editor/src/components/edit/EditModal.tsx +236 -0
  132. package/packages/editor/src/components/edit/FileTree.tsx +144 -0
  133. package/packages/editor/src/components/edit/api.ts +100 -0
  134. package/packages/editor/src/components/edit/index.ts +6 -0
  135. package/packages/editor/src/components/edit/types.ts +53 -0
  136. package/packages/editor/src/components/edit/useEditSession.ts +164 -0
  137. package/packages/editor/src/components/index.ts +5 -0
  138. package/packages/editor/src/index.ts +72 -0
  139. package/packages/editor/src/lib/code-extractor.ts +210 -0
  140. package/packages/editor/src/lib/diff.ts +308 -0
  141. package/packages/editor/src/lib/index.ts +4 -0
  142. package/packages/editor/src/lib/utils.ts +6 -0
  143. package/packages/editor/src/lib/vfs.ts +106 -0
  144. package/packages/editor/tsconfig.json +10 -0
  145. package/packages/editor/tsup.config.ts +10 -0
  146. package/packages/images/ink/node_modules/.bin/jiti +17 -0
  147. package/packages/images/ink/node_modules/.bin/tsc +17 -0
  148. package/packages/images/ink/node_modules/.bin/tsserver +17 -0
  149. package/packages/images/ink/node_modules/.bin/tsup +17 -0
  150. package/packages/images/ink/node_modules/.bin/tsup-node +17 -0
  151. package/packages/images/ink/node_modules/.bin/tsx +17 -0
  152. package/packages/images/ink/package.json +53 -0
  153. package/packages/images/ink/src/index.ts +48 -0
  154. package/packages/images/ink/src/runner.ts +331 -0
  155. package/packages/images/ink/src/setup.ts +123 -0
  156. package/packages/images/ink/tsconfig.json +10 -0
  157. package/packages/images/ink/tsup.config.ts +11 -0
  158. package/packages/images/shadcn/node_modules/.bin/jiti +17 -0
  159. package/packages/images/shadcn/node_modules/.bin/tsc +17 -0
  160. package/packages/images/shadcn/node_modules/.bin/tsserver +17 -0
  161. package/packages/images/shadcn/node_modules/.bin/tsup +17 -0
  162. package/packages/images/shadcn/node_modules/.bin/tsup-node +17 -0
  163. package/packages/images/shadcn/node_modules/.bin/tsx +17 -0
  164. package/packages/images/shadcn/package.json +82 -0
  165. package/packages/images/shadcn/src/html.ts +341 -0
  166. package/packages/images/shadcn/src/index.ts +37 -0
  167. package/packages/images/shadcn/src/setup.ts +287 -0
  168. package/packages/images/shadcn/tsconfig.json +9 -0
  169. package/packages/images/shadcn/tsup.config.ts +13 -0
  170. package/packages/images/vanilla/node_modules/.bin/jiti +17 -0
  171. package/packages/images/vanilla/node_modules/.bin/tsc +17 -0
  172. package/packages/images/vanilla/node_modules/.bin/tsserver +17 -0
  173. package/packages/images/vanilla/node_modules/.bin/tsup +17 -0
  174. package/packages/images/vanilla/node_modules/.bin/tsup-node +17 -0
  175. package/packages/images/vanilla/node_modules/.bin/tsx +17 -0
  176. package/packages/images/vanilla/package.json +35 -0
  177. package/packages/images/vanilla/src/index.ts +7 -0
  178. package/packages/images/vanilla/src/setup.ts +6 -0
  179. package/packages/images/vanilla/tsconfig.json +9 -0
  180. package/packages/images/vanilla/tsup.config.ts +10 -0
  181. package/packages/patchwork/node_modules/.bin/jiti +17 -0
  182. package/packages/patchwork/node_modules/.bin/tsc +17 -0
  183. package/packages/patchwork/node_modules/.bin/tsserver +17 -0
  184. package/packages/patchwork/node_modules/.bin/tsup +17 -0
  185. package/packages/patchwork/node_modules/.bin/tsup-node +17 -0
  186. package/packages/patchwork/node_modules/.bin/tsx +17 -0
  187. package/packages/patchwork/package.json +27 -0
  188. package/packages/patchwork/src/index.ts +15 -0
  189. package/packages/patchwork/src/services/index.ts +11 -0
  190. package/packages/patchwork/src/services/proxy.ts +213 -0
  191. package/packages/patchwork/src/services/types.ts +28 -0
  192. package/packages/patchwork/src/types.ts +116 -0
  193. package/packages/patchwork/tsconfig.json +8 -0
  194. package/packages/patchwork/tsup.config.ts +14 -0
  195. package/packages/stitchery/node_modules/.bin/jiti +17 -0
  196. package/packages/stitchery/node_modules/.bin/tsc +17 -0
  197. package/packages/stitchery/node_modules/.bin/tsserver +17 -0
  198. package/packages/stitchery/node_modules/.bin/tsup +17 -0
  199. package/packages/stitchery/node_modules/.bin/tsup-node +17 -0
  200. package/packages/stitchery/node_modules/.bin/tsx +17 -0
  201. package/packages/stitchery/package.json +40 -0
  202. package/packages/stitchery/src/cli.ts +116 -0
  203. package/packages/stitchery/src/index.ts +16 -0
  204. package/packages/stitchery/src/prompts.ts +326 -0
  205. package/packages/stitchery/src/server/index.ts +365 -0
  206. package/packages/stitchery/src/server/local-packages.ts +91 -0
  207. package/packages/stitchery/src/server/routes.ts +122 -0
  208. package/packages/stitchery/src/server/services.ts +382 -0
  209. package/packages/stitchery/src/server/vfs-routes.ts +142 -0
  210. package/packages/stitchery/src/types.ts +59 -0
  211. package/packages/stitchery/tsconfig.json +13 -0
  212. package/packages/stitchery/tsup.config.ts +15 -0
  213. package/packages/utcp/node_modules/.bin/jiti +17 -0
  214. package/packages/utcp/node_modules/.bin/tsc +17 -0
  215. package/packages/utcp/node_modules/.bin/tsserver +17 -0
  216. package/packages/utcp/node_modules/.bin/tsup +17 -0
  217. package/packages/utcp/node_modules/.bin/tsup-node +17 -0
  218. package/packages/utcp/node_modules/.bin/tsx +17 -0
  219. package/packages/utcp/package.json +38 -0
  220. package/packages/utcp/src/index.ts +153 -0
  221. package/packages/utcp/tsconfig.json +8 -0
  222. package/packages/utcp/tsup.config.ts +12 -0
  223. package/pnpm-workspace.yaml +3 -0
  224. package/tsconfig.json +18 -0
  225. package/turbo.json +23 -0
@@ -0,0 +1,85 @@
1
+ import type { DesignTokens } from '../../../types';
2
+ import { SectionWrapper } from './SectionWrapper';
3
+ import { QuickSelectDropdown } from '../controls/QuickSelectDropdown';
4
+ import { SliderInput } from '../controls/SliderInput';
5
+
6
+ interface EffectsSectionProps {
7
+ expanded: boolean;
8
+ onToggle: () => void;
9
+ computedStyle: CSSStyleDeclaration;
10
+ onApplyStyle: (property: string, value: string) => void;
11
+ tokens: DesignTokens;
12
+ hasChanges?: boolean;
13
+ }
14
+
15
+ export function EffectsSection({
16
+ expanded,
17
+ onToggle,
18
+ computedStyle,
19
+ onApplyStyle,
20
+ tokens,
21
+ hasChanges = false,
22
+ }: EffectsSectionProps) {
23
+ const boxShadow = computedStyle.boxShadow;
24
+ const borderRadius = computedStyle.borderRadius;
25
+ const borderWidth = computedStyle.borderWidth;
26
+ const opacity = parseFloat(computedStyle.opacity) * 100;
27
+
28
+ return (
29
+ <SectionWrapper title="Effects" expanded={expanded} onToggle={onToggle} hasChanges={hasChanges}>
30
+ {/* Border Radius */}
31
+ <div style={{ marginBottom: '12px' }}>
32
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
33
+ Border Radius
34
+ </label>
35
+ <QuickSelectDropdown
36
+ value={borderRadius}
37
+ tokens={tokens.borderRadius}
38
+ quickKeys={['none', 'sm', 'md', 'lg', 'full']}
39
+ onChange={(value) => onApplyStyle('border-radius', value)}
40
+ />
41
+ </div>
42
+
43
+ {/* Border Width */}
44
+ <div style={{ marginBottom: '12px' }}>
45
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
46
+ Border Width
47
+ </label>
48
+ <QuickSelectDropdown
49
+ value={borderWidth}
50
+ tokens={tokens.borderWidth}
51
+ quickKeys={['0', 'DEFAULT', '2', '4']}
52
+ onChange={(value) => onApplyStyle('border-width', value)}
53
+ />
54
+ </div>
55
+
56
+ {/* Box Shadow */}
57
+ <div style={{ marginBottom: '12px' }}>
58
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
59
+ Shadow
60
+ </label>
61
+ <QuickSelectDropdown
62
+ value={boxShadow}
63
+ tokens={tokens.boxShadow}
64
+ quickKeys={['none', 'sm', 'md', 'lg']}
65
+ onChange={(value) => onApplyStyle('box-shadow', value)}
66
+ />
67
+ </div>
68
+
69
+ {/* Opacity */}
70
+ <div>
71
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
72
+ Opacity
73
+ </label>
74
+ <SliderInput
75
+ value={opacity}
76
+ min={0}
77
+ max={100}
78
+ step={1}
79
+ unit="%"
80
+ onChange={(value) => onApplyStyle('opacity', String(value / 100))}
81
+ />
82
+ </div>
83
+ </SectionWrapper>
84
+ );
85
+ }
@@ -0,0 +1,224 @@
1
+ import type { DesignTokens } from '../../../types';
2
+ import { SectionWrapper } from './SectionWrapper';
3
+ import { ToggleGroup } from '../controls/ToggleGroup';
4
+ import { TokenDropdown } from '../controls/TokenDropdown';
5
+
6
+ // Direction icons
7
+ const ArrowRightIcon = () => (
8
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
9
+ <line x1="5" y1="12" x2="19" y2="12" />
10
+ <polyline points="12 5 19 12 12 19" />
11
+ </svg>
12
+ );
13
+
14
+ const ArrowLeftIcon = () => (
15
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
16
+ <line x1="19" y1="12" x2="5" y2="12" />
17
+ <polyline points="12 19 5 12 12 5" />
18
+ </svg>
19
+ );
20
+
21
+ const ArrowDownIcon = () => (
22
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
23
+ <line x1="12" y1="5" x2="12" y2="19" />
24
+ <polyline points="19 12 12 19 5 12" />
25
+ </svg>
26
+ );
27
+
28
+ const ArrowUpIcon = () => (
29
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
30
+ <line x1="12" y1="19" x2="12" y2="5" />
31
+ <polyline points="5 12 12 5 19 12" />
32
+ </svg>
33
+ );
34
+
35
+ // Justify icons
36
+ const JustifyStartIcon = () => (
37
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
38
+ <line x1="3" y1="4" x2="3" y2="20" />
39
+ <rect x="7" y="8" width="4" height="8" rx="1" />
40
+ <rect x="13" y="8" width="4" height="8" rx="1" />
41
+ </svg>
42
+ );
43
+
44
+ const JustifyCenterIcon = () => (
45
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
46
+ <rect x="6" y="8" width="4" height="8" rx="1" />
47
+ <rect x="14" y="8" width="4" height="8" rx="1" />
48
+ </svg>
49
+ );
50
+
51
+ const JustifyEndIcon = () => (
52
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
53
+ <line x1="21" y1="4" x2="21" y2="20" />
54
+ <rect x="7" y="8" width="4" height="8" rx="1" />
55
+ <rect x="13" y="8" width="4" height="8" rx="1" />
56
+ </svg>
57
+ );
58
+
59
+ const JustifyBetweenIcon = () => (
60
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
61
+ <line x1="3" y1="4" x2="3" y2="20" />
62
+ <line x1="21" y1="4" x2="21" y2="20" />
63
+ <rect x="6" y="8" width="4" height="8" rx="1" />
64
+ <rect x="14" y="8" width="4" height="8" rx="1" />
65
+ </svg>
66
+ );
67
+
68
+ const JustifyAroundIcon = () => (
69
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
70
+ <rect x="4" y="8" width="4" height="8" rx="1" />
71
+ <rect x="10" y="8" width="4" height="8" rx="1" />
72
+ <rect x="16" y="8" width="4" height="8" rx="1" />
73
+ </svg>
74
+ );
75
+
76
+ // Align icons
77
+ const AlignStartIcon = () => (
78
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
79
+ <line x1="4" y1="3" x2="20" y2="3" />
80
+ <rect x="6" y="6" width="4" height="10" rx="1" />
81
+ <rect x="14" y="6" width="4" height="6" rx="1" />
82
+ </svg>
83
+ );
84
+
85
+ const AlignCenterVIcon = () => (
86
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
87
+ <rect x="6" y="5" width="4" height="14" rx="1" />
88
+ <rect x="14" y="7" width="4" height="10" rx="1" />
89
+ </svg>
90
+ );
91
+
92
+ const AlignEndIcon = () => (
93
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
94
+ <line x1="4" y1="21" x2="20" y2="21" />
95
+ <rect x="6" y="8" width="4" height="10" rx="1" />
96
+ <rect x="14" y="12" width="4" height="6" rx="1" />
97
+ </svg>
98
+ );
99
+
100
+ const AlignStretchIcon = () => (
101
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
102
+ <line x1="4" y1="3" x2="20" y2="3" />
103
+ <line x1="4" y1="21" x2="20" y2="21" />
104
+ <rect x="6" y="6" width="4" height="12" rx="1" />
105
+ <rect x="14" y="6" width="4" height="12" rx="1" />
106
+ </svg>
107
+ );
108
+
109
+ interface LayoutSectionProps {
110
+ expanded: boolean;
111
+ onToggle: () => void;
112
+ computedStyle: CSSStyleDeclaration;
113
+ onApplyStyle: (property: string, value: string) => void;
114
+ tokens: DesignTokens;
115
+ hasChanges?: boolean;
116
+ }
117
+
118
+ export function LayoutSection({
119
+ expanded,
120
+ onToggle,
121
+ computedStyle,
122
+ onApplyStyle,
123
+ tokens,
124
+ hasChanges = false,
125
+ }: LayoutSectionProps) {
126
+ const display = computedStyle.display;
127
+ const flexDirection = computedStyle.flexDirection;
128
+ const justifyContent = computedStyle.justifyContent;
129
+ const alignItems = computedStyle.alignItems;
130
+ const gap = computedStyle.gap;
131
+
132
+ const isFlex = display === 'flex' || display === 'inline-flex';
133
+ const isGrid = display === 'grid' || display === 'inline-grid';
134
+
135
+ return (
136
+ <SectionWrapper title="Layout" expanded={expanded} onToggle={onToggle} hasChanges={hasChanges}>
137
+ {/* Display */}
138
+ <div style={{ marginBottom: '12px' }}>
139
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
140
+ Display
141
+ </label>
142
+ <ToggleGroup
143
+ value={display}
144
+ options={[
145
+ { value: 'block', label: 'Block' },
146
+ { value: 'flex', label: 'Flex' },
147
+ { value: 'grid', label: 'Grid' },
148
+ { value: 'inline', label: 'Inline' },
149
+ { value: 'none', label: 'None' },
150
+ ]}
151
+ onChange={(value) => onApplyStyle('display', value)}
152
+ />
153
+ </div>
154
+
155
+ {/* Flex-specific controls */}
156
+ {isFlex && (
157
+ <>
158
+ <div style={{ marginBottom: '12px' }}>
159
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
160
+ Direction
161
+ </label>
162
+ <ToggleGroup
163
+ value={flexDirection}
164
+ options={[
165
+ { value: 'row', label: <ArrowRightIcon /> },
166
+ { value: 'row-reverse', label: <ArrowLeftIcon /> },
167
+ { value: 'column', label: <ArrowDownIcon /> },
168
+ { value: 'column-reverse', label: <ArrowUpIcon /> },
169
+ ]}
170
+ onChange={(value) => onApplyStyle('flex-direction', value)}
171
+ />
172
+ </div>
173
+
174
+ <div style={{ marginBottom: '12px' }}>
175
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
176
+ Justify
177
+ </label>
178
+ <ToggleGroup
179
+ value={justifyContent}
180
+ options={[
181
+ { value: 'flex-start', label: <JustifyStartIcon /> },
182
+ { value: 'center', label: <JustifyCenterIcon /> },
183
+ { value: 'flex-end', label: <JustifyEndIcon /> },
184
+ { value: 'space-between', label: <JustifyBetweenIcon /> },
185
+ { value: 'space-around', label: <JustifyAroundIcon /> },
186
+ ]}
187
+ onChange={(value) => onApplyStyle('justify-content', value)}
188
+ />
189
+ </div>
190
+
191
+ <div style={{ marginBottom: '12px' }}>
192
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
193
+ Align
194
+ </label>
195
+ <ToggleGroup
196
+ value={alignItems}
197
+ options={[
198
+ { value: 'flex-start', label: <AlignStartIcon /> },
199
+ { value: 'center', label: <AlignCenterVIcon /> },
200
+ { value: 'flex-end', label: <AlignEndIcon /> },
201
+ { value: 'stretch', label: <AlignStretchIcon /> },
202
+ ]}
203
+ onChange={(value) => onApplyStyle('align-items', value)}
204
+ />
205
+ </div>
206
+ </>
207
+ )}
208
+
209
+ {/* Gap (for flex and grid) */}
210
+ {(isFlex || isGrid) && (
211
+ <div style={{ marginBottom: '12px' }}>
212
+ <label style={{ fontSize: '10px', color: '#71717a', marginBottom: '4px', display: 'block' }}>
213
+ Gap
214
+ </label>
215
+ <TokenDropdown
216
+ value={gap}
217
+ tokens={tokens.spacing}
218
+ onChange={(value) => onApplyStyle('gap', value)}
219
+ />
220
+ </div>
221
+ )}
222
+ </SectionWrapper>
223
+ );
224
+ }
@@ -0,0 +1,57 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface SectionWrapperProps {
4
+ title: string;
5
+ expanded: boolean;
6
+ onToggle: () => void;
7
+ children: ReactNode;
8
+ hasChanges?: boolean;
9
+ }
10
+
11
+ export function SectionWrapper({ title, expanded, onToggle, children, hasChanges = false }: SectionWrapperProps) {
12
+ return (
13
+ <div style={{ borderBottom: '1px solid #f4f4f5' }}>
14
+ <button
15
+ onClick={onToggle}
16
+ style={{
17
+ width: '100%',
18
+ padding: '8px 12px',
19
+ display: 'flex',
20
+ alignItems: 'center',
21
+ justifyContent: 'space-between',
22
+ backgroundColor: hasChanges ? '#eff6ff' : 'transparent',
23
+ border: 'none',
24
+ cursor: 'pointer',
25
+ color: '#18181b',
26
+ fontSize: '11px',
27
+ fontWeight: 500,
28
+ textTransform: 'uppercase',
29
+ letterSpacing: '0.05em',
30
+ }}
31
+ >
32
+ <span style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
33
+ {title}
34
+ {hasChanges && (
35
+ <span
36
+ style={{
37
+ width: '6px',
38
+ height: '6px',
39
+ borderRadius: '50%',
40
+ backgroundColor: '#3b82f6',
41
+ }}
42
+ title="Has unsaved changes"
43
+ />
44
+ )}
45
+ </span>
46
+ <span style={{ fontSize: '10px', color: '#a1a1aa' }}>
47
+ {expanded ? '▲' : '▼'}
48
+ </span>
49
+ </button>
50
+ {expanded && (
51
+ <div style={{ padding: '0 12px 12px' }}>
52
+ {children}
53
+ </div>
54
+ )}
55
+ </div>
56
+ );
57
+ }
@@ -0,0 +1,166 @@
1
+ import { useState } from 'react';
2
+ import type { DesignTokens } from '../../../types';
3
+ import { SectionWrapper } from './SectionWrapper';
4
+ import { SliderInput } from '../controls/SliderInput';
5
+
6
+ // Common size presets
7
+ const sizePresets: Record<string, string> = {
8
+ 'auto': 'auto',
9
+ 'full': '100%',
10
+ 'fit': 'fit-content',
11
+ 'min': 'min-content',
12
+ 'max': 'max-content',
13
+ 'screen': '100vh',
14
+ };
15
+
16
+ interface SizeSectionProps {
17
+ expanded: boolean;
18
+ onToggle: () => void;
19
+ computedStyle: CSSStyleDeclaration;
20
+ onApplyStyle: (property: string, value: string) => void;
21
+ tokens: DesignTokens;
22
+ hasChanges?: boolean;
23
+ }
24
+
25
+ // Component for size input with quick presets and slider
26
+ function SizeInput({
27
+ label,
28
+ value,
29
+ property,
30
+ onApplyStyle,
31
+ }: {
32
+ label: string;
33
+ value: string;
34
+ property: string;
35
+ onApplyStyle: (property: string, value: string) => void;
36
+ }) {
37
+ const [showSlider, setShowSlider] = useState(false);
38
+ const numericValue = parseFloat(value) || 0;
39
+
40
+ // Check if current value matches a preset
41
+ const isPresetSelected = (presetValue: string) => {
42
+ return value.toLowerCase() === presetValue.toLowerCase();
43
+ };
44
+
45
+ return (
46
+ <div style={{ marginBottom: '10px' }}>
47
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '4px' }}>
48
+ <label style={{ fontSize: '10px', color: '#71717a' }}>{label}</label>
49
+ <button
50
+ onClick={() => setShowSlider(!showSlider)}
51
+ style={{
52
+ padding: '1px 4px',
53
+ borderRadius: '2px',
54
+ border: '1px solid #e4e4e7',
55
+ backgroundColor: showSlider ? '#18181b' : '#ffffff',
56
+ color: showSlider ? '#fafafa' : '#71717a',
57
+ fontSize: '8px',
58
+ cursor: 'pointer',
59
+ }}
60
+ title="Toggle custom size slider"
61
+ >
62
+ px
63
+ </button>
64
+ </div>
65
+
66
+ {/* Quick presets */}
67
+ <div style={{ display: 'flex', gap: '2px', flexWrap: 'wrap', marginBottom: showSlider ? '6px' : 0 }}>
68
+ {Object.entries(sizePresets).slice(0, 5).map(([key, presetValue]) => (
69
+ <button
70
+ key={key}
71
+ onClick={() => onApplyStyle(property, presetValue)}
72
+ style={{
73
+ padding: '2px 5px',
74
+ borderRadius: '3px',
75
+ border: '1px solid',
76
+ borderColor: isPresetSelected(presetValue) ? '#18181b' : '#e4e4e7',
77
+ backgroundColor: isPresetSelected(presetValue) ? '#18181b' : '#ffffff',
78
+ color: isPresetSelected(presetValue) ? '#fafafa' : '#18181b',
79
+ fontSize: '9px',
80
+ fontFamily: 'ui-monospace, monospace',
81
+ cursor: 'pointer',
82
+ transition: 'all 0.1s ease',
83
+ }}
84
+ title={presetValue}
85
+ >
86
+ {key}
87
+ </button>
88
+ ))}
89
+ </div>
90
+
91
+ {/* Slider for custom values */}
92
+ {showSlider && (
93
+ <SliderInput
94
+ value={numericValue}
95
+ min={0}
96
+ max={1000}
97
+ onChange={(v) => onApplyStyle(property, `${v}px`)}
98
+ />
99
+ )}
100
+ </div>
101
+ );
102
+ }
103
+
104
+ export function SizeSection({
105
+ expanded,
106
+ onToggle,
107
+ computedStyle,
108
+ onApplyStyle,
109
+ hasChanges = false,
110
+ }: SizeSectionProps) {
111
+ const width = computedStyle.width;
112
+ const height = computedStyle.height;
113
+ const minWidth = computedStyle.minWidth;
114
+ const maxWidth = computedStyle.maxWidth;
115
+ const minHeight = computedStyle.minHeight;
116
+ const maxHeight = computedStyle.maxHeight;
117
+
118
+ return (
119
+ <SectionWrapper title="Size" expanded={expanded} onToggle={onToggle} hasChanges={hasChanges}>
120
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>
121
+ <SizeInput
122
+ label="Width"
123
+ value={width}
124
+ property="width"
125
+ onApplyStyle={onApplyStyle}
126
+ />
127
+ <SizeInput
128
+ label="Height"
129
+ value={height}
130
+ property="height"
131
+ onApplyStyle={onApplyStyle}
132
+ />
133
+ </div>
134
+
135
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>
136
+ <SizeInput
137
+ label="Min W"
138
+ value={minWidth}
139
+ property="min-width"
140
+ onApplyStyle={onApplyStyle}
141
+ />
142
+ <SizeInput
143
+ label="Max W"
144
+ value={maxWidth}
145
+ property="max-width"
146
+ onApplyStyle={onApplyStyle}
147
+ />
148
+ </div>
149
+
150
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>
151
+ <SizeInput
152
+ label="Min H"
153
+ value={minHeight}
154
+ property="min-height"
155
+ onApplyStyle={onApplyStyle}
156
+ />
157
+ <SizeInput
158
+ label="Max H"
159
+ value={maxHeight}
160
+ property="max-height"
161
+ onApplyStyle={onApplyStyle}
162
+ />
163
+ </div>
164
+ </SectionWrapper>
165
+ );
166
+ }
@@ -0,0 +1,69 @@
1
+ import type { DesignTokens } from '../../../types';
2
+ import { SectionWrapper } from './SectionWrapper';
3
+ import { SpacingControl } from '../controls/SpacingControl';
4
+
5
+ interface SpacingSectionProps {
6
+ expanded: boolean;
7
+ onToggle: () => void;
8
+ computedStyle: CSSStyleDeclaration;
9
+ onApplyStyle: (property: string, value: string) => void;
10
+ tokens: DesignTokens;
11
+ hasChanges?: boolean;
12
+ changedProps?: Record<string, boolean>;
13
+ }
14
+
15
+ export function SpacingSection({
16
+ expanded,
17
+ onToggle,
18
+ computedStyle,
19
+ onApplyStyle,
20
+ hasChanges = false,
21
+ changedProps = {},
22
+ }: SpacingSectionProps) {
23
+ const margin = {
24
+ top: computedStyle.marginTop,
25
+ right: computedStyle.marginRight,
26
+ bottom: computedStyle.marginBottom,
27
+ left: computedStyle.marginLeft,
28
+ };
29
+
30
+ const padding = {
31
+ top: computedStyle.paddingTop,
32
+ right: computedStyle.paddingRight,
33
+ bottom: computedStyle.paddingBottom,
34
+ left: computedStyle.paddingLeft,
35
+ };
36
+
37
+ const marginChanges = {
38
+ top: changedProps['margin-top'],
39
+ right: changedProps['margin-right'],
40
+ bottom: changedProps['margin-bottom'],
41
+ left: changedProps['margin-left'],
42
+ };
43
+
44
+ const paddingChanges = {
45
+ top: changedProps['padding-top'],
46
+ right: changedProps['padding-right'],
47
+ bottom: changedProps['padding-bottom'],
48
+ left: changedProps['padding-left'],
49
+ };
50
+
51
+ return (
52
+ <SectionWrapper title="Spacing" expanded={expanded} onToggle={onToggle} hasChanges={hasChanges}>
53
+ <div style={{ marginBottom: '16px' }}>
54
+ <SpacingControl
55
+ label="Margin"
56
+ values={margin}
57
+ onChange={(side, value) => onApplyStyle(`margin-${side}`, value)}
58
+ hasChanges={marginChanges}
59
+ />
60
+ </div>
61
+ <SpacingControl
62
+ label="Padding"
63
+ values={padding}
64
+ onChange={(side, value) => onApplyStyle(`padding-${side}`, value)}
65
+ hasChanges={paddingChanges}
66
+ />
67
+ </SectionWrapper>
68
+ );
69
+ }