@object-ui/plugin-markdown 3.3.0 → 3.3.2
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 +19 -0
- package/README.md +24 -0
- package/dist/{MarkdownImpl-BcKLng98.js → MarkdownImpl-C8BDvVj9.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +1 -1
- package/dist/{jsx-runtime-B1W8iDPg.js → jsx-runtime-DW-7Xb_Z.js} +1 -1
- package/package.json +32 -9
- package/.turbo/turbo-build.log +0 -24
- package/src/MarkdownImpl.tsx +0 -72
- package/src/index.test.ts +0 -63
- package/src/index.tsx +0 -71
- package/src/types.ts +0 -36
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @object-ui/plugin-markdown
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @object-ui/types@3.3.2
|
|
8
|
+
- @object-ui/core@3.3.2
|
|
9
|
+
- @object-ui/react@3.3.2
|
|
10
|
+
- @object-ui/components@3.3.2
|
|
11
|
+
|
|
12
|
+
## 3.3.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [b429568]
|
|
17
|
+
- @object-ui/components@3.3.1
|
|
18
|
+
- @object-ui/types@3.3.1
|
|
19
|
+
- @object-ui/core@3.3.1
|
|
20
|
+
- @object-ui/react@3.3.1
|
|
21
|
+
|
|
3
22
|
## 3.3.0
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -109,3 +109,27 @@ pnpm build
|
|
|
109
109
|
|
|
110
110
|
# The package will generate proper ESM and UMD builds with lazy loading preserved
|
|
111
111
|
```
|
|
112
|
+
|
|
113
|
+
<!-- release-metadata:v3.3.0 -->
|
|
114
|
+
|
|
115
|
+
## Compatibility
|
|
116
|
+
|
|
117
|
+
- **React:** 18.x or 19.x
|
|
118
|
+
- **Node.js:** ≥ 18
|
|
119
|
+
- **TypeScript:** ≥ 5.0 (strict mode)
|
|
120
|
+
- **`@objectstack/spec`:** ^3.3.0
|
|
121
|
+
- **`@objectstack/client`:** ^3.3.0
|
|
122
|
+
- **Tailwind CSS:** ≥ 3.4 (for packages with UI)
|
|
123
|
+
|
|
124
|
+
## Links
|
|
125
|
+
|
|
126
|
+
- 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-markdown)
|
|
127
|
+
- 📦 [npm package](https://www.npmjs.com/package/@object-ui/plugin-markdown)
|
|
128
|
+
- 📝 [Changelog](./CHANGELOG.md)
|
|
129
|
+
- 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
|
|
130
|
+
- 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
|
|
131
|
+
- 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./jsx-runtime-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./jsx-runtime-DW-7Xb_Z.js";
|
|
2
2
|
import "react";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region ../../node_modules/.pnpm/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as e } from "./jsx-runtime-
|
|
1
|
+
import { t as e } from "./jsx-runtime-DW-7Xb_Z.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("./MarkdownImpl-
|
|
6
|
+
var a = e(), o = t.lazy(() => import("./MarkdownImpl-C8BDvVj9.js")), s = ({ schema: e }) => /* @__PURE__ */ (0, a.jsx)(n, {
|
|
7
7
|
fallback: /* @__PURE__ */ (0, a.jsx)(i, { className: "w-full h-[200px]" }),
|
|
8
8
|
children: /* @__PURE__ */ (0, a.jsx)(o, {
|
|
9
9
|
content: e.content || "",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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.ObjectUIPluginMarkdown={},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},m=(e,t,n)=>(n=e==null?{}:i(c(e)),p(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e));t=m(t,1);var h=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})),g=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===D?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 ee: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=O.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(te.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(){A||(A=!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 re[e]||(re[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(ne(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(te.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}`,ae[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.ObjectUIPluginMarkdown={},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},m=(e,t,n)=>(n=e==null?{}:i(c(e)),p(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e));t=m(t,1);var h=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})),g=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===D?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 ee: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=O.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(te.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(){A||(A=!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 re[e]||(re[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(ne(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(te.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}`,ae[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 = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), s = (e, n) => {
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
3
3
|
let r = {};
|
|
4
4
|
for (var i in e) t(r, i, {
|
|
5
5
|
get: e[i],
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-markdown",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Markdown rendering plugin for Object UI, powered by react-markdown",
|
|
7
|
-
"homepage": "https://www.objectui.org",
|
|
7
|
+
"homepage": "https://www.objectui.org/docs/plugins/plugin-markdown",
|
|
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-markdown"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"react-markdown": "^10.1.0",
|
|
28
28
|
"rehype-sanitize": "^6.0.0",
|
|
29
29
|
"remark-gfm": "^4.0.1",
|
|
30
|
-
"@object-ui/components": "3.3.
|
|
31
|
-
"@object-ui/core": "3.3.
|
|
32
|
-
"@object-ui/react": "3.3.
|
|
33
|
-
"@object-ui/types": "3.3.
|
|
30
|
+
"@object-ui/components": "3.3.2",
|
|
31
|
+
"@object-ui/core": "3.3.2",
|
|
32
|
+
"@object-ui/react": "3.3.2",
|
|
33
|
+
"@object-ui/types": "3.3.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -40,10 +40,33 @@
|
|
|
40
40
|
"@types/react": "19.2.14",
|
|
41
41
|
"@types/react-dom": "19.2.3",
|
|
42
42
|
"@vitejs/plugin-react": "^6.0.1",
|
|
43
|
-
"typescript": "^6.0.
|
|
44
|
-
"vite": "^8.0.
|
|
43
|
+
"typescript": "^6.0.3",
|
|
44
|
+
"vite": "^8.0.10",
|
|
45
45
|
"vite-plugin-dts": "^4.5.4"
|
|
46
46
|
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"objectui",
|
|
49
|
+
"sdui",
|
|
50
|
+
"schema-driven-ui",
|
|
51
|
+
"react",
|
|
52
|
+
"tailwind",
|
|
53
|
+
"shadcn",
|
|
54
|
+
"objectstack",
|
|
55
|
+
"plugin",
|
|
56
|
+
"markdown",
|
|
57
|
+
"react-markdown",
|
|
58
|
+
"gfm"
|
|
59
|
+
],
|
|
60
|
+
"author": "ObjectStack Team <team@objectstack.ai>",
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"dist",
|
|
66
|
+
"README.md",
|
|
67
|
+
"CHANGELOG.md",
|
|
68
|
+
"LICENSE"
|
|
69
|
+
],
|
|
47
70
|
"scripts": {
|
|
48
71
|
"build": "vite build",
|
|
49
72
|
"test": "vitest run",
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @object-ui/plugin-markdown@3.3.0 build /home/runner/work/objectui/objectui/packages/plugin-markdown
|
|
3
|
-
> vite build
|
|
4
|
-
|
|
5
|
-
[36mvite v8.0.8 [32mbuilding client environment for production...[36m[39m
|
|
6
|
-
[2K
|
|
7
|
-
rendering chunks...
|
|
8
|
-
[32m
|
|
9
|
-
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
10
|
-
[32m[36m[vite:dts][32m Declaration files built in 20198ms.
|
|
11
|
-
[39m
|
|
12
|
-
computing gzip size...
|
|
13
|
-
dist/index.js 1.06 kB │ gzip: 0.58 kB
|
|
14
|
-
dist/jsx-runtime-B1W8iDPg.js 8.59 kB │ gzip: 3.13 kB
|
|
15
|
-
dist/MarkdownImpl-BcKLng98.js 225.97 kB │ gzip: 55.48 kB
|
|
16
|
-
|
|
17
|
-
[33m[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `vite:dts`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
18
|
-
[39m
|
|
19
|
-
[2K
|
|
20
|
-
rendering chunks...
|
|
21
|
-
computing gzip size...
|
|
22
|
-
dist/index.umd.cjs 172.89 kB │ gzip: 53.13 kB
|
|
23
|
-
|
|
24
|
-
[32m✓ built in 23.70s[39m
|
package/src/MarkdownImpl.tsx
DELETED
|
@@ -1,72 +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 * as React from "react"
|
|
10
|
-
import ReactMarkdown from "react-markdown"
|
|
11
|
-
import remarkGfm from "remark-gfm"
|
|
12
|
-
import rehypeSanitize from "rehype-sanitize"
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Props for the Markdown component implementation.
|
|
16
|
-
*
|
|
17
|
-
* This component renders markdown content using react-markdown with GitHub Flavored Markdown support.
|
|
18
|
-
* All content is sanitized to prevent XSS attacks.
|
|
19
|
-
*/
|
|
20
|
-
export interface MarkdownImplProps {
|
|
21
|
-
/**
|
|
22
|
-
* The markdown content to render.
|
|
23
|
-
*/
|
|
24
|
-
content: string
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Optional CSS class name to apply custom styling to the markdown container.
|
|
28
|
-
*/
|
|
29
|
-
className?: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal Markdown implementation component.
|
|
34
|
-
* This contains the actual react-markdown import (heavy ~100-200 KB).
|
|
35
|
-
*/
|
|
36
|
-
export default function MarkdownImpl({ content, className }: MarkdownImplProps) {
|
|
37
|
-
// Utility function to merge class names (inline to avoid external dependency)
|
|
38
|
-
const cn = (...classes: (string | undefined)[]) => classes.filter(Boolean).join(' ')
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
data-slot="markdown"
|
|
43
|
-
className={cn(
|
|
44
|
-
"prose prose-sm dark:prose-invert max-w-none",
|
|
45
|
-
"prose-headings:font-semibold prose-headings:tracking-tight",
|
|
46
|
-
"prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
|
|
47
|
-
"prose-p:leading-relaxed prose-p:text-foreground",
|
|
48
|
-
"prose-a:text-primary prose-a:no-underline hover:prose-a:underline",
|
|
49
|
-
"prose-code:text-foreground prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none",
|
|
50
|
-
"prose-pre:bg-muted prose-pre:text-foreground prose-pre:border",
|
|
51
|
-
"prose-blockquote:border-l-primary prose-blockquote:text-muted-foreground",
|
|
52
|
-
"prose-strong:text-foreground prose-strong:font-semibold",
|
|
53
|
-
"prose-ul:list-disc prose-ol:list-decimal",
|
|
54
|
-
"prose-li:text-foreground prose-li:marker:text-muted-foreground",
|
|
55
|
-
"prose-table:border prose-th:border prose-th:bg-muted prose-td:border",
|
|
56
|
-
"prose-img:rounded-md prose-img:border",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
>
|
|
60
|
-
<ReactMarkdown
|
|
61
|
-
remarkPlugins={[remarkGfm]}
|
|
62
|
-
rehypePlugins={[rehypeSanitize]}
|
|
63
|
-
// Additional security: only allow safe elements
|
|
64
|
-
// This provides defense-in-depth beyond rehype-sanitize
|
|
65
|
-
disallowedElements={['script', 'style', 'iframe', 'object', 'embed']}
|
|
66
|
-
unwrapDisallowed={true}
|
|
67
|
-
>
|
|
68
|
-
{content}
|
|
69
|
-
</ReactMarkdown>
|
|
70
|
-
</div>
|
|
71
|
-
)
|
|
72
|
-
}
|
package/src/index.test.ts
DELETED
|
@@ -1,63 +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 Markdown', () => {
|
|
13
|
-
// Import all renderers to register them
|
|
14
|
-
beforeAll(async () => {
|
|
15
|
-
await import('./index');
|
|
16
|
-
}, 15000); // Increase timeout to 15 seconds for async import
|
|
17
|
-
|
|
18
|
-
describe('markdown component', () => {
|
|
19
|
-
it('should be registered in ComponentRegistry', () => {
|
|
20
|
-
const markdownRenderer = ComponentRegistry.get('markdown');
|
|
21
|
-
expect(markdownRenderer).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should have proper metadata', () => {
|
|
25
|
-
const config = ComponentRegistry.getConfig('markdown');
|
|
26
|
-
expect(config).toBeDefined();
|
|
27
|
-
expect(config?.label).toBe('Markdown');
|
|
28
|
-
expect(config?.category).toBe('plugin');
|
|
29
|
-
expect(config?.inputs).toBeDefined();
|
|
30
|
-
expect(config?.defaultProps).toBeDefined();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should have expected inputs', () => {
|
|
34
|
-
const config = ComponentRegistry.getConfig('markdown');
|
|
35
|
-
const inputNames = config?.inputs?.map((input: any) => input.name) || [];
|
|
36
|
-
|
|
37
|
-
expect(inputNames).toContain('content');
|
|
38
|
-
expect(inputNames).toContain('className');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should have content as required input', () => {
|
|
42
|
-
const config = ComponentRegistry.getConfig('markdown');
|
|
43
|
-
const contentInput = config?.inputs?.find((input: any) => input.name === 'content');
|
|
44
|
-
|
|
45
|
-
expect(contentInput).toBeDefined();
|
|
46
|
-
expect(contentInput?.required).toBe(true);
|
|
47
|
-
expect(contentInput?.type).toBe('string');
|
|
48
|
-
expect(contentInput?.inputType).toBe('textarea');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should have sensible default props', () => {
|
|
52
|
-
const config = ComponentRegistry.getConfig('markdown');
|
|
53
|
-
const defaults = config?.defaultProps;
|
|
54
|
-
|
|
55
|
-
expect(defaults).toBeDefined();
|
|
56
|
-
expect(defaults?.content).toBeDefined();
|
|
57
|
-
expect(typeof defaults?.content).toBe('string');
|
|
58
|
-
expect(defaults?.content.length).toBeGreaterThan(0);
|
|
59
|
-
// Verify it contains markdown syntax
|
|
60
|
-
expect(defaults?.content).toContain('#');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
package/src/index.tsx
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
|
-
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 { MarkdownSchema } from './types';
|
|
15
|
-
|
|
16
|
-
// 🚀 Lazy load the implementation file
|
|
17
|
-
// This ensures react-markdown is only loaded when the component is actually rendered
|
|
18
|
-
const LazyMarkdown = React.lazy(() => import('./MarkdownImpl'));
|
|
19
|
-
|
|
20
|
-
export interface MarkdownRendererProps {
|
|
21
|
-
schema: {
|
|
22
|
-
type: string;
|
|
23
|
-
id?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
content?: string;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* MarkdownRenderer - The public API for the markdown component
|
|
31
|
-
* This wrapper handles lazy loading internally using React.Suspense
|
|
32
|
-
*/
|
|
33
|
-
export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ schema }) => {
|
|
34
|
-
return (
|
|
35
|
-
<Suspense fallback={<Skeleton className="w-full h-[200px]" />}>
|
|
36
|
-
<LazyMarkdown
|
|
37
|
-
content={schema.content || ''}
|
|
38
|
-
className={schema.className}
|
|
39
|
-
/>
|
|
40
|
-
</Suspense>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Register the component with the ComponentRegistry
|
|
45
|
-
ComponentRegistry.register(
|
|
46
|
-
'markdown',
|
|
47
|
-
MarkdownRenderer,
|
|
48
|
-
{
|
|
49
|
-
namespace: 'plugin-markdown',
|
|
50
|
-
label: 'Markdown',
|
|
51
|
-
category: 'plugin',
|
|
52
|
-
inputs: [
|
|
53
|
-
{
|
|
54
|
-
name: 'content',
|
|
55
|
-
type: 'string',
|
|
56
|
-
label: 'Markdown Content',
|
|
57
|
-
required: true,
|
|
58
|
-
inputType: 'textarea'
|
|
59
|
-
},
|
|
60
|
-
{ name: 'className', type: 'string', label: 'CSS Class' }
|
|
61
|
-
],
|
|
62
|
-
defaultProps: {
|
|
63
|
-
content: '# Hello World\n\nThis is a **markdown** component with *formatting* support.\n\n- Item 1\n- Item 2\n- Item 3',
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
// Standard Export Protocol - for manual integration
|
|
69
|
-
export const markdownComponents = {
|
|
70
|
-
'markdown': MarkdownRenderer,
|
|
71
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,36 +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 type { BaseSchema } from '@object-ui/types';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Markdown component schema.
|
|
13
|
-
* Renders markdown content with GitHub Flavored Markdown support.
|
|
14
|
-
*/
|
|
15
|
-
export interface MarkdownSchema extends BaseSchema {
|
|
16
|
-
type: 'markdown';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The markdown content to render. Supports GitHub Flavored Markdown including:
|
|
20
|
-
* - Headers (H1-H6)
|
|
21
|
-
* - Bold, italic, and inline code
|
|
22
|
-
* - Links and images
|
|
23
|
-
* - Lists (ordered, unordered, and nested)
|
|
24
|
-
* - Tables
|
|
25
|
-
* - Blockquotes
|
|
26
|
-
* - Code blocks
|
|
27
|
-
* - Strikethrough
|
|
28
|
-
* - Task lists
|
|
29
|
-
*/
|
|
30
|
-
content?: string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Optional CSS class name to apply custom styling to the markdown container.
|
|
34
|
-
*/
|
|
35
|
-
className?: string;
|
|
36
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"baseUrl": ".",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@/*": ["src/*"]
|
|
9
|
-
},
|
|
10
|
-
// Removed rootDir to prevent file not under rootDir errors when importing from workspace dependencies
|
|
11
|
-
"noEmit": false,
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"composite": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"skipLibCheck": true
|
|
16
|
-
},
|
|
17
|
-
"include": ["src"],
|
|
18
|
-
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
|
|
19
|
-
}
|
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: 'ObjectUIPluginMarkdown',
|
|
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
|
-
});
|