@catalystsoftware/ui 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/catalyst-ui/data/chat-data.tsx +336 -0
- package/dist/components/catalyst-ui/data/code-data.tsx +1 -74
- package/dist/components/catalyst-ui/data/core-data.tsx +679 -7
- package/dist/components/catalyst-ui/data/crm-data.tsx +2 -2
- package/dist/components/catalyst-ui/data/forms-data.tsx +5 -5
- package/dist/components/catalyst-ui/data/media-data.tsx +66 -3
- package/dist/components/catalyst-ui/data/overlay-data.tsx +5 -3
- package/dist/components/catalyst-ui/data/primitive-data.tsx +18 -128
- package/dist/components/catalyst-ui/data/sidebars-data.tsx +38 -38
- package/dist/components/catalyst-ui/data/tools-data.tsx +1 -1
- package/dist/components/catalyst-ui/data/utils-data.tsx +27 -9
- package/dist/components/catalyst-ui/marketing/sections/header.tsx +1 -0
- package/dist/components/catalyst-ui/overlays/sidebar-props.tsx +1 -1
- package/dist/components/catalyst-ui/primitives/alert.tsx +1 -1
- package/dist/components/catalyst-ui/tools/md-badge-builder.tsx +1 -1
- package/dist/components/catalyst-ui/tools/monaco-sidebar.tsx +935 -331
- package/dist/components/catalyst-ui/tools/monaco.tsx +66 -66
- package/dist/components/catalyst-ui/tools/snippets.tsx +844 -0
- package/dist/data/tailwind.config.js +1 -1
- package/dist/data/tailwind.config.ngin.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientOnly, } from "~/utils/client-only";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { X, } from "lucide-react";
|
|
4
4
|
import { LoadingPage, SpinnerV4, DEFAULT_PREF, loadEditorSettings, autoSaveSettings, handleEditorDidMount as baseHandleEditorDidMount, renderEditor as baseRenderEditor, useToasted, MonacoToolbar, } from "~/components/catalyst-ui";
|
|
5
5
|
import { useDS, DSTrigger } from "~/components/catalyst-ui";
|
|
@@ -18,7 +18,7 @@ export function MonacoEditor({ setCode, code, }) {
|
|
|
18
18
|
const [theme, setTheme] = useState(DEFAULT_PREF.theme);
|
|
19
19
|
const [isFullscreen, setIsFullscreen] = useState(DEFAULT_PREF.isFullscreen);
|
|
20
20
|
const [es, setEs] = useState(() => loadEditorSettings());
|
|
21
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
21
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
22
22
|
const [lastSaved, setLastSaved] = useState(null);
|
|
23
23
|
const [isClient, setIsClient] = useState(false);
|
|
24
24
|
const [editorRenameTab, setEditorRenameTab] = useState(false);
|
|
@@ -330,76 +330,75 @@ export function MonacoEditor({ setCode, code, }) {
|
|
|
330
330
|
};
|
|
331
331
|
|
|
332
332
|
const TabComponent = ({ tab, isActive, onClose, onSelect }) => {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
useEffect(() => {
|
|
345
|
-
if (isEditing && inputRef.current) {
|
|
346
|
-
inputRef.current.focus();
|
|
347
|
-
inputRef.current.select();
|
|
348
|
-
}
|
|
349
|
-
}, [isEditing]);
|
|
333
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
334
|
+
const [editName, setEditName] = useState(tab.name);
|
|
335
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
336
|
+
|
|
337
|
+
useEffect(() => {
|
|
338
|
+
if (editorRenameTab && isActive) {
|
|
339
|
+
setIsEditing(true);
|
|
340
|
+
setEditName(tab.name);
|
|
341
|
+
}
|
|
342
|
+
}, [editorRenameTab, isActive]);
|
|
350
343
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
};
|
|
344
|
+
useEffect(() => {
|
|
345
|
+
if (isEditing && inputRef.current) {
|
|
346
|
+
inputRef.current.focus();
|
|
347
|
+
inputRef.current.select();
|
|
348
|
+
}
|
|
349
|
+
}, [isEditing]);
|
|
358
350
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
setEditName(tab.name);
|
|
351
|
+
const handleRename = () => {
|
|
352
|
+
if (editName.trim() && editName !== tab.name) {
|
|
353
|
+
renameTab(tab.id, editName.trim());
|
|
354
|
+
}
|
|
364
355
|
setIsEditing(false);
|
|
365
356
|
setEditorRenameTab(false);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
357
|
+
};
|
|
368
358
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
onClick={(e) => e.stopPropagation()}
|
|
385
|
-
className="text-sm bg-transparent border-none outline-none focus:ring-0 w-32 px-0"
|
|
386
|
-
/>
|
|
387
|
-
) : (
|
|
388
|
-
<span className="text-sm truncate max-w-32">{tab.name}</span>
|
|
389
|
-
)}
|
|
390
|
-
{tab.isDirty && <span className="ml-1 text-destructive">●</span>}
|
|
391
|
-
<button
|
|
392
|
-
onClick={(e) => {
|
|
393
|
-
e.stopPropagation();
|
|
394
|
-
onClose(tab.id);
|
|
395
|
-
}}
|
|
396
|
-
className="ml-2 p-1 rounded hover:bg-destructive/20 hover:text-destructive"
|
|
359
|
+
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
360
|
+
if (e.key === 'Enter') {
|
|
361
|
+
handleRename();
|
|
362
|
+
} else if (e.key === 'Escape') {
|
|
363
|
+
setEditName(tab.name);
|
|
364
|
+
setIsEditing(false);
|
|
365
|
+
setEditorRenameTab(false);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
return (
|
|
370
|
+
<div
|
|
371
|
+
className={`flex items-center px-3 py-2 border-r border-border cursor-pointer transition-colors ${isActive ? "bg-background text-foreground border-b-2 border-primary" : "bg-muted text-muted-foreground hover:bg-background hover:text-foreground"
|
|
372
|
+
}`}
|
|
373
|
+
onClick={() => !isEditing && onSelect(tab.id)}
|
|
397
374
|
>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
375
|
+
{isEditing ? (
|
|
376
|
+
<input
|
|
377
|
+
ref={inputRef}
|
|
378
|
+
type="text"
|
|
379
|
+
value={editName}
|
|
380
|
+
onChange={(e) => setEditName(e.target.value)}
|
|
381
|
+
onBlur={handleRename}
|
|
382
|
+
onKeyDown={handleKeyDown}
|
|
383
|
+
onClick={(e) => e.stopPropagation()}
|
|
384
|
+
className="text-sm bg-transparent border-none outline-none focus:ring-0 w-32 px-0"
|
|
385
|
+
/>
|
|
386
|
+
) : (
|
|
387
|
+
<span className="text-sm truncate max-w-32">{tab.name}</span>
|
|
388
|
+
)}
|
|
389
|
+
{tab.isDirty && <span className="ml-1 text-destructive">●</span>}
|
|
390
|
+
<button
|
|
391
|
+
onClick={(e) => {
|
|
392
|
+
e.stopPropagation();
|
|
393
|
+
onClose(tab.id);
|
|
394
|
+
}}
|
|
395
|
+
className="ml-2 p-1 rounded hover:bg-destructive/20 hover:text-destructive"
|
|
396
|
+
>
|
|
397
|
+
<X className="h-3 w-3" />
|
|
398
|
+
</button>
|
|
399
|
+
</div>
|
|
400
|
+
);
|
|
401
|
+
};
|
|
403
402
|
const onOpen = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
404
403
|
try {
|
|
405
404
|
const file = e.target.files?.[0];
|
|
@@ -486,6 +485,7 @@ export function MonacoEditor({ setCode, code, }) {
|
|
|
486
485
|
</div>
|
|
487
486
|
)}
|
|
488
487
|
</div>
|
|
488
|
+
|
|
489
489
|
</div>
|
|
490
490
|
);
|
|
491
491
|
}
|