@object-ui/plugin-editor 3.3.0 → 3.3.1

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @object-ui/plugin-editor
2
2
 
3
+ ## 3.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b429568]
8
+ - @object-ui/components@3.3.1
9
+ - @object-ui/types@3.3.1
10
+ - @object-ui/core@3.3.1
11
+ - @object-ui/react@3.3.1
12
+
3
13
  ## 3.3.0
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -104,3 +104,27 @@ pnpm build
104
104
 
105
105
  # The package will generate proper ESM and UMD builds with lazy loading preserved
106
106
  ```
107
+
108
+ <!-- release-metadata:v3.3.0 -->
109
+
110
+ ## Compatibility
111
+
112
+ - **React:** 18.x or 19.x
113
+ - **Node.js:** ≥ 18
114
+ - **TypeScript:** ≥ 5.0 (strict mode)
115
+ - **`@objectstack/spec`:** ^3.3.0
116
+ - **`@objectstack/client`:** ^3.3.0
117
+ - **Tailwind CSS:** ≥ 3.4 (for packages with UI)
118
+
119
+ ## Links
120
+
121
+ - 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-editor)
122
+ - 📦 [npm package](https://www.npmjs.com/package/@object-ui/plugin-editor)
123
+ - 📝 [Changelog](./CHANGELOG.md)
124
+ - 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
125
+ - 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
126
+ - 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
127
+
128
+ ## License
129
+
130
+ MIT — see [LICENSE](./LICENSE).
@@ -1,4 +1,4 @@
1
- import { t as e } from "./jsx-runtime-HjdTyiyb.js";
1
+ import { t as e } from "./jsx-runtime-hW70xvt7.js";
2
2
  import t, { memo as n, useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
3
  //#region ../../node_modules/.pnpm/@monaco-editor+loader@1.7.0/node_modules/@monaco-editor/loader/lib/es/_virtual/_rollupPluginBabelHelpers.js
4
4
  function s(e, t) {
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { t as e } from "./jsx-runtime-HjdTyiyb.js";
1
+ import { t as e } from "./jsx-runtime-hW70xvt7.js";
2
2
  import t, { Suspense as n } from "react";
3
3
  import { ComponentRegistry as r } from "@object-ui/core";
4
4
  import { Skeleton as i } from "@object-ui/components";
5
5
  //#region src/index.tsx
6
- var a = e(), o = t.lazy(() => import("./MonacoImpl-BMgw4JKF.js")), s = ({ schema: e, value: t, onChange: r }) => /* @__PURE__ */ (0, a.jsx)(n, {
6
+ var a = e(), o = t.lazy(() => import("./MonacoImpl-CWQ6eT06.js")), s = ({ schema: e, value: t, onChange: r }) => /* @__PURE__ */ (0, a.jsx)(n, {
7
7
  fallback: /* @__PURE__ */ (0, a.jsx)(i, { className: "w-full h-[400px]" }),
8
8
  children: /* @__PURE__ */ (0, a.jsx)(o, {
9
9
  value: t ?? e.value,
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@object-ui/core`),require(`@object-ui/components`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/components`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginEditor={},e.React,e.ObjectUICore,e.ObjectUIComponents))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>()=>(e&&(t=e(e=0)),t),d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),f=(e,t)=>{let n={};for(var r in e)a(n,r,{get:e[r],enumerable:!0});return t||a(n,Symbol.toStringTag,{value:`Module`}),n},p=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:i(c(e)),p(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var m=d((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),h=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`@object-ui/core`),require(`@object-ui/components`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/components`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginEditor={},e.React,e.ObjectUICore,e.ObjectUIComponents))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>()=>(e&&(t=e(e=0)),t),d=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),f=(e,t)=>{let n={};for(var r in e)a(n,r,{get:e[r],enumerable:!0});return t||a(n,Symbol.toStringTag,{value:`Module`}),n},p=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:i(c(e)),p(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var m=d((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),h=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
@@ -1,5 +1,5 @@
1
1
  //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
2
+ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
3
  if (typeof require < "u") return require.apply(this, arguments);
4
4
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
5
  }), n = /* @__PURE__ */ e(((e) => {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-editor",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Rich text editor plugin for Object UI, powered by Monaco Editor",
7
- "homepage": "https://www.objectui.org",
7
+ "homepage": "https://www.objectui.org/docs/plugins/plugin-editor",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/objectstack-ai/objectui.git",
10
+ "url": "git+https://github.com/objectstack-ai/objectui.git",
11
11
  "directory": "packages/plugin-editor"
12
12
  },
13
13
  "bugs": {
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@monaco-editor/react": "^4.7.0",
28
- "@object-ui/components": "3.3.0",
29
- "@object-ui/core": "3.3.0",
30
- "@object-ui/react": "3.3.0",
31
- "@object-ui/types": "3.3.0"
28
+ "@object-ui/components": "3.3.1",
29
+ "@object-ui/core": "3.3.1",
30
+ "@object-ui/react": "3.3.1",
31
+ "@object-ui/types": "3.3.1"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^18.0.0 || ^19.0.0",
@@ -38,10 +38,33 @@
38
38
  "@types/react": "19.2.14",
39
39
  "@types/react-dom": "19.2.3",
40
40
  "@vitejs/plugin-react": "^6.0.1",
41
- "typescript": "^6.0.2",
42
- "vite": "^8.0.8",
41
+ "typescript": "^6.0.3",
42
+ "vite": "^8.0.9",
43
43
  "vite-plugin-dts": "^4.5.4"
44
44
  },
45
+ "keywords": [
46
+ "objectui",
47
+ "sdui",
48
+ "schema-driven-ui",
49
+ "react",
50
+ "tailwind",
51
+ "shadcn",
52
+ "objectstack",
53
+ "plugin",
54
+ "editor",
55
+ "monaco",
56
+ "code-editor"
57
+ ],
58
+ "author": "ObjectStack Team <team@objectstack.ai>",
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "README.md",
65
+ "CHANGELOG.md",
66
+ "LICENSE"
67
+ ],
45
68
  "scripts": {
46
69
  "build": "vite build",
47
70
  "test": "vitest run",
@@ -1,27 +0,0 @@
1
-
2
- > @object-ui/plugin-editor@3.3.0 build /home/runner/work/objectui/objectui/packages/plugin-editor
3
- > vite build
4
-
5
- vite v8.0.8 building client environment for production...
6
- 
7
- rendering chunks...
8
- 
9
- [vite:dts] Start generate declaration files...
10
- [vite:dts] Declaration files built in 10183ms.
11
- 
12
- computing gzip size...
13
- dist/index.js 1.65 kB │ gzip: 0.74 kB
14
- dist/jsx-runtime-HjdTyiyb.js 7.81 kB │ gzip: 2.84 kB
15
- dist/MonacoImpl-BMgw4JKF.js 18.40 kB │ gzip: 5.69 kB
16
-
17
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
18
- - vite:dts (86%)
19
- - vite:worker (9%)
20
- See https://rolldown.rs/options/checks#plugintimings for more details.
21
- 
22
- 
23
- rendering chunks...
24
- computing gzip size...
25
- dist/index.umd.cjs 22.90 kB │ gzip: 8.06 kB
26
-
27
- ✓ built in 11.00s
@@ -1,53 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import Editor from '@monaco-editor/react';
10
-
11
- export interface MonacoImplProps {
12
- value?: string;
13
- language?: string;
14
- theme?: 'vs-dark' | 'light';
15
- height?: string;
16
- onChange?: (value: string | undefined) => void;
17
- readOnly?: boolean;
18
- className?: string;
19
- }
20
-
21
- /**
22
- * MonacoImpl - The heavy implementation that imports Monaco Editor
23
- * This component is lazy-loaded to avoid including Monaco in the initial bundle
24
- */
25
- export default function MonacoImpl({
26
- value = '',
27
- language = 'javascript',
28
- theme = 'vs-dark',
29
- height = '400px',
30
- onChange,
31
- readOnly = false,
32
- className = '',
33
- }: MonacoImplProps) {
34
- return (
35
- <div className={className}>
36
- <Editor
37
- height={height}
38
- language={language}
39
- theme={theme}
40
- value={value}
41
- onChange={onChange}
42
- options={{
43
- readOnly,
44
- minimap: { enabled: false },
45
- fontSize: 14,
46
- lineNumbers: 'on',
47
- scrollBeyondLastLine: false,
48
- automaticLayout: true,
49
- }}
50
- />
51
- </div>
52
- );
53
- }
package/src/index.test.ts DELETED
@@ -1,99 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { describe, it, expect, beforeAll } from 'vitest';
10
- import { ComponentRegistry } from '@object-ui/core';
11
-
12
- describe('Plugin Editor', () => {
13
- // Import all renderers to register them
14
- // Note: Monaco Editor is a heavy library that takes time to load
15
- beforeAll(async () => {
16
- await import('./index');
17
- }, 30000); // 30 second timeout for Monaco Editor initialization
18
-
19
- describe('code-editor component', () => {
20
- it('should be registered in ComponentRegistry', () => {
21
- const editorRenderer = ComponentRegistry.get('code-editor');
22
- expect(editorRenderer).toBeDefined();
23
- });
24
-
25
- it('should have proper metadata', () => {
26
- const config = ComponentRegistry.getConfig('code-editor');
27
- expect(config).toBeDefined();
28
- expect(config?.label).toBe('Code Editor');
29
- expect(config?.category).toBe('plugin');
30
- expect(config?.inputs).toBeDefined();
31
- expect(config?.defaultProps).toBeDefined();
32
- });
33
-
34
- it('should have expected inputs', () => {
35
- const config = ComponentRegistry.getConfig('code-editor');
36
- const inputNames = config?.inputs?.map((input: any) => input.name) || [];
37
-
38
- expect(inputNames).toContain('value');
39
- expect(inputNames).toContain('language');
40
- expect(inputNames).toContain('theme');
41
- expect(inputNames).toContain('height');
42
- expect(inputNames).toContain('readOnly');
43
- });
44
-
45
- it('should have language as enum input', () => {
46
- const config = ComponentRegistry.getConfig('code-editor');
47
- const languageInput = config?.inputs?.find((input: any) => input.name === 'language');
48
-
49
- expect(languageInput).toBeDefined();
50
- expect(languageInput?.type).toBe('enum');
51
- expect(languageInput?.enum).toBeDefined();
52
- expect(Array.isArray(languageInput?.enum)).toBe(true);
53
-
54
- const enumValues = languageInput?.enum || [];
55
- expect(enumValues).toContain('javascript');
56
- expect(enumValues).toContain('typescript');
57
- expect(enumValues).toContain('python');
58
- expect(enumValues).toContain('json');
59
- expect(enumValues).toContain('html');
60
- expect(enumValues).toContain('css');
61
- });
62
-
63
- it('should have theme as enum input', () => {
64
- const config = ComponentRegistry.getConfig('code-editor');
65
- const themeInput = config?.inputs?.find((input: any) => input.name === 'theme');
66
-
67
- expect(themeInput).toBeDefined();
68
- expect(themeInput?.type).toBe('enum');
69
- expect(themeInput?.enum).toBeDefined();
70
- expect(Array.isArray(themeInput?.enum)).toBe(true);
71
-
72
- const enumValues = themeInput?.enum || [];
73
- expect(enumValues).toContain('vs-dark');
74
- expect(enumValues).toContain('light');
75
- });
76
-
77
- it('should have sensible default props', () => {
78
- const config = ComponentRegistry.getConfig('code-editor');
79
- const defaults = config?.defaultProps;
80
-
81
- expect(defaults).toBeDefined();
82
- expect(defaults?.value).toBeDefined();
83
- expect(typeof defaults?.value).toBe('string');
84
- expect(defaults?.language).toBe('javascript');
85
- expect(defaults?.theme).toBe('vs-dark');
86
- expect(defaults?.height).toBe('400px');
87
- expect(defaults?.readOnly).toBe(false);
88
- });
89
-
90
- it('should have readOnly as boolean input', () => {
91
- const config = ComponentRegistry.getConfig('code-editor');
92
- const readOnlyInput = config?.inputs?.find((input: any) => input.name === 'readOnly');
93
-
94
- expect(readOnlyInput).toBeDefined();
95
- expect(readOnlyInput?.type).toBe('boolean');
96
- expect(readOnlyInput?.defaultValue).toBe(false);
97
- });
98
- });
99
- });
package/src/index.tsx DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import React, { Suspense } from 'react';
10
- import { ComponentRegistry } from '@object-ui/core';
11
- import { Skeleton } from '@object-ui/components';
12
-
13
- // Export types for external use
14
- export type { CodeEditorSchema } from './types';
15
-
16
- // 🚀 Lazy load the implementation file
17
- // This ensures Monaco Editor is only loaded when the component is actually rendered
18
- const LazyMonacoEditor = React.lazy(() => import('./MonacoImpl'));
19
-
20
- export interface CodeEditorRendererProps {
21
- schema: {
22
- type: string;
23
- id?: string;
24
- className?: string;
25
- value?: string;
26
- language?: string;
27
- theme?: 'vs-dark' | 'light';
28
- height?: string;
29
- readOnly?: boolean;
30
- onChange?: (value: string | undefined) => void;
31
- };
32
- value?: string;
33
- onChange?: (value: string | undefined) => void;
34
- }
35
-
36
- /**
37
- * CodeEditorRenderer - The public API for the code editor component
38
- * This wrapper handles lazy loading internally using React.Suspense
39
- */
40
- export const CodeEditorRenderer: React.FC<CodeEditorRendererProps> = ({ schema, value, onChange }) => {
41
- return (
42
- <Suspense fallback={<Skeleton className="w-full h-[400px]" />}>
43
- <LazyMonacoEditor
44
- value={value ?? schema.value}
45
- language={schema.language}
46
- theme={schema.theme}
47
- height={schema.height}
48
- onChange={onChange ?? schema.onChange}
49
- readOnly={schema.readOnly}
50
- className={schema.className}
51
- />
52
- </Suspense>
53
- );
54
- };
55
-
56
- // Register the component with the ComponentRegistry
57
- ComponentRegistry.register(
58
- 'code-editor',
59
- CodeEditorRenderer,
60
- {
61
- namespace: 'plugin-editor',
62
- label: 'Code Editor',
63
- category: 'plugin',
64
- inputs: [
65
- { name: 'value', type: 'string', label: 'Code', defaultValue: '' },
66
- { name: 'language', type: 'enum', label: 'Language', enum: ['javascript', 'typescript', 'python', 'json', 'html', 'css'], defaultValue: 'javascript' },
67
- { name: 'theme', type: 'enum', label: 'Theme', enum: ['vs-dark', 'light'], defaultValue: 'vs-dark' },
68
- { name: 'height', type: 'string', label: 'Height', defaultValue: '400px' },
69
- { name: 'readOnly', type: 'boolean', label: 'Read Only', defaultValue: false },
70
- ],
71
- defaultProps: {
72
- value: '// Write your code here\nconsole.log("Hello, World!");',
73
- language: 'javascript',
74
- theme: 'vs-dark',
75
- height: '400px',
76
- readOnly: false,
77
- },
78
- }
79
- );
80
-
81
- // Standard Export Protocol - for manual integration
82
- export const editorComponents = {
83
- 'code-editor': CodeEditorRenderer,
84
- };
package/src/types.ts DELETED
@@ -1,71 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- /**
10
- * TypeScript type definitions for @object-ui/plugin-editor
11
- *
12
- * These types can be imported by applications using this plugin
13
- * to get full TypeScript support for code-editor schemas.
14
- */
15
-
16
- import type { BaseSchema } from '@object-ui/types';
17
-
18
- /**
19
- * Code Editor component schema.
20
- * Renders a Monaco-based code editor with syntax highlighting.
21
- *
22
- * @example
23
- * ```typescript
24
- * import type { CodeEditorSchema } from '@object-ui/plugin-editor';
25
- *
26
- * const editorSchema: CodeEditorSchema = {
27
- * type: 'code-editor',
28
- * value: 'console.log("Hello, World!");',
29
- * language: 'javascript',
30
- * theme: 'vs-dark',
31
- * height: '400px'
32
- * }
33
- * ```
34
- */
35
- export interface CodeEditorSchema extends BaseSchema {
36
- type: 'code-editor';
37
-
38
- /**
39
- * The code content to display in the editor.
40
- */
41
- value?: string;
42
-
43
- /**
44
- * Programming language for syntax highlighting.
45
- * @default 'javascript'
46
- */
47
- language?: 'javascript' | 'typescript' | 'python' | 'json' | 'html' | 'css' | 'markdown' | string;
48
-
49
- /**
50
- * Color theme for the editor.
51
- * @default 'vs-dark'
52
- */
53
- theme?: 'vs-dark' | 'light';
54
-
55
- /**
56
- * Height of the editor.
57
- * @default '400px'
58
- */
59
- height?: string;
60
-
61
- /**
62
- * Whether the editor is read-only.
63
- * @default false
64
- */
65
- readOnly?: boolean;
66
-
67
- /**
68
- * Callback when the code content changes.
69
- */
70
- onChange?: (value: string | undefined) => void;
71
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx",
6
- "baseUrl": ".",
7
- "paths": {
8
- "@/*": ["src/*"]
9
- },
10
- "noImplicitAny": true,
11
- "noEmit": false,
12
- "declaration": true,
13
- "composite": true,
14
- "skipLibCheck": true
15
- },
16
- "include": ["src"]
17
- }
package/vite.config.ts DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { defineConfig } from 'vite';
10
- import react from '@vitejs/plugin-react';
11
- import dts from 'vite-plugin-dts';
12
- import { resolve } from 'path';
13
-
14
- export default defineConfig({
15
- plugins: [
16
- react(),
17
- dts({
18
- insertTypesEntry: true,
19
- compilerOptions: { rootDir: resolve(__dirname, '../..') },
20
- include: ['src'],
21
- }),
22
- ],
23
- resolve: {
24
- alias: {
25
- '@': resolve(__dirname, './src'),
26
- '@object-ui/core': resolve(__dirname, '../core/src'),
27
- '@object-ui/types': resolve(__dirname, '../types/src'),
28
- '@object-ui/react': resolve(__dirname, '../react/src'),
29
- '@object-ui/components': resolve(__dirname, '../components/src'),
30
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
31
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
32
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
33
- },
34
- },
35
- build: {
36
- lib: {
37
- entry: resolve(__dirname, 'src/index.tsx'),
38
- name: 'ObjectUIPluginEditor',
39
- fileName: 'index',
40
- },
41
- rollupOptions: {
42
- external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react'],
43
- output: {
44
- globals: {
45
- react: 'React',
46
- 'react-dom': 'ReactDOM',
47
- '@object-ui/components': 'ObjectUIComponents',
48
- '@object-ui/core': 'ObjectUICore',
49
- '@object-ui/react': 'ObjectUIReact',
50
- },
51
- },
52
- },
53
- },
54
- test: {
55
- globals: true,
56
- environment: 'happy-dom',
57
- setupFiles: ['../../vitest.setup.tsx'],
58
- passWithNoTests: true,
59
- },
60
- });
@@ -1,43 +0,0 @@
1
- // vite.config.ts
2
- import { defineConfig } from "file:///home/runner/work/objectui/objectui/node_modules/.pnpm/vite@5.4.21_@types+node@24.10.8/node_modules/vite/dist/node/index.js";
3
- import react from "file:///home/runner/work/objectui/objectui/node_modules/.pnpm/@vitejs+plugin-react@4.7.0_vite@5.4.21_@types+node@24.10.8_/node_modules/@vitejs/plugin-react/dist/index.js";
4
- import dts from "file:///home/runner/work/objectui/objectui/node_modules/.pnpm/vite-plugin-dts@3.9.1_@types+node@24.10.8_rollup@4.55.1_typescript@5.9.3_vite@5.4.21_@types+node@24.10.8_/node_modules/vite-plugin-dts/dist/index.mjs";
5
- import { resolve } from "path";
6
- var __vite_injected_original_dirname = "/home/runner/work/objectui/objectui/packages/plugin-editor";
7
- var vite_config_default = defineConfig({
8
- plugins: [
9
- react(),
10
- dts({
11
- insertTypesEntry: true,
12
- include: ["src"]
13
- })
14
- ],
15
- resolve: {
16
- alias: {
17
- "@": resolve(__vite_injected_original_dirname, "./src")
18
- }
19
- },
20
- build: {
21
- lib: {
22
- entry: resolve(__vite_injected_original_dirname, "src/index.tsx"),
23
- name: "ObjectUIPluginEditor",
24
- fileName: "index"
25
- },
26
- rollupOptions: {
27
- external: ["react", "react-dom", "@object-ui/components", "@object-ui/core", "@object-ui/react"],
28
- output: {
29
- globals: {
30
- react: "React",
31
- "react-dom": "ReactDOM",
32
- "@object-ui/components": "ObjectUIComponents",
33
- "@object-ui/core": "ObjectUICore",
34
- "@object-ui/react": "ObjectUIReact"
35
- }
36
- }
37
- }
38
- }
39
- });
40
- export {
41
- vite_config_default as default
42
- };
43
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0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