@object-ui/plugin-markdown 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-markdown
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,111 @@
1
+ # Plugin Markdown - Lazy-Loaded Markdown Renderer
2
+
3
+ A lazy-loaded markdown component for Object UI based on react-markdown with GitHub Flavored Markdown support.
4
+
5
+ ## Features
6
+
7
+ - **Internal Lazy Loading**: react-markdown is loaded on-demand using `React.lazy()` and `Suspense`
8
+ - **Zero Configuration**: Just import the package and use `type: 'markdown'` in your schema
9
+ - **Automatic Registration**: Components auto-register with the ComponentRegistry
10
+ - **Skeleton Loading**: Shows a skeleton while react-markdown loads
11
+ - **XSS Protection**: All content is sanitized via rehype-sanitize
12
+ - **GitHub Flavored Markdown**: Full support for tables, strikethrough, task lists, etc.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add @object-ui/plugin-markdown
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Automatic Registration (Side-Effect Import)
23
+
24
+ ```typescript
25
+ // In your app entry point (e.g., App.tsx or main.tsx)
26
+ import '@object-ui/plugin-markdown';
27
+
28
+ // Now you can use markdown type in your schemas
29
+ const schema = {
30
+ type: 'markdown',
31
+ content: '# Hello World\n\nThis is **markdown** text.'
32
+ };
33
+ ```
34
+
35
+ ### Manual Integration
36
+
37
+ ```typescript
38
+ import { markdownComponents } from '@object-ui/plugin-markdown';
39
+ import { ComponentRegistry } from '@object-ui/core';
40
+
41
+ // Manually register if needed
42
+ Object.entries(markdownComponents).forEach(([type, component]) => {
43
+ ComponentRegistry.register(type, component);
44
+ });
45
+ ```
46
+
47
+ ### TypeScript Support
48
+
49
+ The plugin exports TypeScript types for full type safety:
50
+
51
+ ```typescript
52
+ import type { MarkdownSchema } from '@object-ui/plugin-markdown';
53
+
54
+ const schema: MarkdownSchema = {
55
+ type: 'markdown',
56
+ content: '# Hello World\n\nThis is **markdown** text.'
57
+ };
58
+ ```
59
+
60
+ ## Schema API
61
+
62
+ ```typescript
63
+ {
64
+ type: 'markdown',
65
+ content?: string, // Markdown content (supports GitHub Flavored Markdown)
66
+ className?: string // Tailwind classes
67
+ }
68
+ ```
69
+
70
+ ## Supported Markdown Features
71
+
72
+ - Headers (H1-H6)
73
+ - Bold, italic, and inline code
74
+ - Links and images
75
+ - Lists (ordered, unordered, and nested)
76
+ - Tables
77
+ - Blockquotes
78
+ - Code blocks with syntax highlighting
79
+ - Strikethrough
80
+ - Task lists
81
+ - Autolinks
82
+
83
+ ## Lazy Loading Architecture
84
+
85
+ The plugin uses a two-file pattern for optimal code splitting:
86
+
87
+ 1. **`MarkdownImpl.tsx`**: Contains the actual react-markdown import (heavy ~100-200 KB)
88
+ 2. **`index.tsx`**: Entry point with `React.lazy()` wrapper (light)
89
+
90
+ When bundled, Vite automatically creates separate chunks:
91
+ - `index.js` (~200 bytes) - The entry point
92
+ - `MarkdownImpl-xxx.js` (~100-200 KB) - The lazy-loaded implementation
93
+
94
+ The react-markdown library is only downloaded when a `markdown` component is actually rendered, not on initial page load.
95
+
96
+ ## Bundle Size Impact
97
+
98
+ By using lazy loading, the main application bundle stays lean:
99
+ - Without lazy loading: +100-200 KB on initial load
100
+ - With lazy loading: +0.19 KB on initial load, +100-200 KB only when markdown is rendered
101
+
102
+ This results in significantly faster initial page loads for applications that don't use markdown on every page.
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ # Build the plugin
108
+ pnpm build
109
+
110
+ # The package will generate proper ESM and UMD builds with lazy loading preserved
111
+ ```