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