@zeke-02/docx-editor-react 0.1.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.
Files changed (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +122 -0
  3. package/dist/FindReplaceDialog-25PDOTC7.js +1 -0
  4. package/dist/FindReplaceDialog-6PLDD22H.mjs +1 -0
  5. package/dist/FootnotePropertiesDialog-JIWAFAKL.js +1 -0
  6. package/dist/FootnotePropertiesDialog-SZYOYLR3.mjs +1 -0
  7. package/dist/HyperlinkDialog-G5FFKLWY.js +1 -0
  8. package/dist/HyperlinkDialog-PSJ6P3E3.mjs +1 -0
  9. package/dist/ImagePositionDialog-DTGYFFAR.js +1 -0
  10. package/dist/ImagePositionDialog-FKBG2MSL.mjs +1 -0
  11. package/dist/ImagePropertiesDialog-SO6RAOT6.js +1 -0
  12. package/dist/ImagePropertiesDialog-T77XMKJF.mjs +1 -0
  13. package/dist/KeyboardShortcutsDialog-04AoVwn3.d.mts +415 -0
  14. package/dist/KeyboardShortcutsDialog-04AoVwn3.d.ts +415 -0
  15. package/dist/PageSetupDialog-Q7UGLILM.mjs +1 -0
  16. package/dist/PageSetupDialog-XMG64O3T.js +1 -0
  17. package/dist/PrintPreview-DEhwRBC_.d.mts +93 -0
  18. package/dist/PrintPreview-DEhwRBC_.d.ts +93 -0
  19. package/dist/SplitCellDialog-NPGW4JGQ.mjs +1 -0
  20. package/dist/SplitCellDialog-RNP37SKZ.js +1 -0
  21. package/dist/TablePropertiesDialog-3QNCWNEG.mjs +1 -0
  22. package/dist/TablePropertiesDialog-AQVM7FGA.js +1 -0
  23. package/dist/chunk-2DBLZSGF.js +1 -0
  24. package/dist/chunk-3QCOIABL.js +2 -0
  25. package/dist/chunk-45GFZZ45.mjs +1 -0
  26. package/dist/chunk-4RTT4L2S.js +1 -0
  27. package/dist/chunk-7DAI755K.mjs +1 -0
  28. package/dist/chunk-BJ5RZW6Y.js +1 -0
  29. package/dist/chunk-BMBP5UFA.mjs +1 -0
  30. package/dist/chunk-DZHU5RSL.mjs +2 -0
  31. package/dist/chunk-FZ357PVD.mjs +2 -0
  32. package/dist/chunk-GM2S2WMT.mjs +1 -0
  33. package/dist/chunk-GNIO6SOS.js +1 -0
  34. package/dist/chunk-HAFRR4IT.js +1 -0
  35. package/dist/chunk-ICVBXT6V.mjs +2 -0
  36. package/dist/chunk-JGPOALUP.js +1 -0
  37. package/dist/chunk-JTUSMG6J.js +1 -0
  38. package/dist/chunk-K5DD2LSK.mjs +1 -0
  39. package/dist/chunk-NIBCC7WQ.js +1 -0
  40. package/dist/chunk-PBA4ERQP.js +2 -0
  41. package/dist/chunk-RK5GPBQ5.mjs +1 -0
  42. package/dist/chunk-UMM2BQ4N.mjs +1 -0
  43. package/dist/chunk-UT6DJWGC.js +2 -0
  44. package/dist/chunk-UZLKRJJK.js +2 -0
  45. package/dist/chunk-W3QFF3SQ.mjs +2 -0
  46. package/dist/chunk-XA53EBKC.js +1 -0
  47. package/dist/chunk-XRZKQOQJ.mjs +1 -0
  48. package/dist/chunk-ZFZJRL2R.mjs +1 -0
  49. package/dist/dialogs.d.mts +40 -0
  50. package/dist/dialogs.d.ts +40 -0
  51. package/dist/dialogs.js +1 -0
  52. package/dist/dialogs.mjs +1 -0
  53. package/dist/hooks.d.mts +513 -0
  54. package/dist/hooks.d.ts +513 -0
  55. package/dist/hooks.js +1 -0
  56. package/dist/hooks.mjs +1 -0
  57. package/dist/index.d.mts +567 -0
  58. package/dist/index.d.ts +567 -0
  59. package/dist/index.js +33 -0
  60. package/dist/index.mjs +33 -0
  61. package/dist/plugin-api.d.mts +90 -0
  62. package/dist/plugin-api.d.ts +90 -0
  63. package/dist/plugin-api.js +246 -0
  64. package/dist/plugin-api.mjs +246 -0
  65. package/dist/styles.css +1 -0
  66. package/dist/styles.d.mts +13 -0
  67. package/dist/styles.d.ts +13 -0
  68. package/dist/styles.js +1 -0
  69. package/dist/styles.mjs +1 -0
  70. package/dist/types-DaQbko33.d.mts +106 -0
  71. package/dist/types-DaQbko33.d.ts +106 -0
  72. package/dist/ui.d.mts +1565 -0
  73. package/dist/ui.d.ts +1565 -0
  74. package/dist/ui.js +111 -0
  75. package/dist/ui.mjs +111 -0
  76. package/dist/useFindReplace-C5gZIvkA.d.mts +219 -0
  77. package/dist/useFindReplace-C5gZIvkA.d.ts +219 -0
  78. package/package.json +137 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @zeke-02/docx-editor-react/plugin-api
3
+ *
4
+ * Generic plugin interface and host component for integrating external
5
+ * plugins with the editor. Pairs with the framework-agnostic plugin types
6
+ * exported from `@zeke-02/docx-editor-core/plugin-api`.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { PluginHost, templatePlugin, type EditorPlugin } from '@zeke-02/docx-editor-react/plugin-api';
11
+ *
12
+ * function MyEditor() {
13
+ * return (
14
+ * <PluginHost plugins={[templatePlugin]}>
15
+ * <DocxEditor document={doc} onChange={handleChange} />
16
+ * </PluginHost>
17
+ * );
18
+ * }
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @public
23
+ */
24
+ import { P as PluginHostProps, a as PluginHostRef, b as ReactEditorPlugin } from './types-DaQbko33.mjs';
25
+ export { E as EditorPlugin, c as PluginContext, R as ReactSidebarItem, S as SidebarItemRenderProps } from './types-DaQbko33.mjs';
26
+ import * as React from 'react';
27
+ export { RenderedDomContextImpl, createRenderedDomContext } from '@zeke-02/docx-editor-core/plugin-api/RenderedDomContext';
28
+ import { TemplateTag } from '@zeke-02/docx-editor-core/prosemirror/template/prosemirror-plugin';
29
+ export { TEMPLATE_DECORATION_STYLES, TagType, TemplateTag, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePluginKey } from '@zeke-02/docx-editor-core/prosemirror/template/prosemirror-plugin';
30
+ export { PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext } from '@zeke-02/docx-editor-core/plugin-api';
31
+ import 'prosemirror-view';
32
+
33
+ declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: visible;\n position: relative;\n}\n\n.plugin-host-editor {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 0;\n overflow: visible;\n}\n\n\n.plugin-panels-left,\n.plugin-panels-right {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n background: #f8f9fa;\n border-color: #e9ecef;\n}\n\n.plugin-panels-left {\n border-right: 1px solid #e9ecef;\n}\n\n.plugin-panels-right {\n border-left: 1px solid #e9ecef;\n}\n\n.plugin-panels-bottom {\n border-top: 1px solid #e9ecef;\n background: #f8f9fa;\n}\n\n.plugin-panel {\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: width 0.2s ease, height 0.2s ease;\n}\n\n.plugin-panel.collapsed {\n overflow: visible;\n}\n\n.plugin-panel-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 12px;\n color: #6c757d;\n white-space: nowrap;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle {\n writing-mode: vertical-rl;\n text-orientation: mixed;\n flex-direction: column;\n height: 100%;\n padding: 8px 6px;\n}\n\n.plugin-panel-toggle:hover {\n background: #e9ecef;\n color: #495057;\n}\n\n.plugin-panel-toggle-icon {\n font-weight: bold;\n font-size: 14px;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle-icon {\n transform: rotate(90deg);\n}\n\n.plugin-panel-toggle-label {\n font-weight: 500;\n}\n\n.plugin-panel-content {\n flex: 1;\n overflow: auto;\n}\n\n/* Right panel rendered inside viewport - scrolls with content */\n.plugin-panel-in-viewport {\n position: absolute;\n top: 0;\n /* Position is set dynamically via inline styles based on page edge */\n width: 220px;\n pointer-events: auto;\n z-index: 10;\n overflow: visible;\n}\n\n.plugin-panel-in-viewport.collapsed {\n width: 32px;\n}\n\n.plugin-panel-in-viewport .plugin-panel-toggle {\n position: sticky;\n top: 0;\n background: rgba(255, 255, 255, 0.95);\n border-radius: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.plugin-panel-in-viewport-content {\n overflow: visible;\n position: relative;\n}\n\n/* Plugin overlay container for rendering highlights/decorations */\n.plugin-overlays-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 5;\n}\n\n.plugin-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n/* Individual overlay children manage their own pointer-events.\n Do NOT set pointer-events: auto here \u2014 it overrides overlay containers\n that need pointer-events: none to let clicks pass through to the editor. */\n";
34
+ /**
35
+ * PluginHost Component
36
+ *
37
+ * Wraps the editor and provides:
38
+ * - Plugin state management
39
+ * - Panel rendering for each plugin
40
+ * - CSS injection for plugin styles
41
+ * - Callbacks for editor interaction
42
+ */
43
+ declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
44
+
45
+ /**
46
+ * Template Plugin
47
+ *
48
+ * Docxtemplater template support as a plugin for the DOCX Editor.
49
+ *
50
+ * Features:
51
+ * - Full docxtemplater syntax detection (variables, loops, conditionals)
52
+ * - Sidebar annotation chips showing template structure (via getSidebarItems)
53
+ * - Differentiated visual highlighting by element type
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * import { PluginHost, templatePlugin } from '@zeke-02/docx-editor-react/plugin-api';
58
+ *
59
+ * function MyEditor() {
60
+ * return (
61
+ * <PluginHost plugins={[templatePlugin]}>
62
+ * <DocxEditor document={doc} onChange={handleChange} />
63
+ * </PluginHost>
64
+ * );
65
+ * }
66
+ * ```
67
+ */
68
+
69
+ interface TemplatePluginState {
70
+ tags: TemplateTag[];
71
+ hoveredId?: string;
72
+ selectedId?: string;
73
+ }
74
+ /**
75
+ * Create the template plugin instance.
76
+ */
77
+ declare function createPlugin(_options?: {
78
+ /** @deprecated — panel is no longer used; template chips render in the unified sidebar */
79
+ defaultCollapsed?: boolean;
80
+ /** @deprecated */
81
+ panelPosition?: 'left' | 'right';
82
+ /** @deprecated */
83
+ panelWidth?: number;
84
+ }): ReactEditorPlugin<TemplatePluginState>;
85
+ /**
86
+ * Default template plugin instance.
87
+ */
88
+ declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
89
+
90
+ export { PLUGIN_HOST_STYLES, PluginHost, PluginHostProps, PluginHostRef, ReactEditorPlugin, createPlugin as createTemplatePlugin, templatePlugin };
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @zeke-02/docx-editor-react/plugin-api
3
+ *
4
+ * Generic plugin interface and host component for integrating external
5
+ * plugins with the editor. Pairs with the framework-agnostic plugin types
6
+ * exported from `@zeke-02/docx-editor-core/plugin-api`.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { PluginHost, templatePlugin, type EditorPlugin } from '@zeke-02/docx-editor-react/plugin-api';
11
+ *
12
+ * function MyEditor() {
13
+ * return (
14
+ * <PluginHost plugins={[templatePlugin]}>
15
+ * <DocxEditor document={doc} onChange={handleChange} />
16
+ * </PluginHost>
17
+ * );
18
+ * }
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @public
23
+ */
24
+ import { P as PluginHostProps, a as PluginHostRef, b as ReactEditorPlugin } from './types-DaQbko33.js';
25
+ export { E as EditorPlugin, c as PluginContext, R as ReactSidebarItem, S as SidebarItemRenderProps } from './types-DaQbko33.js';
26
+ import * as React from 'react';
27
+ export { RenderedDomContextImpl, createRenderedDomContext } from '@zeke-02/docx-editor-core/plugin-api/RenderedDomContext';
28
+ import { TemplateTag } from '@zeke-02/docx-editor-core/prosemirror/template/prosemirror-plugin';
29
+ export { TEMPLATE_DECORATION_STYLES, TagType, TemplateTag, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePluginKey } from '@zeke-02/docx-editor-core/prosemirror/template/prosemirror-plugin';
30
+ export { PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext } from '@zeke-02/docx-editor-core/plugin-api';
31
+ import 'prosemirror-view';
32
+
33
+ declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: visible;\n position: relative;\n}\n\n.plugin-host-editor {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 0;\n overflow: visible;\n}\n\n\n.plugin-panels-left,\n.plugin-panels-right {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n background: #f8f9fa;\n border-color: #e9ecef;\n}\n\n.plugin-panels-left {\n border-right: 1px solid #e9ecef;\n}\n\n.plugin-panels-right {\n border-left: 1px solid #e9ecef;\n}\n\n.plugin-panels-bottom {\n border-top: 1px solid #e9ecef;\n background: #f8f9fa;\n}\n\n.plugin-panel {\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: width 0.2s ease, height 0.2s ease;\n}\n\n.plugin-panel.collapsed {\n overflow: visible;\n}\n\n.plugin-panel-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 12px;\n color: #6c757d;\n white-space: nowrap;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle {\n writing-mode: vertical-rl;\n text-orientation: mixed;\n flex-direction: column;\n height: 100%;\n padding: 8px 6px;\n}\n\n.plugin-panel-toggle:hover {\n background: #e9ecef;\n color: #495057;\n}\n\n.plugin-panel-toggle-icon {\n font-weight: bold;\n font-size: 14px;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle-icon {\n transform: rotate(90deg);\n}\n\n.plugin-panel-toggle-label {\n font-weight: 500;\n}\n\n.plugin-panel-content {\n flex: 1;\n overflow: auto;\n}\n\n/* Right panel rendered inside viewport - scrolls with content */\n.plugin-panel-in-viewport {\n position: absolute;\n top: 0;\n /* Position is set dynamically via inline styles based on page edge */\n width: 220px;\n pointer-events: auto;\n z-index: 10;\n overflow: visible;\n}\n\n.plugin-panel-in-viewport.collapsed {\n width: 32px;\n}\n\n.plugin-panel-in-viewport .plugin-panel-toggle {\n position: sticky;\n top: 0;\n background: rgba(255, 255, 255, 0.95);\n border-radius: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.plugin-panel-in-viewport-content {\n overflow: visible;\n position: relative;\n}\n\n/* Plugin overlay container for rendering highlights/decorations */\n.plugin-overlays-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 5;\n}\n\n.plugin-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n/* Individual overlay children manage their own pointer-events.\n Do NOT set pointer-events: auto here \u2014 it overrides overlay containers\n that need pointer-events: none to let clicks pass through to the editor. */\n";
34
+ /**
35
+ * PluginHost Component
36
+ *
37
+ * Wraps the editor and provides:
38
+ * - Plugin state management
39
+ * - Panel rendering for each plugin
40
+ * - CSS injection for plugin styles
41
+ * - Callbacks for editor interaction
42
+ */
43
+ declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
44
+
45
+ /**
46
+ * Template Plugin
47
+ *
48
+ * Docxtemplater template support as a plugin for the DOCX Editor.
49
+ *
50
+ * Features:
51
+ * - Full docxtemplater syntax detection (variables, loops, conditionals)
52
+ * - Sidebar annotation chips showing template structure (via getSidebarItems)
53
+ * - Differentiated visual highlighting by element type
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * import { PluginHost, templatePlugin } from '@zeke-02/docx-editor-react/plugin-api';
58
+ *
59
+ * function MyEditor() {
60
+ * return (
61
+ * <PluginHost plugins={[templatePlugin]}>
62
+ * <DocxEditor document={doc} onChange={handleChange} />
63
+ * </PluginHost>
64
+ * );
65
+ * }
66
+ * ```
67
+ */
68
+
69
+ interface TemplatePluginState {
70
+ tags: TemplateTag[];
71
+ hoveredId?: string;
72
+ selectedId?: string;
73
+ }
74
+ /**
75
+ * Create the template plugin instance.
76
+ */
77
+ declare function createPlugin(_options?: {
78
+ /** @deprecated — panel is no longer used; template chips render in the unified sidebar */
79
+ defaultCollapsed?: boolean;
80
+ /** @deprecated */
81
+ panelPosition?: 'left' | 'right';
82
+ /** @deprecated */
83
+ panelWidth?: number;
84
+ }): ReactEditorPlugin<TemplatePluginState>;
85
+ /**
86
+ * Default template plugin instance.
87
+ */
88
+ declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
89
+
90
+ export { PLUGIN_HOST_STYLES, PluginHost, PluginHostProps, PluginHostRef, ReactEditorPlugin, createPlugin as createTemplatePlugin, templatePlugin };
@@ -0,0 +1,246 @@
1
+ 'use strict';var chunkJTUSMG6J_js=require('./chunk-JTUSMG6J.js'),chunkBJ5RZW6Y_js=require('./chunk-BJ5RZW6Y.js'),ie=require('react'),prosemirrorState=require('prosemirror-state'),docxEditorCore=require('@zeke-02/docx-editor-core'),jsxRuntime=require('react/jsx-runtime'),ke=require('@zeke-02/docx-editor-core/prosemirror/template/prosemirror-plugin');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ie__default=/*#__PURE__*/_interopDefault(ie);var ke__namespace=/*#__PURE__*/_interopNamespace(ke);var z={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},j=docxEditorCore.injectStyles,J=`
2
+ .plugin-host {
3
+ display: flex;
4
+ width: 100%;
5
+ height: 100%;
6
+ overflow: visible;
7
+ position: relative;
8
+ }
9
+
10
+ .plugin-host-editor {
11
+ flex: 1;
12
+ display: flex;
13
+ flex-direction: column;
14
+ min-width: 0;
15
+ overflow: visible;
16
+ }
17
+
18
+
19
+ .plugin-panels-left,
20
+ .plugin-panels-right {
21
+ display: flex;
22
+ flex-direction: column;
23
+ flex-shrink: 0;
24
+ background: #f8f9fa;
25
+ border-color: #e9ecef;
26
+ }
27
+
28
+ .plugin-panels-left {
29
+ border-right: 1px solid #e9ecef;
30
+ }
31
+
32
+ .plugin-panels-right {
33
+ border-left: 1px solid #e9ecef;
34
+ }
35
+
36
+ .plugin-panels-bottom {
37
+ border-top: 1px solid #e9ecef;
38
+ background: #f8f9fa;
39
+ }
40
+
41
+ .plugin-panel {
42
+ position: relative;
43
+ display: flex;
44
+ flex-direction: column;
45
+ overflow: hidden;
46
+ transition: width 0.2s ease, height 0.2s ease;
47
+ }
48
+
49
+ .plugin-panel.collapsed {
50
+ overflow: visible;
51
+ }
52
+
53
+ .plugin-panel-toggle {
54
+ display: flex;
55
+ align-items: center;
56
+ gap: 4px;
57
+ padding: 6px 8px;
58
+ background: transparent;
59
+ border: none;
60
+ cursor: pointer;
61
+ font-size: 12px;
62
+ color: #6c757d;
63
+ white-space: nowrap;
64
+ }
65
+
66
+ .plugin-panel.collapsed .plugin-panel-toggle {
67
+ writing-mode: vertical-rl;
68
+ text-orientation: mixed;
69
+ flex-direction: column;
70
+ height: 100%;
71
+ padding: 8px 6px;
72
+ }
73
+
74
+ .plugin-panel-toggle:hover {
75
+ background: #e9ecef;
76
+ color: #495057;
77
+ }
78
+
79
+ .plugin-panel-toggle-icon {
80
+ font-weight: bold;
81
+ font-size: 14px;
82
+ }
83
+
84
+ .plugin-panel.collapsed .plugin-panel-toggle-icon {
85
+ transform: rotate(90deg);
86
+ }
87
+
88
+ .plugin-panel-toggle-label {
89
+ font-weight: 500;
90
+ }
91
+
92
+ .plugin-panel-content {
93
+ flex: 1;
94
+ overflow: auto;
95
+ }
96
+
97
+ /* Right panel rendered inside viewport - scrolls with content */
98
+ .plugin-panel-in-viewport {
99
+ position: absolute;
100
+ top: 0;
101
+ /* Position is set dynamically via inline styles based on page edge */
102
+ width: 220px;
103
+ pointer-events: auto;
104
+ z-index: 10;
105
+ overflow: visible;
106
+ }
107
+
108
+ .plugin-panel-in-viewport.collapsed {
109
+ width: 32px;
110
+ }
111
+
112
+ .plugin-panel-in-viewport .plugin-panel-toggle {
113
+ position: sticky;
114
+ top: 0;
115
+ background: rgba(255, 255, 255, 0.95);
116
+ border-radius: 4px;
117
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
118
+ }
119
+
120
+ .plugin-panel-in-viewport-content {
121
+ overflow: visible;
122
+ position: relative;
123
+ }
124
+
125
+ /* Plugin overlay container for rendering highlights/decorations */
126
+ .plugin-overlays-container {
127
+ position: absolute;
128
+ top: 0;
129
+ left: 0;
130
+ right: 0;
131
+ bottom: 0;
132
+ pointer-events: none;
133
+ overflow: visible;
134
+ z-index: 5;
135
+ }
136
+
137
+ .plugin-overlay {
138
+ position: absolute;
139
+ top: 0;
140
+ left: 0;
141
+ right: 0;
142
+ bottom: 0;
143
+ pointer-events: none;
144
+ }
145
+
146
+ /* Individual overlay children manage their own pointer-events.
147
+ Do NOT set pointer-events: auto here \u2014 it overrides overlay containers
148
+ that need pointer-events: none to let clicks pass through to the editor. */
149
+ `,ve=ie.forwardRef(function({plugins:d,children:g,className:p=""},u){let[n,y]=ie.useState(null),f=ie.useRef(g.props);f.current=g.props;let[a,S]=ie.useState(null),i=ie.useMemo(()=>new docxEditorCore.PluginLifecycleManager,[]),m=ie.useSyncExternalStore(i.subscribe,i.getSnapshot),[h,T]=ie.useState(()=>{let t=new Set;for(let e of d)({...z,...e.panelConfig}).defaultCollapsed&&t.add(e.id);return t}),[v]=ie.useState(()=>{let t=new Map;for(let e of d){let o={...z,...e.panelConfig};t.set(e.id,o.defaultSize);}return t});ie.useEffect(()=>{if(!n)return;let t=d.map(e=>({id:e.id,styles:e.styles,initialize:e.initialize,onStateChange:e.onStateChange,destroy:e.destroy}));return i.initialize(t,n),()=>{i.destroy();}},[i,n,d]),ie.useEffect(()=>{let t=d.filter(e=>e.styles).map(e=>j(e.id,e.styles));return ()=>t.forEach(e=>e())},[d]),ie.useEffect(()=>{if(!n?.dom)return;let t=()=>{i.updateStates(n);},e=null,o=()=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(t);};t();let s=n.dom;s.addEventListener("input",o),s.addEventListener("focus",t),s.addEventListener("click",t);let c=n.dispatch.bind(n);return n.dispatch=x=>{c(x),o();},()=>{s.removeEventListener("input",o),s.removeEventListener("focus",t),s.removeEventListener("click",t),e&&cancelAnimationFrame(e),n.dispatch=c;}},[n,i]),ie.useEffect(()=>j("plugin-host-base",J),[]);let O=ie.useCallback(t=>{if(!n)return;if(n.coordsAtPos(t)){n.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:o}=n,s=o.doc.resolve(Math.min(t,o.doc.content.size)),c=o.tr.setSelection(prosemirrorState.TextSelection.near(s));n.dispatch(c),n.focus();}},[n]),k=ie.useCallback((t,e)=>{if(!n)return;let{state:o}=n,s=o.doc.content.size,c=Math.max(0,Math.min(t,s)),x=Math.max(0,Math.min(e,s)),R=o.tr.setSelection(prosemirrorState.TextSelection.create(o.doc,c,x));n.dispatch(R),n.focus();},[n]),_=ie.useCallback(t=>i.getPluginState(t),[i]),A=ie.useCallback((t,e)=>{i.setPluginState(t,e);},[i]),F=ie.useCallback(()=>{n&&i.updateStates(n);},[n,i]);ie.useImperativeHandle(u,()=>({getPluginState:_,setPluginState:A,getEditorView:()=>n,refreshPluginStates:F}),[_,A,n,F]);let Y=ie.useMemo(()=>{let t=[];for(let e of d)e.proseMirrorPlugins&&t.push(...e.proseMirrorPlugins);return t},[d]),M=ie.useCallback(t=>{T(e=>{let o=new Set(e);return o.has(t)?o.delete(t):o.add(t),o});},[]),[$,N]=ie.useState(null);ie.useEffect(()=>{if(!a){N(null);return}let t=()=>{let s=a.pagesContainer,c=s.querySelector(".layout-page");if(!c){N(null);return}let x=a.getContainerOffset(),R=c.getBoundingClientRect(),D=s.getBoundingClientRect(),V=(R.right-D.left)/a.zoom,le=x.x+V+5;N(le);};t();let e=()=>{requestAnimationFrame(t);};window.addEventListener("resize",e);let o=new ResizeObserver(()=>{requestAnimationFrame(t);});return o.observe(a.pagesContainer),()=>{window.removeEventListener("resize",e),o.disconnect();}},[a]);let G=ie.useMemo(()=>{let t=[];if(a){for(let e of d)if(e.renderOverlay){let o=m.states.get(e.id);t.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":e.id,children:e.renderOverlay(a,o,n)},`overlay-${e.id}`));}}for(let e of d){if(!e.Panel||(e.panelConfig?.position??"right")!=="right")continue;let s={...z,...e.panelConfig},c=h.has(e.id),x=v.get(e.id)??s.defaultSize,R=e.Panel,D=m.states.get(e.id),V=$!==null?`${$}px`:"calc(50% + 428px)";t.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${c?"collapsed":""}`,style:{width:c?"32px":`${x}px`,left:V},"data-plugin-id":e.id,children:[s.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>M(e.id),title:c?`Show ${e.name}`:`Hide ${e.name}`,"aria-label":c?`Show ${e.name}`:`Hide ${e.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:c?"\u2039":"\u203A"})}),!c&&a&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(R,{editorView:n,doc:n?.state.doc??null,scrollToPosition:O,selectRange:k,pluginState:D,panelWidth:x,renderedDomContext:a})})]},`panel-overlay-${e.id}`));}return t.length>0?t:null},[a,d,m.version,n,h,v,O,k,M,$]),q=ie.useMemo(()=>{let t=[];for(let e of d){if(!e.getSidebarItems)continue;let o=m.states.get(e.id),s={editorView:n,renderedDomContext:a,anchorPositions:new Map,zoom:a?.zoom??1},c=e.getSidebarItems(o,s);t.push(...c);}return t},[d,m.version,n,a]),U=ie.useCallback(t=>{S(t);let e=f.current?.onRenderedDomContextReady;typeof e=="function"&&e(t);},[]),se=ie.useMemo(()=>ie.cloneElement(g,{externalPlugins:Y,pluginOverlays:G,pluginSidebarItems:q,pluginRenderedDomContext:a,onRenderedDomContextReady:U,onEditorViewReady:t=>{y(t);let e=f.current?.onEditorViewReady;typeof e=="function"&&e(t);}}),[g,Y,G,q,a,U]),H=ie.useMemo(()=>{let t=[],e=[],o=[];for(let s of d){if(!s.Panel)continue;let c=s.panelConfig?.position??"right";c==="left"?t.push(s):c==="bottom"?o.push(s):e.push(s);}return {left:t,right:e,bottom:o}},[d]),W=t=>{if(!t.Panel)return null;let e={...z,...t.panelConfig},o=h.has(t.id),s=v.get(t.id)??e.defaultSize,c=t.Panel,x=m.states.get(t.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${e.position} ${o?"collapsed":""}`,style:{[e.position==="bottom"?"height":"width"]:o?"32px":`${s}px`,minWidth:e.position!=="bottom"?o?"32px":`${e.minSize}px`:void 0,maxWidth:e.position!=="bottom"?`${e.maxSize}px`:void 0,minHeight:e.position==="bottom"?o?"32px":`${e.minSize}px`:void 0,maxHeight:e.position==="bottom"?`${e.maxSize}px`:void 0},"data-plugin-id":t.id,children:[e.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>M(t.id),title:o?`Show ${t.name}`:`Hide ${t.name}`,"aria-label":o?`Show ${t.name}`:`Hide ${t.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:o?"\u203A":"\u2039"}),o&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:t.name})]}),!o&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(c,{editorView:n,doc:n?.state.doc??null,scrollToPosition:O,selectRange:k,pluginState:x,panelWidth:s,renderedDomContext:a??null})})]},t.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${p}`,children:[H.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:H.left.map(W)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[se,H.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:H.bottom.map(W)})]})]})});var l={};chunkBJ5RZW6Y_js.a(l,ke__namespace);var Se={variable:"rgba(245, 158, 11, 0.3)",sectionStart:"rgba(59, 130, 246, 0.3)",sectionEnd:"rgba(59, 130, 246, 0.3)",invertedStart:"rgba(139, 92, 246, 0.3)",raw:"rgba(239, 68, 68, 0.3)"},Te={variable:"rgba(245, 158, 11, 0.5)",sectionStart:"rgba(59, 130, 246, 0.5)",sectionEnd:"rgba(59, 130, 246, 0.5)",invertedStart:"rgba(139, 92, 246, 0.5)",raw:"rgba(239, 68, 68, 0.5)"};function Z({context:r,tags:d,hoveredId:g,selectedId:p,onHover:u,onSelect:n}){let[y,f]=ie.useState(0),a=ie.useCallback(()=>{let i=r.getContainerOffset(),m=[];for(let h of d){let T=r.getRectsForRange(h.from,h.to);for(let v of T)m.push({tagId:h.id,tagType:h.type,x:v.x+i.x,y:v.y+i.y,width:v.width,height:v.height});}return m},[r,d]),S=ie.useMemo(()=>a(),[a,y]);return ie.useEffect(()=>{let i=()=>{requestAnimationFrame(()=>f(m=>m+1));};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),ie.useEffect(()=>{let i=new ResizeObserver(()=>{requestAnimationFrame(()=>f(m=>m+1));});return i.observe(r.pagesContainer),()=>i.disconnect()},[r.pagesContainer]),S.length===0?null:jsxRuntime.jsx("div",{className:"template-highlight-overlay",children:S.map((i,m)=>{let h=i.tagId===g,T=i.tagId===p,v=h||T?Te[i.tagType]:Se[i.tagType];return jsxRuntime.jsx("div",{className:`template-highlight ${h?"hovered":""} ${T?"selected":""}`,style:{position:"absolute",left:i.x,top:i.y,width:i.width,height:i.height,backgroundColor:v,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>u?.(i.tagId),onMouseLeave:()=>u?.(void 0),onClick:()=>n?.(i.tagId)},`${i.tagId}-${m}`)})})}var ee=`
150
+ .template-highlight-overlay {
151
+ position: absolute;
152
+ top: 0;
153
+ left: 0;
154
+ right: 0;
155
+ bottom: 0;
156
+ pointer-events: none;
157
+ overflow: visible;
158
+ }
159
+
160
+ .template-highlight {
161
+ pointer-events: auto;
162
+ transition: background-color 0.1s ease;
163
+ }
164
+
165
+ .template-highlight:hover,
166
+ .template-highlight.hovered {
167
+ filter: brightness(0.9);
168
+ }
169
+
170
+ .template-highlight.selected {
171
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
172
+ }
173
+ `;var we={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function Ee(r){switch(r){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}var ne=`
174
+ .template-annotation-chip {
175
+ display: inline-flex;
176
+ flex-wrap: wrap;
177
+ align-items: center;
178
+ gap: 4px;
179
+ padding: 5px 10px;
180
+ background: white;
181
+ border: 1px solid #e2e8f0;
182
+ border-left: 3px solid #6c757d;
183
+ border-radius: 4px;
184
+ font-size: 11px;
185
+ cursor: pointer;
186
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
187
+ max-width: 200px;
188
+ }
189
+
190
+ .template-annotation-chip:hover,
191
+ .template-annotation-chip.hovered {
192
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
193
+ border-color: #cbd5e1;
194
+ }
195
+
196
+ .template-annotation-chip.selected {
197
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
198
+ }
199
+
200
+ .template-chip-badge {
201
+ font-size: 9px;
202
+ font-weight: 600;
203
+ padding: 1px 5px;
204
+ border-radius: 3px;
205
+ color: white;
206
+ text-transform: uppercase;
207
+ letter-spacing: 0.3px;
208
+ }
209
+
210
+ .template-chip-dot {
211
+ font-size: 8px;
212
+ }
213
+
214
+ .template-chip-name {
215
+ color: #334155;
216
+ font-weight: 500;
217
+ }
218
+
219
+ .template-chip-nested {
220
+ display: flex;
221
+ flex-wrap: wrap;
222
+ gap: 4px;
223
+ width: 100%;
224
+ margin-top: 4px;
225
+ padding-top: 4px;
226
+ border-top: 1px solid rgba(0, 0, 0, 0.06);
227
+ }
228
+
229
+ .template-nested-var {
230
+ font-size: 10px;
231
+ color: #64748b;
232
+ background: rgba(0, 0, 0, 0.04);
233
+ padding: 2px 6px;
234
+ border-radius: 3px;
235
+ }
236
+
237
+ .template-nested-var:hover {
238
+ background: rgba(59, 130, 246, 0.15);
239
+ color: #1e40af;
240
+ }
241
+ `;function oe({tag:r,isHovered:d,measureRef:g,onHover:p,onSelect:u}){let n=Ee(r.type),y=we[r.type],f=r.type==="sectionStart"||r.type==="invertedStart";return jsxRuntime.jsxs("div",{ref:g,style:{display:"flex",alignItems:"flex-start"},children:[jsxRuntime.jsx("div",{style:{width:20,height:1,background:d?"#3b82f6":"#d0d0d0",marginTop:12,marginRight:4,flexShrink:0}}),jsxRuntime.jsxs("div",{className:`template-annotation-chip ${d?"hovered":""}`,style:{borderLeftColor:y},onMouseEnter:()=>p(r.id),onMouseLeave:()=>p(void 0),onClick:a=>{a.stopPropagation(),u(r.id);},onMouseDown:a=>a.stopPropagation(),title:f?`${r.rawTag}
242
+ Iterates over ${r.name}[]. Access nested properties via ${r.name}.property`:r.rawTag,children:[n&&jsxRuntime.jsx("span",{className:"template-chip-badge",style:{background:y},children:n}),!n&&jsxRuntime.jsx("span",{className:"template-chip-dot",style:{color:y},children:"\u25CF"}),jsxRuntime.jsx("span",{className:"template-chip-name",children:r.name}),f&&r.nestedVars&&r.nestedVars.length>0&&jsxRuntime.jsx("div",{className:"template-chip-nested",children:r.nestedVars.map((a,S)=>jsxRuntime.jsx("span",{className:"template-nested-var",title:`Access: ${r.name}.${a}`,children:a.includes(".")?a.split(".").pop():a},S))})]})]})}function re(r,d,g){if(!r)return;(0, l.setSelectedElement)(r,g);let p=d.find(u=>u.id===g);if(p){let u=r.state.tr.setSelection(prosemirrorState.TextSelection.near(r.state.doc.resolve(p.from)));r.dispatch(u),r.focus();}}function ae(r={}){return {id:"template",name:"Template",proseMirrorPlugins:[(0, l.createTemplatePlugin)()],onStateChange:g=>{let p=l.templatePluginKey.getState(g.state);if(p)return {tags:p.tags,hoveredId:p.hoveredId,selectedId:p.selectedId}},initialize:g=>({tags:[]}),getSidebarItems:(g,p)=>!g||g.tags.length===0?[]:g.tags.filter(n=>n.type!=="sectionEnd"&&!n.insideSection).map(n=>({id:`template-${n.id}`,anchorPos:n.from,priority:10,estimatedHeight:32,render:y=>ie__default.default.createElement(oe,{...y,tag:n,isHovered:n.id===g.hoveredId,onHover:f=>{p.editorView&&(0, l.setHoveredElement)(p.editorView,f);},onSelect:f=>re(p.editorView,g.tags,f)})})),renderOverlay:(g,p,u)=>!p||p.tags.length===0?null:ie__default.default.createElement(Z,{context:g,tags:p.tags,hoveredId:p.hoveredId,selectedId:p.selectedId,onHover:n=>{u&&(0, l.setHoveredElement)(u,n);},onSelect:n=>re(u,p.tags,n)}),styles:`
243
+ ${l.TEMPLATE_DECORATION_STYLES}
244
+ ${ne}
245
+ ${ee}
246
+ `}}var Ce=ae();var export_TEMPLATE_DECORATION_STYLES=l.TEMPLATE_DECORATION_STYLES;var export_createTemplateProseMirrorPlugin=l.createTemplatePlugin;var export_getTemplatePluginTags=l.getTemplateTags;var export_setHoveredElement=l.setHoveredElement;var export_setSelectedElement=l.setSelectedElement;var export_templatePluginKey=l.templatePluginKey;Object.defineProperty(exports,"RenderedDomContextImpl",{enumerable:true,get:function(){return chunkJTUSMG6J_js.a}});Object.defineProperty(exports,"createRenderedDomContext",{enumerable:true,get:function(){return chunkJTUSMG6J_js.b}});exports.PLUGIN_HOST_STYLES=J;exports.PluginHost=ve;exports.TEMPLATE_DECORATION_STYLES=export_TEMPLATE_DECORATION_STYLES;exports.createTemplatePlugin=ae;exports.createTemplateProseMirrorPlugin=export_createTemplateProseMirrorPlugin;exports.getTemplatePluginTags=export_getTemplatePluginTags;exports.setHoveredElement=export_setHoveredElement;exports.setSelectedElement=export_setSelectedElement;exports.templatePlugin=Ce;exports.templatePluginKey=export_templatePluginKey;