@zeke-02/docx-editor 0.5.3 → 0.5.4
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/dist/{KeyboardShortcutsDialog-5D_FoAp6.d.ts → KeyboardShortcutsDialog-B0UFuR4w.d.ts} +2 -2
- package/dist/{KeyboardShortcutsDialog-D7ihAj18.d.mts → KeyboardShortcutsDialog-t6JKL4Aj.d.mts} +2 -2
- package/dist/PageSetupDialog-642IAVG2.js +1 -1
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -1
- package/dist/PluginHost-HS31VIuo.d.mts +16 -0
- package/dist/PluginHost-zILZO7zX.d.ts +16 -0
- package/dist/{agentApi-D4AZmNfB.d.ts → agentApi-B2Y7kexW.d.ts} +1 -1
- package/dist/{agentApi-C41hiW-n.d.mts → agentApi-BzUJ_kao.d.mts} +1 -1
- package/dist/{chunk-E6MQXELR.js → chunk-HXDMASAR.js} +1 -1
- package/dist/chunk-JFRDFK7V.mjs +260 -0
- package/dist/{chunk-LUJ6HCMH.mjs → chunk-LWOHVYKW.mjs} +1 -1
- package/dist/chunk-MDTA25AN.mjs +60 -0
- package/dist/chunk-NOLMVQNN.mjs +40 -0
- package/dist/chunk-SGTUE33R.js +260 -0
- package/dist/chunk-WO3FIV4B.js +40 -0
- package/dist/{chunk-ONNHQWAX.mjs → chunk-XGJ2EORY.mjs} +1 -1
- package/dist/{chunk-AYMGSTNG.js → chunk-Y3SEHWZ2.js} +1 -1
- package/dist/chunk-YBEVHQCT.js +60 -0
- package/dist/{content-B2MzIMwA.d.mts → content-REFGFfEH.d.mts} +1 -1
- package/dist/{content-B2MzIMwA.d.ts → content-REFGFfEH.d.ts} +1 -1
- package/dist/dialogs.d.mts +4 -4
- package/dist/dialogs.d.ts +4 -4
- package/dist/dialogs.js +1 -1
- package/dist/dialogs.mjs +1 -1
- package/dist/{document-Di1qGqLS.d.mts → document-Cu2vq_wS.d.mts} +1 -1
- package/dist/{document-DZ_ZeZEH.d.ts → document-CxOagoLQ.d.ts} +1 -1
- package/dist/executor-WBHID2RK.mjs +1 -0
- package/dist/{executor-EPEB53SJ.js → executor-Y5VUOAHY.js} +1 -1
- package/dist/{findReplace-pkMskVJU.d.ts → findReplace-Bue0JaXh.d.ts} +1 -1
- package/dist/{findReplace-CpIoILbP.d.mts → findReplace-shXbOjFQ.d.mts} +1 -1
- package/dist/fork.css +1 -0
- package/dist/fork.d.mts +535 -0
- package/dist/fork.d.ts +535 -0
- package/dist/fork.js +1 -0
- package/dist/fork.mjs +1 -0
- package/dist/hooks.d.mts +6 -6
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index-B5A-J9GC.d.ts +1119 -0
- package/dist/index-bw-PaozF.d.mts +1119 -0
- package/dist/index.d.mts +11 -1120
- package/dist/index.d.ts +11 -1120
- package/dist/index.js +1 -40
- package/dist/index.mjs +1 -40
- package/dist/plugin-api.d.mts +5 -16
- package/dist/plugin-api.d.ts +5 -16
- package/dist/plugin-api.js +1 -260
- package/dist/plugin-api.mjs +1 -260
- package/dist/{types-DZUhB7Ao.d.mts → types-BF48VxkC.d.mts} +1 -1
- package/dist/{types-DZUhB7Ao.d.ts → types-BF48VxkC.d.ts} +1 -1
- package/dist/{types-Bd_YzkhG.d.mts → types-BnIs4sE7.d.mts} +1 -1
- package/dist/{types-Bd_YzkhG.d.ts → types-BnIs4sE7.d.ts} +1 -1
- package/dist/{types-DcxHFUSc.d.ts → types-CW6HFAX6.d.ts} +1 -1
- package/dist/{types-CkfDgB0O.d.mts → types-DIsDCwTG.d.mts} +1 -1
- package/dist/ui.d.mts +9 -9
- package/dist/ui.d.ts +9 -9
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/dist/{useFindReplace-eyhMSZZf.d.ts → useFindReplace-DKy-s3gS.d.ts} +2 -2
- package/dist/{useFindReplace-DDs533b-.d.mts → useFindReplace-vuoKpDKE.d.mts} +2 -2
- package/package.json +7 -7
- package/dist/chunk-47VJOBJD.mjs +0 -60
- package/dist/chunk-IP5NAYHL.js +0 -60
- package/dist/executor-TVJ6K6MW.mjs +0 -1
package/dist/plugin-api.d.mts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { E as EditorPlugin,
|
|
3
|
-
|
|
1
|
+
import { R as RenderedDomContext, P as PositionCoordinates, b as ReactEditorPlugin } from './types-BnIs4sE7.mjs';
|
|
2
|
+
export { E as EditorPlugin, c as PanelConfig, d as PluginContext, e as PluginHostProps, f as PluginHostRef, g as PluginPanelProps, a as ReactSidebarItem, S as SidebarItem, h as SidebarItemContext, i as SidebarItemRenderProps } from './types-BnIs4sE7.mjs';
|
|
3
|
+
export { a as PLUGIN_HOST_STYLES, P as PluginHost } from './PluginHost-HS31VIuo.mjs';
|
|
4
4
|
import * as prosemirror_state from 'prosemirror-state';
|
|
5
5
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
6
6
|
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
7
|
+
import 'react';
|
|
7
8
|
import 'prosemirror-model';
|
|
8
9
|
|
|
9
|
-
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";
|
|
10
|
-
/**
|
|
11
|
-
* PluginHost Component
|
|
12
|
-
*
|
|
13
|
-
* Wraps the editor and provides:
|
|
14
|
-
* - Plugin state management
|
|
15
|
-
* - Panel rendering for each plugin
|
|
16
|
-
* - CSS injection for plugin styles
|
|
17
|
-
* - Callbacks for editor interaction
|
|
18
|
-
*/
|
|
19
|
-
declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
|
|
20
|
-
|
|
21
10
|
/**
|
|
22
11
|
* RenderedDomContext Implementation
|
|
23
12
|
*
|
|
@@ -173,4 +162,4 @@ declare function createPlugin(_options?: {
|
|
|
173
162
|
*/
|
|
174
163
|
declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
175
164
|
|
|
176
|
-
export {
|
|
165
|
+
export { PositionCoordinates, ReactEditorPlugin, RenderedDomContext, RenderedDomContextImpl, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, createRenderedDomContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };
|
package/dist/plugin-api.d.ts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { E as EditorPlugin,
|
|
3
|
-
|
|
1
|
+
import { R as RenderedDomContext, P as PositionCoordinates, b as ReactEditorPlugin } from './types-BnIs4sE7.js';
|
|
2
|
+
export { E as EditorPlugin, c as PanelConfig, d as PluginContext, e as PluginHostProps, f as PluginHostRef, g as PluginPanelProps, a as ReactSidebarItem, S as SidebarItem, h as SidebarItemContext, i as SidebarItemRenderProps } from './types-BnIs4sE7.js';
|
|
3
|
+
export { a as PLUGIN_HOST_STYLES, P as PluginHost } from './PluginHost-zILZO7zX.js';
|
|
4
4
|
import * as prosemirror_state from 'prosemirror-state';
|
|
5
5
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
6
6
|
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
7
|
+
import 'react';
|
|
7
8
|
import 'prosemirror-model';
|
|
8
9
|
|
|
9
|
-
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";
|
|
10
|
-
/**
|
|
11
|
-
* PluginHost Component
|
|
12
|
-
*
|
|
13
|
-
* Wraps the editor and provides:
|
|
14
|
-
* - Plugin state management
|
|
15
|
-
* - Panel rendering for each plugin
|
|
16
|
-
* - CSS injection for plugin styles
|
|
17
|
-
* - Callbacks for editor interaction
|
|
18
|
-
*/
|
|
19
|
-
declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
|
|
20
|
-
|
|
21
10
|
/**
|
|
22
11
|
* RenderedDomContext Implementation
|
|
23
12
|
*
|
|
@@ -173,4 +162,4 @@ declare function createPlugin(_options?: {
|
|
|
173
162
|
*/
|
|
174
163
|
declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
175
164
|
|
|
176
|
-
export {
|
|
165
|
+
export { PositionCoordinates, ReactEditorPlugin, RenderedDomContext, RenderedDomContextImpl, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, createRenderedDomContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };
|
package/dist/plugin-api.js
CHANGED
|
@@ -1,260 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
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
|
-
`,Re=me.forwardRef(function({plugins:i,children:s,className:r=""},p){let[t,f]=me.useState(null),m=me.useRef(s.props);m.current=s.props;let[a,u]=me.useState(null),l=me.useMemo(()=>new chunkIP5NAYHL_js.s,[]),x=me.useSyncExternalStore(l.subscribe,l.getSnapshot),[T,h]=me.useState(()=>{let o=new Set;for(let e of i)({...$,...e.panelConfig}).defaultCollapsed&&o.add(e.id);return o}),[v]=me.useState(()=>{let o=new Map;for(let e of i){let d={...$,...e.panelConfig};o.set(e.id,d.defaultSize);}return o});me.useEffect(()=>{if(!t)return;let o=i.map(e=>({id:e.id,styles:e.styles,initialize:e.initialize,onStateChange:e.onStateChange,destroy:e.destroy}));return l.initialize(o,t),()=>{l.destroy();}},[l,t,i]),me.useEffect(()=>{let o=i.filter(e=>e.styles).map(e=>te(e.id,e.styles));return ()=>o.forEach(e=>e())},[i]),me.useEffect(()=>{if(!t?.dom)return;let o=()=>{l.updateStates(t);},e=null,d=()=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(o);};o();let c=t.dom;c.addEventListener("input",d),c.addEventListener("focus",o),c.addEventListener("click",o);let g=t.dispatch.bind(t);return t.dispatch=y=>{g(y),d();},()=>{c.removeEventListener("input",d),c.removeEventListener("focus",o),c.removeEventListener("click",o),e&&cancelAnimationFrame(e),t.dispatch=g;}},[t,l]),me.useEffect(()=>te("plugin-host-base",ne),[]);let R=me.useCallback(o=>{if(!t)return;if(t.coordsAtPos(o)){t.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:d}=t,c=d.doc.resolve(Math.min(o,d.doc.content.size)),g=d.tr.setSelection(prosemirrorState.TextSelection.near(c));t.dispatch(g),t.focus();}},[t]),P=me.useCallback((o,e)=>{if(!t)return;let{state:d}=t,c=d.doc.content.size,g=Math.max(0,Math.min(o,c)),y=Math.max(0,Math.min(e,c)),L=d.tr.setSelection(prosemirrorState.TextSelection.create(d.doc,g,y));t.dispatch(L),t.focus();},[t]),E=me.useCallback(o=>l.getPluginState(o),[l]),K=me.useCallback((o,e)=>{l.setPluginState(o,e);},[l]),U=me.useCallback(()=>{t&&l.updateStates(t);},[t,l]);me.useImperativeHandle(p,()=>({getPluginState:E,setPluginState:K,getEditorView:()=>t,refreshPluginStates:U}),[E,K,t,U]);let W=me.useMemo(()=>{let o=[];for(let e of i)e.proseMirrorPlugins&&o.push(...e.proseMirrorPlugins);return o},[i]),_=me.useCallback(o=>{h(e=>{let d=new Set(e);return d.has(o)?d.delete(o):d.add(o),d});},[]),[A,F]=me.useState(null);me.useEffect(()=>{if(!a){F(null);return}let o=()=>{let c=a.pagesContainer,g=c.querySelector(".layout-page");if(!g){F(null);return}let y=a.getContainerOffset(),L=g.getBoundingClientRect(),Y=c.getBoundingClientRect(),G=(L.right-Y.left)/a.zoom,xe=y.x+G+5;F(xe);};o();let e=()=>{requestAnimationFrame(o);};window.addEventListener("resize",e);let d=new ResizeObserver(()=>{requestAnimationFrame(o);});return d.observe(a.pagesContainer),()=>{window.removeEventListener("resize",e),d.disconnect();}},[a]);let Z=me.useMemo(()=>{let o=[];if(a){for(let e of i)if(e.renderOverlay){let d=x.states.get(e.id);o.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":e.id,children:e.renderOverlay(a,d,t)},`overlay-${e.id}`));}}for(let e of i){if(!e.Panel||(e.panelConfig?.position??"right")!=="right")continue;let c={...$,...e.panelConfig},g=T.has(e.id),y=v.get(e.id)??c.defaultSize,L=e.Panel,Y=x.states.get(e.id),G=A!==null?`${A}px`:"calc(50% + 428px)";o.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${g?"collapsed":""}`,style:{width:g?"32px":`${y}px`,left:G},"data-plugin-id":e.id,children:[c.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>_(e.id),title:g?`Show ${e.name}`:`Hide ${e.name}`,"aria-label":g?`Show ${e.name}`:`Hide ${e.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:g?"\u2039":"\u203A"})}),!g&&a&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(L,{editorView:t,doc:t?.state.doc??null,scrollToPosition:R,selectRange:P,pluginState:Y,panelWidth:y,renderedDomContext:a})})]},`panel-overlay-${e.id}`));}return o.length>0?o:null},[a,i,x.version,t,T,v,R,P,_,A]),j=me.useMemo(()=>{let o=[];for(let e of i){if(!e.getSidebarItems)continue;let d=x.states.get(e.id),c={editorView:t,renderedDomContext:a,anchorPositions:new Map,zoom:a?.zoom??1},g=e.getSidebarItems(d,c);o.push(...g);}return o},[i,x.version,t,a]),B=me.useCallback(o=>{u(o);let e=m.current?.onRenderedDomContextReady;typeof e=="function"&&e(o);},[]),be=me.useMemo(()=>me.cloneElement(s,{externalPlugins:W,pluginOverlays:Z,pluginSidebarItems:j,pluginRenderedDomContext:a,onRenderedDomContextReady:B,onEditorViewReady:o=>{f(o);let e=m.current?.onEditorViewReady;typeof e=="function"&&e(o);}}),[s,W,Z,j,a,B]),O=me.useMemo(()=>{let o=[],e=[],d=[];for(let c of i){if(!c.Panel)continue;let g=c.panelConfig?.position??"right";g==="left"?o.push(c):g==="bottom"?d.push(c):e.push(c);}return {left:o,right:e,bottom:d}},[i]),X=o=>{if(!o.Panel)return null;let e={...$,...o.panelConfig},d=T.has(o.id),c=v.get(o.id)??e.defaultSize,g=o.Panel,y=x.states.get(o.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${e.position} ${d?"collapsed":""}`,style:{[e.position==="bottom"?"height":"width"]:d?"32px":`${c}px`,minWidth:e.position!=="bottom"?d?"32px":`${e.minSize}px`:void 0,maxWidth:e.position!=="bottom"?`${e.maxSize}px`:void 0,minHeight:e.position==="bottom"?d?"32px":`${e.minSize}px`:void 0,maxHeight:e.position==="bottom"?`${e.maxSize}px`:void 0},"data-plugin-id":o.id,children:[e.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>_(o.id),title:d?`Show ${o.name}`:`Hide ${o.name}`,"aria-label":d?`Show ${o.name}`:`Hide ${o.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:d?"\u203A":"\u2039"}),d&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:o.name})]}),!d&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(g,{editorView:t,doc:t?.state.doc??null,scrollToPosition:R,selectRange:P,pluginState:y,panelWidth:c,renderedDomContext:a??null})})]},o.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${r}`,children:[O.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:O.left.map(X)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[be,O.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:O.bottom.map(X)})]})]})});var oe=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,b=new prosemirrorState.PluginKey("template");function He(n,i,s){return `${n}:${i}:${s}`}function ie(n){let i=[];n.descendants((a,u)=>(a.isText&&a.text&&i.push({text:a.text,pos:u}),true));let s="",r=[];for(let a of i){for(let u=0;u<a.text.length;u++)r.push(a.pos+u);s+=a.text;}let p=[],t=[],f=new Map,m;for(oe.lastIndex=0;(m=oe.exec(s))!==null;){let[a,u,l]=m,x=r[m.index],T=r[m.index+a.length-1]+1,h;u==="#"?h="sectionStart":u==="/"?h="sectionEnd":u==="^"?h="invertedStart":u==="@"?h="raw":h="variable";let v=`${h}:${l}`,R=f.get(v)??0;f.set(v,R+1);let P={id:He(h,l,R),type:h,name:l,rawTag:a,from:x,to:T};if(h==="sectionStart"||h==="invertedStart")P.nestedVars=[],t.push(P);else if(h==="sectionEnd"){for(let E=t.length-1;E>=0;E--)if(t[E].name===l){t.splice(E,1);break}}else h==="variable"&&t.length>0&&(t[t.length-1].nestedVars?.push(l),P.insideSection=true);p.push(P);}return p}function Me(n){switch(n){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function q(n,i,s,r){let p=[];for(let t of i){let f=t.id===s,m=t.id===r,a=Me(t.type),u=["docx-template-tag"];f&&u.push("hovered"),m&&u.push("selected"),p.push(prosemirrorView.Decoration.inline(t.from,t.to,{class:u.join(" "),"data-tag-id":t.id,style:`background-color: ${a}22; border-radius: 2px;`},{noOverlay:true}));}return prosemirrorView.DecorationSet.create(n,p)}function ke(n,i){if(n.length!==i.length)return false;for(let s=0;s<n.length;s++)if(n[s].id!==i[s].id)return false;return true}function N(){return new prosemirrorState.Plugin({key:b,state:{init(n,i){let s=ie(i.doc);return {tags:s,decorations:q(i.doc,s)}},apply(n,i,s,r){if(n.docChanged){let t=ie(r.doc),f=ke(i.tags,t);return {tags:t,decorations:f?i.decorations.map(n.mapping,n.doc):q(r.doc,t,i.hoveredId,i.selectedId),hoveredId:i.hoveredId,selectedId:i.selectedId}}let p=n.getMeta(b);if(p){let t=p.hoveredId??i.hoveredId,f=p.selectedId??i.selectedId;return {...i,hoveredId:t,selectedId:f,decorations:q(r.doc,i.tags,t,f)}}return {...i,decorations:i.decorations.map(n.mapping,n.doc)}}},props:{decorations(n){return b.getState(n)?.decorations??prosemirrorView.DecorationSet.empty},handleClick(n,i){let r=(b.getState(n.state)?.tags??[]).find(t=>i>=t.from&&i<=t.to);return r?(n.dispatch(n.state.tr.setMeta(b,{selectedId:r.id})),true):(b.getState(n.state)?.selectedId&&n.dispatch(n.state.tr.setMeta(b,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(n,i){let r=i.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,p=b.getState(n.state)?.hoveredId;return r!==p&&n.dispatch(n.state.tr.setMeta(b,{hoveredId:r})),false},mouseout(n,i){return i.relatedTarget?.closest?.("[data-tag-id]")||b.getState(n.state)?.hoveredId&&n.dispatch(n.state.tr.setMeta(b,{hoveredId:void 0})),false}}}})}function ae(n){return b.getState(n)?.tags??[]}function z(n,i){n.dispatch(n.state.tr.setMeta(b,{hoveredId:i}));}function D(n,i){n.dispatch(n.state.tr.setMeta(b,{selectedId:i}));}var V=`
|
|
150
|
-
.docx-template-tag {
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
transition: background-color 0.1s;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.docx-template-tag:hover,
|
|
156
|
-
.docx-template-tag.hovered {
|
|
157
|
-
filter: brightness(0.95);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.docx-template-tag.selected {
|
|
161
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
162
|
-
}
|
|
163
|
-
`;var Ne={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)"},De={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 de({context:n,tags:i,hoveredId:s,selectedId:r,onHover:p,onSelect:t}){let[f,m]=me.useState(0),a=me.useCallback(()=>{let l=n.getContainerOffset(),x=[];for(let T of i){let h=n.getRectsForRange(T.from,T.to);for(let v of h)x.push({tagId:T.id,tagType:T.type,x:v.x+l.x,y:v.y+l.y,width:v.width,height:v.height});}return x},[n,i]),u=me.useMemo(()=>a(),[a,f]);return me.useEffect(()=>{let l=()=>{requestAnimationFrame(()=>m(x=>x+1));};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),me.useEffect(()=>{let l=new ResizeObserver(()=>{requestAnimationFrame(()=>m(x=>x+1));});return l.observe(n.pagesContainer),()=>l.disconnect()},[n.pagesContainer]),u.length===0?null:jsxRuntime.jsx("div",{className:"template-highlight-overlay",children:u.map((l,x)=>{let T=l.tagId===s,h=l.tagId===r,v=T||h?De[l.tagType]:Ne[l.tagType];return jsxRuntime.jsx("div",{className:`template-highlight ${T?"hovered":""} ${h?"selected":""}`,style:{position:"absolute",left:l.x,top:l.y,width:l.width,height:l.height,backgroundColor:v,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>p?.(l.tagId),onMouseLeave:()=>p?.(void 0),onClick:()=>t?.(l.tagId)},`${l.tagId}-${x}`)})})}var pe=`
|
|
164
|
-
.template-highlight-overlay {
|
|
165
|
-
position: absolute;
|
|
166
|
-
top: 0;
|
|
167
|
-
left: 0;
|
|
168
|
-
right: 0;
|
|
169
|
-
bottom: 0;
|
|
170
|
-
pointer-events: none;
|
|
171
|
-
overflow: visible;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.template-highlight {
|
|
175
|
-
pointer-events: auto;
|
|
176
|
-
transition: background-color 0.1s ease;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.template-highlight:hover,
|
|
180
|
-
.template-highlight.hovered {
|
|
181
|
-
filter: brightness(0.9);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.template-highlight.selected {
|
|
185
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
|
|
186
|
-
}
|
|
187
|
-
`;var Ve={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function _e(n){switch(n){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}var ge=`
|
|
188
|
-
.template-annotation-chip {
|
|
189
|
-
display: inline-flex;
|
|
190
|
-
flex-wrap: wrap;
|
|
191
|
-
align-items: center;
|
|
192
|
-
gap: 4px;
|
|
193
|
-
padding: 5px 10px;
|
|
194
|
-
background: white;
|
|
195
|
-
border: 1px solid #e2e8f0;
|
|
196
|
-
border-left: 3px solid #6c757d;
|
|
197
|
-
border-radius: 4px;
|
|
198
|
-
font-size: 11px;
|
|
199
|
-
cursor: pointer;
|
|
200
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
201
|
-
max-width: 200px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.template-annotation-chip:hover,
|
|
205
|
-
.template-annotation-chip.hovered {
|
|
206
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
207
|
-
border-color: #cbd5e1;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.template-annotation-chip.selected {
|
|
211
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.template-chip-badge {
|
|
215
|
-
font-size: 9px;
|
|
216
|
-
font-weight: 600;
|
|
217
|
-
padding: 1px 5px;
|
|
218
|
-
border-radius: 3px;
|
|
219
|
-
color: white;
|
|
220
|
-
text-transform: uppercase;
|
|
221
|
-
letter-spacing: 0.3px;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.template-chip-dot {
|
|
225
|
-
font-size: 8px;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.template-chip-name {
|
|
229
|
-
color: #334155;
|
|
230
|
-
font-weight: 500;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.template-chip-nested {
|
|
234
|
-
display: flex;
|
|
235
|
-
flex-wrap: wrap;
|
|
236
|
-
gap: 4px;
|
|
237
|
-
width: 100%;
|
|
238
|
-
margin-top: 4px;
|
|
239
|
-
padding-top: 4px;
|
|
240
|
-
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.template-nested-var {
|
|
244
|
-
font-size: 10px;
|
|
245
|
-
color: #64748b;
|
|
246
|
-
background: rgba(0, 0, 0, 0.04);
|
|
247
|
-
padding: 2px 6px;
|
|
248
|
-
border-radius: 3px;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.template-nested-var:hover {
|
|
252
|
-
background: rgba(59, 130, 246, 0.15);
|
|
253
|
-
color: #1e40af;
|
|
254
|
-
}
|
|
255
|
-
`;function ue({tag:n,isHovered:i,measureRef:s,onHover:r,onSelect:p}){let t=_e(n.type),f=Ve[n.type],m=n.type==="sectionStart"||n.type==="invertedStart";return jsxRuntime.jsxs("div",{ref:s,style:{display:"flex",alignItems:"flex-start"},children:[jsxRuntime.jsx("div",{style:{width:20,height:1,background:i?"#3b82f6":"#d0d0d0",marginTop:12,marginRight:4,flexShrink:0}}),jsxRuntime.jsxs("div",{className:`template-annotation-chip ${i?"hovered":""}`,style:{borderLeftColor:f},onMouseEnter:()=>r(n.id),onMouseLeave:()=>r(void 0),onClick:a=>{a.stopPropagation(),p(n.id);},onMouseDown:a=>a.stopPropagation(),title:m?`${n.rawTag}
|
|
256
|
-
Iterates over ${n.name}[]. Access nested properties via ${n.name}.property`:n.rawTag,children:[t&&jsxRuntime.jsx("span",{className:"template-chip-badge",style:{background:f},children:t}),!t&&jsxRuntime.jsx("span",{className:"template-chip-dot",style:{color:f},children:"\u25CF"}),jsxRuntime.jsx("span",{className:"template-chip-name",children:n.name}),m&&n.nestedVars&&n.nestedVars.length>0&&jsxRuntime.jsx("div",{className:"template-chip-nested",children:n.nestedVars.map((a,u)=>jsxRuntime.jsx("span",{className:"template-nested-var",title:`Access: ${n.name}.${a}`,children:a.includes(".")?a.split(".").pop():a},u))})]})]})}function fe(n,i,s){if(!n)return;D(n,s);let r=i.find(p=>p.id===s);if(r){let p=n.state.tr.setSelection(prosemirrorState.TextSelection.near(n.state.doc.resolve(r.from)));n.dispatch(p),n.focus();}}function he(n={}){return {id:"template",name:"Template",proseMirrorPlugins:[N()],onStateChange:s=>{let r=b.getState(s.state);if(r)return {tags:r.tags,hoveredId:r.hoveredId,selectedId:r.selectedId}},initialize:s=>({tags:[]}),getSidebarItems:(s,r)=>!s||s.tags.length===0?[]:s.tags.filter(t=>t.type!=="sectionEnd"&&!t.insideSection).map(t=>({id:`template-${t.id}`,anchorPos:t.from,priority:10,estimatedHeight:32,render:f=>me__default.default.createElement(ue,{...f,tag:t,isHovered:t.id===s.hoveredId,onHover:m=>{r.editorView&&z(r.editorView,m);},onSelect:m=>fe(r.editorView,s.tags,m)})})),renderOverlay:(s,r,p)=>!r||r.tags.length===0?null:me__default.default.createElement(de,{context:s,tags:r.tags,hoveredId:r.hoveredId,selectedId:r.selectedId,onHover:t=>{p&&z(p,t);},onSelect:t=>fe(p,r.tags,t)}),styles:`
|
|
257
|
-
${V}
|
|
258
|
-
${ge}
|
|
259
|
-
${pe}
|
|
260
|
-
`}}var Fe=he();Object.defineProperty(exports,"RenderedDomContextImpl",{enumerable:true,get:function(){return chunk2XXILKEQ_js.a}});Object.defineProperty(exports,"createRenderedDomContext",{enumerable:true,get:function(){return chunk2XXILKEQ_js.b}});exports.PLUGIN_HOST_STYLES=ne;exports.PluginHost=Re;exports.TEMPLATE_DECORATION_STYLES=V;exports.createTemplatePlugin=he;exports.createTemplateProseMirrorPlugin=N;exports.getTemplatePluginTags=ae;exports.setHoveredElement=z;exports.setSelectedElement=D;exports.templatePlugin=Fe;exports.templatePluginKey=b;
|
|
1
|
+
'use strict';var chunkSGTUE33R_js=require('./chunk-SGTUE33R.js'),chunk2XXILKEQ_js=require('./chunk-2XXILKEQ.js');require('./chunk-YBEVHQCT.js'),require('./chunk-HXDMASAR.js'),require('./chunk-IFPN3NT3.js'),require('./chunk-B45ECEGY.js'),require('./chunk-GGQK26JO.js'),require('./chunk-ZXPCJWVY.js'),require('./chunk-ILYKDR3C.js'),require('./chunk-ESZ6JRTW.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"PLUGIN_HOST_STYLES",{enumerable:true,get:function(){return chunkSGTUE33R_js.a}});Object.defineProperty(exports,"PluginHost",{enumerable:true,get:function(){return chunkSGTUE33R_js.b}});Object.defineProperty(exports,"TEMPLATE_DECORATION_STYLES",{enumerable:true,get:function(){return chunkSGTUE33R_js.h}});Object.defineProperty(exports,"createTemplatePlugin",{enumerable:true,get:function(){return chunkSGTUE33R_js.i}});Object.defineProperty(exports,"createTemplateProseMirrorPlugin",{enumerable:true,get:function(){return chunkSGTUE33R_js.d}});Object.defineProperty(exports,"getTemplatePluginTags",{enumerable:true,get:function(){return chunkSGTUE33R_js.e}});Object.defineProperty(exports,"setHoveredElement",{enumerable:true,get:function(){return chunkSGTUE33R_js.f}});Object.defineProperty(exports,"setSelectedElement",{enumerable:true,get:function(){return chunkSGTUE33R_js.g}});Object.defineProperty(exports,"templatePlugin",{enumerable:true,get:function(){return chunkSGTUE33R_js.j}});Object.defineProperty(exports,"templatePluginKey",{enumerable:true,get:function(){return chunkSGTUE33R_js.c}});Object.defineProperty(exports,"RenderedDomContextImpl",{enumerable:true,get:function(){return chunk2XXILKEQ_js.a}});Object.defineProperty(exports,"createRenderedDomContext",{enumerable:true,get:function(){return chunk2XXILKEQ_js.b}});
|
package/dist/plugin-api.mjs
CHANGED
|
@@ -1,260 +1 @@
|
|
|
1
|
-
export{a as
|
|
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
|
-
`,Re=forwardRef(function({plugins:i,children:s$1,className:r=""},p){let[t,f]=useState(null),m=useRef(s$1.props);m.current=s$1.props;let[a,u]=useState(null),l=useMemo(()=>new s,[]),x=useSyncExternalStore(l.subscribe,l.getSnapshot),[T,h]=useState(()=>{let o=new Set;for(let e of i)({...$,...e.panelConfig}).defaultCollapsed&&o.add(e.id);return o}),[v]=useState(()=>{let o=new Map;for(let e of i){let d={...$,...e.panelConfig};o.set(e.id,d.defaultSize);}return o});useEffect(()=>{if(!t)return;let o=i.map(e=>({id:e.id,styles:e.styles,initialize:e.initialize,onStateChange:e.onStateChange,destroy:e.destroy}));return l.initialize(o,t),()=>{l.destroy();}},[l,t,i]),useEffect(()=>{let o=i.filter(e=>e.styles).map(e=>te(e.id,e.styles));return ()=>o.forEach(e=>e())},[i]),useEffect(()=>{if(!t?.dom)return;let o=()=>{l.updateStates(t);},e=null,d=()=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(o);};o();let c=t.dom;c.addEventListener("input",d),c.addEventListener("focus",o),c.addEventListener("click",o);let g=t.dispatch.bind(t);return t.dispatch=y=>{g(y),d();},()=>{c.removeEventListener("input",d),c.removeEventListener("focus",o),c.removeEventListener("click",o),e&&cancelAnimationFrame(e),t.dispatch=g;}},[t,l]),useEffect(()=>te("plugin-host-base",ne),[]);let R=useCallback(o=>{if(!t)return;if(t.coordsAtPos(o)){t.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:d}=t,c=d.doc.resolve(Math.min(o,d.doc.content.size)),g=d.tr.setSelection(TextSelection.near(c));t.dispatch(g),t.focus();}},[t]),P=useCallback((o,e)=>{if(!t)return;let{state:d}=t,c=d.doc.content.size,g=Math.max(0,Math.min(o,c)),y=Math.max(0,Math.min(e,c)),L=d.tr.setSelection(TextSelection.create(d.doc,g,y));t.dispatch(L),t.focus();},[t]),E=useCallback(o=>l.getPluginState(o),[l]),K=useCallback((o,e)=>{l.setPluginState(o,e);},[l]),U=useCallback(()=>{t&&l.updateStates(t);},[t,l]);useImperativeHandle(p,()=>({getPluginState:E,setPluginState:K,getEditorView:()=>t,refreshPluginStates:U}),[E,K,t,U]);let W=useMemo(()=>{let o=[];for(let e of i)e.proseMirrorPlugins&&o.push(...e.proseMirrorPlugins);return o},[i]),_=useCallback(o=>{h(e=>{let d=new Set(e);return d.has(o)?d.delete(o):d.add(o),d});},[]),[A,F]=useState(null);useEffect(()=>{if(!a){F(null);return}let o=()=>{let c=a.pagesContainer,g=c.querySelector(".layout-page");if(!g){F(null);return}let y=a.getContainerOffset(),L=g.getBoundingClientRect(),Y=c.getBoundingClientRect(),G=(L.right-Y.left)/a.zoom,xe=y.x+G+5;F(xe);};o();let e=()=>{requestAnimationFrame(o);};window.addEventListener("resize",e);let d=new ResizeObserver(()=>{requestAnimationFrame(o);});return d.observe(a.pagesContainer),()=>{window.removeEventListener("resize",e),d.disconnect();}},[a]);let Z=useMemo(()=>{let o=[];if(a){for(let e of i)if(e.renderOverlay){let d=x.states.get(e.id);o.push(jsx("div",{className:"plugin-overlay","data-plugin-id":e.id,children:e.renderOverlay(a,d,t)},`overlay-${e.id}`));}}for(let e of i){if(!e.Panel||(e.panelConfig?.position??"right")!=="right")continue;let c={...$,...e.panelConfig},g=T.has(e.id),y=v.get(e.id)??c.defaultSize,L=e.Panel,Y=x.states.get(e.id),G=A!==null?`${A}px`:"calc(50% + 428px)";o.push(jsxs("div",{className:`plugin-panel-in-viewport ${g?"collapsed":""}`,style:{width:g?"32px":`${y}px`,left:G},"data-plugin-id":e.id,children:[c.collapsible&&jsx("button",{className:"plugin-panel-toggle",onClick:()=>_(e.id),title:g?`Show ${e.name}`:`Hide ${e.name}`,"aria-label":g?`Show ${e.name}`:`Hide ${e.name}`,children:jsx("span",{className:"plugin-panel-toggle-icon",children:g?"\u2039":"\u203A"})}),!g&&a&&jsx("div",{className:"plugin-panel-in-viewport-content",children:jsx(L,{editorView:t,doc:t?.state.doc??null,scrollToPosition:R,selectRange:P,pluginState:Y,panelWidth:y,renderedDomContext:a})})]},`panel-overlay-${e.id}`));}return o.length>0?o:null},[a,i,x.version,t,T,v,R,P,_,A]),j=useMemo(()=>{let o=[];for(let e of i){if(!e.getSidebarItems)continue;let d=x.states.get(e.id),c={editorView:t,renderedDomContext:a,anchorPositions:new Map,zoom:a?.zoom??1},g=e.getSidebarItems(d,c);o.push(...g);}return o},[i,x.version,t,a]),B=useCallback(o=>{u(o);let e=m.current?.onRenderedDomContextReady;typeof e=="function"&&e(o);},[]),be=useMemo(()=>cloneElement(s$1,{externalPlugins:W,pluginOverlays:Z,pluginSidebarItems:j,pluginRenderedDomContext:a,onRenderedDomContextReady:B,onEditorViewReady:o=>{f(o);let e=m.current?.onEditorViewReady;typeof e=="function"&&e(o);}}),[s$1,W,Z,j,a,B]),O=useMemo(()=>{let o=[],e=[],d=[];for(let c of i){if(!c.Panel)continue;let g=c.panelConfig?.position??"right";g==="left"?o.push(c):g==="bottom"?d.push(c):e.push(c);}return {left:o,right:e,bottom:d}},[i]),X=o=>{if(!o.Panel)return null;let e={...$,...o.panelConfig},d=T.has(o.id),c=v.get(o.id)??e.defaultSize,g=o.Panel,y=x.states.get(o.id);return jsxs("div",{className:`plugin-panel plugin-panel-${e.position} ${d?"collapsed":""}`,style:{[e.position==="bottom"?"height":"width"]:d?"32px":`${c}px`,minWidth:e.position!=="bottom"?d?"32px":`${e.minSize}px`:void 0,maxWidth:e.position!=="bottom"?`${e.maxSize}px`:void 0,minHeight:e.position==="bottom"?d?"32px":`${e.minSize}px`:void 0,maxHeight:e.position==="bottom"?`${e.maxSize}px`:void 0},"data-plugin-id":o.id,children:[e.collapsible&&jsxs("button",{className:"plugin-panel-toggle",onClick:()=>_(o.id),title:d?`Show ${o.name}`:`Hide ${o.name}`,"aria-label":d?`Show ${o.name}`:`Hide ${o.name}`,children:[jsx("span",{className:"plugin-panel-toggle-icon",children:d?"\u203A":"\u2039"}),d&&jsx("span",{className:"plugin-panel-toggle-label",children:o.name})]}),!d&&jsx("div",{className:"plugin-panel-content",children:jsx(g,{editorView:t,doc:t?.state.doc??null,scrollToPosition:R,selectRange:P,pluginState:y,panelWidth:c,renderedDomContext:a??null})})]},o.id)};return jsxs("div",{className:`plugin-host ${r}`,children:[O.left.length>0&&jsx("div",{className:"plugin-panels-left",children:O.left.map(X)}),jsxs("div",{className:"plugin-host-editor",children:[be,O.bottom.length>0&&jsx("div",{className:"plugin-panels-bottom",children:O.bottom.map(X)})]})]})});var oe=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,b=new PluginKey("template");function He(n,i,s){return `${n}:${i}:${s}`}function ie(n){let i=[];n.descendants((a,u)=>(a.isText&&a.text&&i.push({text:a.text,pos:u}),true));let s="",r=[];for(let a of i){for(let u=0;u<a.text.length;u++)r.push(a.pos+u);s+=a.text;}let p=[],t=[],f=new Map,m;for(oe.lastIndex=0;(m=oe.exec(s))!==null;){let[a,u,l]=m,x=r[m.index],T=r[m.index+a.length-1]+1,h;u==="#"?h="sectionStart":u==="/"?h="sectionEnd":u==="^"?h="invertedStart":u==="@"?h="raw":h="variable";let v=`${h}:${l}`,R=f.get(v)??0;f.set(v,R+1);let P={id:He(h,l,R),type:h,name:l,rawTag:a,from:x,to:T};if(h==="sectionStart"||h==="invertedStart")P.nestedVars=[],t.push(P);else if(h==="sectionEnd"){for(let E=t.length-1;E>=0;E--)if(t[E].name===l){t.splice(E,1);break}}else h==="variable"&&t.length>0&&(t[t.length-1].nestedVars?.push(l),P.insideSection=true);p.push(P);}return p}function Me(n){switch(n){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function q(n,i,s,r){let p=[];for(let t of i){let f=t.id===s,m=t.id===r,a=Me(t.type),u=["docx-template-tag"];f&&u.push("hovered"),m&&u.push("selected"),p.push(Decoration.inline(t.from,t.to,{class:u.join(" "),"data-tag-id":t.id,style:`background-color: ${a}22; border-radius: 2px;`},{noOverlay:true}));}return DecorationSet.create(n,p)}function ke(n,i){if(n.length!==i.length)return false;for(let s=0;s<n.length;s++)if(n[s].id!==i[s].id)return false;return true}function N(){return new Plugin({key:b,state:{init(n,i){let s=ie(i.doc);return {tags:s,decorations:q(i.doc,s)}},apply(n,i,s,r){if(n.docChanged){let t=ie(r.doc),f=ke(i.tags,t);return {tags:t,decorations:f?i.decorations.map(n.mapping,n.doc):q(r.doc,t,i.hoveredId,i.selectedId),hoveredId:i.hoveredId,selectedId:i.selectedId}}let p=n.getMeta(b);if(p){let t=p.hoveredId??i.hoveredId,f=p.selectedId??i.selectedId;return {...i,hoveredId:t,selectedId:f,decorations:q(r.doc,i.tags,t,f)}}return {...i,decorations:i.decorations.map(n.mapping,n.doc)}}},props:{decorations(n){return b.getState(n)?.decorations??DecorationSet.empty},handleClick(n,i){let r=(b.getState(n.state)?.tags??[]).find(t=>i>=t.from&&i<=t.to);return r?(n.dispatch(n.state.tr.setMeta(b,{selectedId:r.id})),true):(b.getState(n.state)?.selectedId&&n.dispatch(n.state.tr.setMeta(b,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(n,i){let r=i.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,p=b.getState(n.state)?.hoveredId;return r!==p&&n.dispatch(n.state.tr.setMeta(b,{hoveredId:r})),false},mouseout(n,i){return i.relatedTarget?.closest?.("[data-tag-id]")||b.getState(n.state)?.hoveredId&&n.dispatch(n.state.tr.setMeta(b,{hoveredId:void 0})),false}}}})}function ae(n){return b.getState(n)?.tags??[]}function z(n,i){n.dispatch(n.state.tr.setMeta(b,{hoveredId:i}));}function D(n,i){n.dispatch(n.state.tr.setMeta(b,{selectedId:i}));}var V=`
|
|
150
|
-
.docx-template-tag {
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
transition: background-color 0.1s;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.docx-template-tag:hover,
|
|
156
|
-
.docx-template-tag.hovered {
|
|
157
|
-
filter: brightness(0.95);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.docx-template-tag.selected {
|
|
161
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
162
|
-
}
|
|
163
|
-
`;var Ne={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)"},De={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 de({context:n,tags:i,hoveredId:s,selectedId:r,onHover:p,onSelect:t}){let[f,m]=useState(0),a=useCallback(()=>{let l=n.getContainerOffset(),x=[];for(let T of i){let h=n.getRectsForRange(T.from,T.to);for(let v of h)x.push({tagId:T.id,tagType:T.type,x:v.x+l.x,y:v.y+l.y,width:v.width,height:v.height});}return x},[n,i]),u=useMemo(()=>a(),[a,f]);return useEffect(()=>{let l=()=>{requestAnimationFrame(()=>m(x=>x+1));};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),useEffect(()=>{let l=new ResizeObserver(()=>{requestAnimationFrame(()=>m(x=>x+1));});return l.observe(n.pagesContainer),()=>l.disconnect()},[n.pagesContainer]),u.length===0?null:jsx("div",{className:"template-highlight-overlay",children:u.map((l,x)=>{let T=l.tagId===s,h=l.tagId===r,v=T||h?De[l.tagType]:Ne[l.tagType];return jsx("div",{className:`template-highlight ${T?"hovered":""} ${h?"selected":""}`,style:{position:"absolute",left:l.x,top:l.y,width:l.width,height:l.height,backgroundColor:v,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>p?.(l.tagId),onMouseLeave:()=>p?.(void 0),onClick:()=>t?.(l.tagId)},`${l.tagId}-${x}`)})})}var pe=`
|
|
164
|
-
.template-highlight-overlay {
|
|
165
|
-
position: absolute;
|
|
166
|
-
top: 0;
|
|
167
|
-
left: 0;
|
|
168
|
-
right: 0;
|
|
169
|
-
bottom: 0;
|
|
170
|
-
pointer-events: none;
|
|
171
|
-
overflow: visible;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.template-highlight {
|
|
175
|
-
pointer-events: auto;
|
|
176
|
-
transition: background-color 0.1s ease;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.template-highlight:hover,
|
|
180
|
-
.template-highlight.hovered {
|
|
181
|
-
filter: brightness(0.9);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.template-highlight.selected {
|
|
185
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
|
|
186
|
-
}
|
|
187
|
-
`;var Ve={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function _e(n){switch(n){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}var ge=`
|
|
188
|
-
.template-annotation-chip {
|
|
189
|
-
display: inline-flex;
|
|
190
|
-
flex-wrap: wrap;
|
|
191
|
-
align-items: center;
|
|
192
|
-
gap: 4px;
|
|
193
|
-
padding: 5px 10px;
|
|
194
|
-
background: white;
|
|
195
|
-
border: 1px solid #e2e8f0;
|
|
196
|
-
border-left: 3px solid #6c757d;
|
|
197
|
-
border-radius: 4px;
|
|
198
|
-
font-size: 11px;
|
|
199
|
-
cursor: pointer;
|
|
200
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
201
|
-
max-width: 200px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.template-annotation-chip:hover,
|
|
205
|
-
.template-annotation-chip.hovered {
|
|
206
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
207
|
-
border-color: #cbd5e1;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.template-annotation-chip.selected {
|
|
211
|
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.template-chip-badge {
|
|
215
|
-
font-size: 9px;
|
|
216
|
-
font-weight: 600;
|
|
217
|
-
padding: 1px 5px;
|
|
218
|
-
border-radius: 3px;
|
|
219
|
-
color: white;
|
|
220
|
-
text-transform: uppercase;
|
|
221
|
-
letter-spacing: 0.3px;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.template-chip-dot {
|
|
225
|
-
font-size: 8px;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.template-chip-name {
|
|
229
|
-
color: #334155;
|
|
230
|
-
font-weight: 500;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.template-chip-nested {
|
|
234
|
-
display: flex;
|
|
235
|
-
flex-wrap: wrap;
|
|
236
|
-
gap: 4px;
|
|
237
|
-
width: 100%;
|
|
238
|
-
margin-top: 4px;
|
|
239
|
-
padding-top: 4px;
|
|
240
|
-
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.template-nested-var {
|
|
244
|
-
font-size: 10px;
|
|
245
|
-
color: #64748b;
|
|
246
|
-
background: rgba(0, 0, 0, 0.04);
|
|
247
|
-
padding: 2px 6px;
|
|
248
|
-
border-radius: 3px;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.template-nested-var:hover {
|
|
252
|
-
background: rgba(59, 130, 246, 0.15);
|
|
253
|
-
color: #1e40af;
|
|
254
|
-
}
|
|
255
|
-
`;function ue({tag:n,isHovered:i,measureRef:s,onHover:r,onSelect:p}){let t=_e(n.type),f=Ve[n.type],m=n.type==="sectionStart"||n.type==="invertedStart";return jsxs("div",{ref:s,style:{display:"flex",alignItems:"flex-start"},children:[jsx("div",{style:{width:20,height:1,background:i?"#3b82f6":"#d0d0d0",marginTop:12,marginRight:4,flexShrink:0}}),jsxs("div",{className:`template-annotation-chip ${i?"hovered":""}`,style:{borderLeftColor:f},onMouseEnter:()=>r(n.id),onMouseLeave:()=>r(void 0),onClick:a=>{a.stopPropagation(),p(n.id);},onMouseDown:a=>a.stopPropagation(),title:m?`${n.rawTag}
|
|
256
|
-
Iterates over ${n.name}[]. Access nested properties via ${n.name}.property`:n.rawTag,children:[t&&jsx("span",{className:"template-chip-badge",style:{background:f},children:t}),!t&&jsx("span",{className:"template-chip-dot",style:{color:f},children:"\u25CF"}),jsx("span",{className:"template-chip-name",children:n.name}),m&&n.nestedVars&&n.nestedVars.length>0&&jsx("div",{className:"template-chip-nested",children:n.nestedVars.map((a,u)=>jsx("span",{className:"template-nested-var",title:`Access: ${n.name}.${a}`,children:a.includes(".")?a.split(".").pop():a},u))})]})]})}function fe(n,i,s){if(!n)return;D(n,s);let r=i.find(p=>p.id===s);if(r){let p=n.state.tr.setSelection(TextSelection.near(n.state.doc.resolve(r.from)));n.dispatch(p),n.focus();}}function he(n={}){return {id:"template",name:"Template",proseMirrorPlugins:[N()],onStateChange:s=>{let r=b.getState(s.state);if(r)return {tags:r.tags,hoveredId:r.hoveredId,selectedId:r.selectedId}},initialize:s=>({tags:[]}),getSidebarItems:(s,r)=>!s||s.tags.length===0?[]:s.tags.filter(t=>t.type!=="sectionEnd"&&!t.insideSection).map(t=>({id:`template-${t.id}`,anchorPos:t.from,priority:10,estimatedHeight:32,render:f=>me.createElement(ue,{...f,tag:t,isHovered:t.id===s.hoveredId,onHover:m=>{r.editorView&&z(r.editorView,m);},onSelect:m=>fe(r.editorView,s.tags,m)})})),renderOverlay:(s,r,p)=>!r||r.tags.length===0?null:me.createElement(de,{context:s,tags:r.tags,hoveredId:r.hoveredId,selectedId:r.selectedId,onHover:t=>{p&&z(p,t);},onSelect:t=>fe(p,r.tags,t)}),styles:`
|
|
257
|
-
${V}
|
|
258
|
-
${ge}
|
|
259
|
-
${pe}
|
|
260
|
-
`}}var Fe=he();export{ne as PLUGIN_HOST_STYLES,Re as PluginHost,V as TEMPLATE_DECORATION_STYLES,he as createTemplatePlugin,N as createTemplateProseMirrorPlugin,ae as getTemplatePluginTags,z as setHoveredElement,D as setSelectedElement,Fe as templatePlugin,b as templatePluginKey};
|
|
1
|
+
export{a as PLUGIN_HOST_STYLES,b as PluginHost,h as TEMPLATE_DECORATION_STYLES,i as createTemplatePlugin,d as createTemplateProseMirrorPlugin,e as getTemplatePluginTags,f as setHoveredElement,g as setSelectedElement,j as templatePlugin,c as templatePluginKey}from'./chunk-JFRDFK7V.mjs';export{a as RenderedDomContextImpl,b as createRenderedDomContext}from'./chunk-KOXCF3CL.mjs';import'./chunk-MDTA25AN.mjs';import'./chunk-XGJ2EORY.mjs';import'./chunk-WOHFANC5.mjs';import'./chunk-XQZTWWRF.mjs';import'./chunk-B7CCL7SL.mjs';import'./chunk-ONIYA2FU.mjs';import'./chunk-FWPVBFKQ.mjs';import'./chunk-TZMMD6RR.mjs';import'./chunk-TAUMSKRE.mjs';
|
|
@@ -15,4 +15,4 @@ type DotPath<T, Prefix extends string = ''> = {
|
|
|
15
15
|
}[keyof T & string];
|
|
16
16
|
type TranslationKey = DotPath<LocaleStrings>;
|
|
17
17
|
|
|
18
|
-
export type { LocaleStrings as L, PartialLocaleStrings as P,
|
|
18
|
+
export type { LocaleStrings as L, PartialLocaleStrings as P, TranslationKey as T, Translations as a };
|