@djangocfg/ui-tools 2.1.239 → 2.1.241
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/README.md +49 -3
- package/dist/index.cjs +731 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +233 -1
- package/dist/index.d.ts +233 -1
- package/dist/index.mjs +726 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -7
- package/src/tools/CodeEditor/CodeEditor.story.tsx +202 -0
- package/src/tools/CodeEditor/README.md +189 -0
- package/src/tools/CodeEditor/components/DiffEditor.tsx +123 -0
- package/src/tools/CodeEditor/components/Editor.tsx +222 -0
- package/src/tools/CodeEditor/components/index.ts +2 -0
- package/src/tools/CodeEditor/context/EditorProvider.tsx +194 -0
- package/src/tools/CodeEditor/context/index.ts +1 -0
- package/src/tools/CodeEditor/hooks/index.ts +4 -0
- package/src/tools/CodeEditor/hooks/useEditor.ts +36 -0
- package/src/tools/CodeEditor/hooks/useEditorTheme.ts +158 -0
- package/src/tools/CodeEditor/hooks/useLanguage.ts +29 -0
- package/src/tools/CodeEditor/hooks/useMonaco.ts +64 -0
- package/src/tools/CodeEditor/index.ts +16 -0
- package/src/tools/CodeEditor/lib/index.ts +2 -0
- package/src/tools/CodeEditor/lib/languages.ts +227 -0
- package/src/tools/CodeEditor/lib/themes.ts +78 -0
- package/src/tools/CodeEditor/types/index.ts +130 -0
- package/src/tools/CodeEditor/workers/index.ts +1 -0
- package/src/tools/CodeEditor/workers/setup.ts +58 -0
- package/src/tools/index.ts +25 -0
package/README.md
CHANGED
|
@@ -28,20 +28,21 @@ This package contains heavy components that are loaded lazily to keep your initi
|
|
|
28
28
|
| `@djangocfg/ui-tools` | Heavy tools with lazy loading |
|
|
29
29
|
| `@djangocfg/ui-nextjs` | Next.js apps (extends ui-core) |
|
|
30
30
|
|
|
31
|
-
## Tools (
|
|
31
|
+
## Tools (13)
|
|
32
32
|
|
|
33
33
|
| Tool | Bundle Size | Description |
|
|
34
34
|
|------|-------------|-------------|
|
|
35
|
-
| `Gallery` | ~50KB | Image/video gallery with carousel, grid, lightbox |
|
|
36
35
|
| `Map` | ~800KB | MapLibre GL maps with markers, clusters, layers |
|
|
37
36
|
| `Mermaid` | ~800KB | Diagram rendering with declarative builders |
|
|
38
|
-
| `
|
|
37
|
+
| `CodeEditor` | ~550KB | Monaco-based code editor with diff view |
|
|
38
|
+
| `PrettyCode` | ~500KB | Code syntax highlighting (read-only) |
|
|
39
39
|
| `OpenapiViewer` | ~400KB | OpenAPI schema viewer & playground |
|
|
40
40
|
| `JsonForm` | ~300KB | JSON Schema form generator |
|
|
41
41
|
| `LottiePlayer` | ~200KB | Lottie animation player |
|
|
42
42
|
| `AudioPlayer` | ~200KB | Audio player with WaveSurfer.js |
|
|
43
43
|
| `VideoPlayer` | ~150KB | Professional video player with Vidstack |
|
|
44
44
|
| `JsonTree` | ~100KB | JSON visualization with modes (full/compact/inline) |
|
|
45
|
+
| `Gallery` | ~50KB | Image/video gallery with carousel, grid, lightbox |
|
|
45
46
|
| `ImageViewer` | ~50KB | Image viewer with zoom/pan/rotate/flip and gallery navigation |
|
|
46
47
|
| `CronScheduler` | ~15KB | Cron expression builder with intuitive UI |
|
|
47
48
|
|
|
@@ -65,6 +66,7 @@ import { FlowDiagram, SequenceDiagram, JourneyDiagram } from '@djangocfg/ui-tool
|
|
|
65
66
|
| Path | Content |
|
|
66
67
|
|------|---------|
|
|
67
68
|
| `@djangocfg/ui-tools` | All tools with lazy loading |
|
|
69
|
+
| `@djangocfg/ui-tools/code-editor` | Monaco editor, diff editor, hooks |
|
|
68
70
|
| `@djangocfg/ui-tools/gallery` | Gallery components & hooks |
|
|
69
71
|
| `@djangocfg/ui-tools/map` | Map components & utilities |
|
|
70
72
|
| `@djangocfg/ui-tools/mermaid` | Mermaid component & declarative builders |
|
|
@@ -469,8 +471,52 @@ journey.section('Sign Up')
|
|
|
469
471
|
return journey.toString();
|
|
470
472
|
```
|
|
471
473
|
|
|
474
|
+
## Code Editor
|
|
475
|
+
|
|
476
|
+
Monaco-based code editor with full IDE features: syntax highlighting, IntelliSense, diff view, multi-file support.
|
|
477
|
+
|
|
478
|
+
```tsx
|
|
479
|
+
import { Editor, DiffEditor } from '@djangocfg/ui-tools';
|
|
480
|
+
// or tree-shakeable: import { Editor } from '@djangocfg/ui-tools/code-editor';
|
|
481
|
+
|
|
482
|
+
// Basic editor
|
|
483
|
+
<Editor
|
|
484
|
+
value="const x = 42;"
|
|
485
|
+
language="typescript"
|
|
486
|
+
onChange={(value) => console.log(value)}
|
|
487
|
+
options={{ fontSize: 14, minimap: false }}
|
|
488
|
+
/>
|
|
489
|
+
|
|
490
|
+
// Diff view
|
|
491
|
+
<DiffEditor
|
|
492
|
+
original="const x = 1;"
|
|
493
|
+
modified="const x = 42;"
|
|
494
|
+
language="typescript"
|
|
495
|
+
/>
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Context & Hooks
|
|
499
|
+
|
|
500
|
+
```tsx
|
|
501
|
+
import {
|
|
502
|
+
EditorProvider,
|
|
503
|
+
useEditorContext,
|
|
504
|
+
useMonaco,
|
|
505
|
+
useEditor,
|
|
506
|
+
useLanguage,
|
|
507
|
+
} from '@djangocfg/ui-tools/code-editor';
|
|
508
|
+
|
|
509
|
+
// Multi-file editor with shared state
|
|
510
|
+
<EditorProvider onSave={async (path) => { /* save file */ }}>
|
|
511
|
+
<FileTree />
|
|
512
|
+
<Editor />
|
|
513
|
+
</EditorProvider>
|
|
514
|
+
```
|
|
515
|
+
|
|
472
516
|
## Code Highlighting
|
|
473
517
|
|
|
518
|
+
Read-only syntax highlighting (lighter than Monaco — use when editing not needed):
|
|
519
|
+
|
|
474
520
|
```tsx
|
|
475
521
|
import { PrettyCode } from '@djangocfg/ui-tools';
|
|
476
522
|
|