@object-ui/plugin-editor 0.3.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # @object-ui/plugin-editor
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Unified version across all packages to 0.3.0 for consistent versioning
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - New plugin-object and ObjectQL SDK updates
14
+
15
+ **Added:**
16
+ - New Plugin: @object-ui/plugin-object - ObjectQL plugin for automatic table and form generation
17
+ - ObjectTable: Auto-generates tables from ObjectQL object schemas
18
+ - ObjectForm: Auto-generates forms from ObjectQL object schemas with create/edit/view modes
19
+ - Full TypeScript support with comprehensive type definitions
20
+ - Type Definitions: Added ObjectTableSchema and ObjectFormSchema to @object-ui/types
21
+ - ObjectQL Integration: Enhanced ObjectQLDataSource with getObjectSchema() method using MetadataApiClient
22
+
23
+ **Changed:**
24
+ - Updated @objectql/sdk from ^1.8.3 to ^1.9.1
25
+ - Updated @objectql/types from ^1.8.3 to ^1.9.1
26
+
27
+ - Updated dependencies
28
+ - @object-ui/types@0.3.0
29
+ - @object-ui/core@0.2.2
30
+ - @object-ui/react@0.2.2
31
+ - @object-ui/components@0.2.2
32
+
33
+ ## 0.2.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Patch release: Add automated changeset workflow and CI/CD improvements
38
+
39
+ This release includes infrastructure improvements:
40
+ - Added changeset-based version management
41
+ - Enhanced CI/CD workflows with GitHub Actions
42
+ - Improved documentation for contributing and releasing
43
+
44
+ - Updated dependencies
45
+ - @object-ui/types@0.2.1
46
+ - @object-ui/core@0.2.1
47
+ - @object-ui/react@0.2.1
48
+ - @object-ui/components@0.2.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ObjectQL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # Plugin Editor - Lazy-Loaded Monaco Editor
2
+
3
+ A lazy-loaded code editor component for Object UI based on Monaco Editor.
4
+
5
+ ## Features
6
+
7
+ - **Internal Lazy Loading**: The Monaco Editor is loaded on-demand using `React.lazy()` and `Suspense`
8
+ - **Zero Configuration**: Just import the package and use `type: 'code-editor'` in your schema
9
+ - **Automatic Registration**: Components auto-register with the ComponentRegistry
10
+ - **Skeleton Loading**: Shows a skeleton while Monaco loads
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @object-ui/plugin-editor
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Automatic Registration (Side-Effect Import)
21
+
22
+ ```typescript
23
+ // In your app entry point (e.g., App.tsx or main.tsx)
24
+ import '@object-ui/plugin-editor';
25
+
26
+ // Now you can use code-editor type in your schemas
27
+ const schema = {
28
+ type: 'code-editor',
29
+ value: 'console.log("Hello, World!");',
30
+ language: 'javascript',
31
+ theme: 'vs-dark',
32
+ height: '400px'
33
+ };
34
+ ```
35
+
36
+ ### Manual Integration
37
+
38
+ ```typescript
39
+ import { editorComponents } from '@object-ui/plugin-editor';
40
+ import { ComponentRegistry } from '@object-ui/core';
41
+
42
+ // Manually register if needed
43
+ Object.entries(editorComponents).forEach(([type, component]) => {
44
+ ComponentRegistry.register(type, component);
45
+ });
46
+ ```
47
+
48
+ ### TypeScript Support
49
+
50
+ The plugin exports TypeScript types for full type safety:
51
+
52
+ ```typescript
53
+ import type { CodeEditorSchema } from '@object-ui/plugin-editor';
54
+
55
+ const schema: CodeEditorSchema = {
56
+ type: 'code-editor',
57
+ value: 'console.log("Hello, World!");',
58
+ language: 'javascript',
59
+ theme: 'vs-dark',
60
+ height: '400px'
61
+ };
62
+ ```
63
+
64
+ ## Schema API
65
+
66
+ ```typescript
67
+ {
68
+ type: 'code-editor',
69
+ value?: string, // Code content
70
+ language?: string, // 'javascript' | 'typescript' | 'python' | 'json' | 'html' | 'css'
71
+ theme?: 'vs-dark' | 'light', // Editor theme
72
+ height?: string, // e.g., '400px'
73
+ readOnly?: boolean, // Read-only mode
74
+ className?: string // Tailwind classes
75
+ }
76
+ ```
77
+
78
+ ## Lazy Loading Architecture
79
+
80
+ The plugin uses a two-file pattern for optimal code splitting:
81
+
82
+ 1. **`MonacoImpl.tsx`**: Contains the actual Monaco Editor import (heavy)
83
+ 2. **`index.tsx`**: Entry point with `React.lazy()` wrapper (light)
84
+
85
+ When bundled, Vite automatically creates separate chunks:
86
+ - `index.js` (~200 bytes) - The entry point
87
+ - `MonacoImpl-xxx.js` (~15-20 KB) - The lazy-loaded implementation
88
+
89
+ The Monaco Editor library is only downloaded when a `code-editor` component is actually rendered, not on initial page load.
90
+
91
+ ## Build Output Example
92
+
93
+ ```
94
+ dist/index.js 0.19 kB # Entry point
95
+ dist/MonacoImpl-DCiwKyYW.js 19.42 kB # Lazy chunk (loaded on demand)
96
+ dist/index.umd.cjs 30.37 kB # UMD bundle
97
+ ```
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ # Build the plugin
103
+ pnpm build
104
+
105
+ # The package will generate proper ESM and UMD builds with lazy loading preserved
106
+ ```