@object-ui/plugin-markdown 3.1.5 → 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.
@@ -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],
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownImpl.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownImpl.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAoC7E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAM9C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAS5D,CAAC;AA2BF,eAAO,MAAM,kBAAkB;;CAE9B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-markdown",
3
- "version": "3.1.5",
3
+ "version": "3.3.1",
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.1.5",
31
- "@object-ui/core": "3.1.5",
32
- "@object-ui/react": "3.1.5",
33
- "@object-ui/types": "3.1.5"
30
+ "@object-ui/components": "3.3.1",
31
+ "@object-ui/core": "3.3.1",
32
+ "@object-ui/react": "3.3.1",
33
+ "@object-ui/types": "3.3.1"
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": "^5.9.3",
44
- "vite": "^8.0.1",
43
+ "typescript": "^6.0.3",
44
+ "vite": "^8.0.9",
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",
@@ -1,28 +0,0 @@
1
-
2
- > @object-ui/plugin-markdown@3.1.5 build /home/runner/work/objectui/objectui/packages/plugin-markdown
3
- > vite build
4
-
5
- vite v8.0.1 building client environment for production...
6
- 
7
- rendering chunks...
8
- 
9
- [vite:dts] Start generate declaration files...
10
- [vite:dts] Declaration files built in 20668ms.
11
- 
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-zSR34qzi.js 225.98 kB │ gzip: 55.48 kB
16
-
17
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
18
- - vite:dts (86%)
19
- - vite:css-post (6%)
20
- - vite:worker (5%)
21
- See https://rolldown.rs/options/checks#plugintimings for more details.
22
- 
23
- 
24
- rendering chunks...
25
- computing gzip size...
26
- dist/index.umd.cjs 172.79 kB │ gzip: 53.09 kB
27
-
28
- ✓ built in 23.63s
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownImpl.d.ts","sourceRoot":"","sources":["../../src/MarkdownImpl.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAoC7E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAM9C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAS5D,CAAC;AA2BF,eAAO,MAAM,kBAAkB;;CAE9B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -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,59 +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
- include: ['src'],
20
- }),
21
- ],
22
- resolve: {
23
- alias: {
24
- '@': resolve(__dirname, './src'),
25
- '@object-ui/core': resolve(__dirname, '../core/src'),
26
- '@object-ui/types': resolve(__dirname, '../types/src'),
27
- '@object-ui/react': resolve(__dirname, '../react/src'),
28
- '@object-ui/components': resolve(__dirname, '../components/src'),
29
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
30
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
31
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
32
- },
33
- },
34
- build: {
35
- lib: {
36
- entry: resolve(__dirname, 'src/index.tsx'),
37
- name: 'ObjectUIPluginMarkdown',
38
- fileName: 'index',
39
- },
40
- rollupOptions: {
41
- external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react'],
42
- output: {
43
- globals: {
44
- react: 'React',
45
- 'react-dom': 'ReactDOM',
46
- '@object-ui/components': 'ObjectUIComponents',
47
- '@object-ui/core': 'ObjectUICore',
48
- '@object-ui/react': 'ObjectUIReact',
49
- },
50
- },
51
- },
52
- },
53
- test: {
54
- globals: true,
55
- environment: 'happy-dom',
56
- setupFiles: ['../../vitest.setup.tsx'],
57
- passWithNoTests: true,
58
- },
59
- });