@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,472 +1,15 @@
1
- import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-B5ElFlHv.js';
2
- import { i as isFieldDisabled, s as syncFieldHost } from './form-field-state-DstNl_WY.js';
3
- import { r as registerFormField } from './form-field-adapter-CGml_DQ8.js';
4
- import { s as syncNativeControlValidity } from './form-control-validity-Bj2RJb2E.js';
1
+ import { M as Mixin, r as registerInstance, c as createEvent, a as getElement, f as forceUpdate, h, H as Host } from './index-CIMzZPQO.js';
2
+ import { w as withSyntaxContent, s as syntaxBoxes, a as syntaxScrollRestorers, h as hasSlottedSource, b as syntaxVisibility } from './syntax-content-Cr9kSbmA.js';
3
+ import './form-field-adapter-CGml_DQ8.js';
4
+ import './form-field-state-DstNl_WY.js';
5
+ import './form-control-validity-BxxU73QQ.js';
5
6
 
6
- /**
7
- * @license @lucide/icons v1.54.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
7
+ 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}`;
12
8
 
13
- const Braces = {
14
- name: "braces",
15
- size: 24,
16
- node: [
17
- [
18
- "path",
19
- { 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" }
20
- ],
21
- [
22
- "path",
23
- {
24
- 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",
25
- key: "e1hn23"
26
- }
27
- ]
28
- ],
29
- aliases: ["curly-braces"]
30
- };
31
-
32
- /**
33
- * @license @lucide/icons v1.54.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */
38
-
39
- const Check = {
40
- name: "check",
41
- size: 24,
42
- node: [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]
43
- };
44
-
45
- /**
46
- * @license @lucide/icons v1.54.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- */
51
-
52
- const Copy = {
53
- name: "copy",
54
- size: 24,
55
- node: [
56
- ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
57
- ["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" }]
58
- ]
59
- };
60
-
61
- const MAX_JSON_FORMAT_INPUT = 1_048_576;
62
- const MAX_JSON_FORMAT_OUTPUT = 2_097_152;
63
- const MAX_JSON_FORMAT_DEPTH = 128;
64
- class FormatLimitError extends Error {
65
- }
66
- function isFormatSupported(language) {
67
- return typeof language === 'string' && language.toLowerCase() === 'json';
68
- }
69
- /** Validates JSON grammar while emitting original tokens, never JavaScript values. */
70
- function layoutJson(source) {
71
- if (source.length > MAX_JSON_FORMAT_INPUT) {
72
- throw new FormatLimitError();
73
- }
74
- let index = 0;
75
- let outputLength = 0;
76
- const parts = [];
77
- const emit = (text) => {
78
- outputLength += text.length;
79
- if (outputLength > MAX_JSON_FORMAT_OUTPUT) {
80
- throw new FormatLimitError();
81
- }
82
- parts.push(text);
83
- };
84
- const whitespace = () => {
85
- while (/[\x20\t\r\n]/.test(source.charAt(index)) && index < source.length) {
86
- index++;
87
- }
88
- };
89
- const requireCharacter = (character) => {
90
- if (source[index++] !== character) {
91
- throw new SyntaxError('Invalid JSON.');
92
- }
93
- whitespace();
94
- };
95
- const stringToken = () => {
96
- const start = index;
97
- if (source[index++] !== '"') {
98
- throw new SyntaxError('Invalid JSON string.');
99
- }
100
- while (index < source.length) {
101
- const character = source[index++];
102
- if (character === '"') {
103
- return source.slice(start, index);
104
- }
105
- if (character.charCodeAt(0) < 0x20) {
106
- throw new SyntaxError('Invalid JSON string.');
107
- }
108
- if (character === '\\') {
109
- const escaped = source[index++];
110
- if (escaped === 'u') {
111
- if (!/^[\da-fA-F]{4}$/.test(source.slice(index, index + 4))) {
112
- throw new SyntaxError('Invalid JSON escape.');
113
- }
114
- index += 4;
115
- }
116
- else if (!escaped || !'"\\/bfnrt'.includes(escaped)) {
117
- throw new SyntaxError('Invalid JSON escape.');
118
- }
119
- }
120
- }
121
- throw new SyntaxError('Unterminated JSON string.');
122
- };
123
- const newline = (depth) => emit('\n' + ' '.repeat(depth));
124
- const value = (depth) => {
125
- whitespace();
126
- const character = source[index];
127
- if (character === '{' || character === '[') {
128
- if (depth >= MAX_JSON_FORMAT_DEPTH) {
129
- throw new FormatLimitError();
130
- }
131
- const object = character === '{';
132
- const close = object ? '}' : ']';
133
- index++;
134
- emit(character);
135
- whitespace();
136
- if (source[index] === close) {
137
- index++;
138
- emit(close);
139
- return;
140
- }
141
- newline(depth + 1);
142
- while (true) {
143
- if (object) {
144
- emit(stringToken());
145
- whitespace();
146
- requireCharacter(':');
147
- emit(': ');
148
- }
149
- value(depth + 1);
150
- whitespace();
151
- if (source[index] === close) {
152
- index++;
153
- newline(depth);
154
- emit(close);
155
- return;
156
- }
157
- requireCharacter(',');
158
- emit(',');
159
- newline(depth + 1);
160
- }
161
- }
162
- if (character === '"') {
163
- emit(stringToken());
164
- return;
165
- }
166
- for (const literal of ['true', 'false', 'null']) {
167
- if (source.startsWith(literal, index)) {
168
- index += literal.length;
169
- emit(literal);
170
- return;
171
- }
172
- }
173
- const start = index;
174
- while (index < source.length && /[\d.eE+-]/.test(source[index])) {
175
- index++;
176
- }
177
- const token = source.slice(start, index);
178
- if (!/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(token)) {
179
- throw new SyntaxError('Invalid JSON value.');
180
- }
181
- emit(token);
182
- };
183
- value(0);
184
- whitespace();
185
- if (index !== source.length) {
186
- throw new SyntaxError('Trailing JSON content.');
187
- }
188
- return parts.join('');
189
- }
190
- function formatSource(code, language) {
191
- if (!isFormatSupported(language)) {
192
- return { code, status: 'unsupported' };
193
- }
194
- try {
195
- const formatted = layoutJson(code);
196
- return { code: formatted, status: formatted === code ? 'unchanged' : 'formatted' };
197
- }
198
- catch (error) {
199
- return { code, status: error instanceof FormatLimitError ? 'unsupported' : 'invalid' };
200
- }
201
- }
202
-
203
- /** Each token and gap is an unchanged slice of the source; generated markup is never scanned. */
204
- function scan(text, pattern, classify) {
205
- const tokens = [];
206
- let offset = 0;
207
- let match;
208
- while ((match = pattern.exec(text)) !== null) {
209
- if (offset < match.index)
210
- tokens.push({ text: text.slice(offset, match.index) });
211
- tokens.push({ text: match[0], className: classify(match) });
212
- offset = match.index + match[0].length;
213
- }
214
- if (offset < text.length)
215
- tokens.push({ text: text.slice(offset) });
216
- return tokens;
217
- }
218
- /** Keep unhighlighted runs together so long edits do not create a text node per character. */
219
- function tokenWriter(text) {
220
- const tokens = [];
221
- let plainStart = 0;
222
- return {
223
- emit(start, end, className) {
224
- if (plainStart < start)
225
- tokens.push({ text: text.slice(plainStart, start) });
226
- tokens.push({ text: text.slice(start, end), className });
227
- plainStart = end;
228
- },
229
- finish() {
230
- if (plainStart < text.length)
231
- tokens.push({ text: text.slice(plainStart) });
232
- return tokens;
233
- },
234
- };
235
- }
236
- function isLetter(char) {
237
- return char >= 'a' && char <= 'z' || char >= 'A' && char <= 'Z';
238
- }
239
- function isDigit(char) {
240
- return char >= '0' && char <= '9';
241
- }
242
- function isWord(char) {
243
- return isLetter(char) || isDigit(char) || char === '_';
244
- }
245
- function skipWhitespace(text, offset) {
246
- while (offset < text.length && /\s/.test(text[offset]))
247
- offset++;
248
- return offset;
249
- }
250
- function quotedEnd(text, start, escaped) {
251
- const quote = text[start];
252
- let offset = start + 1;
253
- while (offset < text.length) {
254
- if (escaped && text[offset] === '\\')
255
- offset = Math.min(text.length, offset + 2);
256
- else if (text[offset++] === quote)
257
- break;
258
- }
259
- return offset;
260
- }
261
- /** Consume each name once instead of retrying an attribute lookahead at every suffix. */
262
- function tokenizeHtml(text) {
263
- const writer = tokenWriter(text);
264
- let offset = 0;
265
- while (offset < text.length) {
266
- const start = offset;
267
- const char = text[offset];
268
- if (text.startsWith('<!--', offset)) {
269
- const end = text.indexOf('-->', offset + 4);
270
- offset = end === -1 ? text.length : end + 3;
271
- writer.emit(start, offset, 'code-comment');
272
- }
273
- else if (char === '<' && isLetter(text[offset + (text[offset + 1] === '/' ? 2 : 1)])) {
274
- offset += text[offset + 1] === '/' ? 3 : 2;
275
- while (offset < text.length && (isWord(text[offset]) || text[offset] === ':' || text[offset] === '-'))
276
- offset++;
277
- writer.emit(start, offset, 'code-tag');
278
- }
279
- else if (char === '"' || char === "'") {
280
- // HTML uses entities for embedded quotes; a backslash does not escape its delimiter.
281
- offset = quotedEnd(text, start, false);
282
- writer.emit(start, offset, 'code-value');
283
- }
284
- else if (char === '>' || char === '/' && text[offset + 1] === '>') {
285
- offset += char === '/' ? 2 : 1;
286
- writer.emit(start, offset, 'code-tag');
287
- }
288
- else if (isWord(char) || char === ':' || char === '-') {
289
- offset++;
290
- while (offset < text.length && (isWord(text[offset]) || text[offset] === ':' || text[offset] === '-'))
291
- offset++;
292
- if (text[skipWhitespace(text, offset)] === '=')
293
- writer.emit(start, offset, 'code-attr');
294
- }
295
- else
296
- offset++;
297
- }
298
- return writer.finish();
299
- }
300
- const JAVASCRIPT_KEYWORDS = new Set([
301
- 'const', 'let', 'var', 'function', 'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case',
302
- 'break', 'continue', 'class', 'export', 'import', 'from', 'new', 'this', 'typeof', 'instanceof',
303
- 'try', 'catch', 'finally', 'throw', 'async', 'await', 'null', 'undefined', 'true', 'false',
304
- ]);
305
- /** Consume strings/comments before identifiers so their contents are never scanned as code. */
306
- function tokenizeJavascript(text) {
307
- const writer = tokenWriter(text);
308
- let offset = 0;
309
- while (offset < text.length) {
310
- const start = offset;
311
- const char = text[offset];
312
- if (char === '/' && text[offset + 1] === '/') {
313
- offset += 2;
314
- while (offset < text.length && !/[\r\n\u2028\u2029]/.test(text[offset]))
315
- offset++;
316
- writer.emit(start, offset, 'code-comment');
317
- }
318
- else if (char === '/' && text[offset + 1] === '*') {
319
- const end = text.indexOf('*/', offset + 2);
320
- offset = end === -1 ? text.length : end + 2;
321
- writer.emit(start, offset, 'code-comment');
322
- }
323
- else if (char === '"' || char === "'" || char === '`') {
324
- offset = quotedEnd(text, start, true);
325
- writer.emit(start, offset, 'code-value');
326
- }
327
- else if (isLetter(char) || char === '_' || char === '$') {
328
- offset++;
329
- while (offset < text.length && (isWord(text[offset]) || text[offset] === '$'))
330
- offset++;
331
- if (JAVASCRIPT_KEYWORDS.has(text.slice(start, offset)))
332
- writer.emit(start, offset, 'code-tag');
333
- else if (text[skipWhitespace(text, offset)] === '(')
334
- writer.emit(start, offset, 'code-attr');
335
- }
336
- else if (isDigit(char)) {
337
- while (offset < text.length && isDigit(text[offset]))
338
- offset++;
339
- if (text[offset] === '.' && isDigit(text[offset + 1])) {
340
- offset++;
341
- while (offset < text.length && isDigit(text[offset]))
342
- offset++;
343
- }
344
- if (isWord(text[offset]) || text[offset] === '$') {
345
- // An unfinished number/identifier is one plain run, not a highlighted suffix.
346
- while (offset < text.length && (isWord(text[offset]) || text[offset] === '$'))
347
- offset++;
348
- }
349
- else
350
- writer.emit(start, offset, 'code-number');
351
- }
352
- else
353
- offset++;
354
- }
355
- return writer.finish();
356
- }
357
- /** Consume CSS once, including incomplete edits; never retry a selector suffix. */
358
- function tokenizeCss(text) {
359
- const tokens = [];
360
- let mode = 'selector';
361
- let depth = 0;
362
- let offset = 0;
363
- const emit = (start, end, className) => {
364
- if (end > start)
365
- tokens.push({ text: text.slice(start, end), className });
366
- };
367
- while (offset < text.length) {
368
- const start = offset;
369
- const char = text[offset];
370
- if (char === '/' && text[offset + 1] === '*') {
371
- const end = text.indexOf('*/', offset + 2);
372
- offset = end === -1 ? text.length : end + 2;
373
- emit(start, offset, 'code-comment');
374
- }
375
- else if (char === '"' || char === "'") {
376
- offset++;
377
- while (offset < text.length) {
378
- if (text[offset] === '\\')
379
- offset = Math.min(text.length, offset + 2);
380
- else if (text[offset++] === char)
381
- break;
382
- }
383
- emit(start, offset, 'code-value');
384
- }
385
- else if (char === '{' || char === '}' || char === ';' || (char === ':' && mode === 'property')) {
386
- offset++;
387
- emit(start, offset);
388
- if (char === '{') {
389
- depth++;
390
- mode = 'property';
391
- }
392
- else if (char === '}') {
393
- depth = Math.max(0, depth - 1);
394
- mode = depth ? 'property' : 'selector';
395
- }
396
- else if (char === ';')
397
- mode = depth ? 'property' : 'selector';
398
- else
399
- mode = 'value';
400
- }
401
- else {
402
- // Each character belongs to exactly one run or lexical token.
403
- while (offset < text.length) {
404
- const next = text[offset];
405
- if (next === '"' || next === "'" || next === '{' || next === '}' || next === ';' ||
406
- (next === ':' && mode === 'property') || (next === '/' && text[offset + 1] === '*'))
407
- break;
408
- offset++;
409
- }
410
- emit(start, offset, mode === 'selector' ? 'code-tag' : mode === 'property' ? 'code-attr' : 'code-value');
411
- }
412
- }
413
- return tokens;
414
- }
415
- function tokenizeSyntax(text, language) {
416
- switch (language) {
417
- case 'html':
418
- return tokenizeHtml(text);
419
- case 'javascript':
420
- return tokenizeJavascript(text);
421
- case 'css':
422
- return tokenizeCss(text);
423
- case 'json':
424
- 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');
425
- default:
426
- return text ? [{ text }] : [];
427
- }
428
- }
429
-
430
- function getSyntaxBoxCopyText(code, fallbackText) {
431
- return code !== undefined ? code : fallbackText || '';
432
- }
433
- async function writeClipboardText(text) {
434
- if (!navigator.clipboard || typeof navigator.clipboard.writeText !== 'function') {
435
- throw new Error('Clipboard API unavailable');
436
- }
437
- await navigator.clipboard.writeText(text);
438
- }
439
-
440
- function getSyntaxBoxEditorKeyAction(event, value, start, end) {
441
- if (event.key === 'Escape') {
442
- return { type: 'blur' };
443
- }
444
- if (event.key !== 'Tab' || event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) {
445
- return { type: 'none' };
446
- }
447
- const spaces = ' ';
448
- return {
449
- type: 'indent',
450
- value: value.substring(0, start) + spaces + value.substring(end),
451
- caret: start + spaces.length,
452
- };
453
- }
454
-
455
- /** Missing editable content is empty; supplied source is never reformatted. */
456
- function normalizeSyntaxBoxValue(value, options) {
457
- return options.editable ? value ?? '' : value;
458
- }
459
- function resolveInitialSyntaxBoxValue(options) {
460
- const code = normalizeSyntaxBoxValue(options.code ?? options.value, options);
461
- // Preserve the existing read-only behavior when both aliases were supplied differently.
462
- const value = options.editable ? code : options.value ?? code;
463
- return { code, value, initialValue: code ?? '' };
464
- }
465
-
466
- 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}`;
467
-
468
- const QSyntaxBox = class {
9
+ let nextBox = 0;
10
+ const QSyntaxBox = class extends Mixin(withSyntaxContent) {
469
11
  constructor(hostRef) {
12
+ super();
470
13
  registerInstance(this, hostRef);
471
14
  this.qChange = createEvent(this, "qChange");
472
15
  this.qInput = createEvent(this, "qInput");
@@ -480,277 +23,192 @@ const QSyntaxBox = class {
480
23
  }
481
24
  get el() { return getElement(this); }
482
25
  internals;
483
- /** Mirrored with `value`; prefer `code` for domain usage. */
484
- code;
485
- /** Form-value alias mirrored with `code` for compatibility. */
486
- value;
487
- /** Shown only in the panel variant. */
488
- heading;
489
- /** Accessible name for the editor; falls back to `heading`, then the language. */
490
- ariaLabel = null;
491
- variant = 'panel';
492
- /** Explicit content height. Panel mode defaults to 110px; plain mode defaults to auto. */
493
- height;
494
- copyable = false;
495
- editable = false;
496
- /** Form field name used when the component is editable. */
497
- name;
498
- /** Marks the editable textarea as required for form validation. */
499
- required = false;
500
- language = 'html';
501
- /** Disables editing and panel actions. */
502
- disabled = false;
503
- /** Emitted when editable content is committed by the native change event or by formatting. */
504
- qChange;
505
- /** Emitted on each editable content input and after formatting. */
506
- qInput;
507
- // ======================== [2] INTERNAL STATE & REFS ========================
508
- disabledState = false;
509
- get isDisabled() {
510
- return isFieldDisabled(this.el, this.disabled);
511
- }
512
- copied = false;
513
- copyFailed = false;
514
- formatMessage;
515
- initialValue = '';
516
- copiedTimeoutId;
517
- scrollableEl;
518
- preEl;
519
- // ========================= [3] LIFECYCLE & WATCHERS =========================
520
- watchCode(newCode) {
521
- this.formatMessage = undefined;
522
- const finalCode = normalizeSyntaxBoxValue(newCode, {
523
- editable: this.editable,
26
+ instanceId = `q-syntax-box-${++nextBox}`;
27
+ identities = new WeakMap();
28
+ nextView = 0;
29
+ views = [];
30
+ selected;
31
+ observer;
32
+ tabSelector;
33
+ focusWithin = false;
34
+ restoreFocus = false;
35
+ activeVariant;
36
+ linkFrame;
37
+ connectedCallback() {
38
+ syntaxBoxes.set(this.el, this);
39
+ this.el.addEventListener('focusin', this.onFocusIn);
40
+ this.el.addEventListener('focusout', this.onFocusOut);
41
+ this.observer = new MutationObserver(changes => {
42
+ const changed = changes.some(change => change.target === this.el || change.target.parentNode === this.el &&
43
+ (change.type === 'characterData' || change.type === 'attributes'));
44
+ if (changed && this.collectViews())
45
+ forceUpdate(this.el);
524
46
  });
525
- if (finalCode !== newCode) {
526
- this.code = finalCode;
527
- }
528
- if (this.value !== finalCode) {
529
- this.value = finalCode;
530
- }
531
- this.syncFormValue(finalCode);
532
- }
533
- watchValue(newValue) {
534
- this.formatMessage = undefined;
535
- const finalVal = normalizeSyntaxBoxValue(newValue, {
536
- editable: this.editable,
47
+ this.observer.observe(this.el, {
48
+ childList: true, subtree: true, characterData: true, attributes: true,
49
+ attributeFilter: ['heading', 'view-key', 'slot'],
537
50
  });
538
- if (finalVal !== newValue) {
539
- this.value = finalVal;
540
- }
541
- if (this.code !== finalVal) {
542
- this.code = finalVal;
543
- }
544
- this.syncFormValue(finalVal);
545
51
  }
546
- watchConstraints() {
547
- this.syncValidity();
548
- }
549
- watchEditable() {
550
- if (this.editable)
551
- this.watchCode(this.code);
552
- this.syncFormValue(this.code);
553
- }
554
- componentWillLoad() {
555
- const initial = resolveInitialSyntaxBoxValue({
556
- code: this.code,
557
- value: this.value,
558
- editable: this.editable,
559
- });
560
- this.code = initial.code;
561
- this.value = initial.value;
562
- this.initialValue = initial.initialValue;
563
- this.syncFormValue(this.code);
564
- }
565
- formDisabledCallback() {
566
- this.syncValidity();
567
- }
568
- componentDidLoad() {
569
- registerFormField(this.el, {
570
- kind: 'text',
571
- owner: () => this.internals?.form ?? null,
572
- active: () => this.editable,
573
- value: () => this.code ?? '',
574
- assign: value => { this.value = value; },
575
- reconcile: () => {
576
- const textarea = this.el.shadowRoot?.querySelector('textarea');
577
- if (textarea && textarea.value !== (this.code ?? ''))
578
- textarea.value = this.code ?? '';
579
- this.syncFormValue(this.code);
580
- this.syncValidity();
581
- },
582
- reset: () => this.formResetCallback(),
583
- validate: report => report ? this.internals?.reportValidity?.() ?? true : this.internals?.checkValidity?.() ?? true,
584
- });
52
+ componentWillRender() {
53
+ this.collectViews();
585
54
  }
586
55
  componentDidRender() {
587
- this.syncValidity();
56
+ super.componentDidRender();
57
+ if (this.activeVariant !== this.variant) {
58
+ this.activeVariant = this.variant;
59
+ for (const view of this.views)
60
+ if (view.element !== this.el)
61
+ forceUpdate(view.element);
62
+ }
63
+ this.syncPanels();
64
+ if (this.linkFrame !== undefined)
65
+ cancelAnimationFrame(this.linkFrame);
66
+ this.linkFrame = requestAnimationFrame(() => {
67
+ this.linkFrame = undefined;
68
+ this.linkTabs();
69
+ if (this.selected)
70
+ syntaxScrollRestorers.get(this.selected)?.();
71
+ this.recoverFocus();
72
+ });
588
73
  }
589
74
  disconnectedCallback() {
590
- this.clearCopiedTimeout();
591
- }
592
- formResetCallback() {
593
- this.code = this.initialValue;
594
- this.value = this.initialValue;
595
- this.syncFormValue(this.code);
596
- this.syncValidity();
597
- }
598
- // ========================== [4] EXPOSED METHODS ==========================
599
- /** Programmatically scrolls the read-only code body to the bottom when it is wrapped by q-scrollable. */
600
- async scrollToBottom() {
601
- await this.scrollableEl?.scrollToBottom();
602
- }
603
- /** Returns whether editable content satisfies native constraints. */
604
- async checkValidity() {
605
- this.syncValidity();
606
- if (typeof this.internals.checkValidity === 'function') {
607
- return this.internals.checkValidity();
608
- }
609
- return this.el.shadowRoot?.querySelector('textarea')?.checkValidity?.() ?? true;
610
- }
611
- /** Reports editable constraint violations and returns whether the control is valid. */
612
- async reportValidity() {
613
- this.syncValidity();
614
- if (typeof this.internals.reportValidity === 'function') {
615
- return this.internals.reportValidity();
616
- }
617
- return this.el.shadowRoot?.querySelector('textarea')?.reportValidity?.() ?? true;
618
- }
619
- // =================== [5] EVENT HANDLERS & INTERNAL METHODS ===================
620
- syncFormValue(value) {
621
- if (!this.internals || typeof this.internals.setFormValue !== 'function')
75
+ super.disconnectedCallback();
76
+ this.observer?.disconnect();
77
+ this.el.removeEventListener('focusin', this.onFocusIn);
78
+ this.el.removeEventListener('focusout', this.onFocusOut);
79
+ if (this.linkFrame !== undefined)
80
+ cancelAnimationFrame(this.linkFrame);
81
+ }
82
+ visible(view) {
83
+ return !this.selected || view === this.selected;
84
+ }
85
+ select(view) {
86
+ if (!this.views.some(candidate => candidate.element === view) || this.selected === view)
622
87
  return;
623
- this.internals.setFormValue(this.editable ? value || '' : null);
624
- this.syncValidity();
625
- }
626
- syncValidity() {
627
- const disabled = syncFieldHost(this.el, this.disabled, this.name, this.required);
628
- if (this.disabledState !== disabled)
629
- this.disabledState = disabled;
630
- const textarea = this.el.shadowRoot?.querySelector('textarea');
631
- if (textarea) {
632
- textarea.disabled = disabled;
633
- textarea.required = this.required;
634
- textarea.readOnly = this.el.hasAttribute('readonly');
635
- if (textarea.value !== (this.code ?? ''))
636
- textarea.value = this.code ?? '';
637
- }
638
- this.internals?.setFormValue?.(this.editable && !disabled ? this.code ?? '' : null);
639
- if (!this.internals || !textarea || !this.editable) {
640
- if (typeof this.internals?.setValidity === 'function') {
641
- this.internals.setValidity({});
88
+ this.selected = view;
89
+ this.syncPanels();
90
+ forceUpdate(this.el);
91
+ }
92
+ onFocusIn = () => { this.focusWithin = true; };
93
+ onFocusOut = (event) => {
94
+ if (event.relatedTarget instanceof Node && !this.el.contains(event.relatedTarget))
95
+ this.focusWithin = false;
96
+ };
97
+ collectViews() {
98
+ const children = Array.from(this.el.children).filter((child) => child.localName === 'q-syntax-view');
99
+ const hostHasContent = this.code !== undefined || this.value !== undefined || this.editable || hasSlottedSource(this.el);
100
+ const elements = hostHasContent || !children.length ? [this.el, ...children] : children;
101
+ const views = elements.map((element, index) => this.describeView(element, index));
102
+ const previous = this.views;
103
+ 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);
104
+ if (!changed)
105
+ return false;
106
+ if (!views.some(view => view.element === this.selected)) {
107
+ this.restoreFocus = this.selected !== undefined && this.focusWithin;
108
+ this.selected = this.replacementView(views).element;
109
+ }
110
+ if (previous.length > 1 && views.length === 1 && this.el.shadowRoot?.activeElement === this.tabSelector)
111
+ this.restoreFocus = true;
112
+ for (const old of previous) {
113
+ if (!elements.includes(old.element) && old.element.slot === old.tab.value) {
114
+ old.element.removeAttribute('slot');
115
+ forceUpdate(old.element);
642
116
  }
643
- return;
644
117
  }
645
- syncNativeControlValidity({
646
- internals: this.internals,
647
- control: textarea,
648
- disabled: this.isDisabled,
649
- });
650
- }
651
- clearCopiedTimeout() {
652
- if (this.copiedTimeoutId !== undefined) {
653
- clearTimeout(this.copiedTimeoutId);
654
- this.copiedTimeoutId = undefined;
118
+ this.views = views;
119
+ return true;
120
+ }
121
+ describeView(element, index) {
122
+ let id = this.identities.get(element);
123
+ if (!id) {
124
+ id = `${this.instanceId}-view-${++this.nextView}`;
125
+ this.identities.set(element, id);
126
+ }
127
+ const child = element !== this.el;
128
+ if (child && element.slot !== id) {
129
+ element.slot = id;
130
+ if (element.shadowRoot?.childElementCount)
131
+ forceUpdate(element);
132
+ }
133
+ const label = (child ? element.getAttribute('heading') : this.heading)?.trim() || `View ${index + 1}`;
134
+ return {
135
+ element,
136
+ key: child ? element.getAttribute('view-key')?.trim() : undefined,
137
+ tab: { label, value: id, tabId: id + '-tab', panelId: id + '-panel' },
138
+ };
139
+ }
140
+ replacementView(views) {
141
+ const index = this.views.findIndex(view => view.element === this.selected);
142
+ if (index < 0)
143
+ return views[0];
144
+ const key = this.views[index].key;
145
+ if (key && this.views.filter(view => view.key === key).length === 1) {
146
+ const replacements = views.filter(view => view.key === key);
147
+ if (replacements.length === 1)
148
+ return replacements[0];
149
+ }
150
+ const neighbors = [...this.views.slice(index + 1), ...this.views.slice(0, index).reverse()];
151
+ return neighbors.find(old => views.some(view => view.element === old.element)) ?? views[0];
152
+ }
153
+ onTabChange = (event) => {
154
+ event.stopPropagation();
155
+ const view = this.views.find(candidate => candidate.tab.value === event.detail);
156
+ if (view)
157
+ this.select(view.element);
158
+ };
159
+ panel(view) {
160
+ return this.el.shadowRoot?.getElementById(view.tab.panelId);
161
+ }
162
+ syncPanels() {
163
+ for (const view of this.views) {
164
+ const panel = this.panel(view);
165
+ if (!panel)
166
+ continue;
167
+ const inactive = !this.visible(view.element);
168
+ panel.toggleAttribute('data-inactive', inactive);
169
+ if (inactive)
170
+ panel.setAttribute('aria-hidden', 'true');
171
+ else
172
+ panel.removeAttribute('aria-hidden');
173
+ panel.tabIndex = !inactive && this.views.length > 1 ? 0 : -1;
174
+ syntaxVisibility.get(view.element)?.();
655
175
  }
656
176
  }
657
- scheduleCopyStateReset() {
658
- this.clearCopiedTimeout();
659
- this.copiedTimeoutId = setTimeout(() => {
660
- this.copied = false;
661
- this.copyFailed = false;
662
- this.copiedTimeoutId = undefined;
663
- }, 1500);
664
- }
665
- copyCode = async () => {
666
- if (this.isDisabled)
667
- return;
668
- const codeToCopy = getSyntaxBoxCopyText(this.code, this.el.textContent);
669
- try {
670
- await writeClipboardText(codeToCopy);
671
- if (!this.el.isConnected)
672
- return;
673
- this.copied = true;
674
- this.copyFailed = false;
177
+ linkTabs() {
178
+ for (const view of this.views) {
179
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
180
+ const panel = this.panel(view);
181
+ if (!tab || !panel)
182
+ continue;
183
+ if ('ariaControlsElements' in tab)
184
+ tab.ariaControlsElements = [panel];
185
+ if ('ariaLabelledByElements' in panel)
186
+ panel.ariaLabelledByElements = [tab];
675
187
  }
676
- catch {
677
- if (!this.el.isConnected)
678
- return;
679
- this.copied = false;
680
- this.copyFailed = true;
681
- }
682
- this.scheduleCopyStateReset();
683
- };
684
- handleScroll = (e) => {
685
- const textarea = e.target;
686
- if (this.preEl) {
687
- this.preEl.scrollLeft = textarea.scrollLeft;
688
- this.preEl.scrollTop = textarea.scrollTop;
689
- }
690
- };
691
- handleInput = (ev) => {
692
- const target = ev.target;
693
- this.code = target.value;
694
- this.value = target.value;
695
- this.qInput.emit(this.code);
696
- };
697
- handleChange = (ev) => {
698
- const target = ev.target;
699
- this.code = target.value;
700
- this.value = target.value;
701
- this.qChange.emit(this.code);
702
- };
703
- handleKeyDown = (ev) => {
704
- const textarea = ev.target;
705
- const action = getSyntaxBoxEditorKeyAction(ev, textarea.value, textarea.selectionStart, textarea.selectionEnd);
706
- if (action.type === 'none') {
188
+ }
189
+ recoverFocus() {
190
+ if (!this.restoreFocus)
707
191
  return;
708
- }
709
- if (action.type === 'blur') {
710
- textarea.blur();
192
+ this.restoreFocus = false;
193
+ const focused = this.el.ownerDocument.activeElement;
194
+ if (focused && focused !== this.el.ownerDocument.body && focused !== this.el && !this.el.contains(focused))
711
195
  return;
712
- }
713
- ev.preventDefault();
714
- this.code = action.value;
715
- this.value = action.value;
716
- this.qInput.emit(this.code);
717
- requestAnimationFrame(() => {
718
- textarea.selectionStart = textarea.selectionEnd = action.caret;
719
- });
720
- };
721
- handleFormat = () => {
722
- if (this.isDisabled || !isFormatSupported(this.language))
196
+ const view = this.views.find(candidate => candidate.element === this.selected);
197
+ if (!view)
723
198
  return;
724
- if (this.code) {
725
- const result = formatSource(this.code, this.language);
726
- this.code = result.code;
727
- this.value = result.code;
728
- this.formatMessage = result.status === 'invalid' ? 'Invalid JSON; source unchanged.'
729
- : result.status === 'unsupported' ? 'JSON formatting limit reached; source unchanged.' : undefined;
730
- this.qInput.emit(result.code);
731
- this.qChange.emit(result.code);
732
- }
733
- };
734
- getCopyTooltipContent() {
735
- if (this.copyFailed)
736
- return 'Copy failed';
737
- if (this.copied)
738
- return 'Copied!';
739
- return 'Copy';
199
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
200
+ (tab ?? this.panel(view))?.focus({ preventScroll: true });
740
201
  }
741
- // ===================== [6] RENDER (Visual Template Only) =====================
742
202
  render() {
743
- const resolvedHeight = this.height !== undefined ? this.height : this.variant === 'panel' ? '110px' : 'auto';
744
- const isScrollable = resolvedHeight !== 'auto' && resolvedHeight !== '';
745
- const formatSupported = isFormatSupported(this.language);
746
- const formatFeedback = this.editable ? formatSupported ? this.formatMessage : 'Formatting is available for JSON only.' : undefined;
747
- const highlighted = tokenizeSyntax(this.code ?? '', this.language).map(token => token.className ? h("span", { class: token.className }, token.text) : token.text);
748
- const content = this.editable || this.code !== undefined ? (this.editable ? (h("div", { class: "editor-area", style: { height: resolvedHeight } }, h("span", { id: "syntax-box-keyboard-help", class: "visually-hidden" }, "Press Escape to leave the code editor. Press Tab to insert two spaces."), 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 }), h("pre", { class: "code-body", ref: el => (this.preEl = el) }, h("code", null, highlighted)))) : (h("pre", { class: "code-body" }, h("code", null, highlighted)))) : (h("slot", null));
749
- const bodyContent = isScrollable && !this.editable ? (h("q-scrollable", { height: resolvedHeight, ref: el => (this.scrollableEl = el) }, content)) : (content);
750
- if (this.variant === 'panel') {
751
- return (h(Host, { class: { 'q-syntax-box-panel': true } }, h("div", { class: "panel-container" }, h("div", { class: "panel-header" }, h("span", null, this.heading), h("div", { class: "panel-actions" }, h("slot", { name: "actions" }), this.editable && (h("q-button", { class: "format-btn", variant: "ghost", size: "sm", onClick: this.handleFormat, disabled: this.isDisabled || !formatSupported }, h("q-icon", { slot: "icon-left", definition: Braces, name: "braces", size: "sm" }), h("q-tooltip", { slot: "icon-left", position: "bottom", content: formatSupported ? 'Format JSON' : 'Formatting is available for JSON only.' }))), this.copyable && (h("q-button", { variant: "ghost", size: "sm", onClick: this.copyCode, disabled: this.isDisabled }, h("q-icon", { slot: "icon-left", definition: this.copied ? Check : Copy, name: this.copied ? 'check' : 'copy', size: "sm" }), h("q-tooltip", { slot: "icon-left", position: "bottom", content: this.getCopyTooltipContent() }))))), formatFeedback && h("div", { class: "format-feedback", role: "status" }, formatFeedback), bodyContent)));
752
- }
753
- return (h(Host, { class: { 'q-syntax-box-plain': true } }, h("div", { class: "plain-container" }, bodyContent)));
203
+ const tabbed = this.views.length > 1;
204
+ const panelStyle = this.variant === 'panel';
205
+ const active = this.views.find(view => view.element === this.selected);
206
+ const title = this.heading || (active?.element !== this.el ? active?.element.getAttribute('heading') : '');
207
+ return (h(Host, { key: 'd80b3540ede49d88b0a2990f30b8ceba69bac746', class: { 'q-syntax-box-panel': panelStyle, 'q-syntax-box-plain': !panelStyle } }, h("div", { key: '1470ea00ab877363757f55047c415394e07e6dfc', class: `syntax-layout ${panelStyle ? 'panel-container' : 'plain-container'}` }, (panelStyle || tabbed) && h("div", { key: "header", class: "panel-header" }, tabbed
208
+ ? 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; } })
209
+ : h("span", null, h("slot", { name: "heading" }, title))), this.views.map(view => 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
210
+ ? [panelStyle && this.renderActions(), this.renderContent(this.variant)]
211
+ : h("slot", { name: view.tab.value }))))));
754
212
  }
755
213
  static get delegatesFocus() { return true; }
756
214
  static get formAssociated() { return true; }
@@ -761,6 +219,9 @@ const QSyntaxBox = class {
761
219
  "value": [{
762
220
  "watchValue": 0
763
221
  }],
222
+ "language": [{
223
+ "watchLanguage": 0
224
+ }],
764
225
  "disabled": [{
765
226
  "watchConstraints": 0
766
227
  }],