@eigenpal/docx-js-editor 0.0.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/LICENSE +21 -0
- package/README.md +191 -0
- package/dist/colorResolver-C-tITrbI.d.cts +1037 -0
- package/dist/colorResolver-Yakhydrt.d.ts +1037 -0
- package/dist/core-plugins.cjs +7131 -0
- package/dist/core-plugins.cjs.map +1 -0
- package/dist/core-plugins.d.cts +27 -0
- package/dist/core-plugins.d.ts +27 -0
- package/dist/core-plugins.js +7102 -0
- package/dist/core-plugins.js.map +1 -0
- package/dist/headless.cjs +10984 -0
- package/dist/headless.cjs.map +1 -0
- package/dist/headless.d.cts +361 -0
- package/dist/headless.d.ts +361 -0
- package/dist/headless.js +10852 -0
- package/dist/headless.js.map +1 -0
- package/dist/index.cjs +45026 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +369 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +4579 -0
- package/dist/index.d.ts +4579 -0
- package/dist/index.js +44701 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-cli.js +9657 -0
- package/dist/mcp-cli.js.map +1 -0
- package/dist/mcp.cjs +8715 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.d.cts +155 -0
- package/dist/mcp.d.ts +155 -0
- package/dist/mcp.js +8667 -0
- package/dist/mcp.js.map +1 -0
- package/dist/registry-D3zhko7n.d.ts +165 -0
- package/dist/registry-DeeU0bQB.d.cts +165 -0
- package/dist/styles.css +1 -0
- package/dist/types-BJXChtaM.d.cts +2216 -0
- package/dist/types-BJXChtaM.d.ts +2216 -0
- package/package.json +132 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { C as CorePlugin, P as PluginOptions, a as PluginRegistrationResult, b as CommandHandler, M as McpToolDefinition, c as PluginEventListener } from './types-BJXChtaM.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Registry
|
|
5
|
+
*
|
|
6
|
+
* Central registry for core plugins. Manages plugin lifecycle,
|
|
7
|
+
* collects command handlers from all plugins, and aggregates
|
|
8
|
+
* MCP tool definitions for the MCP server.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Plugin Registry - manages core plugins
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
|
|
17
|
+
*
|
|
18
|
+
* // Register plugins
|
|
19
|
+
* pluginRegistry.register(docxtemplaterPlugin);
|
|
20
|
+
*
|
|
21
|
+
* // Get all MCP tools for MCP server
|
|
22
|
+
* const tools = pluginRegistry.getMcpTools();
|
|
23
|
+
*
|
|
24
|
+
* // Get command handler for executor
|
|
25
|
+
* const handler = pluginRegistry.getCommandHandler('insertTemplateVariable');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare class PluginRegistry {
|
|
29
|
+
private plugins;
|
|
30
|
+
private commandHandlers;
|
|
31
|
+
private eventListeners;
|
|
32
|
+
private initialized;
|
|
33
|
+
/**
|
|
34
|
+
* Register a plugin
|
|
35
|
+
*
|
|
36
|
+
* @param plugin - The plugin to register
|
|
37
|
+
* @param options - Optional configuration
|
|
38
|
+
* @returns Registration result
|
|
39
|
+
*/
|
|
40
|
+
register(plugin: CorePlugin, options?: PluginOptions): PluginRegistrationResult;
|
|
41
|
+
/**
|
|
42
|
+
* Unregister a plugin
|
|
43
|
+
*
|
|
44
|
+
* @param pluginId - ID of the plugin to unregister
|
|
45
|
+
* @returns Whether unregistration succeeded
|
|
46
|
+
*/
|
|
47
|
+
unregister(pluginId: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a registered plugin by ID
|
|
50
|
+
*
|
|
51
|
+
* @param id - Plugin ID
|
|
52
|
+
* @returns The plugin or undefined
|
|
53
|
+
*/
|
|
54
|
+
get(id: string): CorePlugin | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Get all registered plugins
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of all plugins
|
|
59
|
+
*/
|
|
60
|
+
getAll(): CorePlugin[];
|
|
61
|
+
/**
|
|
62
|
+
* Check if a plugin is registered
|
|
63
|
+
*
|
|
64
|
+
* @param id - Plugin ID
|
|
65
|
+
* @returns Whether the plugin is registered
|
|
66
|
+
*/
|
|
67
|
+
has(id: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get number of registered plugins
|
|
70
|
+
*/
|
|
71
|
+
get size(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Get a command handler for a command type
|
|
74
|
+
*
|
|
75
|
+
* @param commandType - The command type
|
|
76
|
+
* @returns The handler or undefined
|
|
77
|
+
*/
|
|
78
|
+
getCommandHandler(commandType: string): CommandHandler | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all registered command types
|
|
81
|
+
*
|
|
82
|
+
* @returns Array of command type strings
|
|
83
|
+
*/
|
|
84
|
+
getCommandTypes(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Check if a command type has a handler
|
|
87
|
+
*
|
|
88
|
+
* @param commandType - The command type
|
|
89
|
+
* @returns Whether a handler exists
|
|
90
|
+
*/
|
|
91
|
+
hasCommandHandler(commandType: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get all MCP tools from all registered plugins
|
|
94
|
+
*
|
|
95
|
+
* @returns Array of MCP tool definitions
|
|
96
|
+
*/
|
|
97
|
+
getMcpTools(): McpToolDefinition[];
|
|
98
|
+
/**
|
|
99
|
+
* Get MCP tools from a specific plugin
|
|
100
|
+
*
|
|
101
|
+
* @param pluginId - Plugin ID
|
|
102
|
+
* @returns Array of MCP tool definitions
|
|
103
|
+
*/
|
|
104
|
+
getMcpToolsForPlugin(pluginId: string): McpToolDefinition[];
|
|
105
|
+
/**
|
|
106
|
+
* Get an MCP tool by name
|
|
107
|
+
*
|
|
108
|
+
* @param toolName - Tool name
|
|
109
|
+
* @returns The tool definition or undefined
|
|
110
|
+
*/
|
|
111
|
+
getMcpTool(toolName: string): McpToolDefinition | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Add an event listener
|
|
114
|
+
*
|
|
115
|
+
* @param listener - Event listener function
|
|
116
|
+
*/
|
|
117
|
+
addEventListener(listener: PluginEventListener): void;
|
|
118
|
+
/**
|
|
119
|
+
* Remove an event listener
|
|
120
|
+
*
|
|
121
|
+
* @param listener - Event listener function
|
|
122
|
+
*/
|
|
123
|
+
removeEventListener(listener: PluginEventListener): void;
|
|
124
|
+
/**
|
|
125
|
+
* Emit an event to all listeners
|
|
126
|
+
*/
|
|
127
|
+
private emit;
|
|
128
|
+
/**
|
|
129
|
+
* Clear all registered plugins
|
|
130
|
+
*
|
|
131
|
+
* Useful for testing or resetting state.
|
|
132
|
+
*/
|
|
133
|
+
clear(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get registry state for debugging
|
|
136
|
+
*/
|
|
137
|
+
getDebugInfo(): {
|
|
138
|
+
plugins: string[];
|
|
139
|
+
commandTypes: string[];
|
|
140
|
+
mcpTools: string[];
|
|
141
|
+
initialized: string[];
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Global plugin registry instance
|
|
146
|
+
*
|
|
147
|
+
* Use this for registering plugins and accessing their capabilities.
|
|
148
|
+
*/
|
|
149
|
+
declare const pluginRegistry: PluginRegistry;
|
|
150
|
+
/**
|
|
151
|
+
* Register multiple plugins at once
|
|
152
|
+
*
|
|
153
|
+
* @param plugins - Array of plugins to register
|
|
154
|
+
* @returns Array of registration results
|
|
155
|
+
*/
|
|
156
|
+
declare function registerPlugins(plugins: CorePlugin[], options?: PluginOptions): PluginRegistrationResult[];
|
|
157
|
+
/**
|
|
158
|
+
* Create a plugin registration helper with options pre-configured
|
|
159
|
+
*
|
|
160
|
+
* @param options - Default options for plugin registration
|
|
161
|
+
* @returns Registration function
|
|
162
|
+
*/
|
|
163
|
+
declare function createPluginRegistrar(options: PluginOptions): (plugin: CorePlugin) => PluginRegistrationResult;
|
|
164
|
+
|
|
165
|
+
export { PluginRegistry as P, createPluginRegistrar as c, pluginRegistry as p, registerPlugins as r };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { C as CorePlugin, P as PluginOptions, a as PluginRegistrationResult, b as CommandHandler, M as McpToolDefinition, c as PluginEventListener } from './types-BJXChtaM.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Registry
|
|
5
|
+
*
|
|
6
|
+
* Central registry for core plugins. Manages plugin lifecycle,
|
|
7
|
+
* collects command handlers from all plugins, and aggregates
|
|
8
|
+
* MCP tool definitions for the MCP server.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Plugin Registry - manages core plugins
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
|
|
17
|
+
*
|
|
18
|
+
* // Register plugins
|
|
19
|
+
* pluginRegistry.register(docxtemplaterPlugin);
|
|
20
|
+
*
|
|
21
|
+
* // Get all MCP tools for MCP server
|
|
22
|
+
* const tools = pluginRegistry.getMcpTools();
|
|
23
|
+
*
|
|
24
|
+
* // Get command handler for executor
|
|
25
|
+
* const handler = pluginRegistry.getCommandHandler('insertTemplateVariable');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare class PluginRegistry {
|
|
29
|
+
private plugins;
|
|
30
|
+
private commandHandlers;
|
|
31
|
+
private eventListeners;
|
|
32
|
+
private initialized;
|
|
33
|
+
/**
|
|
34
|
+
* Register a plugin
|
|
35
|
+
*
|
|
36
|
+
* @param plugin - The plugin to register
|
|
37
|
+
* @param options - Optional configuration
|
|
38
|
+
* @returns Registration result
|
|
39
|
+
*/
|
|
40
|
+
register(plugin: CorePlugin, options?: PluginOptions): PluginRegistrationResult;
|
|
41
|
+
/**
|
|
42
|
+
* Unregister a plugin
|
|
43
|
+
*
|
|
44
|
+
* @param pluginId - ID of the plugin to unregister
|
|
45
|
+
* @returns Whether unregistration succeeded
|
|
46
|
+
*/
|
|
47
|
+
unregister(pluginId: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a registered plugin by ID
|
|
50
|
+
*
|
|
51
|
+
* @param id - Plugin ID
|
|
52
|
+
* @returns The plugin or undefined
|
|
53
|
+
*/
|
|
54
|
+
get(id: string): CorePlugin | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Get all registered plugins
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of all plugins
|
|
59
|
+
*/
|
|
60
|
+
getAll(): CorePlugin[];
|
|
61
|
+
/**
|
|
62
|
+
* Check if a plugin is registered
|
|
63
|
+
*
|
|
64
|
+
* @param id - Plugin ID
|
|
65
|
+
* @returns Whether the plugin is registered
|
|
66
|
+
*/
|
|
67
|
+
has(id: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get number of registered plugins
|
|
70
|
+
*/
|
|
71
|
+
get size(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Get a command handler for a command type
|
|
74
|
+
*
|
|
75
|
+
* @param commandType - The command type
|
|
76
|
+
* @returns The handler or undefined
|
|
77
|
+
*/
|
|
78
|
+
getCommandHandler(commandType: string): CommandHandler | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all registered command types
|
|
81
|
+
*
|
|
82
|
+
* @returns Array of command type strings
|
|
83
|
+
*/
|
|
84
|
+
getCommandTypes(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Check if a command type has a handler
|
|
87
|
+
*
|
|
88
|
+
* @param commandType - The command type
|
|
89
|
+
* @returns Whether a handler exists
|
|
90
|
+
*/
|
|
91
|
+
hasCommandHandler(commandType: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get all MCP tools from all registered plugins
|
|
94
|
+
*
|
|
95
|
+
* @returns Array of MCP tool definitions
|
|
96
|
+
*/
|
|
97
|
+
getMcpTools(): McpToolDefinition[];
|
|
98
|
+
/**
|
|
99
|
+
* Get MCP tools from a specific plugin
|
|
100
|
+
*
|
|
101
|
+
* @param pluginId - Plugin ID
|
|
102
|
+
* @returns Array of MCP tool definitions
|
|
103
|
+
*/
|
|
104
|
+
getMcpToolsForPlugin(pluginId: string): McpToolDefinition[];
|
|
105
|
+
/**
|
|
106
|
+
* Get an MCP tool by name
|
|
107
|
+
*
|
|
108
|
+
* @param toolName - Tool name
|
|
109
|
+
* @returns The tool definition or undefined
|
|
110
|
+
*/
|
|
111
|
+
getMcpTool(toolName: string): McpToolDefinition | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Add an event listener
|
|
114
|
+
*
|
|
115
|
+
* @param listener - Event listener function
|
|
116
|
+
*/
|
|
117
|
+
addEventListener(listener: PluginEventListener): void;
|
|
118
|
+
/**
|
|
119
|
+
* Remove an event listener
|
|
120
|
+
*
|
|
121
|
+
* @param listener - Event listener function
|
|
122
|
+
*/
|
|
123
|
+
removeEventListener(listener: PluginEventListener): void;
|
|
124
|
+
/**
|
|
125
|
+
* Emit an event to all listeners
|
|
126
|
+
*/
|
|
127
|
+
private emit;
|
|
128
|
+
/**
|
|
129
|
+
* Clear all registered plugins
|
|
130
|
+
*
|
|
131
|
+
* Useful for testing or resetting state.
|
|
132
|
+
*/
|
|
133
|
+
clear(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get registry state for debugging
|
|
136
|
+
*/
|
|
137
|
+
getDebugInfo(): {
|
|
138
|
+
plugins: string[];
|
|
139
|
+
commandTypes: string[];
|
|
140
|
+
mcpTools: string[];
|
|
141
|
+
initialized: string[];
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Global plugin registry instance
|
|
146
|
+
*
|
|
147
|
+
* Use this for registering plugins and accessing their capabilities.
|
|
148
|
+
*/
|
|
149
|
+
declare const pluginRegistry: PluginRegistry;
|
|
150
|
+
/**
|
|
151
|
+
* Register multiple plugins at once
|
|
152
|
+
*
|
|
153
|
+
* @param plugins - Array of plugins to register
|
|
154
|
+
* @returns Array of registration results
|
|
155
|
+
*/
|
|
156
|
+
declare function registerPlugins(plugins: CorePlugin[], options?: PluginOptions): PluginRegistrationResult[];
|
|
157
|
+
/**
|
|
158
|
+
* Create a plugin registration helper with options pre-configured
|
|
159
|
+
*
|
|
160
|
+
* @param options - Default options for plugin registration
|
|
161
|
+
* @returns Registration function
|
|
162
|
+
*/
|
|
163
|
+
declare function createPluginRegistrar(options: PluginOptions): (plugin: CorePlugin) => PluginRegistrationResult;
|
|
164
|
+
|
|
165
|
+
export { PluginRegistry as P, createPluginRegistrar as c, pluginRegistry as p, registerPlugins as r };
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:221.2 83.2% 53.3%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:221.2 83.2% 53.3%;--radius:0.5rem;--doc-bg:#f8f9fa;--doc-primary:#1a73e8;--doc-primary-hover:#1557b0;--doc-primary-light:#e8f0fe;--doc-text:#202124;--doc-text-muted:#5f6368;--doc-text-subtle:#9aa0a6;--doc-text-placeholder:#999;--doc-border:#e0e0e0;--doc-border-light:#dadce0;--doc-border-dark:#d0d0d0;--doc-border-input:#ccc;--doc-bg-subtle:#f5f5f5;--doc-bg-hover:#f1f3f4;--doc-bg-input:#f8f9fa;--doc-error:#c5221f;--doc-error-bg:#fce8e6;--doc-success:#34a853;--doc-success-bg:#e8f5e9;--doc-warning:#f9a825;--doc-warning-bg:#fff8e1;--doc-link:#0563c1}[contenteditable=true]{caret-color:#000;outline:none;caret-shape:bar}.docx-run-editable[contenteditable=true]{caret-color:#000;min-height:1em;display:inline}.docx-paragraph-empty [contenteditable=true]{min-height:1em;min-width:1px;display:inline-block}.docx-paragraph-editable{cursor:text}.docx-run-editable[contenteditable=true]:focus{outline:none}.docx-paragraph-editable:focus-within{outline:none}.docx-run ::selection,.docx-run-editable ::selection,.docx-run-editable::selection,.docx-run::selection,[contenteditable=true] ::selection,[contenteditable=true]::selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-run ::-moz-selection,.docx-run-editable ::-moz-selection,.docx-run-editable::-moz-selection,.docx-run::-moz-selection,[contenteditable=true] ::-moz-selection,[contenteditable=true]::-moz-selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-paragraph ::selection,.docx-paragraph-editable ::selection,.docx-paragraph-editable::selection,.docx-paragraph::selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-paragraph ::-moz-selection,.docx-paragraph-editable ::-moz-selection,.docx-paragraph-editable::-moz-selection,.docx-paragraph::-moz-selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-hyperlink ::selection,.docx-hyperlink::selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-hyperlink ::-moz-selection,.docx-hyperlink::-moz-selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-run-highlighted ::selection,.docx-run-highlighted::selection{background-color:rgba(26,115,232,.5)!important;color:inherit!important}.docx-run-highlighted ::-moz-selection,.docx-run-highlighted::-moz-selection{background-color:rgba(26,115,232,.5)!important;color:inherit!important}.docx-run-dark-bg ::selection,.docx-run-dark-bg::selection{background-color:rgba(100,181,246,.5)!important;color:inherit!important}.docx-run-dark-bg ::-moz-selection,.docx-run-dark-bg::-moz-selection{background-color:rgba(100,181,246,.5)!important;color:inherit!important}.docx-run-bold ::selection,.docx-run-bold::selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-run-bold ::-moz-selection,.docx-run-bold::-moz-selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-run-italic ::selection,.docx-run-italic::selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-run-italic ::-moz-selection,.docx-run-italic::-moz-selection{background-color:rgba(26,115,232,.3)!important;color:inherit!important}.docx-find-highlight{background-color:rgba(255,235,59,.5)!important;border-radius:2px}.docx-find-highlight-current{background-color:rgba(255,152,0,.6)!important;border-radius:2px;outline:2px solid rgba(255,152,0,.8)}.docx-ai-selection-preview{background-color:rgba(156,39,176,.2);border-bottom:2px dashed rgba(156,39,176,.6)}.docx-selection-overlay-container{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;overflow:hidden}.docx-selection-overlay-rect{position:absolute;background-color:rgba(26,115,232,.3);pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;mix-blend-mode:multiply}.docx-run-highlighted[contenteditable=true]{caret-color:#333}.docx-run-dark-bg[contenteditable=true]{caret-color:#fff}.docx-editor{cursor:default}.docx-editor-page{cursor:text}.docx-bookmark-end,.docx-bookmark-start,.docx-drawing-placeholder,.docx-field,.docx-list-marker,.docx-shape-placeholder{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.docx-run-has-variable [contenteditable=false]{cursor:default;-webkit-user-select:all;-moz-user-select:all;user-select:all}
|