@m3ui-vue/m3ui-vue 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/API.md +43 -32
  2. package/dist/{MButton-D_uxtJa-.js → MButton-CPghlKb0.js} +8 -9
  3. package/dist/MButton-CPghlKb0.js.map +1 -0
  4. package/dist/{MDialog-DT4KAPmn.js → MDialog-X50At1Gk.js} +38 -44
  5. package/dist/MDialog-X50At1Gk.js.map +1 -0
  6. package/dist/{MIcon-Bxh9j135.js → MIcon-DpajuUTJ.js} +2 -3
  7. package/dist/MIcon-DpajuUTJ.js.map +1 -0
  8. package/dist/{MIconButton-DoNotQ9v.js → MIconButton-BBggVwBV.js} +5 -6
  9. package/dist/MIconButton-BBggVwBV.js.map +1 -0
  10. package/dist/{MListItem-CwYrxpPZ.js → MListItem-DVi1j1QI.js} +8 -14
  11. package/dist/MListItem-DVi1j1QI.js.map +1 -0
  12. package/dist/{MLoadingIndicator-DhzECYRI.js → MLoadingIndicator-vooA3110.js} +3 -4
  13. package/dist/MLoadingIndicator-vooA3110.js.map +1 -0
  14. package/dist/{MMenuItem-Bih0h4-n.js → MMenuItem-CRNZkVVr.js} +13 -25
  15. package/dist/MMenuItem-CRNZkVVr.js.map +1 -0
  16. package/dist/{MProgressBar-BCoruxA-.js → MProgressBar-BWly1UKN.js} +3 -8
  17. package/dist/MProgressBar-BWly1UKN.js.map +1 -0
  18. package/dist/{MSeekBar-DQPF5FTp.js → MSeekBar-BL2W5_rD.js} +4 -5
  19. package/dist/MSeekBar-BL2W5_rD.js.map +1 -0
  20. package/dist/{MSegmentedButton-DL9JtJFX.js → MSegmentedButton-BEB4gXLA.js} +3 -4
  21. package/dist/MSegmentedButton-BEB4gXLA.js.map +1 -0
  22. package/dist/{MSlider-BvoMZTy9.js → MSlider-B9NcKTmZ.js} +22 -23
  23. package/dist/MSlider-B9NcKTmZ.js.map +1 -0
  24. package/dist/{MSpinner-CgcCQhS9.js → MSpinner-_XpTRkAg.js} +3 -4
  25. package/dist/MSpinner-_XpTRkAg.js.map +1 -0
  26. package/dist/{MTextField-B72dwF6V.js → MTextField-DpcPmR5B.js} +119 -89
  27. package/dist/MTextField-DpcPmR5B.js.map +1 -0
  28. package/dist/{MTooltip-YyF1CO75.js → MTooltip-BL3jPYPT.js} +10 -12
  29. package/dist/MTooltip-BL3jPYPT.js.map +1 -0
  30. package/dist/THIRD_PARTY_LICENSES.md +2 -2
  31. package/dist/{_plugin-vue_export-helper-B3ysoDQm.js → _plugin-vue_export-helper-Djzt4Yr7.js} +1 -2
  32. package/dist/{_storageKeys-CYXsUBwK.js → _storageKeys-C4W_4xK4.js} +2 -3
  33. package/dist/_storageKeys-C4W_4xK4.js.map +1 -0
  34. package/dist/{_useEscapeStack-CjndQhqg.js → _useEscapeStack-C5-BYr8y.js} +2 -3
  35. package/dist/_useEscapeStack-C5-BYr8y.js.map +1 -0
  36. package/dist/api.json +1 -1
  37. package/dist/barcode.js +1 -2
  38. package/dist/barcode.js.map +1 -1
  39. package/dist/chart.js +2 -4
  40. package/dist/chart.js.map +1 -1
  41. package/dist/code-editor.js +22 -23
  42. package/dist/code-editor.js.map +1 -1
  43. package/dist/{common-0dgrgaPL.js → common-kIb6A2Qu.js} +8 -37
  44. package/dist/common-kIb6A2Qu.js.map +1 -0
  45. package/dist/components/MAbsolute.vue.d.ts +5 -3
  46. package/dist/components/MAlert.vue.d.ts +8 -6
  47. package/dist/components/MAppBar.vue.d.ts +9 -7
  48. package/dist/components/MAppBarWithSearch.vue.d.ts +15 -13
  49. package/dist/components/MAppLayout.vue.d.ts +13 -11
  50. package/dist/components/MAspectRatio.vue.d.ts +5 -3
  51. package/dist/components/MAudioPlayer.vue.d.ts +22 -20
  52. package/dist/components/MAutocomplete.vue.d.ts +1 -1
  53. package/dist/components/MAvailabilityCalendar.vue.d.ts +19 -17
  54. package/dist/components/MBadge.vue.d.ts +6 -4
  55. package/dist/components/MBar.vue.d.ts +14 -12
  56. package/dist/components/MBarcode.vue.d.ts +5 -3
  57. package/dist/components/MBeforeAfter.vue.d.ts +12 -10
  58. package/dist/components/MBodyMap.vue.d.ts +1 -1
  59. package/dist/components/MBottomAppBar.vue.d.ts +10 -8
  60. package/dist/components/MBottomSheet.vue.d.ts +8 -6
  61. package/dist/components/MBottomSheetScaffold.vue.d.ts +9 -7
  62. package/dist/components/MBox.vue.d.ts +6 -4
  63. package/dist/components/MButton.vue.d.ts +7 -5
  64. package/dist/components/MCard.vue.d.ts +12 -10
  65. package/dist/components/MCenter.vue.d.ts +5 -3
  66. package/dist/components/MChatBubble.vue.d.ts +6 -4
  67. package/dist/components/MCheckbox.vue.d.ts +5 -3
  68. package/dist/components/MChip.vue.d.ts +9 -7
  69. package/dist/components/MCircleProgressBar.vue.d.ts +6 -4
  70. package/dist/components/MCodeEditor.vue.d.ts +5 -3
  71. package/dist/components/MContainer.vue.d.ts +6 -4
  72. package/dist/components/MContextMenu.vue.d.ts +8 -6
  73. package/dist/components/MCopyButton.vue.d.ts +1 -1
  74. package/dist/components/MDataTable.vue.d.ts +21 -19
  75. package/dist/components/MDialog.vue.d.ts +21 -19
  76. package/dist/components/MDragHandle.vue.d.ts +1 -1
  77. package/dist/components/MDrawCanvas.vue.d.ts +5 -3
  78. package/dist/components/MDrawToolbar.vue.d.ts +7 -5
  79. package/dist/components/MEmptyState.vue.d.ts +5 -3
  80. package/dist/components/MExpansionPanel.vue.d.ts +6 -4
  81. package/dist/components/MExportButton.vue.d.ts +7 -5
  82. package/dist/components/MFab.vue.d.ts +11 -9
  83. package/dist/components/MFabMenu.vue.d.ts +3 -3
  84. package/dist/components/MFixed.vue.d.ts +5 -3
  85. package/dist/components/MFlex.vue.d.ts +7 -5
  86. package/dist/components/MFloorPlan.vue.d.ts +3 -3
  87. package/dist/components/MFloorPlanInspector.vue.d.ts +32 -30
  88. package/dist/components/MFloorPlanToolbar.vue.d.ts +2 -2
  89. package/dist/components/MFlow.vue.d.ts +4 -4
  90. package/dist/components/MFlowControls.vue.d.ts +6 -4
  91. package/dist/components/MFlowHandle.vue.d.ts +1 -1
  92. package/dist/components/MFlowNode.vue.d.ts +11 -9
  93. package/dist/components/MFooter.vue.d.ts +12 -10
  94. package/dist/components/MFullscreen.vue.d.ts +5 -3
  95. package/dist/components/MGantt.vue.d.ts +33 -31
  96. package/dist/components/MGanttControls.vue.d.ts +8 -6
  97. package/dist/components/MGrid.vue.d.ts +6 -4
  98. package/dist/components/MIcon.vue.d.ts +5 -0
  99. package/dist/components/MIconButton.vue.d.ts +1 -1
  100. package/dist/components/MImageCropper.vue.d.ts +14 -12
  101. package/dist/components/MInfiniteScroll.vue.d.ts +11 -9
  102. package/dist/components/MList.vue.d.ts +5 -3
  103. package/dist/components/MListGroup.vue.d.ts +7 -5
  104. package/dist/components/MListItem.vue.d.ts +21 -19
  105. package/dist/components/MListSubheader.vue.d.ts +5 -3
  106. package/dist/components/MLoadingOverlay.vue.d.ts +10 -8
  107. package/dist/components/MMap.vue.d.ts +14 -6
  108. package/dist/components/MMapControl.vue.d.ts +12 -10
  109. package/dist/components/MMapFeatureInfo.vue.d.ts +11 -9
  110. package/dist/components/MMapIdentify.vue.d.ts +9 -7
  111. package/dist/components/MMapLayers.vue.d.ts +13 -11
  112. package/dist/components/MMapMarker.vue.d.ts +7 -5
  113. package/dist/components/MMapPopup.vue.d.ts +5 -3
  114. package/dist/components/MMasonry.vue.d.ts +5 -3
  115. package/dist/components/MMenu.vue.d.ts +12 -10
  116. package/dist/components/MMenuItem.vue.d.ts +11 -9
  117. package/dist/components/MMultiAutocomplete.vue.d.ts +1 -1
  118. package/dist/components/MMultiSelect.vue.d.ts +6 -4
  119. package/dist/components/MNavigationDrawer.vue.d.ts +14 -12
  120. package/dist/components/MNavigationRail.vue.d.ts +7 -5
  121. package/dist/components/MOdontogram.vue.d.ts +1 -1
  122. package/dist/components/MOrderBook.vue.d.ts +1 -1
  123. package/dist/components/MOverlay.vue.d.ts +5 -3
  124. package/dist/components/MPdfViewer.vue.d.ts +4 -4
  125. package/dist/components/MPhoneInput.vue.d.ts +11 -9
  126. package/dist/components/MPosKeypad.vue.d.ts +18 -16
  127. package/dist/components/MProgressBar.vue.d.ts +1 -1
  128. package/dist/components/MPullToRefresh.vue.d.ts +5 -3
  129. package/dist/components/MQRCode.vue.d.ts +7 -5
  130. package/dist/components/MRadioGroup.vue.d.ts +1 -1
  131. package/dist/components/MReceipt.vue.d.ts +2 -2
  132. package/dist/components/MRelative.vue.d.ts +5 -3
  133. package/dist/components/MResourceTimeline.vue.d.ts +31 -29
  134. package/dist/components/MResponsive.vue.d.ts +5 -3
  135. package/dist/components/MResult.vue.d.ts +7 -5
  136. package/dist/components/MScrollable.vue.d.ts +7 -5
  137. package/dist/components/MSearchBar.vue.d.ts +13 -11
  138. package/dist/components/MSearchField.vue.d.ts +7 -5
  139. package/dist/components/MSection.vue.d.ts +11 -9
  140. package/dist/components/MSeekBar.vue.d.ts +3 -3
  141. package/dist/components/MSelect.vue.d.ts +1 -1
  142. package/dist/components/MShader.vue.d.ts +11 -9
  143. package/dist/components/MShortNavigationBar.vue.d.ts +1 -1
  144. package/dist/components/MSideSheet.vue.d.ts +9 -7
  145. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  146. package/dist/components/MSkeleton.vue.d.ts +2 -2
  147. package/dist/components/MSlider.vue.d.ts +3 -3
  148. package/dist/components/MSparkline.vue.d.ts +1 -1
  149. package/dist/components/MSplitButton.vue.d.ts +7 -5
  150. package/dist/components/MSplitter.vue.d.ts +9 -7
  151. package/dist/components/MSpotlightSearch.vue.d.ts +1 -1
  152. package/dist/components/MStack.vue.d.ts +8 -6
  153. package/dist/components/MStatCard.vue.d.ts +5 -3
  154. package/dist/components/MStepper.vue.d.ts +5 -3
  155. package/dist/components/MSticky.vue.d.ts +5 -3
  156. package/dist/components/MSubtitle.vue.d.ts +6 -4
  157. package/dist/components/MSwipeToDismiss.vue.d.ts +11 -9
  158. package/dist/components/MTable.vue.d.ts +17 -15
  159. package/dist/components/MText.vue.d.ts +5 -3
  160. package/dist/components/MTextField.vue.d.ts +6 -4
  161. package/dist/components/MTimePickerModal.vue.d.ts +1 -1
  162. package/dist/components/MTitle.vue.d.ts +6 -4
  163. package/dist/components/MToggleButton.vue.d.ts +5 -3
  164. package/dist/components/MToolbar.vue.d.ts +24 -22
  165. package/dist/components/MTooltip.vue.d.ts +10 -8
  166. package/dist/components/MTopAppBar.vue.d.ts +22 -20
  167. package/dist/components/MTour.vue.d.ts +28 -26
  168. package/dist/components/MTransition.vue.d.ts +5 -3
  169. package/dist/components/MTree.vue.d.ts +6 -4
  170. package/dist/components/MTreeTable.vue.d.ts +21 -19
  171. package/dist/components/MTypewriter.vue.d.ts +6 -4
  172. package/dist/components/MVirtualTable.vue.d.ts +8 -6
  173. package/dist/components/_MMapLayerItem.vue.d.ts +8 -6
  174. package/dist/components/_MPdfPage.vue.d.ts +2 -2
  175. package/dist/components/_MToolbarFab.vue.d.ts +5 -3
  176. package/dist/components/_MTreeNode.vue.d.ts +13 -11
  177. package/dist/composables/_fieldLayout.d.ts +47 -0
  178. package/dist/composables/useMap.d.ts +8 -0
  179. package/dist/{dist-CrjSW5DN.js → dist-Bj5kEq8G.js} +4 -6
  180. package/dist/dist-Bj5kEq8G.js.map +1 -0
  181. package/dist/draw.js +62 -82
  182. package/dist/draw.js.map +1 -1
  183. package/dist/{emoji-names-de-BphO5XpV.js → emoji-names-de-Cu3OSpp6.js} +2 -3
  184. package/dist/emoji-names-de-Cu3OSpp6.js.map +1 -0
  185. package/dist/{emoji-names-en-9ZvMRvzi.js → emoji-names-en-BNX1pM9h.js} +2 -3
  186. package/dist/emoji-names-en-BNX1pM9h.js.map +1 -0
  187. package/dist/{emoji-names-es-DvfWU3Pj.js → emoji-names-es-C_Dafg4D.js} +2 -3
  188. package/dist/emoji-names-es-C_Dafg4D.js.map +1 -0
  189. package/dist/{emoji-names-fr-B-jhUlsP.js → emoji-names-fr-D4HTMFuM.js} +2 -3
  190. package/dist/emoji-names-fr-D4HTMFuM.js.map +1 -0
  191. package/dist/{emoji-names-ja-l8cMFJo1.js → emoji-names-ja-BCql-Sj6.js} +2 -3
  192. package/dist/emoji-names-ja-BCql-Sj6.js.map +1 -0
  193. package/dist/{emoji-names-ko-YP-o9G0c.js → emoji-names-ko-CT8L52nn.js} +2 -3
  194. package/dist/emoji-names-ko-CT8L52nn.js.map +1 -0
  195. package/dist/{emoji-names-pt-DGj_Js4M.js → emoji-names-pt-DHiwPiL-.js} +2 -3
  196. package/dist/emoji-names-pt-DHiwPiL-.js.map +1 -0
  197. package/dist/{emoji-names-zh-Dzecwtw_.js → emoji-names-zh-L3FXVief.js} +2 -3
  198. package/dist/emoji-names-zh-L3FXVief.js.map +1 -0
  199. package/dist/flow.js +351 -374
  200. package/dist/flow.js.map +1 -1
  201. package/dist/{flowPaths-CcWOKY4Z.js → flowPaths-BaH7yaUM.js} +3 -8
  202. package/dist/flowPaths-BaH7yaUM.js.map +1 -0
  203. package/dist/gantt.js +272 -333
  204. package/dist/gantt.js.map +1 -1
  205. package/dist/locales/index.js +1 -2
  206. package/dist/locales/index.js.map +1 -1
  207. package/dist/m3ui-vue.css +1 -1
  208. package/dist/m3ui.js +4085 -4277
  209. package/dist/m3ui.js.map +1 -1
  210. package/dist/map.d.ts +1 -1
  211. package/dist/map.js +521 -520
  212. package/dist/map.js.map +1 -1
  213. package/dist/markdown.js +3 -4
  214. package/dist/markdown.js.map +1 -1
  215. package/dist/{material-color-utilities-C_iikgRm.js → material-color-utilities-CEFytLsr.js} +15 -32
  216. package/dist/material-color-utilities-CEFytLsr.js.map +1 -0
  217. package/dist/media.js +80 -94
  218. package/dist/media.js.map +1 -1
  219. package/dist/{motion-DZiXG09o.js → motion-BcejVTeX.js} +2 -3
  220. package/dist/motion-BcejVTeX.js.map +1 -0
  221. package/dist/pdf.js +103 -115
  222. package/dist/pdf.js.map +1 -1
  223. package/dist/qrcode.js +1 -2
  224. package/dist/qrcode.js.map +1 -1
  225. package/dist/rich-text-editor.js +33 -34
  226. package/dist/rich-text-editor.js.map +1 -1
  227. package/dist/styles.css +1 -1
  228. package/dist/terminal.js +2 -3
  229. package/dist/terminal.js.map +1 -1
  230. package/dist/{useLocale-DLcG3qPC.js → useLocale-COav9m8C.js} +2 -3
  231. package/dist/useLocale-COav9m8C.js.map +1 -0
  232. package/dist/{useThemeTokens-DQQcaWbE.js → useThemeTokens-DyAdPQB0.js} +6 -10
  233. package/dist/useThemeTokens-DyAdPQB0.js.map +1 -0
  234. package/package.json +32 -32
  235. package/src/__tests__/MFab.test.ts +10 -1
  236. package/src/__tests__/MMap.test.ts +16 -1
  237. package/src/__tests__/_fakeMaplibre.ts +2 -0
  238. package/src/__tests__/fieldOverflow.test.ts +118 -0
  239. package/src/components/MAutocomplete.vue +21 -24
  240. package/src/components/MColorPicker.vue +3 -3
  241. package/src/components/MDatePicker.vue +4 -4
  242. package/src/components/MDateRangePicker.vue +4 -4
  243. package/src/components/MMap.vue +12 -3
  244. package/src/components/MMapMeasure.vue +3 -1
  245. package/src/components/MMaskField.vue +16 -24
  246. package/src/components/MMultiAutocomplete.vue +19 -25
  247. package/src/components/MMultiSelect.vue +20 -27
  248. package/src/components/MNumberField.vue +16 -26
  249. package/src/components/MPinInput.vue +3 -2
  250. package/src/components/MSearchBar.vue +2 -2
  251. package/src/components/MSelect.vue +16 -22
  252. package/src/components/MTagInput.vue +19 -26
  253. package/src/components/MTextField.vue +18 -46
  254. package/src/components/MTimePicker.vue +4 -4
  255. package/src/composables/_fieldLayout.ts +117 -0
  256. package/src/composables/useMap.ts +17 -0
  257. package/src/composables/useMapLayers.ts +4 -1
  258. package/src/map.ts +1 -1
  259. package/dist/MButton-D_uxtJa-.js.map +0 -1
  260. package/dist/MDialog-DT4KAPmn.js.map +0 -1
  261. package/dist/MIcon-Bxh9j135.js.map +0 -1
  262. package/dist/MIconButton-DoNotQ9v.js.map +0 -1
  263. package/dist/MListItem-CwYrxpPZ.js.map +0 -1
  264. package/dist/MLoadingIndicator-DhzECYRI.js.map +0 -1
  265. package/dist/MMenuItem-Bih0h4-n.js.map +0 -1
  266. package/dist/MProgressBar-BCoruxA-.js.map +0 -1
  267. package/dist/MSeekBar-DQPF5FTp.js.map +0 -1
  268. package/dist/MSegmentedButton-DL9JtJFX.js.map +0 -1
  269. package/dist/MSlider-BvoMZTy9.js.map +0 -1
  270. package/dist/MSpinner-CgcCQhS9.js.map +0 -1
  271. package/dist/MTextField-B72dwF6V.js.map +0 -1
  272. package/dist/MTooltip-YyF1CO75.js.map +0 -1
  273. package/dist/_storageKeys-CYXsUBwK.js.map +0 -1
  274. package/dist/_useEscapeStack-CjndQhqg.js.map +0 -1
  275. package/dist/common-0dgrgaPL.js.map +0 -1
  276. package/dist/dist-CrjSW5DN.js.map +0 -1
  277. package/dist/emoji-names-de-BphO5XpV.js.map +0 -1
  278. package/dist/emoji-names-en-9ZvMRvzi.js.map +0 -1
  279. package/dist/emoji-names-es-DvfWU3Pj.js.map +0 -1
  280. package/dist/emoji-names-fr-B-jhUlsP.js.map +0 -1
  281. package/dist/emoji-names-ja-l8cMFJo1.js.map +0 -1
  282. package/dist/emoji-names-ko-YP-o9G0c.js.map +0 -1
  283. package/dist/emoji-names-pt-DGj_Js4M.js.map +0 -1
  284. package/dist/emoji-names-zh-Dzecwtw_.js.map +0 -1
  285. package/dist/flowPaths-CcWOKY4Z.js.map +0 -1
  286. package/dist/material-color-utilities-C_iikgRm.js.map +0 -1
  287. package/dist/motion-DZiXG09o.js.map +0 -1
  288. package/dist/useLocale-DLcG3qPC.js.map +0 -1
  289. package/dist/useThemeTokens-DQQcaWbE.js.map +0 -1
package/dist/barcode.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fragment as e, createCommentVNode as t, createElementBlock as n, createTextVNode as r, defineComponent as i, mergeProps as a, openBlock as o, ref as s, renderSlot as c, toDisplayString as l, vShow as u, watchEffect as d, withDirectives as f } from "vue";
2
2
  import p from "jsbarcode";
3
- //#region src/components/MBarcode.vue?vue&type=script&setup=true&lang.ts
3
+ // src/components/MBarcode.vue?vue&type=script&setup=true&lang.ts
4
4
  var m = ["aria-label"], h = /* @__PURE__ */ i({
5
5
  inheritAttrs: !1,
6
6
  __name: "MBarcode",
@@ -43,7 +43,6 @@ var m = ["aria-label"], h = /* @__PURE__ */ i({
43
43
  }), null, 16, m)), [[u, !_.value]])], 64));
44
44
  }
45
45
  });
46
- //#endregion
47
46
  export { h as MBarcode };
48
47
 
49
48
  //# sourceMappingURL=barcode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"barcode.js","names":["$attrs"],"sources":["../src/components/MBarcode.vue","../src/components/MBarcode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Renders a barcode as inline SVG. Available from the `/barcode` entry point.\n *\n * @slot error Shown instead of the SVG when value is invalid for the given format (e.g. a non-numeric EAN13)\n */\nimport { ref, watchEffect } from 'vue'\nimport JsBarcode from 'jsbarcode'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(\n defineProps<{\n /** Data to encode. Required — there is no default. */\n value: string\n /** Barcode symbology. Common values: 'CODE128', 'EAN13', 'EAN8', 'UPC', 'CODE39', 'ITF14', 'MSI', 'pharmacode', 'codabar'. */\n format?: string\n /** Width of the narrowest bar, in px */\n width?: number\n /** Bar height in px */\n height?: number\n /** Show the encoded text below the bars */\n displayValue?: boolean\n /** Bar color */\n color?: string\n /** Background color */\n background?: string\n /** Quiet zone around the barcode, in px */\n margin?: number\n /** Font size for the displayed value */\n fontSize?: number\n /** aria-label for the svg. Defaults to value */\n label?: string\n }>(),\n {\n format: 'CODE128',\n width: 2,\n height: 80,\n displayValue: true,\n color: '#000000',\n background: '#ffffff',\n margin: 10,\n fontSize: 20,\n },\n)\n\nconst svgEl = ref<SVGSVGElement | null>(null)\nconst error = ref<string | null>(null)\n\n// flush: 'post' runs synchronously right after (re-)render, once the ref is\n// attached — the default 'pre' flush defers the first run to a microtask\n// after the ref is set, which is later than callers expect a mount to settle.\nwatchEffect(() => {\n if (!svgEl.value) return\n error.value = null\n JsBarcode(svgEl.value, props.value, {\n format: props.format,\n width: props.width,\n height: props.height,\n displayValue: props.displayValue,\n lineColor: props.color,\n background: props.background,\n margin: props.margin,\n fontSize: props.fontSize,\n valid: (ok) => {\n if (!ok) error.value = `Invalid value \"${props.value}\" for format \"${props.format}\"`\n },\n })\n}, { flush: 'post' })\n</script>\n\n<template>\n <div v-if=\"error\" v-bind=\"$attrs\" class=\"flex items-center justify-center text-body-small text-error\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg v-show=\"!error\" v-bind=\"error ? {} : $attrs\" ref=\"svgEl\" role=\"img\" :aria-label=\"label ?? value\"></svg>\n</template>\n","<script setup lang=\"ts\">\n/**\n * Renders a barcode as inline SVG. Available from the `/barcode` entry point.\n *\n * @slot error Shown instead of the SVG when value is invalid for the given format (e.g. a non-numeric EAN13)\n */\nimport { ref, watchEffect } from 'vue'\nimport JsBarcode from 'jsbarcode'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(\n defineProps<{\n /** Data to encode. Required — there is no default. */\n value: string\n /** Barcode symbology. Common values: 'CODE128', 'EAN13', 'EAN8', 'UPC', 'CODE39', 'ITF14', 'MSI', 'pharmacode', 'codabar'. */\n format?: string\n /** Width of the narrowest bar, in px */\n width?: number\n /** Bar height in px */\n height?: number\n /** Show the encoded text below the bars */\n displayValue?: boolean\n /** Bar color */\n color?: string\n /** Background color */\n background?: string\n /** Quiet zone around the barcode, in px */\n margin?: number\n /** Font size for the displayed value */\n fontSize?: number\n /** aria-label for the svg. Defaults to value */\n label?: string\n }>(),\n {\n format: 'CODE128',\n width: 2,\n height: 80,\n displayValue: true,\n color: '#000000',\n background: '#ffffff',\n margin: 10,\n fontSize: 20,\n },\n)\n\nconst svgEl = ref<SVGSVGElement | null>(null)\nconst error = ref<string | null>(null)\n\n// flush: 'post' runs synchronously right after (re-)render, once the ref is\n// attached — the default 'pre' flush defers the first run to a microtask\n// after the ref is set, which is later than callers expect a mount to settle.\nwatchEffect(() => {\n if (!svgEl.value) return\n error.value = null\n JsBarcode(svgEl.value, props.value, {\n format: props.format,\n width: props.width,\n height: props.height,\n displayValue: props.displayValue,\n lineColor: props.color,\n background: props.background,\n margin: props.margin,\n fontSize: props.fontSize,\n valid: (ok) => {\n if (!ok) error.value = `Invalid value \"${props.value}\" for format \"${props.format}\"`\n },\n })\n}, { flush: 'post' })\n</script>\n\n<template>\n <div v-if=\"error\" v-bind=\"$attrs\" class=\"flex items-center justify-center text-body-small text-error\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg v-show=\"!error\" v-bind=\"error ? {} : $attrs\" ref=\"svgEl\" role=\"img\" :aria-label=\"label ?? value\"></svg>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAWA,IAAM,IAAQ,GAmCR,IAAQ,EAA0B,IAAI,GACtC,IAAQ,EAAmB,IAAI;SAKrC,QAAkB;GACX,EAAM,UACX,EAAM,QAAQ,MACd,EAAU,EAAM,OAAO,EAAM,OAAO;IAClC,QAAQ,EAAM;IACd,OAAO,EAAM;IACb,QAAQ,EAAM;IACd,cAAc,EAAM;IACpB,WAAW,EAAM;IACjB,YAAY,EAAM;IAClB,QAAQ,EAAM;IACd,UAAU,EAAM;IAChB,QAAQ,MAAO;KACb,AAAK,MAAI,EAAM,QAAQ,kBAAkB,EAAM,MAAM,gBAAgB,EAAM,OAAO;IACpF;GACF,CAAC;EACH,GAAG,EAAE,OAAO,OAAO,CAAC,cAIP,EAAA,GAAA,EAAA,GAAA,MAAA,CAAA,EAAA,SAAX,EAAA,GAAA,EAEM,OAFN,EAEM,EAAA,KAAA,EAAA,GAFoBA,EAAAA,QAAM,EAAE,OAAM,8DAA6D,CAAA,GAAA,CACnG,EAAqC,EAAA,QAAA,SAAA,CAAA,SAAA,CAAf,EAAA,EAAA,EAAA,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA,GAE7B,GAAA,EAAA,GAAA,EAA4G,OAA5G,EAA6B,EAA+E,QAA1E,CAAA,IAAQA,EAAAA,QAAM;GAAM,SAAA;GAAJ,KAAI;GAAQ,MAAK;GAAO,cAAY,EAAA,SAAS,EAAA;EAAjF,CAAA,GAAA,MAAA,IAAA,CAAA,IAAA,CAAA,CAAA,GAAA,CAAA,EAAA,KAAK,CAAA,CAAA,CAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"barcode.js","names":["$attrs","_openBlock","_createElementBlock","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_withDirectives","_vShow","JsBarcode","_hoisted_1","MBarcode_default","defineComponent","props","__props","svgEl","ref","error","watchEffect","ok","openBlock","createElementBlock","Fragment","mergeProps","_ctx","renderSlot","createTextVNode","toDisplayString","createCommentVNode","withDirectives","vShow"],"sources":["../src/components/MBarcode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Renders a barcode as inline SVG. Available from the `/barcode` entry point.\n *\n * @slot error Shown instead of the SVG when value is invalid for the given format (e.g. a non-numeric EAN13)\n */\nimport { ref, watchEffect } from 'vue'\nimport JsBarcode from 'jsbarcode'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(\n defineProps<{\n /** Data to encode. Required — there is no default. */\n value: string\n /** Barcode symbology. Common values: 'CODE128', 'EAN13', 'EAN8', 'UPC', 'CODE39', 'ITF14', 'MSI', 'pharmacode', 'codabar'. */\n format?: string\n /** Width of the narrowest bar, in px */\n width?: number\n /** Bar height in px */\n height?: number\n /** Show the encoded text below the bars */\n displayValue?: boolean\n /** Bar color */\n color?: string\n /** Background color */\n background?: string\n /** Quiet zone around the barcode, in px */\n margin?: number\n /** Font size for the displayed value */\n fontSize?: number\n /** aria-label for the svg. Defaults to value */\n label?: string\n }>(),\n {\n format: 'CODE128',\n width: 2,\n height: 80,\n displayValue: true,\n color: '#000000',\n background: '#ffffff',\n margin: 10,\n fontSize: 20,\n },\n)\n\nconst svgEl = ref<SVGSVGElement | null>(null)\nconst error = ref<string | null>(null)\n\n// flush: 'post' runs synchronously right after (re-)render, once the ref is\n// attached — the default 'pre' flush defers the first run to a microtask\n// after the ref is set, which is later than callers expect a mount to settle.\nwatchEffect(() => {\n if (!svgEl.value) return\n error.value = null\n JsBarcode(svgEl.value, props.value, {\n format: props.format,\n width: props.width,\n height: props.height,\n displayValue: props.displayValue,\n lineColor: props.color,\n background: props.background,\n margin: props.margin,\n fontSize: props.fontSize,\n valid: (ok) => {\n if (!ok) error.value = `Invalid value \"${props.value}\" for format \"${props.format}\"`\n },\n })\n}, { flush: 'post' })\n</script>\n\n<template>\n <div v-if=\"error\" v-bind=\"$attrs\" class=\"flex items-center justify-center text-body-small text-error\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg v-show=\"!error\" v-bind=\"error ? {} : $attrs\" ref=\"svgEl\" role=\"img\" :aria-label=\"label ?? value\"></svg>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAWA,IAAMa,IAAQC,GAmCRC,IAAQC,EAA0B,IAAI,GACtCC,IAAQD,EAAmB,IAAI;E,OAKrCE,QAAkB;GAChB,AAAKH,EAAM,UACX,EAAM,QAAQ,MACdN,EAAUM,EAAM,OAAOF,EAAM,OAAO;IAClC,QAAQA,EAAM;IACd,OAAOA,EAAM;IACb,QAAQA,EAAM;IACd,cAAcA,EAAM;IACpB,WAAWA,EAAM;IACjB,YAAYA,EAAM;IAClB,QAAQA,EAAM;IACd,UAAUA,EAAM;IAChB,QAAQ,MAAO;KACb,AAAKM,MAAI,EAAM,QAAQ,kBAAkBN,EAAM,MAAM,gBAAgBA,EAAM,OAAO;IACpF;GACF,CAAC;EACH,GAAG,EAAE,OAAO,OAAO,CAAC,I,2BAIPI,EAAA,SAAXhB,EAAA,GAAAC,EAEM,OAFNC,EAEM,EAAA,KAAA,EAAA,GAFoBH,EAAAA,QAAM,EAAE,OAAM,8DAA6D,CAAA,GAAA,CACnGI,EAAqCoB,EAAA,QAAA,SAAA,CAAA,SAAA,CAAfnB,EAAAC,EAAAW,EAAA,KAAK,GAAA,CAAA,C,uBAE7BV,GAAAN,EAAA,GAAAC,EAA4G,OAA5GC,EAA6Bc,EAA+E,QAA1E,CAAA,IAAQjB,EAAAA,QAAM;GAAM,SAAA;GAAJ,KAAIe;GAAQ,MAAK;GAAO,cAAYD,EAAA,SAASA,EAAA;E,oBAAjF,CAAAN,GAAA,CAAAS,EAAA,KAAK,C"}
package/dist/chart.js CHANGED
@@ -1,7 +1,6 @@
1
- import { t as e } from "./useThemeTokens-DQQcaWbE.js";
1
+ import { t as e } from "./useThemeTokens-DyAdPQB0.js";
2
2
  import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, defineComponent as a, normalizeStyle as o, onMounted as s, openBlock as c, ref as l, resolveDynamicComponent as u, shallowRef as d, watch as f } from "vue";
3
- //#endregion
4
- //#region src/components/MChart.vue
3
+ // src/components/MChart.vue
5
4
  var p = /* @__PURE__ */ a({
6
5
  __name: "MChart",
7
6
  props: {
@@ -186,7 +185,6 @@ var p = /* @__PURE__ */ a({
186
185
  }, null, 8, ["data", "options"])) : r("", !0)], 4));
187
186
  }
188
187
  });
189
- //#endregion
190
188
  export { p as MChart };
191
189
 
192
190
  //# sourceMappingURL=chart.js.map
package/dist/chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"chart.js","names":[],"sources":["../src/components/MChart.vue","../src/components/MChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, palette, contrast). Datasets without colors of their own get\n * the theme's too, one per series (one per slice in a pie or doughnut). Available from the `/chart` entry point.\n */\nimport { computed, ref, watch, onMounted, shallowRef, type Component } from 'vue'\nimport { useThemeTokens } from '../composables/useThemeTokens'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n /**\n * Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3\n * role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,\n * error, outline\n */\n colors?: string[]\n }>(),\n { height: '300px' },\n)\n\nconst SERIES = ['primary', 'tertiary', 'secondary', 'success', 'error', 'outline']\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\n// Every role a color list may name, read as plain strings (a canvas can't resolve CSS variables) and kept current\n// across theme, palette, contrast and generated-palette changes, settled after the switch's color transition\nconst ROLES = [\n 'primary', 'secondary', 'tertiary', 'error', 'success', 'outline', 'outline-variant', 'inverse-primary',\n 'primary-container', 'secondary-container', 'tertiary-container', 'error-container', 'success-container',\n 'on-surface', 'on-surface-variant', 'surface', 'surface-container',\n] as const\nconst tokens = useThemeTokens(ROLES)\nconst isRole = (c: string): c is (typeof ROLES)[number] => (ROLES as readonly string[]).includes(c)\nconst resolve = (c: string) => (isRole(c) ? tokens.value[c] : c)\n\n// Canvas can't resolve CSS vars either for fonts: pass Chart.js the resolved stack, read again once web fonts load\n// (text drawn before keeps the fallback)\nconst readFont = () =>\n (typeof document === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue('--font-sans').trim())\n || \"'Roboto', system-ui, sans-serif\"\nconst fontFamily = ref(readFont())\n\nconst m3Colors = computed(() => ({\n onSurface: tokens.value['on-surface'],\n onSurfaceVariant: tokens.value['on-surface-variant'],\n outlineVariant: tokens.value['outline-variant'],\n surface: tokens.value.surface,\n surfaceContainer: tokens.value['surface-container'],\n fontFamily: fontFamily.value,\n}))\n\n/** A color at some opacity, for fills under a line or inside a radar. */\nfunction withAlpha(color: string, a: number) {\n const m = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i)\n if (m) return `rgba(${parseInt(m[1]!, 16)}, ${parseInt(m[2]!, 16)}, ${parseInt(m[3]!, 16)}, ${a})`\n return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`\n}\n\n// Datasets without colors get the theme's: only the keys they leave unset, so a consumer's own colors always win\nconst themedData = computed(() => {\n const data = props.data\n if (!Array.isArray(data?.datasets)) return data\n const palette = (props.colors?.length ? props.colors : SERIES).map(resolve)\n const at = (i: number) => palette[i % palette.length]!\n const slices = props.type === 'pie' || props.type === 'doughnut'\n const datasets = data.datasets.map((ds: Record<string, any>, i: number) => {\n const fill: Record<string, any> = {}\n if (slices) {\n if (ds.backgroundColor === undefined) fill.backgroundColor = (ds.data ?? []).map((_: unknown, j: number) => at(j))\n // Slices separated by the card's own color\n if (ds.borderColor === undefined) fill.borderColor = m3Colors.value.surface\n } else {\n const c = at(i)\n if (ds.borderColor === undefined) fill.borderColor = c\n if (ds.backgroundColor === undefined) fill.backgroundColor = props.type === 'bar' ? c : withAlpha(c, props.type === 'radar' ? 0.2 : 0.15)\n if (props.type !== 'bar' && ds.pointBackgroundColor === undefined) fill.pointBackgroundColor = c\n }\n return { ...fill, ...ds }\n })\n return { ...data, datasets }\n})\n\nonMounted(async () => {\n fontFamily.value = readFont()\n document.fonts?.ready.then(() => { fontFamily.value = readFont() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: withAlpha(c.outlineVariant, 0.25) },\n angleLines: { color: withAlpha(c.outlineVariant, 0.25) },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"themedData\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, palette, contrast). Datasets without colors of their own get\n * the theme's too, one per series (one per slice in a pie or doughnut). Available from the `/chart` entry point.\n */\nimport { computed, ref, watch, onMounted, shallowRef, type Component } from 'vue'\nimport { useThemeTokens } from '../composables/useThemeTokens'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n /**\n * Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3\n * role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,\n * error, outline\n */\n colors?: string[]\n }>(),\n { height: '300px' },\n)\n\nconst SERIES = ['primary', 'tertiary', 'secondary', 'success', 'error', 'outline']\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\n// Every role a color list may name, read as plain strings (a canvas can't resolve CSS variables) and kept current\n// across theme, palette, contrast and generated-palette changes, settled after the switch's color transition\nconst ROLES = [\n 'primary', 'secondary', 'tertiary', 'error', 'success', 'outline', 'outline-variant', 'inverse-primary',\n 'primary-container', 'secondary-container', 'tertiary-container', 'error-container', 'success-container',\n 'on-surface', 'on-surface-variant', 'surface', 'surface-container',\n] as const\nconst tokens = useThemeTokens(ROLES)\nconst isRole = (c: string): c is (typeof ROLES)[number] => (ROLES as readonly string[]).includes(c)\nconst resolve = (c: string) => (isRole(c) ? tokens.value[c] : c)\n\n// Canvas can't resolve CSS vars either for fonts: pass Chart.js the resolved stack, read again once web fonts load\n// (text drawn before keeps the fallback)\nconst readFont = () =>\n (typeof document === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue('--font-sans').trim())\n || \"'Roboto', system-ui, sans-serif\"\nconst fontFamily = ref(readFont())\n\nconst m3Colors = computed(() => ({\n onSurface: tokens.value['on-surface'],\n onSurfaceVariant: tokens.value['on-surface-variant'],\n outlineVariant: tokens.value['outline-variant'],\n surface: tokens.value.surface,\n surfaceContainer: tokens.value['surface-container'],\n fontFamily: fontFamily.value,\n}))\n\n/** A color at some opacity, for fills under a line or inside a radar. */\nfunction withAlpha(color: string, a: number) {\n const m = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i)\n if (m) return `rgba(${parseInt(m[1]!, 16)}, ${parseInt(m[2]!, 16)}, ${parseInt(m[3]!, 16)}, ${a})`\n return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`\n}\n\n// Datasets without colors get the theme's: only the keys they leave unset, so a consumer's own colors always win\nconst themedData = computed(() => {\n const data = props.data\n if (!Array.isArray(data?.datasets)) return data\n const palette = (props.colors?.length ? props.colors : SERIES).map(resolve)\n const at = (i: number) => palette[i % palette.length]!\n const slices = props.type === 'pie' || props.type === 'doughnut'\n const datasets = data.datasets.map((ds: Record<string, any>, i: number) => {\n const fill: Record<string, any> = {}\n if (slices) {\n if (ds.backgroundColor === undefined) fill.backgroundColor = (ds.data ?? []).map((_: unknown, j: number) => at(j))\n // Slices separated by the card's own color\n if (ds.borderColor === undefined) fill.borderColor = m3Colors.value.surface\n } else {\n const c = at(i)\n if (ds.borderColor === undefined) fill.borderColor = c\n if (ds.backgroundColor === undefined) fill.backgroundColor = props.type === 'bar' ? c : withAlpha(c, props.type === 'radar' ? 0.2 : 0.15)\n if (props.type !== 'bar' && ds.pointBackgroundColor === undefined) fill.pointBackgroundColor = c\n }\n return { ...fill, ...ds }\n })\n return { ...data, datasets }\n})\n\nonMounted(async () => {\n fontFamily.value = readFont()\n document.fonts?.ready.then(() => { fontFamily.value = readFont() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: withAlpha(c.outlineVariant, 0.25) },\n angleLines: { color: withAlpha(c.outlineVariant, 0.25) },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"themedData\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAWA,IAAM,IAAQ,GAuBR,IAAS;GAAC;GAAW;GAAY;GAAa;GAAW;GAAS;EAAS,GAE3E,IAAQ,EAAI,EAAK,GACjB,IAAiB,EAA6B,IAAI,GAClD,IAAe,EAAsC,CAAC,CAAC,GAIvD,IAAQ;GACZ;GAAW;GAAa;GAAY;GAAS;GAAW;GAAW;GAAmB;GACtF;GAAqB;GAAuB;GAAsB;GAAmB;GACrF;GAAc;GAAsB;GAAW;EACjD,GACM,IAAS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W,CAAC,CAAC;EAC5C,CAAC;EAED,SAAS,EAAU,GAAa,GAAkB;GAChD,IAAM,IAAS,EAAE,GAAG,EAAO;GAC3B,KAAK,IAAM,KAAO,OAAO,KAAK,CAAM,GAClC,AAGE,EAAO,KAHL,EAAO,MAAQ,OAAO,EAAO,MAAS,YAAY,CAAC,MAAM,QAAQ,EAAO,EAAI,IAChE,EAAU,EAAO,MAAQ,CAAC,GAAG,EAAO,EAAI,IAExC,EAAO;GAGzB,OAAO;EACT;oBAIE,EAAA,GAAA,EAOM,OAAA;GAPD,OAAM;GAA2D,OAAK,EAAA,EAAA,QAAI,EAAA,OAAM,CAAA;EAE3E,GAAA,CAAA,EAAA,SAAS,EAAA,SADjB,EAAA,GAAA,EAKE,EAHK,EAAA,KAAc,GAAA;;GAClB,MAAM,EAAA;GACN,SAAS,EAAA"}
1
+ {"version":3,"file":"chart.js","names":["_openBlock","_createElementBlock","_normalizeStyle","_createBlock","_resolveDynamicComponent","useThemeTokens","MChart_default","defineComponent","props","__props","SERIES","ready","ref","chartComponent","shallowRef","componentMap","ROLES","tokens","isRole","c","resolve","readFont","fontFamily","m3Colors","computed","withAlpha","m","color","a","themedData","data","palette","at","i","slices","datasets","fill","ds","j","onMounted","chartjs","vueChartjs","watch","mergedOptions","base","deepMerge","output","target","key","source","openBlock","createElementBlock","normalizeStyle","createBlock","resolveDynamicComponent","createCommentVNode"],"sources":["../src/components/MChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, palette, contrast). Datasets without colors of their own get\n * the theme's too, one per series (one per slice in a pie or doughnut). Available from the `/chart` entry point.\n */\nimport { computed, ref, watch, onMounted, shallowRef, type Component } from 'vue'\nimport { useThemeTokens } from '../composables/useThemeTokens'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n /**\n * Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3\n * role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,\n * error, outline\n */\n colors?: string[]\n }>(),\n { height: '300px' },\n)\n\nconst SERIES = ['primary', 'tertiary', 'secondary', 'success', 'error', 'outline']\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\n// Every role a color list may name, read as plain strings (a canvas can't resolve CSS variables) and kept current\n// across theme, palette, contrast and generated-palette changes, settled after the switch's color transition\nconst ROLES = [\n 'primary', 'secondary', 'tertiary', 'error', 'success', 'outline', 'outline-variant', 'inverse-primary',\n 'primary-container', 'secondary-container', 'tertiary-container', 'error-container', 'success-container',\n 'on-surface', 'on-surface-variant', 'surface', 'surface-container',\n] as const\nconst tokens = useThemeTokens(ROLES)\nconst isRole = (c: string): c is (typeof ROLES)[number] => (ROLES as readonly string[]).includes(c)\nconst resolve = (c: string) => (isRole(c) ? tokens.value[c] : c)\n\n// Canvas can't resolve CSS vars either for fonts: pass Chart.js the resolved stack, read again once web fonts load\n// (text drawn before keeps the fallback)\nconst readFont = () =>\n (typeof document === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue('--font-sans').trim())\n || \"'Roboto', system-ui, sans-serif\"\nconst fontFamily = ref(readFont())\n\nconst m3Colors = computed(() => ({\n onSurface: tokens.value['on-surface'],\n onSurfaceVariant: tokens.value['on-surface-variant'],\n outlineVariant: tokens.value['outline-variant'],\n surface: tokens.value.surface,\n surfaceContainer: tokens.value['surface-container'],\n fontFamily: fontFamily.value,\n}))\n\n/** A color at some opacity, for fills under a line or inside a radar. */\nfunction withAlpha(color: string, a: number) {\n const m = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i)\n if (m) return `rgba(${parseInt(m[1]!, 16)}, ${parseInt(m[2]!, 16)}, ${parseInt(m[3]!, 16)}, ${a})`\n return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`\n}\n\n// Datasets without colors get the theme's: only the keys they leave unset, so a consumer's own colors always win\nconst themedData = computed(() => {\n const data = props.data\n if (!Array.isArray(data?.datasets)) return data\n const palette = (props.colors?.length ? props.colors : SERIES).map(resolve)\n const at = (i: number) => palette[i % palette.length]!\n const slices = props.type === 'pie' || props.type === 'doughnut'\n const datasets = data.datasets.map((ds: Record<string, any>, i: number) => {\n const fill: Record<string, any> = {}\n if (slices) {\n if (ds.backgroundColor === undefined) fill.backgroundColor = (ds.data ?? []).map((_: unknown, j: number) => at(j))\n // Slices separated by the card's own color\n if (ds.borderColor === undefined) fill.borderColor = m3Colors.value.surface\n } else {\n const c = at(i)\n if (ds.borderColor === undefined) fill.borderColor = c\n if (ds.backgroundColor === undefined) fill.backgroundColor = props.type === 'bar' ? c : withAlpha(c, props.type === 'radar' ? 0.2 : 0.15)\n if (props.type !== 'bar' && ds.pointBackgroundColor === undefined) fill.pointBackgroundColor = c\n }\n return { ...fill, ...ds }\n })\n return { ...data, datasets }\n})\n\nonMounted(async () => {\n fontFamily.value = readFont()\n document.fonts?.ready.then(() => { fontFamily.value = readFont() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: withAlpha(c.outlineVariant, 0.25) },\n angleLines: { color: withAlpha(c.outlineVariant, 0.25) },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"themedData\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAWA,IAAMQ,IAAQC,GAuBRC,IAAS;GAAC;GAAW;GAAY;GAAa;GAAW;GAAS;EAAS,GAE3EC,IAAQC,EAAI,EAAK,GACjBC,IAAiBC,EAA6B,IAAI,GAClDC,IAAeD,EAAsC,CAAC,CAAC,GAIvDE,IAAQ;GACZ;GAAW;GAAa;GAAY;GAAS;GAAW;GAAW;GAAmB;GACtF;GAAqB;GAAuB;GAAsB;GAAmB;GACrF;GAAc;GAAsB;GAAW;EACjD,GACMC,IAASZ,EAAeW,CAAK,GAC7BE,KAAU,MAA4CF,EAA4B,SAASG,CAAC,GAC5FC,KAAW,MAAeF,EAAOC,CAAC,IAAIF,EAAO,MAAME,KAAKA,GAIxDE,WACH,OAAO,WAAa,MAAc,KAAK,iBAAiB,SAAS,eAAe,CAAC,CAAC,iBAAiB,aAAa,CAAC,CAAC,KAAK,MACrH,mCACCC,IAAaV,EAAIS,EAAS,CAAC,GAE3BE,IAAWC,SAAgB;GAC/B,WAAWP,EAAO,MAAM;GACxB,kBAAkBA,EAAO,MAAM;GAC/B,gBAAgBA,EAAO,MAAM;GAC7B,SAASA,EAAO,MAAM;GACtB,kBAAkBA,EAAO,MAAM;GAC/B,YAAYK,EAAW;EACzB,EAAE;EAGF,SAASG,EAAU,GAAe,GAAW;GAC3C,IAAMC,IAAIC,EAAM,MAAM,0CAA0C;GAEhE,OADID,IAAU,QAAQ,SAASA,EAAE,IAAK,EAAE,EAAE,IAAI,SAASA,EAAE,IAAK,EAAE,EAAE,IAAI,SA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EAAA,SADjBb,EAAA,GAAAG,EAKEC,EAHKS,EAAA,KAAc,GAAA;;GAClB,MAAMgB,EAAA;GACN,SAASc,EAAA"}
@@ -1,12 +1,12 @@
1
- import { i as e } from "./useLocale-DLcG3qPC.js";
2
- import { t } from "./MIcon-Bxh9j135.js";
3
- import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
1
+ import { t as e } from "./MIcon-DpajuUTJ.js";
2
+ import { t } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
3
+ import { i as n } from "./useLocale-COav9m8C.js";
4
4
  import { computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, watch as v, withCtx as y } from "vue";
5
- //#region src/components/MCodeEditor.vue?vue&type=script&setup=true&lang.ts
5
+ // src/components/MCodeEditor.vue?vue&type=script&setup=true&lang.ts
6
6
  var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline-variant" }, x = { class: "flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2" }, S = { class: "text-label-medium text-on-surface-variant" }, C = { class: "flex items-center gap-2" }, w = ["title"], T = {
7
7
  key: 0,
8
8
  class: "text-primary"
9
- }, E = /*#__PURE__*/ n(/* @__PURE__ */ l({
9
+ }, E = /*#__PURE__*/ t(/* @__PURE__ */ l({
10
10
  __name: "MCodeEditor",
11
11
  props: {
12
12
  modelValue: {},
@@ -29,8 +29,8 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
29
29
  }
30
30
  },
31
31
  emits: ["update:modelValue"],
32
- setup(e, { emit: n }) {
33
- let s = e, l = n, y = h(null), E = null, D = null, O = h(!1);
32
+ setup(t, { emit: n }) {
33
+ let s = t, l = n, y = h(null), E = null, D = null, O = h(!1);
34
34
  async function k() {
35
35
  await navigator.clipboard.writeText(s.modelValue), O.value = !0, setTimeout(() => {
36
36
  O.value = !1;
@@ -57,7 +57,7 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
57
57
  import("@codemirror/state"),
58
58
  import("@codemirror/commands"),
59
59
  import("@codemirror/language"),
60
- import("./dist-CrjSW5DN.js"),
60
+ import("./dist-Bj5kEq8G.js"),
61
61
  import("@codemirror/theme-one-dark"),
62
62
  import("@codemirror/lang-javascript"),
63
63
  import("@codemirror/lang-json"),
@@ -291,7 +291,7 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
291
291
  class: "flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8",
292
292
  title: O.value ? "Copied!" : "Copy code",
293
293
  onClick: k
294
- }, [c(t, {
294
+ }, [c(e, {
295
295
  name: O.value ? "check" : "content_copy",
296
296
  size: 16,
297
297
  class: u(O.value ? "text-primary" : "")
@@ -300,8 +300,8 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
300
300
  ref: y,
301
301
  class: "code-editor-container overflow-auto bg-surface text-on-surface",
302
302
  style: d({
303
- minHeight: e.minHeight,
304
- maxHeight: e.maxHeight
303
+ minHeight: t.minHeight,
304
+ maxHeight: t.maxHeight
305
305
  })
306
306
  }, null, 4)]));
307
307
  }
@@ -321,8 +321,8 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
321
321
  labels: {}
322
322
  },
323
323
  emits: ["update:modelValue"],
324
- setup(n, { emit: l }) {
325
- let d = e(), f = n, p = r(() => ({
324
+ setup(t, { emit: l }) {
325
+ let d = n(), f = t, p = r(() => ({
326
326
  valid: d.jsonValid,
327
327
  invalid: d.jsonInvalid,
328
328
  format: d.jsonFormat,
@@ -359,36 +359,36 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
359
359
  b.value = JSON.stringify(e), x.value = null, g("update:modelValue", e);
360
360
  } catch {}
361
361
  }
362
- return (e, r) => (m(), a("div", D, [c(E, {
362
+ return (n, r) => (m(), a("div", D, [c(E, {
363
363
  "model-value": b.value,
364
364
  language: "json",
365
- readonly: n.readonly,
366
- "min-height": n.minHeight,
367
- "max-height": n.maxHeight,
365
+ readonly: t.readonly,
366
+ "min-height": t.minHeight,
367
+ "max-height": t.maxHeight,
368
368
  "onUpdate:modelValue": C
369
369
  }, {
370
370
  actions: y(() => [o("div", O, [
371
- o("span", { class: u(["flex items-center gap-1 rounded-full px-2.5 py-0.5 text-label-small", S.value ? "bg-success-container text-on-success-container" : "bg-error-container text-on-error-container"]) }, [c(t, {
371
+ o("span", { class: u(["flex items-center gap-1 rounded-full px-2.5 py-0.5 text-label-small", S.value ? "bg-success-container text-on-success-container" : "bg-error-container text-on-error-container"]) }, [c(e, {
372
372
  name: S.value ? "check_circle" : "error",
373
373
  size: 14
374
374
  }, null, 8, ["name"]), s(" " + _(S.value ? p.value.valid : p.value.invalid), 1)], 2),
375
- n.readonly ? i("", !0) : (m(), a("button", {
375
+ t.readonly ? i("", !0) : (m(), a("button", {
376
376
  key: 0,
377
377
  type: "button",
378
378
  title: p.value.format,
379
379
  class: "flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8",
380
380
  onClick: w
381
- }, [c(t, {
381
+ }, [c(e, {
382
382
  name: "format_indent_increase",
383
383
  size: 16
384
384
  }), s(" " + _(p.value.format), 1)], 8, k)),
385
- n.readonly ? i("", !0) : (m(), a("button", {
385
+ t.readonly ? i("", !0) : (m(), a("button", {
386
386
  key: 1,
387
387
  type: "button",
388
388
  title: p.value.minify,
389
389
  class: "flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8",
390
390
  onClick: T
391
- }, [c(t, {
391
+ }, [c(e, {
392
392
  name: "compress",
393
393
  size: 16
394
394
  }), s(" " + _(p.value.minify), 1)], 8, A))
@@ -402,7 +402,6 @@ var b = { class: "flex flex-col overflow-hidden rounded-lg border border-outline
402
402
  ]), x.value ? (m(), a("p", j, _(x.value), 1)) : i("", !0)]));
403
403
  }
404
404
  });
405
- //#endregion
406
405
  export { E as MCodeEditor, M as MJsonEditor };
407
406
 
408
407
  //# sourceMappingURL=code-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.js","names":[],"sources":["../src/components/MCodeEditor.vue","../src/components/MCodeEditor.vue","../src/components/MJsonEditor.vue","../src/components/MJsonEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A syntax-highlighted code editor built on CodeMirror 6, with a header bar, line numbers, and a copy button.\n *\n * @slot actions Extra controls rendered in the header bar, before the built-in copy button\n * @event update:modelValue Emitted on every document change — powers v-model\n */\nimport { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'\nimport MIcon from './MIcon.vue'\n\ntype Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'c' | 'cpp' | 'rust' | 'asm' | 'plain'\n\nconst props = withDefaults(\n defineProps<{\n /** Editor content (v-model) */\n modelValue: string\n /** Syntax language */\n language?: Language\n /** Read-only mode */\n readonly?: boolean\n /** Show line numbers */\n lineNumbers?: boolean\n /** Color theme */\n theme?: 'light' | 'dark'\n /** Minimum editor height */\n minHeight?: string\n /** Maximum editor height */\n maxHeight?: string\n /** Placeholder text shown via CodeMirror when the editor is empty */\n placeholder?: string\n /** Word wrap */\n wrap?: boolean\n }>(),\n {\n language: 'javascript',\n readonly: false,\n lineNumbers: true,\n theme: 'light',\n minHeight: '200px',\n maxHeight: '600px',\n wrap: true,\n },\n)\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst containerRef = ref<HTMLElement | null>(null)\nlet view: any = null\nlet cmModules: any = null\nconst copied = ref(false)\n\nasync function copyCode() {\n await navigator.clipboard.writeText(props.modelValue)\n copied.value = true\n setTimeout(() => { copied.value = false }, 1500)\n}\n\nconst langLabel = computed(() => {\n const labels: Record<Language, string> = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n json: 'JSON',\n html: 'HTML',\n css: 'CSS',\n python: 'Python',\n vue: 'Vue',\n c: 'C',\n cpp: 'C++',\n rust: 'Rust',\n asm: 'Assembly',\n plain: 'Texto',\n }\n return labels[props.language]\n})\n\nasync function loadModules() {\n if (cmModules) return cmModules\n\n const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod] = await Promise.all([\n import('@codemirror/view'),\n import('@codemirror/state'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n import('@lezer/highlight'),\n import('@codemirror/theme-one-dark'),\n import('@codemirror/lang-javascript'),\n import('@codemirror/lang-json'),\n import('@codemirror/lang-html'),\n import('@codemirror/lang-css'),\n import('@codemirror/lang-python'),\n import('@codemirror/lang-vue'),\n import('@codemirror/lang-cpp'),\n import('@codemirror/lang-rust'),\n import('@codemirror/legacy-modes/mode/gas'),\n ])\n\n cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod }\n return cmModules\n}\n\nfunction buildM3HighlightStyle(languageMod: any, tags: any) {\n return languageMod.HighlightStyle.define([\n { tag: tags.keyword, color: 'var(--color-primary)' },\n { tag: tags.controlKeyword, color: 'var(--color-primary)', fontWeight: '500' },\n { tag: tags.operatorKeyword, color: 'var(--color-primary)' },\n { tag: tags.definitionKeyword, color: 'var(--color-primary)' },\n { tag: tags.moduleKeyword, color: 'var(--color-primary)' },\n\n { tag: tags.string, color: 'var(--color-tertiary)' },\n { tag: tags.regexp, color: 'var(--color-tertiary)' },\n\n { tag: tags.number, color: 'var(--color-error)' },\n { tag: tags.bool, color: 'var(--color-error)' },\n\n { tag: tags.function(tags.variableName), color: 'var(--color-secondary)' },\n { tag: tags.function(tags.definition(tags.variableName)), color: 'var(--color-secondary)', fontWeight: '500' },\n\n { tag: tags.typeName, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.className, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.namespace, color: 'var(--color-on-surface-variant)' },\n\n { tag: tags.propertyName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.propertyName), color: 'var(--color-on-surface)' },\n\n { tag: tags.variableName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.variableName), color: 'var(--color-on-surface)' },\n\n { tag: tags.comment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.lineComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.blockComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n\n { tag: tags.meta, color: 'var(--color-on-surface-variant)' },\n { tag: tags.tagName, color: 'var(--color-primary)' },\n { tag: tags.attributeName, color: 'var(--color-tertiary)' },\n { tag: tags.attributeValue, color: 'var(--color-secondary)' },\n\n { tag: tags.atom, color: 'var(--color-error)' },\n { tag: tags.null, color: 'var(--color-error)' },\n\n { tag: tags.punctuation, color: 'var(--color-on-surface-variant)' },\n { tag: tags.bracket, color: 'var(--color-on-surface-variant)' },\n { tag: tags.operator, color: 'var(--color-on-surface-variant)' },\n { tag: tags.separator, color: 'var(--color-on-surface-variant)' },\n ])\n}\n\nfunction getLangExtension(mods: any) {\n switch (props.language) {\n case 'javascript': return mods.jsMod.javascript()\n case 'typescript': return mods.jsMod.javascript({ typescript: true })\n case 'json': return mods.jsonMod.json()\n case 'html': return mods.htmlMod.html()\n case 'css': return mods.cssMod.css()\n case 'python': return mods.pyMod.python()\n case 'vue': return mods.vueMod.vue()\n case 'c': case 'cpp': return mods.cppMod.cpp()\n case 'rust': return mods.rustMod.rust()\n case 'asm': return mods.languageMod.StreamLanguage.define(mods.asmMod.gas)\n default: return []\n }\n}\n\nfunction buildExtensions(mods: any) {\n const { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod } = mods\n\n const m3Style = buildM3HighlightStyle(languageMod, highlightMod.tags)\n\n const exts = [\n viewMod.keymap.of([...commandsMod.defaultKeymap, ...commandsMod.historyKeymap, commandsMod.indentWithTab]),\n commandsMod.history(),\n languageMod.bracketMatching(),\n languageMod.indentOnInput(),\n languageMod.foldGutter(),\n viewMod.drawSelection(),\n viewMod.highlightActiveLine(),\n viewMod.highlightActiveLineGutter(),\n languageMod.syntaxHighlighting(m3Style),\n languageMod.syntaxHighlighting(languageMod.defaultHighlightStyle, { fallback: true }),\n getLangExtension(mods),\n viewMod.EditorView.updateListener.of((update: any) => {\n if (update.docChanged) emit('update:modelValue', update.state.doc.toString())\n }),\n stateMod.EditorState.readOnly.of(props.readonly),\n ]\n\n if (props.wrap) exts.push(viewMod.EditorView.lineWrapping)\n if (props.lineNumbers) exts.push(viewMod.lineNumbers())\n if (props.theme === 'dark') exts.push(oneDarkMod.oneDark)\n if (props.placeholder) exts.push(viewMod.placeholder(props.placeholder))\n\n return exts\n}\n\nasync function createEditor() {\n if (!containerRef.value) return\n const mods = await loadModules()\n const { viewMod, stateMod } = mods\n\n view?.destroy()\n\n view = new viewMod.EditorView({\n state: stateMod.EditorState.create({\n doc: props.modelValue,\n extensions: buildExtensions(mods),\n }),\n parent: containerRef.value,\n })\n}\n\nonMounted(createEditor)\n\nwatch(() => props.modelValue, (val) => {\n if (view && view.state.doc.toString() !== val) {\n view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: val } })\n }\n})\n\nwatch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap, () => props.placeholder], createEditor)\n\nonBeforeUnmount(() => view?.destroy())\n</script>\n\n<template>\n <div class=\"flex flex-col overflow-hidden rounded-lg border border-outline-variant\">\n <!-- Header bar -->\n <div class=\"flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2\">\n <span class=\"text-label-medium text-on-surface-variant\">{{ langLabel }}</span>\n <div class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n <button\n type=\"button\"\n class=\"flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n :title=\"copied ? 'Copied!' : 'Copy code'\"\n @click=\"copyCode\"\n >\n <MIcon :name=\"copied ? 'check' : 'content_copy'\" :size=\"16\" :class=\"copied ? 'text-primary' : ''\" />\n <span v-if=\"copied\" class=\"text-primary\">Copied</span>\n </button>\n </div>\n </div>\n\n <!-- Editor -->\n <div\n ref=\"containerRef\"\n class=\"code-editor-container overflow-auto bg-surface text-on-surface\"\n :style=\"{ minHeight, maxHeight }\"\n />\n </div>\n</template>\n\n<style scoped>\n.code-editor-container {\n /* .cm-editor/.cm-scroller/.cm-gutters all use height:100%, which only ever\n resolves against a genuinely definite ancestor height — a min-height (what\n this container has, so it can grow with content up to maxHeight) doesn't\n count as definite for that percentage chain, so .cm-gutters silently fell\n back to sizing off its own content instead of the real editor height.\n Making this a flex column and letting .cm-editor grow via flex instead of\n a % height gives the whole chain a real definite size to resolve against. */\n display: flex;\n flex-direction: column;\n /* Also grow to fill the outer wrapper (see the root element's own flex-col\n above) rather than just sitting at minHeight, whenever a consumer stretches\n the whole component taller than that — e.g. `class=\"h-full\"` in a grid\n cell next to taller content. Still hard-capped by maxHeight either way. */\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.code-editor-container :deep(.cm-editor) {\n flex: 1;\n min-height: 0;\n font-size: 0.8125rem;\n}\n\n.code-editor-container :deep(.cm-editor.cm-focused) {\n outline: none;\n}\n\n.code-editor-container :deep(.cm-scroller) {\n /* .cm-scroller normally sizes itself off a height:100% against .cm-editor,\n but that's a percentage-height-in-nested-flex-column case that browsers\n don't reliably resolve — grow it directly instead so it has a real,\n laid-out height for .cm-gutters to stretch against below. */\n flex: 1 !important;\n min-height: 0;\n /* .cm-scroller lays out .cm-gutters/.cm-content in a row (gutter | content),\n so .cm-gutters' height comes from cross-axis stretch, not flex-grow —\n CodeMirror's own base theme sets align-items: flex-start !important here,\n which is exactly what stops the gutter from stretching to full height in\n the first place. */\n align-items: stretch !important;\n /* Set here, not on .cm-editor: CodeMirror's base theme declares\n font-family: monospace and line-height: 1.4 on .cm-scroller itself,\n which beats inheritance */\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n line-height: 1.6;\n}\n\n.code-editor-container :deep(.cm-content) {\n padding: 12px 0;\n}\n\n.code-editor-container :deep(.cm-line) {\n padding: 0 16px;\n}\n\n.code-editor-container :deep(.cm-gutters) {\n background: var(--color-surface-container);\n border-right: 1px solid var(--color-outline-variant);\n color: var(--color-outline);\n font-size: 0.75rem;\n padding: 0 4px;\n /* .cm-gutters ships with an explicit height:100% rather than auto, so the\n align-items:stretch above (on .cm-scroller) never actually kicks in —\n stretch only applies to items whose cross-size computes to auto. Forcing\n height back to auto here is what makes that stretch take effect. */\n height: auto !important;\n align-self: stretch !important;\n}\n\n.code-editor-container :deep(.cm-activeLineGutter) {\n background: var(--color-surface-container-high);\n color: var(--color-on-surface-variant);\n}\n\n.code-editor-container :deep(.cm-activeLine) {\n /* CodeMirror renders the selection highlight on a layer with z-index: -1\n (@codemirror/view's selectionLayer has `above: false` by design, so it always\n sits behind the line content). An opaque active-line background would paint\n straight over it and hide the selection on the current line — this needs to\n stay a translucent tint so a selection underneath still shows through. */\n background: color-mix(in srgb, var(--color-on-surface) 5%, transparent);\n}\n\n.code-editor-container :deep(.cm-selectionBackground) {\n background: var(--color-primary-container) !important;\n}\n\n.code-editor-container :deep(.cm-cursor) {\n border-left-color: var(--color-primary);\n border-left-width: 2px;\n}\n\n.code-editor-container :deep(.cm-matchingBracket) {\n background: var(--color-tertiary-container);\n color: var(--color-on-tertiary-container);\n border-radius: 2px;\n}\n\n.code-editor-container :deep(.cm-foldGutter span) {\n color: var(--color-on-surface-variant);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A syntax-highlighted code editor built on CodeMirror 6, with a header bar, line numbers, and a copy button.\n *\n * @slot actions Extra controls rendered in the header bar, before the built-in copy button\n * @event update:modelValue Emitted on every document change — powers v-model\n */\nimport { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'\nimport MIcon from './MIcon.vue'\n\ntype Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'c' | 'cpp' | 'rust' | 'asm' | 'plain'\n\nconst props = withDefaults(\n defineProps<{\n /** Editor content (v-model) */\n modelValue: string\n /** Syntax language */\n language?: Language\n /** Read-only mode */\n readonly?: boolean\n /** Show line numbers */\n lineNumbers?: boolean\n /** Color theme */\n theme?: 'light' | 'dark'\n /** Minimum editor height */\n minHeight?: string\n /** Maximum editor height */\n maxHeight?: string\n /** Placeholder text shown via CodeMirror when the editor is empty */\n placeholder?: string\n /** Word wrap */\n wrap?: boolean\n }>(),\n {\n language: 'javascript',\n readonly: false,\n lineNumbers: true,\n theme: 'light',\n minHeight: '200px',\n maxHeight: '600px',\n wrap: true,\n },\n)\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst containerRef = ref<HTMLElement | null>(null)\nlet view: any = null\nlet cmModules: any = null\nconst copied = ref(false)\n\nasync function copyCode() {\n await navigator.clipboard.writeText(props.modelValue)\n copied.value = true\n setTimeout(() => { copied.value = false }, 1500)\n}\n\nconst langLabel = computed(() => {\n const labels: Record<Language, string> = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n json: 'JSON',\n html: 'HTML',\n css: 'CSS',\n python: 'Python',\n vue: 'Vue',\n c: 'C',\n cpp: 'C++',\n rust: 'Rust',\n asm: 'Assembly',\n plain: 'Texto',\n }\n return labels[props.language]\n})\n\nasync function loadModules() {\n if (cmModules) return cmModules\n\n const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod] = await Promise.all([\n import('@codemirror/view'),\n import('@codemirror/state'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n import('@lezer/highlight'),\n import('@codemirror/theme-one-dark'),\n import('@codemirror/lang-javascript'),\n import('@codemirror/lang-json'),\n import('@codemirror/lang-html'),\n import('@codemirror/lang-css'),\n import('@codemirror/lang-python'),\n import('@codemirror/lang-vue'),\n import('@codemirror/lang-cpp'),\n import('@codemirror/lang-rust'),\n import('@codemirror/legacy-modes/mode/gas'),\n ])\n\n cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod }\n return cmModules\n}\n\nfunction buildM3HighlightStyle(languageMod: any, tags: any) {\n return languageMod.HighlightStyle.define([\n { tag: tags.keyword, color: 'var(--color-primary)' },\n { tag: tags.controlKeyword, color: 'var(--color-primary)', fontWeight: '500' },\n { tag: tags.operatorKeyword, color: 'var(--color-primary)' },\n { tag: tags.definitionKeyword, color: 'var(--color-primary)' },\n { tag: tags.moduleKeyword, color: 'var(--color-primary)' },\n\n { tag: tags.string, color: 'var(--color-tertiary)' },\n { tag: tags.regexp, color: 'var(--color-tertiary)' },\n\n { tag: tags.number, color: 'var(--color-error)' },\n { tag: tags.bool, color: 'var(--color-error)' },\n\n { tag: tags.function(tags.variableName), color: 'var(--color-secondary)' },\n { tag: tags.function(tags.definition(tags.variableName)), color: 'var(--color-secondary)', fontWeight: '500' },\n\n { tag: tags.typeName, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.className, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.namespace, color: 'var(--color-on-surface-variant)' },\n\n { tag: tags.propertyName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.propertyName), color: 'var(--color-on-surface)' },\n\n { tag: tags.variableName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.variableName), color: 'var(--color-on-surface)' },\n\n { tag: tags.comment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.lineComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.blockComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n\n { tag: tags.meta, color: 'var(--color-on-surface-variant)' },\n { tag: tags.tagName, color: 'var(--color-primary)' },\n { tag: tags.attributeName, color: 'var(--color-tertiary)' },\n { tag: tags.attributeValue, color: 'var(--color-secondary)' },\n\n { tag: tags.atom, color: 'var(--color-error)' },\n { tag: tags.null, color: 'var(--color-error)' },\n\n { tag: tags.punctuation, color: 'var(--color-on-surface-variant)' },\n { tag: tags.bracket, color: 'var(--color-on-surface-variant)' },\n { tag: tags.operator, color: 'var(--color-on-surface-variant)' },\n { tag: tags.separator, color: 'var(--color-on-surface-variant)' },\n ])\n}\n\nfunction getLangExtension(mods: any) {\n switch (props.language) {\n case 'javascript': return mods.jsMod.javascript()\n case 'typescript': return mods.jsMod.javascript({ typescript: true })\n case 'json': return mods.jsonMod.json()\n case 'html': return mods.htmlMod.html()\n case 'css': return mods.cssMod.css()\n case 'python': return mods.pyMod.python()\n case 'vue': return mods.vueMod.vue()\n case 'c': case 'cpp': return mods.cppMod.cpp()\n case 'rust': return mods.rustMod.rust()\n case 'asm': return mods.languageMod.StreamLanguage.define(mods.asmMod.gas)\n default: return []\n }\n}\n\nfunction buildExtensions(mods: any) {\n const { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod } = mods\n\n const m3Style = buildM3HighlightStyle(languageMod, highlightMod.tags)\n\n const exts = [\n viewMod.keymap.of([...commandsMod.defaultKeymap, ...commandsMod.historyKeymap, commandsMod.indentWithTab]),\n commandsMod.history(),\n languageMod.bracketMatching(),\n languageMod.indentOnInput(),\n languageMod.foldGutter(),\n viewMod.drawSelection(),\n viewMod.highlightActiveLine(),\n viewMod.highlightActiveLineGutter(),\n languageMod.syntaxHighlighting(m3Style),\n languageMod.syntaxHighlighting(languageMod.defaultHighlightStyle, { fallback: true }),\n getLangExtension(mods),\n viewMod.EditorView.updateListener.of((update: any) => {\n if (update.docChanged) emit('update:modelValue', update.state.doc.toString())\n }),\n stateMod.EditorState.readOnly.of(props.readonly),\n ]\n\n if (props.wrap) exts.push(viewMod.EditorView.lineWrapping)\n if (props.lineNumbers) exts.push(viewMod.lineNumbers())\n if (props.theme === 'dark') exts.push(oneDarkMod.oneDark)\n if (props.placeholder) exts.push(viewMod.placeholder(props.placeholder))\n\n return exts\n}\n\nasync function createEditor() {\n if (!containerRef.value) return\n const mods = await loadModules()\n const { viewMod, stateMod } = mods\n\n view?.destroy()\n\n view = new viewMod.EditorView({\n state: stateMod.EditorState.create({\n doc: props.modelValue,\n extensions: buildExtensions(mods),\n }),\n parent: containerRef.value,\n })\n}\n\nonMounted(createEditor)\n\nwatch(() => props.modelValue, (val) => {\n if (view && view.state.doc.toString() !== val) {\n view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: val } })\n }\n})\n\nwatch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap, () => props.placeholder], createEditor)\n\nonBeforeUnmount(() => view?.destroy())\n</script>\n\n<template>\n <div class=\"flex flex-col overflow-hidden rounded-lg border border-outline-variant\">\n <!-- Header bar -->\n <div class=\"flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2\">\n <span class=\"text-label-medium text-on-surface-variant\">{{ langLabel }}</span>\n <div class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n <button\n type=\"button\"\n class=\"flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n :title=\"copied ? 'Copied!' : 'Copy code'\"\n @click=\"copyCode\"\n >\n <MIcon :name=\"copied ? 'check' : 'content_copy'\" :size=\"16\" :class=\"copied ? 'text-primary' : ''\" />\n <span v-if=\"copied\" class=\"text-primary\">Copied</span>\n </button>\n </div>\n </div>\n\n <!-- Editor -->\n <div\n ref=\"containerRef\"\n class=\"code-editor-container overflow-auto bg-surface text-on-surface\"\n :style=\"{ minHeight, maxHeight }\"\n />\n </div>\n</template>\n\n<style scoped>\n.code-editor-container {\n /* .cm-editor/.cm-scroller/.cm-gutters all use height:100%, which only ever\n resolves against a genuinely definite ancestor height — a min-height (what\n this container has, so it can grow with content up to maxHeight) doesn't\n count as definite for that percentage chain, so .cm-gutters silently fell\n back to sizing off its own content instead of the real editor height.\n Making this a flex column and letting .cm-editor grow via flex instead of\n a % height gives the whole chain a real definite size to resolve against. */\n display: flex;\n flex-direction: column;\n /* Also grow to fill the outer wrapper (see the root element's own flex-col\n above) rather than just sitting at minHeight, whenever a consumer stretches\n the whole component taller than that — e.g. `class=\"h-full\"` in a grid\n cell next to taller content. Still hard-capped by maxHeight either way. */\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.code-editor-container :deep(.cm-editor) {\n flex: 1;\n min-height: 0;\n font-size: 0.8125rem;\n}\n\n.code-editor-container :deep(.cm-editor.cm-focused) {\n outline: none;\n}\n\n.code-editor-container :deep(.cm-scroller) {\n /* .cm-scroller normally sizes itself off a height:100% against .cm-editor,\n but that's a percentage-height-in-nested-flex-column case that browsers\n don't reliably resolve — grow it directly instead so it has a real,\n laid-out height for .cm-gutters to stretch against below. */\n flex: 1 !important;\n min-height: 0;\n /* .cm-scroller lays out .cm-gutters/.cm-content in a row (gutter | content),\n so .cm-gutters' height comes from cross-axis stretch, not flex-grow —\n CodeMirror's own base theme sets align-items: flex-start !important here,\n which is exactly what stops the gutter from stretching to full height in\n the first place. */\n align-items: stretch !important;\n /* Set here, not on .cm-editor: CodeMirror's base theme declares\n font-family: monospace and line-height: 1.4 on .cm-scroller itself,\n which beats inheritance */\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n line-height: 1.6;\n}\n\n.code-editor-container :deep(.cm-content) {\n padding: 12px 0;\n}\n\n.code-editor-container :deep(.cm-line) {\n padding: 0 16px;\n}\n\n.code-editor-container :deep(.cm-gutters) {\n background: var(--color-surface-container);\n border-right: 1px solid var(--color-outline-variant);\n color: var(--color-outline);\n font-size: 0.75rem;\n padding: 0 4px;\n /* .cm-gutters ships with an explicit height:100% rather than auto, so the\n align-items:stretch above (on .cm-scroller) never actually kicks in —\n stretch only applies to items whose cross-size computes to auto. Forcing\n height back to auto here is what makes that stretch take effect. */\n height: auto !important;\n align-self: stretch !important;\n}\n\n.code-editor-container :deep(.cm-activeLineGutter) {\n background: var(--color-surface-container-high);\n color: var(--color-on-surface-variant);\n}\n\n.code-editor-container :deep(.cm-activeLine) {\n /* CodeMirror renders the selection highlight on a layer with z-index: -1\n (@codemirror/view's selectionLayer has `above: false` by design, so it always\n sits behind the line content). An opaque active-line background would paint\n straight over it and hide the selection on the current line — this needs to\n stay a translucent tint so a selection underneath still shows through. */\n background: color-mix(in srgb, var(--color-on-surface) 5%, transparent);\n}\n\n.code-editor-container :deep(.cm-selectionBackground) {\n background: var(--color-primary-container) !important;\n}\n\n.code-editor-container :deep(.cm-cursor) {\n border-left-color: var(--color-primary);\n border-left-width: 2px;\n}\n\n.code-editor-container :deep(.cm-matchingBracket) {\n background: var(--color-tertiary-container);\n color: var(--color-on-tertiary-container);\n border-radius: 2px;\n}\n\n.code-editor-container :deep(.cm-foldGutter span) {\n color: var(--color-on-surface-variant);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A JSON-aware editor built on top of MCodeEditor — validates as you type and adds format/minify shortcuts.\n *\n * @event update:modelValue Emitted with the parsed value whenever the text is valid JSON — powers v-model\n */\nimport { ref, computed, watch } from 'vue'\nimport MCodeEditor from './MCodeEditor.vue'\nimport MIcon from './MIcon.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface JsonEditorLabels {\n valid?: string\n invalid?: string\n format?: string\n minify?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n /** JSON data (v-model, any valid JSON) */\n modelValue: unknown\n /** Read-only mode */\n readonly?: boolean\n /** Min height */\n minHeight?: string\n /** Max height */\n maxHeight?: string\n /**\n * Overrides for the valid/invalid badge and format/minify button text (see `JsonEditorLabels`) — defaults come\n * from useLocale()\n */\n labels?: JsonEditorLabels\n }>(),\n {\n readonly: false,\n minHeight: '200px',\n maxHeight: '600px',\n },\n)\n\nconst l = computed<Required<JsonEditorLabels>>(() => ({\n valid: locale.jsonValid,\n invalid: locale.jsonInvalid,\n format: locale.jsonFormat,\n minify: locale.jsonMinify,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [unknown] }>()\n\nconst rawText = ref(JSON.stringify(props.modelValue, null, 2))\nconst parseError = ref<string | null>(null)\n\nconst isValid = computed(() => !parseError.value)\n\nwatch(() => props.modelValue, (val) => {\n let current: unknown\n try {\n current = JSON.parse(rawText.value)\n } catch {\n current = undefined\n }\n // Only resync from outside when the actual data changed, not just its formatting —\n // otherwise the round-trip from formatJson/minifyJson emitting would immediately\n // overwrite the newly (re)formatted text with a pretty-printed copy.\n if (JSON.stringify(current) === JSON.stringify(val)) return\n rawText.value = JSON.stringify(val, null, 2)\n parseError.value = null\n})\n\nfunction onTextUpdate(text: string) {\n rawText.value = text\n try {\n const parsed = JSON.parse(text)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch (e) {\n parseError.value = (e as Error).message\n }\n}\n\nfunction formatJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed, null, 2)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n\nfunction minifyJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-0\">\n <MCodeEditor\n :model-value=\"rawText\"\n language=\"json\"\n :readonly=\"readonly\"\n :min-height=\"minHeight\"\n :max-height=\"maxHeight\"\n @update:model-value=\"onTextUpdate\"\n >\n <template #actions>\n <div class=\"flex items-center gap-2\">\n <!-- Validation badge -->\n <span\n class=\"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-label-small\"\n :class=\"isValid ? 'bg-success-container text-on-success-container' : 'bg-error-container text-on-error-container'\"\n >\n <MIcon :name=\"isValid ? 'check_circle' : 'error'\" :size=\"14\" />\n {{ isValid ? l.valid : l.invalid }}\n </span>\n\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.format\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"formatJson\"\n >\n <MIcon name=\"format_indent_increase\" :size=\"16\" />\n {{ l.format }}\n </button>\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.minify\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"minifyJson\"\n >\n <MIcon name=\"compress\" :size=\"16\" />\n {{ l.minify }}\n </button>\n </div>\n </template>\n </MCodeEditor>\n\n <p v-if=\"parseError\" class=\"px-3 py-1.5 text-body-small text-error\">\n {{ parseError }}\n </p>\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A JSON-aware editor built on top of MCodeEditor — validates as you type and adds format/minify shortcuts.\n *\n * @event update:modelValue Emitted with the parsed value whenever the text is valid JSON — powers v-model\n */\nimport { ref, computed, watch } from 'vue'\nimport MCodeEditor from './MCodeEditor.vue'\nimport MIcon from './MIcon.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface JsonEditorLabels {\n valid?: string\n invalid?: string\n format?: string\n minify?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n /** JSON data (v-model, any valid JSON) */\n modelValue: unknown\n /** Read-only mode */\n readonly?: boolean\n /** Min height */\n minHeight?: string\n /** Max height */\n maxHeight?: string\n /**\n * Overrides for the valid/invalid badge and format/minify button text (see `JsonEditorLabels`) — defaults come\n * from useLocale()\n */\n labels?: JsonEditorLabels\n }>(),\n {\n readonly: false,\n minHeight: '200px',\n maxHeight: '600px',\n },\n)\n\nconst l = computed<Required<JsonEditorLabels>>(() => ({\n valid: locale.jsonValid,\n invalid: locale.jsonInvalid,\n format: locale.jsonFormat,\n minify: locale.jsonMinify,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [unknown] }>()\n\nconst rawText = ref(JSON.stringify(props.modelValue, null, 2))\nconst parseError = ref<string | null>(null)\n\nconst isValid = computed(() => !parseError.value)\n\nwatch(() => props.modelValue, (val) => {\n let current: unknown\n try {\n current = JSON.parse(rawText.value)\n } catch {\n current = undefined\n }\n // Only resync from outside when the actual data changed, not just its formatting —\n // otherwise the round-trip from formatJson/minifyJson emitting would immediately\n // overwrite the newly (re)formatted text with a pretty-printed copy.\n if (JSON.stringify(current) === JSON.stringify(val)) return\n rawText.value = JSON.stringify(val, null, 2)\n parseError.value = null\n})\n\nfunction onTextUpdate(text: string) {\n rawText.value = text\n try {\n const parsed = JSON.parse(text)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch (e) {\n parseError.value = (e as Error).message\n }\n}\n\nfunction formatJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed, null, 2)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n\nfunction minifyJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-0\">\n <MCodeEditor\n :model-value=\"rawText\"\n language=\"json\"\n :readonly=\"readonly\"\n :min-height=\"minHeight\"\n :max-height=\"maxHeight\"\n @update:model-value=\"onTextUpdate\"\n >\n <template #actions>\n <div class=\"flex items-center gap-2\">\n <!-- Validation badge -->\n <span\n class=\"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-label-small\"\n :class=\"isValid ? 'bg-success-container text-on-success-container' : 'bg-error-container text-on-error-container'\"\n >\n <MIcon :name=\"isValid ? 'check_circle' : 'error'\" :size=\"14\" />\n {{ isValid ? l.valid : l.invalid }}\n </span>\n\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.format\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"formatJson\"\n >\n <MIcon name=\"format_indent_increase\" :size=\"16\" />\n {{ l.format }}\n </button>\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.minify\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"minifyJson\"\n >\n <MIcon name=\"compress\" :size=\"16\" />\n {{ l.minify }}\n </button>\n </div>\n </template>\n </MCodeEditor>\n\n <p v-if=\"parseError\" class=\"px-3 py-1.5 text-body-small text-error\">\n {{ parseError }}\n </p>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYA,IAAM,IAAQ,GAgCR,IAAO,GAEP,IAAe,EAAwB,IAAI,GAC7C,IAAY,MACZ,IAAiB,MACf,IAAS,EAAI,EAAK;EAExB,eAAe,IAAW;GAGxB,AAFA,MAAM,UAAU,UAAU,UAAU,EAAM,UAAU,GACpD,EAAO,QAAQ,IACf,iBAAiB;IAAE,EAAO,QAAQ;GAAM,GAAG,IAAI;EACjD;EAEA,IAAM,IAAY,SAeT;GAbL,YAAY;GACZ,YAAY;GACZ,MAAM;GACN,MAAM;GACN,KAAK;GACL,QAAQ;GACR,KAAK;GACL,GAAG;GACH,KAAK;GACL,MAAM;GACN,KAAK;GACL,OAAO;EAEF,EAAA,CAAO,EAAM,SACrB;EAED,eAAe,IAAc;GAC3B,IAAI,GAAW,OAAO;GAEtB,IAAM,CAAC,GAAS,GAAU,GAAa,GAAa,GAAc,GAAY,GAAO,GAAS,GAAS,GAAQ,GAAO,GAAQ,GAAQ,GAAS,KAAU,MAAM,QAAQ,IAAI;IACzK,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;GACT,CAAC;GAGD,OADA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Q,EAAA,MAAE,OAAO,GAAA,CAAA,CAAA,GAAA,CAAA;IAIzB,EAAA,WAOI,EAAA,IAAA,EAAA,KARb,EAAA,GAAA,EASS,UAAA;;KAPP,MAAK;KACJ,OAAO,EAAA,MAAE;KACV,OAAM;KACL,SAAO;IAER,GAAA,CAAA,EAAkD,GAAA;KAA3C,MAAK;KAA0B,MAAM;IAAM,CAAA,GAAA,EAAA,MAClD,EAAG,EAAA,MAAE,MAAM,GAAA,CAAA,CAAA,GAAA,GAAA,CAAA;IAGJ,EAAA,WAOI,EAAA,IAAA,EAAA,KARb,EAAA,GAAA,EASS,UAAA;;KAPP,MAAK;KACJ,OAAO,EAAA,MAAE;KACV,OAAM;KACL,SAAO;IAER,GAAA,CAAA,EAAoC,GAAA;KAA7B,MAAK;KAAY,MAAM;IAAM,CAAA,GAAA,EAAA,MACpC,EAAG,EAAA,MAAE,MAAM,GAAA,CAAA,CAAA,GAAA,GAAA,CAAA;;;;;;;;EAMV,CAAA,GAAA,EAAA,SAAT,EAAA,GAAA,EAEI,KAFJ,GAEI,EADC,EAAA,KAAU,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"code-editor.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_renderSlot","_createVNode","MIcon","_normalizeClass","_normalizeStyle","_openBlock","_createElementBlock","_createVNode","MCodeEditor","_withCtx","_createElementVNode","_normalizeClass","MIcon","_createTextVNode","_toDisplayString","MIcon_default","useLocale","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_hoisted_5$1","_hoisted_6","MCodeEditor_default","defineComponent","__emit","props","__props","emit","containerRef","ref","view","cmModules","copied","copyCode","langLabel","computed","loadModules","viewMod","stateMod","commandsMod","languageMod","highlightMod","oneDarkMod","jsMod","jsonMod","htmlMod","cssMod","pyMod","vueMod","cppMod","rustMod","asmMod","buildM3HighlightStyle","tags","getLangExtension","mods","buildExtensions","m3Style","exts","update","createEditor","onMounted","watch","val","onBeforeUnmount","openBlock","createElementBlock","createElementVNode","toDisplayString","renderSlot","_ctx","createVNode","normalizeClass","createCommentVNode","normalizeStyle","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","MJsonEditor_default","locale","l","rawText","parseError","isValid","current","onTextUpdate","text","parsed","formatJson","minifyJson","withCtx","createTextVNode"],"sources":["../src/components/MCodeEditor.vue","../src/components/MJsonEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A syntax-highlighted code editor built on CodeMirror 6, with a header bar, line numbers, and a copy button.\n *\n * @slot actions Extra controls rendered in the header bar, before the built-in copy button\n * @event update:modelValue Emitted on every document change — powers v-model\n */\nimport { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'\nimport MIcon from './MIcon.vue'\n\ntype Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'c' | 'cpp' | 'rust' | 'asm' | 'plain'\n\nconst props = withDefaults(\n defineProps<{\n /** Editor content (v-model) */\n modelValue: string\n /** Syntax language */\n language?: Language\n /** Read-only mode */\n readonly?: boolean\n /** Show line numbers */\n lineNumbers?: boolean\n /** Color theme */\n theme?: 'light' | 'dark'\n /** Minimum editor height */\n minHeight?: string\n /** Maximum editor height */\n maxHeight?: string\n /** Placeholder text shown via CodeMirror when the editor is empty */\n placeholder?: string\n /** Word wrap */\n wrap?: boolean\n }>(),\n {\n language: 'javascript',\n readonly: false,\n lineNumbers: true,\n theme: 'light',\n minHeight: '200px',\n maxHeight: '600px',\n wrap: true,\n },\n)\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst containerRef = ref<HTMLElement | null>(null)\nlet view: any = null\nlet cmModules: any = null\nconst copied = ref(false)\n\nasync function copyCode() {\n await navigator.clipboard.writeText(props.modelValue)\n copied.value = true\n setTimeout(() => { copied.value = false }, 1500)\n}\n\nconst langLabel = computed(() => {\n const labels: Record<Language, string> = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n json: 'JSON',\n html: 'HTML',\n css: 'CSS',\n python: 'Python',\n vue: 'Vue',\n c: 'C',\n cpp: 'C++',\n rust: 'Rust',\n asm: 'Assembly',\n plain: 'Texto',\n }\n return labels[props.language]\n})\n\nasync function loadModules() {\n if (cmModules) return cmModules\n\n const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod] = await Promise.all([\n import('@codemirror/view'),\n import('@codemirror/state'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n import('@lezer/highlight'),\n import('@codemirror/theme-one-dark'),\n import('@codemirror/lang-javascript'),\n import('@codemirror/lang-json'),\n import('@codemirror/lang-html'),\n import('@codemirror/lang-css'),\n import('@codemirror/lang-python'),\n import('@codemirror/lang-vue'),\n import('@codemirror/lang-cpp'),\n import('@codemirror/lang-rust'),\n import('@codemirror/legacy-modes/mode/gas'),\n ])\n\n cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod }\n return cmModules\n}\n\nfunction buildM3HighlightStyle(languageMod: any, tags: any) {\n return languageMod.HighlightStyle.define([\n { tag: tags.keyword, color: 'var(--color-primary)' },\n { tag: tags.controlKeyword, color: 'var(--color-primary)', fontWeight: '500' },\n { tag: tags.operatorKeyword, color: 'var(--color-primary)' },\n { tag: tags.definitionKeyword, color: 'var(--color-primary)' },\n { tag: tags.moduleKeyword, color: 'var(--color-primary)' },\n\n { tag: tags.string, color: 'var(--color-tertiary)' },\n { tag: tags.regexp, color: 'var(--color-tertiary)' },\n\n { tag: tags.number, color: 'var(--color-error)' },\n { tag: tags.bool, color: 'var(--color-error)' },\n\n { tag: tags.function(tags.variableName), color: 'var(--color-secondary)' },\n { tag: tags.function(tags.definition(tags.variableName)), color: 'var(--color-secondary)', fontWeight: '500' },\n\n { tag: tags.typeName, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.className, color: 'var(--color-primary)', fontStyle: 'italic' },\n { tag: tags.namespace, color: 'var(--color-on-surface-variant)' },\n\n { tag: tags.propertyName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.propertyName), color: 'var(--color-on-surface)' },\n\n { tag: tags.variableName, color: 'var(--color-on-surface)' },\n { tag: tags.definition(tags.variableName), color: 'var(--color-on-surface)' },\n\n { tag: tags.comment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.lineComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n { tag: tags.blockComment, color: 'var(--color-outline)', fontStyle: 'italic' },\n\n { tag: tags.meta, color: 'var(--color-on-surface-variant)' },\n { tag: tags.tagName, color: 'var(--color-primary)' },\n { tag: tags.attributeName, color: 'var(--color-tertiary)' },\n { tag: tags.attributeValue, color: 'var(--color-secondary)' },\n\n { tag: tags.atom, color: 'var(--color-error)' },\n { tag: tags.null, color: 'var(--color-error)' },\n\n { tag: tags.punctuation, color: 'var(--color-on-surface-variant)' },\n { tag: tags.bracket, color: 'var(--color-on-surface-variant)' },\n { tag: tags.operator, color: 'var(--color-on-surface-variant)' },\n { tag: tags.separator, color: 'var(--color-on-surface-variant)' },\n ])\n}\n\nfunction getLangExtension(mods: any) {\n switch (props.language) {\n case 'javascript': return mods.jsMod.javascript()\n case 'typescript': return mods.jsMod.javascript({ typescript: true })\n case 'json': return mods.jsonMod.json()\n case 'html': return mods.htmlMod.html()\n case 'css': return mods.cssMod.css()\n case 'python': return mods.pyMod.python()\n case 'vue': return mods.vueMod.vue()\n case 'c': case 'cpp': return mods.cppMod.cpp()\n case 'rust': return mods.rustMod.rust()\n case 'asm': return mods.languageMod.StreamLanguage.define(mods.asmMod.gas)\n default: return []\n }\n}\n\nfunction buildExtensions(mods: any) {\n const { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod } = mods\n\n const m3Style = buildM3HighlightStyle(languageMod, highlightMod.tags)\n\n const exts = [\n viewMod.keymap.of([...commandsMod.defaultKeymap, ...commandsMod.historyKeymap, commandsMod.indentWithTab]),\n commandsMod.history(),\n languageMod.bracketMatching(),\n languageMod.indentOnInput(),\n languageMod.foldGutter(),\n viewMod.drawSelection(),\n viewMod.highlightActiveLine(),\n viewMod.highlightActiveLineGutter(),\n languageMod.syntaxHighlighting(m3Style),\n languageMod.syntaxHighlighting(languageMod.defaultHighlightStyle, { fallback: true }),\n getLangExtension(mods),\n viewMod.EditorView.updateListener.of((update: any) => {\n if (update.docChanged) emit('update:modelValue', update.state.doc.toString())\n }),\n stateMod.EditorState.readOnly.of(props.readonly),\n ]\n\n if (props.wrap) exts.push(viewMod.EditorView.lineWrapping)\n if (props.lineNumbers) exts.push(viewMod.lineNumbers())\n if (props.theme === 'dark') exts.push(oneDarkMod.oneDark)\n if (props.placeholder) exts.push(viewMod.placeholder(props.placeholder))\n\n return exts\n}\n\nasync function createEditor() {\n if (!containerRef.value) return\n const mods = await loadModules()\n const { viewMod, stateMod } = mods\n\n view?.destroy()\n\n view = new viewMod.EditorView({\n state: stateMod.EditorState.create({\n doc: props.modelValue,\n extensions: buildExtensions(mods),\n }),\n parent: containerRef.value,\n })\n}\n\nonMounted(createEditor)\n\nwatch(() => props.modelValue, (val) => {\n if (view && view.state.doc.toString() !== val) {\n view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: val } })\n }\n})\n\nwatch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap, () => props.placeholder], createEditor)\n\nonBeforeUnmount(() => view?.destroy())\n</script>\n\n<template>\n <div class=\"flex flex-col overflow-hidden rounded-lg border border-outline-variant\">\n <!-- Header bar -->\n <div class=\"flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2\">\n <span class=\"text-label-medium text-on-surface-variant\">{{ langLabel }}</span>\n <div class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n <button\n type=\"button\"\n class=\"flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n :title=\"copied ? 'Copied!' : 'Copy code'\"\n @click=\"copyCode\"\n >\n <MIcon :name=\"copied ? 'check' : 'content_copy'\" :size=\"16\" :class=\"copied ? 'text-primary' : ''\" />\n <span v-if=\"copied\" class=\"text-primary\">Copied</span>\n </button>\n </div>\n </div>\n\n <!-- Editor -->\n <div\n ref=\"containerRef\"\n class=\"code-editor-container overflow-auto bg-surface text-on-surface\"\n :style=\"{ minHeight, maxHeight }\"\n />\n </div>\n</template>\n\n<style scoped>\n.code-editor-container {\n /* .cm-editor/.cm-scroller/.cm-gutters all use height:100%, which only ever\n resolves against a genuinely definite ancestor height — a min-height (what\n this container has, so it can grow with content up to maxHeight) doesn't\n count as definite for that percentage chain, so .cm-gutters silently fell\n back to sizing off its own content instead of the real editor height.\n Making this a flex column and letting .cm-editor grow via flex instead of\n a % height gives the whole chain a real definite size to resolve against. */\n display: flex;\n flex-direction: column;\n /* Also grow to fill the outer wrapper (see the root element's own flex-col\n above) rather than just sitting at minHeight, whenever a consumer stretches\n the whole component taller than that — e.g. `class=\"h-full\"` in a grid\n cell next to taller content. Still hard-capped by maxHeight either way. */\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.code-editor-container :deep(.cm-editor) {\n flex: 1;\n min-height: 0;\n font-size: 0.8125rem;\n}\n\n.code-editor-container :deep(.cm-editor.cm-focused) {\n outline: none;\n}\n\n.code-editor-container :deep(.cm-scroller) {\n /* .cm-scroller normally sizes itself off a height:100% against .cm-editor,\n but that's a percentage-height-in-nested-flex-column case that browsers\n don't reliably resolve — grow it directly instead so it has a real,\n laid-out height for .cm-gutters to stretch against below. */\n flex: 1 !important;\n min-height: 0;\n /* .cm-scroller lays out .cm-gutters/.cm-content in a row (gutter | content),\n so .cm-gutters' height comes from cross-axis stretch, not flex-grow —\n CodeMirror's own base theme sets align-items: flex-start !important here,\n which is exactly what stops the gutter from stretching to full height in\n the first place. */\n align-items: stretch !important;\n /* Set here, not on .cm-editor: CodeMirror's base theme declares\n font-family: monospace and line-height: 1.4 on .cm-scroller itself,\n which beats inheritance */\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n line-height: 1.6;\n}\n\n.code-editor-container :deep(.cm-content) {\n padding: 12px 0;\n}\n\n.code-editor-container :deep(.cm-line) {\n padding: 0 16px;\n}\n\n.code-editor-container :deep(.cm-gutters) {\n background: var(--color-surface-container);\n border-right: 1px solid var(--color-outline-variant);\n color: var(--color-outline);\n font-size: 0.75rem;\n padding: 0 4px;\n /* .cm-gutters ships with an explicit height:100% rather than auto, so the\n align-items:stretch above (on .cm-scroller) never actually kicks in —\n stretch only applies to items whose cross-size computes to auto. Forcing\n height back to auto here is what makes that stretch take effect. */\n height: auto !important;\n align-self: stretch !important;\n}\n\n.code-editor-container :deep(.cm-activeLineGutter) {\n background: var(--color-surface-container-high);\n color: var(--color-on-surface-variant);\n}\n\n.code-editor-container :deep(.cm-activeLine) {\n /* CodeMirror renders the selection highlight on a layer with z-index: -1\n (@codemirror/view's selectionLayer has `above: false` by design, so it always\n sits behind the line content). An opaque active-line background would paint\n straight over it and hide the selection on the current line — this needs to\n stay a translucent tint so a selection underneath still shows through. */\n background: color-mix(in srgb, var(--color-on-surface) 5%, transparent);\n}\n\n.code-editor-container :deep(.cm-selectionBackground) {\n background: var(--color-primary-container) !important;\n}\n\n.code-editor-container :deep(.cm-cursor) {\n border-left-color: var(--color-primary);\n border-left-width: 2px;\n}\n\n.code-editor-container :deep(.cm-matchingBracket) {\n background: var(--color-tertiary-container);\n color: var(--color-on-tertiary-container);\n border-radius: 2px;\n}\n\n.code-editor-container :deep(.cm-foldGutter span) {\n color: var(--color-on-surface-variant);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A JSON-aware editor built on top of MCodeEditor — validates as you type and adds format/minify shortcuts.\n *\n * @event update:modelValue Emitted with the parsed value whenever the text is valid JSON — powers v-model\n */\nimport { ref, computed, watch } from 'vue'\nimport MCodeEditor from './MCodeEditor.vue'\nimport MIcon from './MIcon.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface JsonEditorLabels {\n valid?: string\n invalid?: string\n format?: string\n minify?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n /** JSON data (v-model, any valid JSON) */\n modelValue: unknown\n /** Read-only mode */\n readonly?: boolean\n /** Min height */\n minHeight?: string\n /** Max height */\n maxHeight?: string\n /**\n * Overrides for the valid/invalid badge and format/minify button text (see `JsonEditorLabels`) — defaults come\n * from useLocale()\n */\n labels?: JsonEditorLabels\n }>(),\n {\n readonly: false,\n minHeight: '200px',\n maxHeight: '600px',\n },\n)\n\nconst l = computed<Required<JsonEditorLabels>>(() => ({\n valid: locale.jsonValid,\n invalid: locale.jsonInvalid,\n format: locale.jsonFormat,\n minify: locale.jsonMinify,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [unknown] }>()\n\nconst rawText = ref(JSON.stringify(props.modelValue, null, 2))\nconst parseError = ref<string | null>(null)\n\nconst isValid = computed(() => !parseError.value)\n\nwatch(() => props.modelValue, (val) => {\n let current: unknown\n try {\n current = JSON.parse(rawText.value)\n } catch {\n current = undefined\n }\n // Only resync from outside when the actual data changed, not just its formatting —\n // otherwise the round-trip from formatJson/minifyJson emitting would immediately\n // overwrite the newly (re)formatted text with a pretty-printed copy.\n if (JSON.stringify(current) === JSON.stringify(val)) return\n rawText.value = JSON.stringify(val, null, 2)\n parseError.value = null\n})\n\nfunction onTextUpdate(text: string) {\n rawText.value = text\n try {\n const parsed = JSON.parse(text)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch (e) {\n parseError.value = (e as Error).message\n }\n}\n\nfunction formatJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed, null, 2)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n\nfunction minifyJson() {\n try {\n const parsed = JSON.parse(rawText.value)\n rawText.value = JSON.stringify(parsed)\n parseError.value = null\n emit('update:modelValue', parsed)\n } catch {\n // keep error state\n }\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-0\">\n <MCodeEditor\n :model-value=\"rawText\"\n language=\"json\"\n :readonly=\"readonly\"\n :min-height=\"minHeight\"\n :max-height=\"maxHeight\"\n @update:model-value=\"onTextUpdate\"\n >\n <template #actions>\n <div class=\"flex items-center gap-2\">\n <!-- Validation badge -->\n <span\n class=\"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-label-small\"\n :class=\"isValid ? 'bg-success-container text-on-success-container' : 'bg-error-container text-on-error-container'\"\n >\n <MIcon :name=\"isValid ? 'check_circle' : 'error'\" :size=\"14\" />\n {{ isValid ? l.valid : l.invalid }}\n </span>\n\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.format\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"formatJson\"\n >\n <MIcon name=\"format_indent_increase\" :size=\"16\" />\n {{ l.format }}\n </button>\n <button\n v-if=\"!readonly\"\n type=\"button\"\n :title=\"l.minify\"\n class=\"flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-label-medium text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"minifyJson\"\n >\n <MIcon name=\"compress\" :size=\"16\" />\n {{ l.minify }}\n </button>\n </div>\n </template>\n </MCodeEditor>\n\n <p v-if=\"parseError\" class=\"px-3 py-1.5 text-body-small text-error\">\n {{ parseError }}\n </p>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYA,IAAMkC,IAAQC,GAgCRC,IAAOH,GAEPI,IAAeC,EAAwB,IAAI,GAC7CC,IAAY,MACZC,IAAiB,MACfC,IAASH,EAAI,EAAK;EAExB,eAAeI,IAAW;GAGxB,AAFA,MAAM,UAAU,UAAU,UAAUR,EAAM,UA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GAAA;KAA7B,MAAK;KAAY,MAAM;I,IAAMC,EAAA,MACpCC,EAAGqE,EAAA,MAAE,MAAM,GAAA,CAAA,C;;;;;;;;E,IAMVE,EAAA,SAAThF,EAAA,GAAAC,EAEI,KAFJ0E,GAEIlE,EADCuE,EAAA,KAAU,GAAA,CAAA,K"}
@@ -1,5 +1,5 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
1
+ // \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
3
3
  if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
4
  get: ((e) => i[e]).bind(null, d),
5
5
  enumerable: !(s = n(i, d)) || s.enumerable
@@ -16,7 +16,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16
16
  throw Error("set is read-only");
17
17
  }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((t) => {
18
18
  let r = e[t], i = typeof r;
19
- (i === "object" || i === "function") && !Object.isFrozen(r) && n(r);
19
+ i !== "object" && i !== "function" || Object.isFrozen(r) || n(r);
20
20
  }), e;
21
21
  }
22
22
  var r = class {
@@ -758,11 +758,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
758
758
  function e() {
759
759
  k();
760
760
  }
761
- if (document.readyState === "loading") {
762
- O || window.addEventListener("DOMContentLoaded", e, !1), O = !0;
763
- return;
764
- }
765
- document.querySelectorAll(l.cssSelector).forEach(w);
761
+ document.readyState === "loading" ? (O || window.addEventListener("DOMContentLoaded", e, !1), O = !0) : document.querySelectorAll(l.cssSelector).forEach(w);
766
762
  }
767
763
  function A(n, r) {
768
764
  let i = null;
@@ -1067,17 +1063,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1067
1063
  n
1068
1064
  ]
1069
1065
  }, f = e.SHEBANG({
1070
- binary: `(${[
1071
- "fish",
1072
- "bash",
1073
- "zsh",
1074
- "sh",
1075
- "csh",
1076
- "ksh",
1077
- "tcsh",
1078
- "dash",
1079
- "scsh"
1080
- ].join("|")})`,
1066
+ binary: "(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",
1081
1067
  relevance: 10
1082
1068
  }), p = {
1083
1069
  className: "function",
@@ -3014,14 +3000,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
3014
3000
  }
3015
3001
  r === ">" && (u(e, { after: n }) || t.ignoreMatch());
3016
3002
  let i, a = e.input.substring(n);
3017
- if (i = a.match(/^\s*=/)) {
3018
- t.ignoreMatch();
3019
- return;
3020
- }
3021
- if ((i = a.match(/^\s+extends\s+/)) && i.index === 0) {
3022
- t.ignoreMatch();
3023
- return;
3024
- }
3003
+ ((i = a.match(/^\s*=/)) || (i = a.match(/^\s+extends\s+/)) && i.index === 0) && t.ignoreMatch();
3025
3004
  }
3026
3005
  }, h = {
3027
3006
  $pattern: n,
@@ -6229,14 +6208,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6229
6208
  }
6230
6209
  r === ">" && (u(e, { after: n }) || t.ignoreMatch());
6231
6210
  let i, a = e.input.substring(n);
6232
- if (i = a.match(/^\s*=/)) {
6233
- t.ignoreMatch();
6234
- return;
6235
- }
6236
- if ((i = a.match(/^\s+extends\s+/)) && i.index === 0) {
6237
- t.ignoreMatch();
6238
- return;
6239
- }
6211
+ ((i = a.match(/^\s*=/)) || (i = a.match(/^\s+extends\s+/)) && i.index === 0) && t.ignoreMatch();
6240
6212
  }
6241
6213
  }, h = {
6242
6214
  $pattern: n,
@@ -6819,7 +6791,6 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6819
6791
  var n = l();
6820
6792
  n.registerLanguage("xml", u()), n.registerLanguage("bash", d()), n.registerLanguage("c", f()), n.registerLanguage("cpp", p()), n.registerLanguage("csharp", m()), n.registerLanguage("css", h()), n.registerLanguage("markdown", g()), n.registerLanguage("diff", _()), n.registerLanguage("ruby", v()), n.registerLanguage("go", y()), n.registerLanguage("graphql", b()), n.registerLanguage("ini", x()), n.registerLanguage("java", S()), n.registerLanguage("javascript", C()), n.registerLanguage("json", w()), n.registerLanguage("kotlin", T()), n.registerLanguage("less", E()), n.registerLanguage("lua", D()), n.registerLanguage("makefile", O()), n.registerLanguage("perl", k()), n.registerLanguage("objectivec", A()), n.registerLanguage("php", j()), n.registerLanguage("php-template", M()), n.registerLanguage("plaintext", N()), n.registerLanguage("python", P()), n.registerLanguage("python-repl", F()), n.registerLanguage("r", I()), n.registerLanguage("rust", L()), n.registerLanguage("scss", R()), n.registerLanguage("shell", z()), n.registerLanguage("sql", B()), n.registerLanguage("swift", V()), n.registerLanguage("yaml", ee()), n.registerLanguage("typescript", H()), n.registerLanguage("vbnet", U()), n.registerLanguage("wasm", W()), n.HighlightJS = n, n.default = n, t.exports = n;
6821
6793
  })))())).default;
6822
- //#endregion
6823
6794
  export { G as default };
6824
6795
 
6825
- //# sourceMappingURL=common-0dgrgaPL.js.map
6796
+ //# sourceMappingURL=common-kIb6A2Qu.js.map