@zeke-02/docx-editor 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-C41hiW-n.d.mts +486 -0
- package/dist/agentApi-D4AZmNfB.d.ts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-47VJOBJD.mjs +60 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-AYMGSTNG.js +1 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-E6MQXELR.js +1 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-IP5NAYHL.js +60 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LUJ6HCMH.mjs +1 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-ONNHQWAX.mjs +1 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-DZ_ZeZEH.d.ts +294 -0
- package/dist/document-Di1qGqLS.d.mts +294 -0
- package/dist/executor-EPEB53SJ.js +1 -0
- package/dist/executor-TVJ6K6MW.mjs +1 -0
- package/dist/findReplace-CpIoILbP.d.mts +138 -0
- package/dist/findReplace-pkMskVJU.d.ts +138 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index.d.mts +1013 -483
- package/dist/index.d.ts +1013 -483
- package/dist/index.js +40 -120
- package/dist/index.mjs +40 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +176 -0
- package/dist/plugin-api.d.ts +176 -0
- package/dist/plugin-api.js +260 -0
- package/dist/plugin-api.mjs +260 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-Bd_YzkhG.d.mts +281 -0
- package/dist/types-Bd_YzkhG.d.ts +281 -0
- package/dist/types-CkfDgB0O.d.mts +39 -0
- package/dist/types-DZUhB7Ao.d.mts +18 -0
- package/dist/types-DZUhB7Ao.d.ts +18 -0
- package/dist/types-DcxHFUSc.d.ts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DDs533b-.d.mts +261 -0
- package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
- package/package.json +41 -43
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-7BG7QY7I.js +0 -182
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-KUTCCI4X.mjs +0 -182
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.css +0 -1
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
'use strict';var chunk2XXILKEQ_js=require('./chunk-2XXILKEQ.js'),chunkIP5NAYHL_js=require('./chunk-IP5NAYHL.js');require('./chunk-IFPN3NT3.js'),require('./chunk-B45ECEGY.js'),require('./chunk-GGQK26JO.js'),require('./chunk-ZXPCJWVY.js'),require('./chunk-ESZ6JRTW.js'),require('./chunk-E6MQXELR.js'),require('./chunk-ILYKDR3C.js'),require('./chunk-H5NTJZO4.js');var me=require('react'),prosemirrorState=require('prosemirror-state'),jsxRuntime=require('react/jsx-runtime'),prosemirrorView=require('prosemirror-view');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var me__default=/*#__PURE__*/_interopDefault(me);var $={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},te=chunkIP5NAYHL_js.r,ne=`
|
|
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;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
export{a as RenderedDomContextImpl,b as createRenderedDomContext}from'./chunk-KOXCF3CL.mjs';import {s,r}from'./chunk-47VJOBJD.mjs';import'./chunk-WOHFANC5.mjs';import'./chunk-XQZTWWRF.mjs';import'./chunk-B7CCL7SL.mjs';import'./chunk-ONIYA2FU.mjs';import'./chunk-TZMMD6RR.mjs';import'./chunk-ONNHQWAX.mjs';import'./chunk-FWPVBFKQ.mjs';import'./chunk-TAUMSKRE.mjs';import me,{forwardRef,useState,useRef,useMemo,useSyncExternalStore,useEffect,useCallback,useImperativeHandle,cloneElement}from'react';import {TextSelection,PluginKey,Plugin}from'prosemirror-state';import {jsx,jsxs}from'react/jsx-runtime';import {DecorationSet,Decoration}from'prosemirror-view';var $={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},te=r,ne=`
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkESZ6JRTW_js=require('./chunk-ESZ6JRTW.js');require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunkESZ6JRTW_js.j}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkESZ6JRTW_js.k}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunkESZ6JRTW_js.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkESZ6JRTW_js.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunkESZ6JRTW_js.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkESZ6JRTW_js.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunkESZ6JRTW_js.i}});Object.defineProperty(exports,"processTemplateAndDownload",{enumerable:true,get:function(){return chunkESZ6JRTW_js.d}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkESZ6JRTW_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkESZ6JRTW_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkESZ6JRTW_js.f}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{j as createTemplateProcessor,k as default,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-
|
|
1
|
+
export{j as createTemplateProcessor,k as default,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-TZMMD6RR.mjs';import'./chunk-TAUMSKRE.mjs';
|