@zeng-alt/formkit-form-builder 1.4.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +325 -137
  3. package/dist/builder.css +1 -1
  4. package/dist/builder.es.js +7922 -42834
  5. package/dist/builder.es.js.map +1 -0
  6. package/dist/builder.umd.js +58 -86
  7. package/dist/chunks/AiPrompt-CWUhBDH4.js +174 -0
  8. package/dist/chunks/AiPrompt-CWUhBDH4.js.map +1 -0
  9. package/dist/chunks/BadgeEditor-B1kB2DXg.js +133 -0
  10. package/dist/chunks/BadgeEditor-B1kB2DXg.js.map +1 -0
  11. package/dist/chunks/BuilderPreview-CKL5bqCP.js +142 -0
  12. package/dist/chunks/BuilderPreview-CKL5bqCP.js.map +1 -0
  13. package/dist/chunks/ButtonGroupEditor-C5pChDFz.js +55 -0
  14. package/dist/chunks/ButtonGroupEditor-C5pChDFz.js.map +1 -0
  15. package/dist/chunks/CardEditor-Bsbriwvu.js +61 -0
  16. package/dist/chunks/CardEditor-Bsbriwvu.js.map +1 -0
  17. package/dist/chunks/CheckboxEditor-CxNEvn_Y.js +23 -0
  18. package/dist/chunks/CheckboxEditor-CxNEvn_Y.js.map +1 -0
  19. package/dist/chunks/CollapseEditor-CUFTdj0V.js +36 -0
  20. package/dist/chunks/CollapseEditor-CUFTdj0V.js.map +1 -0
  21. package/dist/chunks/ColorEditor-Bo9QkLsR.js +17 -0
  22. package/dist/chunks/ColorEditor-Bo9QkLsR.js.map +1 -0
  23. package/dist/chunks/DataTableContainerPreview-phlGcigM.js +403 -0
  24. package/dist/chunks/DataTableContainerPreview-phlGcigM.js.map +1 -0
  25. package/dist/chunks/DataTableEditor-BTDWXdtk.js +473 -0
  26. package/dist/chunks/DataTableEditor-BTDWXdtk.js.map +1 -0
  27. package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js +1579 -0
  28. package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js.map +1 -0
  29. package/dist/chunks/DataTableRowCellInput-BLTM3I21.js +195 -0
  30. package/dist/chunks/DataTableRowCellInput-BLTM3I21.js.map +1 -0
  31. package/dist/chunks/DataTableSearchField-PU89hniM.js +81 -0
  32. package/dist/chunks/DataTableSearchField-PU89hniM.js.map +1 -0
  33. package/dist/chunks/DateLikeEditor-ZkCbMhpE.js +74 -0
  34. package/dist/chunks/DateLikeEditor-ZkCbMhpE.js.map +1 -0
  35. package/dist/chunks/DateTimeEditor-C-jZKTT5.js +73 -0
  36. package/dist/chunks/DateTimeEditor-C-jZKTT5.js.map +1 -0
  37. package/dist/chunks/EditorSection-BR3qdK2c.js +23 -0
  38. package/dist/chunks/EditorSection-BR3qdK2c.js.map +1 -0
  39. package/dist/chunks/EditsLayout-fueCrxZM.js +22 -0
  40. package/dist/chunks/EditsLayout-fueCrxZM.js.map +1 -0
  41. package/dist/chunks/ExprEditModal-CeXiPStM.js +540 -0
  42. package/dist/chunks/ExprEditModal-CeXiPStM.js.map +1 -0
  43. package/dist/chunks/FileEditor-BXELd_SD.js +35 -0
  44. package/dist/chunks/FileEditor-BXELd_SD.js.map +1 -0
  45. package/dist/chunks/FormRenderer-BwykpB3h.js +2625 -0
  46. package/dist/chunks/FormRenderer-BwykpB3h.js.map +1 -0
  47. package/dist/chunks/GroupEditor-DchDUDDY.js +13 -0
  48. package/dist/chunks/GroupEditor-DchDUDDY.js.map +1 -0
  49. package/dist/chunks/HistoryPanel-1p0-Obef.js +104 -0
  50. package/dist/chunks/HistoryPanel-1p0-Obef.js.map +1 -0
  51. package/dist/chunks/ImportExportModal-CTqkyp1s.js +266 -0
  52. package/dist/chunks/ImportExportModal-CTqkyp1s.js.map +1 -0
  53. package/dist/chunks/InlineEditableText-BO-dT5rp.js +68 -0
  54. package/dist/chunks/InlineEditableText-BO-dT5rp.js.map +1 -0
  55. package/dist/chunks/InputGroupEditor-D_5giZtN.js +13 -0
  56. package/dist/chunks/InputGroupEditor-D_5giZtN.js.map +1 -0
  57. package/dist/chunks/IssuesPanel-CW5bdwvC.js +82 -0
  58. package/dist/chunks/IssuesPanel-CW5bdwvC.js.map +1 -0
  59. package/dist/chunks/JsCodeEditor-CIPxhwZa.js +751 -0
  60. package/dist/chunks/JsCodeEditor-CIPxhwZa.js.map +1 -0
  61. package/dist/chunks/JsonTextarea-C3mnRwtG.js +54 -0
  62. package/dist/chunks/JsonTextarea-C3mnRwtG.js.map +1 -0
  63. package/dist/chunks/ListEditor-C1hn5yOi.js +25 -0
  64. package/dist/chunks/ListEditor-C1hn5yOi.js.map +1 -0
  65. package/dist/chunks/NaiveAlertEditor-DACimYS1.js +67 -0
  66. package/dist/chunks/NaiveAlertEditor-DACimYS1.js.map +1 -0
  67. package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js +122 -0
  68. package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js.map +1 -0
  69. package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js +36 -0
  70. package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js.map +1 -0
  71. package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js +69 -0
  72. package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js.map +1 -0
  73. package/dist/chunks/NaiveBasicSection-wNyhGLou.js +184 -0
  74. package/dist/chunks/NaiveBasicSection-wNyhGLou.js.map +1 -0
  75. package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js +13 -0
  76. package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js.map +1 -0
  77. package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js +168 -0
  78. package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js.map +1 -0
  79. package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js +26 -0
  80. package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js.map +1 -0
  81. package/dist/chunks/NaiveDividerEditor-B1dPteDV.js +52 -0
  82. package/dist/chunks/NaiveDividerEditor-B1dPteDV.js.map +1 -0
  83. package/dist/chunks/NaiveH1Editor-Can7c9mh.js +14 -0
  84. package/dist/chunks/NaiveH1Editor-Can7c9mh.js.map +1 -0
  85. package/dist/chunks/NaiveH2Editor-BRKeEVf4.js +14 -0
  86. package/dist/chunks/NaiveH2Editor-BRKeEVf4.js.map +1 -0
  87. package/dist/chunks/NaiveH3Editor-DCdyd3-n.js +14 -0
  88. package/dist/chunks/NaiveH3Editor-DCdyd3-n.js.map +1 -0
  89. package/dist/chunks/NaiveH4Editor-COFS6udv.js +14 -0
  90. package/dist/chunks/NaiveH4Editor-COFS6udv.js.map +1 -0
  91. package/dist/chunks/NaiveH5Editor-CQEe6s1O.js +14 -0
  92. package/dist/chunks/NaiveH5Editor-CQEe6s1O.js.map +1 -0
  93. package/dist/chunks/NaiveH6Editor-DHGzIUAl.js +14 -0
  94. package/dist/chunks/NaiveH6Editor-DHGzIUAl.js.map +1 -0
  95. package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js +12 -0
  96. package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js.map +1 -0
  97. package/dist/chunks/NaiveImageEditor-WyVYLNbT.js +201 -0
  98. package/dist/chunks/NaiveImageEditor-WyVYLNbT.js.map +1 -0
  99. package/dist/chunks/NaiveLiEditor-CC65rrna.js +13 -0
  100. package/dist/chunks/NaiveLiEditor-CC65rrna.js.map +1 -0
  101. package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js +38 -0
  102. package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js.map +1 -0
  103. package/dist/chunks/NaiveMentionEditor-BupocM2c.js +23 -0
  104. package/dist/chunks/NaiveMentionEditor-BupocM2c.js.map +1 -0
  105. package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js +16 -0
  106. package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js.map +1 -0
  107. package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js +104 -0
  108. package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js.map +1 -0
  109. package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js +119 -0
  110. package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js.map +1 -0
  111. package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js +77 -0
  112. package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js.map +1 -0
  113. package/dist/chunks/NaiveRateEditor-BVY1QiXv.js +44 -0
  114. package/dist/chunks/NaiveRateEditor-BVY1QiXv.js.map +1 -0
  115. package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js +17 -0
  116. package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js.map +1 -0
  117. package/dist/chunks/NaiveTextEditor-C38l4Q-j.js +107 -0
  118. package/dist/chunks/NaiveTextEditor-C38l4Q-j.js.map +1 -0
  119. package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js +19 -0
  120. package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js.map +1 -0
  121. package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js +26 -0
  122. package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js.map +1 -0
  123. package/dist/chunks/NaiveUlEditor-CMKofBid.js +16 -0
  124. package/dist/chunks/NaiveUlEditor-CMKofBid.js.map +1 -0
  125. package/dist/chunks/NumberEditor-0P2Li_GH.js +40 -0
  126. package/dist/chunks/NumberEditor-0P2Li_GH.js.map +1 -0
  127. package/dist/chunks/NumberInput-DU-FiLxW.js +37 -0
  128. package/dist/chunks/NumberInput-DU-FiLxW.js.map +1 -0
  129. package/dist/chunks/OptionsLayoutSection-C9gVadRA.js +21 -0
  130. package/dist/chunks/OptionsLayoutSection-C9gVadRA.js.map +1 -0
  131. package/dist/chunks/OptionsSourceTabs-3fsum0OI.js +628 -0
  132. package/dist/chunks/OptionsSourceTabs-3fsum0OI.js.map +1 -0
  133. package/dist/chunks/OptionsTagsSection-vKkxlWLw.js +31 -0
  134. package/dist/chunks/OptionsTagsSection-vKkxlWLw.js.map +1 -0
  135. package/dist/chunks/PasswordEditor-Igld1ak6.js +29 -0
  136. package/dist/chunks/PasswordEditor-Igld1ak6.js.map +1 -0
  137. package/dist/chunks/PlaceholderSection-BKOS-7Qu.js +26 -0
  138. package/dist/chunks/PlaceholderSection-BKOS-7Qu.js.map +1 -0
  139. package/dist/chunks/RadioEditor-CyJhILjI.js +23 -0
  140. package/dist/chunks/RadioEditor-CyJhILjI.js.map +1 -0
  141. package/dist/chunks/RangeEditor-PGOnGfuV.js +86 -0
  142. package/dist/chunks/RangeEditor-PGOnGfuV.js.map +1 -0
  143. package/dist/chunks/RichText-DqcMtoil.js +424 -0
  144. package/dist/chunks/RichText-DqcMtoil.js.map +1 -0
  145. package/dist/chunks/RichTextEditor-EfA6m9w2.js +81 -0
  146. package/dist/chunks/RichTextEditor-EfA6m9w2.js.map +1 -0
  147. package/dist/chunks/SelectEditor-mJ_zUivj.js +21 -0
  148. package/dist/chunks/SelectEditor-mJ_zUivj.js.map +1 -0
  149. package/dist/chunks/SelectInput-DY4Oi2Lp.js +31 -0
  150. package/dist/chunks/SelectInput-DY4Oi2Lp.js.map +1 -0
  151. package/dist/chunks/SignatureEditor-BNttg68X.js +52 -0
  152. package/dist/chunks/SignatureEditor-BNttg68X.js.map +1 -0
  153. package/dist/chunks/SignaturePad-qhmoMg1E.js +170 -0
  154. package/dist/chunks/SignaturePad-qhmoMg1E.js.map +1 -0
  155. package/dist/chunks/StepsEditor-C8U-ext8.js +63 -0
  156. package/dist/chunks/StepsEditor-C8U-ext8.js.map +1 -0
  157. package/dist/chunks/SubmitEditor-B9R984q8.js +168 -0
  158. package/dist/chunks/SubmitEditor-B9R984q8.js.map +1 -0
  159. package/dist/chunks/SwitchInput-DQrSTyW0.js +34 -0
  160. package/dist/chunks/SwitchInput-DQrSTyW0.js.map +1 -0
  161. package/dist/chunks/TabsEditor-DepUhmsz.js +100 -0
  162. package/dist/chunks/TabsEditor-DepUhmsz.js.map +1 -0
  163. package/dist/chunks/TagsInput-DeG3Om1R.js +36 -0
  164. package/dist/chunks/TagsInput-DeG3Om1R.js.map +1 -0
  165. package/dist/chunks/TemplatePickerModal-DPkdJJJs.js +440 -0
  166. package/dist/chunks/TemplatePickerModal-DPkdJJJs.js.map +1 -0
  167. package/dist/chunks/TextInput-D1EMeBPf.js +53 -0
  168. package/dist/chunks/TextInput-D1EMeBPf.js.map +1 -0
  169. package/dist/chunks/TextLikeEditor-Du0nHQWQ.js +56 -0
  170. package/dist/chunks/TextLikeEditor-Du0nHQWQ.js.map +1 -0
  171. package/dist/chunks/ToggleInput-DoZPwM0A.js +51 -0
  172. package/dist/chunks/ToggleInput-DoZPwM0A.js.map +1 -0
  173. package/dist/chunks/_plugin-vue_export-helper-BxNYtmDu.js +8 -0
  174. package/dist/chunks/axios-agM_iOnv.js +1589 -0
  175. package/dist/chunks/axios-agM_iOnv.js.map +1 -0
  176. package/dist/chunks/bind-runtime-CRyrBYCi.js +58 -0
  177. package/dist/chunks/bind-runtime-CRyrBYCi.js.map +1 -0
  178. package/dist/chunks/canvas-locate-CxDD4bDp.js +64 -0
  179. package/dist/chunks/canvas-locate-CxDD4bDp.js.map +1 -0
  180. package/dist/chunks/context-4zkSHwVA.js +2510 -0
  181. package/dist/chunks/context-4zkSHwVA.js.map +1 -0
  182. package/dist/chunks/create-form-builder-state-CoXaJhWO.js +358 -0
  183. package/dist/chunks/create-form-builder-state-CoXaJhWO.js.map +1 -0
  184. package/dist/chunks/date-family-BYkr1OaE.js +75 -0
  185. package/dist/chunks/date-family-BYkr1OaE.js.map +1 -0
  186. package/dist/chunks/evaluator-DqNftI0d.js +139 -0
  187. package/dist/chunks/evaluator-DqNftI0d.js.map +1 -0
  188. package/dist/chunks/expr-parse-u7_CxMWg.js +463 -0
  189. package/dist/chunks/expr-parse-u7_CxMWg.js.map +1 -0
  190. package/dist/chunks/expr-source-BRPYrxuB.js +118 -0
  191. package/dist/chunks/expr-source-BRPYrxuB.js.map +1 -0
  192. package/dist/chunks/form-builder-plugin-BCbiWZKT.js +280 -0
  193. package/dist/chunks/form-builder-plugin-BCbiWZKT.js.map +1 -0
  194. package/dist/chunks/form-fields-DjLk8iH2.js +877 -0
  195. package/dist/chunks/form-fields-DjLk8iH2.js.map +1 -0
  196. package/dist/chunks/form-layout-Dm4QeYrL.js +69 -0
  197. package/dist/chunks/form-layout-Dm4QeYrL.js.map +1 -0
  198. package/dist/chunks/grid-C8xMKll5.js +137 -0
  199. package/dist/chunks/grid-C8xMKll5.js.map +1 -0
  200. package/dist/chunks/keys-D4DlFgJT.js +61 -0
  201. package/dist/chunks/keys-D4DlFgJT.js.map +1 -0
  202. package/dist/chunks/media-family-B4Wijm18.js +178 -0
  203. package/dist/chunks/media-family-B4Wijm18.js.map +1 -0
  204. package/dist/chunks/misc-family-CQJhCKco.js +133 -0
  205. package/dist/chunks/misc-family-CQJhCKco.js.map +1 -0
  206. package/dist/chunks/rich-text-toolbar-CQidmjGI.js +32 -0
  207. package/dist/chunks/rich-text-toolbar-CQidmjGI.js.map +1 -0
  208. package/dist/chunks/rolldown-runtime-DMoxecvO.js +11 -0
  209. package/dist/chunks/schema-adapter-_sLPmdLy.js +2089 -0
  210. package/dist/chunks/schema-adapter-_sLPmdLy.js.map +1 -0
  211. package/dist/chunks/selection-family-T_wZGrXc.js +249 -0
  212. package/dist/chunks/selection-family-T_wZGrXc.js.map +1 -0
  213. package/dist/chunks/use-ai-prompt-focus-39DHK41R.js +14 -0
  214. package/dist/chunks/use-ai-prompt-focus-39DHK41R.js.map +1 -0
  215. package/dist/chunks/use-bind-events-C-H7jhW_.js +89 -0
  216. package/dist/chunks/use-bind-events-C-H7jhW_.js.map +1 -0
  217. package/dist/chunks/use-config-DTr8dhzM.js +16 -0
  218. package/dist/chunks/use-config-DTr8dhzM.js.map +1 -0
  219. package/dist/chunks/use-dictionary-BAN34x49.js +26 -0
  220. package/dist/chunks/use-dictionary-BAN34x49.js.map +1 -0
  221. package/dist/chunks/use-dynamic-options-DbGSz-3_.js +29 -0
  222. package/dist/chunks/use-dynamic-options-DbGSz-3_.js.map +1 -0
  223. package/dist/chunks/use-schema-render-data-DagOPKiy.js +33 -0
  224. package/dist/chunks/use-schema-render-data-DagOPKiy.js.map +1 -0
  225. package/dist/chunks/utils-DlUMv2vG.js +53 -0
  226. package/dist/chunks/utils-DlUMv2vG.js.map +1 -0
  227. package/dist/index.d.ts +243 -1060
  228. package/dist/renderer.d.ts +632 -0
  229. package/dist/renderer.es.js +6 -0
  230. package/dist/renderer.umd.js +34 -0
  231. package/package.json +48 -33
@@ -0,0 +1,751 @@
1
+ import { t as e } from "./rolldown-runtime-DMoxecvO.js";
2
+ import { n as t } from "./context-4zkSHwVA.js";
3
+ import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, onBeforeUnmount as c, onMounted as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, watch as m, withModifiers as h } from "vue";
4
+ import { useColorMode as g, usePreferredDark as _ } from "@vueuse/core";
5
+ import { EditorState as v, StateEffect as y } from "@codemirror/state";
6
+ import { EditorView as b, highlightActiveLineGutter as x, hoverTooltip as S, keymap as C, lineNumbers as w } from "@codemirror/view";
7
+ import { defaultKeymap as T, history as E, historyKeymap as D } from "@codemirror/commands";
8
+ import { javascript as ee, javascriptLanguage as O } from "@codemirror/lang-javascript";
9
+ import { oneDark as k } from "@codemirror/theme-one-dark";
10
+ import { linter as A } from "@codemirror/lint";
11
+ import { autocompletion as j } from "@codemirror/autocomplete";
12
+ import { syntaxTree as M } from "@codemirror/language";
13
+ //#region src/utils/bind-runtime-completions.ts
14
+ var N = {
15
+ event: {
16
+ type: "Event",
17
+ description: "触发事件的原始事件对象(click / input / focus / blur 等)",
18
+ members: [
19
+ {
20
+ name: "target",
21
+ detail: "EventTarget",
22
+ type: "property",
23
+ info: "触发事件的元素"
24
+ },
25
+ {
26
+ name: "currentTarget",
27
+ detail: "EventTarget",
28
+ type: "property",
29
+ info: "绑定事件处理器的元素"
30
+ },
31
+ {
32
+ name: "type",
33
+ detail: "string",
34
+ type: "property",
35
+ info: "事件类型名称"
36
+ },
37
+ {
38
+ name: "clientX",
39
+ detail: "number",
40
+ type: "property",
41
+ info: "鼠标相对视口 X 坐标"
42
+ },
43
+ {
44
+ name: "clientY",
45
+ detail: "number",
46
+ type: "property",
47
+ info: "鼠标相对视口 Y 坐标"
48
+ },
49
+ {
50
+ name: "pageX",
51
+ detail: "number",
52
+ type: "property",
53
+ info: "鼠标相对文档 X 坐标"
54
+ },
55
+ {
56
+ name: "pageY",
57
+ detail: "number",
58
+ type: "property",
59
+ info: "鼠标相对文档 Y 坐标"
60
+ },
61
+ {
62
+ name: "key",
63
+ detail: "string",
64
+ type: "property",
65
+ info: "按键值(键盘事件)"
66
+ },
67
+ {
68
+ name: "code",
69
+ detail: "string",
70
+ type: "property",
71
+ info: "物理按键码(键盘事件)"
72
+ },
73
+ {
74
+ name: "altKey",
75
+ detail: "boolean",
76
+ type: "property",
77
+ info: "Alt 键是否按下"
78
+ },
79
+ {
80
+ name: "ctrlKey",
81
+ detail: "boolean",
82
+ type: "property",
83
+ info: "Ctrl 键是否按下"
84
+ },
85
+ {
86
+ name: "shiftKey",
87
+ detail: "boolean",
88
+ type: "property",
89
+ info: "Shift 键是否按下"
90
+ },
91
+ {
92
+ name: "data",
93
+ detail: "string | null",
94
+ type: "property",
95
+ info: "输入字符(input 事件)"
96
+ },
97
+ {
98
+ name: "value",
99
+ detail: "string",
100
+ type: "property",
101
+ info: "输入框当前值(input 事件)"
102
+ },
103
+ {
104
+ name: "button",
105
+ detail: "number",
106
+ type: "property",
107
+ info: "按下的鼠标按钮编号"
108
+ },
109
+ {
110
+ name: "preventDefault",
111
+ detail: "() => void",
112
+ type: "method",
113
+ info: "阻止默认行为"
114
+ },
115
+ {
116
+ name: "stopPropagation",
117
+ detail: "() => void",
118
+ type: "method",
119
+ info: "阻止事件冒泡"
120
+ }
121
+ ]
122
+ },
123
+ form: {
124
+ type: "Record<string, unknown>",
125
+ description: "当前表单数据"
126
+ },
127
+ $form: {
128
+ type: "{ id?: string; version?: number; name?: string }",
129
+ description: "表单定义元信息(来自 DSL 顶层字段)",
130
+ members: [
131
+ {
132
+ name: "id",
133
+ detail: "string | undefined",
134
+ type: "property",
135
+ info: "表单定义 id"
136
+ },
137
+ {
138
+ name: "version",
139
+ detail: "number | undefined",
140
+ type: "property",
141
+ info: "表单定义 version"
142
+ },
143
+ {
144
+ name: "name",
145
+ detail: "string | undefined",
146
+ type: "property",
147
+ info: "表单定义 name"
148
+ }
149
+ ]
150
+ },
151
+ $value: {
152
+ type: "unknown",
153
+ description: "当前节点的值"
154
+ },
155
+ $node: {
156
+ type: "FormKitNode",
157
+ description: "当前节点的 FormKit 节点实例",
158
+ members: [
159
+ {
160
+ name: "name",
161
+ detail: "string",
162
+ type: "property",
163
+ info: "字段名"
164
+ },
165
+ {
166
+ name: "value",
167
+ detail: "unknown",
168
+ type: "property",
169
+ info: "当前节点的值"
170
+ },
171
+ {
172
+ name: "props",
173
+ detail: "Record<string, unknown>",
174
+ type: "property",
175
+ info: "节点属性配置"
176
+ },
177
+ {
178
+ name: "context",
179
+ detail: "FormKitContext",
180
+ type: "property",
181
+ info: "节点上下文对象"
182
+ },
183
+ {
184
+ name: "type",
185
+ detail: "string",
186
+ type: "property",
187
+ info: "输入类型(text / select / …)"
188
+ },
189
+ {
190
+ name: "id",
191
+ detail: "string",
192
+ type: "property",
193
+ info: "节点唯一标识"
194
+ },
195
+ {
196
+ name: "parent",
197
+ detail: "FormKitNode | null",
198
+ type: "property",
199
+ info: "父节点"
200
+ },
201
+ {
202
+ name: "children",
203
+ detail: "FormKitNode[]",
204
+ type: "property",
205
+ info: "子节点数组"
206
+ },
207
+ {
208
+ name: "index",
209
+ detail: "number",
210
+ type: "property",
211
+ info: "在兄弟节点中的位置"
212
+ }
213
+ ]
214
+ },
215
+ $name: {
216
+ type: "string",
217
+ description: "当前节点的字段名(即 $node.name)"
218
+ },
219
+ $get: {
220
+ type: "(name: string) => unknown",
221
+ description: "按字段名取任意字段的当前值,如 $get(\"age\")",
222
+ apply: "$get('$1')"
223
+ },
224
+ $slots: {
225
+ type: "Record<string, Slot>",
226
+ description: "节点插槽"
227
+ },
228
+ attrs: {
229
+ type: "Record<string, unknown>",
230
+ description: "当前节点的全部配置"
231
+ },
232
+ ctx: {
233
+ type: "{ event, form, attrs, $value, $node, $name, $get, $slots, $form }",
234
+ description: "以上参数的合并上下文对象",
235
+ members: [
236
+ {
237
+ name: "event",
238
+ detail: "Event",
239
+ type: "property",
240
+ info: "触发事件的事件对象"
241
+ },
242
+ {
243
+ name: "form",
244
+ detail: "Record<string, unknown>",
245
+ type: "property",
246
+ info: "当前表单数据"
247
+ },
248
+ {
249
+ name: "attrs",
250
+ detail: "Record<string, unknown>",
251
+ type: "property",
252
+ info: "当前节点配置"
253
+ },
254
+ {
255
+ name: "$value",
256
+ detail: "unknown",
257
+ type: "property",
258
+ info: "当前节点的值"
259
+ },
260
+ {
261
+ name: "$node",
262
+ detail: "FormKitNode",
263
+ type: "property",
264
+ info: "当前节点的 FormKit 节点实例"
265
+ },
266
+ {
267
+ name: "$name",
268
+ detail: "string",
269
+ type: "property",
270
+ info: "当前节点的字段名"
271
+ },
272
+ {
273
+ name: "$get",
274
+ detail: "(name: string) => unknown",
275
+ type: "method",
276
+ info: "按字段名取任意字段的当前值"
277
+ },
278
+ {
279
+ name: "$slots",
280
+ detail: "Record<string, Slot>",
281
+ type: "property",
282
+ info: "节点插槽"
283
+ },
284
+ {
285
+ name: "$form",
286
+ detail: "{ id?: string; version?: number; name?: string }",
287
+ type: "property",
288
+ info: "表单定义元信息"
289
+ }
290
+ ]
291
+ },
292
+ extra: {
293
+ type: "Record<string, unknown>",
294
+ description: "额外传入的数据"
295
+ },
296
+ axios: {
297
+ type: "AxiosInstance",
298
+ description: "HTTP 请求库",
299
+ members: [
300
+ {
301
+ name: "request",
302
+ detail: "(config) => Promise",
303
+ type: "method",
304
+ info: "通用请求方法"
305
+ },
306
+ {
307
+ name: "get",
308
+ detail: "(url, config?) => Promise",
309
+ type: "method",
310
+ info: "GET 请求"
311
+ },
312
+ {
313
+ name: "delete",
314
+ detail: "(url, config?) => Promise",
315
+ type: "method",
316
+ info: "DELETE 请求"
317
+ },
318
+ {
319
+ name: "head",
320
+ detail: "(url, config?) => Promise",
321
+ type: "method",
322
+ info: "HEAD 请求"
323
+ },
324
+ {
325
+ name: "options",
326
+ detail: "(url, config?) => Promise",
327
+ type: "method",
328
+ info: "OPTIONS 请求"
329
+ },
330
+ {
331
+ name: "post",
332
+ detail: "(url, data?, config?) => Promise",
333
+ type: "method",
334
+ info: "POST 请求"
335
+ },
336
+ {
337
+ name: "put",
338
+ detail: "(url, data?, config?) => Promise",
339
+ type: "method",
340
+ info: "PUT 请求"
341
+ },
342
+ {
343
+ name: "patch",
344
+ detail: "(url, data?, config?) => Promise",
345
+ type: "method",
346
+ info: "PATCH 请求"
347
+ },
348
+ {
349
+ name: "getUri",
350
+ detail: "(config?) => string",
351
+ type: "method",
352
+ info: "获取完整 URL"
353
+ },
354
+ {
355
+ name: "defaults",
356
+ detail: "AxiosDefaults",
357
+ type: "property",
358
+ info: "全局默认配置"
359
+ },
360
+ {
361
+ name: "interceptors",
362
+ detail: "InterceptorManager",
363
+ type: "property",
364
+ info: "拦截器管理器"
365
+ }
366
+ ]
367
+ }
368
+ }, P = new Set(Object.keys(N));
369
+ function F(e, t) {
370
+ let n = t.match(/^\(([^)]*)\)/);
371
+ if (!n) return;
372
+ let r = n[1].trim();
373
+ return r ? `${e}(${r.split(",").map((e) => e.trim()).filter(Boolean).map((e, t) => {
374
+ let n = e.replace(/[:?].*$/, "").trim();
375
+ return `\${${t + 1}:${n}}`;
376
+ }).join(", ")})` : `${e}()`;
377
+ }
378
+ function I(e, t) {
379
+ let n = document.createElement("div");
380
+ n.setAttribute("style", `${L}min-width:240px;`);
381
+ let r = document.createElement("div");
382
+ r.setAttribute("style", "display:flex;align-items:baseline;gap:2px;margin-bottom:6px;");
383
+ let i = document.createElement("span");
384
+ i.setAttribute("style", "width:16px;font-size:10px;text-align:center;flex-shrink:0;"), i.textContent = t.type === "method" ? "fn" : "P", i.style.color = t.type === "method" ? "#dcdcaa" : "#9cdcfe";
385
+ let a = document.createElement("span");
386
+ a.setAttribute("style", "font-weight:400;font-size:13px;color:#9cdcfe;"), a.textContent = `${e}.`;
387
+ let o = document.createElement("span");
388
+ o.setAttribute("style", "font-weight:700;font-size:13px;color:#dcdcaa;"), o.textContent = t.name;
389
+ let s = document.createElement("span");
390
+ if (s.setAttribute("style", "font-size:11px;opacity:0.55;margin-left:2px;"), s.textContent = t.detail, r.append(i, a, o, s), n.append(r), t.info) {
391
+ let e = document.createElement("div");
392
+ e.setAttribute("style", `${V}font-size:11px;opacity:0.75;`), e.textContent = t.info, n.append(e);
393
+ }
394
+ return n;
395
+ }
396
+ var L = "\n font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;\n font-size: 12px;\n line-height: 1.5;\n max-width: 380px;\n padding: 8px 10px;\n", R = "\n display:flex;align-items:baseline;gap:6px;margin-bottom:6px;\n", z = "\n font-weight:700;font-size:13px;color:var(--cm-completionInfoTitle,#569cd6);\n", B = "\n font-size:11px;opacity:0.7;color:var(--cm-completionInfoType,#aaa);\n", V = "\n margin-top:0;padding:4px 0 0;border-top:1px solid var(--cm-completionInfoBorder,#444);\n font-size:11px;opacity:0.85;color:var(--cm-completionInfoDesc,#ccc);white-space:pre-wrap;\n";
397
+ function H(e, t) {
398
+ let n = document.createElement("div");
399
+ n.setAttribute("style", L);
400
+ let r = document.createElement("div");
401
+ r.setAttribute("style", R);
402
+ let i = document.createElement("span");
403
+ i.setAttribute("style", z), i.textContent = e;
404
+ let a = document.createElement("span");
405
+ if (a.setAttribute("style", B), a.textContent = `: ${t.type}`, r.append(i, a), n.append(r), t.description) {
406
+ let e = document.createElement("div");
407
+ e.setAttribute("style", V), e.textContent = t.description, n.append(e);
408
+ }
409
+ if (t.members?.length) {
410
+ let e = document.createElement("div");
411
+ e.setAttribute("style", "margin-top:6px;padding-top:4px;border-top:1px solid var(--cm-completionInfoBorder,#444);");
412
+ for (let n of t.members) {
413
+ let t = document.createElement("div");
414
+ t.setAttribute("style", "display:flex;align-items:baseline;gap:4px;padding:1px 0;");
415
+ let r = document.createElement("span");
416
+ r.setAttribute("style", `width:14px;font-size:10px;text-align:center;color:${n.type === "method" ? "#dcdcaa" : "#9cdcfe"};flex-shrink:0;`), r.textContent = n.type === "method" ? "fn" : "P";
417
+ let i = document.createElement("code");
418
+ i.setAttribute("style", "font-weight:600;font-size:12px;color:var(--cm-completionInfoMember,#e06c75);"), i.textContent = n.name;
419
+ let a = document.createElement("span");
420
+ a.setAttribute("style", "font-size:11px;opacity:0.55;color:var(--cm-completionInfoMemberDetail,#999);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"), a.textContent = n.detail, t.append(r, i, a), e.append(t);
421
+ }
422
+ n.append(e);
423
+ }
424
+ return n;
425
+ }
426
+ function U(e) {
427
+ let t = document.createElement("div");
428
+ t.setAttribute("style", L), t.setAttribute("style", `${L}min-width:260px;`);
429
+ let n = document.createElement("div");
430
+ n.setAttribute("style", "font-weight:600;margin-bottom:2px;"), n.textContent = e.type, t.append(n);
431
+ let r = document.createElement("div");
432
+ if (r.setAttribute("style", "font-size:11px;opacity:0.75;margin-bottom:6px;color:var(--cm-completionInfoDesc,#aaa);"), r.textContent = e.description, t.append(r), e.members?.length) {
433
+ let n = document.createElement("div");
434
+ n.setAttribute("style", "padding-top:4px;border-top:1px solid var(--cm-completionInfoBorder,#444);");
435
+ for (let t of e.members) {
436
+ let e = document.createElement("div");
437
+ e.setAttribute("style", "display:flex;align-items:baseline;gap:4px;padding:1px 0;");
438
+ let r = document.createElement("code");
439
+ r.setAttribute("style", "font-weight:600;font-size:11px;color:#e06c75;"), r.textContent = t.name;
440
+ let i = document.createElement("span");
441
+ i.setAttribute("style", "font-size:10px;opacity:0.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"), i.textContent = t.detail, e.append(r, i), n.append(e);
442
+ }
443
+ t.append(n);
444
+ }
445
+ return t;
446
+ }
447
+ function W(e) {
448
+ return (t) => {
449
+ let n = t.matchBefore(/(\$?\w+)\.\s*/);
450
+ if (n) {
451
+ let t = n.text, r = t.lastIndexOf("."), i = t.slice(0, r), a = t.slice(r + 1).trim();
452
+ if (i === "form" && e().length > 0) {
453
+ let t = [], r = a.toLowerCase();
454
+ for (let n of e()) n.toLowerCase().startsWith(r) && t.push({
455
+ label: n,
456
+ type: "property",
457
+ detail: "unknown",
458
+ info: () => {
459
+ let e = document.createElement("div");
460
+ e.setAttribute("style", `${L}min-width:200px;`);
461
+ let t = document.createElement("div");
462
+ t.setAttribute("style", "display:flex;align-items:baseline;gap:2px;margin-bottom:6px;");
463
+ let r = document.createElement("span");
464
+ r.setAttribute("style", "font-weight:400;font-size:13px;color:#9cdcfe;"), r.textContent = "form.";
465
+ let i = document.createElement("span");
466
+ i.setAttribute("style", "font-weight:700;font-size:13px;color:#9cdcfe;"), i.textContent = n, t.append(r, i), e.append(t);
467
+ let a = document.createElement("div");
468
+ return a.setAttribute("style", `${V}font-size:11px;opacity:0.75;`), a.textContent = `表单字段「${n}」的当前值`, e.append(a), e;
469
+ }
470
+ });
471
+ return t.length > 0 ? {
472
+ from: n.to,
473
+ options: t,
474
+ validFor: /^\w*$/
475
+ } : null;
476
+ }
477
+ let o = N[i];
478
+ if (o?.members?.length) {
479
+ let e = [];
480
+ for (let t of o.members) t.name.startsWith(a) && e.push({
481
+ label: t.name,
482
+ type: t.type ?? "property",
483
+ detail: t.detail,
484
+ info: () => I(i, t),
485
+ apply: t.type === "method" ? F(t.name, t.detail) : void 0
486
+ });
487
+ if (e.length > 0) return {
488
+ from: n.to,
489
+ options: e,
490
+ validFor: /^\w*$/
491
+ };
492
+ }
493
+ return null;
494
+ }
495
+ let r = t.matchBefore(/\$?\w*/);
496
+ if (!r || r.from === r.to && !t.explicit) return null;
497
+ let i = [];
498
+ for (let [e, t] of Object.entries(N)) e.startsWith(r.text) && i.push({
499
+ label: e,
500
+ type: t.members?.length ? "class" : t.apply ? "function" : "variable",
501
+ detail: t.type,
502
+ info: () => H(e, t),
503
+ apply: t.apply
504
+ });
505
+ return i.length === 0 ? null : {
506
+ from: r.from,
507
+ options: i,
508
+ validFor: /^\$?\w*$/
509
+ };
510
+ };
511
+ }
512
+ function G(e) {
513
+ return (t, n) => {
514
+ let r = M(t.state).resolveInner(n, -1);
515
+ if (!r) return null;
516
+ let i = t.state.doc.sliceString(0), a = r.parent;
517
+ if (a?.name === "MemberExpression" && r.name === "PropertyName") {
518
+ let t = a.firstChild, n = t && i.slice(t.from, t.to), o = i.slice(r.from, r.to);
519
+ if (!n || !o) return null;
520
+ if (n === "form" && e().includes(o)) return {
521
+ pos: a.from,
522
+ end: a.to,
523
+ above: !0,
524
+ create: () => ({ dom: (() => {
525
+ let e = document.createElement("div");
526
+ e.setAttribute("style", `${L}min-width:200px;`);
527
+ let t = document.createElement("div");
528
+ t.setAttribute("style", "display:flex;align-items:baseline;gap:2px;margin-bottom:6px;");
529
+ let n = document.createElement("span");
530
+ n.setAttribute("style", "font-weight:400;font-size:13px;color:#9cdcfe;"), n.textContent = "form.";
531
+ let r = document.createElement("span");
532
+ r.setAttribute("style", "font-weight:700;font-size:13px;color:#9cdcfe;"), r.textContent = o, t.append(n, r);
533
+ let i = document.createElement("span");
534
+ i.setAttribute("style", "font-size:11px;opacity:0.55;margin-left:4px;"), i.textContent = ": unknown", t.append(i), e.append(t);
535
+ let a = document.createElement("div");
536
+ return a.setAttribute("style", `${V}font-size:11px;opacity:0.75;`), a.textContent = `表单字段「${o}」的当前值`, e.append(a), e;
537
+ })() })
538
+ };
539
+ if (n && P.has(n)) {
540
+ let e = N[n]?.members?.find((e) => e.name === o);
541
+ if (e) return {
542
+ pos: a.from,
543
+ end: a.to,
544
+ above: !0,
545
+ create: () => ({ dom: K(n, e) })
546
+ };
547
+ }
548
+ return null;
549
+ }
550
+ if (r.name === "VariableName" || r.name === "VariableDefinition") {
551
+ let e = i.slice(r.from, r.to);
552
+ if (!P.has(e)) return null;
553
+ let t = N[e];
554
+ return t ? {
555
+ pos: r.from,
556
+ end: r.to,
557
+ above: !0,
558
+ create: () => ({ dom: U(t) })
559
+ } : null;
560
+ }
561
+ return null;
562
+ };
563
+ }
564
+ function K(e, t) {
565
+ let n = document.createElement("div");
566
+ n.setAttribute("style", `${L}min-width:240px;`);
567
+ let r = document.createElement("div");
568
+ r.setAttribute("style", "display:flex;align-items:baseline;gap:2px;margin-bottom:6px;");
569
+ let i = document.createElement("span");
570
+ i.setAttribute("style", "width:16px;font-size:10px;text-align:center;flex-shrink:0;"), i.textContent = t.type === "method" ? "fn" : "P", i.style.color = t.type === "method" ? "#dcdcaa" : "#9cdcfe";
571
+ let a = document.createElement("span");
572
+ a.setAttribute("style", "font-weight:400;font-size:13px;color:#9cdcfe;"), a.textContent = `${e}.`;
573
+ let o = document.createElement("span");
574
+ o.setAttribute("style", "font-weight:700;font-size:13px;color:#dcdcaa;"), o.textContent = t.name;
575
+ let s = document.createElement("span");
576
+ if (s.setAttribute("style", "font-size:11px;opacity:0.55;margin-left:2px;"), s.textContent = t.detail, r.append(i, a, o, s), n.append(r), t.info) {
577
+ let e = document.createElement("div");
578
+ e.setAttribute("style", `${V}font-size:11px;opacity:0.75;`), e.textContent = t.info, n.append(e);
579
+ }
580
+ return n;
581
+ }
582
+ //#endregion
583
+ //#region src/utils/bind-runtime-lint.ts
584
+ var q = new Set([
585
+ "event",
586
+ "form",
587
+ "$form",
588
+ "$value",
589
+ "$node",
590
+ "$name",
591
+ "$get",
592
+ "$slots",
593
+ "attrs",
594
+ "ctx",
595
+ "extra",
596
+ "axios"
597
+ ]), J = new Set(/* @__PURE__ */ "console.window.document.Array.Object.String.Number.Boolean.Date.Math.JSON.Promise.RegExp.Error.Map.Set.WeakMap.WeakSet.parseInt.parseFloat.isNaN.isFinite.undefined.NaN.Infinity.setTimeout.setInterval.clearTimeout.clearInterval.fetch.alert.confirm.prompt.Intl.BigInt.Symbol.Proxy.Reflect.arguments.eval".split("."));
598
+ function Y(e) {
599
+ let t = [], n = M(e.state), r = e.state.doc.toString(), i = /* @__PURE__ */ new Set();
600
+ return X(n.cursor(), r, i), Z(n.cursor(), r, i, t), t;
601
+ }
602
+ function X(e, t, n) {
603
+ do {
604
+ let r = e.node;
605
+ switch (r.name) {
606
+ case "VariableDefinition":
607
+ n.add(t.slice(r.from, r.to));
608
+ break;
609
+ case "PropertyDefinition":
610
+ case "Property": break;
611
+ }
612
+ if (r.name === "FunctionDeclaration" || r.name === "ArrowFunction" || r.name === "FunctionExpression") {
613
+ let e = r.firstChild;
614
+ if (e) {
615
+ let r = e.firstChild;
616
+ for (; r;) r.name === "VariableDefinition" && n.add(t.slice(r.from, r.to)), r = r.nextSibling;
617
+ }
618
+ }
619
+ e.firstChild() && (X(e, t, n), e.parent());
620
+ } while (e.nextSibling());
621
+ }
622
+ function Z(e, t, n, r) {
623
+ do {
624
+ let i = e.node;
625
+ if (i.type.isError) r.push({
626
+ from: i.from,
627
+ to: i.to,
628
+ severity: "error",
629
+ message: "语法错误"
630
+ });
631
+ else if (i.name === "VariableName") {
632
+ let e = t.slice(i.from, i.to);
633
+ e && !q.has(e) && !J.has(e) && !n.has(e) && !Q(i, t) && r.push({
634
+ from: i.from,
635
+ to: i.to,
636
+ severity: "warning",
637
+ message: `未定义的变量 "${e}"`
638
+ });
639
+ }
640
+ e.firstChild() && (Z(e, t, n, r), e.parent());
641
+ } while (e.nextSibling());
642
+ }
643
+ function Q(e, t) {
644
+ let n = e.parent;
645
+ return n ? n.name === "MemberExpression" && n.firstChild !== e : !1;
646
+ }
647
+ //#endregion
648
+ //#region src/components/sidebar-right/edits/common/JsCodeEditor.vue?vue&type=script&setup=true&lang.ts
649
+ var te = { class: "w-full space-y-1.5" }, ne = {
650
+ key: 0,
651
+ class: "flex flex-wrap items-center gap-1 px-0.5"
652
+ }, re = { class: "text-[10px] text-muted-foreground mr-0.5 shrink-0" }, ie = ["onMousedown"], ae = /* @__PURE__ */ s({
653
+ __name: "JsCodeEditor",
654
+ props: {
655
+ modelValue: {},
656
+ height: {},
657
+ fieldNames: {},
658
+ quickVars: {}
659
+ },
660
+ emits: ["update:modelValue"],
661
+ setup(e, { emit: s }) {
662
+ let M = e, N = s, P = d(null), F = null, I = !1, { t: L } = t(), R = r(() => L("builder.quickInsert"));
663
+ function z(e) {
664
+ if (!F) return;
665
+ let { from: t, to: n } = F.state.selection.main;
666
+ F.dispatch({
667
+ changes: {
668
+ from: t,
669
+ to: n,
670
+ insert: e
671
+ },
672
+ selection: { anchor: t + e.length }
673
+ }), F.focus();
674
+ }
675
+ let B = g(), V = _(), H = r(() => B.value === "dark" || B.value === "auto" && V.value), U = r(() => [
676
+ w(),
677
+ x(),
678
+ E(),
679
+ C.of([...T, ...D]),
680
+ ee({
681
+ typescript: !1,
682
+ jsx: !1
683
+ }),
684
+ j(),
685
+ O.data.of({ autocomplete: W(() => M.fieldNames ?? []) }),
686
+ S(G(() => M.fieldNames ?? [])),
687
+ A(Y),
688
+ ...H.value ? [k] : [],
689
+ b.updateListener.of((e) => {
690
+ e.docChanged && (I || N("update:modelValue", e.state.doc.toString()));
691
+ }),
692
+ b.theme({
693
+ "&": {
694
+ borderRadius: "10px",
695
+ overflow: "hidden",
696
+ border: "1px solid var(--border)",
697
+ backgroundColor: "var(--card)",
698
+ color: "var(--foreground)"
699
+ },
700
+ ".cm-content": {
701
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace",
702
+ fontSize: "12px",
703
+ lineHeight: "1.55"
704
+ },
705
+ ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace" }
706
+ })
707
+ ]);
708
+ function K(e) {
709
+ return v.create({
710
+ doc: e,
711
+ extensions: U.value
712
+ });
713
+ }
714
+ return l(() => {
715
+ if (!P.value) return;
716
+ F = new b({
717
+ state: K(M.modelValue ?? ""),
718
+ parent: P.value
719
+ });
720
+ let e = Math.max(160, Math.min(720, Math.round(M.height ?? 280)));
721
+ F.dom.style.height = `${e}px`;
722
+ }), m(H, () => {
723
+ F?.dispatch({ effects: y.reconfigure.of(U.value) });
724
+ }), c(() => {
725
+ F?.destroy(), F = null;
726
+ }), m(() => M.modelValue, (e) => {
727
+ if (!F) return;
728
+ let t = F.state.doc.toString();
729
+ t !== e && (I = !0, F.dispatch({ changes: {
730
+ from: 0,
731
+ to: t.length,
732
+ insert: e ?? ""
733
+ } }), queueMicrotask(() => {
734
+ I = !1;
735
+ }));
736
+ }), (t, r) => (u(), a("div", te, [e.quickVars && e.quickVars.length ? (u(), a("div", ne, [o("span", re, p(R.value), 1), (u(!0), a(n, null, f(e.quickVars, (e) => (u(), a("button", {
737
+ key: e,
738
+ type: "button",
739
+ class: "px-1.5 py-0.5 rounded border border-border/50 bg-muted/40 text-[11px] font-mono text-foreground/80 transition-colors hover:bg-muted hover:text-foreground cursor-pointer select-none",
740
+ onMousedown: h((t) => z(e), ["prevent"])
741
+ }, p(e), 41, ie))), 128))])) : i("", !0), o("div", {
742
+ ref_key: "hostRef",
743
+ ref: P,
744
+ class: "w-full"
745
+ }, null, 512)]));
746
+ }
747
+ }), oe = /* @__PURE__ */ e({ default: () => $ }), $ = ae;
748
+ //#endregion
749
+ export { oe as n, $ as t };
750
+
751
+ //# sourceMappingURL=JsCodeEditor-CIPxhwZa.js.map