@gallop.software/studio 2.0.1 → 2.0.3

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 (47) hide show
  1. package/app/page.tsx +1 -1
  2. package/dist/components/StudioUI.d.mts +15 -0
  3. package/dist/components/StudioUI.d.ts +15 -0
  4. package/dist/components/StudioUI.js +6572 -0
  5. package/dist/components/StudioUI.js.map +1 -0
  6. package/dist/components/StudioUI.mjs +6572 -0
  7. package/dist/components/StudioUI.mjs.map +1 -0
  8. package/dist/handlers/index.js.map +1 -1
  9. package/dist/handlers/index.mjs.map +1 -1
  10. package/next.config.mjs +11 -5
  11. package/package.json +6 -2
  12. package/src/components/AddNewModal.tsx +0 -402
  13. package/src/components/ErrorModal.tsx +0 -89
  14. package/src/components/R2SetupModal.tsx +0 -400
  15. package/src/components/StudioBreadcrumb.tsx +0 -115
  16. package/src/components/StudioButton.tsx +0 -200
  17. package/src/components/StudioContext.tsx +0 -219
  18. package/src/components/StudioDetailView.tsx +0 -714
  19. package/src/components/StudioFileGrid.tsx +0 -704
  20. package/src/components/StudioFileList.tsx +0 -743
  21. package/src/components/StudioFolderPicker.tsx +0 -342
  22. package/src/components/StudioModal.tsx +0 -473
  23. package/src/components/StudioPreview.tsx +0 -399
  24. package/src/components/StudioSettings.tsx +0 -536
  25. package/src/components/StudioToolbar.tsx +0 -1448
  26. package/src/components/StudioUI.tsx +0 -731
  27. package/src/components/styles/common.ts +0 -236
  28. package/src/components/tokens.ts +0 -78
  29. package/src/components/useStudioActions.tsx +0 -497
  30. package/src/config/index.ts +0 -7
  31. package/src/config/workspace.ts +0 -52
  32. package/src/handlers/favicon.ts +0 -152
  33. package/src/handlers/files.ts +0 -784
  34. package/src/handlers/images.ts +0 -949
  35. package/src/handlers/import.ts +0 -190
  36. package/src/handlers/index.ts +0 -168
  37. package/src/handlers/list.ts +0 -627
  38. package/src/handlers/scan.ts +0 -311
  39. package/src/handlers/utils/cdn.ts +0 -234
  40. package/src/handlers/utils/files.ts +0 -64
  41. package/src/handlers/utils/index.ts +0 -4
  42. package/src/handlers/utils/meta.ts +0 -102
  43. package/src/handlers/utils/thumbnails.ts +0 -98
  44. package/src/hooks/useFileList.ts +0 -143
  45. package/src/index.tsx +0 -36
  46. package/src/lib/api.ts +0 -176
  47. package/src/types.ts +0 -119
package/next.config.mjs CHANGED
@@ -8,15 +8,21 @@ const nextConfig = {
8
8
  emotion: true,
9
9
  },
10
10
 
11
- // Disable static generation for this dev tool
12
- experimental: {
13
- // Allow importing from src/ in app/
14
- },
15
-
16
11
  // Environment variables to expose to the client
17
12
  env: {
18
13
  NEXT_PUBLIC_STUDIO_WORKSPACE: process.env.STUDIO_WORKSPACE || process.cwd(),
19
14
  },
15
+
16
+ // Transpile the src folder
17
+ transpilePackages: ['./src'],
18
+
19
+ // Enable SWC minification
20
+ swcMinify: true,
21
+
22
+ // Experimental settings for better TypeScript handling
23
+ experimental: {
24
+ // Improve TypeScript compilation
25
+ },
20
26
  }
21
27
 
22
28
  export default nextConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gallop.software/studio",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Standalone media manager for Gallop templates - upload, process, and sync images to CDN",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -18,13 +18,17 @@
18
18
  "types": "./dist/handlers/index.d.ts",
19
19
  "import": "./dist/handlers/index.mjs",
20
20
  "require": "./dist/handlers/index.js"
21
+ },
22
+ "./components/StudioUI": {
23
+ "types": "./dist/components/StudioUI.d.ts",
24
+ "import": "./dist/components/StudioUI.mjs",
25
+ "require": "./dist/components/StudioUI.js"
21
26
  }
22
27
  },
23
28
  "files": [
24
29
  "dist",
25
30
  "bin",
26
31
  "app",
27
- "src",
28
32
  "next.config.mjs"
29
33
  ],
30
34
  "scripts": {
@@ -1,402 +0,0 @@
1
- /** @jsxImportSource @emotion/react */
2
- 'use client'
3
-
4
- import React, { useState, useRef, useCallback } from 'react'
5
- import { css, keyframes } from '@emotion/react'
6
- import { colors, fontSize, fontStack, baseReset } from './tokens'
7
-
8
- const fadeIn = keyframes`
9
- from { opacity: 0; }
10
- to { opacity: 1; }
11
- `
12
-
13
- const slideIn = keyframes`
14
- from {
15
- opacity: 0;
16
- transform: translateY(-8px) scale(0.98);
17
- }
18
- to {
19
- opacity: 1;
20
- transform: translateY(0) scale(1);
21
- }
22
- `
23
-
24
- const styles = {
25
- overlay: css`
26
- position: fixed;
27
- inset: 0;
28
- background-color: rgba(26, 31, 54, 0.4);
29
- backdrop-filter: blur(4px);
30
- display: flex;
31
- align-items: center;
32
- justify-content: center;
33
- z-index: 10000;
34
- animation: ${fadeIn} 0.15s ease-out;
35
- font-family: ${fontStack};
36
- `,
37
- modal: css`
38
- ${baseReset}
39
- background-color: ${colors.surface};
40
- border-radius: 12px;
41
- box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.3);
42
- max-width: 520px;
43
- width: 90%;
44
- animation: ${slideIn} 0.2s ease-out;
45
- overflow: hidden;
46
- `,
47
- header: css`
48
- padding: 24px 24px 0;
49
- `,
50
- title: css`
51
- font-size: ${fontSize.lg};
52
- font-weight: 600;
53
- color: ${colors.text};
54
- margin: 0;
55
- letter-spacing: -0.02em;
56
- `,
57
- tabs: css`
58
- display: flex;
59
- gap: 0;
60
- margin-top: 16px;
61
- border-bottom: 1px solid ${colors.border};
62
- `,
63
- tab: css`
64
- padding: 12px 20px;
65
- font-size: ${fontSize.base};
66
- font-weight: 500;
67
- color: ${colors.textSecondary};
68
- background: none;
69
- border: none;
70
- cursor: pointer;
71
- position: relative;
72
- transition: color 0.15s;
73
-
74
- &:hover {
75
- color: ${colors.text};
76
- }
77
- `,
78
- tabActive: css`
79
- color: ${colors.primary};
80
-
81
- &::after {
82
- content: '';
83
- position: absolute;
84
- bottom: -1px;
85
- left: 0;
86
- right: 0;
87
- height: 2px;
88
- background-color: ${colors.primary};
89
- }
90
- `,
91
- body: css`
92
- padding: 24px;
93
- min-height: 200px;
94
- `,
95
- dropzone: css`
96
- border: 2px dashed ${colors.border};
97
- border-radius: 8px;
98
- padding: 40px 24px;
99
- text-align: center;
100
- cursor: pointer;
101
- transition: all 0.15s;
102
-
103
- &:hover {
104
- border-color: ${colors.primary};
105
- background-color: ${colors.primaryLight};
106
- }
107
- `,
108
- dropzoneActive: css`
109
- border-color: ${colors.primary};
110
- background-color: ${colors.primaryLight};
111
- `,
112
- dropzoneIcon: css`
113
- width: 48px;
114
- height: 48px;
115
- margin: 0 auto 16px;
116
- color: ${colors.textMuted};
117
- `,
118
- dropzoneText: css`
119
- font-size: ${fontSize.base};
120
- color: ${colors.text};
121
- margin: 0 0 4px;
122
- `,
123
- dropzoneHint: css`
124
- font-size: ${fontSize.sm};
125
- color: ${colors.textSecondary};
126
- margin: 0;
127
- `,
128
- textarea: css`
129
- width: 100%;
130
- min-height: 150px;
131
- padding: 12px;
132
- font-size: ${fontSize.sm};
133
- font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
134
- border: 1px solid ${colors.border};
135
- border-radius: 8px;
136
- resize: vertical;
137
-
138
- &:focus {
139
- outline: none;
140
- border-color: ${colors.primary};
141
- box-shadow: 0 0 0 3px ${colors.primaryLight};
142
- }
143
-
144
- &::placeholder {
145
- color: ${colors.textMuted};
146
- }
147
- `,
148
- textareaLabel: css`
149
- font-size: ${fontSize.sm};
150
- color: ${colors.textSecondary};
151
- margin: 0 0 8px;
152
- `,
153
- footer: css`
154
- display: flex;
155
- justify-content: flex-end;
156
- gap: 12px;
157
- padding: 16px 24px;
158
- border-top: 1px solid ${colors.border};
159
- background-color: ${colors.background};
160
- `,
161
- btn: css`
162
- padding: 10px 18px;
163
- font-size: ${fontSize.base};
164
- font-weight: 500;
165
- border-radius: 6px;
166
- cursor: pointer;
167
- transition: all 0.15s ease;
168
- letter-spacing: -0.01em;
169
- `,
170
- btnCancel: css`
171
- background-color: ${colors.surface};
172
- border: 1px solid ${colors.border};
173
- color: ${colors.text};
174
-
175
- &:hover {
176
- background-color: ${colors.surfaceHover};
177
- border-color: ${colors.borderHover};
178
- }
179
- `,
180
- btnConfirm: css`
181
- background-color: ${colors.primary};
182
- border: 1px solid ${colors.primary};
183
- color: white;
184
-
185
- &:hover:not(:disabled) {
186
- background-color: ${colors.primaryHover};
187
- border-color: ${colors.primaryHover};
188
- }
189
-
190
- &:disabled {
191
- opacity: 0.6;
192
- cursor: not-allowed;
193
- }
194
- `,
195
- fileInput: css`
196
- display: none;
197
- `,
198
- selectedFiles: css`
199
- margin-top: 16px;
200
- padding: 12px;
201
- background-color: ${colors.background};
202
- border-radius: 6px;
203
- font-size: ${fontSize.sm};
204
- color: ${colors.text};
205
- `,
206
- }
207
-
208
- interface AddNewModalProps {
209
- currentPath: string
210
- onClose: () => void
211
- onUploadComplete: () => void
212
- }
213
-
214
- export function AddNewModal({ currentPath, onClose, onUploadComplete }: AddNewModalProps) {
215
- const [activeTab, setActiveTab] = useState<'upload' | 'import'>('upload')
216
- const [selectedFiles, setSelectedFiles] = useState<File[]>([])
217
- const [urlInput, setUrlInput] = useState('')
218
- const [isDragging, setIsDragging] = useState(false)
219
- const [uploading, setUploading] = useState(false)
220
- const [importing, setImporting] = useState(false)
221
- const fileInputRef = useRef<HTMLInputElement>(null)
222
-
223
- const handleFileSelect = useCallback((files: FileList | null) => {
224
- if (files) {
225
- setSelectedFiles(Array.from(files))
226
- }
227
- }, [])
228
-
229
- const handleDrop = useCallback((e: React.DragEvent) => {
230
- e.preventDefault()
231
- setIsDragging(false)
232
- handleFileSelect(e.dataTransfer.files)
233
- }, [handleFileSelect])
234
-
235
- const handleUpload = useCallback(async () => {
236
- if (selectedFiles.length === 0) return
237
-
238
- setUploading(true)
239
-
240
- try {
241
- for (const file of selectedFiles) {
242
- const formData = new FormData()
243
- formData.append('file', file)
244
- formData.append('path', currentPath)
245
-
246
- await fetch('/api/studio/upload', {
247
- method: 'POST',
248
- body: formData,
249
- })
250
- }
251
-
252
- onUploadComplete()
253
- onClose()
254
- } catch (error) {
255
- console.error('Upload failed:', error)
256
- } finally {
257
- setUploading(false)
258
- }
259
- }, [selectedFiles, currentPath, onUploadComplete, onClose])
260
-
261
- const handleImport = useCallback(async () => {
262
- const urls = urlInput
263
- .split('\n')
264
- .map(url => url.trim())
265
- .filter(url => url.length > 0)
266
-
267
- if (urls.length === 0) return
268
-
269
- setImporting(true)
270
-
271
- try {
272
- const response = await fetch('/api/studio/import', {
273
- method: 'POST',
274
- headers: { 'Content-Type': 'application/json' },
275
- body: JSON.stringify({ urls }),
276
- })
277
-
278
- const reader = response.body?.getReader()
279
- if (!reader) throw new Error('No reader')
280
-
281
- const decoder = new TextDecoder()
282
-
283
- while (true) {
284
- const { done, value } = await reader.read()
285
- if (done) break
286
-
287
- const text = decoder.decode(value)
288
- const lines = text.split('\n\n').filter(line => line.startsWith('data: '))
289
-
290
- for (const line of lines) {
291
- const data = JSON.parse(line.replace('data: ', ''))
292
- if (data.type === 'complete') {
293
- onUploadComplete()
294
- onClose()
295
- }
296
- }
297
- }
298
- } catch (error) {
299
- console.error('Import failed:', error)
300
- } finally {
301
- setImporting(false)
302
- }
303
- }, [urlInput, onUploadComplete, onClose])
304
-
305
- return (
306
- <div css={styles.overlay} onClick={onClose}>
307
- <div css={styles.modal} onClick={e => e.stopPropagation()}>
308
- <div css={styles.header}>
309
- <h3 css={styles.title}>Add New</h3>
310
- <div css={styles.tabs}>
311
- <button
312
- css={[styles.tab, activeTab === 'upload' && styles.tabActive]}
313
- onClick={() => setActiveTab('upload')}
314
- >
315
- Upload Files
316
- </button>
317
- <button
318
- css={[styles.tab, activeTab === 'import' && styles.tabActive]}
319
- onClick={() => setActiveTab('import')}
320
- >
321
- Import URLs
322
- </button>
323
- </div>
324
- </div>
325
-
326
- <div css={styles.body}>
327
- {activeTab === 'upload' ? (
328
- <>
329
- <div
330
- css={[styles.dropzone, isDragging && styles.dropzoneActive]}
331
- onClick={() => fileInputRef.current?.click()}
332
- onDragOver={(e) => { e.preventDefault(); setIsDragging(true) }}
333
- onDragLeave={() => setIsDragging(false)}
334
- onDrop={handleDrop}
335
- >
336
- <svg css={styles.dropzoneIcon} fill="none" stroke="currentColor" viewBox="0 0 24 24">
337
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
338
- </svg>
339
- <p css={styles.dropzoneText}>
340
- Drop files here or click to browse
341
- </p>
342
- <p css={styles.dropzoneHint}>
343
- Supports images and other media files
344
- </p>
345
- </div>
346
- <input
347
- ref={fileInputRef}
348
- type="file"
349
- multiple
350
- css={styles.fileInput}
351
- onChange={(e) => handleFileSelect(e.target.files)}
352
- />
353
- {selectedFiles.length > 0 && (
354
- <div css={styles.selectedFiles}>
355
- {selectedFiles.length} file{selectedFiles.length !== 1 ? 's' : ''} selected
356
- </div>
357
- )}
358
- </>
359
- ) : (
360
- <>
361
- <p css={styles.textareaLabel}>
362
- Paste image URLs (one per line)
363
- </p>
364
- <textarea
365
- css={styles.textarea}
366
- value={urlInput}
367
- onChange={(e) => setUrlInput(e.target.value)}
368
- placeholder={`https://cdn.example.com/photos/image1.jpg\nhttps://cdn.example.com/photos/image2.jpg`}
369
- />
370
- </>
371
- )}
372
- </div>
373
-
374
- <div css={styles.footer}>
375
- <button
376
- css={[styles.btn, styles.btnCancel]}
377
- onClick={onClose}
378
- >
379
- Cancel
380
- </button>
381
- {activeTab === 'upload' ? (
382
- <button
383
- css={[styles.btn, styles.btnConfirm]}
384
- onClick={handleUpload}
385
- disabled={selectedFiles.length === 0 || uploading}
386
- >
387
- {uploading ? 'Uploading...' : 'Upload'}
388
- </button>
389
- ) : (
390
- <button
391
- css={[styles.btn, styles.btnConfirm]}
392
- onClick={handleImport}
393
- disabled={!urlInput.trim() || importing}
394
- >
395
- {importing ? 'Importing...' : 'Import'}
396
- </button>
397
- )}
398
- </div>
399
- </div>
400
- </div>
401
- )
402
- }
@@ -1,89 +0,0 @@
1
- /** @jsxImportSource @emotion/react */
2
- 'use client'
3
-
4
- import { css } from '@emotion/react'
5
- import { useStudio } from './StudioContext'
6
- import { colors, fontSize } from './tokens'
7
-
8
- const styles = {
9
- overlay: css`
10
- position: fixed;
11
- inset: 0;
12
- background: rgba(0, 0, 0, 0.5);
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
16
- z-index: 1100;
17
- `,
18
- modal: css`
19
- background: ${colors.surface};
20
- border-radius: 12px;
21
- padding: 24px;
22
- max-width: 400px;
23
- width: 90%;
24
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
25
- `,
26
- header: css`
27
- display: flex;
28
- align-items: center;
29
- gap: 12px;
30
- margin-bottom: 12px;
31
- `,
32
- icon: css`
33
- width: 24px;
34
- height: 24px;
35
- color: ${colors.danger};
36
- flex-shrink: 0;
37
- `,
38
- title: css`
39
- font-size: ${fontSize.lg};
40
- font-weight: 600;
41
- color: ${colors.text};
42
- margin: 0;
43
- `,
44
- message: css`
45
- font-size: ${fontSize.base};
46
- color: ${colors.textSecondary};
47
- margin: 0 0 20px 0;
48
- line-height: 1.5;
49
- `,
50
- button: css`
51
- width: 100%;
52
- padding: 10px 16px;
53
- border-radius: 6px;
54
- font-size: ${fontSize.base};
55
- font-weight: 500;
56
- border: none;
57
- background: ${colors.primary};
58
- color: white;
59
- cursor: pointer;
60
- transition: background 0.15s ease;
61
-
62
- &:hover {
63
- background: ${colors.primaryHover};
64
- }
65
- `,
66
- }
67
-
68
- export function ErrorModal() {
69
- const { error, clearError } = useStudio()
70
-
71
- if (!error) return null
72
-
73
- return (
74
- <div css={styles.overlay} onClick={clearError}>
75
- <div css={styles.modal} onClick={(e) => e.stopPropagation()}>
76
- <div css={styles.header}>
77
- <svg css={styles.icon} fill="none" stroke="currentColor" viewBox="0 0 24 24">
78
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
79
- </svg>
80
- <h3 css={styles.title}>{error.title}</h3>
81
- </div>
82
- <p css={styles.message}>{error.message}</p>
83
- <button css={styles.button} onClick={clearError}>
84
- OK
85
- </button>
86
- </div>
87
- </div>
88
- )
89
- }