@xlabs-store/core 0.0.1 → 0.0.3
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/LICENSE +21 -21
- package/components/index.d.ts +0 -0
- package/components/index.js +1 -1
- package/components/p--BbMiBIf.js +1 -0
- package/components/p-4BROAJ-M.js +1 -0
- package/components/p-9T3IQVUX.js +1 -0
- package/components/p-B1Y8S28h.js +1 -0
- package/components/p-B5VsEsBC.js +1 -0
- package/components/p-B7SdFSQT.js +1 -0
- package/components/p-B97Hj_bs.js +1 -0
- package/components/p-BBTo0Tfc.js +1 -0
- package/components/p-BCuFZ3xx.js +1 -0
- package/components/p-BFPoQ179.js +1 -0
- package/components/p-BLqwG7xa.js +1 -0
- package/components/p-BPaLHj9P.js +1 -0
- package/components/p-BQtB82ld.js +1 -0
- package/components/p-BSLE4EQn.js +1 -0
- package/components/{p-DcRlYBIl.js → p-BUXxKr3t.js} +1 -1
- package/components/p-BYCebYZT.js +1 -0
- package/components/p-BZdNMS4e.js +1 -0
- package/components/p-BhWqNJhk.js +1 -0
- package/components/p-BnnNgLpE.js +1 -0
- package/components/p-BoPZ9Se8.js +1 -0
- package/components/p-BogEYBiK.js +1 -0
- package/components/p-Brr9Q7gj.js +1 -0
- package/components/p-BvOnPBRo.js +1 -0
- package/components/p-BzX-LA7W.js +1 -0
- package/components/p-C-KgrbKX.js +1 -0
- package/components/{p-CfhgoXyB.js → p-C-rau5Ex.js} +1 -1
- package/components/{p-B4R9Mtmk.js → p-C1PUbETy.js} +1 -1
- package/components/p-C1_JmoB8.js +1 -0
- package/components/{p-noTpj1Kh.js → p-C3Kx_-Wc.js} +1 -1
- package/components/p-CIOnWzKr.js +1 -0
- package/components/p-CQ2VND9-.js +1 -0
- package/components/p-CQQI-pRu.js +1 -0
- package/components/p-CXhCHTJf.js +1 -0
- package/components/p-CaJOfbTg.js +1 -0
- package/components/p-Cf_74fjT.js +1 -0
- package/components/{p-DVz50Dd3.js → p-CgLn4Y4c.js} +1 -1
- package/components/p-CgaLhv3u.js +1 -0
- package/components/{p-CGYOWZnh.js → p-CijqjTOk.js} +1 -1
- package/components/p-CkwLFDlS.js +1 -0
- package/components/p-CkyEMR2k.js +1 -0
- package/components/{p-Ce32Mo_Q.js → p-CmfyRJYt.js} +1 -1
- package/components/p-CnPsn8zN.js +1 -0
- package/components/p-Cp3SPBy3.js +1 -0
- package/components/p-CsYh9t-z.js +1 -0
- package/components/{p-BM-ap7lt.js → p-CtFbsd8j.js} +1 -1
- package/components/p-Cuf33Rgj.js +1 -0
- package/components/p-CwNmnRmr.js +1 -0
- package/components/p-CxMQkHjk.js +1 -0
- package/components/p-CzErFq8K.js +1 -0
- package/components/p-CzHtwC1k.js +1 -0
- package/components/p-CzjK_fJj.js +1 -0
- package/components/p-D4Joi-Km.js +1 -0
- package/components/p-D4am7l6X.js +1 -0
- package/components/p-D7kqIlVo.js +1 -0
- package/components/p-DFzUUEiS.js +1 -0
- package/components/p-DINdyuGa.js +1 -0
- package/components/p-DIZuWptV.js +1 -0
- package/components/p-DPo53FC8.js +1 -0
- package/components/p-DPt8hDp3.js +1 -0
- package/components/p-DSC5zsOB.js +1 -0
- package/components/{p-Co3Y9VjQ.js → p-DSa1uqPO.js} +1 -1
- package/components/p-DT7-VE44.js +1 -0
- package/components/p-DTPUsC3Q.js +1 -0
- package/components/p-DUjF0MeP.js +1 -0
- package/components/p-DXMO8s1V.js +1 -0
- package/components/p-DZtvVtvb.js +1 -0
- package/components/p-D_184xNl.js +1 -0
- package/components/p-D_hKBumm.js +1 -0
- package/components/p-Da7AZprv.js +1 -0
- package/components/p-DcqkhKqy.js +1 -0
- package/components/p-Dkga4pDL.js +1 -0
- package/components/p-Dn1c0e9W.js +1 -0
- package/components/p-DobuHW4v.js +1 -0
- package/components/p-DqayamUz.js +1 -0
- package/components/{p-Cd919NAP.js → p-DtIk7IPf.js} +1 -1
- package/components/p-DwySgZYx.js +1 -0
- package/components/p-DynL8Hj8.js +1 -0
- package/components/p-EYMvnfpO.js +1 -0
- package/components/p-K2tV3sog.js +1 -0
- package/components/p-LX68sH4m.js +1 -0
- package/components/{p-CKVSyuIH.js → p-MRcLOacJ.js} +1 -1
- package/components/p-N4_1eZ9k.js +1 -0
- package/components/p-PNU1f8B9.js +1 -0
- package/components/p-SFcKtdEL.js +1 -0
- package/components/p-VezrLuwj.js +1 -0
- package/components/p-eF_oZrS1.js +1 -0
- package/components/p-ez-wfqCC.js +1 -0
- package/components/p-gQbQhfDs.js +1 -0
- package/components/p-ibXnjCdF.js +1 -0
- package/components/p-jTIj1nFL.js +1 -0
- package/components/p-k2uLDFNn.js +1 -0
- package/components/p-pK9HRi91.js +1 -0
- package/components/p-sijpPVRP.js +1 -0
- package/components/p-tMIvQ4L0.js +1 -0
- package/components/p-yktKa2eA.js +1 -0
- package/components/x-address.js +1 -1
- package/components/x-affix.d.ts +0 -0
- package/components/x-affix.js +1 -1
- package/components/x-alert.d.ts +0 -0
- package/components/x-alert.js +1 -1
- package/components/x-anchor-link.d.ts +0 -0
- package/components/x-anchor-link.js +1 -1
- package/components/x-anchor.d.ts +0 -0
- package/components/x-anchor.js +1 -1
- package/components/x-app.d.ts +0 -0
- package/components/x-app.js +1 -1
- package/components/x-auto-complete-dropdown-content.d.ts +0 -0
- package/components/x-auto-complete-dropdown-content.js +1 -1
- package/components/x-auto-complete.d.ts +0 -0
- package/components/x-auto-complete.js +1 -1
- package/components/x-avatar.d.ts +0 -0
- package/components/x-avatar.js +1 -1
- package/components/x-back-top.js +1 -1
- package/components/x-badge.d.ts +0 -0
- package/components/x-badge.js +1 -1
- package/components/x-breadcrumb-item.d.ts +0 -0
- package/components/x-breadcrumb-item.js +1 -1
- package/components/x-breadcrumb.d.ts +0 -0
- package/components/x-breadcrumb.js +1 -1
- package/components/x-button.d.ts +0 -0
- package/components/x-button.js +1 -1
- package/components/x-captcha.js +1 -1
- package/components/x-card.d.ts +0 -0
- package/components/x-card.js +1 -1
- package/components/x-carousel.d.ts +0 -0
- package/components/x-carousel.js +1 -1
- package/components/x-cascader-dropdown-content.d.ts +0 -0
- package/components/x-cascader-dropdown-content.js +1 -1
- package/components/x-cascader.d.ts +0 -0
- package/components/x-cascader.js +1 -1
- package/components/x-checkbox.d.ts +0 -0
- package/components/x-checkbox.js +1 -1
- package/components/x-code-editor.d.ts +11 -0
- package/components/x-code-editor.js +1 -0
- package/components/x-col.d.ts +0 -0
- package/components/x-col.js +1 -1
- package/components/x-collapse-panel.d.ts +0 -0
- package/components/x-collapse-panel.js +1 -1
- package/components/x-collapse.d.ts +0 -0
- package/components/x-collapse.js +1 -1
- package/components/x-color-picker-panel.d.ts +0 -0
- package/components/x-color-picker-panel.js +1 -1
- package/components/x-color-picker.d.ts +0 -0
- package/components/x-color-picker.js +1 -1
- package/components/x-comment.d.ts +0 -0
- package/components/x-comment.js +1 -1
- package/components/x-content.d.ts +0 -0
- package/components/x-content.js +1 -1
- package/components/x-date-picker-dropdown-content.d.ts +0 -0
- package/components/x-date-picker-dropdown-content.js +1 -1
- package/components/x-date-picker.d.ts +0 -0
- package/components/x-date-picker.js +1 -1
- package/components/x-descriptions-item.d.ts +0 -0
- package/components/x-descriptions-item.js +1 -1
- package/components/x-descriptions.d.ts +0 -0
- package/components/x-descriptions.js +1 -1
- package/components/x-divider.d.ts +0 -0
- package/components/x-divider.js +1 -1
- package/components/x-drawer-content.d.ts +0 -0
- package/components/x-drawer-content.js +1 -1
- package/components/x-drawer.d.ts +0 -0
- package/components/x-drawer.js +1 -1
- package/components/x-dropdown-content.d.ts +0 -0
- package/components/x-dropdown-content.js +1 -1
- package/components/x-dropdown.d.ts +0 -0
- package/components/x-dropdown.js +1 -1
- package/components/x-editor.d.ts +0 -0
- package/components/x-editor.js +1 -1
- package/components/x-empty.d.ts +0 -0
- package/components/x-empty.js +1 -1
- package/components/x-finder.d.ts +0 -0
- package/components/x-finder.js +1 -1
- package/components/x-flex.d.ts +0 -0
- package/components/x-flex.js +1 -1
- package/components/x-float-button.d.ts +0 -0
- package/components/x-float-button.js +1 -1
- package/components/x-footer.d.ts +0 -0
- package/components/x-footer.js +1 -1
- package/components/x-form-builder.d.ts +0 -0
- package/components/x-form-builder.js +1 -1
- package/components/x-form-item.d.ts +0 -0
- package/components/x-form-item.js +1 -1
- package/components/x-form.d.ts +0 -0
- package/components/x-form.js +1 -1
- package/components/x-header.d.ts +0 -0
- package/components/x-header.js +1 -1
- package/components/x-icon-picker-dropdown-content.d.ts +11 -0
- package/components/x-icon-picker-dropdown-content.js +1 -0
- package/components/x-icon.d.ts +0 -0
- package/components/x-icon.js +1 -1
- package/components/x-image.d.ts +0 -0
- package/components/x-image.js +1 -1
- package/components/x-infinite-scroll.d.ts +0 -0
- package/components/x-infinite-scroll.js +1 -1
- package/components/x-input-icon.d.ts +11 -0
- package/components/x-input-icon.js +1 -0
- package/components/x-input-number.d.ts +0 -0
- package/components/x-input-number.js +1 -1
- package/components/x-input.d.ts +0 -0
- package/components/x-input.js +1 -1
- package/components/x-layout-admin.d.ts +11 -0
- package/components/x-layout-admin.js +1 -0
- package/components/x-layout-detail.d.ts +11 -0
- package/components/x-layout-detail.js +1 -0
- package/components/x-layout-list.d.ts +11 -0
- package/components/x-layout-list.js +1 -0
- package/components/x-layout.d.ts +0 -0
- package/components/x-layout.js +1 -1
- package/components/x-list-item.js +1 -1
- package/components/x-list.d.ts +0 -0
- package/components/x-list.js +1 -1
- package/components/x-login.d.ts +11 -0
- package/components/x-login.js +1 -0
- package/components/x-mentions.d.ts +0 -0
- package/components/x-mentions.js +1 -1
- package/components/x-menu-divider.d.ts +0 -0
- package/components/x-menu-divider.js +1 -1
- package/components/x-menu-item-group.d.ts +0 -0
- package/components/x-menu-item-group.js +1 -1
- package/components/x-menu-item.d.ts +0 -0
- package/components/x-menu-item.js +1 -1
- package/components/x-menu-submenu.d.ts +0 -0
- package/components/x-menu-submenu.js +1 -1
- package/components/x-menu.d.ts +0 -0
- package/components/x-menu.js +1 -1
- package/components/x-message.d.ts +0 -0
- package/components/x-message.js +1 -1
- package/components/x-modal-content.d.ts +0 -0
- package/components/x-modal-content.js +1 -1
- package/components/x-modal.d.ts +0 -0
- package/components/x-modal.js +1 -1
- package/components/x-notification.d.ts +0 -0
- package/components/x-notification.js +1 -1
- package/components/x-page-header.js +1 -1
- package/components/x-pagination.d.ts +0 -0
- package/components/x-pagination.js +1 -1
- package/components/x-popconfirm-content.d.ts +0 -0
- package/components/x-popconfirm-content.js +1 -1
- package/components/x-popconfirm.d.ts +0 -0
- package/components/x-popconfirm.js +1 -1
- package/components/x-popover-content.d.ts +0 -0
- package/components/x-popover-content.js +1 -1
- package/components/x-popover.d.ts +0 -0
- package/components/x-popover.js +1 -1
- package/components/x-progress.d.ts +0 -0
- package/components/x-progress.js +1 -1
- package/components/x-qr-code.d.ts +0 -0
- package/components/x-qr-code.js +1 -1
- package/components/x-radio-group.d.ts +0 -0
- package/components/x-radio-group.js +1 -1
- package/components/x-radio.d.ts +0 -0
- package/components/x-radio.js +1 -1
- package/components/x-range-picker-dropdown-content.d.ts +0 -0
- package/components/x-range-picker-dropdown-content.js +1 -1
- package/components/x-range-picker.d.ts +0 -0
- package/components/x-range-picker.js +1 -1
- package/components/x-rate.d.ts +0 -0
- package/components/x-rate.js +1 -1
- package/components/x-result.d.ts +0 -0
- package/components/x-result.js +1 -1
- package/components/x-row.d.ts +0 -0
- package/components/x-row.js +1 -1
- package/components/x-segmented.d.ts +0 -0
- package/components/x-segmented.js +1 -1
- package/components/x-select-dropdown-content.d.ts +0 -0
- package/components/x-select-dropdown-content.js +1 -1
- package/components/x-select-option.d.ts +0 -0
- package/components/x-select-option.js +1 -1
- package/components/x-select.d.ts +0 -0
- package/components/x-select.js +1 -1
- package/components/x-sider.d.ts +0 -0
- package/components/x-sider.js +1 -1
- package/components/x-skeleton.d.ts +0 -0
- package/components/x-skeleton.js +1 -1
- package/components/x-slider.d.ts +0 -0
- package/components/x-slider.js +1 -1
- package/components/x-space.d.ts +0 -0
- package/components/x-space.js +1 -1
- package/components/x-spin.d.ts +0 -0
- package/components/x-spin.js +1 -1
- package/components/x-splitter-panel.d.ts +0 -0
- package/components/x-splitter-panel.js +1 -1
- package/components/x-splitter.d.ts +0 -0
- package/components/x-splitter.js +1 -1
- package/components/x-statistic.d.ts +0 -0
- package/components/x-statistic.js +1 -1
- package/components/x-step.d.ts +0 -0
- package/components/x-step.js +1 -1
- package/components/x-steps.d.ts +0 -0
- package/components/x-steps.js +1 -1
- package/components/x-switch.d.ts +0 -0
- package/components/x-switch.js +1 -1
- package/components/x-tab-pane.js +1 -1
- package/components/x-table-cell.d.ts +0 -0
- package/components/x-table-cell.js +1 -1
- package/components/x-table-row.d.ts +0 -0
- package/components/x-table-row.js +1 -1
- package/components/x-table.d.ts +0 -0
- package/components/x-table.js +1 -1
- package/components/x-tabs.d.ts +0 -0
- package/components/x-tabs.js +1 -1
- package/components/x-tag.d.ts +0 -0
- package/components/x-tag.js +1 -1
- package/components/x-textarea.d.ts +0 -0
- package/components/x-textarea.js +1 -1
- package/components/x-time-picker-dropdown-content.d.ts +0 -0
- package/components/x-time-picker-dropdown-content.js +1 -1
- package/components/x-time-picker.d.ts +0 -0
- package/components/x-time-picker.js +1 -1
- package/components/x-timeline-item.d.ts +0 -0
- package/components/x-timeline-item.js +1 -1
- package/components/x-timeline.d.ts +0 -0
- package/components/x-timeline.js +1 -1
- package/components/x-tooltip-content.d.ts +0 -0
- package/components/x-tooltip-content.js +1 -1
- package/components/x-tooltip.d.ts +0 -0
- package/components/x-tooltip.js +1 -1
- package/components/x-tour-panel.d.ts +0 -0
- package/components/x-tour-panel.js +1 -1
- package/components/x-tour.d.ts +0 -0
- package/components/x-tour.js +1 -1
- package/components/x-transfer.d.ts +0 -0
- package/components/x-transfer.js +1 -1
- package/components/x-tree-select-dropdown-content.js +1 -1
- package/components/x-tree-select.d.ts +0 -0
- package/components/x-tree-select.js +1 -1
- package/components/x-tree.d.ts +0 -0
- package/components/x-tree.js +1 -1
- package/components/x-typography.d.ts +0 -0
- package/components/x-typography.js +1 -1
- package/components/x-upload.d.ts +0 -0
- package/components/x-upload.js +1 -1
- package/components/x-virtual-scroll.d.ts +0 -0
- package/components/x-virtual-scroll.js +1 -1
- package/components/x-workflow-builder.d.ts +0 -0
- package/components/x-workflow-builder.js +1 -1
- package/components/x-workflow.d.ts +0 -0
- package/components/x-workflow.js +1 -1
- package/dist/cjs/{abstract-control-C4D0eNCC.js → abstract-control-JI4_szTV.js} +40 -14
- package/dist/cjs/{config-BP9bROYD.js → config-BYR5qIIZ.js} +3 -3
- package/dist/cjs/icons-BfHE2jcr.js +19261 -0
- package/dist/cjs/{index-C7sKs9A2.js → index-Cy2P_ln3.js} +39 -12
- package/dist/cjs/index.cjs.js +7 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{locale.service-Cz-aZQnr.js → locale.service-DT6E8Rzd.js} +17 -9
- package/dist/cjs/{modal-service-BtAF0mFq.js → modal-service-FQpCPk_L.js} +34 -14
- package/dist/cjs/{notification-service-m6I5U9aG.js → notification-service-v7LRmTyh.js} +12 -13
- package/dist/cjs/{portal-controller-CtYVbhXL.js → portal-controller-DJft2QkA.js} +11 -16
- package/dist/cjs/{schema-builder-CYnX7lKi.js → schema-builder-DAwDwgIM.js} +385 -99
- package/dist/cjs/{tree.service-fxLOCSpD.js → tree.service-u0qqS1Qh.js} +22 -22
- package/dist/cjs/x-address_51.cjs.entry.js +26978 -0
- package/dist/cjs/x-affix.cjs.entry.js +5 -5
- package/dist/cjs/{x-alert_11.cjs.entry.js → x-alert_9.cjs.entry.js} +267 -646
- package/dist/cjs/x-anchor-link.cjs.entry.js +3 -3
- package/dist/cjs/x-anchor.cjs.entry.js +11 -9
- package/dist/cjs/x-app.cjs.entry.js +19 -19
- package/dist/cjs/x-back-top.cjs.entry.js +4 -4
- package/dist/cjs/x-breadcrumb_2.cjs.entry.js +124 -0
- package/dist/cjs/x-carousel.cjs.entry.js +7 -7
- package/dist/cjs/x-code-editor.cjs.entry.js +2365 -0
- package/dist/cjs/x-col_11.cjs.entry.js +1204 -0
- package/dist/cjs/x-collapse-panel.cjs.entry.js +4 -4
- package/dist/cjs/x-collapse.cjs.entry.js +4 -4
- package/dist/cjs/x-comment.cjs.entry.js +5 -5
- package/dist/cjs/x-descriptions-item.cjs.entry.js +6 -6
- package/dist/cjs/{x-breadcrumb_5.cjs.entry.js → x-descriptions_3.cjs.entry.js} +36 -157
- package/dist/cjs/x-drawer-content.cjs.entry.js +8 -8
- package/dist/cjs/x-drawer.cjs.entry.js +9 -7
- package/dist/cjs/x-finder.cjs.entry.js +39 -32
- package/dist/cjs/x-icon-picker-dropdown-content.cjs.entry.js +158 -0
- package/dist/cjs/x-infinite-scroll.cjs.entry.js +4 -4
- package/dist/cjs/x-input-icon.cjs.entry.js +361 -0
- package/dist/cjs/x-layout-admin.cjs.entry.js +45 -0
- package/dist/cjs/x-layout-detail.cjs.entry.js +145 -0
- package/dist/cjs/x-layout-list.cjs.entry.js +259 -0
- package/dist/cjs/x-list-item.cjs.entry.js +3 -3
- package/dist/cjs/{x-menu-submenu.cjs.entry.js → x-list_2.cjs.entry.js} +141 -7
- package/dist/cjs/x-mentions.cjs.entry.js +6 -6
- package/dist/cjs/x-menu-divider.cjs.entry.js +2 -2
- package/dist/cjs/x-menu-item-group.cjs.entry.js +2 -2
- package/dist/cjs/x-menu_2.cjs.entry.js +509 -0
- package/dist/cjs/x-message.cjs.entry.js +7 -7
- package/dist/cjs/x-notification.cjs.entry.js +7 -7
- package/dist/cjs/x-page-header.cjs.entry.js +3 -3
- package/dist/cjs/x-popconfirm-content.cjs.entry.js +4 -4
- package/dist/cjs/x-popconfirm.cjs.entry.js +5 -5
- package/dist/cjs/x-progress.cjs.entry.js +10 -10
- package/dist/cjs/x-qr-code.cjs.entry.js +11 -9
- package/dist/cjs/x-skeleton.cjs.entry.js +5 -5
- package/dist/cjs/x-splitter-panel.cjs.entry.js +2 -2
- package/dist/cjs/x-splitter.cjs.entry.js +11 -5
- package/dist/cjs/x-statistic.cjs.entry.js +3 -3
- package/dist/cjs/x-step.cjs.entry.js +7 -7
- package/dist/cjs/x-steps.cjs.entry.js +6 -8
- package/dist/cjs/x-table-cell.cjs.entry.js +4 -4
- package/dist/cjs/x-table-row.cjs.entry.js +13 -10
- package/dist/cjs/x-timeline-item.cjs.entry.js +4 -4
- package/dist/cjs/x-timeline.cjs.entry.js +4 -4
- package/dist/cjs/x-tour-panel.cjs.entry.js +3 -3
- package/dist/cjs/x-tour.cjs.entry.js +16 -16
- package/dist/cjs/x-virtual-scroll.cjs.entry.js +5 -5
- package/dist/cjs/x-workflow-builder.cjs.entry.js +8 -8
- package/dist/cjs/xlabs.cjs.js +24 -0
- package/dist/collection/collection-manifest.json +8 -1
- package/dist/collection/components/x-address/vietnam-data.js +3 -3
- package/dist/collection/components/x-address/x-address.css +5 -2
- package/dist/collection/components/x-address/x-address.js +8 -10
- package/dist/collection/components/x-affix/x-affix.js +4 -4
- package/dist/collection/components/x-alert/x-alert.css +5 -2
- package/dist/collection/components/x-alert/x-alert.js +1 -1
- package/dist/collection/components/x-anchor/x-anchor.js +16 -8
- package/dist/collection/components/x-anchor-link/x-anchor-link.js +2 -2
- package/dist/collection/components/x-app/x-app.js +15 -15
- package/dist/collection/components/x-auto-complete/auto-complete-dropdown-content/auto-complete-dropdown-content.css +5 -2
- package/dist/collection/components/x-auto-complete/auto-complete-dropdown-content/auto-complete-dropdown-content.js +1 -1
- package/dist/collection/components/x-auto-complete/types.js +2 -5
- package/dist/collection/components/x-auto-complete/x-auto-complete.css +5 -2
- package/dist/collection/components/x-auto-complete/x-auto-complete.js +52 -25
- package/dist/collection/components/x-avatar/x-avatar.js +23 -14
- package/dist/collection/components/x-back-top/x-back-top.js +3 -3
- package/dist/collection/components/x-badge/x-badge.js +3 -7
- package/dist/collection/components/x-breadcrumb/x-breadcrumb.js +3 -3
- package/dist/collection/components/x-breadcrumb-item/x-breadcrumb-item.js +1 -1
- package/dist/collection/components/x-button/x-button.js +7 -7
- package/dist/collection/components/x-captcha/x-captcha.js +28 -8
- package/dist/collection/components/x-card/x-card.css +9 -4
- package/dist/collection/components/x-card/x-card.js +1 -1
- package/dist/collection/components/x-carousel/x-carousel.css +5 -2
- package/dist/collection/components/x-carousel/x-carousel.js +5 -5
- package/dist/collection/components/x-cascader/cascader-dropdown-content/cascader-dropdown-content.css +5 -2
- package/dist/collection/components/x-cascader/cascader-dropdown-content/cascader-dropdown-content.js +9 -9
- package/dist/collection/components/x-cascader/x-cascader.css +5 -2
- package/dist/collection/components/x-cascader/x-cascader.js +17 -20
- package/dist/collection/components/x-checkbox/x-checkbox.css +5 -2
- package/dist/collection/components/x-checkbox/x-checkbox.js +9 -19
- package/dist/collection/components/x-code-editor/types.js +1 -0
- package/dist/collection/components/x-code-editor/x-code-editor.css +1274 -0
- package/dist/collection/components/x-code-editor/x-code-editor.js +1497 -0
- package/dist/collection/components/x-col/x-col.css +5 -2
- package/dist/collection/components/x-col/x-col.js +14 -14
- package/dist/collection/components/x-collapse/x-collapse.css +5 -2
- package/dist/collection/components/x-collapse/x-collapse.js +4 -4
- package/dist/collection/components/x-collapse-panel/x-collapse-panel.css +5 -2
- package/dist/collection/components/x-collapse-panel/x-collapse-panel.js +4 -4
- package/dist/collection/components/x-color-picker/x-color-picker-panel.js +6 -8
- package/dist/collection/components/x-color-picker/x-color-picker.css +5 -2
- package/dist/collection/components/x-color-picker/x-color-picker.js +72 -12
- package/dist/collection/components/x-comment/x-comment.css +5 -2
- package/dist/collection/components/x-comment/x-comment.js +3 -3
- package/dist/collection/components/x-content/x-content.css +5 -4
- package/dist/collection/components/x-content/x-content.js +3 -3
- package/dist/collection/components/x-date-picker/date-picker-dropdown-content/date-picker-dropdown-content.css +7 -3
- package/dist/collection/components/x-date-picker/date-picker-dropdown-content/date-picker-dropdown-content.js +5 -9
- package/dist/collection/components/x-date-picker/x-date-picker.css +5 -2
- package/dist/collection/components/x-date-picker/x-date-picker.js +65 -23
- package/dist/collection/components/x-descriptions/x-descriptions.css +5 -2
- package/dist/collection/components/x-descriptions/x-descriptions.js +3 -3
- package/dist/collection/components/x-descriptions-item/x-descriptions-item.css +5 -2
- package/dist/collection/components/x-descriptions-item/x-descriptions-item.js +4 -4
- package/dist/collection/components/x-divider/x-divider.css +5 -2
- package/dist/collection/components/x-divider/x-divider.js +3 -3
- package/dist/collection/components/x-drawer/x-drawer.css +5 -2
- package/dist/collection/components/x-drawer/x-drawer.js +6 -4
- package/dist/collection/components/x-drawer-content/x-drawer-content.css +5 -2
- package/dist/collection/components/x-drawer-content/x-drawer-content.js +4 -4
- package/dist/collection/components/x-dropdown/dropdown-content/dropdown-content.css +5 -2
- package/dist/collection/components/x-dropdown/dropdown-content/dropdown-content.js +1 -1
- package/dist/collection/components/x-dropdown/x-dropdown.css +5 -2
- package/dist/collection/components/x-dropdown/x-dropdown.js +34 -12
- package/dist/collection/components/x-editor/types.js +4 -6
- package/dist/collection/components/x-editor/x-editor.css +25 -10
- package/dist/collection/components/x-editor/x-editor.js +80 -74
- package/dist/collection/components/x-empty/x-empty.css +5 -2
- package/dist/collection/components/x-empty/x-empty.js +1 -1
- package/dist/collection/components/x-finder/services/finder-service.js +7 -9
- package/dist/collection/components/x-finder/x-finder.css +10 -4
- package/dist/collection/components/x-finder/x-finder.js +28 -19
- package/dist/collection/components/x-flex/x-flex.css +5 -2
- package/dist/collection/components/x-flex/x-flex.js +5 -7
- package/dist/collection/components/x-float-button/x-float-button.css +5 -2
- package/dist/collection/components/x-float-button/x-float-button.js +4 -4
- package/dist/collection/components/x-footer/x-footer.css +5 -2
- package/dist/collection/components/x-footer/x-footer.js +1 -1
- package/dist/collection/components/x-form/x-form.css +5 -2
- package/dist/collection/components/x-form/x-form.js +98 -3
- package/dist/collection/components/x-form-builder/services/apis/api-client.js +24 -15
- package/dist/collection/components/x-form-builder/services/forms/form-array.js +3 -5
- package/dist/collection/components/x-form-builder/services/forms/form-group.js +6 -6
- package/dist/collection/components/x-form-builder/services/forms/validators.js +20 -10
- package/dist/collection/components/x-form-builder/services/schema/condition-builder.js +73 -50
- package/dist/collection/components/x-form-builder/services/schema/default-registry.js +108 -87
- package/dist/collection/components/x-form-builder/services/schema/form-mapping.js +80 -5
- package/dist/collection/components/x-form-builder/services/schema/formula-builder.js +114 -0
- package/dist/collection/components/x-form-builder/services/schema/schema-builder.js +7 -2
- package/dist/collection/components/x-form-builder/services/schema/schema-validator.js +1 -1
- package/dist/collection/components/x-form-builder/types/common/index.js +1 -0
- package/dist/collection/components/x-form-builder/types/common/ui-types.js +1 -0
- package/dist/collection/components/x-form-builder/types/fields/selection-fields.js +1 -9
- package/dist/collection/components/x-form-builder/utils/condition-engine.js +56 -14
- package/dist/collection/components/x-form-builder/utils/utils.js +25 -6
- package/dist/collection/components/x-form-builder/x-form-builder.js +559 -206
- package/dist/collection/components/x-form-item/x-form-item.css +16 -10
- package/dist/collection/components/x-form-item/x-form-item.js +46 -28
- package/dist/collection/components/x-header/x-header.css +5 -2
- package/dist/collection/components/x-header/x-header.js +1 -1
- package/dist/collection/components/x-icon/icons.js +19257 -2716
- package/dist/collection/components/x-icon/x-icon.css +5 -2
- package/dist/collection/components/x-icon/x-icon.js +6 -6
- package/dist/collection/components/x-image/x-image.css +5 -2
- package/dist/collection/components/x-image/x-image.js +6 -6
- package/dist/collection/components/x-infinite-scroll/x-infinite-scroll.css +5 -2
- package/dist/collection/components/x-infinite-scroll/x-infinite-scroll.js +2 -2
- package/dist/collection/components/x-input/x-input.css +25 -2
- package/dist/collection/components/x-input/x-input.js +38 -9
- package/dist/collection/components/x-input-icon/icon-picker-dropdown-content/icon-picker-dropdown-content.css +453 -0
- package/dist/collection/components/x-input-icon/icon-picker-dropdown-content/icon-picker-dropdown-content.js +304 -0
- package/dist/collection/components/x-input-icon/types.js +1 -0
- package/dist/collection/components/x-input-icon/x-input-icon.css +404 -0
- package/dist/collection/components/x-input-icon/x-input-icon.js +917 -0
- package/dist/collection/components/x-input-number/x-input-number.css +5 -2
- package/dist/collection/components/x-input-number/x-input-number.js +108 -13
- package/dist/collection/components/x-layout/x-layout.css +5 -2
- package/dist/collection/components/x-layout/x-layout.js +11 -5
- package/dist/collection/components/x-layout-admin/x-layout-admin.css +403 -0
- package/dist/collection/components/x-layout-admin/x-layout-admin.js +127 -0
- package/dist/collection/components/x-layout-detail/x-layout-detail.css +479 -0
- package/dist/collection/components/x-layout-detail/x-layout-detail.js +300 -0
- package/dist/collection/components/x-layout-list/types.js +1 -0
- package/dist/collection/components/x-layout-list/x-layout-list.css +511 -0
- package/dist/collection/components/x-layout-list/x-layout-list.js +619 -0
- package/dist/collection/components/x-list/x-list.css +5 -2
- package/dist/collection/components/x-list/x-list.js +3 -3
- package/dist/collection/components/x-list-item/x-list-item.css +5 -2
- package/dist/collection/components/x-list-item/x-list-item.js +1 -1
- package/dist/collection/components/x-login/types.js +1 -0
- package/dist/collection/components/x-login/x-login.css +562 -0
- package/dist/collection/components/x-login/x-login.js +706 -0
- package/dist/collection/components/x-mentions/x-mentions.css +5 -2
- package/dist/collection/components/x-mentions/x-mentions.js +4 -4
- package/dist/collection/components/x-menu/x-menu.js +1 -1
- package/dist/collection/components/x-menu-divider/x-menu-divider.js +1 -1
- package/dist/collection/components/x-menu-item/x-menu-item.js +2 -2
- package/dist/collection/components/x-menu-item-group/x-menu-item-group.js +1 -1
- package/dist/collection/components/x-menu-submenu/x-menu-submenu.js +5 -5
- package/dist/collection/components/x-message/message-service.js +2 -2
- package/dist/collection/components/x-message/x-message.css +5 -2
- package/dist/collection/components/x-message/x-message.js +5 -5
- package/dist/collection/components/x-modal/modal-service.js +33 -13
- package/dist/collection/components/x-modal/x-modal.css +5 -2
- package/dist/collection/components/x-modal/x-modal.js +148 -47
- package/dist/collection/components/x-modal-content/x-modal-content.css +110 -18
- package/dist/collection/components/x-modal-content/x-modal-content.js +157 -12
- package/dist/collection/components/x-notification/notification-service.js +9 -10
- package/dist/collection/components/x-notification/x-notification.css +6 -2
- package/dist/collection/components/x-notification/x-notification.js +4 -4
- package/dist/collection/components/x-page-header/x-page-header.css +5 -2
- package/dist/collection/components/x-page-header/x-page-header.js +1 -1
- package/dist/collection/components/x-pagination/x-pagination.css +11 -2
- package/dist/collection/components/x-pagination/x-pagination.js +18 -14
- package/dist/collection/components/x-popconfirm/popconfirm-content/popconfirm-content.css +5 -2
- package/dist/collection/components/x-popconfirm/popconfirm-content/popconfirm-content.js +1 -1
- package/dist/collection/components/x-popconfirm/x-popconfirm.css +5 -2
- package/dist/collection/components/x-popconfirm/x-popconfirm.js +1 -1
- package/dist/collection/components/x-popover/popover-content/popover-content.css +5 -2
- package/dist/collection/components/x-popover/popover-content/popover-content.js +1 -1
- package/dist/collection/components/x-popover/x-popover.css +5 -2
- package/dist/collection/components/x-popover/x-popover.js +1 -1
- package/dist/collection/components/x-portal/positioning.js +11 -16
- package/dist/collection/components/x-progress/x-progress.css +5 -2
- package/dist/collection/components/x-progress/x-progress.js +8 -8
- package/dist/collection/components/x-qr-code/x-qr-code.css +2 -1
- package/dist/collection/components/x-qr-code/x-qr-code.js +23 -1
- package/dist/collection/components/x-radio/x-radio.css +5 -2
- package/dist/collection/components/x-radio/x-radio.js +5 -5
- package/dist/collection/components/x-radio-group/x-radio-group.css +5 -2
- package/dist/collection/components/x-radio-group/x-radio-group.js +6 -8
- package/dist/collection/components/x-range-picker/range-picker-dropdown-content/range-picker-dropdown-content.css +7 -3
- package/dist/collection/components/x-range-picker/range-picker-dropdown-content/range-picker-dropdown-content.js +13 -13
- package/dist/collection/components/x-range-picker/x-range-picker.css +5 -2
- package/dist/collection/components/x-range-picker/x-range-picker.js +9 -18
- package/dist/collection/components/x-rate/x-rate.css +5 -2
- package/dist/collection/components/x-rate/x-rate.js +3 -3
- package/dist/collection/components/x-result/x-result.css +5 -2
- package/dist/collection/components/x-result/x-result.js +11 -10
- package/dist/collection/components/x-row/x-row.css +5 -2
- package/dist/collection/components/x-row/x-row.js +4 -4
- package/dist/collection/components/x-segmented/x-segmented.css +5 -2
- package/dist/collection/components/x-segmented/x-segmented.js +8 -8
- package/dist/collection/components/x-select/select-dropdown-content/select-dropdown-content.css +11 -4
- package/dist/collection/components/x-select/select-dropdown-content/select-dropdown-content.js +1 -1
- package/dist/collection/components/x-select/x-select.css +11 -4
- package/dist/collection/components/x-select/x-select.js +33 -39
- package/dist/collection/components/x-select-option/x-select-option.css +5 -2
- package/dist/collection/components/x-select-option/x-select-option.js +3 -3
- package/dist/collection/components/x-sider/x-sider.css +7 -4
- package/dist/collection/components/x-sider/x-sider.js +7 -9
- package/dist/collection/components/x-skeleton/x-skeleton.css +5 -2
- package/dist/collection/components/x-skeleton/x-skeleton.js +3 -3
- package/dist/collection/components/x-slider/x-slider.css +5 -2
- package/dist/collection/components/x-slider/x-slider.js +11 -23
- package/dist/collection/components/x-space/x-space.css +5 -2
- package/dist/collection/components/x-space/x-space.js +4 -4
- package/dist/collection/components/x-spin/x-spin.css +5 -2
- package/dist/collection/components/x-spin/x-spin.js +1 -1
- package/dist/collection/components/x-splitter/x-splitter.js +14 -8
- package/dist/collection/components/x-splitter-panel/x-splitter-panel.js +1 -1
- package/dist/collection/components/x-statistic/x-statistic.css +5 -2
- package/dist/collection/components/x-statistic/x-statistic.js +1 -1
- package/dist/collection/components/x-step/x-step.css +5 -2
- package/dist/collection/components/x-step/x-step.js +5 -5
- package/dist/collection/components/x-steps/x-steps.css +5 -2
- package/dist/collection/components/x-steps/x-steps.js +4 -6
- package/dist/collection/components/x-switch/x-switch.css +5 -2
- package/dist/collection/components/x-switch/x-switch.js +7 -4
- package/dist/collection/components/x-tab-pane/x-tab-pane.css +5 -2
- package/dist/collection/components/x-tab-pane/x-tab-pane.js +58 -2
- package/dist/collection/components/x-table/x-table.css +187 -41
- package/dist/collection/components/x-table/x-table.js +257 -105
- package/dist/collection/components/x-table-cell/x-table-cell.css +5 -2
- package/dist/collection/components/x-table-cell/x-table-cell.js +2 -2
- package/dist/collection/components/x-table-row/x-table-row.css +5 -2
- package/dist/collection/components/x-table-row/x-table-row.js +11 -8
- package/dist/collection/components/x-tabs/x-tabs.css +17 -2
- package/dist/collection/components/x-tabs/x-tabs.js +130 -12
- package/dist/collection/components/x-tag/x-tag.css +6 -3
- package/dist/collection/components/x-tag/x-tag.js +1 -4
- package/dist/collection/components/x-textarea/x-textarea.css +5 -2
- package/dist/collection/components/x-textarea/x-textarea.js +5 -5
- package/dist/collection/components/x-time-picker/time-picker-dropdown-content/time-picker-dropdown-content.css +5 -2
- package/dist/collection/components/x-time-picker/time-picker-dropdown-content/time-picker-dropdown-content.js +1 -1
- package/dist/collection/components/x-time-picker/x-time-picker.css +5 -2
- package/dist/collection/components/x-time-picker/x-time-picker.js +4 -7
- package/dist/collection/components/x-timeline/x-timeline.css +5 -2
- package/dist/collection/components/x-timeline/x-timeline.js +2 -2
- package/dist/collection/components/x-timeline-item/x-timeline-item.css +5 -2
- package/dist/collection/components/x-timeline-item/x-timeline-item.js +2 -2
- package/dist/collection/components/x-tooltip/x-tooltip.css +5 -2
- package/dist/collection/components/x-tooltip/x-tooltip.js +6 -8
- package/dist/collection/components/x-tooltip-content/x-tooltip-content.js +2 -2
- package/dist/collection/components/x-tour/x-tour-panel.css +5 -2
- package/dist/collection/components/x-tour/x-tour-panel.js +1 -1
- package/dist/collection/components/x-tour/x-tour.css +5 -2
- package/dist/collection/components/x-tour/x-tour.js +15 -15
- package/dist/collection/components/x-transfer/x-transfer.css +5 -2
- package/dist/collection/components/x-transfer/x-transfer.js +8 -8
- package/dist/collection/components/x-tree/x-tree.css +5 -2
- package/dist/collection/components/x-tree/x-tree.js +25 -26
- package/dist/collection/components/x-tree-select/tree-select-dropdown-content/tree-select-dropdown-content.css +5 -2
- package/dist/collection/components/x-tree-select/tree-select-dropdown-content/tree-select-dropdown-content.js +6 -6
- package/dist/collection/components/x-tree-select/x-tree-select.css +5 -2
- package/dist/collection/components/x-tree-select/x-tree-select.js +21 -31
- package/dist/collection/components/x-typography/x-typography.css +10 -3
- package/dist/collection/components/x-typography/x-typography.js +12 -12
- package/dist/collection/components/x-upload/x-upload.css +5 -2
- package/dist/collection/components/x-upload/x-upload.js +342 -48
- package/dist/collection/components/x-virtual-scroll/x-virtual-scroll.js +5 -5
- package/dist/collection/components/x-workflow/x-workflow.css +3 -1
- package/dist/collection/components/x-workflow/x-workflow.js +81 -66
- package/dist/collection/components/x-workflow-builder/x-workflow-builder.css +5 -2
- package/dist/collection/components/x-workflow-builder/x-workflow-builder.js +6 -6
- package/dist/collection/index.js +2 -0
- package/dist/collection/locales/languages/mn_MN.js +14 -1
- package/dist/collection/locales/locale.service.js +4 -9
- package/dist/collection/utils/code-editor/ast-parser.js +378 -0
- package/dist/collection/utils/code-editor/autocomplete-db.js +590 -0
- package/dist/collection/utils/code-editor/history.js +56 -0
- package/dist/collection/utils/code-editor/index.js +4 -0
- package/dist/collection/utils/code-editor/plugin-system.js +54 -0
- package/dist/collection/utils/code-editor/tokenizer.js +300 -0
- package/dist/collection/utils/config.js +3 -3
- package/dist/collection/utils/form/core/abstract-control.js +40 -14
- package/dist/collection/utils/form/core/form-array.js +7 -5
- package/dist/collection/utils/form/core/form-group.js +8 -4
- package/dist/collection/utils/form/frameworks.js +7 -3
- package/dist/collection/utils/form/validators/validators.js +3 -9
- package/dist/collection/utils/qr-code/engine/qr.engine.js +3 -3
- package/dist/collection/utils/qr-code/engine/qr.mask.js +3 -3
- package/dist/collection/utils/qr-code/engine/qr.rs.js +1 -1
- package/dist/collection/utils/table.service.js +40 -14
- package/dist/collection/utils/tree.service.js +22 -22
- package/dist/collection/utils/workflow/flow.service.js +95 -30
- package/dist/esm/{abstract-control-XBF88YT_.js → abstract-control-BtYiIQqg.js} +40 -14
- package/dist/esm/{config-BPeosvTA.js → config-RKpMhZmc.js} +3 -3
- package/dist/esm/icons-CQ2VND9-.js +19259 -0
- package/dist/esm/{index-ig_mFsVk.js → index-BMTt8QT3.js} +39 -12
- package/dist/esm/index.js +6 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{locale.service-D66tF8_2.js → locale.service-DFADJBLL.js} +17 -9
- package/dist/esm/{modal-service-C_e0SaFZ.js → modal-service-ikfAY1gn.js} +34 -14
- package/dist/esm/{notification-service-DJTSPOq7.js → notification-service-CUyIF7K-.js} +12 -13
- package/dist/esm/{portal-controller-COpzIi1n.js → portal-controller-DM8AggMt.js} +11 -16
- package/dist/esm/{schema-builder-DBPGgJBx.js → schema-builder-CekbhOnD.js} +385 -99
- package/dist/esm/{tree.service-Dgxy93Bg.js → tree.service-iG9CbEpE.js} +22 -22
- package/dist/esm/x-address_51.entry.js +26926 -0
- package/dist/esm/x-affix.entry.js +5 -5
- package/dist/esm/{x-alert_11.entry.js → x-alert_9.entry.js} +268 -645
- package/dist/esm/x-anchor-link.entry.js +3 -3
- package/dist/esm/x-anchor.entry.js +11 -9
- package/dist/esm/x-app.entry.js +19 -19
- package/dist/esm/x-back-top.entry.js +4 -4
- package/dist/esm/x-breadcrumb_2.entry.js +121 -0
- package/dist/esm/x-carousel.entry.js +7 -7
- package/dist/esm/x-code-editor.entry.js +2363 -0
- package/dist/esm/x-col_11.entry.js +1192 -0
- package/dist/esm/x-collapse-panel.entry.js +4 -4
- package/dist/esm/x-collapse.entry.js +4 -4
- package/dist/esm/x-comment.entry.js +5 -5
- package/dist/esm/x-descriptions-item.entry.js +6 -6
- package/dist/esm/{x-breadcrumb_5.entry.js → x-descriptions_3.entry.js} +37 -156
- package/dist/esm/x-drawer-content.entry.js +8 -8
- package/dist/esm/x-drawer.entry.js +9 -7
- package/dist/esm/x-finder.entry.js +39 -32
- package/dist/esm/x-icon-picker-dropdown-content.entry.js +156 -0
- package/dist/esm/x-infinite-scroll.entry.js +4 -4
- package/dist/esm/x-input-icon.entry.js +359 -0
- package/dist/esm/x-layout-admin.entry.js +43 -0
- package/dist/esm/x-layout-detail.entry.js +143 -0
- package/dist/esm/x-layout-list.entry.js +257 -0
- package/dist/esm/x-list-item.entry.js +3 -3
- package/dist/esm/{x-menu-submenu.entry.js → x-list_2.entry.js} +141 -8
- package/dist/esm/x-mentions.entry.js +6 -6
- package/dist/esm/x-menu-divider.entry.js +2 -2
- package/dist/esm/x-menu-item-group.entry.js +2 -2
- package/dist/esm/x-menu_2.entry.js +506 -0
- package/dist/esm/x-message.entry.js +7 -7
- package/dist/esm/x-notification.entry.js +7 -7
- package/dist/esm/x-page-header.entry.js +3 -3
- package/dist/esm/x-popconfirm-content.entry.js +4 -4
- package/dist/esm/x-popconfirm.entry.js +5 -5
- package/dist/esm/x-progress.entry.js +10 -10
- package/dist/esm/x-qr-code.entry.js +11 -9
- package/dist/esm/x-skeleton.entry.js +5 -5
- package/dist/esm/x-splitter-panel.entry.js +2 -2
- package/dist/esm/x-splitter.entry.js +11 -5
- package/dist/esm/x-statistic.entry.js +3 -3
- package/dist/esm/x-step.entry.js +7 -7
- package/dist/esm/x-steps.entry.js +6 -8
- package/dist/esm/x-table-cell.entry.js +4 -4
- package/dist/esm/x-table-row.entry.js +13 -10
- package/dist/esm/x-timeline-item.entry.js +4 -4
- package/dist/esm/x-timeline.entry.js +4 -4
- package/dist/esm/x-tour-panel.entry.js +3 -3
- package/dist/esm/x-tour.entry.js +16 -16
- package/dist/esm/x-virtual-scroll.entry.js +5 -5
- package/dist/esm/x-workflow-builder.entry.js +8 -8
- package/dist/esm/xlabs.js +20 -0
- package/dist/types/components/x-app/x-app.d.ts +12 -12
- package/dist/types/components/x-auto-complete/auto-complete-dropdown-content/index.d.ts +1 -1
- package/dist/types/components/x-auto-complete/x-auto-complete.d.ts +6 -0
- package/dist/types/components/x-avatar/x-avatar.d.ts +3 -2
- package/dist/types/components/x-captcha/x-captcha.d.ts +4 -0
- package/dist/types/components/x-checkbox/x-checkbox.d.ts +0 -4
- package/dist/types/components/x-code-editor/types.d.ts +26 -0
- package/dist/types/components/x-code-editor/x-code-editor.d.ts +141 -0
- package/dist/types/components/x-color-picker/types.d.ts +4 -0
- package/dist/types/components/x-color-picker/x-color-picker.d.ts +8 -1
- package/dist/types/components/x-content/x-content.d.ts +1 -1
- package/dist/types/components/x-date-picker/x-date-picker.d.ts +4 -0
- package/dist/types/components/x-form/x-form.d.ts +12 -0
- package/dist/types/components/x-form-builder/services/forms/validators.d.ts +1 -0
- package/dist/types/components/x-form-builder/services/schema/form-mapping.d.ts +4 -0
- package/dist/types/components/x-form-builder/services/schema/formula-builder.d.ts +29 -0
- package/dist/types/components/x-form-builder/services/schema/schema-builder.d.ts +6 -1
- package/dist/types/components/x-form-builder/types/common/common-types.d.ts +5 -0
- package/dist/types/components/x-form-builder/types/common/field-types-enum.d.ts +1 -1
- package/dist/types/components/x-form-builder/types/common/index.d.ts +1 -0
- package/dist/types/components/x-form-builder/types/common/ui-types.d.ts +28 -0
- package/dist/types/components/x-form-builder/types/common/validation-types.d.ts +1 -1
- package/dist/types/components/x-form-builder/types/fields/advanced-fields.d.ts +1 -0
- package/dist/types/components/x-form-builder/types/fields/base-field.d.ts +4 -1
- package/dist/types/components/x-form-builder/types/fields/datetime-file-fields.d.ts +10 -3
- package/dist/types/components/x-form-builder/types/fields/display-fields.d.ts +3 -0
- package/dist/types/components/x-form-builder/types/fields/form-field-union.d.ts +5 -5
- package/dist/types/components/x-form-builder/types/fields/input-fields.d.ts +5 -0
- package/dist/types/components/x-form-builder/types/fields/layout-fields.d.ts +29 -2
- package/dist/types/components/x-form-builder/types/fields/selection-fields.d.ts +11 -4
- package/dist/types/components/x-form-builder/types/fields/special-input-fields.d.ts +3 -0
- package/dist/types/components/x-form-builder/types/form/schema-types.d.ts +7 -3
- package/dist/types/components/x-form-builder/utils/values.d.ts +1 -1
- package/dist/types/components/x-form-builder/x-form-builder.d.ts +11 -3
- package/dist/types/components/x-icon/icons.d.ts +12 -2716
- package/dist/types/components/x-icon/x-icon.d.ts +1 -1
- package/dist/types/components/x-input/types.d.ts +1 -1
- package/dist/types/components/x-input/x-input.d.ts +6 -0
- package/dist/types/components/x-input-icon/icon-picker-dropdown-content/icon-picker-dropdown-content.d.ts +39 -0
- package/dist/types/components/x-input-icon/types.d.ts +9 -0
- package/dist/types/components/x-input-icon/x-input-icon.d.ts +150 -0
- package/dist/types/components/x-input-number/x-input-number.d.ts +5 -0
- package/dist/types/components/x-layout/x-layout.d.ts +2 -1
- package/dist/types/components/x-layout-admin/x-layout-admin.d.ts +23 -0
- package/dist/types/components/x-layout-detail/x-layout-detail.d.ts +86 -0
- package/dist/types/components/x-layout-list/types.d.ts +100 -0
- package/dist/types/components/x-layout-list/x-layout-list.d.ts +107 -0
- package/dist/types/components/x-login/types.d.ts +113 -0
- package/dist/types/components/x-login/x-login.d.ts +126 -0
- package/dist/types/components/x-message/message-service.d.ts +1 -1
- package/dist/types/components/x-modal/x-modal.d.ts +31 -6
- package/dist/types/components/x-modal-content/x-modal-content.d.ts +24 -0
- package/dist/types/components/x-notification/notification-service.d.ts +1 -1
- package/dist/types/components/x-qr-code/x-qr-code.d.ts +2 -0
- package/dist/types/components/x-select/select-dropdown-content/index.d.ts +1 -1
- package/dist/types/components/x-tab-pane/x-tab-pane.d.ts +11 -0
- package/dist/types/components/x-table/types.d.ts +3 -0
- package/dist/types/components/x-table/x-table.d.ts +15 -4
- package/dist/types/components/x-tabs/types.d.ts +9 -0
- package/dist/types/components/x-tabs/x-tabs.d.ts +40 -1
- package/dist/types/components/x-time-picker/time-picker-dropdown-content/index.d.ts +1 -1
- package/dist/types/components/x-transfer/types.d.ts +3 -1
- package/dist/types/components/x-upload/types.d.ts +14 -0
- package/dist/types/components/x-upload/x-upload.d.ts +34 -7
- package/dist/types/components.d.ts +1304 -70
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locales/locale.service.d.ts +3 -3
- package/dist/types/types.d.ts +2 -0
- package/dist/types/utils/code-editor/ast-parser.d.ts +5 -0
- package/dist/types/utils/code-editor/autocomplete-db.d.ts +10 -0
- package/dist/types/utils/code-editor/history.d.ts +19 -0
- package/dist/types/utils/code-editor/index.d.ts +4 -0
- package/dist/types/utils/code-editor/plugin-system.d.ts +31 -0
- package/dist/types/utils/code-editor/tokenizer.d.ts +2 -0
- package/dist/types/utils/form/types.d.ts +1 -1
- package/dist/types/utils/table.service.d.ts +2 -1
- package/dist/xlabs/index.esm.js +1 -0
- package/dist/xlabs/p-0139d27f.entry.js +1 -0
- package/dist/xlabs/p-04985e4d.entry.js +1 -0
- package/dist/xlabs/p-05a79f30.entry.js +1 -0
- package/dist/xlabs/p-0a08e0c8.entry.js +1 -0
- package/dist/xlabs/p-0d5fb8de.entry.js +1 -0
- package/dist/{xlabs-store/p-cd3c3374.entry.js → xlabs/p-121911e5.entry.js} +1 -1
- package/dist/xlabs/p-1260ad3b.entry.js +1 -0
- package/dist/xlabs/p-1c0ee15c.entry.js +1 -0
- package/dist/{xlabs-store/p-023259c9.entry.js → xlabs/p-1cd3b259.entry.js} +1 -1
- package/dist/xlabs/p-2451ab24.entry.js +1 -0
- package/dist/xlabs/p-2ab3bc58.entry.js +1 -0
- package/dist/xlabs/p-2f9d0da7.entry.js +1 -0
- package/dist/xlabs/p-302ab3b9.entry.js +1 -0
- package/dist/xlabs/p-31029063.entry.js +1 -0
- package/dist/xlabs/p-31c814c2.entry.js +1 -0
- package/dist/xlabs/p-3f5b28e5.entry.js +1 -0
- package/dist/xlabs/p-43d10a6e.entry.js +1 -0
- package/dist/xlabs/p-4bf9b6f7.entry.js +1 -0
- package/dist/xlabs/p-5ab9ce39.entry.js +1 -0
- package/dist/xlabs/p-5e495388.entry.js +1 -0
- package/dist/xlabs/p-6039e514.entry.js +1 -0
- package/dist/xlabs/p-674527b2.entry.js +1 -0
- package/dist/xlabs/p-68056c0e.entry.js +1 -0
- package/dist/xlabs/p-6d7480c0.entry.js +1 -0
- package/dist/xlabs/p-7697ef47.entry.js +1 -0
- package/dist/xlabs/p-7b8bdd79.entry.js +1 -0
- package/dist/xlabs/p-7f9a80e0.entry.js +1 -0
- package/dist/xlabs/p-948a032e.entry.js +1 -0
- package/dist/xlabs/p-99c568fd.entry.js +1 -0
- package/dist/{xlabs-store/p-7a8f11b4.entry.js → xlabs/p-9ae3501d.entry.js} +1 -1
- package/dist/xlabs/p-9b3a4aa6.entry.js +1 -0
- package/dist/xlabs/p-9c1cc5ff.entry.js +1 -0
- package/dist/xlabs/p-BMTt8QT3.js +2 -0
- package/dist/xlabs/p-CQ2VND9-.js +1 -0
- package/dist/xlabs/p-CkwLFDlS.js +1 -0
- package/dist/xlabs/p-D7kqIlVo.js +1 -0
- package/dist/{xlabs-store/p-Co3Y9VjQ.js → xlabs/p-DSa1uqPO.js} +1 -1
- package/dist/{xlabs-store/p-c0ca6f7d.entry.js → xlabs/p-a2d14538.entry.js} +1 -1
- package/dist/xlabs/p-a415c8c1.entry.js +1 -0
- package/dist/xlabs/p-a4995e36.entry.js +1 -0
- package/dist/{xlabs-store/p-fdec5d89.entry.js → xlabs/p-aba80f73.entry.js} +1 -1
- package/dist/xlabs/p-bc5969e0.entry.js +1 -0
- package/dist/xlabs/p-bef8def9.entry.js +1 -0
- package/dist/xlabs/p-cc57e705.entry.js +1 -0
- package/dist/xlabs/p-d11de492.entry.js +1 -0
- package/dist/xlabs/p-d4558f7b.entry.js +1 -0
- package/dist/xlabs/p-d921a2c7.entry.js +1 -0
- package/dist/xlabs/p-df10e5a1.entry.js +1 -0
- package/dist/xlabs/p-e1a1acbe.entry.js +1 -0
- package/dist/xlabs/p-eab901c4.entry.js +1 -0
- package/dist/xlabs/p-edcb4001.entry.js +1 -0
- package/dist/xlabs/p-f07d9ee7.entry.js +1 -0
- package/dist/xlabs/p-f280faed.entry.js +1 -0
- package/dist/xlabs/p-f5b96f2a.entry.js +1 -0
- package/dist/xlabs/p-f6950840.entry.js +1 -0
- package/dist/{xlabs-store/p-96b1939d.entry.js → xlabs/p-f69d2b16.entry.js} +1 -1
- package/dist/{xlabs-store/p-8bcbb4e3.entry.js → xlabs/p-fd003457.entry.js} +1 -1
- package/dist/xlabs/xlabs.css +2 -0
- package/dist/xlabs/xlabs.esm.js +1 -0
- package/loader/cdn.js +0 -0
- package/loader/index.cjs.js +0 -0
- package/loader/index.d.ts +0 -0
- package/loader/index.es2017.js +0 -0
- package/loader/index.js +0 -0
- package/package.json +65 -69
- package/readme.md +107 -50
- package/components/p-5c86X8JO.js +0 -1
- package/components/p-6KpqCGp9.js +0 -1
- package/components/p-ADwHM_jT.js +0 -1
- package/components/p-AgSyA7Ia.js +0 -1
- package/components/p-B-7Hwizp.js +0 -1
- package/components/p-B-ClGFfy.js +0 -1
- package/components/p-B4rO7Sgt.js +0 -1
- package/components/p-B5Syz0fw.js +0 -1
- package/components/p-B6p-mzW-.js +0 -1
- package/components/p-B8SZP5Xz.js +0 -1
- package/components/p-BBGHXZqR.js +0 -1
- package/components/p-BHLvuyOq.js +0 -1
- package/components/p-BOCR5Zk0.js +0 -1
- package/components/p-BRBrLtOz.js +0 -1
- package/components/p-BSRP2TGa.js +0 -1
- package/components/p-BUjRcJoK.js +0 -1
- package/components/p-BVeQ5W_G.js +0 -1
- package/components/p-BVnVlCcd.js +0 -1
- package/components/p-BZQcq9R_.js +0 -1
- package/components/p-BeIFU-wn.js +0 -1
- package/components/p-BkEgl31q.js +0 -1
- package/components/p-BkPJ1Whr.js +0 -1
- package/components/p-BkevSugc.js +0 -1
- package/components/p-BkiOFW3H.js +0 -1
- package/components/p-BskMfHyY.js +0 -1
- package/components/p-Bu2JqZs8.js +0 -1
- package/components/p-BvjR2Q5Q.js +0 -1
- package/components/p-Bz7MhZ4K.js +0 -1
- package/components/p-C3gvR6nN.js +0 -1
- package/components/p-C70KKm8p.js +0 -1
- package/components/p-C7csgUoA.js +0 -1
- package/components/p-CAPfC5Vn.js +0 -1
- package/components/p-CEBSDVyp.js +0 -1
- package/components/p-CFB6xkAX.js +0 -1
- package/components/p-CGIxdOEm.js +0 -1
- package/components/p-CHRrsVXB.js +0 -1
- package/components/p-CKUzvJue.js +0 -1
- package/components/p-CRBPzT4B.js +0 -1
- package/components/p-CSfrs76m.js +0 -1
- package/components/p-C_ZBjXFP.js +0 -1
- package/components/p-Ce5L9qbY.js +0 -1
- package/components/p-CeBfFEIa.js +0 -1
- package/components/p-Ck6SW8G3.js +0 -1
- package/components/p-D7ijqXRY.js +0 -1
- package/components/p-D7n-26Q5.js +0 -1
- package/components/p-D8ew7Rgv.js +0 -1
- package/components/p-DBk4T-b-.js +0 -1
- package/components/p-DD-W_fMF.js +0 -1
- package/components/p-DElCk9ta.js +0 -1
- package/components/p-DEumEVI3.js +0 -1
- package/components/p-DGqQ8PT4.js +0 -1
- package/components/p-DJ1WhSJ4.js +0 -1
- package/components/p-DOxXxhXb.js +0 -1
- package/components/p-DRa4o4c6.js +0 -1
- package/components/p-DTlSrH8_.js +0 -1
- package/components/p-DTvD0UO5.js +0 -1
- package/components/p-DZFphzg1.js +0 -1
- package/components/p-DZPUUptR.js +0 -1
- package/components/p-D_xaGiZU.js +0 -1
- package/components/p-DaL42JUi.js +0 -1
- package/components/p-DbRpEXwX.js +0 -1
- package/components/p-Dg0xgMke.js +0 -1
- package/components/p-Dky_8i8S.js +0 -1
- package/components/p-DlwlBBr4.js +0 -1
- package/components/p-DoTf8yXn.js +0 -1
- package/components/p-DphUq6Z5.js +0 -1
- package/components/p-DsgWQbJY.js +0 -1
- package/components/p-Dx3yBe39.js +0 -1
- package/components/p-DxKMnrS8.js +0 -1
- package/components/p-O88oQkR1.js +0 -1
- package/components/p-PlUkLT0A.js +0 -1
- package/components/p-QTSiPk0I.js +0 -1
- package/components/p-TC9DZAbC.js +0 -1
- package/components/p-bVsOg7S9.js +0 -1
- package/components/p-ccpcKv5U.js +0 -1
- package/components/p-en06CSUT.js +0 -1
- package/components/p-g6ZBqIze.js +0 -1
- package/dist/cjs/types-DQ-V76ZQ.js +0 -255
- package/dist/cjs/x-address_14.cjs.entry.js +0 -12577
- package/dist/cjs/x-auto-complete-dropdown-content.cjs.entry.js +0 -69
- package/dist/cjs/x-avatar.cjs.entry.js +0 -269
- package/dist/cjs/x-button.cjs.entry.js +0 -174
- package/dist/cjs/x-card_12.cjs.entry.js +0 -1386
- package/dist/cjs/x-cascader-dropdown-content.cjs.entry.js +0 -364
- package/dist/cjs/x-checkbox_5.cjs.entry.js +0 -1376
- package/dist/cjs/x-color-picker-panel_2.cjs.entry.js +0 -873
- package/dist/cjs/x-color-picker_9.cjs.entry.js +0 -3085
- package/dist/cjs/x-date-picker-dropdown-content.cjs.entry.js +0 -757
- package/dist/cjs/x-dropdown_2.cjs.entry.js +0 -735
- package/dist/cjs/x-empty.cjs.entry.js +0 -64
- package/dist/cjs/x-form-builder.cjs.entry.js +0 -807
- package/dist/cjs/x-icon.cjs.entry.js +0 -144
- package/dist/cjs/x-list.cjs.entry.js +0 -138
- package/dist/cjs/x-modal-content.cjs.entry.js +0 -217
- package/dist/cjs/x-range-picker-dropdown-content.cjs.entry.js +0 -821
- package/dist/cjs/x-select_2.cjs.entry.js +0 -1316
- package/dist/cjs/x-spin.cjs.entry.js +0 -62
- package/dist/cjs/x-tab-pane.cjs.entry.js +0 -73
- package/dist/cjs/x-tabs.cjs.entry.js +0 -609
- package/dist/cjs/x-time-picker-dropdown-content.cjs.entry.js +0 -389
- package/dist/cjs/x-tree-select-dropdown-content.cjs.entry.js +0 -439
- package/dist/cjs/xlabs-store.cjs.js +0 -24
- package/dist/esm/types-C_QdJRdB.js +0 -253
- package/dist/esm/x-address_14.entry.js +0 -12562
- package/dist/esm/x-auto-complete-dropdown-content.entry.js +0 -67
- package/dist/esm/x-avatar.entry.js +0 -267
- package/dist/esm/x-button.entry.js +0 -172
- package/dist/esm/x-card_12.entry.js +0 -1373
- package/dist/esm/x-cascader-dropdown-content.entry.js +0 -362
- package/dist/esm/x-checkbox_5.entry.js +0 -1370
- package/dist/esm/x-color-picker-panel_2.entry.js +0 -870
- package/dist/esm/x-color-picker_9.entry.js +0 -3075
- package/dist/esm/x-date-picker-dropdown-content.entry.js +0 -755
- package/dist/esm/x-dropdown_2.entry.js +0 -732
- package/dist/esm/x-empty.entry.js +0 -62
- package/dist/esm/x-form-builder.entry.js +0 -805
- package/dist/esm/x-icon.entry.js +0 -142
- package/dist/esm/x-list.entry.js +0 -136
- package/dist/esm/x-modal-content.entry.js +0 -215
- package/dist/esm/x-range-picker-dropdown-content.entry.js +0 -819
- package/dist/esm/x-select_2.entry.js +0 -1313
- package/dist/esm/x-spin.entry.js +0 -60
- package/dist/esm/x-tab-pane.entry.js +0 -71
- package/dist/esm/x-tabs.entry.js +0 -607
- package/dist/esm/x-time-picker-dropdown-content.entry.js +0 -387
- package/dist/esm/x-tree-select-dropdown-content.entry.js +0 -437
- package/dist/esm/xlabs-store.js +0 -20
- package/dist/xlabs-store/index.esm.js +0 -1
- package/dist/xlabs-store/p-016194dc.entry.js +0 -1
- package/dist/xlabs-store/p-04a3721a.entry.js +0 -1
- package/dist/xlabs-store/p-072445b7.entry.js +0 -1
- package/dist/xlabs-store/p-0ec21454.entry.js +0 -1
- package/dist/xlabs-store/p-12b6a843.entry.js +0 -1
- package/dist/xlabs-store/p-1a81cf09.entry.js +0 -1
- package/dist/xlabs-store/p-1b019aeb.entry.js +0 -1
- package/dist/xlabs-store/p-262a0673.entry.js +0 -1
- package/dist/xlabs-store/p-34cce823.entry.js +0 -1
- package/dist/xlabs-store/p-3a9fdefe.entry.js +0 -1
- package/dist/xlabs-store/p-40036100.entry.js +0 -1
- package/dist/xlabs-store/p-45f04e8d.entry.js +0 -1
- package/dist/xlabs-store/p-48ba7c34.entry.js +0 -1
- package/dist/xlabs-store/p-48e2c26e.entry.js +0 -1
- package/dist/xlabs-store/p-4ac2e915.entry.js +0 -1
- package/dist/xlabs-store/p-4d7c2a35.entry.js +0 -1
- package/dist/xlabs-store/p-4f67cb33.entry.js +0 -1
- package/dist/xlabs-store/p-502b345e.entry.js +0 -1
- package/dist/xlabs-store/p-555c5e48.entry.js +0 -1
- package/dist/xlabs-store/p-5878525f.entry.js +0 -1
- package/dist/xlabs-store/p-5abbdca7.entry.js +0 -1
- package/dist/xlabs-store/p-6243ca69.entry.js +0 -1
- package/dist/xlabs-store/p-64e7a057.entry.js +0 -1
- package/dist/xlabs-store/p-6530d2ef.entry.js +0 -1
- package/dist/xlabs-store/p-675a39e1.entry.js +0 -1
- package/dist/xlabs-store/p-689c52ef.entry.js +0 -1
- package/dist/xlabs-store/p-69b8cb7d.entry.js +0 -1
- package/dist/xlabs-store/p-6b121c60.entry.js +0 -1
- package/dist/xlabs-store/p-6c75fc39.entry.js +0 -1
- package/dist/xlabs-store/p-6f705deb.entry.js +0 -1
- package/dist/xlabs-store/p-723d362c.entry.js +0 -1
- package/dist/xlabs-store/p-783545e3.entry.js +0 -1
- package/dist/xlabs-store/p-81fb4caf.entry.js +0 -1
- package/dist/xlabs-store/p-863dd67d.entry.js +0 -1
- package/dist/xlabs-store/p-8bcc219a.entry.js +0 -1
- package/dist/xlabs-store/p-914b0ae2.entry.js +0 -1
- package/dist/xlabs-store/p-9ac291ea.entry.js +0 -1
- package/dist/xlabs-store/p-9de03a07.entry.js +0 -1
- package/dist/xlabs-store/p-C_QdJRdB.js +0 -1
- package/dist/xlabs-store/p-Ce5L9qbY.js +0 -1
- package/dist/xlabs-store/p-DElCk9ta.js +0 -1
- package/dist/xlabs-store/p-a4223feb.entry.js +0 -1
- package/dist/xlabs-store/p-a8c2eca7.entry.js +0 -1
- package/dist/xlabs-store/p-ac9ba3aa.entry.js +0 -1
- package/dist/xlabs-store/p-bd5084b8.entry.js +0 -1
- package/dist/xlabs-store/p-bda322db.entry.js +0 -1
- package/dist/xlabs-store/p-c4c8840c.entry.js +0 -1
- package/dist/xlabs-store/p-c4d0ce0d.entry.js +0 -1
- package/dist/xlabs-store/p-cf4697bc.entry.js +0 -1
- package/dist/xlabs-store/p-d2ec3d4a.entry.js +0 -1
- package/dist/xlabs-store/p-d4d00aff.entry.js +0 -1
- package/dist/xlabs-store/p-d9d0147b.entry.js +0 -1
- package/dist/xlabs-store/p-dd930f2a.entry.js +0 -1
- package/dist/xlabs-store/p-e04836e8.entry.js +0 -1
- package/dist/xlabs-store/p-e14b5f6d.entry.js +0 -1
- package/dist/xlabs-store/p-eb1dd3c2.entry.js +0 -1
- package/dist/xlabs-store/p-f02155e4.entry.js +0 -1
- package/dist/xlabs-store/p-f1331938.entry.js +0 -1
- package/dist/xlabs-store/p-fac0b689.entry.js +0 -1
- package/dist/xlabs-store/p-fd2e1d9c.entry.js +0 -1
- package/dist/xlabs-store/p-ffba56b2.entry.js +0 -1
- package/dist/xlabs-store/p-ig_mFsVk.js +0 -2
- package/dist/xlabs-store/xlabs-store.css +0 -1
- package/dist/xlabs-store/xlabs-store.esm.js +0 -1
- /package/components/{p-XBF88YT_.js → p-BtYiIQqg.js} +0 -0
- /package/components/{p-D66tF8_2.js → p-DFADJBLL.js} +0 -0
- /package/components/{p-COpzIi1n.js → p-DM8AggMt.js} +0 -0
- /package/components/{p-BPeosvTA.js → p-RKpMhZmc.js} +0 -0
- /package/components/{p-Dgxy93Bg.js → p-iG9CbEpE.js} +0 -0
- /package/dist/{xlabs-store → xlabs}/fonts/xlabs-outlined.woff2 +0 -0
- /package/dist/{xlabs-store → xlabs}/fonts/xlabs-rounded.woff2 +0 -0
- /package/dist/{xlabs-store → xlabs}/fonts/xlabs-solided.woff2 +0 -0
- /package/dist/{xlabs-store/p-XBF88YT_.js → xlabs/p-BtYiIQqg.js} +0 -0
- /package/dist/{xlabs-store/p-D66tF8_2.js → xlabs/p-DFADJBLL.js} +0 -0
- /package/dist/{xlabs-store/p-COpzIi1n.js → xlabs/p-DM8AggMt.js} +0 -0
- /package/dist/{xlabs-store/p-BPeosvTA.js → xlabs/p-RKpMhZmc.js} +0 -0
- /package/dist/{xlabs-store/p-Dgxy93Bg.js → xlabs/p-iG9CbEpE.js} +0 -0
|
@@ -0,0 +1,2363 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, F as Fragment, H as Host } from './index-BMTt8QT3.js';
|
|
2
|
+
|
|
3
|
+
// src/utils/tokenizer.ts
|
|
4
|
+
// Pure syntax tokenizer — no external deps
|
|
5
|
+
function escH$1(s) {
|
|
6
|
+
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
7
|
+
}
|
|
8
|
+
// ─── JavaScript Tokenizer ────────────────────────────────────────────────────
|
|
9
|
+
function tokenizeJS(code) {
|
|
10
|
+
const KW = /^(const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|class|extends|new|this|super|import|export|default|from|typeof|instanceof|in|of|try|catch|finally|throw|async|await|static|get|set|delete|void|yield|null|undefined|true|false|NaN|Infinity)$/;
|
|
11
|
+
const BUILTIN = /^(console|Math|Array|Object|String|Number|Boolean|Symbol|BigInt|Promise|Map|Set|WeakMap|WeakSet|Error|TypeError|RangeError|JSON|Date|RegExp|Proxy|Reflect|globalThis|window|document|navigator|setTimeout|setInterval|clearTimeout|clearInterval|fetch|parseInt|parseFloat|isNaN|isFinite|encodeURI|decodeURI|structuredClone|queueMicrotask)$/;
|
|
12
|
+
const lines = code.split('\n');
|
|
13
|
+
let inMLComment = false;
|
|
14
|
+
return lines
|
|
15
|
+
.map(line => {
|
|
16
|
+
let out = '';
|
|
17
|
+
let rest = line;
|
|
18
|
+
if (inMLComment) {
|
|
19
|
+
const end = rest.indexOf('*/');
|
|
20
|
+
if (end < 0)
|
|
21
|
+
return `<span class="t-cmt">${escH$1(rest)}</span>`;
|
|
22
|
+
out += `<span class="t-cmt">${escH$1(rest.slice(0, end + 2))}</span>`;
|
|
23
|
+
rest = rest.slice(end + 2);
|
|
24
|
+
inMLComment = false;
|
|
25
|
+
}
|
|
26
|
+
while (rest.length > 0) {
|
|
27
|
+
// single-line comment
|
|
28
|
+
if (rest.startsWith('//')) {
|
|
29
|
+
out += `<span class="t-cmt">${escH$1(rest)}</span>`;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
// multi-line comment
|
|
33
|
+
if (rest.startsWith('/*')) {
|
|
34
|
+
const end = rest.indexOf('*/', 2);
|
|
35
|
+
if (end < 0) {
|
|
36
|
+
out += `<span class="t-cmt">${escH$1(rest)}</span>`;
|
|
37
|
+
inMLComment = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
out += `<span class="t-cmt">${escH$1(rest.slice(0, end + 2))}</span>`;
|
|
41
|
+
rest = rest.slice(end + 2);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// template literal
|
|
45
|
+
if (rest[0] === '`') {
|
|
46
|
+
let i = 1, s = '`';
|
|
47
|
+
while (i < rest.length) {
|
|
48
|
+
if (rest[i] === '\\') {
|
|
49
|
+
s += rest[i] + rest[i + 1];
|
|
50
|
+
i += 2;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (rest[i] === '`') {
|
|
54
|
+
s += '`';
|
|
55
|
+
i++;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
s += rest[i++];
|
|
59
|
+
}
|
|
60
|
+
out += `<span class="t-str">${escH$1(s)}</span>`;
|
|
61
|
+
rest = rest.slice(s.length);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// string
|
|
65
|
+
const strM = rest.match(/^("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/);
|
|
66
|
+
if (strM) {
|
|
67
|
+
out += `<span class="t-str">${escH$1(strM[0])}</span>`;
|
|
68
|
+
rest = rest.slice(strM[0].length);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
// decorator
|
|
72
|
+
if (rest[0] === '@') {
|
|
73
|
+
const dm = rest.match(/^@[a-zA-Z_$][a-zA-Z0-9_$]*/);
|
|
74
|
+
if (dm) {
|
|
75
|
+
out += `<span class="t-dec">${escH$1(dm[0])}</span>`;
|
|
76
|
+
rest = rest.slice(dm[0].length);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// number
|
|
81
|
+
const numM = rest.match(/^(0x[\da-fA-F]+|0b[01]+|0o[0-7]+|\d+\.?\d*(?:[eE][+-]?\d+)?n?)\b/);
|
|
82
|
+
if (numM) {
|
|
83
|
+
out += `<span class="t-num">${numM[0]}</span>`;
|
|
84
|
+
rest = rest.slice(numM[0].length);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// identifier / keyword
|
|
88
|
+
const idM = rest.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*/);
|
|
89
|
+
if (idM) {
|
|
90
|
+
const w = idM[0];
|
|
91
|
+
if (KW.test(w))
|
|
92
|
+
out += `<span class="t-kw">${w}</span>`;
|
|
93
|
+
else if (BUILTIN.test(w))
|
|
94
|
+
out += `<span class="t-bi">${w}</span>`;
|
|
95
|
+
else if (rest[w.length] === '(')
|
|
96
|
+
out += `<span class="t-fn">${w}</span>`;
|
|
97
|
+
else
|
|
98
|
+
out += `<span class="t-id">${escH$1(w)}</span>`;
|
|
99
|
+
rest = rest.slice(w.length);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
// operator
|
|
103
|
+
const opM = rest.match(/^(===|!==|=>|\.{3}|\?\?=?|\?\.|[+\-*/%=<>!&|^~?:]+)/);
|
|
104
|
+
if (opM) {
|
|
105
|
+
out += `<span class="t-op">${escH$1(opM[0])}</span>`;
|
|
106
|
+
rest = rest.slice(opM[0].length);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
out += escH$1(rest[0]);
|
|
110
|
+
rest = rest.slice(1);
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
})
|
|
114
|
+
.join('\n');
|
|
115
|
+
}
|
|
116
|
+
// ─── CSS Tokenizer ──────────────────────────────────────────────────────────
|
|
117
|
+
function tokenizeCSS(code) {
|
|
118
|
+
const lines = code.split('\n');
|
|
119
|
+
let inComment = false;
|
|
120
|
+
return lines
|
|
121
|
+
.map(line => {
|
|
122
|
+
let out = '', rest = line;
|
|
123
|
+
if (inComment) {
|
|
124
|
+
const e = rest.indexOf('*/');
|
|
125
|
+
if (e < 0)
|
|
126
|
+
return `<span class="t-cmt">${escH$1(rest)}</span>`;
|
|
127
|
+
out += `<span class="t-cmt">${escH$1(rest.slice(0, e + 2))}</span>`;
|
|
128
|
+
rest = rest.slice(e + 2);
|
|
129
|
+
inComment = false;
|
|
130
|
+
}
|
|
131
|
+
while (rest.length > 0) {
|
|
132
|
+
if (rest.startsWith('/*')) {
|
|
133
|
+
const e = rest.indexOf('*/', 2);
|
|
134
|
+
if (e < 0) {
|
|
135
|
+
out += `<span class="t-cmt">${escH$1(rest)}</span>`;
|
|
136
|
+
inComment = true;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
out += `<span class="t-cmt">${escH$1(rest.slice(0, e + 2))}</span>`;
|
|
140
|
+
rest = rest.slice(e + 2);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// string
|
|
144
|
+
const strM = rest.match(/^("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/);
|
|
145
|
+
if (strM) {
|
|
146
|
+
out += `<span class="t-str">${escH$1(strM[0])}</span>`;
|
|
147
|
+
rest = rest.slice(strM[0].length);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
// @-rule
|
|
151
|
+
const atM = rest.match(/^@(media|keyframes|import|font-face|layer|container|supports|charset|namespace)\b/);
|
|
152
|
+
if (atM) {
|
|
153
|
+
out += `<span class="t-kw">${escH$1(atM[0])}</span>`;
|
|
154
|
+
rest = rest.slice(atM[0].length);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
// CSS property
|
|
158
|
+
const propM = rest.match(/^(-{1,2}[a-zA-Z][a-zA-Z0-9-]*)(?=\s*:)/);
|
|
159
|
+
if (propM) {
|
|
160
|
+
out += `<span class="t-prop">${escH$1(propM[0])}</span>`;
|
|
161
|
+
rest = rest.slice(propM[0].length);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
// hex color
|
|
165
|
+
const hashM = rest.match(/^#([0-9a-fA-F]{3,8})\b/);
|
|
166
|
+
if (hashM) {
|
|
167
|
+
out += `<span class="t-num" style="border-bottom:2px solid #${hashM[1]}">#${hashM[1]}</span>`;
|
|
168
|
+
rest = rest.slice(hashM[0].length);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
// number + unit
|
|
172
|
+
const numM = rest.match(/^-?[\d.]+(?:px|em|rem|vh|vw|vmin|vmax|%|s|ms|deg|rad|fr|ch|ex|cm|mm|in|pt|pc)?/);
|
|
173
|
+
if (numM && numM[0] && /\d/.test(numM[0])) {
|
|
174
|
+
out += `<span class="t-num">${numM[0]}</span>`;
|
|
175
|
+
rest = rest.slice(numM[0].length);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
// function call
|
|
179
|
+
const fnM = rest.match(/^([a-zA-Z-]+)(?=\s*\()/);
|
|
180
|
+
if (fnM) {
|
|
181
|
+
out += `<span class="t-fn">${fnM[1]}</span>`;
|
|
182
|
+
rest = rest.slice(fnM[1].length);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// selector fragment
|
|
186
|
+
const selM = rest.match(/^([.#:][a-zA-Z_-][a-zA-Z0-9_-]*)/);
|
|
187
|
+
if (selM) {
|
|
188
|
+
out += `<span class="t-sel">${escH$1(selM[0])}</span>`;
|
|
189
|
+
rest = rest.slice(selM[0].length);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
// keyword value
|
|
193
|
+
const kwM = rest.match(/^\b(important|auto|none|inherit|initial|unset|normal|bold|flex|grid|block|inline|absolute|relative|fixed|sticky|hidden|visible|scroll|solid|dashed|dotted|transparent|currentColor|center|left|right|top|bottom)\b/);
|
|
194
|
+
if (kwM) {
|
|
195
|
+
out += `<span class="t-kw">${kwM[0]}</span>`;
|
|
196
|
+
rest = rest.slice(kwM[0].length);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
out += escH$1(rest[0]);
|
|
200
|
+
rest = rest.slice(1);
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
})
|
|
204
|
+
.join('\n');
|
|
205
|
+
}
|
|
206
|
+
// ─── HTML Tokenizer ─────────────────────────────────────────────────────────
|
|
207
|
+
function tokenizeHTML(code) {
|
|
208
|
+
let out = '', i = 0;
|
|
209
|
+
while (i < code.length) {
|
|
210
|
+
// comment
|
|
211
|
+
if (code.slice(i, i + 4) === '<!--') {
|
|
212
|
+
const e = code.indexOf('-->', i + 4);
|
|
213
|
+
const chunk = e >= 0 ? code.slice(i, e + 3) : code.slice(i);
|
|
214
|
+
out += `<span class="t-cmt">${escH$1(chunk)}</span>`;
|
|
215
|
+
i = e >= 0 ? e + 3 : code.length;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (code[i] === '<') {
|
|
219
|
+
const tagEnd = code.indexOf('>', i);
|
|
220
|
+
if (tagEnd < 0) {
|
|
221
|
+
out += escH$1(code.slice(i));
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
const rawTag = code.slice(i, tagEnd + 1);
|
|
225
|
+
const close = code[i + 1] === '/';
|
|
226
|
+
const tagM = rawTag.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
227
|
+
if (!tagM) {
|
|
228
|
+
out += escH$1(rawTag);
|
|
229
|
+
i = tagEnd + 1;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
const tagName = tagM[1];
|
|
233
|
+
let inner = rawTag.slice(tagM[0].length, -1);
|
|
234
|
+
// highlight attributes
|
|
235
|
+
inner = inner.replace(/([a-zA-Z_:][a-zA-Z0-9_:.-]*)(\s*=\s*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')?/g, (_, a, eq, v) => `<span class="t-attr">${escH$1(a)}</span>${escH$1(eq || '')}${v ? `<span class="t-str">${escH$1(v)}</span>` : ''}`);
|
|
236
|
+
out += `<span class="t-op"><${close ? '/' : ''}</span><span class="t-tag">${tagName}</span>${inner}<span class="t-op">></span>`;
|
|
237
|
+
i = tagEnd + 1;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
// HTML entity
|
|
241
|
+
if (code[i] === '&') {
|
|
242
|
+
const e = code.indexOf(';', i);
|
|
243
|
+
if (e >= 0 && e - i < 12) {
|
|
244
|
+
out += `<span class="t-str">${escH$1(code.slice(i, e + 1))}</span>`;
|
|
245
|
+
i = e + 1;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
out += escH$1(code[i++]);
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|
|
253
|
+
// ─── JSON Tokenizer ─────────────────────────────────────────────────────────
|
|
254
|
+
function tokenizeJSON(code) {
|
|
255
|
+
const lines = code.split('\n');
|
|
256
|
+
return lines
|
|
257
|
+
.map(line => {
|
|
258
|
+
let out = '', rest = line;
|
|
259
|
+
while (rest.length > 0) {
|
|
260
|
+
const strM = rest.match(/^("(?:[^"\\]|\\.)*")/);
|
|
261
|
+
if (strM) {
|
|
262
|
+
const s = strM[0];
|
|
263
|
+
if (rest[s.length] === ':' || rest.slice(s.length).match(/^\s*:/))
|
|
264
|
+
out += `<span class="t-prop">${escH$1(s)}</span>`;
|
|
265
|
+
else
|
|
266
|
+
out += `<span class="t-str">${escH$1(s)}</span>`;
|
|
267
|
+
rest = rest.slice(s.length);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
const numM = rest.match(/^-?\d+\.?\d*(?:[eE][+-]?\d+)?/);
|
|
271
|
+
if (numM) {
|
|
272
|
+
out += `<span class="t-num">${numM[0]}</span>`;
|
|
273
|
+
rest = rest.slice(numM[0].length);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const kwM = rest.match(/^\b(true|false|null)\b/);
|
|
277
|
+
if (kwM) {
|
|
278
|
+
out += `<span class="t-kw">${kwM[0]}</span>`;
|
|
279
|
+
rest = rest.slice(kwM[0].length);
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
out += escH$1(rest[0]);
|
|
283
|
+
rest = rest.slice(1);
|
|
284
|
+
}
|
|
285
|
+
return out;
|
|
286
|
+
})
|
|
287
|
+
.join('\n');
|
|
288
|
+
}
|
|
289
|
+
function tokenize$1(code, lang) {
|
|
290
|
+
switch (lang) {
|
|
291
|
+
case 'js':
|
|
292
|
+
return tokenizeJS(code);
|
|
293
|
+
case 'css':
|
|
294
|
+
return tokenizeCSS(code);
|
|
295
|
+
case 'html':
|
|
296
|
+
return tokenizeHTML(code);
|
|
297
|
+
case 'json':
|
|
298
|
+
return tokenizeJSON(code);
|
|
299
|
+
default:
|
|
300
|
+
return escH$1(code);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/utils/ast-parser.ts
|
|
305
|
+
// Lightweight JS AST parser — produces a tree for the AST Explorer panel
|
|
306
|
+
const JS_KEYWORDS = new Set([
|
|
307
|
+
'const',
|
|
308
|
+
'let',
|
|
309
|
+
'var',
|
|
310
|
+
'function',
|
|
311
|
+
'class',
|
|
312
|
+
'return',
|
|
313
|
+
'if',
|
|
314
|
+
'else',
|
|
315
|
+
'for',
|
|
316
|
+
'while',
|
|
317
|
+
'do',
|
|
318
|
+
'switch',
|
|
319
|
+
'case',
|
|
320
|
+
'break',
|
|
321
|
+
'continue',
|
|
322
|
+
'new',
|
|
323
|
+
'import',
|
|
324
|
+
'export',
|
|
325
|
+
'default',
|
|
326
|
+
'from',
|
|
327
|
+
'async',
|
|
328
|
+
'await',
|
|
329
|
+
'try',
|
|
330
|
+
'catch',
|
|
331
|
+
'finally',
|
|
332
|
+
'throw',
|
|
333
|
+
'typeof',
|
|
334
|
+
'instanceof',
|
|
335
|
+
'delete',
|
|
336
|
+
'void',
|
|
337
|
+
'yield',
|
|
338
|
+
]);
|
|
339
|
+
function tokenize(code) {
|
|
340
|
+
const toks = [];
|
|
341
|
+
let i = 0;
|
|
342
|
+
while (i < code.length) {
|
|
343
|
+
// whitespace
|
|
344
|
+
if (/\s/.test(code[i])) {
|
|
345
|
+
i++;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
// single-line comment
|
|
349
|
+
if (code.slice(i, i + 2) === '//') {
|
|
350
|
+
while (i < code.length && code[i] !== '\n')
|
|
351
|
+
i++;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
// multi-line comment
|
|
355
|
+
if (code.slice(i, i + 2) === '/*') {
|
|
356
|
+
while (i < code.length && code.slice(i, i + 2) !== '*/')
|
|
357
|
+
i++;
|
|
358
|
+
i += 2;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
// string / template
|
|
362
|
+
const strM = code.slice(i).match(/^("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/);
|
|
363
|
+
if (strM) {
|
|
364
|
+
toks.push({ t: 'string', v: strM[0] });
|
|
365
|
+
i += strM[0].length;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
// number
|
|
369
|
+
const numM = code.slice(i).match(/^[\d.]+/);
|
|
370
|
+
if (numM) {
|
|
371
|
+
toks.push({ t: 'number', v: numM[0] });
|
|
372
|
+
i += numM[0].length;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
// identifier / keyword
|
|
376
|
+
const idM = code.slice(i).match(/^[a-zA-Z_$][a-zA-Z0-9_$]*/);
|
|
377
|
+
if (idM) {
|
|
378
|
+
toks.push({ t: JS_KEYWORDS.has(idM[0]) ? 'keyword' : 'identifier', v: idM[0] });
|
|
379
|
+
i += idM[0].length;
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
// punctuation / operator
|
|
383
|
+
const pM = code.slice(i).match(/^(===|!==|=>|\.{3}|\?\?|[{}()\[\];,.:+\-*/%=<>!&|^~?])/);
|
|
384
|
+
if (pM) {
|
|
385
|
+
toks.push({ t: 'punct', v: pM[0] });
|
|
386
|
+
i += pM[0].length;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
i++;
|
|
390
|
+
}
|
|
391
|
+
toks.push({ t: 'eof', v: '' });
|
|
392
|
+
return toks;
|
|
393
|
+
}
|
|
394
|
+
class Parser {
|
|
395
|
+
toks;
|
|
396
|
+
i = 0;
|
|
397
|
+
constructor(toks) {
|
|
398
|
+
this.toks = toks;
|
|
399
|
+
}
|
|
400
|
+
peek() {
|
|
401
|
+
return this.toks[this.i] ?? { t: 'eof', v: '' };
|
|
402
|
+
}
|
|
403
|
+
eat() {
|
|
404
|
+
return this.toks[this.i++] ?? { t: 'eof', v: '' };
|
|
405
|
+
}
|
|
406
|
+
parseProgram() {
|
|
407
|
+
const body = [];
|
|
408
|
+
while (this.peek().t !== 'eof' && this.i < this.toks.length - 1) {
|
|
409
|
+
try {
|
|
410
|
+
const node = this.parseStatement();
|
|
411
|
+
if (node)
|
|
412
|
+
body.push(node);
|
|
413
|
+
}
|
|
414
|
+
catch {
|
|
415
|
+
this.i++;
|
|
416
|
+
if (body.length > 60)
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return { type: 'Program', body };
|
|
421
|
+
}
|
|
422
|
+
parseStatement() {
|
|
423
|
+
const p = this.peek();
|
|
424
|
+
if (p.v === 'import')
|
|
425
|
+
return this.parseImport();
|
|
426
|
+
if (p.v === 'export')
|
|
427
|
+
return this.parseExport();
|
|
428
|
+
if (p.v === 'class')
|
|
429
|
+
return this.parseClass();
|
|
430
|
+
if (p.v === 'function' || p.v === 'async')
|
|
431
|
+
return this.parseFunction();
|
|
432
|
+
if (p.v === 'const' || p.v === 'let' || p.v === 'var')
|
|
433
|
+
return this.parseVarDecl();
|
|
434
|
+
if (p.v === 'return')
|
|
435
|
+
return this.parseReturn();
|
|
436
|
+
if (p.v === 'if')
|
|
437
|
+
return this.parseIf();
|
|
438
|
+
if (p.v === 'for')
|
|
439
|
+
return this.parseFor();
|
|
440
|
+
if (p.v === 'while')
|
|
441
|
+
return this.parseWhile();
|
|
442
|
+
if (p.v === 'try')
|
|
443
|
+
return this.parseTryCatch();
|
|
444
|
+
// expression statement — skip to semicolon or block boundary
|
|
445
|
+
return this.skipToSemicolon();
|
|
446
|
+
}
|
|
447
|
+
skipToSemicolon() {
|
|
448
|
+
let depth = 0;
|
|
449
|
+
while (this.peek().t !== 'eof') {
|
|
450
|
+
const v = this.peek().v;
|
|
451
|
+
if (v === '{' || v === '(' || v === '[')
|
|
452
|
+
depth++;
|
|
453
|
+
if (v === '}' || v === ')' || v === ']') {
|
|
454
|
+
if (depth === 0)
|
|
455
|
+
break;
|
|
456
|
+
depth--;
|
|
457
|
+
}
|
|
458
|
+
if (depth === 0 && v === ';') {
|
|
459
|
+
this.eat();
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
this.eat();
|
|
463
|
+
}
|
|
464
|
+
return { type: 'ExpressionStatement' };
|
|
465
|
+
}
|
|
466
|
+
parseImport() {
|
|
467
|
+
this.eat(); // import
|
|
468
|
+
const specifiers = [];
|
|
469
|
+
while (this.peek().t !== 'eof' && this.peek().v !== ';' && this.peek().v !== '\n') {
|
|
470
|
+
if (this.peek().t === 'identifier')
|
|
471
|
+
specifiers.push(this.peek().v);
|
|
472
|
+
this.eat();
|
|
473
|
+
}
|
|
474
|
+
if (this.peek().v === ';')
|
|
475
|
+
this.eat();
|
|
476
|
+
return { type: 'ImportDeclaration', specifiers };
|
|
477
|
+
}
|
|
478
|
+
parseExport() {
|
|
479
|
+
this.eat(); // export
|
|
480
|
+
const isDefault = this.peek().v === 'default';
|
|
481
|
+
if (isDefault)
|
|
482
|
+
this.eat();
|
|
483
|
+
const declaration = this.peek().t !== 'eof' ? this.parseStatement() : null;
|
|
484
|
+
return { type: 'ExportDeclaration', default: isDefault, declaration };
|
|
485
|
+
}
|
|
486
|
+
parseClass() {
|
|
487
|
+
this.eat(); // class
|
|
488
|
+
const name = this.peek().t === 'identifier' ? this.eat().v : '';
|
|
489
|
+
let superClass = null;
|
|
490
|
+
if (this.peek().v === 'extends') {
|
|
491
|
+
this.eat();
|
|
492
|
+
superClass = this.peek().t === 'identifier' ? this.eat().v : null;
|
|
493
|
+
}
|
|
494
|
+
const methods = [];
|
|
495
|
+
if (this.peek().v === '{') {
|
|
496
|
+
this.eat();
|
|
497
|
+
let depth = 1;
|
|
498
|
+
while (this.peek().t !== 'eof' && depth > 0) {
|
|
499
|
+
const v = this.peek().v;
|
|
500
|
+
if (v === '{')
|
|
501
|
+
depth++;
|
|
502
|
+
if (v === '}') {
|
|
503
|
+
depth--;
|
|
504
|
+
if (depth === 0) {
|
|
505
|
+
this.eat();
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (depth === 1 && this.peek().t === 'identifier' && this.toks[this.i + 1]?.v === '(') {
|
|
510
|
+
const modifier = this.toks[this.i - 1]?.v === 'static' ? 'static' : this.toks[this.i - 1]?.v === 'async' ? 'async' : '';
|
|
511
|
+
methods.push({ type: 'MethodDefinition', key: this.peek().v, kind: modifier || 'method' });
|
|
512
|
+
}
|
|
513
|
+
this.eat();
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return { type: 'ClassDeclaration', id: { name }, superClass, body: { type: 'ClassBody', body: methods } };
|
|
517
|
+
}
|
|
518
|
+
parseFunction() {
|
|
519
|
+
if (this.peek().v === 'async')
|
|
520
|
+
this.eat();
|
|
521
|
+
this.eat(); // function
|
|
522
|
+
const name = this.peek().t === 'identifier' ? this.eat().v : '(anonymous)';
|
|
523
|
+
const params = [];
|
|
524
|
+
if (this.peek().v === '(') {
|
|
525
|
+
this.eat();
|
|
526
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof') {
|
|
527
|
+
if (this.peek().t === 'identifier')
|
|
528
|
+
params.push(this.peek().v);
|
|
529
|
+
this.eat();
|
|
530
|
+
}
|
|
531
|
+
if (this.peek().v === ')')
|
|
532
|
+
this.eat();
|
|
533
|
+
}
|
|
534
|
+
// skip body
|
|
535
|
+
this.skipBlock();
|
|
536
|
+
return { type: 'FunctionDeclaration', id: { name }, params: params.map(p => ({ type: 'Identifier', name: p })) };
|
|
537
|
+
}
|
|
538
|
+
skipBlock() {
|
|
539
|
+
if (this.peek().v !== '{')
|
|
540
|
+
return;
|
|
541
|
+
this.eat();
|
|
542
|
+
let depth = 1;
|
|
543
|
+
while (this.peek().t !== 'eof' && depth > 0) {
|
|
544
|
+
if (this.peek().v === '{')
|
|
545
|
+
depth++;
|
|
546
|
+
if (this.peek().v === '}')
|
|
547
|
+
depth--;
|
|
548
|
+
this.eat();
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
parseVarDecl() {
|
|
552
|
+
const kind = this.eat().v; // const / let / var
|
|
553
|
+
const declarations = [];
|
|
554
|
+
while (this.peek().t !== 'eof' && this.peek().v !== ';') {
|
|
555
|
+
if (this.peek().t === 'identifier') {
|
|
556
|
+
const id = this.eat().v;
|
|
557
|
+
let init = null;
|
|
558
|
+
if (this.peek().v === '=') {
|
|
559
|
+
this.eat();
|
|
560
|
+
// try to capture simple init expression
|
|
561
|
+
if (this.peek().t === 'string')
|
|
562
|
+
init = { type: 'Literal', value: this.eat().v };
|
|
563
|
+
else if (this.peek().t === 'number')
|
|
564
|
+
init = { type: 'Literal', value: this.eat().v };
|
|
565
|
+
else if (this.peek().v === 'new') {
|
|
566
|
+
this.eat();
|
|
567
|
+
const cls = this.peek().t === 'identifier' ? this.eat().v : '';
|
|
568
|
+
if (this.peek().v === '(') {
|
|
569
|
+
this.eat();
|
|
570
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof')
|
|
571
|
+
this.eat();
|
|
572
|
+
this.eat();
|
|
573
|
+
}
|
|
574
|
+
init = { type: 'NewExpression', callee: cls };
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
// skip complex init
|
|
578
|
+
let depth = 0;
|
|
579
|
+
while (this.peek().t !== 'eof') {
|
|
580
|
+
const v = this.peek().v;
|
|
581
|
+
if (v === '{' || v === '(' || v === '[')
|
|
582
|
+
depth++;
|
|
583
|
+
if (v === '}' || v === ')' || v === ']') {
|
|
584
|
+
if (depth === 0)
|
|
585
|
+
break;
|
|
586
|
+
depth--;
|
|
587
|
+
}
|
|
588
|
+
if (depth === 0 && (v === ',' || v === ';'))
|
|
589
|
+
break;
|
|
590
|
+
this.eat();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
declarations.push({ type: 'VariableDeclarator', id: { type: 'Identifier', name: id }, init });
|
|
595
|
+
if (this.peek().v === ',')
|
|
596
|
+
this.eat();
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
if (this.peek().v === '{' || this.peek().v === '[') {
|
|
600
|
+
this.skipBlock();
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
this.eat();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (this.peek().v === ';')
|
|
607
|
+
this.eat();
|
|
608
|
+
return { type: 'VariableDeclaration', kind, declarations };
|
|
609
|
+
}
|
|
610
|
+
parseReturn() {
|
|
611
|
+
this.eat(); // return
|
|
612
|
+
return this.skipToSemicolon() && { type: 'ReturnStatement' };
|
|
613
|
+
}
|
|
614
|
+
parseIf() {
|
|
615
|
+
this.eat(); // if
|
|
616
|
+
if (this.peek().v === '(') {
|
|
617
|
+
this.eat();
|
|
618
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof')
|
|
619
|
+
this.eat();
|
|
620
|
+
this.eat();
|
|
621
|
+
}
|
|
622
|
+
this.skipBlock();
|
|
623
|
+
if (this.peek().v === 'else') {
|
|
624
|
+
this.eat();
|
|
625
|
+
this.skipBlock();
|
|
626
|
+
}
|
|
627
|
+
return { type: 'IfStatement' };
|
|
628
|
+
}
|
|
629
|
+
parseFor() {
|
|
630
|
+
this.eat(); // for
|
|
631
|
+
if (this.peek().v === '(') {
|
|
632
|
+
this.eat();
|
|
633
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof')
|
|
634
|
+
this.eat();
|
|
635
|
+
this.eat();
|
|
636
|
+
}
|
|
637
|
+
this.skipBlock();
|
|
638
|
+
return { type: 'ForStatement' };
|
|
639
|
+
}
|
|
640
|
+
parseWhile() {
|
|
641
|
+
this.eat(); // while
|
|
642
|
+
if (this.peek().v === '(') {
|
|
643
|
+
this.eat();
|
|
644
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof')
|
|
645
|
+
this.eat();
|
|
646
|
+
this.eat();
|
|
647
|
+
}
|
|
648
|
+
this.skipBlock();
|
|
649
|
+
return { type: 'WhileStatement' };
|
|
650
|
+
}
|
|
651
|
+
parseTryCatch() {
|
|
652
|
+
this.eat(); // try
|
|
653
|
+
this.skipBlock();
|
|
654
|
+
if (this.peek().v === 'catch') {
|
|
655
|
+
this.eat();
|
|
656
|
+
if (this.peek().v === '(') {
|
|
657
|
+
this.eat();
|
|
658
|
+
while (this.peek().v !== ')' && this.peek().t !== 'eof')
|
|
659
|
+
this.eat();
|
|
660
|
+
this.eat();
|
|
661
|
+
}
|
|
662
|
+
this.skipBlock();
|
|
663
|
+
}
|
|
664
|
+
if (this.peek().v === 'finally') {
|
|
665
|
+
this.eat();
|
|
666
|
+
this.skipBlock();
|
|
667
|
+
}
|
|
668
|
+
return { type: 'TryStatement' };
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function parseAST(code) {
|
|
672
|
+
try {
|
|
673
|
+
const toks = tokenize(code);
|
|
674
|
+
return new Parser(toks).parseProgram();
|
|
675
|
+
}
|
|
676
|
+
catch (e) {
|
|
677
|
+
return { type: 'Program', body: [], error: String(e) };
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
const JS_ITEMS = [
|
|
682
|
+
// keywords
|
|
683
|
+
...[
|
|
684
|
+
'const',
|
|
685
|
+
'let',
|
|
686
|
+
'var',
|
|
687
|
+
'function',
|
|
688
|
+
'class',
|
|
689
|
+
'return',
|
|
690
|
+
'if',
|
|
691
|
+
'else',
|
|
692
|
+
'for',
|
|
693
|
+
'while',
|
|
694
|
+
'do',
|
|
695
|
+
'switch',
|
|
696
|
+
'case',
|
|
697
|
+
'break',
|
|
698
|
+
'continue',
|
|
699
|
+
'try',
|
|
700
|
+
'catch',
|
|
701
|
+
'finally',
|
|
702
|
+
'throw',
|
|
703
|
+
'async',
|
|
704
|
+
'await',
|
|
705
|
+
'import',
|
|
706
|
+
'export',
|
|
707
|
+
'default',
|
|
708
|
+
'from',
|
|
709
|
+
'new',
|
|
710
|
+
'this',
|
|
711
|
+
'typeof',
|
|
712
|
+
'instanceof',
|
|
713
|
+
'delete',
|
|
714
|
+
'void',
|
|
715
|
+
'null',
|
|
716
|
+
'undefined',
|
|
717
|
+
'true',
|
|
718
|
+
'false',
|
|
719
|
+
].map(k => ({
|
|
720
|
+
label: k,
|
|
721
|
+
type: 'kw',
|
|
722
|
+
detail: 'keyword',
|
|
723
|
+
})),
|
|
724
|
+
// snippets
|
|
725
|
+
{
|
|
726
|
+
label: 'caf',
|
|
727
|
+
type: 'snip',
|
|
728
|
+
detail: 'const arrow fn',
|
|
729
|
+
doc: 'Creates a const arrow function',
|
|
730
|
+
insert: 'const ${1:name} = (${2:args}) => {\n $0\n};',
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
label: 'afn',
|
|
734
|
+
type: 'snip',
|
|
735
|
+
detail: 'async arrow fn',
|
|
736
|
+
insert: 'const ${1:name} = async (${2:args}) => {\n $0\n};',
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
label: 'fn',
|
|
740
|
+
type: 'snip',
|
|
741
|
+
detail: 'function declaration',
|
|
742
|
+
insert: 'function ${1:name}(${2:args}) {\n $0\n}',
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
label: 'class',
|
|
746
|
+
type: 'snip',
|
|
747
|
+
detail: 'class declaration',
|
|
748
|
+
insert: 'class ${1:Name} {\n constructor(${2:args}) {\n $0\n }\n}',
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
label: 'for',
|
|
752
|
+
type: 'snip',
|
|
753
|
+
detail: 'for loop',
|
|
754
|
+
insert: 'for (let ${1:i} = 0; ${1:i} < ${2:arr}.length; ${1:i}++) {\n $0\n}',
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
label: 'forin',
|
|
758
|
+
type: 'snip',
|
|
759
|
+
detail: 'for...in',
|
|
760
|
+
insert: 'for (const ${1:key} in ${2:obj}) {\n $0\n}',
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
label: 'forof',
|
|
764
|
+
type: 'snip',
|
|
765
|
+
detail: 'for...of',
|
|
766
|
+
insert: 'for (const ${1:item} of ${2:arr}) {\n $0\n}',
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
label: 'try',
|
|
770
|
+
type: 'snip',
|
|
771
|
+
detail: 'try / catch',
|
|
772
|
+
insert: 'try {\n $0\n} catch (${1:err}) {\n console.error(${1:err});\n}',
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
label: 'imp',
|
|
776
|
+
type: 'snip',
|
|
777
|
+
detail: 'import statement',
|
|
778
|
+
insert: "import { ${1:name} } from '${2:module}';",
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
label: 'prom',
|
|
782
|
+
type: 'snip',
|
|
783
|
+
detail: 'new Promise',
|
|
784
|
+
insert: 'new Promise((${1:resolve}, ${2:reject}) => {\n $0\n})',
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
label: 'ife',
|
|
788
|
+
type: 'snip',
|
|
789
|
+
detail: 'immediately invoked fn',
|
|
790
|
+
insert: '(async () => {\n $0\n})();',
|
|
791
|
+
},
|
|
792
|
+
// builtins
|
|
793
|
+
...[
|
|
794
|
+
'console.log',
|
|
795
|
+
'console.error',
|
|
796
|
+
'console.warn',
|
|
797
|
+
'console.table',
|
|
798
|
+
'console.dir',
|
|
799
|
+
'Math.floor',
|
|
800
|
+
'Math.ceil',
|
|
801
|
+
'Math.round',
|
|
802
|
+
'Math.max',
|
|
803
|
+
'Math.min',
|
|
804
|
+
'Math.abs',
|
|
805
|
+
'Math.random',
|
|
806
|
+
'Math.pow',
|
|
807
|
+
'Math.sqrt',
|
|
808
|
+
'Array.from',
|
|
809
|
+
'Array.isArray',
|
|
810
|
+
'Array.of',
|
|
811
|
+
'Object.keys',
|
|
812
|
+
'Object.values',
|
|
813
|
+
'Object.entries',
|
|
814
|
+
'Object.assign',
|
|
815
|
+
'Object.freeze',
|
|
816
|
+
'Object.create',
|
|
817
|
+
'JSON.parse',
|
|
818
|
+
'JSON.stringify',
|
|
819
|
+
'parseInt',
|
|
820
|
+
'parseFloat',
|
|
821
|
+
'isNaN',
|
|
822
|
+
'isFinite',
|
|
823
|
+
'setTimeout',
|
|
824
|
+
'setInterval',
|
|
825
|
+
'clearTimeout',
|
|
826
|
+
'clearInterval',
|
|
827
|
+
'requestAnimationFrame',
|
|
828
|
+
'fetch',
|
|
829
|
+
'Promise.all',
|
|
830
|
+
'Promise.allSettled',
|
|
831
|
+
'Promise.race',
|
|
832
|
+
'Promise.resolve',
|
|
833
|
+
'Promise.reject',
|
|
834
|
+
'document.querySelector',
|
|
835
|
+
'document.querySelectorAll',
|
|
836
|
+
'document.getElementById',
|
|
837
|
+
'document.createElement',
|
|
838
|
+
'document.addEventListener',
|
|
839
|
+
'window.addEventListener',
|
|
840
|
+
'window.removeEventListener',
|
|
841
|
+
'localStorage.getItem',
|
|
842
|
+
'localStorage.setItem',
|
|
843
|
+
'localStorage.removeItem',
|
|
844
|
+
'sessionStorage.getItem',
|
|
845
|
+
'sessionStorage.setItem',
|
|
846
|
+
].map(b => ({ label: b, type: 'fn', detail: 'builtin' })),
|
|
847
|
+
// array methods
|
|
848
|
+
...[
|
|
849
|
+
'forEach',
|
|
850
|
+
'map',
|
|
851
|
+
'filter',
|
|
852
|
+
'reduce',
|
|
853
|
+
'reduceRight',
|
|
854
|
+
'find',
|
|
855
|
+
'findIndex',
|
|
856
|
+
'findLast',
|
|
857
|
+
'some',
|
|
858
|
+
'every',
|
|
859
|
+
'includes',
|
|
860
|
+
'indexOf',
|
|
861
|
+
'lastIndexOf',
|
|
862
|
+
'slice',
|
|
863
|
+
'splice',
|
|
864
|
+
'push',
|
|
865
|
+
'pop',
|
|
866
|
+
'shift',
|
|
867
|
+
'unshift',
|
|
868
|
+
'sort',
|
|
869
|
+
'reverse',
|
|
870
|
+
'flat',
|
|
871
|
+
'flatMap',
|
|
872
|
+
'join',
|
|
873
|
+
'fill',
|
|
874
|
+
'copyWithin',
|
|
875
|
+
'entries',
|
|
876
|
+
'keys',
|
|
877
|
+
'values',
|
|
878
|
+
'at',
|
|
879
|
+
'toSorted',
|
|
880
|
+
'toReversed',
|
|
881
|
+
'toSpliced',
|
|
882
|
+
'with',
|
|
883
|
+
].map(m => ({ label: '.' + m, type: 'prop', detail: 'Array method' })),
|
|
884
|
+
// string methods
|
|
885
|
+
...[
|
|
886
|
+
'split',
|
|
887
|
+
'trim',
|
|
888
|
+
'trimStart',
|
|
889
|
+
'trimEnd',
|
|
890
|
+
'replace',
|
|
891
|
+
'replaceAll',
|
|
892
|
+
'match',
|
|
893
|
+
'matchAll',
|
|
894
|
+
'search',
|
|
895
|
+
'startsWith',
|
|
896
|
+
'endsWith',
|
|
897
|
+
'includes',
|
|
898
|
+
'indexOf',
|
|
899
|
+
'lastIndexOf',
|
|
900
|
+
'slice',
|
|
901
|
+
'substring',
|
|
902
|
+
'padStart',
|
|
903
|
+
'padEnd',
|
|
904
|
+
'repeat',
|
|
905
|
+
'toUpperCase',
|
|
906
|
+
'toLowerCase',
|
|
907
|
+
'charAt',
|
|
908
|
+
'charCodeAt',
|
|
909
|
+
'codePointAt',
|
|
910
|
+
'normalize',
|
|
911
|
+
'at',
|
|
912
|
+
].map(m => ({ label: '.' + m, type: 'prop', detail: 'String method' })),
|
|
913
|
+
// promise / async methods
|
|
914
|
+
...['then', 'catch', 'finally'].map(m => ({ label: '.' + m, type: 'prop', detail: 'Promise method' })),
|
|
915
|
+
];
|
|
916
|
+
const CSS_ITEMS = [
|
|
917
|
+
...[
|
|
918
|
+
'display',
|
|
919
|
+
'position',
|
|
920
|
+
'flex',
|
|
921
|
+
'grid',
|
|
922
|
+
'width',
|
|
923
|
+
'height',
|
|
924
|
+
'min-width',
|
|
925
|
+
'max-width',
|
|
926
|
+
'min-height',
|
|
927
|
+
'max-height',
|
|
928
|
+
'margin',
|
|
929
|
+
'margin-top',
|
|
930
|
+
'margin-right',
|
|
931
|
+
'margin-bottom',
|
|
932
|
+
'margin-left',
|
|
933
|
+
'padding',
|
|
934
|
+
'padding-top',
|
|
935
|
+
'padding-right',
|
|
936
|
+
'padding-bottom',
|
|
937
|
+
'padding-left',
|
|
938
|
+
'color',
|
|
939
|
+
'background',
|
|
940
|
+
'background-color',
|
|
941
|
+
'background-image',
|
|
942
|
+
'background-size',
|
|
943
|
+
'background-position',
|
|
944
|
+
'border',
|
|
945
|
+
'border-width',
|
|
946
|
+
'border-style',
|
|
947
|
+
'border-color',
|
|
948
|
+
'border-radius',
|
|
949
|
+
'font-size',
|
|
950
|
+
'font-weight',
|
|
951
|
+
'font-family',
|
|
952
|
+
'font-style',
|
|
953
|
+
'line-height',
|
|
954
|
+
'letter-spacing',
|
|
955
|
+
'text-align',
|
|
956
|
+
'text-decoration',
|
|
957
|
+
'text-transform',
|
|
958
|
+
'white-space',
|
|
959
|
+
'word-break',
|
|
960
|
+
'overflow',
|
|
961
|
+
'overflow-x',
|
|
962
|
+
'overflow-y',
|
|
963
|
+
'z-index',
|
|
964
|
+
'opacity',
|
|
965
|
+
'visibility',
|
|
966
|
+
'pointer-events',
|
|
967
|
+
'cursor',
|
|
968
|
+
'user-select',
|
|
969
|
+
'outline',
|
|
970
|
+
'box-shadow',
|
|
971
|
+
'text-shadow',
|
|
972
|
+
'transition',
|
|
973
|
+
'transform',
|
|
974
|
+
'animation',
|
|
975
|
+
'animation-name',
|
|
976
|
+
'animation-duration',
|
|
977
|
+
'gap',
|
|
978
|
+
'row-gap',
|
|
979
|
+
'column-gap',
|
|
980
|
+
'align-items',
|
|
981
|
+
'align-self',
|
|
982
|
+
'align-content',
|
|
983
|
+
'justify-content',
|
|
984
|
+
'justify-items',
|
|
985
|
+
'justify-self',
|
|
986
|
+
'flex-direction',
|
|
987
|
+
'flex-wrap',
|
|
988
|
+
'flex-grow',
|
|
989
|
+
'flex-shrink',
|
|
990
|
+
'flex-basis',
|
|
991
|
+
'grid-template-columns',
|
|
992
|
+
'grid-template-rows',
|
|
993
|
+
'grid-column',
|
|
994
|
+
'grid-row',
|
|
995
|
+
'grid-area',
|
|
996
|
+
'place-items',
|
|
997
|
+
'place-content',
|
|
998
|
+
'object-fit',
|
|
999
|
+
'object-position',
|
|
1000
|
+
'aspect-ratio',
|
|
1001
|
+
'clip-path',
|
|
1002
|
+
'filter',
|
|
1003
|
+
'backdrop-filter',
|
|
1004
|
+
'will-change',
|
|
1005
|
+
'contain',
|
|
1006
|
+
'content',
|
|
1007
|
+
'resize',
|
|
1008
|
+
'top',
|
|
1009
|
+
'right',
|
|
1010
|
+
'bottom',
|
|
1011
|
+
'left',
|
|
1012
|
+
'inset',
|
|
1013
|
+
].map(p => ({ label: p, type: 'prop', detail: 'property' })),
|
|
1014
|
+
...[
|
|
1015
|
+
'none',
|
|
1016
|
+
'auto',
|
|
1017
|
+
'inherit',
|
|
1018
|
+
'initial',
|
|
1019
|
+
'unset',
|
|
1020
|
+
'revert',
|
|
1021
|
+
'flex',
|
|
1022
|
+
'grid',
|
|
1023
|
+
'block',
|
|
1024
|
+
'inline',
|
|
1025
|
+
'inline-block',
|
|
1026
|
+
'inline-flex',
|
|
1027
|
+
'inline-grid',
|
|
1028
|
+
'absolute',
|
|
1029
|
+
'relative',
|
|
1030
|
+
'fixed',
|
|
1031
|
+
'sticky',
|
|
1032
|
+
'static',
|
|
1033
|
+
'hidden',
|
|
1034
|
+
'visible',
|
|
1035
|
+
'scroll',
|
|
1036
|
+
'clip',
|
|
1037
|
+
'transparent',
|
|
1038
|
+
'currentColor',
|
|
1039
|
+
'center',
|
|
1040
|
+
'start',
|
|
1041
|
+
'end',
|
|
1042
|
+
'stretch',
|
|
1043
|
+
'left',
|
|
1044
|
+
'right',
|
|
1045
|
+
'normal',
|
|
1046
|
+
'bold',
|
|
1047
|
+
'italic',
|
|
1048
|
+
'nowrap',
|
|
1049
|
+
'pre',
|
|
1050
|
+
'pre-wrap',
|
|
1051
|
+
'break-word',
|
|
1052
|
+
'pointer',
|
|
1053
|
+
'default',
|
|
1054
|
+
'cover',
|
|
1055
|
+
'contain',
|
|
1056
|
+
'fill',
|
|
1057
|
+
'underline',
|
|
1058
|
+
'line-through',
|
|
1059
|
+
'uppercase',
|
|
1060
|
+
'lowercase',
|
|
1061
|
+
'capitalize',
|
|
1062
|
+
'ease',
|
|
1063
|
+
'ease-in',
|
|
1064
|
+
'ease-out',
|
|
1065
|
+
'ease-in-out',
|
|
1066
|
+
'linear',
|
|
1067
|
+
'forwards',
|
|
1068
|
+
'backwards',
|
|
1069
|
+
'both',
|
|
1070
|
+
].map(v => ({ label: v, type: 'kw', detail: 'value' })),
|
|
1071
|
+
...[
|
|
1072
|
+
'rgb()',
|
|
1073
|
+
'rgba()',
|
|
1074
|
+
'hsl()',
|
|
1075
|
+
'hsla()',
|
|
1076
|
+
'oklch()',
|
|
1077
|
+
'color()',
|
|
1078
|
+
'linear-gradient()',
|
|
1079
|
+
'radial-gradient()',
|
|
1080
|
+
'conic-gradient()',
|
|
1081
|
+
'var()',
|
|
1082
|
+
'calc()',
|
|
1083
|
+
'clamp()',
|
|
1084
|
+
'min()',
|
|
1085
|
+
'max()',
|
|
1086
|
+
'env()',
|
|
1087
|
+
'url()',
|
|
1088
|
+
'format()',
|
|
1089
|
+
'translate()',
|
|
1090
|
+
'scale()',
|
|
1091
|
+
'rotate()',
|
|
1092
|
+
'matrix()',
|
|
1093
|
+
].map(f => ({ label: f, type: 'fn', detail: 'function' })),
|
|
1094
|
+
];
|
|
1095
|
+
const HTML_ITEMS = [
|
|
1096
|
+
...[
|
|
1097
|
+
'div',
|
|
1098
|
+
'span',
|
|
1099
|
+
'p',
|
|
1100
|
+
'h1',
|
|
1101
|
+
'h2',
|
|
1102
|
+
'h3',
|
|
1103
|
+
'h4',
|
|
1104
|
+
'h5',
|
|
1105
|
+
'h6',
|
|
1106
|
+
'a',
|
|
1107
|
+
'img',
|
|
1108
|
+
'input',
|
|
1109
|
+
'button',
|
|
1110
|
+
'form',
|
|
1111
|
+
'label',
|
|
1112
|
+
'select',
|
|
1113
|
+
'option',
|
|
1114
|
+
'optgroup',
|
|
1115
|
+
'textarea',
|
|
1116
|
+
'fieldset',
|
|
1117
|
+
'legend',
|
|
1118
|
+
'ul',
|
|
1119
|
+
'ol',
|
|
1120
|
+
'li',
|
|
1121
|
+
'dl',
|
|
1122
|
+
'dt',
|
|
1123
|
+
'dd',
|
|
1124
|
+
'table',
|
|
1125
|
+
'tr',
|
|
1126
|
+
'td',
|
|
1127
|
+
'th',
|
|
1128
|
+
'thead',
|
|
1129
|
+
'tbody',
|
|
1130
|
+
'tfoot',
|
|
1131
|
+
'caption',
|
|
1132
|
+
'colgroup',
|
|
1133
|
+
'col',
|
|
1134
|
+
'nav',
|
|
1135
|
+
'header',
|
|
1136
|
+
'footer',
|
|
1137
|
+
'main',
|
|
1138
|
+
'section',
|
|
1139
|
+
'article',
|
|
1140
|
+
'aside',
|
|
1141
|
+
'address',
|
|
1142
|
+
'dialog',
|
|
1143
|
+
'details',
|
|
1144
|
+
'summary',
|
|
1145
|
+
'figure',
|
|
1146
|
+
'figcaption',
|
|
1147
|
+
'video',
|
|
1148
|
+
'audio',
|
|
1149
|
+
'source',
|
|
1150
|
+
'track',
|
|
1151
|
+
'canvas',
|
|
1152
|
+
'svg',
|
|
1153
|
+
'path',
|
|
1154
|
+
'circle',
|
|
1155
|
+
'rect',
|
|
1156
|
+
'line',
|
|
1157
|
+
'script',
|
|
1158
|
+
'link',
|
|
1159
|
+
'meta',
|
|
1160
|
+
'title',
|
|
1161
|
+
'base',
|
|
1162
|
+
'head',
|
|
1163
|
+
'body',
|
|
1164
|
+
'html',
|
|
1165
|
+
'style',
|
|
1166
|
+
'template',
|
|
1167
|
+
'slot',
|
|
1168
|
+
'picture',
|
|
1169
|
+
'iframe',
|
|
1170
|
+
'object',
|
|
1171
|
+
'embed',
|
|
1172
|
+
'code',
|
|
1173
|
+
'pre',
|
|
1174
|
+
'kbd',
|
|
1175
|
+
'samp',
|
|
1176
|
+
'var',
|
|
1177
|
+
'mark',
|
|
1178
|
+
'del',
|
|
1179
|
+
'ins',
|
|
1180
|
+
's',
|
|
1181
|
+
'sub',
|
|
1182
|
+
'sup',
|
|
1183
|
+
'abbr',
|
|
1184
|
+
'blockquote',
|
|
1185
|
+
'cite',
|
|
1186
|
+
'q',
|
|
1187
|
+
'small',
|
|
1188
|
+
'strong',
|
|
1189
|
+
'em',
|
|
1190
|
+
'b',
|
|
1191
|
+
'i',
|
|
1192
|
+
'u',
|
|
1193
|
+
'time',
|
|
1194
|
+
'data',
|
|
1195
|
+
].map(t => ({ label: '<' + t, type: 'tag', detail: 'element', insert: `<${t}>$0</${t}>` })),
|
|
1196
|
+
...[
|
|
1197
|
+
'class',
|
|
1198
|
+
'id',
|
|
1199
|
+
'src',
|
|
1200
|
+
'href',
|
|
1201
|
+
'alt',
|
|
1202
|
+
'type',
|
|
1203
|
+
'name',
|
|
1204
|
+
'value',
|
|
1205
|
+
'placeholder',
|
|
1206
|
+
'disabled',
|
|
1207
|
+
'checked',
|
|
1208
|
+
'readonly',
|
|
1209
|
+
'required',
|
|
1210
|
+
'data-',
|
|
1211
|
+
'aria-label',
|
|
1212
|
+
'aria-hidden',
|
|
1213
|
+
'aria-expanded',
|
|
1214
|
+
'aria-controls',
|
|
1215
|
+
'aria-describedby',
|
|
1216
|
+
'role',
|
|
1217
|
+
'tabindex',
|
|
1218
|
+
'style',
|
|
1219
|
+
'title',
|
|
1220
|
+
'target',
|
|
1221
|
+
'rel',
|
|
1222
|
+
'action',
|
|
1223
|
+
'method',
|
|
1224
|
+
'for',
|
|
1225
|
+
'colspan',
|
|
1226
|
+
'rowspan',
|
|
1227
|
+
'width',
|
|
1228
|
+
'height',
|
|
1229
|
+
'loading',
|
|
1230
|
+
'defer',
|
|
1231
|
+
'async',
|
|
1232
|
+
'charset',
|
|
1233
|
+
'content',
|
|
1234
|
+
'property',
|
|
1235
|
+
'lang',
|
|
1236
|
+
'dir',
|
|
1237
|
+
'hidden',
|
|
1238
|
+
'autofocus',
|
|
1239
|
+
'multiple',
|
|
1240
|
+
'accept',
|
|
1241
|
+
'pattern',
|
|
1242
|
+
'min',
|
|
1243
|
+
'max',
|
|
1244
|
+
'step',
|
|
1245
|
+
'autocomplete',
|
|
1246
|
+
'enctype',
|
|
1247
|
+
'novalidate',
|
|
1248
|
+
'crossorigin',
|
|
1249
|
+
'integrity',
|
|
1250
|
+
'referrerpolicy',
|
|
1251
|
+
'fetchpriority',
|
|
1252
|
+
].map(a => ({ label: a, type: 'attr', detail: 'attribute' })),
|
|
1253
|
+
];
|
|
1254
|
+
const JSON_ITEMS = [
|
|
1255
|
+
{ label: 'true', type: 'kw', detail: 'boolean' },
|
|
1256
|
+
{ label: 'false', type: 'kw', detail: 'boolean' },
|
|
1257
|
+
{ label: 'null', type: 'kw', detail: 'null' },
|
|
1258
|
+
];
|
|
1259
|
+
const DB = {
|
|
1260
|
+
js: JS_ITEMS,
|
|
1261
|
+
css: CSS_ITEMS,
|
|
1262
|
+
html: HTML_ITEMS,
|
|
1263
|
+
json: JSON_ITEMS,
|
|
1264
|
+
};
|
|
1265
|
+
function getCompletions(prefix, lang) {
|
|
1266
|
+
if (!prefix || prefix.length < 1)
|
|
1267
|
+
return [];
|
|
1268
|
+
const lower = prefix.toLowerCase();
|
|
1269
|
+
return (DB[lang] || []).filter(item => item.label.toLowerCase().startsWith(lower) && item.label !== prefix).slice(0, 14);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// src/utils/history.ts
|
|
1273
|
+
class EditHistory {
|
|
1274
|
+
stack = [];
|
|
1275
|
+
index = -1;
|
|
1276
|
+
maxSize;
|
|
1277
|
+
timer = null;
|
|
1278
|
+
constructor(maxSize = 200) {
|
|
1279
|
+
this.maxSize = maxSize;
|
|
1280
|
+
}
|
|
1281
|
+
push(entry) {
|
|
1282
|
+
// debounce: only push after 400ms of inactivity
|
|
1283
|
+
if (this.timer !== null)
|
|
1284
|
+
clearTimeout(this.timer);
|
|
1285
|
+
this.timer = setTimeout(() => {
|
|
1286
|
+
if (this.stack[this.index]?.value === entry.value)
|
|
1287
|
+
return;
|
|
1288
|
+
this.stack = this.stack.slice(0, this.index + 1);
|
|
1289
|
+
this.stack.push({ ...entry });
|
|
1290
|
+
if (this.stack.length > this.maxSize)
|
|
1291
|
+
this.stack.shift();
|
|
1292
|
+
this.index = this.stack.length - 1;
|
|
1293
|
+
}, 400);
|
|
1294
|
+
}
|
|
1295
|
+
/** Push immediately (e.g., before a bulk operation) */
|
|
1296
|
+
pushNow(entry) {
|
|
1297
|
+
if (this.timer !== null) {
|
|
1298
|
+
clearTimeout(this.timer);
|
|
1299
|
+
this.timer = null;
|
|
1300
|
+
}
|
|
1301
|
+
if (this.stack[this.index]?.value === entry.value)
|
|
1302
|
+
return;
|
|
1303
|
+
this.stack = this.stack.slice(0, this.index + 1);
|
|
1304
|
+
this.stack.push({ ...entry });
|
|
1305
|
+
if (this.stack.length > this.maxSize)
|
|
1306
|
+
this.stack.shift();
|
|
1307
|
+
this.index = this.stack.length - 1;
|
|
1308
|
+
}
|
|
1309
|
+
undo() {
|
|
1310
|
+
if (this.index <= 0)
|
|
1311
|
+
return null;
|
|
1312
|
+
this.index--;
|
|
1313
|
+
return { ...this.stack[this.index] };
|
|
1314
|
+
}
|
|
1315
|
+
redo() {
|
|
1316
|
+
if (this.index >= this.stack.length - 1)
|
|
1317
|
+
return null;
|
|
1318
|
+
this.index++;
|
|
1319
|
+
return { ...this.stack[this.index] };
|
|
1320
|
+
}
|
|
1321
|
+
canUndo() {
|
|
1322
|
+
return this.index > 0;
|
|
1323
|
+
}
|
|
1324
|
+
canRedo() {
|
|
1325
|
+
return this.index < this.stack.length - 1;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// src/utils/plugin-system.ts
|
|
1330
|
+
class PluginSystem {
|
|
1331
|
+
plugins = new Map();
|
|
1332
|
+
hooks = {};
|
|
1333
|
+
handlers = {};
|
|
1334
|
+
register(def) {
|
|
1335
|
+
const enabled = def.enabled !== false;
|
|
1336
|
+
this.plugins.set(def.id, { ...def, enabled });
|
|
1337
|
+
if (enabled)
|
|
1338
|
+
def.activate?.();
|
|
1339
|
+
return this;
|
|
1340
|
+
}
|
|
1341
|
+
/** Transforming hook — each fn receives and returns a value */
|
|
1342
|
+
hook(name, fn) {
|
|
1343
|
+
(this.hooks[name] ??= []).push(fn);
|
|
1344
|
+
return () => {
|
|
1345
|
+
this.hooks[name] = (this.hooks[name] ?? []).filter(f => f !== fn);
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
/** Run all hooks, threading value through each */
|
|
1349
|
+
applyHooks(name, initial, ...args) {
|
|
1350
|
+
return (this.hooks[name] ?? []).reduce((v, fn) => fn(v, ...args), initial);
|
|
1351
|
+
}
|
|
1352
|
+
/** Fire-and-forget event */
|
|
1353
|
+
on(event, fn) {
|
|
1354
|
+
(this.handlers[event] ??= []).push(fn);
|
|
1355
|
+
return () => {
|
|
1356
|
+
this.handlers[event] = (this.handlers[event] ?? []).filter(f => f !== fn);
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
emit(event, data) {
|
|
1360
|
+
(this.handlers[event] ?? []).forEach(fn => fn(data));
|
|
1361
|
+
}
|
|
1362
|
+
toggle(id) {
|
|
1363
|
+
const p = this.plugins.get(id);
|
|
1364
|
+
if (!p)
|
|
1365
|
+
return false;
|
|
1366
|
+
p.enabled = !p.enabled;
|
|
1367
|
+
if (p.enabled)
|
|
1368
|
+
p.activate?.();
|
|
1369
|
+
else
|
|
1370
|
+
p.deactivate?.();
|
|
1371
|
+
return p.enabled;
|
|
1372
|
+
}
|
|
1373
|
+
isEnabled(id) {
|
|
1374
|
+
return this.plugins.get(id)?.enabled ?? false;
|
|
1375
|
+
}
|
|
1376
|
+
list() {
|
|
1377
|
+
return [...this.plugins.values()];
|
|
1378
|
+
}
|
|
1379
|
+
get(id) {
|
|
1380
|
+
return this.plugins.get(id);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
const xCodeEditorCss = () => `@charset "UTF-8";:root{--x-color-primary:#1677ff;--x-color-primary-rgb:22, 119, 255;--x-color-primary-contrast:#ffffff;--x-color-primary-contrast-rgb:255, 255, 255;--x-color-primary-shade:#0958d9;--x-color-primary-tint:#4096ff;--x-color-primary-bg:#e6f4ff;--x-color-primary-bg-hover:#bae0ff;--x-color-primary-border:#91caff;--x-color-primary-border-hover:#69b1ff;--x-color-primary-hover:#4096ff;--x-color-primary-active:#0958d9;--x-color-primary-text:#1677ff;--x-color-primary-text-hover:#4096ff;--x-color-primary-text-active:#0958d9;--x-color-secondary:#3dc2ff;--x-color-secondary-rgb:61, 194, 255;--x-color-secondary-contrast:#ffffff;--x-color-secondary-contrast-rgb:255, 255, 255;--x-color-secondary-shade:#36abe0;--x-color-secondary-tint:#50c8ff;--x-color-success:#52c41a;--x-color-success-rgb:82, 196, 26;--x-color-success-contrast:#ffffff;--x-color-success-contrast-rgb:255, 255, 255;--x-color-success-shade:#389e0d;--x-color-success-tint:#73d13d;--x-color-success-bg:#f6ffed;--x-color-success-bg-hover:#d9f7be;--x-color-success-border:#b7eb8f;--x-color-success-border-hover:#95de64;--x-color-success-hover:#73d13d;--x-color-success-active:#389e0d;--x-color-success-text:#52c41a;--x-color-success-text-hover:#73d13d;--x-color-success-text-active:#389e0d;--x-color-warning:#faad14;--x-color-warning-rgb:250, 173, 20;--x-color-warning-contrast:#000000;--x-color-warning-contrast-rgb:0, 0, 0;--x-color-warning-shade:#d48806;--x-color-warning-tint:#ffc53d;--x-color-warning-bg:#fffbe6;--x-color-warning-bg-hover:#fff1b8;--x-color-warning-border:#ffe58f;--x-color-warning-border-hover:#ffd666;--x-color-warning-hover:#ffc53d;--x-color-warning-active:#d48806;--x-color-warning-text:#faad14;--x-color-warning-text-hover:#ffc53d;--x-color-warning-text-active:#d48806;--x-color-danger:#ff4d4f;--x-color-danger-rgb:255, 77, 79;--x-color-danger-contrast:#ffffff;--x-color-danger-contrast-rgb:255, 255, 255;--x-color-danger-shade:#cf1322;--x-color-danger-tint:#ff7875;--x-color-error:#ff4d4f;--x-color-error-rgb:255, 77, 79;--x-color-error-bg:#fff2f0;--x-color-error-bg-hover:#ffccc7;--x-color-error-border:#ffa39e;--x-color-error-border-hover:#ff7875;--x-color-error-hover:#ff7875;--x-color-error-active:#d9363e;--x-color-error-text:#ff4d4f;--x-color-error-text-hover:#ff7875;--x-color-error-text-active:#d9363e;--x-color-info:#1677ff;--x-color-info-rgb:22, 119, 255;--x-color-info-bg:#e6f4ff;--x-color-info-bg-hover:#bae0ff;--x-color-info-border:#91caff;--x-color-info-border-hover:#69b1ff;--x-color-info-hover:#69b1ff;--x-color-info-active:#0958d9;--x-color-info-text:#1677ff;--x-color-info-text-hover:#69b1ff;--x-color-info-text-active:#0958d9;--x-color-text:rgba(0, 0, 0, 0.88);--x-color-text-secondary:rgba(0, 0, 0, 0.65);--x-color-text-tertiary:rgba(0, 0, 0, 0.45);--x-color-text-quaternary:rgba(0, 0, 0, 0.25);--x-color-text-disabled:rgba(0, 0, 0, 0.25);--x-color-text-placeholder:rgba(0, 0, 0, 0.25);--x-color-text-heading:rgba(0, 0, 0, 0.88);--x-color-text-label:rgba(0, 0, 0, 0.65);--x-color-text-description:rgba(0, 0, 0, 0.45);--x-color-text-light-solid:#ffffff;--x-color-text-processing:#ffffff;--x-color-bg-container:#ffffff;--x-color-bg-elevated:#ffffff;--x-color-bg-layout:#f5f5f5;--x-color-bg-spotlight:rgba(0, 0, 0, 0.85);--x-color-bg-mask:rgba(0, 0, 0, 0.45);--x-color-bg-base:#ffffff;--x-color-bg-container-disabled:#f5f5f5;--x-color-bg-container-loading:rgba(255, 255, 255, 0.65);--x-color-white:#ffffff;--x-color-fill:rgba(0, 0, 0, 0.15);--x-color-fill-secondary:rgba(0, 0, 0, 0.06);--x-color-fill-tertiary:rgba(0, 0, 0, 0.04);--x-color-fill-quaternary:rgba(0, 0, 0, 0.02);--x-color-border:#d9d9d9;--x-color-border-secondary:#f0f0f0;--x-color-border-bg:#ffffff;--x-color-split:rgba(5, 5, 5, 0.06);--x-color-dark:#222428;--x-color-dark-rgb:34, 36, 40;--x-color-dark-contrast:#ffffff;--x-color-dark-contrast-rgb:255, 255, 255;--x-color-dark-shade:#1e2023;--x-color-dark-tint:#383a3e;--x-color-medium:#92949c;--x-color-medium-rgb:146, 148, 156;--x-color-medium-contrast:#ffffff;--x-color-medium-contrast-rgb:255, 255, 255;--x-color-medium-shade:#808289;--x-color-medium-tint:#9d9fa6;--x-color-light:#f4f5f8;--x-color-light-rgb:244, 245, 248;--x-color-light-contrast:#000000;--x-color-light-contrast-rgb:0, 0, 0;--x-color-light-shade:#d7d8da;--x-color-light-tint:#f5f6f9;--x-font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';--x-font-family-code:'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;--x-font-size:14px;--x-font-size-sm:12px;--x-font-size-lg:16px;--x-font-size-xl:20px;--x-font-size-heading-1:38px;--x-font-size-heading-2:30px;--x-font-size-heading-3:24px;--x-font-size-heading-4:20px;--x-font-size-heading-5:16px;--x-line-height:1.5714285714285714;--x-line-height-lg:1.5;--x-line-height-sm:1.6666666666666667;--x-line-height-heading-1:1.2105263157894737;--x-line-height-heading-2:1.2666666666666666;--x-line-height-heading-3:1.3333333333333333;--x-line-height-heading-4:1.4;--x-line-height-heading-5:1.5;--x-font-weight-normal:400;--x-font-weight-medium:500;--x-font-weight-semibold:600;--x-font-weight-strong:600;--x-font-size-base:14px;--x-font-size-xxl:24px;--x-line-height-base:1.5714285714285714;--x-spacing-xxs:4px;--x-spacing-xs:8px;--x-spacing-sm:12px;--x-spacing-md:16px;--x-spacing-lg:20px;--x-spacing-xl:24px;--x-spacing-xxl:32px;--x-spacing-xxxl:48px;--x-margin-xxs:4px;--x-margin-xs:8px;--x-margin-sm:12px;--x-margin-md:16px;--x-margin-lg:24px;--x-margin-xl:32px;--x-margin-xxl:48px;--x-padding-xxs:4px;--x-padding-xs:8px;--x-padding-sm:12px;--x-padding-md:16px;--x-padding-lg:24px;--x-padding-content-horizontal-lg:24px;--x-padding-content-vertical-lg:12px;--x-padding-content-horizontal:16px;--x-padding-content-vertical:12px;--x-padding-content-horizontal-sm:16px;--x-padding-content-vertical-sm:8px;--x-border-radius:6px;--x-border-radius-xs:2px;--x-border-radius-sm:4px;--x-border-radius-lg:8px;--x-border-radius-xl:12px;--x-border-radius-outer:4px;--x-border-radius-base:6px;--x-border-width:1px;--x-border-width-base:1px;--x-shadow:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-shadow-secondary:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-shadow-tertiary:0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02);--x-shadow-lg:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-secondary:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-tertiary:0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02);--x-box-shadow-popover-arrow:2px 2px 5px rgba(0, 0, 0, 0.05);--x-box-shadow-card:0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);--x-box-shadow-drawer-right:-6px 0 16px 0 rgba(0, 0, 0, 0.08), -3px 0 6px -4px rgba(0, 0, 0, 0.12), -9px 0 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-drawer-left:6px 0 16px 0 rgba(0, 0, 0, 0.08), 3px 0 6px -4px rgba(0, 0, 0, 0.12), 9px 0 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-drawer-up:0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-drawer-down:0 -6px 16px 0 rgba(0, 0, 0, 0.08), 0 -3px 6px -4px rgba(0, 0, 0, 0.12), 0 -9px 28px 8px rgba(0, 0, 0, 0.05);--x-box-shadow-tabs-overflow-left:inset 10px 0 8px -8px rgba(0, 0, 0, 0.08);--x-box-shadow-tabs-overflow-right:inset -10px 0 8px -8px rgba(0, 0, 0, 0.08);--x-box-shadow-tabs-overflow-top:inset 0 10px 8px -8px rgba(0, 0, 0, 0.08);--x-box-shadow-tabs-overflow-bottom:inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08);--x-motion-duration-fast:0.1s;--x-motion-duration-mid:0.2s;--x-motion-duration-slow:0.3s;--x-motion-ease-in-out:cubic-bezier(0.645, 0.045, 0.355, 1);--x-motion-ease-out:cubic-bezier(0.215, 0.61, 0.355, 1);--x-motion-ease-in:cubic-bezier(0.55, 0.055, 0.675, 0.19);--x-motion-ease-out-back:cubic-bezier(0.12, 0.4, 0.29, 1.46);--x-motion-ease-in-back:cubic-bezier(0.71, -0.46, 0.88, 0.6);--x-motion-ease-in-out-circle:cubic-bezier(0.78, 0.14, 0.15, 0.86);--x-motion-ease-out-circle:cubic-bezier(0.08, 0.82, 0.17, 1);--x-motion-ease-in-circle:cubic-bezier(0.6, 0.04, 0.98, 0.34);--x-motion-ease-in-quint:cubic-bezier(0.755, 0.05, 0.855, 0.06);--x-motion-ease-out-quint:cubic-bezier(0.23, 1, 0.32, 1);--x-z-index-base:0;--x-z-index-popup-base:1000;--x-z-index-popup:1030;--x-z-index-affix:10;--x-z-index-modal:1000;--x-z-index-modal-mask:1000;--x-z-index-drawer:1000;--x-z-index-popover:1030;--x-z-index-dropdown:1050;--x-z-index-tooltip:1070;--x-z-index-notification:1080;--x-z-index-message:1090;--x-z-index-popconfirm:1060;--x-z-index-table-fixed:10;--x-opacity-loading:0.65;--x-opacity-image:1;--x-opacity-disabled:0.5;--x-control-height:32px;--x-control-height-xs:24px;--x-control-height-sm:24px;--x-control-height-lg:40px;--x-control-radio-size:16px;--x-control-checkbox-size:16px;--x-control-padding-horizontal:12px;--x-control-padding-horizontal-sm:8px;--x-control-outline-width:2px;--x-control-outline:rgba(5, 145, 255, 0.1);--x-control-item-bg-hover:rgba(0, 0, 0, 0.04);--x-control-item-bg-active:#e6f4ff;--x-control-item-bg-active-hover:#bae0ff;--x-control-item-bg-active-disabled:rgba(0, 0, 0, 0.15);--x-control-tmp-outline:rgba(0, 0, 0, 0.02);--x-color-yellow:#fadb14;--x-color-yellow-rgb:250, 219, 20;--x-font-family-base:var(--x-font-family);--x-color-link:#1677ff;--x-color-link-hover:#69b1ff;--x-color-link-active:#0958d9;--x-color-icon:rgba(0, 0, 0, 0.45);--x-color-icon-hover:rgba(0, 0, 0, 0.88);--x-color-highlight:#ff4d4f;--x-color-bg-text-hover:rgba(0, 0, 0, 0.06);--x-color-bg-text-active:rgba(0, 0, 0, 0.15);--x-screen-xs:480px;--x-screen-xs-min:480px;--x-screen-xs-max:575px;--x-screen-sm:576px;--x-screen-sm-min:576px;--x-screen-sm-max:767px;--x-screen-md:768px;--x-screen-md-min:768px;--x-screen-md-max:991px;--x-screen-lg:992px;--x-screen-lg-min:992px;--x-screen-lg-max:1199px;--x-screen-xl:1200px;--x-screen-xl-min:1200px;--x-screen-xl-max:1599px;--x-screen-xxl:1600px;--x-screen-xxl-min:1600px;--x-color-fill-content:rgba(0, 0, 0, 0.06);--x-color-fill-content-hover:rgba(0, 0, 0, 0.15);--x-color-fill-alter:rgba(0, 0, 0, 0.02);--x-scrollbar-width:12px;--x-scrollbar-track-bg:rgba(0, 0, 0, 0.04);--x-scrollbar-thumb-bg:rgba(0, 0, 0, 0.25);--x-scrollbar-thumb-bg-hover:rgba(0, 0, 0, 0.35);--x-menu-dark-bg:#001529;--x-menu-dark-item-bg:#001529;--x-menu-dark-popup-bg:#001529;--x-menu-dark-submenu-item-bg:#000c17}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%;width:100%;overflow:hidden;--x-code-editor-bg:#0d0e14;--x-code-editor-surface:#13141c;--x-code-editor-surface2:#1a1b26;--x-code-editor-surface3:#1e2030;--x-code-editor-border:#2a2d3e;--x-code-editor-border2:#3b3f5c;--x-code-editor-txt:#c0caf5;--x-code-editor-txt2:#a9b1d6;--x-code-editor-txt3:#565f89;--x-code-editor-accent:#7aa2f7;--x-code-editor-purple:#bb9af7;--x-code-editor-green:#9ece6a;--x-code-editor-yellow:#e0af68;--x-code-editor-red:#f7768e;--x-code-editor-cyan:#7dcfff;--x-code-editor-orange:#ff9e64;--x-code-editor-lh:22px;--x-code-editor-fs:13px;--x-code-editor-gw:52px;--x-code-editor-font:'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace;--x-code-editor-sel:rgba(122, 162, 247, 0.18);--x-code-editor-match:rgba(224, 175, 104, 0.25);--x-code-editor-cur-line:rgba(122, 162, 247, 0.06);--x-code-editor-bracket:rgba(122, 162, 247, 0.35);font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));color:var(--x-code-editor-txt);background:var(--x-code-editor-bg)}:host(.theme-light){--x-code-editor-bg:#f8f8f2;--x-code-editor-surface:#f0f0e8;--x-code-editor-surface2:#e8e8e0;--x-code-editor-surface3:#dcdcd4;--x-code-editor-border:#c8c8c0;--x-code-editor-border2:#b0b0a8;--x-code-editor-txt:#383a42;--x-code-editor-txt2:#4b4d58;--x-code-editor-txt3:#9096a2;--x-code-editor-accent:#4078f2;--x-code-editor-purple:#a626a4;--x-code-editor-green:#50a14f;--x-code-editor-yellow:#c18401;--x-code-editor-red:#e45649;--x-code-editor-cyan:#0184bc;--x-code-editor-orange:#986801;--x-code-editor-cur-line:rgba(64, 120, 242, 0.06);--x-code-editor-bracket:rgba(64, 120, 242, 0.3)}.x-code-editor-t-kw{color:var(--x-code-editor-purple)}.x-code-editor-t-fn{color:var(--x-code-editor-cyan)}.x-code-editor-t-str{color:var(--x-code-editor-green)}.x-code-editor-t-num{color:var(--x-code-editor-orange)}.x-code-editor-t-cmt{color:var(--x-code-editor-txt3);font-style:italic}.x-code-editor-t-op{color:#89ddff}.x-code-editor-t-id{color:var(--x-code-editor-txt)}.x-code-editor-t-bi{color:var(--x-code-editor-cyan)}.x-code-editor-t-prop{color:var(--x-code-editor-cyan)}.x-code-editor-t-rx{color:var(--x-code-editor-orange)}.x-code-editor-t-dec{color:var(--x-code-editor-red)}.x-code-editor-t-sel{color:var(--x-code-editor-yellow)}.x-code-editor-t-tag{color:var(--x-code-editor-red)}.x-code-editor-t-attr{color:var(--x-code-editor-yellow)}.x-code-editor-t-val{color:var(--x-code-editor-green)}.x-code-editor-folded-pill{display:inline-block;background:var(--x-code-editor-surface3);border:1px solid var(--x-code-editor-border2);border-radius:3px;padding:0 5px;font-size:11px;color:var(--x-code-editor-txt3);cursor:pointer;vertical-align:middle;margin-left:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.x-code-editor-folded-pill:hover{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2));border-color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-titlebar{height:38px;background:var(--x-code-editor-surface);border-bottom:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 14px;-ms-flex-negative:0;flex-shrink:0;gap:0}.x-code-editor-circles{display:-ms-flexbox;display:flex;gap:6px}.x-code-editor-dot{width:12px;height:12px;border-radius:50%;cursor:pointer;-webkit-transition:opacity 0.15s;transition:opacity 0.15s}.x-code-editor-dot:hover{opacity:0.8}.x-code-editor-dot.x-code-editor-red{background:#ff5f57}.x-code-editor-dot.x-code-editor-yellow{background:#ffbd2e}.x-code-editor-dot.x-code-editor-green{background:#28ca41}.x-code-editor-title-name{-ms-flex:1;flex:1;text-align:center;font-size:12px;color:var(--x-code-editor-txt3);letter-spacing:0.5px}.x-code-editor-title-spacer{width:52px}.x-code-editor-tabs{height:36px;background:var(--x-code-editor-surface);border-bottom:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;padding:0 8px;gap:2px;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-tab{padding:0 14px;height:32px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:6px;font-size:12px;color:var(--x-code-editor-txt3);cursor:pointer;border-radius:6px 6px 0 0;border:1px solid transparent;border-bottom:none;-webkit-transition:all 0.12s;transition:all 0.12s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap}.x-code-editor-tab:hover{color:var(--x-code-editor-txt2);background:var(--x-code-editor-surface2)}.x-code-editor-tab.x-code-editor-active{color:var(--x-code-editor-txt);background:var(--x-code-editor-surface2);border-color:var(--x-code-editor-border)}.x-code-editor-tab-dot{width:6px;height:6px;border-radius:50%;background:currentColor;opacity:0.6}.x-code-editor-tab-js .x-code-editor-tab-dot{background:#f7c948}.x-code-editor-tab-css .x-code-editor-tab-dot{background:#61afef}.x-code-editor-tab-html .x-code-editor-tab-dot{background:#e06c75}.x-code-editor-tab-json .x-code-editor-tab-dot{background:#56b6c2}.x-code-editor-toolbar{height:32px;background:var(--x-code-editor-surface2);border-bottom:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 8px;gap:3px;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-tbtn{height:22px;padding:0 8px;font-size:11px;color:var(--x-code-editor-txt3);background:transparent;border:1px solid transparent;border-radius:4px;cursor:pointer;font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));white-space:nowrap;-webkit-transition:all 0.12s;transition:all 0.12s}.x-code-editor-tbtn:hover{color:var(--x-code-editor-txt2);border-color:var(--x-code-editor-border2);background:var(--x-code-editor-surface3)}.x-code-editor-tbtn.x-code-editor-active{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2));border-color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-tsep{width:1px;height:16px;background:var(--x-code-editor-border);margin:0 3px;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-toolbar-lang{margin-left:auto;font-size:11px;color:var(--x-code-editor-txt3);padding:2px 8px;border:1px solid var(--x-code-editor-border);border-radius:4px}.x-code-editor-search-bar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:5px;padding:5px 10px;background:var(--x-code-editor-surface2);border-bottom:1px solid var(--x-code-editor-border);-ms-flex-negative:0;flex-shrink:0}.x-code-editor-search-input{background:var(--x-code-editor-surface3);border:1px solid var(--x-code-editor-border2);color:var(--x-code-editor-txt);padding:3px 8px;font-size:12px;border-radius:4px;outline:none;font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));width:200px;-webkit-transition:border-color 0.15s;transition:border-color 0.15s}.x-code-editor-search-input:focus{border-color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-sbar-btn{height:22px;padding:0 8px;font-size:11px;color:var(--x-code-editor-txt3);background:var(--x-code-editor-surface3);border:1px solid var(--x-code-editor-border);border-radius:4px;cursor:pointer;font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));-webkit-transition:all 0.12s;transition:all 0.12s}.x-code-editor-sbar-btn:hover{color:var(--x-code-editor-txt);border-color:var(--x-code-editor-border2)}.x-code-editor-match-count{font-size:11px;color:var(--x-code-editor-txt3);min-width:70px}.x-code-editor-sbar-close{margin-left:auto;font-size:16px;color:var(--x-code-editor-txt3);cursor:pointer;width:22px;height:22px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:4px;background:transparent;border:none;font-family:sans-serif}.x-code-editor-sbar-close:hover{color:var(--x-code-editor-txt);background:var(--x-code-editor-surface3)}.x-code-editor-main-area{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;overflow:hidden;position:relative}.x-code-editor-editor-wrap{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;overflow:hidden}.x-code-editor-gutter{width:var(--x-code-editor-gw, 52px);background:var(--x-code-editor-surface);border-right:1px solid var(--x-code-editor-border);-ms-flex-negative:0;flex-shrink:0;overflow:hidden;position:relative}.x-code-editor-gutter-canvas{display:block;position:absolute;top:0;left:0;width:100%;cursor:pointer}.x-code-editor-code-container{-ms-flex:1;flex:1;position:relative;overflow:auto;background:var(--x-code-editor-bg)}.x-code-editor-cur-line-hl{position:absolute;left:0;right:0;height:var(--x-code-editor-lh, 22px);background:var(--x-code-editor-cur-line);pointer-events:none;z-index:1}.x-code-editor-bracket-hl{position:absolute;width:9px;height:var(--x-code-editor-lh, 22px);background:var(--x-code-editor-bracket);border-radius:2px;pointer-events:none;z-index:3}.x-code-editor-search-hl{position:absolute;height:var(--x-code-editor-lh, 22px);background:var(--x-code-editor-match);border-radius:2px;pointer-events:none;z-index:4}.x-code-editor-word-hl{position:absolute;height:var(--x-code-editor-lh, 22px);background:rgba(122, 162, 247, 0.2);border:1px solid rgba(122, 162, 247, 0.3);border-radius:2px;pointer-events:none;z-index:3;-webkit-box-sizing:border-box;box-sizing:border-box}.x-code-editor-search-cur{background:rgba(122, 162, 247, 0.4)}.x-code-editor-extra-cursor{position:absolute;width:2px;background:var(--x-code-editor-orange);z-index:11;pointer-events:none;-webkit-animation:blink 1.1s step-end infinite;animation:blink 1.1s step-end infinite;height:var(--x-code-editor-lh, 22px)}@-webkit-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}.x-code-editor-highlight-layer{position:absolute;top:0;left:0;right:0;pointer-events:auto;padding:8px 0 8px 12px;font-size:var(--x-code-editor-fs, var(--x-font-size-sm, 13px));line-height:var(--x-code-editor-lh, 22px);font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));white-space:pre;color:var(--x-code-editor-txt);z-index:5;-o-tab-size:2;tab-size:2;-moz-tab-size:2}.x-code-editor-code-input{position:absolute;top:0;left:0;width:100%;padding:8px 0 8px 12px;font-size:var(--x-code-editor-fs, var(--x-font-size-sm, 13px));line-height:var(--x-code-editor-lh, 22px);font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));background:transparent;color:transparent;caret-color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2));border:none;outline:none;resize:none;white-space:pre;overflow:hidden;z-index:10;-o-tab-size:2;tab-size:2;-moz-tab-size:2;-webkit-text-fill-color:transparent}.x-code-editor-code-input::-moz-selection{background:var(--x-code-editor-sel)}.x-code-editor-code-input::selection{background:var(--x-code-editor-sel)}.x-code-editor-side-panel{width:280px;background:var(--x-code-editor-surface);border-left:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-negative:0;flex-shrink:0;overflow:hidden}.x-code-editor-panel-header{padding:9px 12px;font-size:12px;color:var(--x-code-editor-txt2);border-bottom:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-panel-close{font-size:16px;color:var(--x-code-editor-txt3);cursor:pointer;background:transparent;border:none;font-family:sans-serif;line-height:1;padding:0 2px}.x-code-editor-panel-close:hover{color:var(--x-code-editor-txt)}.x-code-editor-panel-body{-ms-flex:1;flex:1;overflow-y:auto;padding:8px}.x-code-editor-panel-hint{font-size:11px;color:var(--x-code-editor-txt3);padding:8px;font-style:italic}.x-code-editor-ast-tree{font-size:11px;font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));line-height:1.6}.x-code-editor-ast-node{margin-left:10px}.x-code-editor-ast-toggle{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:var(--x-code-editor-txt3);padding:1px 3px;border-radius:3px;display:inline-block}.x-code-editor-ast-toggle:hover{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2));background:var(--x-code-editor-surface3)}.x-code-editor-ast-children{margin-left:12px}.x-code-editor-ast-row{padding:1px 0}.x-code-editor-ast-type{color:var(--x-code-editor-cyan)}.x-code-editor-ast-val{color:var(--x-code-editor-green)}.x-code-editor-ast-key{color:var(--x-code-editor-purple)}.x-code-editor-plugin-card{background:var(--x-code-editor-surface2);border:1px solid var(--x-code-editor-border);border-radius:6px;padding:10px 12px;margin-bottom:8px}.x-code-editor-plugin-card-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin-bottom:5px}.x-code-editor-plugin-name{font-size:12px;color:var(--x-code-editor-txt);font-weight:500}.x-code-editor-plugin-desc{font-size:11px;color:var(--x-code-editor-txt3)}.x-code-editor-toggle{width:30px;height:16px;background:var(--x-code-editor-surface3);border-radius:8px;cursor:pointer;position:relative;border:1px solid var(--x-code-editor-border2);-webkit-transition:background 0.2s;transition:background 0.2s;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-toggle.x-code-editor-on{background:var(--x-code-editor-accent, var(--x-color-primary, #4078f2));border-color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-toggle::after{content:"";position:absolute;top:2px;left:2px;width:10px;height:10px;border-radius:50%;background:#fff;-webkit-transition:left 0.2s;transition:left 0.2s}.x-code-editor-toggle.x-code-editor-on::after{left:16px}.x-code-editor-autocomplete{position:absolute;background:var(--x-code-editor-surface2);border:1px solid var(--x-code-editor-border2);border-radius:6px;-webkit-box-shadow:0 8px 32px rgba(0, 0, 0, 0.6);box-shadow:0 8px 32px rgba(0, 0, 0, 0.6);z-index:200;min-width:220px;max-width:340px;max-height:230px;overflow-y:auto;font-size:12px}.x-code-editor-autocomplete::-webkit-scrollbar{width:4px}.x-code-editor-autocomplete::-webkit-scrollbar-track{background:var(--x-code-editor-surface3)}.x-code-editor-autocomplete::-webkit-scrollbar-thumb{background:var(--x-code-editor-border2);border-radius:2px}.x-code-editor-ac-item{padding:5px 10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:7px;cursor:pointer;-webkit-transition:background 0.08s;transition:background 0.08s}.x-code-editor-ac-item:hover,.x-code-editor-ac-item.x-code-editor-selected{background:var(--x-code-editor-surface3)}.x-code-editor-ac-icon{width:16px;height:16px;border-radius:3px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-size:9px;font-weight:700;-ms-flex-negative:0;flex-shrink:0}.x-code-editor-ac-kw{background:rgba(187, 154, 247, 0.2);color:var(--x-code-editor-purple)}.x-code-editor-ac-fn{background:rgba(125, 207, 255, 0.2);color:var(--x-code-editor-cyan)}.x-code-editor-ac-var{background:rgba(158, 206, 106, 0.2);color:var(--x-code-editor-green)}.x-code-editor-ac-prop{background:rgba(122, 162, 247, 0.2);color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-ac-snip{background:rgba(255, 158, 100, 0.2);color:var(--x-code-editor-orange)}.x-code-editor-ac-tag{background:rgba(247, 118, 142, 0.2);color:var(--x-code-editor-red)}.x-code-editor-ac-attr{background:rgba(224, 175, 104, 0.2);color:var(--x-code-editor-yellow)}.x-code-editor-ac-label{-ms-flex:1;flex:1;color:var(--x-code-editor-txt);font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace))}.x-code-editor-ac-label b{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-ac-detail{font-size:10px;color:var(--x-code-editor-txt3);white-space:nowrap}.x-code-editor-statusbar{height:24px;background:var(--x-code-editor-surface);border-top:1px solid var(--x-code-editor-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 10px;gap:12px;font-size:11px;color:var(--x-code-editor-txt3);-ms-flex-negative:0;flex-shrink:0}.x-code-editor-sb-cursor{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.x-code-editor-sb-sel{color:var(--x-code-editor-yellow)}.x-code-editor-sb-multicursor{color:var(--x-code-editor-orange)}.x-code-editor-sb-spacer{-ms-flex:1;flex:1}.x-code-editor-sb-utf,.x-code-editor-sb-lf{color:var(--x-code-editor-green)}.x-code-editor-sb-lang{color:var(--x-code-editor-txt2)}.x-code-editor-sb-chars{color:var(--x-code-editor-txt3)}.x-code-editor-sb-clear-cursors{font-size:10px;color:var(--x-code-editor-txt3);background:transparent;border:1px solid var(--x-code-editor-border);border-radius:3px;padding:0 5px;cursor:pointer;font-family:var(--x-code-editor-font, var(--x-font-family-code, "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace));-webkit-transition:all 0.1s;transition:all 0.1s}.x-code-editor-sb-clear-cursors:hover{color:var(--x-code-editor-txt);border-color:var(--x-code-editor-border2)}.x-code-editor-code-container::-webkit-scrollbar{width:8px;height:8px}.x-code-editor-code-container::-webkit-scrollbar-track{background:var(--x-code-editor-surface2)}.x-code-editor-code-container::-webkit-scrollbar-thumb{background:var(--x-code-editor-border2);border-radius:4px}.x-code-editor-code-container::-webkit-scrollbar-thumb:hover{background:var(--x-code-editor-txt3)}.x-code-editor-panel-body::-webkit-scrollbar{width:4px}.x-code-editor-panel-body::-webkit-scrollbar-track{background:transparent}.x-code-editor-panel-body::-webkit-scrollbar-thumb{background:var(--x-code-editor-border2);border-radius:2px}.t-kw{color:var(--x-code-editor-purple)}.t-str{color:var(--x-code-editor-green)}.t-num{color:var(--x-code-editor-orange)}.t-fn{color:var(--x-code-editor-cyan)}.t-bi{color:var(--x-code-editor-yellow)}.t-op{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.t-id{color:var(--x-code-editor-txt)}.t-cmt{color:var(--x-code-editor-txt3);font-style:italic}.t-prop{color:var(--x-code-editor-accent, var(--x-color-primary, #4078f2))}.t-var{color:var(--x-code-editor-red)}.t-tag{color:var(--x-code-editor-red)}.t-attr{color:var(--x-code-editor-yellow)}.t-sel{color:var(--x-code-editor-yellow)}.t-dec{color:var(--x-code-editor-purple)}`;
|
|
1385
|
+
|
|
1386
|
+
const LANG_NAMES = {
|
|
1387
|
+
js: 'JavaScript',
|
|
1388
|
+
css: 'CSS',
|
|
1389
|
+
html: 'HTML',
|
|
1390
|
+
json: 'JSON',
|
|
1391
|
+
};
|
|
1392
|
+
const PAIRS = {
|
|
1393
|
+
'(': ')',
|
|
1394
|
+
'[': ']',
|
|
1395
|
+
'{': '}',
|
|
1396
|
+
'"': '"',
|
|
1397
|
+
"'": "'",
|
|
1398
|
+
'`': '`',
|
|
1399
|
+
};
|
|
1400
|
+
const LH = 22; // line height px
|
|
1401
|
+
const CW = 7.8; // approx char width at 13px monospace
|
|
1402
|
+
const PAD = 12; // padding-left for code area
|
|
1403
|
+
function clamp(n, lo, hi) {
|
|
1404
|
+
return Math.max(lo, Math.min(hi, n));
|
|
1405
|
+
}
|
|
1406
|
+
function escH(s) {
|
|
1407
|
+
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
1408
|
+
}
|
|
1409
|
+
const XCodeEditor = class {
|
|
1410
|
+
constructor(hostRef) {
|
|
1411
|
+
registerInstance(this, hostRef);
|
|
1412
|
+
this.codeChange = createEvent(this, "codeChange", 7);
|
|
1413
|
+
this.cursorMove = createEvent(this, "cursorMove", 7);
|
|
1414
|
+
this.langChange = createEvent(this, "langChange", 7);
|
|
1415
|
+
}
|
|
1416
|
+
// ==================== Props ====================
|
|
1417
|
+
/**
|
|
1418
|
+
* The value of the code editor.
|
|
1419
|
+
*/
|
|
1420
|
+
value = '';
|
|
1421
|
+
/**
|
|
1422
|
+
* The programming language for syntax highlighting.
|
|
1423
|
+
*/
|
|
1424
|
+
language = 'js';
|
|
1425
|
+
/**
|
|
1426
|
+
* Whether the editor is read-only.
|
|
1427
|
+
*/
|
|
1428
|
+
readonly = false;
|
|
1429
|
+
/**
|
|
1430
|
+
* The tab size used for indentation.
|
|
1431
|
+
*/
|
|
1432
|
+
tabSize = 2;
|
|
1433
|
+
/**
|
|
1434
|
+
* Editor theme ('dark' or 'light').
|
|
1435
|
+
*/
|
|
1436
|
+
theme = 'dark';
|
|
1437
|
+
/**
|
|
1438
|
+
* Whether to show the minimap (not implemented yet).
|
|
1439
|
+
*/
|
|
1440
|
+
showMinimap = false;
|
|
1441
|
+
/**
|
|
1442
|
+
* Custom class names for editor components.
|
|
1443
|
+
*/
|
|
1444
|
+
classNames;
|
|
1445
|
+
/**
|
|
1446
|
+
* Custom styles for editor components.
|
|
1447
|
+
*/
|
|
1448
|
+
styles;
|
|
1449
|
+
// ==================== Events ====================
|
|
1450
|
+
codeChange;
|
|
1451
|
+
cursorMove;
|
|
1452
|
+
langChange;
|
|
1453
|
+
// ==================== Internal State ====================
|
|
1454
|
+
_value = '';
|
|
1455
|
+
_lang = 'js';
|
|
1456
|
+
_cursorLine = 0;
|
|
1457
|
+
_cursorCol = 0;
|
|
1458
|
+
_selLen = 0;
|
|
1459
|
+
_extraCursors = [];
|
|
1460
|
+
_folds = new Set();
|
|
1461
|
+
_matches = [];
|
|
1462
|
+
_matchIdx = 0;
|
|
1463
|
+
_searchQuery = '';
|
|
1464
|
+
_replaceQuery = '';
|
|
1465
|
+
_showSearch = false;
|
|
1466
|
+
_showReplace = false;
|
|
1467
|
+
_panel = null;
|
|
1468
|
+
_astRoot = null;
|
|
1469
|
+
_pluginList = [];
|
|
1470
|
+
_acItems = [];
|
|
1471
|
+
_acIndex = 0;
|
|
1472
|
+
_acOpen = false;
|
|
1473
|
+
_acX = 0;
|
|
1474
|
+
_acY = 0;
|
|
1475
|
+
_highlighted = '';
|
|
1476
|
+
_displayLines = [];
|
|
1477
|
+
get hostEl() { return getElement(this); }
|
|
1478
|
+
ta;
|
|
1479
|
+
codeContainer;
|
|
1480
|
+
gutterCanvas;
|
|
1481
|
+
acContainer;
|
|
1482
|
+
// ==================== Internal Singletons ====================
|
|
1483
|
+
history = new EditHistory(200);
|
|
1484
|
+
plugins = new PluginSystem();
|
|
1485
|
+
// ==================== Lifecycle ====================
|
|
1486
|
+
componentWillLoad() {
|
|
1487
|
+
this._value = this.value || '';
|
|
1488
|
+
this._lang = this.language;
|
|
1489
|
+
this._setupPlugins();
|
|
1490
|
+
this._reHighlight();
|
|
1491
|
+
this.history.pushNow({ value: this._value, selStart: 0, selEnd: 0 });
|
|
1492
|
+
}
|
|
1493
|
+
componentDidLoad() {
|
|
1494
|
+
this._bindScrollSync();
|
|
1495
|
+
this._drawGutter();
|
|
1496
|
+
this._resizeTA();
|
|
1497
|
+
}
|
|
1498
|
+
componentDidUpdate() {
|
|
1499
|
+
this._drawGutter();
|
|
1500
|
+
this._resizeTA();
|
|
1501
|
+
}
|
|
1502
|
+
// ==================== Watchers ====================
|
|
1503
|
+
onValueProp(v) {
|
|
1504
|
+
if (v !== this._value) {
|
|
1505
|
+
this._value = v;
|
|
1506
|
+
this._reHighlight();
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
onLangProp(l) {
|
|
1510
|
+
this._lang = l;
|
|
1511
|
+
this._folds.clear();
|
|
1512
|
+
this._reHighlight();
|
|
1513
|
+
}
|
|
1514
|
+
// ==================== Methods ====================
|
|
1515
|
+
async getValue() {
|
|
1516
|
+
return this._value;
|
|
1517
|
+
}
|
|
1518
|
+
async setValue(v) {
|
|
1519
|
+
this._applyValue(v, 0, 0, true);
|
|
1520
|
+
}
|
|
1521
|
+
async setLanguage(l) {
|
|
1522
|
+
this._lang = l;
|
|
1523
|
+
this._reHighlight();
|
|
1524
|
+
}
|
|
1525
|
+
async undo() {
|
|
1526
|
+
this._undo();
|
|
1527
|
+
}
|
|
1528
|
+
async redo() {
|
|
1529
|
+
this._redo();
|
|
1530
|
+
}
|
|
1531
|
+
async format() {
|
|
1532
|
+
this._formatDoc();
|
|
1533
|
+
}
|
|
1534
|
+
async foldAll() {
|
|
1535
|
+
this._foldAll();
|
|
1536
|
+
}
|
|
1537
|
+
async unfoldAll() {
|
|
1538
|
+
this._unfoldAll();
|
|
1539
|
+
}
|
|
1540
|
+
async openSearch() {
|
|
1541
|
+
this._showSearch = true;
|
|
1542
|
+
}
|
|
1543
|
+
async getAST() {
|
|
1544
|
+
if (this._lang !== 'js')
|
|
1545
|
+
return null;
|
|
1546
|
+
return parseAST(this._value);
|
|
1547
|
+
}
|
|
1548
|
+
async registerPlugin(def) {
|
|
1549
|
+
this.plugins.register(def);
|
|
1550
|
+
this._pluginList = this.plugins.list();
|
|
1551
|
+
}
|
|
1552
|
+
// ==================== Private Methods ====================
|
|
1553
|
+
_setupPlugins() {
|
|
1554
|
+
this.plugins
|
|
1555
|
+
.register({ id: 'bracket-match', name: 'Bracket Matching', description: 'Highlights matching brackets under cursor', enabled: true })
|
|
1556
|
+
.register({ id: 'auto-close', name: 'Auto Close', description: 'Auto-closes brackets and quotes', enabled: true })
|
|
1557
|
+
.register({ id: 'auto-indent', name: 'Auto Indent', description: 'Smart indentation on Enter', enabled: true })
|
|
1558
|
+
.register({ id: 'line-highlight', name: 'Line Highlight', description: 'Highlight current line', enabled: true })
|
|
1559
|
+
.register({ id: 'fold', name: 'Code Folding', description: 'Collapse/expand code blocks', enabled: true })
|
|
1560
|
+
.register({ id: 'autocomplete', name: 'Autocomplete', description: 'IntelliSense-style completion', enabled: true })
|
|
1561
|
+
.register({ id: 'multi-cursor', name: 'Multi Cursor', description: 'Alt+Click to add cursors', enabled: true });
|
|
1562
|
+
this._pluginList = this.plugins.list();
|
|
1563
|
+
}
|
|
1564
|
+
_bindScrollSync() {
|
|
1565
|
+
this.codeContainer?.addEventListener('scroll', () => {
|
|
1566
|
+
if (this.gutterCanvas) {
|
|
1567
|
+
this.gutterCanvas.style.transform = `translateY(-${this.codeContainer.scrollTop}px)`;
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
_applyValue(v, selStart, selEnd, pushHistory = true) {
|
|
1572
|
+
this._value = v;
|
|
1573
|
+
if (this.ta) {
|
|
1574
|
+
this.ta.value = v;
|
|
1575
|
+
this.ta.setSelectionRange(selStart, selEnd);
|
|
1576
|
+
}
|
|
1577
|
+
if (pushHistory)
|
|
1578
|
+
this.history.push({ value: v, selStart, selEnd });
|
|
1579
|
+
this._reHighlight();
|
|
1580
|
+
this.codeChange.emit({ value: v });
|
|
1581
|
+
}
|
|
1582
|
+
_reHighlight() {
|
|
1583
|
+
// Build display lines (accounting for folds)
|
|
1584
|
+
const lines = this._value.split('\n');
|
|
1585
|
+
const displayLines = [];
|
|
1586
|
+
let i = 0;
|
|
1587
|
+
while (i < lines.length) {
|
|
1588
|
+
if (this._folds.has(i) && this.plugins.isEnabled('fold')) {
|
|
1589
|
+
const end = this._foldEnd(lines, i);
|
|
1590
|
+
displayLines.push({ real: i, folded: true, count: end - i, text: lines[i] });
|
|
1591
|
+
i = end + 1;
|
|
1592
|
+
}
|
|
1593
|
+
else {
|
|
1594
|
+
displayLines.push({ real: i, folded: false, text: lines[i] });
|
|
1595
|
+
i++;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
this._displayLines = displayLines;
|
|
1599
|
+
// Tokenize entire source, then pick lines
|
|
1600
|
+
const tokenized = tokenize$1(this._value, this._lang).split('\n');
|
|
1601
|
+
let hlHtml = '';
|
|
1602
|
+
for (const dl of displayLines) {
|
|
1603
|
+
if (dl.folded) {
|
|
1604
|
+
hlHtml += (tokenized[dl.real] || '') + `<span class="x-code-editor-folded-pill" data-line="${dl.real}"> ··· ${dl.count} lines </span>\n`;
|
|
1605
|
+
}
|
|
1606
|
+
else {
|
|
1607
|
+
hlHtml += (tokenized[dl.real] || '') + '\n';
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
this._highlighted = hlHtml;
|
|
1611
|
+
// AST (debounced if panel open)
|
|
1612
|
+
if (this._panel === 'ast')
|
|
1613
|
+
this._refreshAST();
|
|
1614
|
+
// Search re-run
|
|
1615
|
+
if (this._searchQuery)
|
|
1616
|
+
this._runSearch();
|
|
1617
|
+
}
|
|
1618
|
+
_drawGutter() {
|
|
1619
|
+
const canvas = this.gutterCanvas;
|
|
1620
|
+
if (!canvas)
|
|
1621
|
+
return;
|
|
1622
|
+
const totalLines = this._displayLines.length;
|
|
1623
|
+
const w = canvas.offsetWidth || 52;
|
|
1624
|
+
const h = Math.max(totalLines * LH + 32, this.codeContainer?.clientHeight || 400);
|
|
1625
|
+
canvas.width = w * (devicePixelRatio || 1);
|
|
1626
|
+
canvas.height = h * (devicePixelRatio || 1);
|
|
1627
|
+
canvas.style.width = w + 'px';
|
|
1628
|
+
canvas.style.height = h + 'px';
|
|
1629
|
+
const ctx = canvas.getContext('2d');
|
|
1630
|
+
if (!ctx)
|
|
1631
|
+
return;
|
|
1632
|
+
ctx.scale(devicePixelRatio || 1, devicePixelRatio || 1);
|
|
1633
|
+
ctx.clearRect(0, 0, w, h);
|
|
1634
|
+
ctx.font = `12px Fira Code, Consolas, monospace`;
|
|
1635
|
+
ctx.textAlign = 'right';
|
|
1636
|
+
this._displayLines.forEach((dl, i) => {
|
|
1637
|
+
const y = i * LH + 8;
|
|
1638
|
+
const isCur = dl.real === this._cursorLine;
|
|
1639
|
+
if (isCur && this.plugins.isEnabled('line-highlight')) {
|
|
1640
|
+
ctx.fillStyle = 'rgba(122,162,247,0.1)';
|
|
1641
|
+
ctx.fillRect(0, y - 2, w, LH);
|
|
1642
|
+
}
|
|
1643
|
+
ctx.fillStyle = isCur ? '#c0caf5' : '#3b3f5c';
|
|
1644
|
+
ctx.fillText(String(dl.real + 1), w - 8, y + LH * 0.72);
|
|
1645
|
+
// fold triangle
|
|
1646
|
+
if (this.plugins.isEnabled('fold') && (dl.folded || this._canFold(dl.real))) {
|
|
1647
|
+
ctx.fillStyle = '#3b3f5c';
|
|
1648
|
+
ctx.font = `8px monospace`;
|
|
1649
|
+
ctx.fillText(dl.folded ? '▶' : '▼', w - 5, y + LH * 0.7);
|
|
1650
|
+
ctx.font = `12px Fira Code, Consolas, monospace`;
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
_resizeTA() {
|
|
1655
|
+
if (!this.ta || !this.codeContainer)
|
|
1656
|
+
return;
|
|
1657
|
+
const lines = this._displayLines.length;
|
|
1658
|
+
const h = Math.max(lines * LH + 32, this.codeContainer.clientHeight);
|
|
1659
|
+
this.ta.style.minHeight = h + 'px';
|
|
1660
|
+
}
|
|
1661
|
+
_cursorInfo() {
|
|
1662
|
+
if (!this.ta)
|
|
1663
|
+
return { line: 0, col: 0, pos: 0 };
|
|
1664
|
+
const pos = this.ta.selectionStart;
|
|
1665
|
+
const before = this._value.slice(0, pos);
|
|
1666
|
+
const lines = before.split('\n');
|
|
1667
|
+
return { line: lines.length - 1, col: lines[lines.length - 1].length, pos };
|
|
1668
|
+
}
|
|
1669
|
+
_onCursorChange() {
|
|
1670
|
+
const { line, col} = this._cursorInfo();
|
|
1671
|
+
this._cursorLine = line;
|
|
1672
|
+
this._cursorCol = col;
|
|
1673
|
+
this._selLen = Math.abs(this.ta.selectionEnd - this.ta.selectionStart);
|
|
1674
|
+
this.cursorMove.emit({ line, col });
|
|
1675
|
+
this._drawGutter();
|
|
1676
|
+
if (this.plugins.isEnabled('autocomplete'))
|
|
1677
|
+
this._tryShowAC();
|
|
1678
|
+
// Word Highlights
|
|
1679
|
+
this._wordHls = this._wordHighlights();
|
|
1680
|
+
// Force re-render of highlight layers
|
|
1681
|
+
this._reHighlight();
|
|
1682
|
+
}
|
|
1683
|
+
_wordHls = [];
|
|
1684
|
+
_validateWord(str) {
|
|
1685
|
+
return /^[A-Za-z0-9_$]+$/.test(str);
|
|
1686
|
+
}
|
|
1687
|
+
_wordHighlights() {
|
|
1688
|
+
if (!this.ta)
|
|
1689
|
+
return [];
|
|
1690
|
+
const s = this.ta.selectionStart, e = this.ta.selectionEnd;
|
|
1691
|
+
if (s === e) {
|
|
1692
|
+
// Find word around cursor if empty selection
|
|
1693
|
+
return []; // or complex logic to extract word boundaries at cursor
|
|
1694
|
+
}
|
|
1695
|
+
const word = this._value.slice(s, e);
|
|
1696
|
+
if (!this._validateWord(word) || word.length > 50)
|
|
1697
|
+
return [];
|
|
1698
|
+
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1699
|
+
const re = new RegExp(`\\b${escaped}\\b`, 'g');
|
|
1700
|
+
const hls = [];
|
|
1701
|
+
let m;
|
|
1702
|
+
while ((m = re.exec(this._value)) !== null) {
|
|
1703
|
+
if (m.index !== s) {
|
|
1704
|
+
const before = this._value.slice(0, m.index);
|
|
1705
|
+
const lines = before.split('\n');
|
|
1706
|
+
const rawLine = lines.length - 1;
|
|
1707
|
+
const col = lines[rawLine].length;
|
|
1708
|
+
const dispIdx = this._displayLines.findIndex(dl => dl.real === rawLine);
|
|
1709
|
+
const row = dispIdx >= 0 ? dispIdx : rawLine;
|
|
1710
|
+
hls.push({
|
|
1711
|
+
top: row * LH + 8,
|
|
1712
|
+
left: col * CW + PAD,
|
|
1713
|
+
width: word.length * CW,
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
return hls;
|
|
1718
|
+
}
|
|
1719
|
+
_bracketHighlights() {
|
|
1720
|
+
if (!this.plugins.isEnabled('bracket-match') || !this.ta)
|
|
1721
|
+
return [];
|
|
1722
|
+
const pos = this.ta.selectionStart;
|
|
1723
|
+
const text = this._value;
|
|
1724
|
+
let searchPos = text[pos] && '{}[]()'.includes(text[pos]) ? pos : text[pos - 1] && '{}[]()'.includes(text[pos - 1]) ? pos - 1 : -1;
|
|
1725
|
+
if (searchPos < 0)
|
|
1726
|
+
return [];
|
|
1727
|
+
const ch = text[searchPos];
|
|
1728
|
+
const forward = '({['.includes(ch);
|
|
1729
|
+
const match = this._findMatchBracket(text, searchPos, forward);
|
|
1730
|
+
if (match < 0)
|
|
1731
|
+
return [];
|
|
1732
|
+
return [searchPos, match].map(p => {
|
|
1733
|
+
const before = text.slice(0, p);
|
|
1734
|
+
const lines = before.split('\n');
|
|
1735
|
+
const dispLine = this._displayLines.findIndex(dl => dl.real === lines.length - 1);
|
|
1736
|
+
const row = dispLine >= 0 ? dispLine : lines.length - 1;
|
|
1737
|
+
const col = lines[lines.length - 1].length;
|
|
1738
|
+
return { top: row * LH + 8, left: col * CW + PAD };
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
_findMatchBracket(text, pos, forward) {
|
|
1742
|
+
const opens = '({[', closes = ')}]';
|
|
1743
|
+
let depth = 0;
|
|
1744
|
+
const dir = forward ? 1 : -1;
|
|
1745
|
+
for (let i = pos; i >= 0 && i < text.length; i += dir) {
|
|
1746
|
+
if (opens.includes(text[i]))
|
|
1747
|
+
depth += forward ? 1 : -1;
|
|
1748
|
+
if (closes.includes(text[i]))
|
|
1749
|
+
depth += forward ? -1 : 1;
|
|
1750
|
+
if (depth === 0 && i !== pos)
|
|
1751
|
+
return i;
|
|
1752
|
+
}
|
|
1753
|
+
return -1;
|
|
1754
|
+
}
|
|
1755
|
+
_canFold(lineIdx) {
|
|
1756
|
+
const lines = this._value.split('\n');
|
|
1757
|
+
const line = lines[lineIdx] ?? '';
|
|
1758
|
+
return /[{(\[]$/.test(line.trimEnd()) || /^(function|class|if|for|while)\b/.test(line.trim());
|
|
1759
|
+
}
|
|
1760
|
+
_foldEnd(lines, start) {
|
|
1761
|
+
let depth = 0;
|
|
1762
|
+
for (let i = start; i < lines.length; i++) {
|
|
1763
|
+
for (const ch of lines[i]) {
|
|
1764
|
+
if ('({['.includes(ch))
|
|
1765
|
+
depth++;
|
|
1766
|
+
if (')}]'.includes(ch))
|
|
1767
|
+
depth--;
|
|
1768
|
+
if (depth <= 0 && i > start)
|
|
1769
|
+
return i;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
return Math.min(start + 1, lines.length - 1);
|
|
1773
|
+
}
|
|
1774
|
+
_toggleFold(lineIdx) {
|
|
1775
|
+
const f = new Set(this._folds);
|
|
1776
|
+
if (f.has(lineIdx))
|
|
1777
|
+
f.delete(lineIdx);
|
|
1778
|
+
else if (this._canFold(lineIdx))
|
|
1779
|
+
f.add(lineIdx);
|
|
1780
|
+
this._folds = f;
|
|
1781
|
+
this._reHighlight();
|
|
1782
|
+
}
|
|
1783
|
+
_foldAll() {
|
|
1784
|
+
const f = new Set();
|
|
1785
|
+
this._value.split('\n').forEach((_, i) => {
|
|
1786
|
+
if (this._canFold(i))
|
|
1787
|
+
f.add(i);
|
|
1788
|
+
});
|
|
1789
|
+
this._folds = f;
|
|
1790
|
+
this._reHighlight();
|
|
1791
|
+
}
|
|
1792
|
+
_unfoldAll() {
|
|
1793
|
+
this._folds = new Set();
|
|
1794
|
+
this._reHighlight();
|
|
1795
|
+
}
|
|
1796
|
+
_onInput() {
|
|
1797
|
+
if (!this.ta)
|
|
1798
|
+
return;
|
|
1799
|
+
const pos = this.ta.selectionStart;
|
|
1800
|
+
const char = this.ta.value[pos - 1];
|
|
1801
|
+
// Auto-outdent on typing closing brackets
|
|
1802
|
+
if (this.plugins.isEnabled('auto-indent') && (char === '}' || char === ']' || char === ')')) {
|
|
1803
|
+
const before = this.ta.value.slice(0, pos - 1);
|
|
1804
|
+
const lineStart = before.lastIndexOf('\n') + 1;
|
|
1805
|
+
const linePrefix = before.slice(lineStart);
|
|
1806
|
+
const tab = ' '.repeat(this.tabSize);
|
|
1807
|
+
// Only unindent if line is purely whitespace and ends with our tab size
|
|
1808
|
+
if (/^\s*$/.test(linePrefix) && linePrefix.endsWith(tab)) {
|
|
1809
|
+
const newPrefix = linePrefix.slice(0, -tab.length);
|
|
1810
|
+
const v = this.ta.value.slice(0, lineStart) + newPrefix + char + this.ta.value.slice(pos);
|
|
1811
|
+
this._applyValue(v, lineStart + newPrefix.length + 1, lineStart + newPrefix.length + 1, false);
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
const v = this.ta.value;
|
|
1816
|
+
this._applyValue(v, this.ta.selectionStart, this.ta.selectionEnd, true);
|
|
1817
|
+
}
|
|
1818
|
+
_onKeydown(e) {
|
|
1819
|
+
const ta = this.ta;
|
|
1820
|
+
const ctrl = e.ctrlKey || e.metaKey;
|
|
1821
|
+
// Undo / Redo
|
|
1822
|
+
if (ctrl && e.key === 'z' && !e.shiftKey) {
|
|
1823
|
+
e.preventDefault();
|
|
1824
|
+
this._undo();
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
if (ctrl && (e.key === 'y' || (e.key === 'z' && e.shiftKey))) {
|
|
1828
|
+
e.preventDefault();
|
|
1829
|
+
this._redo();
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
// Search
|
|
1833
|
+
if (ctrl && e.key === 'f') {
|
|
1834
|
+
e.preventDefault();
|
|
1835
|
+
this._showSearch = true;
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
if (ctrl && e.key === 'h') {
|
|
1839
|
+
e.preventDefault();
|
|
1840
|
+
this._showSearch = true;
|
|
1841
|
+
this._showReplace = true;
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
// Format
|
|
1845
|
+
if (e.shiftKey && e.altKey && e.key === 'F') {
|
|
1846
|
+
e.preventDefault();
|
|
1847
|
+
this._formatDoc();
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
// Select all occurrences
|
|
1851
|
+
if (ctrl && e.shiftKey && e.key === 'L') {
|
|
1852
|
+
e.preventDefault();
|
|
1853
|
+
this._selectAllOccurrences();
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
// Autocomplete navigation
|
|
1857
|
+
if (this._acOpen) {
|
|
1858
|
+
if (e.key === 'ArrowDown') {
|
|
1859
|
+
e.preventDefault();
|
|
1860
|
+
this._acMove(1);
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
if (e.key === 'ArrowUp') {
|
|
1864
|
+
e.preventDefault();
|
|
1865
|
+
this._acMove(-1);
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
if (e.key === 'Enter' || e.key === 'Tab') {
|
|
1869
|
+
e.preventDefault();
|
|
1870
|
+
this._acAccept();
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (e.key === 'Escape') {
|
|
1874
|
+
this._acOpen = false;
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
// Tab
|
|
1879
|
+
if (e.key === 'Tab') {
|
|
1880
|
+
e.preventDefault();
|
|
1881
|
+
e.shiftKey ? this._unindent() : this._insertTab();
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1884
|
+
// Enter — smart indent
|
|
1885
|
+
if (e.key === 'Enter' && this.plugins.isEnabled('auto-indent')) {
|
|
1886
|
+
e.preventDefault();
|
|
1887
|
+
this._smartEnter();
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
// Auto-close
|
|
1891
|
+
if (this.plugins.isEnabled('auto-close')) {
|
|
1892
|
+
if (PAIRS[e.key]) {
|
|
1893
|
+
const start = ta.selectionStart, end = ta.selectionEnd;
|
|
1894
|
+
if (start !== end) {
|
|
1895
|
+
e.preventDefault();
|
|
1896
|
+
this._wrapSel(e.key, PAIRS[e.key]);
|
|
1897
|
+
return;
|
|
1898
|
+
}
|
|
1899
|
+
if (e.key === PAIRS[e.key] && ta.value[start] === e.key) {
|
|
1900
|
+
e.preventDefault();
|
|
1901
|
+
ta.setSelectionRange(start + 1, start + 1);
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
e.preventDefault();
|
|
1905
|
+
this._insertPair(e.key, PAIRS[e.key]);
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
if (e.key === 'Backspace' && ta.selectionStart === ta.selectionEnd) {
|
|
1909
|
+
const pos = ta.selectionStart;
|
|
1910
|
+
const prev = ta.value[pos - 1], next = ta.value[pos];
|
|
1911
|
+
if (prev && PAIRS[prev] === next) {
|
|
1912
|
+
e.preventDefault();
|
|
1913
|
+
const v = ta.value.slice(0, pos - 1) + ta.value.slice(pos + 1);
|
|
1914
|
+
this._applyValue(v, pos - 1, pos - 1);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
_smartEnter() {
|
|
1921
|
+
const ta = this.ta;
|
|
1922
|
+
const pos = ta.selectionStart;
|
|
1923
|
+
const before = ta.value.slice(0, pos);
|
|
1924
|
+
const after = ta.value.slice(ta.selectionEnd);
|
|
1925
|
+
const linesBefore = before.split('\n');
|
|
1926
|
+
const curLine = linesBefore.pop() ?? '';
|
|
1927
|
+
const match = curLine.match(/^(\s*)/);
|
|
1928
|
+
const indent = match ? match[1] : '';
|
|
1929
|
+
const lastCh = curLine.trimEnd().slice(-1);
|
|
1930
|
+
const firstAfter = after.trimStart()[0];
|
|
1931
|
+
const tab = ' '.repeat(this.tabSize);
|
|
1932
|
+
let newIndent = indent;
|
|
1933
|
+
let extra = '';
|
|
1934
|
+
if ('({['.includes(lastCh)) {
|
|
1935
|
+
newIndent = indent + tab;
|
|
1936
|
+
if (')}]'.includes(firstAfter))
|
|
1937
|
+
extra = '\n' + indent;
|
|
1938
|
+
}
|
|
1939
|
+
const insert = '\n' + newIndent + extra;
|
|
1940
|
+
const v = before + insert + after;
|
|
1941
|
+
const newPos = pos + 1 + newIndent.length;
|
|
1942
|
+
this._applyValue(v, newPos, newPos);
|
|
1943
|
+
}
|
|
1944
|
+
_insertTab() {
|
|
1945
|
+
const ta = this.ta;
|
|
1946
|
+
const start = ta.selectionStart, end = ta.selectionEnd;
|
|
1947
|
+
const tab = ' '.repeat(this.tabSize);
|
|
1948
|
+
if (start === end) {
|
|
1949
|
+
const v = ta.value.slice(0, start) + tab + ta.value.slice(end);
|
|
1950
|
+
this._applyValue(v, start + tab.length, start + tab.length);
|
|
1951
|
+
}
|
|
1952
|
+
else {
|
|
1953
|
+
const lineStart = ta.value.lastIndexOf('\n', start - 1) + 1;
|
|
1954
|
+
const block = ta.value.slice(lineStart, end);
|
|
1955
|
+
const indented = block
|
|
1956
|
+
.split('\n')
|
|
1957
|
+
.map(l => tab + l)
|
|
1958
|
+
.join('\n');
|
|
1959
|
+
const v = ta.value.slice(0, lineStart) + indented + ta.value.slice(end);
|
|
1960
|
+
this._applyValue(v, lineStart, lineStart + indented.length);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
_unindent() {
|
|
1964
|
+
const ta = this.ta;
|
|
1965
|
+
const start = ta.selectionStart, end = ta.selectionEnd;
|
|
1966
|
+
const tab = ' '.repeat(this.tabSize);
|
|
1967
|
+
const lineStart = ta.value.lastIndexOf('\n', start - 1) + 1;
|
|
1968
|
+
const block = ta.value.slice(lineStart, end);
|
|
1969
|
+
const unindented = block
|
|
1970
|
+
.split('\n')
|
|
1971
|
+
.map(l => (l.startsWith(tab) ? l.slice(tab.length) : l.startsWith('\t') ? l.slice(1) : l))
|
|
1972
|
+
.join('\n');
|
|
1973
|
+
const v = ta.value.slice(0, lineStart) + unindented + ta.value.slice(end);
|
|
1974
|
+
this._applyValue(v, lineStart, lineStart + unindented.length);
|
|
1975
|
+
}
|
|
1976
|
+
_insertPair(open, close) {
|
|
1977
|
+
const ta = this.ta;
|
|
1978
|
+
const pos = ta.selectionStart;
|
|
1979
|
+
const v = ta.value.slice(0, pos) + open + close + ta.value.slice(ta.selectionEnd);
|
|
1980
|
+
this._applyValue(v, pos + 1, pos + 1);
|
|
1981
|
+
}
|
|
1982
|
+
_wrapSel(open, close) {
|
|
1983
|
+
const ta = this.ta;
|
|
1984
|
+
const s = ta.selectionStart, e = ta.selectionEnd;
|
|
1985
|
+
const sel = ta.value.slice(s, e);
|
|
1986
|
+
const v = ta.value.slice(0, s) + open + sel + close + ta.value.slice(e);
|
|
1987
|
+
this._applyValue(v, s + 1, e + 1);
|
|
1988
|
+
}
|
|
1989
|
+
_undo() {
|
|
1990
|
+
const entry = this.history.undo();
|
|
1991
|
+
if (!entry)
|
|
1992
|
+
return;
|
|
1993
|
+
this._value = entry.value;
|
|
1994
|
+
if (this.ta) {
|
|
1995
|
+
this.ta.value = entry.value;
|
|
1996
|
+
this.ta.setSelectionRange(entry.selStart, entry.selEnd);
|
|
1997
|
+
}
|
|
1998
|
+
this._reHighlight();
|
|
1999
|
+
this.codeChange.emit({ value: this._value });
|
|
2000
|
+
}
|
|
2001
|
+
_redo() {
|
|
2002
|
+
const entry = this.history.redo();
|
|
2003
|
+
if (!entry)
|
|
2004
|
+
return;
|
|
2005
|
+
this._value = entry.value;
|
|
2006
|
+
if (this.ta) {
|
|
2007
|
+
this.ta.value = entry.value;
|
|
2008
|
+
this.ta.setSelectionRange(entry.selStart, entry.selEnd);
|
|
2009
|
+
}
|
|
2010
|
+
this._reHighlight();
|
|
2011
|
+
this.codeChange.emit({ value: this._value });
|
|
2012
|
+
}
|
|
2013
|
+
_addExtraCursor(e) {
|
|
2014
|
+
if (!this.plugins.isEnabled('multi-cursor'))
|
|
2015
|
+
return;
|
|
2016
|
+
const rect = this.codeContainer.getBoundingClientRect();
|
|
2017
|
+
const x = e.clientX - rect.left - PAD + this.codeContainer.scrollLeft;
|
|
2018
|
+
const y = e.clientY - rect.top + this.codeContainer.scrollTop - 8;
|
|
2019
|
+
const dispLine = clamp(Math.floor(y / LH), 0, this._displayLines.length - 1);
|
|
2020
|
+
const realLine = this._displayLines[dispLine]?.real ?? 0;
|
|
2021
|
+
const lines = this._value.split('\n');
|
|
2022
|
+
const lineText = lines[realLine] ?? '';
|
|
2023
|
+
const col = clamp(Math.round(x / CW), 0, lineText.length);
|
|
2024
|
+
const pos = lines.slice(0, realLine).join('\n').length + (realLine > 0 ? 1 : 0) + col;
|
|
2025
|
+
this._extraCursors = [...this._extraCursors, { pos }];
|
|
2026
|
+
}
|
|
2027
|
+
_extraCursorPositions() {
|
|
2028
|
+
return this._extraCursors.map(cur => {
|
|
2029
|
+
const before = this._value.slice(0, cur.pos);
|
|
2030
|
+
const lines = before.split('\n');
|
|
2031
|
+
const realLine = lines.length - 1;
|
|
2032
|
+
const dispIdx = this._displayLines.findIndex(dl => dl.real === realLine);
|
|
2033
|
+
const row = dispIdx >= 0 ? dispIdx : realLine;
|
|
2034
|
+
const col = lines[realLine].length;
|
|
2035
|
+
return { top: row * LH + 8, left: col * CW + PAD };
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
_selectAllOccurrences() {
|
|
2039
|
+
const ta = this.ta;
|
|
2040
|
+
const s = ta.selectionStart, e = ta.selectionEnd;
|
|
2041
|
+
if (s === e)
|
|
2042
|
+
return;
|
|
2043
|
+
const word = ta.value.slice(s, e);
|
|
2044
|
+
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2045
|
+
const re = new RegExp(escaped, 'g');
|
|
2046
|
+
const cursors = [];
|
|
2047
|
+
let m;
|
|
2048
|
+
while ((m = re.exec(ta.value)) !== null) {
|
|
2049
|
+
if (m.index !== s)
|
|
2050
|
+
cursors.push({ pos: m.index });
|
|
2051
|
+
}
|
|
2052
|
+
this._extraCursors = cursors;
|
|
2053
|
+
}
|
|
2054
|
+
_runSearch() {
|
|
2055
|
+
const q = this._searchQuery;
|
|
2056
|
+
if (!q) {
|
|
2057
|
+
this._matches = [];
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
try {
|
|
2061
|
+
const re = new RegExp(q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi');
|
|
2062
|
+
const matches = [];
|
|
2063
|
+
let m;
|
|
2064
|
+
while ((m = re.exec(this._value)) !== null) {
|
|
2065
|
+
matches.push({ start: m.index, end: m.index + m[0].length });
|
|
2066
|
+
}
|
|
2067
|
+
this._matches = matches;
|
|
2068
|
+
if (this._matchIdx >= matches.length)
|
|
2069
|
+
this._matchIdx = 0;
|
|
2070
|
+
}
|
|
2071
|
+
catch {
|
|
2072
|
+
this._matches = [];
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
_searchNext() {
|
|
2076
|
+
if (!this._matches.length)
|
|
2077
|
+
return;
|
|
2078
|
+
this._matchIdx = (this._matchIdx + 1) % this._matches.length;
|
|
2079
|
+
this._jumpToMatch(this._matchIdx);
|
|
2080
|
+
}
|
|
2081
|
+
_searchPrev() {
|
|
2082
|
+
if (!this._matches.length)
|
|
2083
|
+
return;
|
|
2084
|
+
this._matchIdx = (this._matchIdx - 1 + this._matches.length) % this._matches.length;
|
|
2085
|
+
this._jumpToMatch(this._matchIdx);
|
|
2086
|
+
}
|
|
2087
|
+
_jumpToMatch(idx) {
|
|
2088
|
+
const m = this._matches[idx];
|
|
2089
|
+
if (!m || !this.ta)
|
|
2090
|
+
return;
|
|
2091
|
+
this.ta.setSelectionRange(m.start, m.end);
|
|
2092
|
+
this.ta.focus();
|
|
2093
|
+
const before = this._value.slice(0, m.start);
|
|
2094
|
+
const line = before.split('\n').length - 1;
|
|
2095
|
+
const dispIdx = this._displayLines.findIndex(dl => dl.real === line);
|
|
2096
|
+
const row = dispIdx >= 0 ? dispIdx : line;
|
|
2097
|
+
this.codeContainer.scrollTop = Math.max(0, row * LH - 100);
|
|
2098
|
+
}
|
|
2099
|
+
_replaceOne() {
|
|
2100
|
+
const m = this._matches[this._matchIdx];
|
|
2101
|
+
if (!m)
|
|
2102
|
+
return;
|
|
2103
|
+
this.history.pushNow({ value: this._value, selStart: m.start, selEnd: m.end });
|
|
2104
|
+
const v = this._value.slice(0, m.start) + this._replaceQuery + this._value.slice(m.end);
|
|
2105
|
+
this._applyValue(v, m.start, m.start + this._replaceQuery.length);
|
|
2106
|
+
this._runSearch();
|
|
2107
|
+
}
|
|
2108
|
+
_replaceAll() {
|
|
2109
|
+
if (!this._searchQuery)
|
|
2110
|
+
return;
|
|
2111
|
+
this.history.pushNow({ value: this._value, selStart: 0, selEnd: 0 });
|
|
2112
|
+
try {
|
|
2113
|
+
const re = new RegExp(this._searchQuery.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi');
|
|
2114
|
+
const v = this._value.replace(re, this._replaceQuery);
|
|
2115
|
+
this._applyValue(v, 0, 0);
|
|
2116
|
+
this._runSearch();
|
|
2117
|
+
}
|
|
2118
|
+
catch { }
|
|
2119
|
+
}
|
|
2120
|
+
_searchHighlights() {
|
|
2121
|
+
return this._matches.map((m, idx) => {
|
|
2122
|
+
const before = this._value.slice(0, m.start);
|
|
2123
|
+
const lines = before.split('\n');
|
|
2124
|
+
const realLine = lines.length - 1;
|
|
2125
|
+
const dispIdx = this._displayLines.findIndex(dl => dl.real === realLine);
|
|
2126
|
+
const row = dispIdx >= 0 ? dispIdx : realLine;
|
|
2127
|
+
const col = lines[realLine].length;
|
|
2128
|
+
const len = m.end - m.start;
|
|
2129
|
+
return { top: row * LH + 8, left: col * CW + PAD, width: len * CW, isCur: idx === this._matchIdx };
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
_tryShowAC() {
|
|
2133
|
+
if (!this.ta)
|
|
2134
|
+
return;
|
|
2135
|
+
const pos = this.ta.selectionStart;
|
|
2136
|
+
if (this.ta.selectionStart !== this.ta.selectionEnd) {
|
|
2137
|
+
this._acOpen = false;
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const before = this._value.slice(0, pos);
|
|
2141
|
+
const m = before.match(/[\w.@#-]+$/);
|
|
2142
|
+
const prefix = m ? m[0] : '';
|
|
2143
|
+
if (prefix.length < 1) {
|
|
2144
|
+
this._acOpen = false;
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
const items = getCompletions(prefix, this._lang);
|
|
2148
|
+
if (!items.length) {
|
|
2149
|
+
this._acOpen = false;
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
this._acItems = items;
|
|
2153
|
+
this._acIndex = 0;
|
|
2154
|
+
this._acOpen = true;
|
|
2155
|
+
// Position
|
|
2156
|
+
const lines = before.split('\n');
|
|
2157
|
+
const dispIdx = this._displayLines.findIndex(dl => dl.real === lines.length - 1);
|
|
2158
|
+
const row = dispIdx >= 0 ? dispIdx : lines.length - 1;
|
|
2159
|
+
const col = lines[lines.length - 1].length;
|
|
2160
|
+
this._acX = col * CW + PAD;
|
|
2161
|
+
this._acY = (row + 1) * LH + 8;
|
|
2162
|
+
}
|
|
2163
|
+
_acMove(dir) {
|
|
2164
|
+
this._acIndex = clamp(this._acIndex + dir, 0, this._acItems.length - 1);
|
|
2165
|
+
// Auto scroll to the selected item avoiding overlap
|
|
2166
|
+
if (this.acContainer) {
|
|
2167
|
+
// Wait for DOM to render the selected class (since Stencil is async)
|
|
2168
|
+
// But actually we can just scroll immediately since the items are already in DOM,
|
|
2169
|
+
// we just need the offsetTop of the corresponding item.
|
|
2170
|
+
setTimeout(() => {
|
|
2171
|
+
if (!this.acContainer)
|
|
2172
|
+
return;
|
|
2173
|
+
const itemElement = this.acContainer.children[this._acIndex];
|
|
2174
|
+
if (!itemElement)
|
|
2175
|
+
return;
|
|
2176
|
+
const containerTop = this.acContainer.scrollTop;
|
|
2177
|
+
const containerBottom = containerTop + this.acContainer.clientHeight;
|
|
2178
|
+
const itemTop = itemElement.offsetTop;
|
|
2179
|
+
const itemBottom = itemTop + itemElement.offsetHeight;
|
|
2180
|
+
if (itemBottom > containerBottom) {
|
|
2181
|
+
this.acContainer.scrollTop = itemBottom - this.acContainer.clientHeight;
|
|
2182
|
+
}
|
|
2183
|
+
else if (itemTop < containerTop) {
|
|
2184
|
+
this.acContainer.scrollTop = itemTop;
|
|
2185
|
+
}
|
|
2186
|
+
}, 10);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
_acAccept() {
|
|
2190
|
+
const item = this._acItems[this._acIndex];
|
|
2191
|
+
if (!item)
|
|
2192
|
+
return;
|
|
2193
|
+
const ta = this.ta;
|
|
2194
|
+
const pos = ta.selectionStart;
|
|
2195
|
+
const before = this._value.slice(0, pos);
|
|
2196
|
+
const m = before.match(/[\w.@#-]+$/);
|
|
2197
|
+
const prefix = m ? m[0] : '';
|
|
2198
|
+
const insert = (item.insert ?? item.label).replace(/\$\{\d+:[^}]+\}|\$\d+/g, '');
|
|
2199
|
+
const v = this._value.slice(0, pos - prefix.length) + insert + this._value.slice(pos);
|
|
2200
|
+
const newPos = pos - prefix.length + insert.length;
|
|
2201
|
+
this._applyValue(v, newPos, newPos);
|
|
2202
|
+
this._acOpen = false;
|
|
2203
|
+
}
|
|
2204
|
+
_formatDoc() {
|
|
2205
|
+
if (this._lang !== 'json')
|
|
2206
|
+
return;
|
|
2207
|
+
try {
|
|
2208
|
+
const formatted = JSON.stringify(JSON.parse(this._value), null, this.tabSize);
|
|
2209
|
+
this.history.pushNow({ value: this._value, selStart: 0, selEnd: 0 });
|
|
2210
|
+
this._applyValue(formatted, 0, 0);
|
|
2211
|
+
}
|
|
2212
|
+
catch {
|
|
2213
|
+
/* invalid json */
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
_refreshAST() {
|
|
2217
|
+
if (this._lang !== 'js') {
|
|
2218
|
+
this._astRoot = null;
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
this._astRoot = parseAST(this._value);
|
|
2222
|
+
}
|
|
2223
|
+
_togglePanel(p) {
|
|
2224
|
+
this._panel = this._panel === p ? null : p;
|
|
2225
|
+
if (this._panel === 'ast')
|
|
2226
|
+
this._refreshAST();
|
|
2227
|
+
if (this._panel === 'plugins')
|
|
2228
|
+
this._pluginList = this.plugins.list();
|
|
2229
|
+
}
|
|
2230
|
+
// ── Render helpers ─────────────────────────────────────────────────────────
|
|
2231
|
+
_renderACIcon(type) {
|
|
2232
|
+
const MAP = {
|
|
2233
|
+
kw: 'K',
|
|
2234
|
+
fn: 'F',
|
|
2235
|
+
var: 'V',
|
|
2236
|
+
prop: 'P',
|
|
2237
|
+
snip: 'S',
|
|
2238
|
+
tag: 'T',
|
|
2239
|
+
attr: 'A',
|
|
2240
|
+
};
|
|
2241
|
+
return MAP[type] ?? '?';
|
|
2242
|
+
}
|
|
2243
|
+
_renderASTTree(node, depth = 0) {
|
|
2244
|
+
if (!node)
|
|
2245
|
+
return '';
|
|
2246
|
+
if (Array.isArray(node)) {
|
|
2247
|
+
if (!node.length)
|
|
2248
|
+
return '<span class="x-code-editor-ast-val">[]</span>';
|
|
2249
|
+
return node.map(n => this._renderASTTree(n, depth)).join('');
|
|
2250
|
+
}
|
|
2251
|
+
const { type, ...rest } = node;
|
|
2252
|
+
const keys = Object.keys(rest).filter(k => !k.startsWith('_'));
|
|
2253
|
+
const id = `n${Math.random().toString(36).slice(2, 8)}`;
|
|
2254
|
+
const childHtml = keys
|
|
2255
|
+
.map(k => {
|
|
2256
|
+
const v = rest[k];
|
|
2257
|
+
if (v === null || v === undefined)
|
|
2258
|
+
return '';
|
|
2259
|
+
const rendered = typeof v === 'object' ? this._renderASTTree(v, depth + 1) : `<span class="x-code-editor-ast-val">${escH(String(v))}</span>`;
|
|
2260
|
+
return `<div class="x-code-editor-ast-row"><span class="x-code-editor-ast-key">${escH(k)}:</span> ${rendered}</div>`;
|
|
2261
|
+
})
|
|
2262
|
+
.filter(Boolean)
|
|
2263
|
+
.join('');
|
|
2264
|
+
if (!childHtml)
|
|
2265
|
+
return `<span class="x-code-editor-ast-type">${escH(type ?? '')}</span>`;
|
|
2266
|
+
return `<div class="x-code-editor-ast-node">
|
|
2267
|
+
<span class="x-code-editor-ast-toggle" onclick="this.nextElementSibling.style.display=this.nextElementSibling.style.display==='none'?'':'none'">
|
|
2268
|
+
▾ <span class="x-code-editor-ast-type">${escH(type ?? '')}</span>
|
|
2269
|
+
</span>
|
|
2270
|
+
<div id="${id}" class="x-code-editor-ast-children">${childHtml}</div>
|
|
2271
|
+
</div>`;
|
|
2272
|
+
}
|
|
2273
|
+
// ==================== Render ====================
|
|
2274
|
+
render() {
|
|
2275
|
+
const bracketHls = this._bracketHighlights();
|
|
2276
|
+
const searchHls = this._searchHighlights();
|
|
2277
|
+
const extraCursorPositions = this._extraCursorPositions();
|
|
2278
|
+
const totalLines = this._displayLines.length;
|
|
2279
|
+
const containerH = Math.max(totalLines * LH + 32, 300);
|
|
2280
|
+
const acPrefix = (() => {
|
|
2281
|
+
if (!this.ta)
|
|
2282
|
+
return '';
|
|
2283
|
+
const before = this._value.slice(0, this.ta.selectionStart);
|
|
2284
|
+
return before.match(/[\w.@#-]+$/)?.[0] ?? '';
|
|
2285
|
+
})();
|
|
2286
|
+
const wrapperClasses = {
|
|
2287
|
+
'x-code-editor-root': true,
|
|
2288
|
+
[`theme-${this.theme}`]: true,
|
|
2289
|
+
[this.classNames?.root ?? '']: !!this.classNames?.root,
|
|
2290
|
+
};
|
|
2291
|
+
const editorBoxClasses = {
|
|
2292
|
+
'x-code-editor-editor-wrap': true,
|
|
2293
|
+
[this.classNames?.editorBox ?? '']: !!this.classNames?.editorBox,
|
|
2294
|
+
};
|
|
2295
|
+
return (h(Host, { class: wrapperClasses, style: this.styles?.root }, h("div", { class: { 'x-code-editor-toolbar': true, [this.classNames?.toolbar ?? '']: !!this.classNames?.toolbar }, style: this.styles?.toolbar }, h("button", { class: "x-code-editor-tbtn", onClick: () => {
|
|
2296
|
+
this._showSearch = true;
|
|
2297
|
+
} }, "\u2315 Search"), h("button", { class: "x-code-editor-tbtn", onClick: () => {
|
|
2298
|
+
this._showSearch = true;
|
|
2299
|
+
this._showReplace = !this._showReplace;
|
|
2300
|
+
} }, "\u21C4 Replace"), h("span", { class: "x-code-editor-tsep" }), h("button", { class: "x-code-editor-tbtn", onClick: () => this._undo(), title: "Ctrl+Z" }, "\u21BA Undo"), h("button", { class: "x-code-editor-tbtn", onClick: () => this._redo(), title: "Ctrl+Y" }, "\u21BB Redo"), h("span", { class: "x-code-editor-tsep" }), h("button", { class: "x-code-editor-tbtn", onClick: () => this._foldAll() }, "\u229F Fold All"), h("button", { class: "x-code-editor-tbtn", onClick: () => this._unfoldAll() }, "\u229E Unfold All"), h("span", { class: "x-code-editor-tsep" }), h("button", { class: `x-code-editor-tbtn${this._panel === 'ast' ? ' x-code-editor-active' : ''}`, onClick: () => this._togglePanel('ast') }, "\uD83C\uDF32 AST"), h("button", { class: `x-code-editor-tbtn${this._panel === 'plugins' ? ' x-code-editor-active' : ''}`, onClick: () => this._togglePanel('plugins') }, "\u2699 Plugins"), this._lang === 'json' && (h("button", { class: "x-code-editor-tbtn", onClick: () => this._formatDoc() }, "\u2726 Format")), h("span", { class: "x-code-editor-toolbar-lang" }, LANG_NAMES[this._lang])), this._showSearch && (h("div", { class: "x-code-editor-search-bar" }, h("input", { class: "x-code-editor-search-input", type: "text", placeholder: "Find\u2026", value: this._searchQuery, onInput: e => {
|
|
2301
|
+
this._searchQuery = e.target.value;
|
|
2302
|
+
this._runSearch();
|
|
2303
|
+
}, onKeyDown: e => {
|
|
2304
|
+
if (e.key === 'Enter')
|
|
2305
|
+
e.shiftKey ? this._searchPrev() : this._searchNext();
|
|
2306
|
+
if (e.key === 'Escape') {
|
|
2307
|
+
this._showSearch = false;
|
|
2308
|
+
this._matches = [];
|
|
2309
|
+
}
|
|
2310
|
+
} }), this._showReplace && (h("input", { class: "x-code-editor-search-input", type: "text", placeholder: "Replace\u2026", value: this._replaceQuery, onInput: e => {
|
|
2311
|
+
this._replaceQuery = e.target.value;
|
|
2312
|
+
} })), h("button", { class: "x-code-editor-sbar-btn", onClick: () => this._searchPrev() }, "\u2191"), h("button", { class: "x-code-editor-sbar-btn", onClick: () => this._searchNext() }, "\u2193"), this._showReplace && (h(Fragment, null, h("button", { class: "x-code-editor-sbar-btn", onClick: () => this._replaceOne() }, "Replace"), h("button", { class: "x-code-editor-sbar-btn", onClick: () => this._replaceAll() }, "All"))), h("span", { class: "x-code-editor-match-count" }, this._matches.length > 0 ? `${this._matchIdx + 1} / ${this._matches.length}` : this._searchQuery ? '0 matches' : ''), h("button", { class: "x-code-editor-sbar-close", onClick: () => {
|
|
2313
|
+
this._showSearch = false;
|
|
2314
|
+
this._matches = [];
|
|
2315
|
+
} }, "\u2715"))), h("div", { class: "x-code-editor-main-area" }, h("div", { class: editorBoxClasses, style: this.styles?.editorBox }, h("div", { class: { 'x-code-editor-gutter': true, [this.classNames?.gutter ?? '']: !!this.classNames?.gutter }, style: this.styles?.gutter }, h("canvas", { ref: el => (this.gutterCanvas = el), class: "x-code-editor-gutter-canvas", onClick: e => {
|
|
2316
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
2317
|
+
const y = e.clientY - rect.top + this.codeContainer.scrollTop;
|
|
2318
|
+
const dispIdx = Math.floor(y / LH);
|
|
2319
|
+
const dl = this._displayLines[dispIdx];
|
|
2320
|
+
if (dl && this.plugins.isEnabled('fold'))
|
|
2321
|
+
this._toggleFold(dl.real);
|
|
2322
|
+
} })), h("div", { class: "x-code-editor-code-container", ref: el => (this.codeContainer = el) }, this.plugins.isEnabled('line-highlight') && h("div", { class: "x-code-editor-cur-line-hl", style: { top: `${this._cursorLine * LH + 8}px` } }), bracketHls.map(b => (h("div", { class: "x-code-editor-bracket-hl", style: { top: `${b.top}px`, left: `${b.left}px` } }))), searchHls.map(s => (h("div", { class: `x-code-editor-search-hl${s.isCur ? ' x-code-editor-search-cur' : ''}`, style: { top: `${s.top}px`, left: `${s.left}px`, width: `${s.width}px` } }))), extraCursorPositions.map(p => (h("div", { class: "x-code-editor-extra-cursor", style: { top: `${p.top}px`, left: `${p.left}px` } }))), this._wordHls.map(w => (h("div", { class: "x-code-editor-word-hl", style: { top: `${w.top}px`, left: `${w.left}px`, width: `${w.width}px` } }))), h("div", { class: "x-code-editor-highlight-layer", style: { minHeight: `${containerH}px` }, innerHTML: this._highlighted, onClick: e => {
|
|
2323
|
+
const target = e.target;
|
|
2324
|
+
if (target.classList.contains('x-code-editor-folded-pill')) {
|
|
2325
|
+
const line = parseInt(target.dataset.line ?? '0', 10);
|
|
2326
|
+
const f = new Set(this._folds);
|
|
2327
|
+
f.delete(line);
|
|
2328
|
+
this._folds = f;
|
|
2329
|
+
this._reHighlight();
|
|
2330
|
+
}
|
|
2331
|
+
} }), h("textarea", { ref: el => (this.ta = el), class: { 'x-code-editor-code-input': true, [this.classNames?.textarea ?? '']: !!this.classNames?.textarea }, spellcheck: false, autocomplete: "off", autocorrect: "off", autocapitalize: "off", readonly: this.readonly, style: { minHeight: `${containerH}px` }, onInput: () => this._onInput(), onKeyDown: e => this._onKeydown(e), onClick: () => this._onCursorChange(), onKeyUp: () => this._onCursorChange(), onMouseUp: () => this._onCursorChange(), onMouseDown: e => {
|
|
2332
|
+
if (e.altKey) {
|
|
2333
|
+
e.preventDefault();
|
|
2334
|
+
this._addExtraCursor(e);
|
|
2335
|
+
}
|
|
2336
|
+
}, onScroll: () => this._drawGutter() }))), this._panel === 'ast' && (h("div", { class: "x-code-editor-side-panel" }, h("div", { class: "x-code-editor-panel-header" }, "AST Explorer", h("button", { class: "x-code-editor-panel-close", onClick: () => (this._panel = null) }, "\u2715")), h("div", { class: "x-code-editor-panel-body" }, this._lang !== 'js' ? (h("p", { class: "x-code-editor-panel-hint" }, "AST available for JavaScript only")) : this._astRoot ? (h("div", { class: "x-code-editor-ast-tree", innerHTML: this._renderASTTree(this._astRoot) })) : (h("p", { class: "x-code-editor-panel-hint" }, "Parsing\u2026"))))), this._panel === 'plugins' && (h("div", { class: "x-code-editor-side-panel" }, h("div", { class: "x-code-editor-panel-header" }, "Plugins", h("button", { class: "x-code-editor-panel-close", onClick: () => (this._panel = null) }, "\u2715")), h("div", { class: "x-code-editor-panel-body" }, this._pluginList.map(p => (h("div", { class: "x-code-editor-plugin-card" }, h("div", { class: "x-code-editor-plugin-card-header" }, h("span", { class: "x-code-editor-plugin-name" }, p.name), h("div", { class: `x-code-editor-toggle${p.enabled ? ' x-code-editor-on' : ''}`, onClick: () => {
|
|
2337
|
+
this.plugins.toggle(p.id);
|
|
2338
|
+
this._pluginList = this.plugins.list();
|
|
2339
|
+
this._reHighlight();
|
|
2340
|
+
} })), h("p", { class: "x-code-editor-plugin-desc" }, p.description)))))))), this._acOpen && this._acItems.length > 0 && (h("div", { class: "x-code-editor-autocomplete", ref: el => (this.acContainer = el), style: {
|
|
2341
|
+
left: `${this._acX}px`,
|
|
2342
|
+
top: `${this._acY - (this.codeContainer?.scrollTop || 0) + 32 + (this._showSearch ? 36 : 0)}px`,
|
|
2343
|
+
} }, this._acItems.map((item, i) => {
|
|
2344
|
+
const hl = item.label.slice(0, acPrefix.length);
|
|
2345
|
+
const rest = item.label.slice(acPrefix.length);
|
|
2346
|
+
return (h("div", { class: `x-code-editor-ac-item${i === this._acIndex ? ' x-code-editor-selected' : ''}`, onClick: () => {
|
|
2347
|
+
this._acIndex = i;
|
|
2348
|
+
this._acAccept();
|
|
2349
|
+
} }, h("span", { class: `x-code-editor-ac-icon x-code-editor-ac-${item.type}` }, this._renderACIcon(item.type)), h("span", { class: "x-code-editor-ac-label" }, h("b", null, hl), rest), h("span", { class: "x-code-editor-ac-detail" }, item.detail)));
|
|
2350
|
+
}))), h("div", { class: "x-code-editor-statusbar" }, h("span", { class: "x-code-editor-sb-cursor" }, "Ln ", this._cursorLine + 1, ", Col ", this._cursorCol + 1), this._selLen > 0 && h("span", { class: "x-code-editor-sb-sel" }, this._selLen, " selected"), this._extraCursors.length > 0 && h("span", { class: "x-code-editor-sb-multicursor" }, "+", this._extraCursors.length, " cursors"), this._extraCursors.length > 0 && (h("button", { class: "x-code-editor-sb-clear-cursors", onClick: () => (this._extraCursors = []) }, "\u00D7 clear")), h("span", { class: "x-code-editor-sb-spacer" }), h("span", { class: "x-code-editor-sb-utf" }, "UTF-8"), h("span", { class: "x-code-editor-sb-lf" }, "LF"), h("span", { class: "x-code-editor-sb-lang" }, LANG_NAMES[this._lang]), h("span", { class: "x-code-editor-sb-chars" }, this._value.length, " chars"))));
|
|
2351
|
+
}
|
|
2352
|
+
static get watchers() { return {
|
|
2353
|
+
"value": [{
|
|
2354
|
+
"onValueProp": 0
|
|
2355
|
+
}],
|
|
2356
|
+
"language": [{
|
|
2357
|
+
"onLangProp": 0
|
|
2358
|
+
}]
|
|
2359
|
+
}; }
|
|
2360
|
+
};
|
|
2361
|
+
XCodeEditor.style = xCodeEditorCss();
|
|
2362
|
+
|
|
2363
|
+
export { XCodeEditor as x_code_editor };
|