@aithe/aithe-ui 26.2.3 → 26.3.2
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/README.md +19 -11
- package/dist/apps/admin/app.js +12 -0
- package/dist/apps/admin/components/admin-app.js +83 -0
- package/dist/apps/admin/components/admin-layout.d.ts +0 -1
- package/dist/apps/admin/components/admin-layout.d.ts.map +1 -1
- package/dist/apps/admin/components/admin-layout.js +250 -0
- package/dist/apps/admin/datahub/auth.js +24 -0
- package/dist/apps/admin/datahub/dashboard.js +16 -0
- package/dist/apps/admin/datahub/index.js +42 -0
- package/dist/apps/admin/datahub/menu.js +16 -0
- package/dist/apps/admin/datahub/mock/auth.js +11 -0
- package/dist/apps/admin/datahub/mock/dashboard.js +10 -0
- package/dist/apps/admin/datahub/mock/menu.js +42 -0
- package/dist/apps/admin/i18n/de-DE.js +37 -0
- package/dist/apps/admin/i18n/en-US.js +37 -0
- package/dist/apps/admin/i18n/es-ES.js +38 -0
- package/dist/apps/admin/i18n/fr-FR.js +37 -0
- package/dist/apps/admin/i18n/index.js +27 -0
- package/dist/apps/admin/i18n/ja-JP.js +38 -0
- package/dist/apps/admin/i18n/ko-KR.js +37 -0
- package/dist/apps/admin/i18n/pt-BR.js +37 -0
- package/dist/apps/admin/i18n/zh-CN.js +37 -0
- package/dist/apps/admin/i18n/zh-HK.js +37 -0
- package/dist/apps/admin/i18n/zh-TW.js +37 -0
- package/dist/apps/admin/pages/dashboard-page.d.ts +1 -0
- package/dist/apps/admin/pages/dashboard-page.d.ts.map +1 -1
- package/dist/apps/admin/pages/dashboard-page.js +199 -0
- package/dist/apps/admin/pages/login-page.js +278 -0
- package/dist/apps/admin/pages/not-found-page.js +57 -0
- package/dist/apps/admin/pages/role-page.js +76 -0
- package/dist/apps/admin/pages/settings-page.js +95 -0
- package/dist/apps/admin/pages/user-page.js +76 -0
- package/dist/apps/admin/router/index.js +43 -0
- package/dist/apps/admin/standalone.js +1 -0
- package/dist/apps/admin/store/auth.js +42 -0
- package/dist/apps/api/app.js +82 -0
- package/dist/apps/api/demo-data.d.ts.map +1 -1
- package/dist/apps/api/demo-data.js +965 -0
- package/dist/apps/api/docs-viewer.js +684 -0
- package/dist/apps/api/i18n/de-DE.d.ts.map +1 -1
- package/dist/apps/api/i18n/de-DE.js +131 -0
- package/dist/apps/api/i18n/en-US.d.ts.map +1 -1
- package/dist/apps/api/i18n/en-US.js +141 -0
- package/dist/apps/api/i18n/es-ES.d.ts.map +1 -1
- package/dist/apps/api/i18n/es-ES.js +131 -0
- package/dist/apps/api/i18n/fr-FR.d.ts.map +1 -1
- package/dist/apps/api/i18n/fr-FR.js +131 -0
- package/dist/apps/api/i18n/index.js +27 -0
- package/dist/apps/api/i18n/ja-JP.d.ts.map +1 -1
- package/dist/apps/api/i18n/ja-JP.js +131 -0
- package/dist/apps/api/i18n/ko-KR.d.ts.map +1 -1
- package/dist/apps/api/i18n/ko-KR.js +131 -0
- package/dist/apps/api/i18n/pt-BR.d.ts.map +1 -1
- package/dist/apps/api/i18n/pt-BR.js +131 -0
- package/dist/apps/api/i18n/zh-CN.d.ts.map +1 -1
- package/dist/apps/api/i18n/zh-CN.js +141 -0
- package/dist/apps/api/i18n/zh-HK.d.ts.map +1 -1
- package/dist/apps/api/i18n/zh-HK.js +131 -0
- package/dist/apps/api/i18n/zh-TW.d.ts.map +1 -1
- package/dist/apps/api/i18n/zh-TW.js +131 -0
- package/dist/apps/api/pages/docs.d.ts.map +1 -1
- package/dist/apps/api/pages/docs.js +369 -0
- package/dist/apps/api/standalone.js +1 -0
- package/dist/apps/demo/app.d.ts.map +1 -1
- package/dist/apps/demo/app.js +275 -0
- package/dist/apps/demo/editor.d.ts.map +1 -1
- package/dist/apps/demo/editor.js +270 -0
- package/dist/apps/demo/helpers.js +7 -0
- package/dist/apps/demo/i18n/de-DE.d.ts.map +1 -1
- package/dist/apps/demo/i18n/de-DE.js +289 -0
- package/dist/apps/demo/i18n/en-US.d.ts.map +1 -1
- package/dist/apps/demo/i18n/en-US.js +301 -0
- package/dist/apps/demo/i18n/es-ES.d.ts.map +1 -1
- package/dist/apps/demo/i18n/es-ES.js +289 -0
- package/dist/apps/demo/i18n/fr-FR.d.ts.map +1 -1
- package/dist/apps/demo/i18n/fr-FR.js +289 -0
- package/dist/apps/demo/i18n/index.js +27 -0
- package/dist/apps/demo/i18n/ja-JP.d.ts.map +1 -1
- package/dist/apps/demo/i18n/ja-JP.js +289 -0
- package/dist/apps/demo/i18n/ko-KR.d.ts.map +1 -1
- package/dist/apps/demo/i18n/ko-KR.js +289 -0
- package/dist/apps/demo/i18n/pt-BR.d.ts.map +1 -1
- package/dist/apps/demo/i18n/pt-BR.js +289 -0
- package/dist/apps/demo/i18n/zh-CN.d.ts.map +1 -1
- package/dist/apps/demo/i18n/zh-CN.js +301 -0
- package/dist/apps/demo/i18n/zh-HK.d.ts.map +1 -1
- package/dist/apps/demo/i18n/zh-HK.js +289 -0
- package/dist/apps/demo/i18n/zh-TW.d.ts.map +1 -1
- package/dist/apps/demo/i18n/zh-TW.js +289 -0
- package/dist/apps/demo/pages/autoform.d.ts.map +1 -1
- package/dist/apps/demo/pages/autoform.js +422 -0
- package/dist/apps/demo/pages/autoview.d.ts +3 -0
- package/dist/apps/demo/pages/autoview.d.ts.map +1 -0
- package/dist/apps/demo/pages/autoview.js +310 -0
- package/dist/apps/demo/pages/basic.js +157 -0
- package/dist/apps/demo/pages/code.js +1088 -0
- package/dist/apps/demo/pages/container.js +42 -0
- package/dist/apps/demo/pages/dashboard.js +159 -0
- package/dist/apps/demo/pages/data.d.ts.map +1 -1
- package/dist/apps/demo/pages/data.js +327 -0
- package/dist/apps/demo/pages/display.d.ts.map +1 -1
- package/dist/apps/demo/pages/display.js +295 -0
- package/dist/apps/demo/pages/feedback.js +94 -0
- package/dist/apps/demo/pages/form.d.ts.map +1 -1
- package/dist/apps/demo/pages/form.js +119 -0
- package/dist/apps/demo/pages/layout.js +74 -0
- package/dist/apps/demo/pages/navigation.js +54 -0
- package/dist/apps/demo/pages/progress.js +42 -0
- package/dist/apps/demo/pages/theme.js +126 -0
- package/dist/apps/demo/standalone.js +1 -0
- package/dist/components/basic/AGENTS.md +1 -0
- package/dist/components/basic/avatar.js +168 -0
- package/dist/components/basic/badge.js +157 -0
- package/dist/components/basic/button-group.js +70 -0
- package/dist/components/basic/button.d.ts +2 -4
- package/dist/components/basic/button.d.ts.map +1 -1
- package/dist/components/basic/button.js +315 -0
- package/dist/components/basic/card.js +186 -0
- package/dist/components/basic/chip.js +103 -0
- package/dist/components/basic/divider.js +127 -0
- package/dist/components/basic/empty.js +72 -0
- package/dist/components/basic/icon.js +129 -0
- package/dist/components/basic/input.d.ts.map +1 -1
- package/dist/components/basic/input.js +314 -0
- package/dist/components/basic/tag.d.ts +7 -2
- package/dist/components/basic/tag.d.ts.map +1 -1
- package/dist/components/basic/tag.js +248 -0
- package/dist/components/basic/textarea.d.ts +0 -1
- package/dist/components/basic/textarea.d.ts.map +1 -1
- package/dist/components/basic/textarea.js +130 -0
- package/dist/components/container/callout.js +108 -0
- package/dist/components/container/details.js +117 -0
- package/dist/components/container/scroller.js +144 -0
- package/dist/components/container/split-panel.js +150 -0
- package/dist/components/data/AGENTS.md +1 -1
- package/dist/components/data/box-table.d.ts +53 -0
- package/dist/components/data/box-table.d.ts.map +1 -0
- package/dist/components/data/box-table.js +220 -0
- package/dist/components/data/dropdown.d.ts +8 -5
- package/dist/components/data/dropdown.d.ts.map +1 -1
- package/dist/components/data/dropdown.js +219 -0
- package/dist/components/data/metrics-group.js +180 -0
- package/dist/components/data/metrics.d.ts +11 -0
- package/dist/components/data/metrics.d.ts.map +1 -1
- package/dist/components/data/metrics.js +309 -0
- package/dist/components/data/pagination.js +119 -0
- package/dist/components/data/tab-pane.d.ts +58 -12
- package/dist/components/data/tab-pane.d.ts.map +1 -1
- package/dist/components/data/tab-pane.js +130 -0
- package/dist/components/data/table-column.d.ts +29 -5
- package/dist/components/data/table-column.d.ts.map +1 -1
- package/dist/components/data/table-column.js +123 -0
- package/dist/components/data/table.d.ts +134 -54
- package/dist/components/data/table.d.ts.map +1 -1
- package/dist/components/data/table.js +1210 -0
- package/dist/components/data/tabs.d.ts +60 -3
- package/dist/components/data/tabs.d.ts.map +1 -1
- package/dist/components/data/tabs.js +416 -0
- package/dist/components/data/timeline-item.js +127 -0
- package/dist/components/data/timeline.js +204 -0
- package/dist/components/data/tree-menu.d.ts +12 -2
- package/dist/components/data/tree-menu.d.ts.map +1 -1
- package/dist/components/data/tree-menu.js +482 -0
- package/dist/components/data/tree.js +269 -0
- package/dist/components/display/AGENTS.md +5 -2
- package/dist/components/display/animated-image.js +98 -0
- package/dist/components/display/autoview.d.ts +139 -0
- package/dist/components/display/autoview.d.ts.map +1 -0
- package/dist/components/display/autoview.js +460 -0
- package/dist/components/display/brief-box.d.ts +42 -0
- package/dist/components/display/brief-box.d.ts.map +1 -0
- package/dist/components/display/brief-box.js +117 -0
- package/dist/components/display/carousel.js +223 -0
- package/dist/components/display/code-editor.d.ts.map +1 -1
- package/dist/components/display/code-editor.js +976 -0
- package/dist/components/display/comparison.js +132 -0
- package/dist/components/display/desc-item.d.ts +48 -0
- package/dist/components/display/desc-item.d.ts.map +1 -0
- package/dist/components/display/desc-item.js +150 -0
- package/dist/components/display/desc.d.ts +68 -0
- package/dist/components/display/desc.d.ts.map +1 -0
- package/dist/components/display/desc.js +405 -0
- package/dist/components/display/detail-box.d.ts +51 -0
- package/dist/components/display/detail-box.d.ts.map +1 -0
- package/dist/components/display/detail-box.js +157 -0
- package/dist/components/display/label.js +166 -0
- package/dist/components/display/markdown-editor.js +319 -0
- package/dist/components/display/markdown.d.ts.map +1 -1
- package/dist/components/display/markdown.js +193 -0
- package/dist/components/display/mini-box.d.ts +31 -0
- package/dist/components/display/mini-box.d.ts.map +1 -0
- package/dist/components/display/mini-box.js +137 -0
- package/dist/components/display/profile.d.ts +18 -0
- package/dist/components/display/profile.d.ts.map +1 -0
- package/dist/components/display/profile.js +164 -0
- package/dist/components/feedback/AGENTS.md +1 -0
- package/dist/components/feedback/alert.js +150 -0
- package/dist/components/feedback/dialog.js +228 -0
- package/dist/components/feedback/drawer.d.ts.map +1 -1
- package/dist/components/feedback/drawer.js +338 -0
- package/dist/components/feedback/loading.js +130 -0
- package/dist/components/feedback/modal.d.ts.map +1 -1
- package/dist/components/feedback/modal.js +303 -0
- package/dist/components/feedback/notification.js +170 -0
- package/dist/components/feedback/popover.d.ts +1 -1
- package/dist/components/feedback/popover.js +124 -0
- package/dist/components/feedback/toast.js +142 -0
- package/dist/components/feedback/tooltip.d.ts +1 -1
- package/dist/components/feedback/tooltip.js +153 -0
- package/dist/components/form/AGENTS.md +4 -0
- package/dist/components/form/autoform-item.d.ts +6 -0
- package/dist/components/form/autoform-item.d.ts.map +1 -1
- package/dist/components/form/autoform-item.js +791 -0
- package/dist/components/form/autoform.d.ts +15 -5
- package/dist/components/form/autoform.d.ts.map +1 -1
- package/dist/components/form/autoform.js +303 -0
- package/dist/components/form/checkbox-group.js +118 -0
- package/dist/components/form/checkbox.js +123 -0
- package/dist/components/form/color-picker.js +148 -0
- package/dist/components/form/combobox.d.ts +4 -0
- package/dist/components/form/combobox.d.ts.map +1 -1
- package/dist/components/form/combobox.js +325 -0
- package/dist/components/form/date-picker.js +123 -0
- package/dist/components/form/form-item.d.ts.map +1 -1
- package/dist/components/form/form-item.js +141 -0
- package/dist/components/form/form.js +94 -0
- package/dist/components/form/radio-group.js +106 -0
- package/dist/components/form/radio.js +110 -0
- package/dist/components/form/rate.js +116 -0
- package/dist/components/form/select.d.ts +5 -1
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/select.js +539 -0
- package/dist/components/form/slider.js +134 -0
- package/dist/components/form/switch.js +146 -0
- package/dist/components/form/time-picker.js +92 -0
- package/dist/components/form/transfer.js +273 -0
- package/dist/components/form/upload.js +138 -0
- package/dist/components/framework/body.js +333 -0
- package/dist/components/framework/dashboard-panel.js +519 -0
- package/dist/components/framework/dashboard.d.ts.map +1 -1
- package/dist/components/framework/dashboard.js +1084 -0
- package/dist/components/framework/header.js +237 -0
- package/dist/components/framework/log-panel.js +637 -0
- package/dist/components/framework/page.js +151 -0
- package/dist/components/framework/sidebar.d.ts +4 -10
- package/dist/components/framework/sidebar.d.ts.map +1 -1
- package/dist/components/framework/sidebar.js +477 -0
- package/dist/components/layout/affix.js +137 -0
- package/dist/components/layout/col.js +103 -0
- package/dist/components/layout/collapse-item.js +165 -0
- package/dist/components/layout/collapse.js +108 -0
- package/dist/components/layout/container.js +92 -0
- package/dist/components/layout/flex.js +100 -0
- package/dist/components/layout/row.js +103 -0
- package/dist/components/layout/space.js +85 -0
- package/dist/components/navigation/back-top.js +127 -0
- package/dist/components/navigation/breadcrumb-item.js +108 -0
- package/dist/components/navigation/breadcrumb.js +70 -0
- package/dist/components/navigation/menu-item.js +181 -0
- package/dist/components/navigation/menu.js +126 -0
- package/dist/components/navigation/steps.js +183 -0
- package/dist/components/navigation/sub-menu.d.ts.map +1 -1
- package/dist/components/navigation/sub-menu.js +252 -0
- package/dist/components/progress/progress-bar.js +97 -0
- package/dist/components/progress/progress-ring.js +111 -0
- package/dist/components/progress/skeleton.js +108 -0
- package/dist/components/progress/spinner.js +129 -0
- package/dist/components/theme/locale-switch.js +241 -0
- package/dist/components/theme/shadow-picker.js +233 -0
- package/dist/components/theme/shape-picker.js +232 -0
- package/dist/components/theme/theme-picker.js +236 -0
- package/dist/components/theme/theme-preview.d.ts +1 -2
- package/dist/components/theme/theme-preview.d.ts.map +1 -1
- package/dist/components/theme/theme-preview.js +376 -0
- package/dist/components/theme/theme-switch.d.ts.map +1 -1
- package/dist/components/theme/theme-switch.js +318 -0
- package/dist/components/theme/typo-picker.js +219 -0
- package/dist/core/AGENTS.md +6 -1
- package/dist/core/aithe-element.d.ts +2 -2
- package/dist/core/aithe-element.js +135 -0
- package/dist/core/aithe-widget.js +30 -0
- package/dist/core/anchored-overlay.d.ts +3 -0
- package/dist/core/anchored-overlay.d.ts.map +1 -1
- package/dist/core/anchored-overlay.js +111 -0
- package/dist/core/autoform/autoform.js +79 -0
- package/dist/core/autoform/autoview.d.ts +86 -0
- package/dist/core/autoform/autoview.d.ts.map +1 -0
- package/dist/core/autoform/autoview.js +37 -0
- package/dist/core/autoform/condition.js +170 -0
- package/dist/core/autoform/index.d.ts +2 -0
- package/dist/core/autoform/index.d.ts.map +1 -1
- package/dist/core/autoform/index.js +9 -0
- package/dist/core/autoform/types.js +7 -0
- package/dist/core/datahub/__tests__/force-options.test.d.ts +8 -0
- package/dist/core/datahub/__tests__/force-options.test.d.ts.map +1 -0
- package/dist/core/datahub/__tests__/force-options.test.js +161 -0
- package/dist/core/datahub/config/strategy.d.ts +1 -1
- package/dist/core/datahub/config/strategy.d.ts.map +1 -1
- package/dist/core/datahub/config/strategy.js +50 -0
- package/dist/core/datahub/core/adapter/fetch-adapter.d.ts +1 -1
- package/dist/core/datahub/core/adapter/fetch-adapter.d.ts.map +1 -1
- package/dist/core/datahub/core/adapter/fetch-adapter.js +118 -0
- package/dist/core/datahub/core/adapter/index.js +7 -0
- package/dist/core/datahub/core/adapter/mock-adapter.d.ts +1 -1
- package/dist/core/datahub/core/adapter/mock-adapter.d.ts.map +1 -1
- package/dist/core/datahub/core/adapter/mock-adapter.js +58 -0
- package/dist/core/datahub/core/api-styles.d.ts +1 -1
- package/dist/core/datahub/core/api-styles.d.ts.map +1 -1
- package/dist/core/datahub/core/api-styles.js +136 -0
- package/dist/core/datahub/core/datahub-core.d.ts +53 -3
- package/dist/core/datahub/core/datahub-core.d.ts.map +1 -1
- package/dist/core/datahub/core/datahub-core.js +520 -0
- package/dist/core/datahub/core/index.js +7 -0
- package/dist/core/datahub/index.js +50 -0
- package/dist/core/datahub/types.d.ts +24 -0
- package/dist/core/datahub/types.d.ts.map +1 -1
- package/dist/core/datahub/types.js +31 -0
- package/dist/core/datahub/utils/cache.js +55 -0
- package/dist/core/datahub/utils/common.js +23 -0
- package/dist/core/datahub/utils/dedup.d.ts +1 -1
- package/dist/core/datahub/utils/dedup.d.ts.map +1 -1
- package/dist/core/datahub/utils/dedup.js +52 -0
- package/dist/core/datahub/utils/idempotent.js +61 -0
- package/dist/core/datahub/utils/is-query.js +53 -0
- package/dist/core/datahub/utils/loading.js +78 -0
- package/dist/core/filter/__tests__/index.test.d.ts +2 -0
- package/dist/core/filter/__tests__/index.test.d.ts.map +1 -0
- package/dist/core/filter/__tests__/index.test.js +230 -0
- package/dist/core/filter/builtins.d.ts +60 -0
- package/dist/core/filter/builtins.d.ts.map +1 -0
- package/dist/core/filter/builtins.js +172 -0
- package/dist/core/filter/factory.d.ts +54 -0
- package/dist/core/filter/factory.d.ts.map +1 -0
- package/dist/core/filter/factory.js +96 -0
- package/dist/core/filter/index.d.ts +11 -0
- package/dist/core/filter/index.d.ts.map +1 -0
- package/dist/core/filter/index.js +9 -0
- package/dist/core/filter/types.d.ts +12 -0
- package/dist/core/filter/types.d.ts.map +1 -0
- package/dist/core/filter/types.js +1 -0
- package/dist/core/floating.js +132 -0
- package/dist/core/highlight/index.js +43 -0
- package/dist/core/highlight/lang-bash.js +27 -0
- package/dist/core/highlight/lang-c.js +27 -0
- package/dist/core/highlight/lang-cmake.js +27 -0
- package/dist/core/highlight/lang-cpp.js +27 -0
- package/dist/core/highlight/lang-css.js +24 -0
- package/dist/core/highlight/lang-dart.js +27 -0
- package/dist/core/highlight/lang-dockerfile.js +16 -0
- package/dist/core/highlight/lang-fsharp.js +23 -0
- package/dist/core/highlight/lang-go.js +22 -0
- package/dist/core/highlight/lang-html.js +12 -0
- package/dist/core/highlight/lang-java.js +22 -0
- package/dist/core/highlight/lang-javascript.js +26 -0
- package/dist/core/highlight/lang-json.js +13 -0
- package/dist/core/highlight/lang-jsonline.js +13 -0
- package/dist/core/highlight/lang-jsx.js +30 -0
- package/dist/core/highlight/lang-kotlin.js +27 -0
- package/dist/core/highlight/lang-latex.js +22 -0
- package/dist/core/highlight/lang-lua.js +26 -0
- package/dist/core/highlight/lang-makefile.js +22 -0
- package/dist/core/highlight/lang-markdown.js +18 -0
- package/dist/core/highlight/lang-objectivec.js +24 -0
- package/dist/core/highlight/lang-perl.js +30 -0
- package/dist/core/highlight/lang-powershell.js +23 -0
- package/dist/core/highlight/lang-python.js +27 -0
- package/dist/core/highlight/lang-r.js +21 -0
- package/dist/core/highlight/lang-ruby.js +29 -0
- package/dist/core/highlight/lang-rust.js +24 -0
- package/dist/core/highlight/lang-scala.js +26 -0
- package/dist/core/highlight/lang-sql.js +21 -0
- package/dist/core/highlight/lang-svelte.js +27 -0
- package/dist/core/highlight/lang-swift.js +28 -0
- package/dist/core/highlight/lang-tsx.js +35 -0
- package/dist/core/highlight/lang-typescript.js +31 -0
- package/dist/core/highlight/lang-vue.js +29 -0
- package/dist/core/highlight/lang-wasm.js +22 -0
- package/dist/core/highlight/lang-xml.js +12 -0
- package/dist/core/highlight/lang-yaml.js +14 -0
- package/dist/core/highlight/registry.js +99 -0
- package/dist/core/logger/LoggerCore.js +626 -0
- package/dist/core/logger/index.js +10 -0
- package/dist/core/logger/types.js +29 -0
- package/dist/core/markdown/index.js +20 -0
- package/dist/core/markdown/parser.d.ts +2 -0
- package/dist/core/markdown/parser.d.ts.map +1 -1
- package/dist/core/markdown/parser.js +376 -0
- package/dist/core/markdown/plugins.d.ts +2 -1
- package/dist/core/markdown/plugins.d.ts.map +1 -1
- package/dist/core/markdown/plugins.js +755 -0
- package/dist/core/markdown/types.d.ts +5 -0
- package/dist/core/markdown/types.d.ts.map +1 -1
- package/dist/core/markdown/types.js +7 -0
- package/dist/core/router/index.js +244 -0
- package/dist/core/styles.js +44 -0
- package/dist/core/types.d.ts +52 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3695 -1622
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1844 -758
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/aithe-ui.d.ts +23 -0
- package/dist/styles/aithe-ui.d.ts.map +1 -1
- package/dist/styles/aithe-ui.js +185 -0
- package/dist/styles/global.css.d.ts +1 -1
- package/dist/styles/global.css.d.ts.map +1 -1
- package/dist/styles/global.css.js +119 -0
- package/dist/styles/i18n/index.js +206 -0
- package/dist/styles/i18n/locales/de-DE.d.ts.map +1 -1
- package/dist/styles/i18n/locales/de-DE.js +151 -0
- package/dist/styles/i18n/locales/en-US.d.ts.map +1 -1
- package/dist/styles/i18n/locales/en-US.js +160 -0
- package/dist/styles/i18n/locales/es-ES.d.ts.map +1 -1
- package/dist/styles/i18n/locales/es-ES.js +151 -0
- package/dist/styles/i18n/locales/fr-FR.d.ts.map +1 -1
- package/dist/styles/i18n/locales/fr-FR.js +151 -0
- package/dist/styles/i18n/locales/index.js +14 -0
- package/dist/styles/i18n/locales/ja-JP.d.ts.map +1 -1
- package/dist/styles/i18n/locales/ja-JP.js +151 -0
- package/dist/styles/i18n/locales/ko-KR.d.ts.map +1 -1
- package/dist/styles/i18n/locales/ko-KR.js +151 -0
- package/dist/styles/i18n/locales/pt-BR.d.ts.map +1 -1
- package/dist/styles/i18n/locales/pt-BR.js +151 -0
- package/dist/styles/i18n/locales/zh-CN.d.ts.map +1 -1
- package/dist/styles/i18n/locales/zh-CN.js +160 -0
- package/dist/styles/i18n/locales/zh-HK.d.ts.map +1 -1
- package/dist/styles/i18n/locales/zh-HK.js +151 -0
- package/dist/styles/i18n/locales/zh-TW.d.ts.map +1 -1
- package/dist/styles/i18n/locales/zh-TW.js +151 -0
- package/dist/styles/layout/index.js +88 -0
- package/dist/styles/mixins.js +43 -0
- package/dist/styles/shadow/cyber.js +19 -0
- package/dist/styles/shadow/deep.js +19 -0
- package/dist/styles/shadow/diffuse.js +19 -0
- package/dist/styles/shadow/flat.js +19 -0
- package/dist/styles/shadow/glassmorphism.js +19 -0
- package/dist/styles/shadow/index.js +129 -0
- package/dist/styles/shadow/neumorphism.js +21 -0
- package/dist/styles/shadow/retro.js +19 -0
- package/dist/styles/shadow/sharp-business.js +19 -0
- package/dist/styles/shadow/skeuomorphic.js +21 -0
- package/dist/styles/shape/chamfer.js +19 -0
- package/dist/styles/shape/circle.js +19 -0
- package/dist/styles/shape/index.js +174 -0
- package/dist/styles/shape/organic.js +19 -0
- package/dist/styles/shape/pill.js +19 -0
- package/dist/styles/shape/rounded.js +21 -0
- package/dist/styles/shape/rounder.js +19 -0
- package/dist/styles/shape/sharp.js +19 -0
- package/dist/styles/shape/smooth.js +19 -0
- package/dist/styles/theme/aliyun.d.ts +1 -1
- package/dist/styles/theme/aliyun.d.ts.map +1 -1
- package/dist/styles/theme/aliyun.js +102 -0
- package/dist/styles/theme/amber.d.ts +1 -1
- package/dist/styles/theme/amber.d.ts.map +1 -1
- package/dist/styles/theme/amber.js +101 -0
- package/dist/styles/theme/blue.d.ts +1 -1
- package/dist/styles/theme/blue.d.ts.map +1 -1
- package/dist/styles/theme/blue.js +101 -0
- package/dist/styles/theme/charcoal.d.ts +1 -1
- package/dist/styles/theme/charcoal.d.ts.map +1 -1
- package/dist/styles/theme/charcoal.js +106 -0
- package/dist/styles/theme/cyan.d.ts +1 -1
- package/dist/styles/theme/cyan.d.ts.map +1 -1
- package/dist/styles/theme/cyan.js +96 -0
- package/dist/styles/theme/dark.d.ts +1 -1
- package/dist/styles/theme/dark.d.ts.map +1 -1
- package/dist/styles/theme/dark.js +106 -0
- package/dist/styles/theme/ebony.d.ts +1 -1
- package/dist/styles/theme/ebony.d.ts.map +1 -1
- package/dist/styles/theme/ebony.js +106 -0
- package/dist/styles/theme/festive.d.ts +1 -1
- package/dist/styles/theme/festive.d.ts.map +1 -1
- package/dist/styles/theme/festive.js +101 -0
- package/dist/styles/theme/graphite.d.ts +1 -1
- package/dist/styles/theme/graphite.d.ts.map +1 -1
- package/dist/styles/theme/graphite.js +106 -0
- package/dist/styles/theme/gray.d.ts +1 -1
- package/dist/styles/theme/gray.d.ts.map +1 -1
- package/dist/styles/theme/gray.js +101 -0
- package/dist/styles/theme/huawei.d.ts +1 -1
- package/dist/styles/theme/huawei.d.ts.map +1 -1
- package/dist/styles/theme/huawei.js +102 -0
- package/dist/styles/theme/index.d.ts +1 -1
- package/dist/styles/theme/index.d.ts.map +1 -1
- package/dist/styles/theme/index.js +276 -0
- package/dist/styles/theme/indigo.d.ts +1 -1
- package/dist/styles/theme/indigo.d.ts.map +1 -1
- package/dist/styles/theme/indigo.js +101 -0
- package/dist/styles/theme/ink.d.ts +1 -1
- package/dist/styles/theme/ink.d.ts.map +1 -1
- package/dist/styles/theme/ink.js +106 -0
- package/dist/styles/theme/light.d.ts +1 -1
- package/dist/styles/theme/light.d.ts.map +1 -1
- package/dist/styles/theme/light.js +102 -0
- package/dist/styles/theme/midnight.d.ts +1 -1
- package/dist/styles/theme/midnight.d.ts.map +1 -1
- package/dist/styles/theme/midnight.js +106 -0
- package/dist/styles/theme/navy.d.ts +1 -1
- package/dist/styles/theme/navy.d.ts.map +1 -1
- package/dist/styles/theme/navy.js +106 -0
- package/dist/styles/theme/obsidian.d.ts +1 -1
- package/dist/styles/theme/obsidian.d.ts.map +1 -1
- package/dist/styles/theme/obsidian.js +106 -0
- package/dist/styles/theme/onyx.d.ts +1 -1
- package/dist/styles/theme/onyx.d.ts.map +1 -1
- package/dist/styles/theme/onyx.js +106 -0
- package/dist/styles/theme/orange.d.ts +1 -1
- package/dist/styles/theme/orange.d.ts.map +1 -1
- package/dist/styles/theme/orange.js +101 -0
- package/dist/styles/theme/pink.d.ts +1 -1
- package/dist/styles/theme/pink.d.ts.map +1 -1
- package/dist/styles/theme/pink.js +101 -0
- package/dist/styles/theme/purple.d.ts +1 -1
- package/dist/styles/theme/purple.d.ts.map +1 -1
- package/dist/styles/theme/purple.js +101 -0
- package/dist/styles/theme/raisin.d.ts +1 -1
- package/dist/styles/theme/raisin.d.ts.map +1 -1
- package/dist/styles/theme/raisin.js +106 -0
- package/dist/styles/theme/slate.d.ts +1 -1
- package/dist/styles/theme/slate.d.ts.map +1 -1
- package/dist/styles/theme/slate.js +106 -0
- package/dist/styles/theme/teal.d.ts +1 -1
- package/dist/styles/theme/teal.d.ts.map +1 -1
- package/dist/styles/theme/teal.js +101 -0
- package/dist/styles/theme/tianyi.d.ts +1 -1
- package/dist/styles/theme/tianyi.d.ts.map +1 -1
- package/dist/styles/theme/tianyi.js +102 -0
- package/dist/styles/types.js +1 -0
- package/dist/styles/typo/business.js +34 -0
- package/dist/styles/typo/compact.js +34 -0
- package/dist/styles/typo/index.js +99 -0
- package/dist/styles/typo/luxury.js +34 -0
- package/dist/styles/typo/minimal.js +34 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/dom.js +51 -0
- package/dist/utils/events.js +32 -0
- package/dist/utils/icon.js +176 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/utils.d.ts +5 -5
- package/dist/utils/utils.js +89 -0
- package/dist/utils/validation.js +52 -0
- package/docs/api/basic/button.md +9 -6
- package/docs/api/basic/tag.md +24 -17
- package/docs/api/data/box-table.md +73 -0
- package/docs/api/data/dropdown.md +3 -2
- package/docs/api/data/metrics.md +2 -0
- package/docs/api/data/table-column.md +37 -23
- package/docs/api/data/table.md +158 -44
- package/docs/api/data/tabs.md +46 -1
- package/docs/api/data/tree-menu.md +55 -2
- package/docs/api/display/autoview.md +277 -0
- package/docs/api/display/box.md +66 -0
- package/docs/api/display/brief-box.md +73 -0
- package/docs/api/display/desc-item.md +57 -0
- package/docs/api/display/desc.md +246 -0
- package/docs/api/display/detail-box.md +75 -0
- package/docs/api/display/mini-box.md +100 -0
- package/docs/api/display/profile.md +92 -0
- package/docs/api/feedback/popover.md +10 -10
- package/docs/api/feedback/tooltip.md +14 -14
- package/docs/api/form/autoform-item.md +115 -0
- package/docs/api/form/autoform.md +7 -3
- package/docs/api/form/combobox.md +27 -7
- package/docs/api/form/select.md +50 -28
- package/docs/api/framework/log-panel.md +46 -0
- package/docs/api/framework/sidebar.md +3 -2
- package/docs/api/summary.md +46 -35
- package/docs/api/theme/theme-switch.md +1 -1
- package/docs/autoform.md +14 -33
- package/docs/changelog/CHANGELOG.md +155 -0
- package/docs/changelog/VERSION_26.3.1.md +966 -0
- package/docs/changelog/VERSION_26.3.2.md +852 -0
- package/docs/datahub.md +4 -1
- package/docs/filter.md +332 -0
- package/docs/framework-integration.md +2 -2
- package/docs/guide.md +72 -6
- package/docs/i18n.md +2 -4
- package/docs/issue/26.3.1/issue_26.3.1.0.md +84 -0
- package/docs/issue/26.3.1/issue_26.3.1.1.md +72 -0
- package/docs/issue/26.3.1/issue_26.3.1.2.md +75 -0
- package/docs/issue/26.3.1/issue_26.3.1.3.md +78 -0
- package/docs/issue/26.3.1/issue_26.3.1.4.md +113 -0
- package/docs/issue/26.3.1/issue_26.3.1.5.md +142 -0
- package/docs/issue/26.3.1/issue_26.3.1.6.md +100 -0
- package/docs/issue/26.3.1/issue_26.3.1.7.md +78 -0
- package/docs/issue/26.3.2/issue_26.3.2.1.md +46 -0
- package/docs/issue/26.3.2/issue_26.3.2.2.md +82 -0
- package/docs/issue/26.3.2/issue_26.3.2.3.md +57 -0
- package/docs/issue/26.3.2/issue_26.3.2.4.md +43 -0
- package/docs/issue/AGENTS.md +24 -3
- package/docs/markdown.md +2 -2
- package/docs/quickstart.md +5 -5
- package/docs/theming.md +5 -4
- package/package.json +5 -2
- package/dist/components/navigation/dropdown.d.ts +0 -56
- package/dist/components/navigation/dropdown.d.ts.map +0 -1
- /package/docs/issue/{issue_26.2.2.1.md → 26.2.2/issue_26.2.2.1.md} +0 -0
- /package/docs/issue/{issue_26.2.2.2.md → 26.2.2/issue_26.2.2.2.md} +0 -0
- /package/docs/issue/{issue_26.2.2.3.md → 26.2.2/issue_26.2.2.3.md} +0 -0
- /package/docs/issue/{issue_26.2.2.4.md → 26.2.2/issue_26.2.2.4.md} +0 -0
- /package/docs/issue/{issue_26.2.3.1.md → 26.2.3/issue_26.2.3.1.md} +0 -0
- /package/docs/issue/{issue_26.2.3.10.md → 26.2.3/issue_26.2.3.10.md} +0 -0
- /package/docs/issue/{issue_26.2.3.11.md → 26.2.3/issue_26.2.3.11.md} +0 -0
- /package/docs/issue/{issue_26.2.3.12.md → 26.2.3/issue_26.2.3.12.md} +0 -0
- /package/docs/issue/{issue_26.2.3.13.md → 26.2.3/issue_26.2.3.13.md} +0 -0
- /package/docs/issue/{issue_26.2.3.14.md → 26.2.3/issue_26.2.3.14.md} +0 -0
- /package/docs/issue/{issue_26.2.3.15.md → 26.2.3/issue_26.2.3.15.md} +0 -0
- /package/docs/issue/{issue_26.2.3.16.md → 26.2.3/issue_26.2.3.16.md} +0 -0
- /package/docs/issue/{issue_26.2.3.2.md → 26.2.3/issue_26.2.3.2.md} +0 -0
- /package/docs/issue/{issue_26.2.3.3.md → 26.2.3/issue_26.2.3.3.md} +0 -0
- /package/docs/issue/{issue_26.2.3.4.md → 26.2.3/issue_26.2.3.4.md} +0 -0
- /package/docs/issue/{issue_26.2.3.5.md → 26.2.3/issue_26.2.3.5.md} +0 -0
- /package/docs/issue/{issue_26.2.3.6.md → 26.2.3/issue_26.2.3.6.md} +0 -0
- /package/docs/issue/{issue_26.2.3.7.md → 26.2.3/issue_26.2.3.7.md} +0 -0
- /package/docs/issue/{issue_26.2.3.8.md → 26.2.3/issue_26.2.3.8.md} +0 -0
- /package/docs/issue/{issue_26.2.3.9.md → 26.2.3/issue_26.2.3.9.md} +0 -0
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
/** 安全取值:将 undefined 转为空字符串 */
|
|
2
|
+
function s(value) {
|
|
3
|
+
return value ?? '';
|
|
4
|
+
}
|
|
5
|
+
/** HTML 转义 */
|
|
6
|
+
function esc(value) {
|
|
7
|
+
return value
|
|
8
|
+
.replaceAll('&', '&')
|
|
9
|
+
.replaceAll('<', '<')
|
|
10
|
+
.replaceAll('>', '>')
|
|
11
|
+
.replaceAll('"', '"');
|
|
12
|
+
}
|
|
13
|
+
/** 代码块语言别名映射 */
|
|
14
|
+
const LANG_ALIAS = {
|
|
15
|
+
ts: 'typescript',
|
|
16
|
+
js: 'javascript',
|
|
17
|
+
py: 'python',
|
|
18
|
+
rb: 'ruby',
|
|
19
|
+
sh: 'bash',
|
|
20
|
+
yml: 'yaml',
|
|
21
|
+
md: 'markdown',
|
|
22
|
+
html: 'html',
|
|
23
|
+
css: 'css',
|
|
24
|
+
json: 'json',
|
|
25
|
+
xml: 'xml',
|
|
26
|
+
sql: 'sql',
|
|
27
|
+
rs: 'rust',
|
|
28
|
+
go: 'go',
|
|
29
|
+
java: 'java',
|
|
30
|
+
kt: 'kotlin',
|
|
31
|
+
swift: 'swift',
|
|
32
|
+
mjs: 'javascript',
|
|
33
|
+
cjs: 'javascript',
|
|
34
|
+
jsx: 'jsx',
|
|
35
|
+
tsx: 'tsx',
|
|
36
|
+
vue: 'vue',
|
|
37
|
+
svelte: 'svelte',
|
|
38
|
+
wasm: 'wasm',
|
|
39
|
+
dockerfile: 'dockerfile',
|
|
40
|
+
makefile: 'makefile',
|
|
41
|
+
gradle: 'gradle',
|
|
42
|
+
cmake: 'cmake',
|
|
43
|
+
tex: 'latex',
|
|
44
|
+
fs: 'fsharp',
|
|
45
|
+
ps: 'powershell',
|
|
46
|
+
pl: 'perl',
|
|
47
|
+
lua: 'lua',
|
|
48
|
+
scala: 'scala',
|
|
49
|
+
dart: 'dart',
|
|
50
|
+
r: 'r',
|
|
51
|
+
m: 'objectivec',
|
|
52
|
+
mm: 'objectivec',
|
|
53
|
+
h: 'c',
|
|
54
|
+
hpp: 'cpp',
|
|
55
|
+
};
|
|
56
|
+
// ── Leaf blocks / 叶子块 ──
|
|
57
|
+
/**
|
|
58
|
+
* ATX 标题
|
|
59
|
+
*
|
|
60
|
+
* 匹配 `# ` `## ` `### ` … `###### ` 六级标题。
|
|
61
|
+
* 标题层级由 `#` 的数量决定。
|
|
62
|
+
*/
|
|
63
|
+
export const headingPlugin = {
|
|
64
|
+
name: 'heading',
|
|
65
|
+
block: (lines) => {
|
|
66
|
+
const line = lines[0];
|
|
67
|
+
if (!line)
|
|
68
|
+
return null;
|
|
69
|
+
const match = /^(#{1,6}) (.+)$/.exec(line);
|
|
70
|
+
if (!match)
|
|
71
|
+
return null;
|
|
72
|
+
const level = match[1].length;
|
|
73
|
+
const text = match[2];
|
|
74
|
+
return {
|
|
75
|
+
nodes: [{ type: 'heading', level, children: [{ type: 'text', value: text }] }],
|
|
76
|
+
consumed: 1,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Setext 标题
|
|
82
|
+
*
|
|
83
|
+
* 匹配下方带 `===`(一级)或 `---`(二级)的标题行。
|
|
84
|
+
*/
|
|
85
|
+
export const setextHeadingPlugin = {
|
|
86
|
+
name: 'setext-heading',
|
|
87
|
+
block: (lines) => {
|
|
88
|
+
if (lines.length < 2)
|
|
89
|
+
return null;
|
|
90
|
+
const text = lines[0];
|
|
91
|
+
const underline = lines[1];
|
|
92
|
+
if (!text || !underline)
|
|
93
|
+
return null;
|
|
94
|
+
const um = /^(=+|-+)\s*$/.exec(underline);
|
|
95
|
+
if (!um)
|
|
96
|
+
return null;
|
|
97
|
+
const level = um[1].startsWith('=') ? 1 : 2;
|
|
98
|
+
return {
|
|
99
|
+
nodes: [{ type: 'heading', level, children: [{ type: 'text', value: text }] }],
|
|
100
|
+
consumed: 2,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* 分隔线
|
|
106
|
+
*
|
|
107
|
+
* 匹配三个或以上的 `-` `*` `_`(可含空格)。
|
|
108
|
+
*/
|
|
109
|
+
export const thematicBreakPlugin = {
|
|
110
|
+
name: 'thematic-break',
|
|
111
|
+
block: (lines) => {
|
|
112
|
+
const line = lines[0];
|
|
113
|
+
if (!line)
|
|
114
|
+
return null;
|
|
115
|
+
if (!/^[ \t]{0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/.test(line))
|
|
116
|
+
return null;
|
|
117
|
+
return { nodes: [{ type: 'thematic-break' }], consumed: 1 };
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 围栏代码块
|
|
122
|
+
*
|
|
123
|
+
* 匹配由 ``` 或 ~~~ 包裹的代码块,支持语言标识。
|
|
124
|
+
*/
|
|
125
|
+
export const codeFencePlugin = {
|
|
126
|
+
name: 'code-fence',
|
|
127
|
+
block: (lines) => {
|
|
128
|
+
const first = lines[0];
|
|
129
|
+
if (!first)
|
|
130
|
+
return null;
|
|
131
|
+
const fenceMatch = /^[ \t]{0,3}(`{3,}|~{3,})([^\n]{0,200})$/.exec(first);
|
|
132
|
+
if (!fenceMatch)
|
|
133
|
+
return null;
|
|
134
|
+
const fence = fenceMatch[1];
|
|
135
|
+
const infoLine = fenceMatch[2];
|
|
136
|
+
const rawLang = infoLine.trim().split(/\s+/)[0] || '';
|
|
137
|
+
const lang = LANG_ALIAS[rawLang] || rawLang;
|
|
138
|
+
const codeLines = [];
|
|
139
|
+
let i = 1;
|
|
140
|
+
let closed = false;
|
|
141
|
+
while (i < lines.length) {
|
|
142
|
+
const line = lines[i];
|
|
143
|
+
if (line !== undefined && new RegExp(String.raw `^[ \t]{0,3}${fence}[ \t]*(?:\n|$)`).exec(line)) {
|
|
144
|
+
closed = true;
|
|
145
|
+
i++;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
codeLines.push(line ?? '');
|
|
149
|
+
i++;
|
|
150
|
+
}
|
|
151
|
+
if (!closed) {
|
|
152
|
+
// 未闭合:取到末尾
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
nodes: [{ type: 'code-block', lang, value: codeLines.join('\n') }],
|
|
156
|
+
consumed: i,
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* 表格(GFM 扩展)
|
|
162
|
+
*
|
|
163
|
+
* 匹配 GFM 风格的管道表格。
|
|
164
|
+
*/
|
|
165
|
+
export const tablePlugin = {
|
|
166
|
+
name: 'table',
|
|
167
|
+
block: (lines) => {
|
|
168
|
+
if (lines.length < 2)
|
|
169
|
+
return null;
|
|
170
|
+
const firstLine = lines[0];
|
|
171
|
+
if (!firstLine?.includes('|'))
|
|
172
|
+
return null;
|
|
173
|
+
const secondLine = lines[1];
|
|
174
|
+
if (!secondLine?.includes('|'))
|
|
175
|
+
return null;
|
|
176
|
+
// 收集所有连续表格行
|
|
177
|
+
const tableLines = [];
|
|
178
|
+
for (const line of lines) {
|
|
179
|
+
if (line?.includes('|')) {
|
|
180
|
+
tableLines.push(line);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (tableLines.length < 2)
|
|
187
|
+
return null;
|
|
188
|
+
const headerCells = parseTableRow(tableLines[0] ?? '');
|
|
189
|
+
if (!headerCells.length)
|
|
190
|
+
return null;
|
|
191
|
+
const alignRow = parseTableRow(tableLines[1] ?? '');
|
|
192
|
+
const aligns = alignRow.map((cell) => {
|
|
193
|
+
const trimmed = cell.trim();
|
|
194
|
+
if (trimmed.startsWith(':') && trimmed.endsWith(':'))
|
|
195
|
+
return 'center';
|
|
196
|
+
if (trimmed.endsWith(':'))
|
|
197
|
+
return 'right';
|
|
198
|
+
if (trimmed.startsWith(':'))
|
|
199
|
+
return 'left';
|
|
200
|
+
return '';
|
|
201
|
+
});
|
|
202
|
+
const header = {
|
|
203
|
+
type: 'table-row',
|
|
204
|
+
children: headerCells.map((cell) => ({
|
|
205
|
+
type: 'table-cell',
|
|
206
|
+
children: [{ type: 'text', value: cell.trim() }],
|
|
207
|
+
})),
|
|
208
|
+
};
|
|
209
|
+
const body = tableLines.slice(2).map((row) => ({
|
|
210
|
+
type: 'table-row',
|
|
211
|
+
children: parseTableRow(row).map((cell) => ({
|
|
212
|
+
type: 'table-cell',
|
|
213
|
+
children: [{ type: 'text', value: cell.trim() }],
|
|
214
|
+
})),
|
|
215
|
+
}));
|
|
216
|
+
return {
|
|
217
|
+
nodes: [{ type: 'table', header, align: aligns, body }],
|
|
218
|
+
consumed: tableLines.length,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
/** 解析表格行:去除首尾 `|` 后按 `|` 分割 */
|
|
223
|
+
function parseTableRow(line) {
|
|
224
|
+
const trimmed = line.trim();
|
|
225
|
+
const inner = trimmed.startsWith('|') ? trimmed.slice(1) : trimmed;
|
|
226
|
+
const end = inner.endsWith('|') ? inner.slice(0, -1) : inner;
|
|
227
|
+
return end.split('|').map((c) => c.trim());
|
|
228
|
+
}
|
|
229
|
+
// ── Container blocks / 容器块 ──
|
|
230
|
+
/**
|
|
231
|
+
* 引用块
|
|
232
|
+
*
|
|
233
|
+
* 匹配 `> ` 开头的行。
|
|
234
|
+
*/
|
|
235
|
+
export const blockquotePlugin = {
|
|
236
|
+
name: 'blockquote',
|
|
237
|
+
block: (lines) => {
|
|
238
|
+
const quoteLines = [];
|
|
239
|
+
let i = 0;
|
|
240
|
+
while (i < lines.length) {
|
|
241
|
+
const line = lines[i];
|
|
242
|
+
const match = line ? /^> ?(.*)$/.exec(line) : null;
|
|
243
|
+
if (match) {
|
|
244
|
+
quoteLines.push(match[1]);
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (quoteLines.length === 0)
|
|
252
|
+
return null;
|
|
253
|
+
// 引用块内的内容暂存为文本段落,由外层 parser 进一步解析
|
|
254
|
+
return {
|
|
255
|
+
nodes: [
|
|
256
|
+
{
|
|
257
|
+
type: 'blockquote',
|
|
258
|
+
children: [
|
|
259
|
+
{ type: 'paragraph', children: [{ type: 'text', value: quoteLines.join('\n') }] },
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
consumed: i,
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Parse a list item line with optional indentation.
|
|
269
|
+
* 解析带可选缩进的列表项行。
|
|
270
|
+
*
|
|
271
|
+
* @param line - The line to parse.
|
|
272
|
+
* @param minIndent - Minimum indentation required (0 for top-level, >0 for sub-items).
|
|
273
|
+
* @returns Parsed result with marker, text, checked, and indent, or null if no match.
|
|
274
|
+
*/
|
|
275
|
+
function parseListItemIndented(line, minIndent = 0) {
|
|
276
|
+
// Match optional leading spaces, then list marker
|
|
277
|
+
const unorderedMatch = /^( *)([-*+]) (.+)$/.exec(line);
|
|
278
|
+
if (unorderedMatch) {
|
|
279
|
+
const indent = unorderedMatch[1].length;
|
|
280
|
+
if (indent < minIndent)
|
|
281
|
+
return null;
|
|
282
|
+
return { marker: unorderedMatch[2], text: unorderedMatch[3], checked: null, indent };
|
|
283
|
+
}
|
|
284
|
+
const orderedMatch = /^( *)(\d+)\. (.+)$/.exec(line);
|
|
285
|
+
if (orderedMatch) {
|
|
286
|
+
const indent = orderedMatch[1].length;
|
|
287
|
+
if (indent < minIndent)
|
|
288
|
+
return null;
|
|
289
|
+
return { marker: orderedMatch[2], text: orderedMatch[3], checked: null, indent };
|
|
290
|
+
}
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Check if a line is a blank line (empty or whitespace only).
|
|
295
|
+
* 判断是否为空行(空字符串或仅含空白)。
|
|
296
|
+
*/
|
|
297
|
+
function isBlankLine(line) {
|
|
298
|
+
return !line || line.trim() === '';
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* After a blank line, find the next non-blank line and decide whether it is
|
|
302
|
+
* still an indented continuation of the current list item.
|
|
303
|
+
* 在空行之后,定位下一个非空行并判断它是否仍属于当前列表项的缩进续行。
|
|
304
|
+
*
|
|
305
|
+
* @returns `true` if the blank line should be included as part of the item,
|
|
306
|
+
* `false` if the list item should end.
|
|
307
|
+
*/
|
|
308
|
+
function blankLineBelongsToItem(lines, from, baseIndent) {
|
|
309
|
+
let j = from;
|
|
310
|
+
while (j < lines.length && isBlankLine(lines[j]))
|
|
311
|
+
j++;
|
|
312
|
+
if (j >= lines.length)
|
|
313
|
+
return false;
|
|
314
|
+
const afterBlank = lines[j];
|
|
315
|
+
if (afterBlank === undefined)
|
|
316
|
+
return false;
|
|
317
|
+
const afterParsed = parseListItemIndented(afterBlank, 0);
|
|
318
|
+
return Boolean(afterParsed && afterParsed.indent > baseIndent);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Decide whether a non-blank line ends the current list item.
|
|
322
|
+
* 判断一个非空行是否结束当前列表项的续行收集。
|
|
323
|
+
*
|
|
324
|
+
* @returns `true` if the line is a sibling item or a less-indented line (stop),
|
|
325
|
+
* `false` if it is an indented continuation / sub-list line (keep).
|
|
326
|
+
*/
|
|
327
|
+
function lineEndsItem(line, baseIndent) {
|
|
328
|
+
const nextParsed = parseListItemIndented(line, baseIndent);
|
|
329
|
+
if (nextParsed && nextParsed.indent === baseIndent)
|
|
330
|
+
return true;
|
|
331
|
+
const indentPrefix = ' '.repeat(baseIndent + 1);
|
|
332
|
+
return !line.startsWith(indentPrefix) && line.trim() !== '';
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Collect indented continuation / sub-list lines following a list item.
|
|
336
|
+
* 收集列表项之后的缩进续行或子列表行。
|
|
337
|
+
*
|
|
338
|
+
* @param lines - All lines of the block.
|
|
339
|
+
* @param start - Index right after the current item's marker line.
|
|
340
|
+
* @param baseIndent - Indent level of the parent list.
|
|
341
|
+
* @returns The collected sub-lines and the next index to resume from.
|
|
342
|
+
*/
|
|
343
|
+
function collectItemSubLines(lines, start, baseIndent) {
|
|
344
|
+
const subLines = [];
|
|
345
|
+
let i = start;
|
|
346
|
+
while (i < lines.length) {
|
|
347
|
+
const nextLine = lines[i];
|
|
348
|
+
if (isBlankLine(nextLine)) {
|
|
349
|
+
if (blankLineBelongsToItem(lines, i + 1, baseIndent)) {
|
|
350
|
+
subLines.push('');
|
|
351
|
+
i++;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
if (nextLine !== undefined && lineEndsItem(nextLine, baseIndent))
|
|
357
|
+
break;
|
|
358
|
+
if (nextLine !== undefined) {
|
|
359
|
+
subLines.push(nextLine);
|
|
360
|
+
}
|
|
361
|
+
i++;
|
|
362
|
+
}
|
|
363
|
+
return { subLines, nextI: i };
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Build children AST nodes for a single list item.
|
|
367
|
+
* 为单个列表项构建子节点。
|
|
368
|
+
*
|
|
369
|
+
* @param itemText - Text on the marker line.
|
|
370
|
+
* @param subLines - Collected indented continuation / sub-list lines.
|
|
371
|
+
* @param baseIndent - Indent level of the parent list.
|
|
372
|
+
*/
|
|
373
|
+
function buildListItemChildren(itemText, subLines, baseIndent) {
|
|
374
|
+
const children = [
|
|
375
|
+
{ type: 'paragraph', children: [{ type: 'raw-inline', value: itemText }] },
|
|
376
|
+
];
|
|
377
|
+
if (subLines.length > 0) {
|
|
378
|
+
children.push(...parseSubLines(subLines, baseIndent));
|
|
379
|
+
}
|
|
380
|
+
return children;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* 无序 / 有序列表
|
|
384
|
+
*
|
|
385
|
+
* 匹配 `- ` `* ` `+ ` 开头的无序列表,以及 `1. ` 等有序列表。
|
|
386
|
+
* 支持列表项的缩进续行和嵌套子列表。
|
|
387
|
+
*/
|
|
388
|
+
export const listPlugin = {
|
|
389
|
+
name: 'list',
|
|
390
|
+
block: (lines) => {
|
|
391
|
+
if (lines.length === 0)
|
|
392
|
+
return null;
|
|
393
|
+
const firstLine = lines[0];
|
|
394
|
+
if (firstLine === undefined)
|
|
395
|
+
return null;
|
|
396
|
+
const firstParsed = parseListItemIndented(firstLine, 0);
|
|
397
|
+
if (!firstParsed)
|
|
398
|
+
return null;
|
|
399
|
+
const ordered = /^\d/.test(firstParsed.marker);
|
|
400
|
+
const start = ordered ? Number.parseInt(firstParsed.marker, 10) : 1;
|
|
401
|
+
const baseIndent = firstParsed.indent;
|
|
402
|
+
const items = [];
|
|
403
|
+
let i = 0;
|
|
404
|
+
while (i < lines.length) {
|
|
405
|
+
const line = lines[i];
|
|
406
|
+
if (isBlankLine(line))
|
|
407
|
+
break;
|
|
408
|
+
if (line === undefined)
|
|
409
|
+
break;
|
|
410
|
+
const parsed = parseListItemIndented(line, baseIndent);
|
|
411
|
+
if (!(parsed && parsed.indent === baseIndent))
|
|
412
|
+
break;
|
|
413
|
+
// Marker type must match (ordered vs unordered)
|
|
414
|
+
const isOrdered = /^\d/.test(parsed.marker);
|
|
415
|
+
if (isOrdered !== ordered)
|
|
416
|
+
break;
|
|
417
|
+
const itemText = parsed.text;
|
|
418
|
+
i++;
|
|
419
|
+
const { subLines, nextI } = collectItemSubLines(lines, i, baseIndent);
|
|
420
|
+
i = nextI;
|
|
421
|
+
items.push({
|
|
422
|
+
text: itemText,
|
|
423
|
+
children: buildListItemChildren(itemText, subLines, baseIndent),
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (items.length === 0)
|
|
427
|
+
return null;
|
|
428
|
+
return {
|
|
429
|
+
nodes: [
|
|
430
|
+
{
|
|
431
|
+
type: 'list',
|
|
432
|
+
ordered,
|
|
433
|
+
start,
|
|
434
|
+
children: items.map((item) => ({
|
|
435
|
+
type: 'list-item',
|
|
436
|
+
checked: null,
|
|
437
|
+
children: item.children,
|
|
438
|
+
})),
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
consumed: i,
|
|
442
|
+
};
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Parse indented sub-lines under a list item.
|
|
447
|
+
* 解析列表项下的缩进子行,生成嵌套列表或续行段落。
|
|
448
|
+
*/
|
|
449
|
+
function parseSubLines(subLines, parentIndent) {
|
|
450
|
+
const nodes = [];
|
|
451
|
+
const firstSub = subLines[0];
|
|
452
|
+
if (firstSub === undefined)
|
|
453
|
+
return nodes;
|
|
454
|
+
const firstParsed = parseListItemIndented(firstSub, 0);
|
|
455
|
+
if (firstParsed && firstParsed.indent > parentIndent) {
|
|
456
|
+
// Nested list — parse recursively
|
|
457
|
+
const subListResult = listPlugin.block(subLines);
|
|
458
|
+
if (subListResult) {
|
|
459
|
+
nodes.push(...subListResult.nodes);
|
|
460
|
+
// Recursively handle any remaining lines after the sub-list
|
|
461
|
+
const remaining = subLines.slice(subListResult.consumed);
|
|
462
|
+
if (remaining.length > 0) {
|
|
463
|
+
nodes.push(...parseSubLines(remaining, parentIndent));
|
|
464
|
+
}
|
|
465
|
+
return nodes;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
// Not a nested list — treat as continuation text (lazy continuation)
|
|
469
|
+
const text = subLines.join('\n').trim();
|
|
470
|
+
if (text) {
|
|
471
|
+
nodes.push({ type: 'paragraph', children: [{ type: 'raw-inline', value: text }] });
|
|
472
|
+
}
|
|
473
|
+
return nodes;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* 任务列表(GFM 扩展)
|
|
477
|
+
*
|
|
478
|
+
* 匹配 `- [ ]`(未完成)和 `- [x]`(已完成)格式。
|
|
479
|
+
*/
|
|
480
|
+
export const taskListPlugin = {
|
|
481
|
+
name: 'task-list',
|
|
482
|
+
block: (lines) => {
|
|
483
|
+
const items = [];
|
|
484
|
+
let i = 0;
|
|
485
|
+
while (i < lines.length) {
|
|
486
|
+
const line = lines[i];
|
|
487
|
+
if (!line)
|
|
488
|
+
break;
|
|
489
|
+
const match = /^[-*+] \[([ xX])] (.+)$/.exec(line);
|
|
490
|
+
if (!match)
|
|
491
|
+
break;
|
|
492
|
+
items.push({ checked: match[1] !== ' ', text: match[2] });
|
|
493
|
+
i++;
|
|
494
|
+
}
|
|
495
|
+
if (items.length === 0)
|
|
496
|
+
return null;
|
|
497
|
+
return {
|
|
498
|
+
nodes: [
|
|
499
|
+
{
|
|
500
|
+
type: 'list',
|
|
501
|
+
ordered: false,
|
|
502
|
+
start: 1,
|
|
503
|
+
children: items.map((item) => ({
|
|
504
|
+
type: 'list-item',
|
|
505
|
+
checked: item.checked,
|
|
506
|
+
children: [{ type: 'paragraph', children: [{ type: 'raw-inline', value: item.text }] }],
|
|
507
|
+
})),
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
consumed: i,
|
|
511
|
+
};
|
|
512
|
+
},
|
|
513
|
+
};
|
|
514
|
+
// ── Inlines / 行内 ──
|
|
515
|
+
/**
|
|
516
|
+
* 加粗
|
|
517
|
+
*
|
|
518
|
+
* 匹配 `**text**` 语法,支持内部嵌套行内元素(如链接)。
|
|
519
|
+
*/
|
|
520
|
+
export const boldPlugin = {
|
|
521
|
+
name: 'bold',
|
|
522
|
+
inline: (text) => {
|
|
523
|
+
const match = /^\*\*(.+?)\*\*/.exec(text);
|
|
524
|
+
if (!match)
|
|
525
|
+
return null;
|
|
526
|
+
// 检查内部是否包含链接语法 [text](url)
|
|
527
|
+
const inner = match[1];
|
|
528
|
+
const linkMatch = /^\[([^[\]]+?)]\(([^()]+?)\)$/.exec(inner);
|
|
529
|
+
if (linkMatch) {
|
|
530
|
+
return {
|
|
531
|
+
nodes: [
|
|
532
|
+
{
|
|
533
|
+
type: 'bold',
|
|
534
|
+
children: [
|
|
535
|
+
{
|
|
536
|
+
type: 'link',
|
|
537
|
+
url: linkMatch[2],
|
|
538
|
+
text: linkMatch[1],
|
|
539
|
+
children: [{ type: 'text', value: linkMatch[1] }],
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
},
|
|
543
|
+
],
|
|
544
|
+
consumed: match[0].length,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
nodes: [{ type: 'bold', children: [{ type: 'text', value: inner }] }],
|
|
549
|
+
consumed: match[0].length,
|
|
550
|
+
};
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* 斜体
|
|
555
|
+
*
|
|
556
|
+
* 匹配 `*text*` 或 `_text_` 语法。
|
|
557
|
+
*/
|
|
558
|
+
export const italicPlugin = {
|
|
559
|
+
name: 'italic',
|
|
560
|
+
inline: (text) => {
|
|
561
|
+
const match = /^([*_])(.+?)\1/.exec(text);
|
|
562
|
+
if (!match)
|
|
563
|
+
return null;
|
|
564
|
+
return {
|
|
565
|
+
nodes: [{ type: 'italic', children: [{ type: 'text', value: match[2] }] }],
|
|
566
|
+
consumed: match[0].length,
|
|
567
|
+
};
|
|
568
|
+
},
|
|
569
|
+
};
|
|
570
|
+
/**
|
|
571
|
+
* 行内代码
|
|
572
|
+
*
|
|
573
|
+
* 匹配 `` `code` `` 语法。
|
|
574
|
+
*/
|
|
575
|
+
export const codePlugin = {
|
|
576
|
+
name: 'code',
|
|
577
|
+
inline: (text) => {
|
|
578
|
+
const match = /^`(.+?)`/.exec(text);
|
|
579
|
+
if (!match)
|
|
580
|
+
return null;
|
|
581
|
+
return {
|
|
582
|
+
nodes: [{ type: 'inline-code', value: match[1] }],
|
|
583
|
+
consumed: match[0].length,
|
|
584
|
+
};
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* 删除线(GFM 扩展)
|
|
589
|
+
*
|
|
590
|
+
* 匹配 `~~text~~` 语法。
|
|
591
|
+
*/
|
|
592
|
+
export const delPlugin = {
|
|
593
|
+
name: 'delete',
|
|
594
|
+
inline: (text) => {
|
|
595
|
+
const match = /^~~(.+?)~~/.exec(text);
|
|
596
|
+
if (!match)
|
|
597
|
+
return null;
|
|
598
|
+
return {
|
|
599
|
+
nodes: [{ type: 'strikethrough', children: [{ type: 'text', value: match[1] }] }],
|
|
600
|
+
consumed: match[0].length,
|
|
601
|
+
};
|
|
602
|
+
},
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* 链接
|
|
606
|
+
*
|
|
607
|
+
* 匹配 `[text](url)` 语法。
|
|
608
|
+
*/
|
|
609
|
+
export function createLinkPlugin() {
|
|
610
|
+
return {
|
|
611
|
+
name: 'link',
|
|
612
|
+
inline: (text) => {
|
|
613
|
+
const match = /^\[([^[\]]+?)]\(([^()]+?)\)/.exec(text);
|
|
614
|
+
if (!match)
|
|
615
|
+
return null;
|
|
616
|
+
const url = match[2];
|
|
617
|
+
const textContent = match[1];
|
|
618
|
+
return {
|
|
619
|
+
nodes: [
|
|
620
|
+
{
|
|
621
|
+
type: 'link',
|
|
622
|
+
url,
|
|
623
|
+
text: textContent,
|
|
624
|
+
children: [{ type: 'text', value: textContent }],
|
|
625
|
+
},
|
|
626
|
+
],
|
|
627
|
+
consumed: match[0].length,
|
|
628
|
+
};
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
/** 向后兼容的 linkPlugin 实例 */
|
|
633
|
+
export const linkPlugin = createLinkPlugin();
|
|
634
|
+
/**
|
|
635
|
+
* 图片
|
|
636
|
+
*
|
|
637
|
+
* 匹配 `` 语法。
|
|
638
|
+
*/
|
|
639
|
+
export const imagePlugin = {
|
|
640
|
+
name: 'image',
|
|
641
|
+
inline: (text) => {
|
|
642
|
+
const match = /^!\[([^[\]]*?)]\(([^()]+?)\)/.exec(text);
|
|
643
|
+
if (!match)
|
|
644
|
+
return null;
|
|
645
|
+
return {
|
|
646
|
+
nodes: [{ type: 'image', url: match[2], alt: match[1] }],
|
|
647
|
+
consumed: match[0].length,
|
|
648
|
+
};
|
|
649
|
+
},
|
|
650
|
+
};
|
|
651
|
+
// ── Aithe UI extensions / 扩展 ──
|
|
652
|
+
/**
|
|
653
|
+
* 图标(Aithe UI 扩展)
|
|
654
|
+
*
|
|
655
|
+
* 匹配 `:iconName:` 语法(驼峰或字母开头)。
|
|
656
|
+
*/
|
|
657
|
+
export const iconPlugin = {
|
|
658
|
+
name: 'icon',
|
|
659
|
+
inline: (text) => {
|
|
660
|
+
const match = /^:([a-zA-Z]\w*):/.exec(text);
|
|
661
|
+
if (!match)
|
|
662
|
+
return null;
|
|
663
|
+
return {
|
|
664
|
+
nodes: [{ type: 'icon', name: match[1] }],
|
|
665
|
+
consumed: match[0].length,
|
|
666
|
+
};
|
|
667
|
+
},
|
|
668
|
+
};
|
|
669
|
+
// ── Emoji 映射表 ──
|
|
670
|
+
const EMOJI_MAP = {
|
|
671
|
+
smile: '😄',
|
|
672
|
+
grin: '😁',
|
|
673
|
+
joy: '😂',
|
|
674
|
+
wink: '😉',
|
|
675
|
+
blush: '😊',
|
|
676
|
+
heart_eyes: '😍',
|
|
677
|
+
kissing_heart: '😘',
|
|
678
|
+
sob: '😭',
|
|
679
|
+
angry: '😡',
|
|
680
|
+
scream: '😱',
|
|
681
|
+
cry: '😢',
|
|
682
|
+
sleepy: '😴',
|
|
683
|
+
mask: '😷',
|
|
684
|
+
sunglasses: '😎',
|
|
685
|
+
confused: '😕',
|
|
686
|
+
neutral: '😐',
|
|
687
|
+
expressionless: '😑',
|
|
688
|
+
smirk: '😏',
|
|
689
|
+
thumbsup: '👍',
|
|
690
|
+
thumbsdown: '👎',
|
|
691
|
+
ok_hand: '👌',
|
|
692
|
+
wave: '👋',
|
|
693
|
+
clap: '👏',
|
|
694
|
+
raised_hands: '🙌',
|
|
695
|
+
pray: '🙏',
|
|
696
|
+
muscle: '💪',
|
|
697
|
+
fire: '🔥',
|
|
698
|
+
rocket: '🚀',
|
|
699
|
+
star: '⭐',
|
|
700
|
+
sparkles: '✨',
|
|
701
|
+
check: '✅',
|
|
702
|
+
x: '❌',
|
|
703
|
+
warning: '⚠️',
|
|
704
|
+
info: 'ℹ️',
|
|
705
|
+
question: '❓',
|
|
706
|
+
exclamation: '❗',
|
|
707
|
+
mail: '📧',
|
|
708
|
+
phone: '📞',
|
|
709
|
+
home: '🏠',
|
|
710
|
+
lock: '🔒',
|
|
711
|
+
unlock: '🔓',
|
|
712
|
+
key: '🔑',
|
|
713
|
+
bulb: '💡',
|
|
714
|
+
gear: '⚙️',
|
|
715
|
+
chart: '📊',
|
|
716
|
+
calendar: '📅',
|
|
717
|
+
clock: '🕐',
|
|
718
|
+
book: '📖',
|
|
719
|
+
pencil: '✏️',
|
|
720
|
+
scissors: '✂️',
|
|
721
|
+
link: '🔗',
|
|
722
|
+
tag: '🏷️',
|
|
723
|
+
folder: '📁',
|
|
724
|
+
file: '📄',
|
|
725
|
+
search: '🔍',
|
|
726
|
+
cart: '🛒',
|
|
727
|
+
gift: '🎁',
|
|
728
|
+
trophy: '🏆',
|
|
729
|
+
medal: '🥇',
|
|
730
|
+
bug: '🐛',
|
|
731
|
+
note: '📝',
|
|
732
|
+
flag: '🚩',
|
|
733
|
+
heart: '❤️',
|
|
734
|
+
plus: '➕',
|
|
735
|
+
minus: '➖',
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* Emoji 短代码(Aithe UI 扩展)
|
|
739
|
+
*
|
|
740
|
+
* 匹配 `:emoji_name:` 语法(小写字母 + 下划线),将短代码映射为 Unicode Emoji。
|
|
741
|
+
*/
|
|
742
|
+
export const emojiPlugin = {
|
|
743
|
+
name: 'emoji',
|
|
744
|
+
inline: (text) => {
|
|
745
|
+
const match = /^:([a-z_][a-z0-9_]*):/.exec(text);
|
|
746
|
+
if (!match)
|
|
747
|
+
return null;
|
|
748
|
+
const name = match[1];
|
|
749
|
+
const unicode = EMOJI_MAP[name];
|
|
750
|
+
if (unicode) {
|
|
751
|
+
return { nodes: [{ type: 'emoji', name, unicode }], consumed: match[0].length };
|
|
752
|
+
}
|
|
753
|
+
return { nodes: [{ type: 'text', value: match[0] }], consumed: match[0].length };
|
|
754
|
+
},
|
|
755
|
+
};
|