@webquark/browser 1.1.0 → 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 (411) hide show
  1. package/dist/cjs/{action.props-B6vl_1p5.js → action.props-CNe2JXR5.js} +1 -1
  2. package/dist/cjs/{field-B5nxD8Kc.js → field-BRAR56Ex.js} +1 -1
  3. package/dist/cjs/{form-control-validity-D1ukC0_e.js → form-control-validity-BkilGb3E.js} +3 -3
  4. package/dist/cjs/{index-BD6Jjssb.js → index-BN-WdOQM.js} +13 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/q-accordion.cjs.entry.js +1 -1
  7. package/dist/cjs/q-alert.cjs.entry.js +2 -2
  8. package/dist/cjs/q-avatar.cjs.entry.js +2 -2
  9. package/dist/cjs/q-banner.cjs.entry.js +1 -1
  10. package/dist/cjs/q-button_3.cjs.entry.js +907 -0
  11. package/dist/cjs/q-card.cjs.entry.js +2 -2
  12. package/dist/cjs/q-carousel.cjs.entry.js +1 -1
  13. package/dist/cjs/q-chip.cjs.entry.js +2 -2
  14. package/dist/cjs/q-control-group.cjs.entry.js +3 -3
  15. package/dist/cjs/q-conversation-bubble.cjs.entry.js +1 -1
  16. package/dist/cjs/q-data-table.cjs.entry.js +1 -1
  17. package/dist/cjs/q-dialog.cjs.entry.js +3 -3
  18. package/dist/cjs/q-divider.cjs.entry.js +3 -3
  19. package/dist/cjs/q-dropdown.cjs.entry.js +4 -4
  20. package/dist/cjs/q-form.cjs.entry.js +6 -6
  21. package/dist/cjs/q-grid.cjs.entry.js +3 -3
  22. package/dist/cjs/q-icon.cjs.entry.js +1 -1
  23. package/dist/cjs/q-image-comparison.cjs.entry.js +2 -2
  24. package/dist/cjs/q-inline.cjs.entry.js +3 -3
  25. package/dist/cjs/q-input_2.cjs.entry.js +6 -6
  26. package/dist/cjs/q-link.cjs.entry.js +2 -2
  27. package/dist/cjs/q-map.cjs.entry.js +1 -1
  28. package/dist/cjs/q-media.cjs.entry.js +2 -2
  29. package/dist/cjs/q-navbar.cjs.entry.js +3 -3
  30. package/dist/cjs/q-pagination.cjs.entry.js +1 -1
  31. package/dist/cjs/q-panel.cjs.entry.js +6 -6
  32. package/dist/cjs/q-quantity-selector.cjs.entry.js +5 -5
  33. package/dist/cjs/q-radio-group.cjs.entry.js +4 -4
  34. package/dist/cjs/q-reel.cjs.entry.js +23 -23
  35. package/dist/cjs/q-section.cjs.entry.js +2 -2
  36. package/dist/cjs/q-sidepanel.cjs.entry.js +4 -3
  37. package/dist/cjs/q-slider.cjs.entry.js +2 -2
  38. package/dist/cjs/q-stack.cjs.entry.js +3 -3
  39. package/dist/cjs/q-step-diagram-item.cjs.entry.js +2 -2
  40. package/dist/cjs/q-step-diagram.cjs.entry.js +3 -3
  41. package/dist/cjs/q-syntax-box.cjs.entry.js +180 -719
  42. package/dist/cjs/q-syntax-view.cjs.entry.js +65 -0
  43. package/dist/cjs/q-tabs.cjs.entry.js +2 -2
  44. package/dist/cjs/q-textarea.cjs.entry.js +5 -5
  45. package/dist/cjs/q-thumbnail.cjs.entry.js +3 -3
  46. package/dist/cjs/q-toast.cjs.entry.js +1 -1
  47. package/dist/cjs/q-toggle.cjs.entry.js +6 -6
  48. package/dist/cjs/q-toolbar.cjs.entry.js +4 -4
  49. package/dist/cjs/syntax-content-BmSExDiW.js +910 -0
  50. package/dist/cjs/{tokens-Cd7g-VMz.js → tokens-BMrfol_M.js} +1 -1
  51. package/dist/cjs/webquark.cjs.js +2 -2
  52. package/dist/collection/collection-manifest.json +3 -1
  53. package/dist/collection/components/actions/button/button.css +27 -9
  54. package/dist/collection/components/communication/alert/alert.css +4 -1
  55. package/dist/collection/components/data-display/syntax-box/internals/formatters/css.js +4 -0
  56. package/dist/collection/components/data-display/syntax-box/internals/formatters/formatter.js +20 -0
  57. package/dist/collection/components/data-display/syntax-box/internals/{formatter.unit.test.js → formatters/formatter.unit.test.js} +38 -11
  58. package/dist/collection/components/data-display/syntax-box/internals/formatters/html.js +4 -0
  59. package/dist/collection/components/data-display/syntax-box/internals/formatters/javascript.js +4 -0
  60. package/dist/collection/components/data-display/syntax-box/internals/{formatter.js → formatters/json.js} +2 -20
  61. package/dist/collection/components/data-display/syntax-box/internals/formatters/languages.js +15 -0
  62. package/dist/collection/components/data-display/syntax-box/internals/formatters/util/prettier.js +17 -0
  63. package/dist/collection/components/data-display/syntax-box/internals/views.js +29 -0
  64. package/dist/collection/components/data-display/syntax-box/internals/views.unit.test.js +19 -0
  65. package/dist/collection/components/data-display/syntax-box/syntax-box.css +107 -36
  66. package/dist/collection/components/data-display/syntax-box/syntax-box.js +179 -637
  67. package/dist/collection/components/data-display/syntax-box/syntax-content.js +748 -0
  68. package/dist/collection/components/data-display/syntax-box/syntax-ui.js +8 -0
  69. package/dist/collection/components/data-display/syntax-box/test/format-fixtures.js +2 -2
  70. package/dist/collection/components/data-display/syntax-box/test/syntax-format.cmp.test.js +20 -20
  71. package/dist/collection/components/data-display/syntax-box/test/syntax-views.cmp.test.js +228 -0
  72. package/dist/collection/components/data-display/syntax-view/syntax-view.js +64 -0
  73. package/dist/collection/components/indicators/step-diagram/step-diagram.js +2 -2
  74. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +1 -1
  75. package/dist/collection/components/inputs/dropdown/dropdown.js +2 -2
  76. package/dist/collection/components/inputs/form/form.js +2 -2
  77. package/dist/collection/components/inputs/form/internals/controls.js +2 -2
  78. package/dist/collection/components/inputs/input/input.js +3 -3
  79. package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +4 -4
  80. package/dist/collection/components/inputs/radio-group/radio-group.js +2 -2
  81. package/dist/collection/components/inputs/slider/slider.js +1 -1
  82. package/dist/collection/components/inputs/textarea/textarea.js +2 -2
  83. package/dist/collection/components/inputs/toggle/toggle.js +3 -3
  84. package/dist/collection/components/layout/control-group/control-group.js +1 -1
  85. package/dist/collection/components/layout/divider/divider.js +1 -1
  86. package/dist/collection/components/layout/grid/grid.js +1 -1
  87. package/dist/collection/components/layout/inline/inline.js +1 -1
  88. package/dist/collection/components/layout/navbar/navbar.js +2 -2
  89. package/dist/collection/components/layout/panel/panel.js +4 -4
  90. package/dist/collection/components/layout/scrollable/scrollable.js +3 -3
  91. package/dist/collection/components/layout/section/section.js +1 -1
  92. package/dist/collection/components/layout/sidepanel/internals/nav-items.js +2 -2
  93. package/dist/collection/components/layout/sidepanel/sidepanel.js +3 -0
  94. package/dist/collection/components/layout/stack/stack.js +1 -1
  95. package/dist/collection/components/layout/tabs/tabs.js +1 -1
  96. package/dist/collection/components/layout/toolbar/toolbar.js +2 -2
  97. package/dist/collection/components/media/avatar/avatar.js +1 -1
  98. package/dist/collection/components/media/image-comparison/image-comparison.js +1 -1
  99. package/dist/collection/components/media/media/media.js +1 -1
  100. package/dist/collection/components/media/reel/reel.js +23 -23
  101. package/dist/collection/components/media/reel/test/focus.cmp.test.js +33 -0
  102. package/dist/collection/components/media/thumbnail/thumbnail.js +2 -2
  103. package/dist/collection/components/overlays/dialog/dialog.js +2 -2
  104. package/dist/collection/components/overlays/tooltip/tooltip.js +2 -2
  105. package/dist/collection/theme/tokens.js +1 -1
  106. package/dist/collection/utils/form-control-validity.js +3 -3
  107. package/dist/components/index.js +1 -1
  108. package/dist/components/{p-CArIPzJU.js → p-B610wOGe.js} +1 -1
  109. package/dist/components/p-BGlbV43y.js +13 -0
  110. package/dist/components/{p-BZXIeEKC.js → p-BKWL9zOn.js} +1 -1
  111. package/dist/components/p-BxxU73QQ.js +1 -0
  112. package/dist/components/{p-kfrqZyfJ.js → p-CVEQfA-v.js} +1 -1
  113. package/dist/components/p-CpbWWDiY.js +1 -0
  114. package/dist/components/{p-BwPMm43W.js → p-D2fczi8m.js} +1 -1
  115. package/dist/components/{p-BGHNFaaC.js → p-D5vpGqZ9.js} +1 -1
  116. package/dist/components/p-DQIYo8zC.js +1 -0
  117. package/dist/components/{p-IwIJb0Mc.js → p-DX6PCIPS.js} +1 -1
  118. package/dist/components/{p-CpkX9YAW.js → p-DY9D4z7Z.js} +1 -1
  119. package/dist/{webquark/p-BDsIecIx.js → components/p-DbzjRzhu.js} +1 -1
  120. package/dist/components/{p-Bp6Xr92S.js → p-RX4DjgmV.js} +1 -1
  121. package/dist/components/{p-Bc2_QcLn.js → p-Ts5oOvg8.js} +1 -1
  122. package/dist/components/p-u1Qz6OcP.js +1 -0
  123. package/dist/components/q-accordion.js +1 -1
  124. package/dist/components/q-alert.js +1 -1
  125. package/dist/components/q-avatar.js +1 -1
  126. package/dist/components/q-banner.js +1 -1
  127. package/dist/components/q-button.js +1 -1
  128. package/dist/components/q-card.js +1 -1
  129. package/dist/components/q-carousel.js +1 -1
  130. package/dist/components/q-chip.js +1 -1
  131. package/dist/components/q-control-group.js +1 -1
  132. package/dist/components/q-conversation-bubble.js +1 -1
  133. package/dist/components/q-data-table.js +1 -1
  134. package/dist/components/q-dialog.js +1 -1
  135. package/dist/components/q-divider.js +1 -1
  136. package/dist/components/q-dropdown.js +1 -1
  137. package/dist/components/q-form.js +1 -1
  138. package/dist/components/q-grid.js +1 -1
  139. package/dist/components/q-icon.js +1 -1
  140. package/dist/components/q-image-comparison.js +1 -1
  141. package/dist/components/q-inline.js +1 -1
  142. package/dist/components/q-input.js +1 -1
  143. package/dist/components/q-link.js +1 -1
  144. package/dist/components/q-map.js +1 -1
  145. package/dist/components/q-media.js +1 -1
  146. package/dist/components/q-navbar.js +1 -1
  147. package/dist/components/q-pagination.js +1 -1
  148. package/dist/components/q-panel.js +1 -1
  149. package/dist/components/q-progress.js +1 -1
  150. package/dist/components/q-quantity-selector.js +1 -1
  151. package/dist/components/q-radio-group.js +1 -1
  152. package/dist/components/q-reel.js +1 -1
  153. package/dist/components/q-scrollable.js +1 -1
  154. package/dist/components/q-section.js +1 -1
  155. package/dist/components/q-sidepanel.js +2 -2
  156. package/dist/components/q-slider.js +1 -1
  157. package/dist/components/q-stack.js +1 -1
  158. package/dist/components/q-step-diagram-item.js +1 -1
  159. package/dist/components/q-step-diagram.js +1 -1
  160. package/dist/components/q-syntax-box.js +1 -13
  161. package/dist/components/q-syntax-view.d.ts +11 -0
  162. package/dist/components/q-syntax-view.js +1 -0
  163. package/dist/components/q-tabs.js +1 -1
  164. package/dist/components/q-textarea.js +1 -1
  165. package/dist/components/q-thumbnail.js +1 -1
  166. package/dist/components/q-toast.js +1 -1
  167. package/dist/components/q-toggle.js +1 -1
  168. package/dist/components/q-toolbar.js +1 -1
  169. package/dist/components/q-tooltip.js +1 -1
  170. package/dist/esm/{action.props-Di_LpF5H.js → action.props-CbSH7c-q.js} +1 -1
  171. package/dist/esm/{dom-CArIPzJU.js → dom-B610wOGe.js} +1 -1
  172. package/dist/esm/{field-C4Iilew6.js → field-D5xUxo11.js} +1 -1
  173. package/dist/esm/{form-control-validity-Bj2RJb2E.js → form-control-validity-BxxU73QQ.js} +3 -3
  174. package/dist/esm/{form-submit-action-CoEIvDqE.js → form-submit-action-BjjfVWyu.js} +1 -1
  175. package/dist/esm/{index-DoGM9gsC.js → index-CIMzZPQO.js} +13 -2
  176. package/dist/esm/loader.js +3 -3
  177. package/dist/esm/q-accordion.entry.js +1 -1
  178. package/dist/esm/q-alert.entry.js +2 -2
  179. package/dist/esm/q-avatar.entry.js +2 -2
  180. package/dist/esm/q-banner.entry.js +1 -1
  181. package/dist/esm/q-button_3.entry.js +903 -0
  182. package/dist/esm/q-card.entry.js +3 -3
  183. package/dist/esm/q-carousel.entry.js +2 -2
  184. package/dist/esm/q-chip.entry.js +2 -2
  185. package/dist/esm/q-control-group.entry.js +3 -3
  186. package/dist/esm/q-conversation-bubble.entry.js +1 -1
  187. package/dist/esm/q-data-table.entry.js +1 -1
  188. package/dist/esm/q-dialog.entry.js +4 -4
  189. package/dist/esm/q-divider.entry.js +3 -3
  190. package/dist/esm/q-dropdown.entry.js +4 -4
  191. package/dist/esm/q-form.entry.js +7 -7
  192. package/dist/esm/q-grid.entry.js +3 -3
  193. package/dist/esm/q-icon.entry.js +1 -1
  194. package/dist/esm/q-image-comparison.entry.js +2 -2
  195. package/dist/esm/q-inline.entry.js +3 -3
  196. package/dist/esm/q-input_2.entry.js +7 -7
  197. package/dist/esm/q-link.entry.js +2 -2
  198. package/dist/esm/q-map.entry.js +1 -1
  199. package/dist/esm/q-media.entry.js +2 -2
  200. package/dist/esm/q-navbar.entry.js +3 -3
  201. package/dist/esm/q-pagination.entry.js +1 -1
  202. package/dist/esm/q-panel.entry.js +7 -7
  203. package/dist/esm/q-quantity-selector.entry.js +5 -5
  204. package/dist/esm/q-radio-group.entry.js +4 -4
  205. package/dist/esm/q-reel.entry.js +24 -24
  206. package/dist/esm/q-section.entry.js +2 -2
  207. package/dist/esm/q-sidepanel.entry.js +5 -4
  208. package/dist/esm/q-slider.entry.js +2 -2
  209. package/dist/esm/q-stack.entry.js +3 -3
  210. package/dist/esm/q-step-diagram-item.entry.js +2 -2
  211. package/dist/esm/q-step-diagram.entry.js +4 -4
  212. package/dist/esm/q-syntax-box.entry.js +180 -719
  213. package/dist/esm/q-syntax-view.entry.js +63 -0
  214. package/dist/esm/q-tabs.entry.js +2 -2
  215. package/dist/esm/q-textarea.entry.js +5 -5
  216. package/dist/esm/q-thumbnail.entry.js +3 -3
  217. package/dist/esm/q-toast.entry.js +1 -1
  218. package/dist/esm/q-toggle.entry.js +6 -6
  219. package/dist/esm/q-toolbar.entry.js +4 -4
  220. package/dist/esm/syntax-content-Cr9kSbmA.js +903 -0
  221. package/dist/esm/{tokens-BDsIecIx.js → tokens-DbzjRzhu.js} +1 -1
  222. package/dist/esm/webquark.js +3 -3
  223. package/dist/formatters/prettier/LICENSE +7 -0
  224. package/dist/formatters/prettier/THIRD-PARTY-NOTICES.md +7941 -0
  225. package/dist/formatters/prettier/html-fragment.mjs +1 -0
  226. package/dist/formatters/prettier/html-fragment.mjs.gz +0 -0
  227. package/dist/formatters/prettier/languages/angular.mjs +1 -0
  228. package/dist/formatters/prettier/languages/angular.mjs.gz +0 -0
  229. package/dist/formatters/prettier/languages/css.mjs +1 -0
  230. package/dist/formatters/prettier/languages/css.mjs.gz +0 -0
  231. package/dist/formatters/prettier/languages/flow.mjs +1 -0
  232. package/dist/formatters/prettier/languages/flow.mjs.gz +0 -0
  233. package/dist/formatters/prettier/languages/graphql.mjs +1 -0
  234. package/dist/formatters/prettier/languages/graphql.mjs.gz +0 -0
  235. package/dist/formatters/prettier/languages/handlebars.mjs +1 -0
  236. package/dist/formatters/prettier/languages/handlebars.mjs.gz +0 -0
  237. package/dist/formatters/prettier/languages/html.mjs +1 -0
  238. package/dist/formatters/prettier/languages/html.mjs.gz +0 -0
  239. package/dist/formatters/prettier/languages/javascript.mjs +1 -0
  240. package/dist/formatters/prettier/languages/javascript.mjs.gz +0 -0
  241. package/dist/formatters/prettier/languages/json-stringify.mjs +1 -0
  242. package/dist/formatters/prettier/languages/json-stringify.mjs.gz +0 -0
  243. package/dist/formatters/prettier/languages/json.mjs +1 -0
  244. package/dist/formatters/prettier/languages/json.mjs.gz +0 -0
  245. package/dist/formatters/prettier/languages/json5.mjs +1 -0
  246. package/dist/formatters/prettier/languages/json5.mjs.gz +0 -0
  247. package/dist/formatters/prettier/languages/jsonc.mjs +1 -0
  248. package/dist/formatters/prettier/languages/jsonc.mjs.gz +0 -0
  249. package/dist/formatters/prettier/languages/jsx.mjs +1 -0
  250. package/dist/formatters/prettier/languages/jsx.mjs.gz +0 -0
  251. package/dist/formatters/prettier/languages/less.mjs +1 -0
  252. package/dist/formatters/prettier/languages/less.mjs.gz +0 -0
  253. package/dist/formatters/prettier/languages/lwc.mjs +1 -0
  254. package/dist/formatters/prettier/languages/lwc.mjs.gz +0 -0
  255. package/dist/formatters/prettier/languages/markdown.mjs +1 -0
  256. package/dist/formatters/prettier/languages/markdown.mjs.gz +0 -0
  257. package/dist/formatters/prettier/languages/mdx.mjs +1 -0
  258. package/dist/formatters/prettier/languages/mdx.mjs.gz +0 -0
  259. package/dist/formatters/prettier/languages/mjml.mjs +1 -0
  260. package/dist/formatters/prettier/languages/mjml.mjs.gz +0 -0
  261. package/dist/formatters/prettier/languages/postcss.mjs +1 -0
  262. package/dist/formatters/prettier/languages/postcss.mjs.gz +0 -0
  263. package/dist/formatters/prettier/languages/scss.mjs +1 -0
  264. package/dist/formatters/prettier/languages/scss.mjs.gz +0 -0
  265. package/dist/formatters/prettier/languages/tsx.mjs +1 -0
  266. package/dist/formatters/prettier/languages/tsx.mjs.gz +0 -0
  267. package/dist/formatters/prettier/languages/typescript.mjs +1 -0
  268. package/dist/formatters/prettier/languages/typescript.mjs.gz +0 -0
  269. package/dist/formatters/prettier/languages/vue.mjs +1 -0
  270. package/dist/formatters/prettier/languages/vue.mjs.gz +0 -0
  271. package/dist/formatters/prettier/languages/yaml.mjs +1 -0
  272. package/dist/formatters/prettier/languages/yaml.mjs.gz +0 -0
  273. package/dist/formatters/prettier/manifest.json +87 -0
  274. package/dist/formatters/prettier/plugins/acorn.mjs +17 -0
  275. package/dist/formatters/prettier/plugins/acorn.mjs.gz +0 -0
  276. package/dist/formatters/prettier/plugins/angular.mjs +7 -0
  277. package/dist/formatters/prettier/plugins/angular.mjs.gz +0 -0
  278. package/dist/formatters/prettier/plugins/babel.mjs +16 -0
  279. package/dist/formatters/prettier/plugins/babel.mjs.gz +0 -0
  280. package/dist/formatters/prettier/plugins/estree.mjs +44 -0
  281. package/dist/formatters/prettier/plugins/estree.mjs.gz +0 -0
  282. package/dist/formatters/prettier/plugins/flow.mjs +7 -0
  283. package/dist/formatters/prettier/plugins/flow.mjs.gz +0 -0
  284. package/dist/formatters/prettier/plugins/glimmer.mjs +37 -0
  285. package/dist/formatters/prettier/plugins/glimmer.mjs.gz +0 -0
  286. package/dist/formatters/prettier/plugins/graphql.mjs +17 -0
  287. package/dist/formatters/prettier/plugins/graphql.mjs.gz +0 -0
  288. package/dist/formatters/prettier/plugins/html.mjs +25 -0
  289. package/dist/formatters/prettier/plugins/html.mjs.gz +0 -0
  290. package/dist/formatters/prettier/plugins/markdown.mjs +70 -0
  291. package/dist/formatters/prettier/plugins/markdown.mjs.gz +0 -0
  292. package/dist/formatters/prettier/plugins/meriyah.mjs +9 -0
  293. package/dist/formatters/prettier/plugins/meriyah.mjs.gz +0 -0
  294. package/dist/formatters/prettier/plugins/postcss.mjs +62 -0
  295. package/dist/formatters/prettier/plugins/postcss.mjs.gz +0 -0
  296. package/dist/formatters/prettier/plugins/typescript.mjs +22 -0
  297. package/dist/formatters/prettier/plugins/typescript.mjs.gz +0 -0
  298. package/dist/formatters/prettier/plugins/yaml.mjs +150 -0
  299. package/dist/formatters/prettier/plugins/yaml.mjs.gz +0 -0
  300. package/dist/formatters/prettier/runtime.d.mts +2 -0
  301. package/dist/formatters/prettier/runtime.mjs +1 -0
  302. package/dist/formatters/prettier/runtime.mjs.gz +0 -0
  303. package/dist/formatters/prettier/standalone.mjs +29 -0
  304. package/dist/formatters/prettier/standalone.mjs.gz +0 -0
  305. package/dist/playground/components/theme-designer/token-row.js +45 -74
  306. package/dist/playground/utils/color.js +14 -25
  307. package/dist/types/components/data-display/syntax-box/internals/formatters/css.d.ts +1 -0
  308. package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.d.ts +10 -0
  309. package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.types.d.ts +4 -0
  310. package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.unit.test.d.ts +1 -0
  311. package/dist/types/components/data-display/syntax-box/internals/formatters/html.d.ts +1 -0
  312. package/dist/types/components/data-display/syntax-box/internals/formatters/javascript.d.ts +1 -0
  313. package/dist/types/components/data-display/syntax-box/internals/formatters/json.d.ts +6 -0
  314. package/dist/types/components/data-display/syntax-box/internals/formatters/languages.d.ts +27 -0
  315. package/dist/types/components/data-display/syntax-box/internals/formatters/util/prettier.d.ts +3 -0
  316. package/dist/types/components/data-display/syntax-box/internals/syntax.d.ts +1 -1
  317. package/dist/types/components/data-display/syntax-box/internals/views.d.ts +11 -0
  318. package/dist/types/components/data-display/syntax-box/internals/views.unit.test.d.ts +1 -0
  319. package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +66 -63
  320. package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +1 -1
  321. package/dist/types/components/data-display/syntax-box/syntax-content.d.ts +41 -0
  322. package/dist/types/components/data-display/syntax-box/syntax-ui.d.ts +15 -0
  323. package/dist/types/components/data-display/syntax-box/test/format-fixtures.d.ts +1 -1
  324. package/dist/types/components/data-display/syntax-box/test/syntax-views.cmp.test.d.ts +1 -0
  325. package/dist/types/components/data-display/syntax-view/syntax-view.d.ts +48 -0
  326. package/dist/types/components/layout/sidepanel/sidepanel.d.ts +2 -0
  327. package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +1 -0
  328. package/dist/types/components/media/reel/reel.d.ts +3 -3
  329. package/dist/types/components/media/reel/test/focus.cmp.test.d.ts +1 -0
  330. package/dist/types/components.d.ts +201 -7
  331. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/token-row.d.ts +1 -1
  332. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/dom-factory.d.ts +1 -0
  333. package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/color.d.ts +2 -8
  334. package/dist/types/utils/form-control-validity.d.ts +2 -1
  335. package/dist/webquark/{p-846dc838.entry.js → p-014c2f4a.entry.js} +1 -1
  336. package/dist/webquark/{p-0182e114.entry.js → p-0389577c.entry.js} +1 -1
  337. package/dist/webquark/p-041e17c1.entry.js +1 -0
  338. package/dist/webquark/p-0479c571.entry.js +1 -0
  339. package/dist/webquark/{p-17b9713f.entry.js → p-0ebca9be.entry.js} +1 -1
  340. package/dist/webquark/{p-0a2c52de.entry.js → p-1bf375f7.entry.js} +2 -2
  341. package/dist/webquark/{p-e2721e77.entry.js → p-20dc3ab5.entry.js} +1 -1
  342. package/dist/webquark/p-28d3348f.entry.js +1 -0
  343. package/dist/webquark/p-35c177d3.entry.js +1 -0
  344. package/dist/webquark/{p-f4d23ffe.entry.js → p-3a60086d.entry.js} +1 -1
  345. package/dist/webquark/{p-e723a7ae.entry.js → p-3ab798aa.entry.js} +1 -1
  346. package/dist/webquark/{p-15bad9ef.entry.js → p-3b580baf.entry.js} +1 -1
  347. package/dist/webquark/{p-4609c362.entry.js → p-3b65f787.entry.js} +1 -1
  348. package/dist/webquark/p-4bf610f8.entry.js +1 -0
  349. package/dist/webquark/{p-f51e1098.entry.js → p-4d30227e.entry.js} +1 -1
  350. package/dist/webquark/p-4de536ae.entry.js +1 -0
  351. package/dist/webquark/{p-3daafc56.entry.js → p-4e4d70c9.entry.js} +1 -1
  352. package/dist/webquark/p-4efeb7c9.entry.js +1 -0
  353. package/dist/webquark/{p-a314bc21.entry.js → p-51b3d71b.entry.js} +1 -1
  354. package/dist/webquark/p-778b6bbb.entry.js +1 -0
  355. package/dist/webquark/{p-a66550da.entry.js → p-7da78b2f.entry.js} +1 -1
  356. package/dist/webquark/{p-fe14f038.entry.js → p-7f8f986b.entry.js} +1 -1
  357. package/dist/webquark/{p-e0943d41.entry.js → p-8253c742.entry.js} +1 -1
  358. package/dist/webquark/{p-a2334abe.entry.js → p-9a1ddeb7.entry.js} +1 -1
  359. package/dist/webquark/{p-CArIPzJU.js → p-B610wOGe.js} +1 -1
  360. package/dist/webquark/p-BxxU73QQ.js +1 -0
  361. package/dist/webquark/p-CIMzZPQO.js +3 -0
  362. package/dist/webquark/p-CfR85WgM.js +13 -0
  363. package/dist/webquark/{p-DDUED8LT.js → p-D8p28N9s.js} +1 -1
  364. package/dist/{components/p-BDsIecIx.js → webquark/p-DbzjRzhu.js} +1 -1
  365. package/dist/webquark/{p-BOdNg0jc.js → p-DeOEN0si.js} +1 -1
  366. package/dist/webquark/p-a2b1de23.entry.js +1 -0
  367. package/dist/webquark/{p-dbcf7592.entry.js → p-a55edc17.entry.js} +1 -1
  368. package/dist/webquark/p-a8808020.entry.js +1 -0
  369. package/dist/webquark/{p-9a76cd71.entry.js → p-b1084b3c.entry.js} +1 -1
  370. package/dist/webquark/{p-a2ff1b64.entry.js → p-b6c4dff4.entry.js} +1 -1
  371. package/dist/webquark/{p-b21ad707.entry.js → p-b962e950.entry.js} +1 -1
  372. package/dist/webquark/{p-5b584d3c.entry.js → p-bc369cd6.entry.js} +1 -1
  373. package/dist/webquark/p-c119a8ea.entry.js +1 -0
  374. package/dist/webquark/{p-85131314.entry.js → p-c6b77e9a.entry.js} +1 -1
  375. package/dist/webquark/{p-84b350a3.entry.js → p-ca1c03b4.entry.js} +1 -1
  376. package/dist/webquark/{p-b8fdef4f.entry.js → p-ce436162.entry.js} +1 -1
  377. package/dist/webquark/{p-86c05afd.entry.js → p-d0a47a7c.entry.js} +1 -1
  378. package/dist/webquark/{p-222405b8.entry.js → p-e1fbc8fc.entry.js} +1 -1
  379. package/dist/webquark/{p-44bbe12f.entry.js → p-e32833ce.entry.js} +1 -1
  380. package/dist/webquark/{p-d86bd51d.entry.js → p-e369a4aa.entry.js} +1 -1
  381. package/dist/webquark/p-e4430c61.entry.js +1 -0
  382. package/dist/webquark/{p-aa342e81.entry.js → p-e9c0052b.entry.js} +1 -1
  383. package/dist/webquark/{p-852e88ae.entry.js → p-f5c4ca18.entry.js} +1 -1
  384. package/dist/webquark/{p-d4788321.entry.js → p-f6683126.entry.js} +1 -1
  385. package/dist/webquark/{p-Dnz3WmdX.js → p-ojSDiptZ.js} +1 -1
  386. package/dist/webquark/webquark.css +1 -1
  387. package/dist/webquark/webquark.esm.js +1 -1
  388. package/package.json +5 -1
  389. package/dist/cjs/q-button_2.cjs.entry.js +0 -462
  390. package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
  391. package/dist/components/p-Bj2RJb2E.js +0 -1
  392. package/dist/components/p-D2nxHd1b.js +0 -1
  393. package/dist/components/p-x3C-wjU9.js +0 -1
  394. package/dist/esm/q-button_2.entry.js +0 -459
  395. package/dist/esm/q-scrollable.entry.js +0 -447
  396. package/dist/types/components/data-display/syntax-box/internals/formatter.d.ts +0 -15
  397. package/dist/webquark/p-048103e0.entry.js +0 -1
  398. package/dist/webquark/p-0baf478a.entry.js +0 -1
  399. package/dist/webquark/p-2eaa3a9f.entry.js +0 -1
  400. package/dist/webquark/p-65fe9cac.entry.js +0 -1
  401. package/dist/webquark/p-8c5b2706.entry.js +0 -1
  402. package/dist/webquark/p-923527f0.entry.js +0 -1
  403. package/dist/webquark/p-Bj2RJb2E.js +0 -1
  404. package/dist/webquark/p-DoGM9gsC.js +0 -3
  405. package/dist/webquark/p-a0d97367.entry.js +0 -1
  406. package/dist/webquark/p-a16bd8d5.entry.js +0 -13
  407. package/dist/webquark/p-a3e1096d.entry.js +0 -1
  408. package/dist/webquark/p-b1c771fb.entry.js +0 -1
  409. package/dist/webquark/p-b45ca926.entry.js +0 -1
  410. package/dist/webquark/p-eb800d1e.entry.js +0 -1
  411. /package/dist/{types/components/data-display/syntax-box/internals/formatter.unit.test.d.ts → collection/components/data-display/syntax-box/internals/formatters/formatter.types.js} +0 -0
@@ -1,293 +1,205 @@
1
- import { isFieldDisabled, syncFieldHost } from "../../../utils/form-field-state";
2
- import { registerFormField } from "../../../utils/form-field-adapter";
3
- import { Host, h } from "@stencil/core";
4
- import { Braces, Check, Copy } from "@lucide/icons";
5
- import { formatSource, isFormatSupported } from "./internals/formatter";
6
- import { syncNativeControlValidity } from "../../../utils/form-control-validity";
7
- import { tokenizeSyntax } from "./internals/syntax";
8
- import { getSyntaxBoxCopyText, writeClipboardText } from "./internals/clipboard";
9
- import { getSyntaxBoxEditorKeyAction } from "./internals/editor-key-action";
10
- import { normalizeSyntaxBoxValue, resolveInitialSyntaxBoxValue } from "./internals/value-sync";
1
+ import { Host, Mixin, forceUpdate, h } from "@stencil/core";
2
+ import { hasSlottedSource, syntaxBoxes, syntaxScrollRestorers, syntaxVisibility } from "./internals/views";
3
+ import { withSyntaxContent } from "./syntax-content";
4
+ let nextBox = 0;
11
5
  /**
12
- * Displays and optionally edits syntax-highlighted code, with form association in editable mode.
13
- * @slot - Read-only fallback content rendered when `code` is not provided.
14
- * @slot actions - Additional actions rendered in the panel header.
6
+ * Displays syntax-highlighted content and automatically adds tabs for multiple views.
7
+ * @slot - Read-only fallback content or direct q-syntax-view children.
8
+ * @slot heading - Custom title content in the single-view panel header.
9
+ * @slot actions - Additional actions for the box's own view.
15
10
  */
16
- export class QSyntaxBox {
17
- // ======== [1] STENCIL API (Props, Events, AttachInternals, Elements) =========
11
+ export class QSyntaxBox extends Mixin(withSyntaxContent) {
12
+ constructor() {
13
+ super();
14
+ }
18
15
  el;
19
16
  internals;
20
- /** Mirrored with `value`; prefer `code` for domain usage. */
21
- code;
22
- /** Form-value alias mirrored with `code` for compatibility. */
23
- value;
24
- /** Shown only in the panel variant. */
25
- heading;
26
- /** Accessible name for the editor; falls back to `heading`, then the language. */
27
- ariaLabel = null;
28
- variant = 'panel';
29
- /** Explicit content height. Panel mode defaults to 110px; plain mode defaults to auto. */
30
- height;
31
- copyable = false;
32
- editable = false;
33
- /** Form field name used when the component is editable. */
34
- name;
35
- /** Marks the editable textarea as required for form validation. */
36
- required = false;
37
- language = 'html';
38
- /** Disables editing and panel actions. */
39
- disabled = false;
40
- /** Emitted when editable content is committed by the native change event or by formatting. */
41
- qChange;
42
- /** Emitted on each editable content input and after formatting. */
43
- qInput;
44
- // ======================== [2] INTERNAL STATE & REFS ========================
45
- disabledState = false;
46
- get isDisabled() {
47
- return isFieldDisabled(this.el, this.disabled);
48
- }
49
- copied = false;
50
- copyFailed = false;
51
- formatMessage;
52
- initialValue = '';
53
- copiedTimeoutId;
54
- scrollableEl;
55
- preEl;
56
- // ========================= [3] LIFECYCLE & WATCHERS =========================
57
- watchCode(newCode) {
58
- this.formatMessage = undefined;
59
- const finalCode = normalizeSyntaxBoxValue(newCode, {
60
- editable: this.editable,
17
+ instanceId = `q-syntax-box-${++nextBox}`;
18
+ identities = new WeakMap();
19
+ nextView = 0;
20
+ views = [];
21
+ selected;
22
+ observer;
23
+ tabSelector;
24
+ focusWithin = false;
25
+ restoreFocus = false;
26
+ activeVariant;
27
+ linkFrame;
28
+ connectedCallback() {
29
+ syntaxBoxes.set(this.el, this);
30
+ this.el.addEventListener('focusin', this.onFocusIn);
31
+ this.el.addEventListener('focusout', this.onFocusOut);
32
+ this.observer = new MutationObserver(changes => {
33
+ const changed = changes.some(change => change.target === this.el || change.target.parentNode === this.el &&
34
+ (change.type === 'characterData' || change.type === 'attributes'));
35
+ if (changed && this.collectViews())
36
+ forceUpdate(this.el);
61
37
  });
62
- if (finalCode !== newCode) {
63
- this.code = finalCode;
64
- }
65
- if (this.value !== finalCode) {
66
- this.value = finalCode;
67
- }
68
- this.syncFormValue(finalCode);
69
- }
70
- watchValue(newValue) {
71
- this.formatMessage = undefined;
72
- const finalVal = normalizeSyntaxBoxValue(newValue, {
73
- editable: this.editable,
38
+ this.observer.observe(this.el, {
39
+ childList: true, subtree: true, characterData: true, attributes: true,
40
+ attributeFilter: ['heading', 'view-key', 'slot'],
74
41
  });
75
- if (finalVal !== newValue) {
76
- this.value = finalVal;
77
- }
78
- if (this.code !== finalVal) {
79
- this.code = finalVal;
80
- }
81
- this.syncFormValue(finalVal);
82
- }
83
- watchConstraints() {
84
- this.syncValidity();
85
42
  }
86
- watchEditable() {
87
- if (this.editable)
88
- this.watchCode(this.code);
89
- this.syncFormValue(this.code);
90
- }
91
- componentWillLoad() {
92
- const initial = resolveInitialSyntaxBoxValue({
93
- code: this.code,
94
- value: this.value,
95
- editable: this.editable,
96
- });
97
- this.code = initial.code;
98
- this.value = initial.value;
99
- this.initialValue = initial.initialValue;
100
- this.syncFormValue(this.code);
101
- }
102
- formDisabledCallback() {
103
- this.syncValidity();
104
- }
105
- componentDidLoad() {
106
- registerFormField(this.el, {
107
- kind: 'text',
108
- owner: () => this.internals?.form ?? null,
109
- active: () => this.editable,
110
- value: () => this.code ?? '',
111
- assign: value => { this.value = value; },
112
- reconcile: () => {
113
- const textarea = this.el.shadowRoot?.querySelector('textarea');
114
- if (textarea && textarea.value !== (this.code ?? ''))
115
- textarea.value = this.code ?? '';
116
- this.syncFormValue(this.code);
117
- this.syncValidity();
118
- },
119
- reset: () => this.formResetCallback(),
120
- validate: report => report ? this.internals?.reportValidity?.() ?? true : this.internals?.checkValidity?.() ?? true,
121
- });
43
+ componentWillRender() {
44
+ this.collectViews();
122
45
  }
123
46
  componentDidRender() {
124
- this.syncValidity();
47
+ super.componentDidRender();
48
+ if (this.activeVariant !== this.variant) {
49
+ this.activeVariant = this.variant;
50
+ for (const view of this.views)
51
+ if (view.element !== this.el)
52
+ forceUpdate(view.element);
53
+ }
54
+ this.syncPanels();
55
+ if (this.linkFrame !== undefined)
56
+ cancelAnimationFrame(this.linkFrame);
57
+ this.linkFrame = requestAnimationFrame(() => {
58
+ this.linkFrame = undefined;
59
+ this.linkTabs();
60
+ if (this.selected)
61
+ syntaxScrollRestorers.get(this.selected)?.();
62
+ this.recoverFocus();
63
+ });
125
64
  }
126
65
  disconnectedCallback() {
127
- this.clearCopiedTimeout();
128
- }
129
- formResetCallback() {
130
- this.code = this.initialValue;
131
- this.value = this.initialValue;
132
- this.syncFormValue(this.code);
133
- this.syncValidity();
134
- }
135
- // ========================== [4] EXPOSED METHODS ==========================
136
- /** Programmatically scrolls the read-only code body to the bottom when it is wrapped by q-scrollable. */
137
- async scrollToBottom() {
138
- await this.scrollableEl?.scrollToBottom();
139
- }
140
- /** Returns whether editable content satisfies native constraints. */
141
- async checkValidity() {
142
- this.syncValidity();
143
- if (typeof this.internals.checkValidity === 'function') {
144
- return this.internals.checkValidity();
145
- }
146
- return this.el.shadowRoot?.querySelector('textarea')?.checkValidity?.() ?? true;
147
- }
148
- /** Reports editable constraint violations and returns whether the control is valid. */
149
- async reportValidity() {
150
- this.syncValidity();
151
- if (typeof this.internals.reportValidity === 'function') {
152
- return this.internals.reportValidity();
153
- }
154
- return this.el.shadowRoot?.querySelector('textarea')?.reportValidity?.() ?? true;
155
- }
156
- // =================== [5] EVENT HANDLERS & INTERNAL METHODS ===================
157
- syncFormValue(value) {
158
- if (!this.internals || typeof this.internals.setFormValue !== 'function')
66
+ super.disconnectedCallback();
67
+ this.observer?.disconnect();
68
+ this.el.removeEventListener('focusin', this.onFocusIn);
69
+ this.el.removeEventListener('focusout', this.onFocusOut);
70
+ if (this.linkFrame !== undefined)
71
+ cancelAnimationFrame(this.linkFrame);
72
+ }
73
+ visible(view) {
74
+ return !this.selected || view === this.selected;
75
+ }
76
+ select(view) {
77
+ if (!this.views.some(candidate => candidate.element === view) || this.selected === view)
159
78
  return;
160
- this.internals.setFormValue(this.editable ? value || '' : null);
161
- this.syncValidity();
162
- }
163
- syncValidity() {
164
- const disabled = syncFieldHost(this.el, this.disabled, this.name, this.required);
165
- if (this.disabledState !== disabled)
166
- this.disabledState = disabled;
167
- const textarea = this.el.shadowRoot?.querySelector('textarea');
168
- if (textarea) {
169
- textarea.disabled = disabled;
170
- textarea.required = this.required;
171
- textarea.readOnly = this.el.hasAttribute('readonly');
172
- if (textarea.value !== (this.code ?? ''))
173
- textarea.value = this.code ?? '';
174
- }
175
- this.internals?.setFormValue?.(this.editable && !disabled ? this.code ?? '' : null);
176
- if (!this.internals || !textarea || !this.editable) {
177
- if (typeof this.internals?.setValidity === 'function') {
178
- this.internals.setValidity({});
79
+ this.selected = view;
80
+ this.syncPanels();
81
+ forceUpdate(this.el);
82
+ }
83
+ onFocusIn = () => { this.focusWithin = true; };
84
+ onFocusOut = (event) => {
85
+ if (event.relatedTarget instanceof Node && !this.el.contains(event.relatedTarget))
86
+ this.focusWithin = false;
87
+ };
88
+ collectViews() {
89
+ const children = Array.from(this.el.children).filter((child) => child.localName === 'q-syntax-view');
90
+ const hostHasContent = this.code !== undefined || this.value !== undefined || this.editable || hasSlottedSource(this.el);
91
+ const elements = hostHasContent || !children.length ? [this.el, ...children] : children;
92
+ const views = elements.map((element, index) => this.describeView(element, index));
93
+ const previous = this.views;
94
+ 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);
95
+ if (!changed)
96
+ return false;
97
+ if (!views.some(view => view.element === this.selected)) {
98
+ this.restoreFocus = this.selected !== undefined && this.focusWithin;
99
+ this.selected = this.replacementView(views).element;
100
+ }
101
+ if (previous.length > 1 && views.length === 1 && this.el.shadowRoot?.activeElement === this.tabSelector)
102
+ this.restoreFocus = true;
103
+ for (const old of previous) {
104
+ if (!elements.includes(old.element) && old.element.slot === old.tab.value) {
105
+ old.element.removeAttribute('slot');
106
+ forceUpdate(old.element);
179
107
  }
180
- return;
181
108
  }
182
- syncNativeControlValidity({
183
- internals: this.internals,
184
- control: textarea,
185
- disabled: this.isDisabled,
186
- });
109
+ this.views = views;
110
+ return true;
187
111
  }
188
- clearCopiedTimeout() {
189
- if (this.copiedTimeoutId !== undefined) {
190
- clearTimeout(this.copiedTimeoutId);
191
- this.copiedTimeoutId = undefined;
112
+ describeView(element, index) {
113
+ let id = this.identities.get(element);
114
+ if (!id) {
115
+ id = `${this.instanceId}-view-${++this.nextView}`;
116
+ this.identities.set(element, id);
192
117
  }
193
- }
194
- scheduleCopyStateReset() {
195
- this.clearCopiedTimeout();
196
- this.copiedTimeoutId = setTimeout(() => {
197
- this.copied = false;
198
- this.copyFailed = false;
199
- this.copiedTimeoutId = undefined;
200
- }, 1500);
201
- }
202
- copyCode = async () => {
203
- if (this.isDisabled)
204
- return;
205
- const codeToCopy = getSyntaxBoxCopyText(this.code, this.el.textContent);
206
- try {
207
- await writeClipboardText(codeToCopy);
208
- if (!this.el.isConnected)
209
- return;
210
- this.copied = true;
211
- this.copyFailed = false;
118
+ const child = element !== this.el;
119
+ if (child && element.slot !== id) {
120
+ element.slot = id;
121
+ if (element.shadowRoot?.childElementCount)
122
+ forceUpdate(element);
212
123
  }
213
- catch {
214
- if (!this.el.isConnected)
215
- return;
216
- this.copied = false;
217
- this.copyFailed = true;
218
- }
219
- this.scheduleCopyStateReset();
220
- };
221
- handleScroll = (e) => {
222
- const textarea = e.target;
223
- if (this.preEl) {
224
- this.preEl.scrollLeft = textarea.scrollLeft;
225
- this.preEl.scrollTop = textarea.scrollTop;
226
- }
227
- };
228
- handleInput = (ev) => {
229
- const target = ev.target;
230
- this.code = target.value;
231
- this.value = target.value;
232
- this.qInput.emit(this.code);
233
- };
234
- handleChange = (ev) => {
235
- const target = ev.target;
236
- this.code = target.value;
237
- this.value = target.value;
238
- this.qChange.emit(this.code);
124
+ const label = (child ? element.getAttribute('heading') : this.heading)?.trim() || `View ${index + 1}`;
125
+ return {
126
+ element,
127
+ key: child ? element.getAttribute('view-key')?.trim() : undefined,
128
+ tab: { label, value: id, tabId: id + '-tab', panelId: id + '-panel' },
129
+ };
130
+ }
131
+ replacementView(views) {
132
+ const index = this.views.findIndex(view => view.element === this.selected);
133
+ if (index < 0)
134
+ return views[0];
135
+ const key = this.views[index].key;
136
+ if (key && this.views.filter(view => view.key === key).length === 1) {
137
+ const replacements = views.filter(view => view.key === key);
138
+ if (replacements.length === 1)
139
+ return replacements[0];
140
+ }
141
+ const neighbors = [...this.views.slice(index + 1), ...this.views.slice(0, index).reverse()];
142
+ return neighbors.find(old => views.some(view => view.element === old.element)) ?? views[0];
143
+ }
144
+ onTabChange = (event) => {
145
+ event.stopPropagation();
146
+ const view = this.views.find(candidate => candidate.tab.value === event.detail);
147
+ if (view)
148
+ this.select(view.element);
239
149
  };
240
- handleKeyDown = (ev) => {
241
- const textarea = ev.target;
242
- const action = getSyntaxBoxEditorKeyAction(ev, textarea.value, textarea.selectionStart, textarea.selectionEnd);
243
- if (action.type === 'none') {
150
+ panel(view) {
151
+ return this.el.shadowRoot?.getElementById(view.tab.panelId);
152
+ }
153
+ syncPanels() {
154
+ for (const view of this.views) {
155
+ const panel = this.panel(view);
156
+ if (!panel)
157
+ continue;
158
+ const inactive = !this.visible(view.element);
159
+ panel.toggleAttribute('data-inactive', inactive);
160
+ if (inactive)
161
+ panel.setAttribute('aria-hidden', 'true');
162
+ else
163
+ panel.removeAttribute('aria-hidden');
164
+ panel.tabIndex = !inactive && this.views.length > 1 ? 0 : -1;
165
+ syntaxVisibility.get(view.element)?.();
166
+ }
167
+ }
168
+ linkTabs() {
169
+ for (const view of this.views) {
170
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
171
+ const panel = this.panel(view);
172
+ if (!tab || !panel)
173
+ continue;
174
+ if ('ariaControlsElements' in tab)
175
+ tab.ariaControlsElements = [panel];
176
+ if ('ariaLabelledByElements' in panel)
177
+ panel.ariaLabelledByElements = [tab];
178
+ }
179
+ }
180
+ recoverFocus() {
181
+ if (!this.restoreFocus)
244
182
  return;
245
- }
246
- if (action.type === 'blur') {
247
- textarea.blur();
183
+ this.restoreFocus = false;
184
+ const focused = this.el.ownerDocument.activeElement;
185
+ if (focused && focused !== this.el.ownerDocument.body && focused !== this.el && !this.el.contains(focused))
248
186
  return;
249
- }
250
- ev.preventDefault();
251
- this.code = action.value;
252
- this.value = action.value;
253
- this.qInput.emit(this.code);
254
- requestAnimationFrame(() => {
255
- textarea.selectionStart = textarea.selectionEnd = action.caret;
256
- });
257
- };
258
- handleFormat = () => {
259
- if (this.isDisabled || !isFormatSupported(this.language))
187
+ const view = this.views.find(candidate => candidate.element === this.selected);
188
+ if (!view)
260
189
  return;
261
- if (this.code) {
262
- const result = formatSource(this.code, this.language);
263
- this.code = result.code;
264
- this.value = result.code;
265
- this.formatMessage = result.status === 'invalid' ? 'Invalid JSON; source unchanged.'
266
- : result.status === 'unsupported' ? 'JSON formatting limit reached; source unchanged.' : undefined;
267
- this.qInput.emit(result.code);
268
- this.qChange.emit(result.code);
269
- }
270
- };
271
- getCopyTooltipContent() {
272
- if (this.copyFailed)
273
- return 'Copy failed';
274
- if (this.copied)
275
- return 'Copied!';
276
- return 'Copy';
190
+ const tab = this.tabSelector?.shadowRoot?.getElementById(view.tab.tabId);
191
+ (tab ?? this.panel(view))?.focus({ preventScroll: true });
277
192
  }
278
- // ===================== [6] RENDER (Visual Template Only) =====================
279
193
  render() {
280
- const resolvedHeight = this.height !== undefined ? this.height : this.variant === 'panel' ? '110px' : 'auto';
281
- const isScrollable = resolvedHeight !== 'auto' && resolvedHeight !== '';
282
- const formatSupported = isFormatSupported(this.language);
283
- const formatFeedback = this.editable ? formatSupported ? this.formatMessage : 'Formatting is available for JSON only.' : undefined;
284
- const highlighted = tokenizeSyntax(this.code ?? '', this.language).map(token => token.className ? h("span", { class: token.className }, token.text) : token.text);
285
- 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));
286
- const bodyContent = isScrollable && !this.editable ? (h("q-scrollable", { height: resolvedHeight, ref: el => (this.scrollableEl = el) }, content)) : (content);
287
- if (this.variant === 'panel') {
288
- 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)));
289
- }
290
- return (h(Host, { class: { 'q-syntax-box-plain': true } }, h("div", { class: "plain-container" }, bodyContent)));
194
+ const tabbed = this.views.length > 1;
195
+ const panelStyle = this.variant === 'panel';
196
+ const active = this.views.find(view => view.element === this.selected);
197
+ const title = this.heading || (active?.element !== this.el ? active?.element.getAttribute('heading') : '');
198
+ 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
199
+ ? 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; } })
200
+ : 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
201
+ ? [panelStyle && this.renderActions(), this.renderContent(this.variant)]
202
+ : h("slot", { name: view.tab.value }))))));
291
203
  }
292
204
  static get is() { return "q-syntax-box"; }
293
205
  static get encapsulation() { return "shadow"; }
@@ -303,376 +215,6 @@ export class QSyntaxBox {
303
215
  "$": ["syntax-box.css"]
304
216
  };
305
217
  }
306
- static get properties() {
307
- return {
308
- "code": {
309
- "type": "string",
310
- "mutable": true,
311
- "complexType": {
312
- "original": "string",
313
- "resolved": "string",
314
- "references": {}
315
- },
316
- "required": false,
317
- "optional": true,
318
- "docs": {
319
- "tags": [],
320
- "text": "Mirrored with `value`; prefer `code` for domain usage."
321
- },
322
- "getter": false,
323
- "setter": false,
324
- "reflect": false,
325
- "attribute": "code"
326
- },
327
- "value": {
328
- "type": "string",
329
- "mutable": true,
330
- "complexType": {
331
- "original": "string",
332
- "resolved": "string",
333
- "references": {}
334
- },
335
- "required": false,
336
- "optional": true,
337
- "docs": {
338
- "tags": [],
339
- "text": "Form-value alias mirrored with `code` for compatibility."
340
- },
341
- "getter": false,
342
- "setter": false,
343
- "reflect": false,
344
- "attribute": "value"
345
- },
346
- "heading": {
347
- "type": "string",
348
- "mutable": false,
349
- "complexType": {
350
- "original": "string",
351
- "resolved": "string",
352
- "references": {}
353
- },
354
- "required": false,
355
- "optional": true,
356
- "docs": {
357
- "tags": [],
358
- "text": "Shown only in the panel variant."
359
- },
360
- "getter": false,
361
- "setter": false,
362
- "reflect": false,
363
- "attribute": "heading"
364
- },
365
- "ariaLabel": {
366
- "type": "string",
367
- "mutable": false,
368
- "complexType": {
369
- "original": "string | null",
370
- "resolved": "string",
371
- "references": {}
372
- },
373
- "required": false,
374
- "optional": false,
375
- "docs": {
376
- "tags": [],
377
- "text": "Accessible name for the editor; falls back to `heading`, then the language."
378
- },
379
- "getter": false,
380
- "setter": false,
381
- "reflect": false,
382
- "attribute": "aria-label",
383
- "defaultValue": "null"
384
- },
385
- "variant": {
386
- "type": "string",
387
- "mutable": false,
388
- "complexType": {
389
- "original": "QSyntaxBoxVariant",
390
- "resolved": "\"panel\" | \"plain\"",
391
- "references": {
392
- "QSyntaxBoxVariant": {
393
- "location": "import",
394
- "path": "./syntax-box.types",
395
- "id": "../../../src/browser/components/data-display/syntax-box/syntax-box.types.ts::QSyntaxBoxVariant",
396
- "referenceLocation": "QSyntaxBoxVariant"
397
- }
398
- }
399
- },
400
- "required": false,
401
- "optional": false,
402
- "docs": {
403
- "tags": [],
404
- "text": ""
405
- },
406
- "getter": false,
407
- "setter": false,
408
- "reflect": false,
409
- "attribute": "variant",
410
- "defaultValue": "'panel'"
411
- },
412
- "height": {
413
- "type": "string",
414
- "mutable": false,
415
- "complexType": {
416
- "original": "string",
417
- "resolved": "string",
418
- "references": {}
419
- },
420
- "required": false,
421
- "optional": true,
422
- "docs": {
423
- "tags": [],
424
- "text": "Explicit content height. Panel mode defaults to 110px; plain mode defaults to auto."
425
- },
426
- "getter": false,
427
- "setter": false,
428
- "reflect": false,
429
- "attribute": "height"
430
- },
431
- "copyable": {
432
- "type": "boolean",
433
- "mutable": false,
434
- "complexType": {
435
- "original": "boolean",
436
- "resolved": "boolean",
437
- "references": {}
438
- },
439
- "required": false,
440
- "optional": false,
441
- "docs": {
442
- "tags": [],
443
- "text": ""
444
- },
445
- "getter": false,
446
- "setter": false,
447
- "reflect": false,
448
- "attribute": "copyable",
449
- "defaultValue": "false"
450
- },
451
- "editable": {
452
- "type": "boolean",
453
- "mutable": false,
454
- "complexType": {
455
- "original": "boolean",
456
- "resolved": "boolean",
457
- "references": {}
458
- },
459
- "required": false,
460
- "optional": false,
461
- "docs": {
462
- "tags": [],
463
- "text": ""
464
- },
465
- "getter": false,
466
- "setter": false,
467
- "reflect": true,
468
- "attribute": "editable",
469
- "defaultValue": "false"
470
- },
471
- "name": {
472
- "type": "string",
473
- "mutable": false,
474
- "complexType": {
475
- "original": "string",
476
- "resolved": "string",
477
- "references": {}
478
- },
479
- "required": false,
480
- "optional": true,
481
- "docs": {
482
- "tags": [],
483
- "text": "Form field name used when the component is editable."
484
- },
485
- "getter": false,
486
- "setter": false,
487
- "reflect": true,
488
- "attribute": "name"
489
- },
490
- "required": {
491
- "type": "boolean",
492
- "mutable": false,
493
- "complexType": {
494
- "original": "boolean",
495
- "resolved": "boolean",
496
- "references": {}
497
- },
498
- "required": false,
499
- "optional": false,
500
- "docs": {
501
- "tags": [],
502
- "text": "Marks the editable textarea as required for form validation."
503
- },
504
- "getter": false,
505
- "setter": false,
506
- "reflect": true,
507
- "attribute": "required",
508
- "defaultValue": "false"
509
- },
510
- "language": {
511
- "type": "string",
512
- "mutable": false,
513
- "complexType": {
514
- "original": "QSyntaxBoxLanguage",
515
- "resolved": "\"css\" | \"html\" | \"javascript\" | \"json\"",
516
- "references": {
517
- "QSyntaxBoxLanguage": {
518
- "location": "import",
519
- "path": "./syntax-box.types",
520
- "id": "../../../src/browser/components/data-display/syntax-box/syntax-box.types.ts::QSyntaxBoxLanguage",
521
- "referenceLocation": "QSyntaxBoxLanguage"
522
- }
523
- }
524
- },
525
- "required": false,
526
- "optional": false,
527
- "docs": {
528
- "tags": [],
529
- "text": ""
530
- },
531
- "getter": false,
532
- "setter": false,
533
- "reflect": false,
534
- "attribute": "language",
535
- "defaultValue": "'html'"
536
- },
537
- "disabled": {
538
- "type": "boolean",
539
- "mutable": false,
540
- "complexType": {
541
- "original": "boolean",
542
- "resolved": "boolean",
543
- "references": {}
544
- },
545
- "required": false,
546
- "optional": false,
547
- "docs": {
548
- "tags": [],
549
- "text": "Disables editing and panel actions."
550
- },
551
- "getter": false,
552
- "setter": false,
553
- "reflect": true,
554
- "attribute": "disabled",
555
- "defaultValue": "false"
556
- }
557
- };
558
- }
559
- static get states() {
560
- return {
561
- "disabledState": {},
562
- "copied": {},
563
- "copyFailed": {},
564
- "formatMessage": {}
565
- };
566
- }
567
- static get events() {
568
- return [{
569
- "method": "qChange",
570
- "name": "qChange",
571
- "bubbles": true,
572
- "cancelable": true,
573
- "composed": true,
574
- "docs": {
575
- "tags": [],
576
- "text": "Emitted when editable content is committed by the native change event or by formatting."
577
- },
578
- "complexType": {
579
- "original": "string",
580
- "resolved": "string",
581
- "references": {}
582
- }
583
- }, {
584
- "method": "qInput",
585
- "name": "qInput",
586
- "bubbles": true,
587
- "cancelable": true,
588
- "composed": true,
589
- "docs": {
590
- "tags": [],
591
- "text": "Emitted on each editable content input and after formatting."
592
- },
593
- "complexType": {
594
- "original": "string",
595
- "resolved": "string",
596
- "references": {}
597
- }
598
- }];
599
- }
600
- static get methods() {
601
- return {
602
- "scrollToBottom": {
603
- "complexType": {
604
- "signature": "() => Promise<void>",
605
- "parameters": [],
606
- "references": {
607
- "Promise": {
608
- "location": "global",
609
- "id": "global::Promise"
610
- }
611
- },
612
- "return": "Promise<void>"
613
- },
614
- "docs": {
615
- "text": "Programmatically scrolls the read-only code body to the bottom when it is wrapped by q-scrollable.",
616
- "tags": []
617
- }
618
- },
619
- "checkValidity": {
620
- "complexType": {
621
- "signature": "() => Promise<boolean>",
622
- "parameters": [],
623
- "references": {
624
- "Promise": {
625
- "location": "global",
626
- "id": "global::Promise"
627
- }
628
- },
629
- "return": "Promise<boolean>"
630
- },
631
- "docs": {
632
- "text": "Returns whether editable content satisfies native constraints.",
633
- "tags": []
634
- }
635
- },
636
- "reportValidity": {
637
- "complexType": {
638
- "signature": "() => Promise<boolean>",
639
- "parameters": [],
640
- "references": {
641
- "Promise": {
642
- "location": "global",
643
- "id": "global::Promise"
644
- }
645
- },
646
- "return": "Promise<boolean>"
647
- },
648
- "docs": {
649
- "text": "Reports editable constraint violations and returns whether the control is valid.",
650
- "tags": []
651
- }
652
- }
653
- };
654
- }
655
218
  static get elementRef() { return "el"; }
656
- static get watchers() {
657
- return [{
658
- "propName": "code",
659
- "methodName": "watchCode"
660
- }, {
661
- "propName": "value",
662
- "methodName": "watchValue"
663
- }, {
664
- "propName": "disabled",
665
- "methodName": "watchConstraints"
666
- }, {
667
- "propName": "required",
668
- "methodName": "watchConstraints"
669
- }, {
670
- "propName": "name",
671
- "methodName": "watchConstraints"
672
- }, {
673
- "propName": "editable",
674
- "methodName": "watchEditable"
675
- }];
676
- }
677
219
  static get attachInternalsMemberName() { return "internals"; }
678
220
  }