@webquark/browser 1.1.0-dev.9 → 1.1.1-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. package/dist/cjs/{action.props-N0urQtdP.js → action.props-CNe2JXR5.js} +1 -1
  2. package/dist/cjs/{dom-Dk77oFF6.js → dom-BYrqRYna.js} +1 -1
  3. package/dist/cjs/{field-CsrQGhG-.js → field-BRAR56Ex.js} +1 -1
  4. package/dist/cjs/{form-control-validity-D1ukC0_e.js → form-control-validity-BkilGb3E.js} +3 -3
  5. package/dist/cjs/{index-DWXhKHCB.js → index-BN-WdOQM.js} +17 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/q-accordion.cjs.entry.js +2 -2
  8. package/dist/cjs/q-alert.cjs.entry.js +2 -2
  9. package/dist/cjs/q-avatar.cjs.entry.js +2 -2
  10. package/dist/cjs/q-banner.cjs.entry.js +1 -1
  11. package/dist/cjs/q-button_3.cjs.entry.js +907 -0
  12. package/dist/cjs/q-card.cjs.entry.js +3 -3
  13. package/dist/cjs/q-carousel.cjs.entry.js +120 -18
  14. package/dist/cjs/q-chip.cjs.entry.js +2 -2
  15. package/dist/cjs/q-control-group.cjs.entry.js +64 -0
  16. package/dist/cjs/q-conversation-bubble.cjs.entry.js +1 -1
  17. package/dist/cjs/q-data-table.cjs.entry.js +4 -4
  18. package/dist/cjs/q-dialog.cjs.entry.js +4 -4
  19. package/dist/cjs/q-divider.cjs.entry.js +26 -0
  20. package/dist/cjs/q-dropdown.cjs.entry.js +320 -104
  21. package/dist/cjs/q-form.cjs.entry.js +17 -7
  22. package/dist/cjs/q-grid.cjs.entry.js +3 -3
  23. package/dist/cjs/q-icon.cjs.entry.js +1 -1
  24. package/dist/cjs/q-image-comparison.cjs.entry.js +2 -2
  25. package/dist/cjs/q-inline.cjs.entry.js +3 -3
  26. package/dist/cjs/q-input_2.cjs.entry.js +10 -8
  27. package/dist/cjs/q-link.cjs.entry.js +2 -2
  28. package/dist/cjs/q-map.cjs.entry.js +2 -2
  29. package/dist/cjs/q-media.cjs.entry.js +2 -2
  30. package/dist/cjs/q-navbar.cjs.entry.js +3 -3
  31. package/dist/cjs/q-pagination.cjs.entry.js +2 -2
  32. package/dist/cjs/q-panel.cjs.entry.js +7 -7
  33. package/dist/cjs/q-quantity-selector.cjs.entry.js +6 -6
  34. package/dist/cjs/q-radio-group.cjs.entry.js +4 -4
  35. package/dist/cjs/q-reel.cjs.entry.js +24 -24
  36. package/dist/cjs/q-section.cjs.entry.js +2 -2
  37. package/dist/cjs/q-sidepanel.cjs.entry.js +5 -4
  38. package/dist/cjs/q-slider.cjs.entry.js +122 -0
  39. package/dist/cjs/q-stack.cjs.entry.js +3 -3
  40. package/dist/cjs/q-step-diagram-item.cjs.entry.js +2 -2
  41. package/dist/cjs/q-step-diagram.cjs.entry.js +4 -4
  42. package/dist/cjs/q-syntax-box.cjs.entry.js +180 -719
  43. package/dist/cjs/q-syntax-view.cjs.entry.js +65 -0
  44. package/dist/cjs/q-tabs.cjs.entry.js +2 -2
  45. package/dist/cjs/q-textarea.cjs.entry.js +8 -6
  46. package/dist/cjs/q-thumbnail.cjs.entry.js +3 -3
  47. package/dist/cjs/q-toast.cjs.entry.js +1 -1
  48. package/dist/cjs/q-toggle.cjs.entry.js +7 -7
  49. package/dist/cjs/q-toolbar.cjs.entry.js +4 -4
  50. package/dist/cjs/syntax-content-BmSExDiW.js +910 -0
  51. package/dist/cjs/{tokens-RMRaIOqv.js → tokens-BMrfol_M.js} +4 -1
  52. package/dist/cjs/webquark.cjs.js +2 -2
  53. package/dist/collection/collection-manifest.json +6 -1
  54. package/dist/collection/components/actions/button/button.css +49 -9
  55. package/dist/collection/components/actions/button/{button.utils.unit.test.js → test/button.utils.unit.test.js} +1 -1
  56. package/dist/collection/components/communication/alert/alert.css +4 -1
  57. package/dist/collection/components/content/carousel/carousel.css +7 -0
  58. package/dist/collection/components/content/carousel/carousel.js +256 -10
  59. package/dist/collection/components/content/carousel/internals/autoplay.js +31 -6
  60. package/dist/collection/components/content/carousel/test/transitions.cmp.test.js +122 -0
  61. package/dist/collection/components/data-display/accordion/accordion.js +1 -1
  62. package/dist/collection/components/data-display/data-table/data-table.js +3 -3
  63. package/dist/collection/components/data-display/map/map.js +1 -1
  64. package/dist/collection/components/data-display/map/test/map.cmp.test.js +1 -1
  65. package/dist/collection/components/data-display/pagination/pagination.js +1 -1
  66. package/dist/collection/components/data-display/syntax-box/internals/formatters/css.js +4 -0
  67. package/dist/collection/components/data-display/syntax-box/internals/formatters/formatter.js +20 -0
  68. package/dist/collection/{utils → components/data-display/syntax-box/internals/formatters}/formatter.unit.test.js +38 -11
  69. package/dist/collection/components/data-display/syntax-box/internals/formatters/html.js +4 -0
  70. package/dist/collection/components/data-display/syntax-box/internals/formatters/javascript.js +4 -0
  71. package/dist/collection/{utils/formatter.js → components/data-display/syntax-box/internals/formatters/json.js} +2 -20
  72. package/dist/collection/components/data-display/syntax-box/internals/formatters/languages.js +15 -0
  73. package/dist/collection/components/data-display/syntax-box/internals/formatters/util/prettier.js +17 -0
  74. package/dist/collection/{utils → components/data-display/syntax-box/internals}/syntax.unit.test.js +1 -1
  75. package/dist/collection/components/data-display/syntax-box/internals/views.js +29 -0
  76. package/dist/collection/components/data-display/syntax-box/internals/views.unit.test.js +19 -0
  77. package/dist/collection/components/data-display/syntax-box/syntax-box.css +107 -36
  78. package/dist/collection/components/data-display/syntax-box/syntax-box.js +179 -637
  79. package/dist/collection/components/data-display/syntax-box/syntax-content.js +748 -0
  80. package/dist/collection/components/data-display/syntax-box/syntax-ui.js +8 -0
  81. package/dist/collection/components/data-display/syntax-box/test/format-fixtures.js +2 -2
  82. package/dist/collection/components/data-display/syntax-box/test/syntax-box.cmp.test.js +1 -1
  83. package/dist/collection/components/data-display/syntax-box/test/syntax-format.cmp.test.js +20 -20
  84. package/dist/collection/components/data-display/syntax-box/test/syntax-views.cmp.test.js +228 -0
  85. package/dist/collection/components/data-display/syntax-view/syntax-view.js +64 -0
  86. package/dist/collection/components/indicators/step-diagram/step-diagram.js +2 -2
  87. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +1 -1
  88. package/dist/collection/components/inputs/dropdown/dropdown.css +148 -0
  89. package/dist/collection/components/inputs/dropdown/dropdown.js +422 -104
  90. package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +28 -0
  91. package/dist/collection/components/inputs/dropdown/test/fit-options.cmp.test.js +120 -0
  92. package/dist/collection/components/inputs/dropdown/test/multiple.cmp.test.js +124 -0
  93. package/dist/collection/components/inputs/dropdown/test/search-mode.cmp.test.js +186 -0
  94. package/dist/collection/components/inputs/form/form.js +2 -2
  95. package/dist/collection/components/inputs/form/internals/controls.js +2 -2
  96. package/dist/collection/components/inputs/form/internals/field-state.js +6 -1
  97. package/dist/collection/components/inputs/form/internals/values.js +5 -0
  98. package/dist/collection/components/inputs/form/test/form-submit.cmp.test.js +14 -8
  99. package/dist/collection/components/inputs/input/input.css +42 -0
  100. package/dist/collection/components/inputs/input/input.js +31 -3
  101. package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +22 -0
  102. package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +4 -4
  103. package/dist/collection/components/inputs/radio-group/radio-group.js +2 -2
  104. package/dist/collection/components/inputs/slider/slider.css +44 -0
  105. package/dist/collection/components/inputs/slider/slider.js +383 -0
  106. package/dist/collection/components/inputs/slider/test/slider.cmp.test.js +45 -0
  107. package/dist/collection/components/inputs/textarea/textarea.css +20 -0
  108. package/dist/collection/components/inputs/textarea/textarea.js +30 -2
  109. package/dist/collection/components/inputs/toggle/test/toggle-layout.cmp.test.js +69 -0
  110. package/dist/collection/components/inputs/toggle/toggle.css +27 -0
  111. package/dist/collection/components/inputs/toggle/toggle.js +3 -3
  112. package/dist/collection/components/layout/control-group/control-group.css +108 -0
  113. package/dist/collection/components/layout/control-group/control-group.js +142 -0
  114. package/dist/collection/components/layout/control-group/test/control-group.cmp.test.js +163 -0
  115. package/dist/collection/components/layout/divider/divider.css +40 -0
  116. package/dist/collection/components/layout/divider/divider.js +121 -0
  117. package/dist/collection/components/layout/divider/test/divider.cmp.test.js +105 -0
  118. package/dist/collection/components/layout/grid/grid.js +1 -1
  119. package/dist/collection/components/layout/inline/inline.js +1 -1
  120. package/dist/collection/components/layout/navbar/navbar.js +2 -2
  121. package/dist/collection/components/layout/panel/panel.js +4 -4
  122. package/dist/collection/components/layout/scrollable/scrollable.js +3 -3
  123. package/dist/collection/components/layout/section/section.js +1 -1
  124. package/dist/collection/components/layout/sidepanel/internals/nav-items.js +2 -2
  125. package/dist/collection/components/layout/sidepanel/sidepanel.js +3 -0
  126. package/dist/collection/components/layout/stack/stack.js +1 -1
  127. package/dist/collection/components/layout/tabs/tabs.js +1 -1
  128. package/dist/collection/components/layout/toolbar/toolbar.js +2 -2
  129. package/dist/collection/components/media/avatar/avatar.js +1 -1
  130. package/dist/collection/components/media/image-comparison/image-comparison.js +1 -1
  131. package/dist/collection/components/media/media/media.js +1 -1
  132. package/dist/collection/components/media/reel/reel.js +23 -23
  133. package/dist/collection/components/media/reel/test/focus.cmp.test.js +33 -0
  134. package/dist/collection/components/media/thumbnail/thumbnail.js +2 -2
  135. package/dist/collection/components/overlays/dialog/dialog.js +2 -2
  136. package/dist/collection/components/overlays/tooltip/tooltip.js +2 -2
  137. package/dist/collection/theme/test/input-width.cmp.test.js +117 -0
  138. package/dist/collection/theme/test/presets.unit.test.js +58 -0
  139. package/dist/collection/theme/tokens.js +4 -1
  140. package/dist/collection/utils/dom.js +1 -1
  141. package/dist/collection/utils/form-control-validity.js +3 -3
  142. package/dist/components/index.js +1 -1
  143. package/dist/components/p-B610wOGe.js +1 -0
  144. package/dist/components/p-BGlbV43y.js +13 -0
  145. package/dist/components/{p-Dfp_If-_.js → p-BKWL9zOn.js} +1 -1
  146. package/dist/components/p-BxxU73QQ.js +1 -0
  147. package/dist/components/{p-Cg0Mv7Vb.js → p-CVEQfA-v.js} +1 -1
  148. package/dist/components/p-CpbWWDiY.js +1 -0
  149. package/dist/{webquark/p-Dhsn99q4.js → components/p-D2fczi8m.js} +1 -1
  150. package/dist/components/{p-6PPZ2sIO.js → p-D5vpGqZ9.js} +1 -1
  151. package/dist/components/p-DQIYo8zC.js +1 -0
  152. package/dist/components/p-DX6PCIPS.js +1 -0
  153. package/dist/components/p-DY9D4z7Z.js +1 -0
  154. package/dist/components/p-DbzjRzhu.js +1 -0
  155. package/dist/components/{p-DQhiqYeq.js → p-DkanItP3.js} +1 -1
  156. package/dist/components/{p-CKuPOxKN.js → p-RX4DjgmV.js} +1 -1
  157. package/dist/components/{p-DlIn_ZWk.js → p-Ts5oOvg8.js} +1 -1
  158. package/dist/components/p-u1Qz6OcP.js +1 -0
  159. package/dist/components/q-accordion.js +1 -1
  160. package/dist/components/q-alert.js +1 -1
  161. package/dist/components/q-avatar.js +1 -1
  162. package/dist/components/q-banner.js +1 -1
  163. package/dist/components/q-button.js +1 -1
  164. package/dist/components/q-card.js +1 -1
  165. package/dist/components/q-carousel.js +1 -1
  166. package/dist/components/q-chip.js +1 -1
  167. package/dist/components/q-control-group.d.ts +11 -0
  168. package/dist/components/q-control-group.js +1 -0
  169. package/dist/components/q-conversation-bubble.js +1 -1
  170. package/dist/components/q-data-table.js +1 -1
  171. package/dist/components/q-dialog.js +1 -1
  172. package/dist/components/q-divider.d.ts +11 -0
  173. package/dist/components/q-divider.js +1 -0
  174. package/dist/components/q-dropdown.js +1 -1
  175. package/dist/components/q-form.js +1 -1
  176. package/dist/components/q-grid.js +1 -1
  177. package/dist/components/q-icon.js +1 -1
  178. package/dist/components/q-image-comparison.js +1 -1
  179. package/dist/components/q-inline.js +1 -1
  180. package/dist/components/q-input.js +1 -1
  181. package/dist/components/q-link.js +1 -1
  182. package/dist/components/q-map.js +1 -1
  183. package/dist/components/q-media.js +1 -1
  184. package/dist/components/q-navbar.js +1 -1
  185. package/dist/components/q-pagination.js +1 -1
  186. package/dist/components/q-panel.js +1 -1
  187. package/dist/components/q-progress.js +1 -1
  188. package/dist/components/q-quantity-selector.js +1 -1
  189. package/dist/components/q-radio-group.js +1 -1
  190. package/dist/components/q-reel.js +1 -1
  191. package/dist/components/q-scrollable.js +1 -1
  192. package/dist/components/q-section.js +1 -1
  193. package/dist/components/q-sidepanel.js +2 -2
  194. package/dist/components/q-slider.d.ts +11 -0
  195. package/dist/components/q-slider.js +1 -0
  196. package/dist/components/q-stack.js +1 -1
  197. package/dist/components/q-step-diagram-item.js +1 -1
  198. package/dist/components/q-step-diagram.js +1 -1
  199. package/dist/components/q-syntax-box.js +1 -13
  200. package/dist/components/q-syntax-view.d.ts +11 -0
  201. package/dist/components/q-syntax-view.js +1 -0
  202. package/dist/components/q-tabs.js +1 -1
  203. package/dist/components/q-textarea.js +1 -1
  204. package/dist/components/q-thumbnail.js +1 -1
  205. package/dist/components/q-toast.js +1 -1
  206. package/dist/components/q-toggle.js +1 -1
  207. package/dist/components/q-toolbar.js +1 -1
  208. package/dist/components/q-tooltip.js +1 -1
  209. package/dist/esm/{action.props-CpnGza8z.js → action.props-CbSH7c-q.js} +1 -1
  210. package/dist/esm/{dom-ByfrUWx1.js → dom-B610wOGe.js} +2 -2
  211. package/dist/esm/{field-zfD6OQ02.js → field-D5xUxo11.js} +1 -1
  212. package/dist/esm/{form-control-validity-Bj2RJb2E.js → form-control-validity-BxxU73QQ.js} +3 -3
  213. package/dist/esm/{form-submit-action-CoEIvDqE.js → form-submit-action-BjjfVWyu.js} +1 -1
  214. package/dist/esm/{index-B5ElFlHv.js → index-CIMzZPQO.js} +16 -2
  215. package/dist/esm/loader.js +3 -3
  216. package/dist/esm/q-accordion.entry.js +2 -2
  217. package/dist/esm/q-alert.entry.js +2 -2
  218. package/dist/esm/q-avatar.entry.js +2 -2
  219. package/dist/esm/q-banner.entry.js +1 -1
  220. package/dist/esm/q-button_3.entry.js +903 -0
  221. package/dist/esm/q-card.entry.js +3 -3
  222. package/dist/esm/q-carousel.entry.js +120 -18
  223. package/dist/esm/q-chip.entry.js +2 -2
  224. package/dist/esm/q-control-group.entry.js +62 -0
  225. package/dist/esm/q-conversation-bubble.entry.js +1 -1
  226. package/dist/esm/q-data-table.entry.js +4 -4
  227. package/dist/esm/q-dialog.entry.js +4 -4
  228. package/dist/esm/q-divider.entry.js +24 -0
  229. package/dist/esm/q-dropdown.entry.js +320 -104
  230. package/dist/esm/q-form.entry.js +18 -8
  231. package/dist/esm/q-grid.entry.js +3 -3
  232. package/dist/esm/q-icon.entry.js +1 -1
  233. package/dist/esm/q-image-comparison.entry.js +2 -2
  234. package/dist/esm/q-inline.entry.js +3 -3
  235. package/dist/esm/q-input_2.entry.js +10 -8
  236. package/dist/esm/q-link.entry.js +2 -2
  237. package/dist/esm/q-map.entry.js +2 -2
  238. package/dist/esm/q-media.entry.js +2 -2
  239. package/dist/esm/q-navbar.entry.js +3 -3
  240. package/dist/esm/q-pagination.entry.js +2 -2
  241. package/dist/esm/q-panel.entry.js +7 -7
  242. package/dist/esm/q-quantity-selector.entry.js +6 -6
  243. package/dist/esm/q-radio-group.entry.js +4 -4
  244. package/dist/esm/q-reel.entry.js +24 -24
  245. package/dist/esm/q-section.entry.js +2 -2
  246. package/dist/esm/q-sidepanel.entry.js +5 -4
  247. package/dist/esm/q-slider.entry.js +120 -0
  248. package/dist/esm/q-stack.entry.js +3 -3
  249. package/dist/esm/q-step-diagram-item.entry.js +2 -2
  250. package/dist/esm/q-step-diagram.entry.js +4 -4
  251. package/dist/esm/q-syntax-box.entry.js +180 -719
  252. package/dist/esm/q-syntax-view.entry.js +63 -0
  253. package/dist/esm/q-tabs.entry.js +2 -2
  254. package/dist/esm/q-textarea.entry.js +8 -6
  255. package/dist/esm/q-thumbnail.entry.js +3 -3
  256. package/dist/esm/q-toast.entry.js +1 -1
  257. package/dist/esm/q-toggle.entry.js +7 -7
  258. package/dist/esm/q-toolbar.entry.js +4 -4
  259. package/dist/esm/syntax-content-Cr9kSbmA.js +903 -0
  260. package/dist/esm/{tokens-B4Mg1xEw.js → tokens-DbzjRzhu.js} +4 -1
  261. package/dist/esm/webquark.js +3 -3
  262. package/dist/formatters/prettier/LICENSE +7 -0
  263. package/dist/formatters/prettier/THIRD-PARTY-NOTICES.md +7941 -0
  264. package/dist/formatters/prettier/html-fragment.mjs +1 -0
  265. package/dist/formatters/prettier/html-fragment.mjs.gz +0 -0
  266. package/dist/formatters/prettier/languages/angular.mjs +1 -0
  267. package/dist/formatters/prettier/languages/angular.mjs.gz +0 -0
  268. package/dist/formatters/prettier/languages/css.mjs +1 -0
  269. package/dist/formatters/prettier/languages/css.mjs.gz +0 -0
  270. package/dist/formatters/prettier/languages/flow.mjs +1 -0
  271. package/dist/formatters/prettier/languages/flow.mjs.gz +0 -0
  272. package/dist/formatters/prettier/languages/graphql.mjs +1 -0
  273. package/dist/formatters/prettier/languages/graphql.mjs.gz +0 -0
  274. package/dist/formatters/prettier/languages/handlebars.mjs +1 -0
  275. package/dist/formatters/prettier/languages/handlebars.mjs.gz +0 -0
  276. package/dist/formatters/prettier/languages/html.mjs +1 -0
  277. package/dist/formatters/prettier/languages/html.mjs.gz +0 -0
  278. package/dist/formatters/prettier/languages/javascript.mjs +1 -0
  279. package/dist/formatters/prettier/languages/javascript.mjs.gz +0 -0
  280. package/dist/formatters/prettier/languages/json-stringify.mjs +1 -0
  281. package/dist/formatters/prettier/languages/json-stringify.mjs.gz +0 -0
  282. package/dist/formatters/prettier/languages/json.mjs +1 -0
  283. package/dist/formatters/prettier/languages/json.mjs.gz +0 -0
  284. package/dist/formatters/prettier/languages/json5.mjs +1 -0
  285. package/dist/formatters/prettier/languages/json5.mjs.gz +0 -0
  286. package/dist/formatters/prettier/languages/jsonc.mjs +1 -0
  287. package/dist/formatters/prettier/languages/jsonc.mjs.gz +0 -0
  288. package/dist/formatters/prettier/languages/jsx.mjs +1 -0
  289. package/dist/formatters/prettier/languages/jsx.mjs.gz +0 -0
  290. package/dist/formatters/prettier/languages/less.mjs +1 -0
  291. package/dist/formatters/prettier/languages/less.mjs.gz +0 -0
  292. package/dist/formatters/prettier/languages/lwc.mjs +1 -0
  293. package/dist/formatters/prettier/languages/lwc.mjs.gz +0 -0
  294. package/dist/formatters/prettier/languages/markdown.mjs +1 -0
  295. package/dist/formatters/prettier/languages/markdown.mjs.gz +0 -0
  296. package/dist/formatters/prettier/languages/mdx.mjs +1 -0
  297. package/dist/formatters/prettier/languages/mdx.mjs.gz +0 -0
  298. package/dist/formatters/prettier/languages/mjml.mjs +1 -0
  299. package/dist/formatters/prettier/languages/mjml.mjs.gz +0 -0
  300. package/dist/formatters/prettier/languages/postcss.mjs +1 -0
  301. package/dist/formatters/prettier/languages/postcss.mjs.gz +0 -0
  302. package/dist/formatters/prettier/languages/scss.mjs +1 -0
  303. package/dist/formatters/prettier/languages/scss.mjs.gz +0 -0
  304. package/dist/formatters/prettier/languages/tsx.mjs +1 -0
  305. package/dist/formatters/prettier/languages/tsx.mjs.gz +0 -0
  306. package/dist/formatters/prettier/languages/typescript.mjs +1 -0
  307. package/dist/formatters/prettier/languages/typescript.mjs.gz +0 -0
  308. package/dist/formatters/prettier/languages/vue.mjs +1 -0
  309. package/dist/formatters/prettier/languages/vue.mjs.gz +0 -0
  310. package/dist/formatters/prettier/languages/yaml.mjs +1 -0
  311. package/dist/formatters/prettier/languages/yaml.mjs.gz +0 -0
  312. package/dist/formatters/prettier/manifest.json +87 -0
  313. package/dist/formatters/prettier/plugins/acorn.mjs +17 -0
  314. package/dist/formatters/prettier/plugins/acorn.mjs.gz +0 -0
  315. package/dist/formatters/prettier/plugins/angular.mjs +7 -0
  316. package/dist/formatters/prettier/plugins/angular.mjs.gz +0 -0
  317. package/dist/formatters/prettier/plugins/babel.mjs +16 -0
  318. package/dist/formatters/prettier/plugins/babel.mjs.gz +0 -0
  319. package/dist/formatters/prettier/plugins/estree.mjs +44 -0
  320. package/dist/formatters/prettier/plugins/estree.mjs.gz +0 -0
  321. package/dist/formatters/prettier/plugins/flow.mjs +7 -0
  322. package/dist/formatters/prettier/plugins/flow.mjs.gz +0 -0
  323. package/dist/formatters/prettier/plugins/glimmer.mjs +37 -0
  324. package/dist/formatters/prettier/plugins/glimmer.mjs.gz +0 -0
  325. package/dist/formatters/prettier/plugins/graphql.mjs +17 -0
  326. package/dist/formatters/prettier/plugins/graphql.mjs.gz +0 -0
  327. package/dist/formatters/prettier/plugins/html.mjs +25 -0
  328. package/dist/formatters/prettier/plugins/html.mjs.gz +0 -0
  329. package/dist/formatters/prettier/plugins/markdown.mjs +70 -0
  330. package/dist/formatters/prettier/plugins/markdown.mjs.gz +0 -0
  331. package/dist/formatters/prettier/plugins/meriyah.mjs +9 -0
  332. package/dist/formatters/prettier/plugins/meriyah.mjs.gz +0 -0
  333. package/dist/formatters/prettier/plugins/postcss.mjs +62 -0
  334. package/dist/formatters/prettier/plugins/postcss.mjs.gz +0 -0
  335. package/dist/formatters/prettier/plugins/typescript.mjs +22 -0
  336. package/dist/formatters/prettier/plugins/typescript.mjs.gz +0 -0
  337. package/dist/formatters/prettier/plugins/yaml.mjs +150 -0
  338. package/dist/formatters/prettier/plugins/yaml.mjs.gz +0 -0
  339. package/dist/formatters/prettier/runtime.d.mts +2 -0
  340. package/dist/formatters/prettier/runtime.mjs +1 -0
  341. package/dist/formatters/prettier/runtime.mjs.gz +0 -0
  342. package/dist/formatters/prettier/standalone.mjs +29 -0
  343. package/dist/formatters/prettier/standalone.mjs.gz +0 -0
  344. package/dist/playground/components/theme-designer/dimension-tokens.js +9 -0
  345. package/dist/playground/components/theme-designer/token-row.js +60 -0
  346. package/dist/playground/dom-factory.js +76 -0
  347. package/dist/playground/utils/color.js +15 -0
  348. package/dist/playground/utils/dom.js +38 -0
  349. package/dist/playground/utils/index.js +2 -0
  350. package/dist/types/components/content/carousel/carousel.d.ts +23 -2
  351. package/dist/types/components/content/carousel/carousel.types.d.ts +6 -0
  352. package/dist/types/components/content/carousel/internals/autoplay.d.ts +5 -0
  353. package/dist/types/components/data-display/syntax-box/internals/formatters/css.d.ts +1 -0
  354. package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.d.ts +10 -0
  355. package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.types.d.ts +4 -0
  356. package/dist/types/components/data-display/syntax-box/internals/formatters/html.d.ts +1 -0
  357. package/dist/types/components/data-display/syntax-box/internals/formatters/javascript.d.ts +1 -0
  358. package/dist/types/components/data-display/syntax-box/internals/formatters/json.d.ts +6 -0
  359. package/dist/types/components/data-display/syntax-box/internals/formatters/languages.d.ts +27 -0
  360. package/dist/types/components/data-display/syntax-box/internals/formatters/util/prettier.d.ts +3 -0
  361. package/dist/types/{utils → components/data-display/syntax-box/internals}/syntax.d.ts +1 -1
  362. package/dist/types/components/data-display/syntax-box/internals/syntax.unit.test.d.ts +1 -0
  363. package/dist/types/components/data-display/syntax-box/internals/views.d.ts +11 -0
  364. package/dist/types/components/data-display/syntax-box/internals/views.unit.test.d.ts +1 -0
  365. package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +66 -63
  366. package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +1 -1
  367. package/dist/types/components/data-display/syntax-box/syntax-content.d.ts +41 -0
  368. package/dist/types/components/data-display/syntax-box/syntax-ui.d.ts +15 -0
  369. package/dist/types/components/data-display/syntax-box/test/format-fixtures.d.ts +1 -1
  370. package/dist/types/components/data-display/syntax-box/test/syntax-views.cmp.test.d.ts +1 -0
  371. package/dist/types/components/data-display/syntax-view/syntax-view.d.ts +48 -0
  372. package/dist/types/components/inputs/dropdown/dropdown.d.ts +45 -1
  373. package/dist/types/components/inputs/dropdown/test/fit-options.cmp.test.d.ts +3 -0
  374. package/dist/types/components/inputs/dropdown/test/multiple.cmp.test.d.ts +1 -0
  375. package/dist/types/components/inputs/dropdown/test/search-mode.cmp.test.d.ts +1 -0
  376. package/dist/types/components/inputs/form/internals/field-state.d.ts +1 -1
  377. package/dist/types/components/inputs/input/input.d.ts +3 -0
  378. package/dist/types/components/inputs/slider/slider.d.ts +45 -0
  379. package/dist/types/components/inputs/slider/test/slider.cmp.test.d.ts +1 -0
  380. package/dist/types/components/inputs/textarea/textarea.d.ts +3 -1
  381. package/dist/types/components/inputs/toggle/test/toggle-layout.cmp.test.d.ts +1 -0
  382. package/dist/types/components/layout/control-group/control-group.d.ts +20 -0
  383. package/dist/types/components/layout/control-group/test/control-group.cmp.test.d.ts +7 -0
  384. package/dist/types/components/layout/divider/divider.d.ts +15 -0
  385. package/dist/types/components/layout/divider/test/divider.cmp.test.d.ts +1 -0
  386. package/dist/types/components/layout/sidepanel/sidepanel.d.ts +2 -0
  387. package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +1 -0
  388. package/dist/types/components/media/reel/reel.d.ts +3 -3
  389. package/dist/types/components/media/reel/test/focus.cmp.test.d.ts +1 -0
  390. package/dist/types/components.d.ts +591 -13
  391. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/dimension-tokens.d.ts +3 -0
  392. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/token-row.d.ts +14 -0
  393. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/dom-factory.d.ts +13 -0
  394. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/color.d.ts +2 -0
  395. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/dom.d.ts +15 -0
  396. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/index.d.ts +2 -0
  397. package/dist/types/index.d.ts +2 -2
  398. package/dist/types/theme/test/input-width.cmp.test.d.ts +3 -0
  399. package/dist/types/theme/test/presets.unit.test.d.ts +1 -0
  400. package/dist/types/theme/tokens.d.ts +9 -0
  401. package/dist/types/utils/form-control-validity.d.ts +2 -1
  402. package/dist/types/utils/form-field-adapter.d.ts +3 -3
  403. package/dist/webquark/p-014c2f4a.entry.js +1 -0
  404. package/dist/webquark/p-0389577c.entry.js +1 -0
  405. package/dist/webquark/p-041e17c1.entry.js +1 -0
  406. package/dist/webquark/p-0479c571.entry.js +1 -0
  407. package/dist/webquark/p-0ebca9be.entry.js +1 -0
  408. package/dist/webquark/{p-fe8c634a.entry.js → p-1bf375f7.entry.js} +2 -2
  409. package/dist/webquark/{p-6bfffa79.entry.js → p-20dc3ab5.entry.js} +1 -1
  410. package/dist/webquark/p-28d3348f.entry.js +1 -0
  411. package/dist/webquark/p-35c177d3.entry.js +1 -0
  412. package/dist/webquark/{p-99d785ca.entry.js → p-3a60086d.entry.js} +1 -1
  413. package/dist/webquark/{p-3bc4629c.entry.js → p-3ab798aa.entry.js} +1 -1
  414. package/dist/webquark/{p-9e78b796.entry.js → p-3b580baf.entry.js} +1 -1
  415. package/dist/webquark/{p-888e46a8.entry.js → p-3b65f787.entry.js} +1 -1
  416. package/dist/webquark/p-4bf610f8.entry.js +1 -0
  417. package/dist/webquark/{p-4d61b70d.entry.js → p-4d30227e.entry.js} +1 -1
  418. package/dist/webquark/{p-70d9ffde.entry.js → p-4de536ae.entry.js} +1 -1
  419. package/dist/webquark/{p-90b0858c.entry.js → p-4e4d70c9.entry.js} +1 -1
  420. package/dist/webquark/p-4efeb7c9.entry.js +1 -0
  421. package/dist/webquark/{p-dd115868.entry.js → p-51b3d71b.entry.js} +1 -1
  422. package/dist/webquark/p-778b6bbb.entry.js +1 -0
  423. package/dist/webquark/{p-f63b7214.entry.js → p-7da78b2f.entry.js} +1 -1
  424. package/dist/webquark/{p-9ff7e5a4.entry.js → p-7f8f986b.entry.js} +1 -1
  425. package/dist/webquark/p-8253c742.entry.js +1 -0
  426. package/dist/webquark/{p-059daa8a.entry.js → p-9a1ddeb7.entry.js} +1 -1
  427. package/dist/webquark/p-B610wOGe.js +1 -0
  428. package/dist/webquark/p-BxxU73QQ.js +1 -0
  429. package/dist/webquark/p-CIMzZPQO.js +3 -0
  430. package/dist/webquark/p-CfR85WgM.js +13 -0
  431. package/dist/{components/p-BofcK-7Z.js → webquark/p-D8p28N9s.js} +1 -1
  432. package/dist/webquark/p-DbzjRzhu.js +1 -0
  433. package/dist/webquark/{p-BOdNg0jc.js → p-DeOEN0si.js} +1 -1
  434. package/dist/webquark/{p-d0fbd2b1.entry.js → p-a2b1de23.entry.js} +1 -1
  435. package/dist/webquark/{p-48fb5228.entry.js → p-a55edc17.entry.js} +1 -1
  436. package/dist/webquark/p-a8808020.entry.js +1 -0
  437. package/dist/webquark/{p-f4f97e74.entry.js → p-b1084b3c.entry.js} +1 -1
  438. package/dist/webquark/{p-36118d90.entry.js → p-b6c4dff4.entry.js} +1 -1
  439. package/dist/webquark/p-b962e950.entry.js +1 -0
  440. package/dist/webquark/{p-023f8437.entry.js → p-bc369cd6.entry.js} +1 -1
  441. package/dist/webquark/p-c119a8ea.entry.js +1 -0
  442. package/dist/webquark/p-c6b77e9a.entry.js +1 -0
  443. package/dist/webquark/{p-030ecde3.entry.js → p-ca1c03b4.entry.js} +1 -1
  444. package/dist/webquark/{p-8ece2c62.entry.js → p-ce436162.entry.js} +1 -1
  445. package/dist/webquark/{p-0aa74ad6.entry.js → p-d0a47a7c.entry.js} +1 -1
  446. package/dist/webquark/{p-fec6fe0a.entry.js → p-e1fbc8fc.entry.js} +1 -1
  447. package/dist/webquark/{p-09cca7b9.entry.js → p-e32833ce.entry.js} +1 -1
  448. package/dist/webquark/p-e369a4aa.entry.js +1 -0
  449. package/dist/webquark/p-e4430c61.entry.js +1 -0
  450. package/dist/webquark/{p-f9ad63ff.entry.js → p-e9c0052b.entry.js} +1 -1
  451. package/dist/webquark/{p-f1bac94c.entry.js → p-f5c4ca18.entry.js} +1 -1
  452. package/dist/webquark/{p-64096386.entry.js → p-f6683126.entry.js} +1 -1
  453. package/dist/webquark/{p-DWO-pleQ.js → p-ojSDiptZ.js} +1 -1
  454. package/dist/webquark/webquark.css +1 -1
  455. package/dist/webquark/webquark.esm.js +1 -1
  456. package/package.json +6 -2
  457. package/dist/cjs/q-button_2.cjs.entry.js +0 -462
  458. package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
  459. package/dist/components/p-B4Mg1xEw.js +0 -1
  460. package/dist/components/p-BH4gQWub.js +0 -1
  461. package/dist/components/p-Bj2RJb2E.js +0 -1
  462. package/dist/components/p-ByfrUWx1.js +0 -1
  463. package/dist/components/p-CN1ut2Lb.js +0 -1
  464. package/dist/components/p-ye27qtRo.js +0 -1
  465. package/dist/esm/q-button_2.entry.js +0 -459
  466. package/dist/esm/q-scrollable.entry.js +0 -447
  467. package/dist/types/utils/formatter.d.ts +0 -15
  468. package/dist/webquark/p-04c8cb9e.entry.js +0 -1
  469. package/dist/webquark/p-0ae43d6c.entry.js +0 -1
  470. package/dist/webquark/p-0c3aac3f.entry.js +0 -1
  471. package/dist/webquark/p-144ef339.entry.js +0 -1
  472. package/dist/webquark/p-296fbdb1.entry.js +0 -1
  473. package/dist/webquark/p-5f232b44.entry.js +0 -13
  474. package/dist/webquark/p-6e28cfe2.entry.js +0 -1
  475. package/dist/webquark/p-91fff6b6.entry.js +0 -1
  476. package/dist/webquark/p-923dac41.entry.js +0 -1
  477. package/dist/webquark/p-97a89cae.entry.js +0 -1
  478. package/dist/webquark/p-B4Mg1xEw.js +0 -1
  479. package/dist/webquark/p-B5ElFlHv.js +0 -3
  480. package/dist/webquark/p-Bj2RJb2E.js +0 -1
  481. package/dist/webquark/p-ByfrUWx1.js +0 -1
  482. package/dist/webquark/p-c523ec6f.entry.js +0 -1
  483. package/dist/webquark/p-d0253d64.entry.js +0 -1
  484. package/dist/webquark/p-f98f9439.entry.js +0 -1
  485. package/dist/webquark/p-fe200f68.entry.js +0 -1
  486. /package/dist/{types/components/actions/button/button.utils.unit.test.d.ts → collection/components/data-display/syntax-box/internals/formatters/formatter.types.js} +0 -0
  487. /package/dist/collection/{utils → components/data-display/syntax-box/internals}/syntax.js +0 -0
  488. /package/dist/types/{utils/formatter.unit.test.d.ts → components/actions/button/test/button.utils.unit.test.d.ts} +0 -0
  489. /package/dist/types/{utils/syntax.unit.test.d.ts → components/data-display/syntax-box/internals/formatters/formatter.unit.test.d.ts} +0 -0
@@ -1,474 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DWXhKHCB.js');
4
- var formFieldState = require('./form-field-state-P63wN30v.js');
5
- var formFieldAdapter = require('./form-field-adapter-D0CJ6poh.js');
6
- var formControlValidity = require('./form-control-validity-D1ukC0_e.js');
3
+ var index = require('./index-BN-WdOQM.js');
4
+ var syntaxContent = require('./syntax-content-BmSExDiW.js');
5
+ require('./form-field-adapter-D0CJ6poh.js');
6
+ require('./form-field-state-P63wN30v.js');
7
+ require('./form-control-validity-BkilGb3E.js');
7
8
 
8
- /**
9
- * @license @lucide/icons v1.54.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */
9
+ const syntaxBoxCss = () => `:host{--q-syntax-bg:#0d1117;--q-syntax-border:#21262d;--q-syntax-header-bg:#161b22;--q-syntax-text:#c9d1d9;--q-syntax-comment:#8b949e;--q-syntax-tag:#ff7b72;--q-syntax-attr:#79c0ff;--q-syntax-value:#a5d6ff;--q-syntax-number:#f0883e;--q-syntax-font-mono:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;--q-syntax-header-font-size:var(--q-font-size-sm, 0.7rem);--q-syntax-code-font-size:var(--q-font-size-base, 0.9rem);--q-syntax-compact-font-size:var(--q-font-size-sm, 0.7rem);display:block;box-sizing:border-box}.panel-container{border-radius:var(--q-radius-lg, 12px);background:var(--q-syntax-bg);border:1px solid var(--q-syntax-border);overflow:hidden;height:100%;box-sizing:border-box}.panel-header{display:grid;grid-area:1 / 1 / 2 / 3;grid-template-columns:subgrid;align-items:center;background:var(--q-syntax-header-bg);border-bottom:1px solid var(--q-syntax-border);font-size:var(--q-syntax-header-font-size);color:var(--q-syntax-comment);box-sizing:border-box}.syntax-layout{position:relative;display:grid;grid-template-columns:minmax(0, 1fr) auto;grid-template-rows:auto auto;min-width:0}.view-panel,:host(.embedded-view){display:grid;grid-area:1 / 1 / 3 / 3;grid-template-columns:subgrid;grid-template-rows:subgrid;min-width:0}.view-panel[data-inactive],.validation-anchor{position:absolute;overflow:hidden;clip-path:inset(50%);pointer-events:none}.view-panel[data-inactive]{inset-inline:0;inset-block-start:0;visibility:hidden}.validation-anchor{width:1px;height:1px;visibility:visible}.panel-header>span,.panel-header>q-tabs{z-index:1;grid-column:1;min-width:0;margin:var(--q-syntax-header-padding, 4px 16px);align-self:center}.panel-header>q-tabs{--q-tabs-border:0;--q-tabs-tab-max-width:100%;display:grid;align-self:stretch;margin-block:0}.panel-container>.panel-header>q-tabs{margin-block-end:-1px}.panel-actions{display:flex;align-items:center;gap:8px;z-index:1;grid-area:1 / 2 / 2 / 3;justify-self:end;align-self:center;padding:var(--q-syntax-header-padding, 4px 16px)}.view-content{grid-area:2 / 1 / 3 / 3;min-width:0}.plain-container .panel-header{border:0;background:transparent}.panel-header>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.format-feedback{padding:4px 16px;font-size:var(--q-syntax-header-font-size);color:var(--q-syntax-comment);border-bottom:1px solid var(--q-syntax-border)}.plain-container{margin:0;padding:0;box-sizing:border-box}.code-body,.slotted-body,.editor-textarea{padding:var(--q-syntax-padding, var(--q-padding-lg, 1rem));font-family:var(--q-syntax-font-mono);font-size:var(--q-syntax-code-font-size);line-height:1.5}.code-body,.slotted-body{color:var(--q-syntax-text)}.slotted-body{overflow-wrap:anywhere}.code-body{margin:0;overflow-x:hidden;overflow-y:auto;white-space:pre-wrap;word-wrap:break-word}:host([role='log']),:host(.q-syntax-log-content){--q-syntax-padding:var(--q-padding-md, .75rem) var(--q-padding-lg, 1rem)}:host(.variant-card-code) .code-body{padding:var(--q-syntax-compact-padding, 10px);font-size:var(--q-syntax-compact-font-size);border-radius:var(--q-radius-md, 8px);background:var(--q-syntax-bg);border:1px solid var(--q-syntax-border)}.code-comment{color:var(--q-syntax-comment);font-style:italic}.code-tag{color:var(--q-syntax-tag);font-weight:600}.code-attr{color:var(--q-syntax-attr)}.code-value{color:var(--q-syntax-value)}.code-number{color:var(--q-syntax-number)}.editor-area{position:relative;width:100%;box-sizing:border-box}.editor-textarea{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;box-sizing:border-box;white-space:pre-wrap;word-wrap:break-word;overflow-x:hidden;overflow-y:auto;background:transparent;color:transparent;caret-color:var(--q-color-primary, #60a5fa);border:none;outline:none;resize:none;z-index:1}.editor-textarea::selection{background:rgba(96, 165, 250, 0.3);color:transparent}.editor-textarea:focus-visible{border-block-end:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa))}.editor-area .code-body{position:relative;width:100%;height:100%;margin:0;box-sizing:border-box;overflow:hidden;pointer-events:none}:host([disabled]){opacity:0.6;cursor:not-allowed !important}:host([disabled]) .editor-textarea,.editor-textarea:disabled,:host([disabled]) .code-body,:host([disabled]) .code-body *{cursor:not-allowed !important;user-select:none;-webkit-user-select:none}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}`;
14
10
 
15
- const Braces = {
16
- name: "braces",
17
- size: 24,
18
- node: [
19
- [
20
- "path",
21
- { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
22
- ],
23
- [
24
- "path",
25
- {
26
- d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
27
- key: "e1hn23"
28
- }
29
- ]
30
- ],
31
- aliases: ["curly-braces"]
32
- };
33
-
34
- /**
35
- * @license @lucide/icons v1.54.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */
40
-
41
- const Check = {
42
- name: "check",
43
- size: 24,
44
- node: [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]
45
- };
46
-
47
- /**
48
- * @license @lucide/icons v1.54.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */
53
-
54
- const Copy = {
55
- name: "copy",
56
- size: 24,
57
- node: [
58
- ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
59
- ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
60
- ]
61
- };
62
-
63
- const MAX_JSON_FORMAT_INPUT = 1_048_576;
64
- const MAX_JSON_FORMAT_OUTPUT = 2_097_152;
65
- const MAX_JSON_FORMAT_DEPTH = 128;
66
- class FormatLimitError extends Error {
67
- }
68
- function isFormatSupported(language) {
69
- return typeof language === 'string' && language.toLowerCase() === 'json';
70
- }
71
- /** Validates JSON grammar while emitting original tokens, never JavaScript values. */
72
- function layoutJson(source) {
73
- if (source.length > MAX_JSON_FORMAT_INPUT) {
74
- throw new FormatLimitError();
75
- }
76
- let index = 0;
77
- let outputLength = 0;
78
- const parts = [];
79
- const emit = (text) => {
80
- outputLength += text.length;
81
- if (outputLength > MAX_JSON_FORMAT_OUTPUT) {
82
- throw new FormatLimitError();
83
- }
84
- parts.push(text);
85
- };
86
- const whitespace = () => {
87
- while (/[\x20\t\r\n]/.test(source.charAt(index)) && index < source.length) {
88
- index++;
89
- }
90
- };
91
- const requireCharacter = (character) => {
92
- if (source[index++] !== character) {
93
- throw new SyntaxError('Invalid JSON.');
94
- }
95
- whitespace();
96
- };
97
- const stringToken = () => {
98
- const start = index;
99
- if (source[index++] !== '"') {
100
- throw new SyntaxError('Invalid JSON string.');
101
- }
102
- while (index < source.length) {
103
- const character = source[index++];
104
- if (character === '"') {
105
- return source.slice(start, index);
106
- }
107
- if (character.charCodeAt(0) < 0x20) {
108
- throw new SyntaxError('Invalid JSON string.');
109
- }
110
- if (character === '\\') {
111
- const escaped = source[index++];
112
- if (escaped === 'u') {
113
- if (!/^[\da-fA-F]{4}$/.test(source.slice(index, index + 4))) {
114
- throw new SyntaxError('Invalid JSON escape.');
115
- }
116
- index += 4;
117
- }
118
- else if (!escaped || !'"\\/bfnrt'.includes(escaped)) {
119
- throw new SyntaxError('Invalid JSON escape.');
120
- }
121
- }
122
- }
123
- throw new SyntaxError('Unterminated JSON string.');
124
- };
125
- const newline = (depth) => emit('\n' + ' '.repeat(depth));
126
- const value = (depth) => {
127
- whitespace();
128
- const character = source[index];
129
- if (character === '{' || character === '[') {
130
- if (depth >= MAX_JSON_FORMAT_DEPTH) {
131
- throw new FormatLimitError();
132
- }
133
- const object = character === '{';
134
- const close = object ? '}' : ']';
135
- index++;
136
- emit(character);
137
- whitespace();
138
- if (source[index] === close) {
139
- index++;
140
- emit(close);
141
- return;
142
- }
143
- newline(depth + 1);
144
- while (true) {
145
- if (object) {
146
- emit(stringToken());
147
- whitespace();
148
- requireCharacter(':');
149
- emit(': ');
150
- }
151
- value(depth + 1);
152
- whitespace();
153
- if (source[index] === close) {
154
- index++;
155
- newline(depth);
156
- emit(close);
157
- return;
158
- }
159
- requireCharacter(',');
160
- emit(',');
161
- newline(depth + 1);
162
- }
163
- }
164
- if (character === '"') {
165
- emit(stringToken());
166
- return;
167
- }
168
- for (const literal of ['true', 'false', 'null']) {
169
- if (source.startsWith(literal, index)) {
170
- index += literal.length;
171
- emit(literal);
172
- return;
173
- }
174
- }
175
- const start = index;
176
- while (index < source.length && /[\d.eE+-]/.test(source[index])) {
177
- index++;
178
- }
179
- const token = source.slice(start, index);
180
- if (!/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(token)) {
181
- throw new SyntaxError('Invalid JSON value.');
182
- }
183
- emit(token);
184
- };
185
- value(0);
186
- whitespace();
187
- if (index !== source.length) {
188
- throw new SyntaxError('Trailing JSON content.');
189
- }
190
- return parts.join('');
191
- }
192
- function formatSource(code, language) {
193
- if (!isFormatSupported(language)) {
194
- return { code, status: 'unsupported' };
195
- }
196
- try {
197
- const formatted = layoutJson(code);
198
- return { code: formatted, status: formatted === code ? 'unchanged' : 'formatted' };
199
- }
200
- catch (error) {
201
- return { code, status: error instanceof FormatLimitError ? 'unsupported' : 'invalid' };
202
- }
203
- }
204
-
205
- /** Each token and gap is an unchanged slice of the source; generated markup is never scanned. */
206
- function scan(text, pattern, classify) {
207
- const tokens = [];
208
- let offset = 0;
209
- let match;
210
- while ((match = pattern.exec(text)) !== null) {
211
- if (offset < match.index)
212
- tokens.push({ text: text.slice(offset, match.index) });
213
- tokens.push({ text: match[0], className: classify(match) });
214
- offset = match.index + match[0].length;
215
- }
216
- if (offset < text.length)
217
- tokens.push({ text: text.slice(offset) });
218
- return tokens;
219
- }
220
- /** Keep unhighlighted runs together so long edits do not create a text node per character. */
221
- function tokenWriter(text) {
222
- const tokens = [];
223
- let plainStart = 0;
224
- return {
225
- emit(start, end, className) {
226
- if (plainStart < start)
227
- tokens.push({ text: text.slice(plainStart, start) });
228
- tokens.push({ text: text.slice(start, end), className });
229
- plainStart = end;
230
- },
231
- finish() {
232
- if (plainStart < text.length)
233
- tokens.push({ text: text.slice(plainStart) });
234
- return tokens;
235
- },
236
- };
237
- }
238
- function isLetter(char) {
239
- return char >= 'a' && char <= 'z' || char >= 'A' && char <= 'Z';
240
- }
241
- function isDigit(char) {
242
- return char >= '0' && char <= '9';
243
- }
244
- function isWord(char) {
245
- return isLetter(char) || isDigit(char) || char === '_';
246
- }
247
- function skipWhitespace(text, offset) {
248
- while (offset < text.length && /\s/.test(text[offset]))
249
- offset++;
250
- return offset;
251
- }
252
- function quotedEnd(text, start, escaped) {
253
- const quote = text[start];
254
- let offset = start + 1;
255
- while (offset < text.length) {
256
- if (escaped && text[offset] === '\\')
257
- offset = Math.min(text.length, offset + 2);
258
- else if (text[offset++] === quote)
259
- break;
260
- }
261
- return offset;
262
- }
263
- /** Consume each name once instead of retrying an attribute lookahead at every suffix. */
264
- function tokenizeHtml(text) {
265
- const writer = tokenWriter(text);
266
- let offset = 0;
267
- while (offset < text.length) {
268
- const start = offset;
269
- const char = text[offset];
270
- if (text.startsWith('<!--', offset)) {
271
- const end = text.indexOf('-->', offset + 4);
272
- offset = end === -1 ? text.length : end + 3;
273
- writer.emit(start, offset, 'code-comment');
274
- }
275
- else if (char === '<' && isLetter(text[offset + (text[offset + 1] === '/' ? 2 : 1)])) {
276
- offset += text[offset + 1] === '/' ? 3 : 2;
277
- while (offset < text.length && (isWord(text[offset]) || text[offset] === ':' || text[offset] === '-'))
278
- offset++;
279
- writer.emit(start, offset, 'code-tag');
280
- }
281
- else if (char === '"' || char === "'") {
282
- // HTML uses entities for embedded quotes; a backslash does not escape its delimiter.
283
- offset = quotedEnd(text, start, false);
284
- writer.emit(start, offset, 'code-value');
285
- }
286
- else if (char === '>' || char === '/' && text[offset + 1] === '>') {
287
- offset += char === '/' ? 2 : 1;
288
- writer.emit(start, offset, 'code-tag');
289
- }
290
- else if (isWord(char) || char === ':' || char === '-') {
291
- offset++;
292
- while (offset < text.length && (isWord(text[offset]) || text[offset] === ':' || text[offset] === '-'))
293
- offset++;
294
- if (text[skipWhitespace(text, offset)] === '=')
295
- writer.emit(start, offset, 'code-attr');
296
- }
297
- else
298
- offset++;
299
- }
300
- return writer.finish();
301
- }
302
- const JAVASCRIPT_KEYWORDS = new Set([
303
- 'const', 'let', 'var', 'function', 'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case',
304
- 'break', 'continue', 'class', 'export', 'import', 'from', 'new', 'this', 'typeof', 'instanceof',
305
- 'try', 'catch', 'finally', 'throw', 'async', 'await', 'null', 'undefined', 'true', 'false',
306
- ]);
307
- /** Consume strings/comments before identifiers so their contents are never scanned as code. */
308
- function tokenizeJavascript(text) {
309
- const writer = tokenWriter(text);
310
- let offset = 0;
311
- while (offset < text.length) {
312
- const start = offset;
313
- const char = text[offset];
314
- if (char === '/' && text[offset + 1] === '/') {
315
- offset += 2;
316
- while (offset < text.length && !/[\r\n\u2028\u2029]/.test(text[offset]))
317
- offset++;
318
- writer.emit(start, offset, 'code-comment');
319
- }
320
- else if (char === '/' && text[offset + 1] === '*') {
321
- const end = text.indexOf('*/', offset + 2);
322
- offset = end === -1 ? text.length : end + 2;
323
- writer.emit(start, offset, 'code-comment');
324
- }
325
- else if (char === '"' || char === "'" || char === '`') {
326
- offset = quotedEnd(text, start, true);
327
- writer.emit(start, offset, 'code-value');
328
- }
329
- else if (isLetter(char) || char === '_' || char === '$') {
330
- offset++;
331
- while (offset < text.length && (isWord(text[offset]) || text[offset] === '$'))
332
- offset++;
333
- if (JAVASCRIPT_KEYWORDS.has(text.slice(start, offset)))
334
- writer.emit(start, offset, 'code-tag');
335
- else if (text[skipWhitespace(text, offset)] === '(')
336
- writer.emit(start, offset, 'code-attr');
337
- }
338
- else if (isDigit(char)) {
339
- while (offset < text.length && isDigit(text[offset]))
340
- offset++;
341
- if (text[offset] === '.' && isDigit(text[offset + 1])) {
342
- offset++;
343
- while (offset < text.length && isDigit(text[offset]))
344
- offset++;
345
- }
346
- if (isWord(text[offset]) || text[offset] === '$') {
347
- // An unfinished number/identifier is one plain run, not a highlighted suffix.
348
- while (offset < text.length && (isWord(text[offset]) || text[offset] === '$'))
349
- offset++;
350
- }
351
- else
352
- writer.emit(start, offset, 'code-number');
353
- }
354
- else
355
- offset++;
356
- }
357
- return writer.finish();
358
- }
359
- /** Consume CSS once, including incomplete edits; never retry a selector suffix. */
360
- function tokenizeCss(text) {
361
- const tokens = [];
362
- let mode = 'selector';
363
- let depth = 0;
364
- let offset = 0;
365
- const emit = (start, end, className) => {
366
- if (end > start)
367
- tokens.push({ text: text.slice(start, end), className });
368
- };
369
- while (offset < text.length) {
370
- const start = offset;
371
- const char = text[offset];
372
- if (char === '/' && text[offset + 1] === '*') {
373
- const end = text.indexOf('*/', offset + 2);
374
- offset = end === -1 ? text.length : end + 2;
375
- emit(start, offset, 'code-comment');
376
- }
377
- else if (char === '"' || char === "'") {
378
- offset++;
379
- while (offset < text.length) {
380
- if (text[offset] === '\\')
381
- offset = Math.min(text.length, offset + 2);
382
- else if (text[offset++] === char)
383
- break;
384
- }
385
- emit(start, offset, 'code-value');
386
- }
387
- else if (char === '{' || char === '}' || char === ';' || (char === ':' && mode === 'property')) {
388
- offset++;
389
- emit(start, offset);
390
- if (char === '{') {
391
- depth++;
392
- mode = 'property';
393
- }
394
- else if (char === '}') {
395
- depth = Math.max(0, depth - 1);
396
- mode = depth ? 'property' : 'selector';
397
- }
398
- else if (char === ';')
399
- mode = depth ? 'property' : 'selector';
400
- else
401
- mode = 'value';
402
- }
403
- else {
404
- // Each character belongs to exactly one run or lexical token.
405
- while (offset < text.length) {
406
- const next = text[offset];
407
- if (next === '"' || next === "'" || next === '{' || next === '}' || next === ';' ||
408
- (next === ':' && mode === 'property') || (next === '/' && text[offset + 1] === '*'))
409
- break;
410
- offset++;
411
- }
412
- emit(start, offset, mode === 'selector' ? 'code-tag' : mode === 'property' ? 'code-attr' : 'code-value');
413
- }
414
- }
415
- return tokens;
416
- }
417
- function tokenizeSyntax(text, language) {
418
- switch (language) {
419
- case 'html':
420
- return tokenizeHtml(text);
421
- case 'javascript':
422
- return tokenizeJavascript(text);
423
- case 'css':
424
- return tokenizeCss(text);
425
- case 'json':
426
- return scan(text, /("(?:[^"\\]|\\[\s\S])*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|\b(?:true|false|null)\b)/g, match => match[1] ? /^\s*:/.test(text.slice(match.index + match[0].length)) ? 'code-tag' : 'code-value' : 'code-attr');
427
- default:
428
- return text ? [{ text }] : [];
429
- }
430
- }
431
-
432
- function getSyntaxBoxCopyText(code, fallbackText) {
433
- return code !== undefined ? code : fallbackText || '';
434
- }
435
- async function writeClipboardText(text) {
436
- if (!navigator.clipboard || typeof navigator.clipboard.writeText !== 'function') {
437
- throw new Error('Clipboard API unavailable');
438
- }
439
- await navigator.clipboard.writeText(text);
440
- }
441
-
442
- function getSyntaxBoxEditorKeyAction(event, value, start, end) {
443
- if (event.key === 'Escape') {
444
- return { type: 'blur' };
445
- }
446
- if (event.key !== 'Tab' || event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) {
447
- return { type: 'none' };
448
- }
449
- const spaces = ' ';
450
- return {
451
- type: 'indent',
452
- value: value.substring(0, start) + spaces + value.substring(end),
453
- caret: start + spaces.length,
454
- };
455
- }
456
-
457
- /** Missing editable content is empty; supplied source is never reformatted. */
458
- function normalizeSyntaxBoxValue(value, options) {
459
- return options.editable ? value ?? '' : value;
460
- }
461
- function resolveInitialSyntaxBoxValue(options) {
462
- const code = normalizeSyntaxBoxValue(options.code ?? options.value, options);
463
- // Preserve the existing read-only behavior when both aliases were supplied differently.
464
- const value = options.editable ? code : options.value ?? code;
465
- return { code, value, initialValue: code ?? '' };
466
- }
467
-
468
- const syntaxBoxCss = () => `:host{--q-syntax-bg:#0d1117;--q-syntax-border:#21262d;--q-syntax-header-bg:#161b22;--q-syntax-text:#c9d1d9;--q-syntax-comment:#8b949e;--q-syntax-tag:#ff7b72;--q-syntax-attr:#79c0ff;--q-syntax-value:#a5d6ff;--q-syntax-number:#f0883e;--q-syntax-font-mono:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;--q-syntax-header-font-size:var(--q-font-size-sm, 0.7rem);--q-syntax-code-font-size:var(--q-font-size-base, 0.9rem);--q-syntax-compact-font-size:var(--q-font-size-sm, 0.7rem);display:block;box-sizing:border-box}.panel-container{position:relative;border-radius:var(--q-radius-lg, 12px);background:var(--q-syntax-bg);border:1px solid var(--q-syntax-border);overflow:hidden;height:100%;display:flex;flex-direction:column;box-sizing:border-box}.panel-header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:var(--q-syntax-header-padding, 4px 16px);background:var(--q-syntax-header-bg);border-bottom:1px solid var(--q-syntax-border);font-size:var(--q-syntax-header-font-size);color:var(--q-syntax-comment);box-sizing:border-box;flex-shrink:0}.panel-header>span{flex-shrink:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.panel-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.format-feedback{padding:4px 16px;font-size:var(--q-syntax-header-font-size);color:var(--q-syntax-comment);border-bottom:1px solid var(--q-syntax-border)}.plain-container{margin:0;padding:0;box-sizing:border-box}.code-body{margin:0;padding:var(--q-syntax-padding, 16px);overflow-x:hidden;overflow-y:auto;font-family:var(--q-syntax-font-mono);font-size:var(--q-syntax-code-font-size);line-height:1.5;color:var(--q-syntax-text);white-space:pre-wrap;word-wrap:break-word}:host(.variant-card-code) .code-body{padding:var(--q-syntax-compact-padding, 10px);font-size:var(--q-syntax-compact-font-size);border-radius:var(--q-radius-md, 8px);background:var(--q-syntax-bg);border:1px solid var(--q-syntax-border)}.code-comment{color:var(--q-syntax-comment);font-style:italic}.code-tag{color:var(--q-syntax-tag);font-weight:600}.code-attr{color:var(--q-syntax-attr)}.code-value{color:var(--q-syntax-value)}.code-number{color:var(--q-syntax-number)}.editor-area{position:relative;width:100%;box-sizing:border-box}.editor-textarea{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:var(--q-syntax-padding, 16px);box-sizing:border-box;font-family:var(--q-syntax-font-mono);font-size:var(--q-syntax-code-font-size);line-height:1.5;white-space:pre-wrap;word-wrap:break-word;overflow-x:hidden;overflow-y:auto;background:transparent;color:transparent;caret-color:var(--q-color-primary, #60a5fa);border:none;outline:none;resize:none;z-index:1}.editor-textarea::selection{background:rgba(96, 165, 250, 0.3);color:transparent}.editor-area .code-body{position:relative;width:100%;height:100%;margin:0;padding:var(--q-syntax-padding, 16px);box-sizing:border-box;overflow:hidden;pointer-events:none}.panel-container:focus-within{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:-1px}:host([editable]) .plain-container:focus-within{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));border-radius:var(--q-radius-md, 8px)}:host([disabled]){opacity:0.6;cursor:not-allowed !important}:host([disabled]) .editor-textarea,.editor-textarea:disabled,:host([disabled]) .code-body,:host([disabled]) .code-body *{cursor:not-allowed !important;user-select:none;-webkit-user-select:none}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}`;
469
-
470
- const QSyntaxBox = class {
11
+ let nextBox = 0;
12
+ const QSyntaxBox = class extends index.Mixin(syntaxContent.withSyntaxContent) {
471
13
  constructor(hostRef) {
14
+ super();
472
15
  index.registerInstance(this, hostRef);
473
16
  this.qChange = index.createEvent(this, "qChange");
474
17
  this.qInput = index.createEvent(this, "qInput");
@@ -482,277 +25,192 @@ const QSyntaxBox = class {
482
25
  }
483
26
  get el() { return index.getElement(this); }
484
27
  internals;
485
- /** Mirrored with `value`; prefer `code` for domain usage. */
486
- code;
487
- /** Form-value alias mirrored with `code` for compatibility. */
488
- value;
489
- /** Shown only in the panel variant. */
490
- heading;
491
- /** Accessible name for the editor; falls back to `heading`, then the language. */
492
- ariaLabel = null;
493
- variant = 'panel';
494
- /** Explicit content height. Panel mode defaults to 110px; plain mode defaults to auto. */
495
- height;
496
- copyable = false;
497
- editable = false;
498
- /** Form field name used when the component is editable. */
499
- name;
500
- /** Marks the editable textarea as required for form validation. */
501
- required = false;
502
- language = 'html';
503
- /** Disables editing and panel actions. */
504
- disabled = false;
505
- /** Emitted when editable content is committed by the native change event or by formatting. */
506
- qChange;
507
- /** Emitted on each editable content input and after formatting. */
508
- qInput;
509
- // ======================== [2] INTERNAL STATE & REFS ========================
510
- disabledState = false;
511
- get isDisabled() {
512
- return formFieldState.isFieldDisabled(this.el, this.disabled);
513
- }
514
- copied = false;
515
- copyFailed = false;
516
- formatMessage;
517
- initialValue = '';
518
- copiedTimeoutId;
519
- scrollableEl;
520
- preEl;
521
- // ========================= [3] LIFECYCLE & WATCHERS =========================
522
- watchCode(newCode) {
523
- this.formatMessage = undefined;
524
- const finalCode = normalizeSyntaxBoxValue(newCode, {
525
- editable: this.editable,
28
+ instanceId = `q-syntax-box-${++nextBox}`;
29
+ identities = new WeakMap();
30
+ nextView = 0;
31
+ views = [];
32
+ selected;
33
+ observer;
34
+ tabSelector;
35
+ focusWithin = false;
36
+ restoreFocus = false;
37
+ activeVariant;
38
+ linkFrame;
39
+ connectedCallback() {
40
+ syntaxContent.syntaxBoxes.set(this.el, this);
41
+ this.el.addEventListener('focusin', this.onFocusIn);
42
+ this.el.addEventListener('focusout', this.onFocusOut);
43
+ this.observer = new MutationObserver(changes => {
44
+ const changed = changes.some(change => change.target === this.el || change.target.parentNode === this.el &&
45
+ (change.type === 'characterData' || change.type === 'attributes'));
46
+ if (changed && this.collectViews())
47
+ index.forceUpdate(this.el);
526
48
  });
527
- if (finalCode !== newCode) {
528
- this.code = finalCode;
529
- }
530
- if (this.value !== finalCode) {
531
- this.value = finalCode;
532
- }
533
- this.syncFormValue(finalCode);
534
- }
535
- watchValue(newValue) {
536
- this.formatMessage = undefined;
537
- const finalVal = normalizeSyntaxBoxValue(newValue, {
538
- editable: this.editable,
49
+ this.observer.observe(this.el, {
50
+ childList: true, subtree: true, characterData: true, attributes: true,
51
+ attributeFilter: ['heading', 'view-key', 'slot'],
539
52
  });
540
- if (finalVal !== newValue) {
541
- this.value = finalVal;
542
- }
543
- if (this.code !== finalVal) {
544
- this.code = finalVal;
545
- }
546
- this.syncFormValue(finalVal);
547
53
  }
548
- watchConstraints() {
549
- this.syncValidity();
550
- }
551
- watchEditable() {
552
- if (this.editable)
553
- this.watchCode(this.code);
554
- this.syncFormValue(this.code);
555
- }
556
- componentWillLoad() {
557
- const initial = resolveInitialSyntaxBoxValue({
558
- code: this.code,
559
- value: this.value,
560
- editable: this.editable,
561
- });
562
- this.code = initial.code;
563
- this.value = initial.value;
564
- this.initialValue = initial.initialValue;
565
- this.syncFormValue(this.code);
566
- }
567
- formDisabledCallback() {
568
- this.syncValidity();
569
- }
570
- componentDidLoad() {
571
- formFieldAdapter.registerFormField(this.el, {
572
- kind: 'text',
573
- owner: () => this.internals?.form ?? null,
574
- active: () => this.editable,
575
- value: () => this.code ?? '',
576
- assign: value => { this.value = value; },
577
- reconcile: () => {
578
- const textarea = this.el.shadowRoot?.querySelector('textarea');
579
- if (textarea && textarea.value !== (this.code ?? ''))
580
- textarea.value = this.code ?? '';
581
- this.syncFormValue(this.code);
582
- this.syncValidity();
583
- },
584
- reset: () => this.formResetCallback(),
585
- validate: report => report ? this.internals?.reportValidity?.() ?? true : this.internals?.checkValidity?.() ?? true,
586
- });
54
+ componentWillRender() {
55
+ this.collectViews();
587
56
  }
588
57
  componentDidRender() {
589
- this.syncValidity();
58
+ super.componentDidRender();
59
+ if (this.activeVariant !== this.variant) {
60
+ this.activeVariant = this.variant;
61
+ for (const view of this.views)
62
+ if (view.element !== this.el)
63
+ index.forceUpdate(view.element);
64
+ }
65
+ this.syncPanels();
66
+ if (this.linkFrame !== undefined)
67
+ cancelAnimationFrame(this.linkFrame);
68
+ this.linkFrame = requestAnimationFrame(() => {
69
+ this.linkFrame = undefined;
70
+ this.linkTabs();
71
+ if (this.selected)
72
+ syntaxContent.syntaxScrollRestorers.get(this.selected)?.();
73
+ this.recoverFocus();
74
+ });
590
75
  }
591
76
  disconnectedCallback() {
592
- this.clearCopiedTimeout();
593
- }
594
- formResetCallback() {
595
- this.code = this.initialValue;
596
- this.value = this.initialValue;
597
- this.syncFormValue(this.code);
598
- this.syncValidity();
599
- }
600
- // ========================== [4] EXPOSED METHODS ==========================
601
- /** Programmatically scrolls the read-only code body to the bottom when it is wrapped by q-scrollable. */
602
- async scrollToBottom() {
603
- await this.scrollableEl?.scrollToBottom();
604
- }
605
- /** Returns whether editable content satisfies native constraints. */
606
- async checkValidity() {
607
- this.syncValidity();
608
- if (typeof this.internals.checkValidity === 'function') {
609
- return this.internals.checkValidity();
610
- }
611
- return this.el.shadowRoot?.querySelector('textarea')?.checkValidity?.() ?? true;
612
- }
613
- /** Reports editable constraint violations and returns whether the control is valid. */
614
- async reportValidity() {
615
- this.syncValidity();
616
- if (typeof this.internals.reportValidity === 'function') {
617
- return this.internals.reportValidity();
618
- }
619
- return this.el.shadowRoot?.querySelector('textarea')?.reportValidity?.() ?? true;
620
- }
621
- // =================== [5] EVENT HANDLERS & INTERNAL METHODS ===================
622
- syncFormValue(value) {
623
- if (!this.internals || typeof this.internals.setFormValue !== 'function')
77
+ super.disconnectedCallback();
78
+ this.observer?.disconnect();
79
+ this.el.removeEventListener('focusin', this.onFocusIn);
80
+ this.el.removeEventListener('focusout', this.onFocusOut);
81
+ if (this.linkFrame !== undefined)
82
+ cancelAnimationFrame(this.linkFrame);
83
+ }
84
+ visible(view) {
85
+ return !this.selected || view === this.selected;
86
+ }
87
+ select(view) {
88
+ if (!this.views.some(candidate => candidate.element === view) || this.selected === view)
624
89
  return;
625
- this.internals.setFormValue(this.editable ? value || '' : null);
626
- this.syncValidity();
627
- }
628
- syncValidity() {
629
- const disabled = formFieldState.syncFieldHost(this.el, this.disabled, this.name, this.required);
630
- if (this.disabledState !== disabled)
631
- this.disabledState = disabled;
632
- const textarea = this.el.shadowRoot?.querySelector('textarea');
633
- if (textarea) {
634
- textarea.disabled = disabled;
635
- textarea.required = this.required;
636
- textarea.readOnly = this.el.hasAttribute('readonly');
637
- if (textarea.value !== (this.code ?? ''))
638
- textarea.value = this.code ?? '';
639
- }
640
- this.internals?.setFormValue?.(this.editable && !disabled ? this.code ?? '' : null);
641
- if (!this.internals || !textarea || !this.editable) {
642
- if (typeof this.internals?.setValidity === 'function') {
643
- this.internals.setValidity({});
90
+ this.selected = view;
91
+ this.syncPanels();
92
+ index.forceUpdate(this.el);
93
+ }
94
+ onFocusIn = () => { this.focusWithin = true; };
95
+ onFocusOut = (event) => {
96
+ if (event.relatedTarget instanceof Node && !this.el.contains(event.relatedTarget))
97
+ this.focusWithin = false;
98
+ };
99
+ collectViews() {
100
+ const children = Array.from(this.el.children).filter((child) => child.localName === 'q-syntax-view');
101
+ const hostHasContent = this.code !== undefined || this.value !== undefined || this.editable || syntaxContent.hasSlottedSource(this.el);
102
+ const elements = hostHasContent || !children.length ? [this.el, ...children] : children;
103
+ const views = elements.map((element, index) => this.describeView(element, index));
104
+ const previous = this.views;
105
+ const changed = previous.length !== views.length || views.some((view, index) => previous[index]?.element !== view.element || previous[index]?.tab.label !== view.tab.label || previous[index]?.key !== view.key);
106
+ if (!changed)
107
+ return false;
108
+ if (!views.some(view => view.element === this.selected)) {
109
+ this.restoreFocus = this.selected !== undefined && this.focusWithin;
110
+ this.selected = this.replacementView(views).element;
111
+ }
112
+ if (previous.length > 1 && views.length === 1 && this.el.shadowRoot?.activeElement === this.tabSelector)
113
+ this.restoreFocus = true;
114
+ for (const old of previous) {
115
+ if (!elements.includes(old.element) && old.element.slot === old.tab.value) {
116
+ old.element.removeAttribute('slot');
117
+ index.forceUpdate(old.element);
644
118
  }
645
- return;
646
119
  }
647
- formControlValidity.syncNativeControlValidity({
648
- internals: this.internals,
649
- control: textarea,
650
- disabled: this.isDisabled,
651
- });
652
- }
653
- clearCopiedTimeout() {
654
- if (this.copiedTimeoutId !== undefined) {
655
- clearTimeout(this.copiedTimeoutId);
656
- this.copiedTimeoutId = undefined;
120
+ this.views = views;
121
+ return true;
122
+ }
123
+ describeView(element, index$1) {
124
+ let id = this.identities.get(element);
125
+ if (!id) {
126
+ id = `${this.instanceId}-view-${++this.nextView}`;
127
+ this.identities.set(element, id);
128
+ }
129
+ const child = element !== this.el;
130
+ if (child && element.slot !== id) {
131
+ element.slot = id;
132
+ if (element.shadowRoot?.childElementCount)
133
+ index.forceUpdate(element);
134
+ }
135
+ const label = (child ? element.getAttribute('heading') : this.heading)?.trim() || `View ${index$1 + 1}`;
136
+ return {
137
+ element,
138
+ key: child ? element.getAttribute('view-key')?.trim() : undefined,
139
+ tab: { label, value: id, tabId: id + '-tab', panelId: id + '-panel' },
140
+ };
141
+ }
142
+ replacementView(views) {
143
+ const index = this.views.findIndex(view => view.element === this.selected);
144
+ if (index < 0)
145
+ return views[0];
146
+ const key = this.views[index].key;
147
+ if (key && this.views.filter(view => view.key === key).length === 1) {
148
+ const replacements = views.filter(view => view.key === key);
149
+ if (replacements.length === 1)
150
+ return replacements[0];
151
+ }
152
+ const neighbors = [...this.views.slice(index + 1), ...this.views.slice(0, index).reverse()];
153
+ return neighbors.find(old => views.some(view => view.element === old.element)) ?? views[0];
154
+ }
155
+ onTabChange = (event) => {
156
+ event.stopPropagation();
157
+ const view = this.views.find(candidate => candidate.tab.value === event.detail);
158
+ if (view)
159
+ this.select(view.element);
160
+ };
161
+ panel(view) {
162
+ return this.el.shadowRoot?.getElementById(view.tab.panelId);
163
+ }
164
+ syncPanels() {
165
+ for (const view of this.views) {
166
+ const panel = this.panel(view);
167
+ if (!panel)
168
+ continue;
169
+ const inactive = !this.visible(view.element);
170
+ panel.toggleAttribute('data-inactive', inactive);
171
+ if (inactive)
172
+ panel.setAttribute('aria-hidden', 'true');
173
+ else
174
+ panel.removeAttribute('aria-hidden');
175
+ panel.tabIndex = !inactive && this.views.length > 1 ? 0 : -1;
176
+ syntaxContent.syntaxVisibility.get(view.element)?.();
657
177
  }
658
178
  }
659
- scheduleCopyStateReset() {
660
- this.clearCopiedTimeout();
661
- this.copiedTimeoutId = setTimeout(() => {
662
- this.copied = false;
663
- this.copyFailed = false;
664
- this.copiedTimeoutId = undefined;
665
- }, 1500);
666
- }
667
- copyCode = async () => {
668
- if (this.isDisabled)
669
- return;
670
- const codeToCopy = getSyntaxBoxCopyText(this.code, this.el.textContent);
671
- try {
672
- await writeClipboardText(codeToCopy);
673
- if (!this.el.isConnected)
674
- return;
675
- this.copied = true;
676
- this.copyFailed = false;
179
+ linkTabs() {
180
+ for (const view of this.views) {
181
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
182
+ const panel = this.panel(view);
183
+ if (!tab || !panel)
184
+ continue;
185
+ if ('ariaControlsElements' in tab)
186
+ tab.ariaControlsElements = [panel];
187
+ if ('ariaLabelledByElements' in panel)
188
+ panel.ariaLabelledByElements = [tab];
677
189
  }
678
- catch {
679
- if (!this.el.isConnected)
680
- return;
681
- this.copied = false;
682
- this.copyFailed = true;
683
- }
684
- this.scheduleCopyStateReset();
685
- };
686
- handleScroll = (e) => {
687
- const textarea = e.target;
688
- if (this.preEl) {
689
- this.preEl.scrollLeft = textarea.scrollLeft;
690
- this.preEl.scrollTop = textarea.scrollTop;
691
- }
692
- };
693
- handleInput = (ev) => {
694
- const target = ev.target;
695
- this.code = target.value;
696
- this.value = target.value;
697
- this.qInput.emit(this.code);
698
- };
699
- handleChange = (ev) => {
700
- const target = ev.target;
701
- this.code = target.value;
702
- this.value = target.value;
703
- this.qChange.emit(this.code);
704
- };
705
- handleKeyDown = (ev) => {
706
- const textarea = ev.target;
707
- const action = getSyntaxBoxEditorKeyAction(ev, textarea.value, textarea.selectionStart, textarea.selectionEnd);
708
- if (action.type === 'none') {
190
+ }
191
+ recoverFocus() {
192
+ if (!this.restoreFocus)
709
193
  return;
710
- }
711
- if (action.type === 'blur') {
712
- textarea.blur();
194
+ this.restoreFocus = false;
195
+ const focused = this.el.ownerDocument.activeElement;
196
+ if (focused && focused !== this.el.ownerDocument.body && focused !== this.el && !this.el.contains(focused))
713
197
  return;
714
- }
715
- ev.preventDefault();
716
- this.code = action.value;
717
- this.value = action.value;
718
- this.qInput.emit(this.code);
719
- requestAnimationFrame(() => {
720
- textarea.selectionStart = textarea.selectionEnd = action.caret;
721
- });
722
- };
723
- handleFormat = () => {
724
- if (this.isDisabled || !isFormatSupported(this.language))
198
+ const view = this.views.find(candidate => candidate.element === this.selected);
199
+ if (!view)
725
200
  return;
726
- if (this.code) {
727
- const result = formatSource(this.code, this.language);
728
- this.code = result.code;
729
- this.value = result.code;
730
- this.formatMessage = result.status === 'invalid' ? 'Invalid JSON; source unchanged.'
731
- : result.status === 'unsupported' ? 'JSON formatting limit reached; source unchanged.' : undefined;
732
- this.qInput.emit(result.code);
733
- this.qChange.emit(result.code);
734
- }
735
- };
736
- getCopyTooltipContent() {
737
- if (this.copyFailed)
738
- return 'Copy failed';
739
- if (this.copied)
740
- return 'Copied!';
741
- return 'Copy';
201
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
202
+ (tab ?? this.panel(view))?.focus({ preventScroll: true });
742
203
  }
743
- // ===================== [6] RENDER (Visual Template Only) =====================
744
204
  render() {
745
- const resolvedHeight = this.height !== undefined ? this.height : this.variant === 'panel' ? '110px' : 'auto';
746
- const isScrollable = resolvedHeight !== 'auto' && resolvedHeight !== '';
747
- const formatSupported = isFormatSupported(this.language);
748
- const formatFeedback = this.editable ? formatSupported ? this.formatMessage : 'Formatting is available for JSON only.' : undefined;
749
- const highlighted = tokenizeSyntax(this.code ?? '', this.language).map(token => token.className ? index.h("span", { class: token.className }, token.text) : token.text);
750
- const content = this.editable || this.code !== undefined ? (this.editable ? (index.h("div", { class: "editor-area", style: { height: resolvedHeight } }, index.h("span", { id: "syntax-box-keyboard-help", class: "visually-hidden" }, "Press Escape to leave the code editor. Press Tab to insert two spaces."), index.h("textarea", { class: "editor-textarea", value: this.code ?? '', name: this.name, disabled: this.isDisabled, required: this.required, "aria-label": this.ariaLabel?.trim() || this.heading?.trim() || `${this.language.toUpperCase()} code editor`, "aria-describedby": "syntax-box-keyboard-help", onInput: this.handleInput, onChange: this.handleChange, onScroll: this.handleScroll, onKeyDown: this.handleKeyDown }), index.h("pre", { class: "code-body", ref: el => (this.preEl = el) }, index.h("code", null, highlighted)))) : (index.h("pre", { class: "code-body" }, index.h("code", null, highlighted)))) : (index.h("slot", null));
751
- const bodyContent = isScrollable && !this.editable ? (index.h("q-scrollable", { height: resolvedHeight, ref: el => (this.scrollableEl = el) }, content)) : (content);
752
- if (this.variant === 'panel') {
753
- return (index.h(index.Host, { class: { 'q-syntax-box-panel': true } }, index.h("div", { class: "panel-container" }, index.h("div", { class: "panel-header" }, index.h("span", null, this.heading), index.h("div", { class: "panel-actions" }, index.h("slot", { name: "actions" }), this.editable && (index.h("q-button", { class: "format-btn", variant: "ghost", size: "sm", onClick: this.handleFormat, disabled: this.isDisabled || !formatSupported }, index.h("q-icon", { slot: "icon-left", definition: Braces, name: "braces", size: "sm" }), index.h("q-tooltip", { slot: "icon-left", position: "bottom", content: formatSupported ? 'Format JSON' : 'Formatting is available for JSON only.' }))), this.copyable && (index.h("q-button", { variant: "ghost", size: "sm", onClick: this.copyCode, disabled: this.isDisabled }, index.h("q-icon", { slot: "icon-left", definition: this.copied ? Check : Copy, name: this.copied ? 'check' : 'copy', size: "sm" }), index.h("q-tooltip", { slot: "icon-left", position: "bottom", content: this.getCopyTooltipContent() }))))), formatFeedback && index.h("div", { class: "format-feedback", role: "status" }, formatFeedback), bodyContent)));
754
- }
755
- return (index.h(index.Host, { class: { 'q-syntax-box-plain': true } }, index.h("div", { class: "plain-container" }, bodyContent)));
205
+ const tabbed = this.views.length > 1;
206
+ const panelStyle = this.variant === 'panel';
207
+ const active = this.views.find(view => view.element === this.selected);
208
+ const title = this.heading || (active?.element !== this.el ? active?.element.getAttribute('heading') : '');
209
+ return (index.h(index.Host, { key: 'd80b3540ede49d88b0a2990f30b8ceba69bac746', class: { 'q-syntax-box-panel': panelStyle, 'q-syntax-box-plain': !panelStyle } }, index.h("div", { key: '1470ea00ab877363757f55047c415394e07e6dfc', class: `syntax-layout ${panelStyle ? 'panel-container' : 'plain-container'}` }, (panelStyle || tabbed) && index.h("div", { key: "header", class: "panel-header" }, tabbed
210
+ ? index.h("q-tabs", { size: "sm", items: this.views.map(view => view.tab), value: active?.tab.value, ariaLabel: this.heading || 'Syntax views', onQChange: this.onTabChange, ref: el => { this.tabSelector = el; } })
211
+ : index.h("span", null, index.h("slot", { name: "heading" }, title))), this.views.map(view => index.h("div", { key: view.tab.value, class: "view-panel", id: view.tab.panelId, "data-inactive": this.visible(view.element) ? undefined : '', role: tabbed ? 'tabpanel' : undefined, "aria-hidden": this.visible(view.element) ? undefined : 'true', "aria-label": tabbed ? view.tab.label : undefined, tabindex: tabbed && this.visible(view.element) ? 0 : -1 }, view.element === this.el
212
+ ? [panelStyle && this.renderActions(), this.renderContent(this.variant)]
213
+ : index.h("slot", { name: view.tab.value }))))));
756
214
  }
757
215
  static get delegatesFocus() { return true; }
758
216
  static get formAssociated() { return true; }
@@ -763,6 +221,9 @@ const QSyntaxBox = class {
763
221
  "value": [{
764
222
  "watchValue": 0
765
223
  }],
224
+ "language": [{
225
+ "watchLanguage": 0
226
+ }],
766
227
  "disabled": [{
767
228
  "watchConstraints": 0
768
229
  }],