@fluxdown/vue-lynx-plugins 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/esm/base/components/animated-text/animation.d.ts +6 -0
- package/dist/esm/base/components/animated-text/animation.js +67 -0
- package/dist/esm/base/components/animated-text/index.d.ts +16 -0
- package/dist/esm/base/components/animated-text/index.js +86 -0
- package/dist/esm/base/components/index.d.ts +1 -0
- package/dist/esm/base/components/index.js +3 -0
- package/dist/esm/base/consts/defaults.d.ts +1 -0
- package/dist/esm/base/consts/defaults.js +3 -0
- package/dist/esm/base/consts/index.d.ts +1 -0
- package/dist/esm/base/consts/index.js +3 -0
- package/dist/esm/base/context/index.d.ts +2 -0
- package/dist/esm/base/context/index.js +5 -0
- package/dist/esm/base/context/text-animation/index.d.ts +14 -0
- package/dist/esm/base/context/text-animation/index.js +22 -0
- package/dist/esm/base/context/text-animation/type.d.ts +4 -0
- package/dist/esm/base/context/text-animation/type.js +2 -0
- package/dist/esm/base/context/text-layout-width/index.d.ts +11 -0
- package/dist/esm/base/context/text-layout-width/index.js +20 -0
- package/dist/esm/base/index.d.ts +6 -0
- package/dist/esm/base/index.js +13 -0
- package/dist/esm/base/render/index.d.ts +2 -0
- package/dist/esm/base/render/index.js +5 -0
- package/dist/esm/base/render/layout.d.ts +9 -0
- package/dist/esm/base/render/layout.js +111 -0
- package/dist/esm/base/render/props.d.ts +3 -0
- package/dist/esm/base/render/props.js +43 -0
- package/dist/esm/base/slot/base.d.ts +5 -0
- package/dist/esm/base/slot/base.js +8 -0
- package/dist/esm/base/slot/index.d.ts +3 -0
- package/dist/esm/base/slot/index.js +7 -0
- package/dist/esm/base/slot/type.d.ts +92 -0
- package/dist/esm/base/slot/type.js +2 -0
- package/dist/esm/base/slot/utils/create.d.ts +3 -0
- package/dist/esm/base/slot/utils/create.js +7 -0
- package/dist/esm/base/slot/utils/index.d.ts +3 -0
- package/dist/esm/base/slot/utils/index.js +7 -0
- package/dist/esm/base/slot/utils/style.d.ts +1 -0
- package/dist/esm/base/slot/utils/style.js +3 -0
- package/dist/esm/base/slot/utils/url.d.ts +4 -0
- package/dist/esm/base/slot/utils/url.js +21 -0
- package/dist/esm/base/theme/index.d.ts +25 -0
- package/dist/esm/base/theme/index.js +78 -0
- package/dist/esm/base/theme/presets/base.d.ts +2 -0
- package/dist/esm/base/theme/presets/base.js +117 -0
- package/dist/esm/base/theme/presets/dark.d.ts +2 -0
- package/dist/esm/base/theme/presets/dark.js +33 -0
- package/dist/esm/base/theme/presets/index.d.ts +4 -0
- package/dist/esm/base/theme/presets/index.js +13 -0
- package/dist/esm/base/theme/presets/light.d.ts +2 -0
- package/dist/esm/base/theme/presets/light.js +33 -0
- package/dist/esm/base/theme/type.d.ts +141 -0
- package/dist/esm/base/theme/type.js +2 -0
- package/dist/esm/base/theme/utils.d.ts +4 -0
- package/dist/esm/base/theme/utils.js +38 -0
- package/dist/esm/env.d.ts +1 -0
- package/dist/esm/jsx-runtime.d.ts +27 -0
- package/dist/esm/jsx-runtime.js +6 -0
- package/dist/esm/plugins/blockquote/index.d.ts +2 -0
- package/dist/esm/plugins/blockquote/index.js +19 -0
- package/dist/esm/plugins/blockquote/slot/blockquote/index.d.ts +13 -0
- package/dist/esm/plugins/blockquote/slot/blockquote/index.js +14 -0
- package/dist/esm/plugins/blockquote/slot/blockquote/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/blockquote/slot/blockquote/renderer/index.js +38 -0
- package/dist/esm/plugins/blockquote/slot/index.d.ts +1 -0
- package/dist/esm/plugins/blockquote/slot/index.js +3 -0
- package/dist/esm/plugins/break-line/index.d.ts +2 -0
- package/dist/esm/plugins/break-line/index.js +19 -0
- package/dist/esm/plugins/break-line/slot/break-line/index.d.ts +13 -0
- package/dist/esm/plugins/break-line/slot/break-line/index.js +14 -0
- package/dist/esm/plugins/break-line/slot/break-line/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/break-line/slot/break-line/renderer/index.js +18 -0
- package/dist/esm/plugins/break-line/slot/index.d.ts +1 -0
- package/dist/esm/plugins/break-line/slot/index.js +3 -0
- package/dist/esm/plugins/code/index.d.ts +4 -0
- package/dist/esm/plugins/code/index.js +23 -0
- package/dist/esm/plugins/code/render/code/index.d.ts +13 -0
- package/dist/esm/plugins/code/render/code/index.js +45 -0
- package/dist/esm/plugins/code/render/code/utils.d.ts +7 -0
- package/dist/esm/plugins/code/render/code/utils.js +61 -0
- package/dist/esm/plugins/code/render/index.d.ts +1 -0
- package/dist/esm/plugins/code/render/index.js +3 -0
- package/dist/esm/plugins/code/slot/code-block/index.d.ts +13 -0
- package/dist/esm/plugins/code/slot/code-block/index.js +14 -0
- package/dist/esm/plugins/code/slot/code-block/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/code/slot/code-block/renderer/index.js +43 -0
- package/dist/esm/plugins/code/slot/code-header/index.d.ts +24 -0
- package/dist/esm/plugins/code/slot/code-header/index.js +14 -0
- package/dist/esm/plugins/code/slot/code-header/renderer/index.d.ts +13 -0
- package/dist/esm/plugins/code/slot/code-header/renderer/index.js +122 -0
- package/dist/esm/plugins/code/slot/code-highlighter/index.d.ts +14 -0
- package/dist/esm/plugins/code/slot/code-highlighter/index.js +16 -0
- package/dist/esm/plugins/code/slot/code-highlighter/renderer/index.d.ts +9 -0
- package/dist/esm/plugins/code/slot/code-highlighter/renderer/index.js +61 -0
- package/dist/esm/plugins/code/slot/code-highlighter/renderer/style.css +4 -0
- package/dist/esm/plugins/code/slot/index.d.ts +3 -0
- package/dist/esm/plugins/code/slot/index.js +7 -0
- package/dist/esm/plugins/code-prism/index.d.ts +3 -0
- package/dist/esm/plugins/code-prism/index.js +19 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/index.d.ts +16 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/index.js +14 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/hooks.d.ts +5 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/hooks.js +36 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/index.js +64 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/languages.d.ts +298 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/languages.js +899 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/runtime.d.ts +2 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/runtime.js +11 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/utils.d.ts +9 -0
- package/dist/esm/plugins/code-prism/slot/code-prism/renderer/utils.js +98 -0
- package/dist/esm/plugins/code-prism/slot/index.d.ts +1 -0
- package/dist/esm/plugins/code-prism/slot/index.js +3 -0
- package/dist/esm/plugins/code-shiki/index.d.ts +3 -0
- package/dist/esm/plugins/code-shiki/index.js +19 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/index.d.ts +16 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/index.js +14 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/hooks.d.ts +2 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/hooks.js +22 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/index.js +80 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/utils.d.ts +5 -0
- package/dist/esm/plugins/code-shiki/slot/code-shiki/renderer/utils.js +142 -0
- package/dist/esm/plugins/code-shiki/slot/index.d.ts +1 -0
- package/dist/esm/plugins/code-shiki/slot/index.js +3 -0
- package/dist/esm/plugins/effect-chunk/index.d.ts +2 -0
- package/dist/esm/plugins/effect-chunk/index.js +19 -0
- package/dist/esm/plugins/effect-chunk/slot/effect-chunk/index.d.ts +17 -0
- package/dist/esm/plugins/effect-chunk/slot/effect-chunk/index.js +16 -0
- package/dist/esm/plugins/effect-chunk/slot/effect-chunk/renderer/index.d.ts +10 -0
- package/dist/esm/plugins/effect-chunk/slot/effect-chunk/renderer/index.js +54 -0
- package/dist/esm/plugins/effect-chunk/slot/effect-chunk/renderer/style.css +6 -0
- package/dist/esm/plugins/effect-chunk/slot/index.d.ts +1 -0
- package/dist/esm/plugins/effect-chunk/slot/index.js +3 -0
- package/dist/esm/plugins/effect-scale/index.d.ts +4 -0
- package/dist/esm/plugins/effect-scale/index.js +22 -0
- package/dist/esm/plugins/effect-scale/render/effect-scale/index.d.ts +13 -0
- package/dist/esm/plugins/effect-scale/render/effect-scale/index.js +48 -0
- package/dist/esm/plugins/effect-scale/render/effect-scale/utils.d.ts +8 -0
- package/dist/esm/plugins/effect-scale/render/effect-scale/utils.js +27 -0
- package/dist/esm/plugins/effect-scale/render/index.d.ts +1 -0
- package/dist/esm/plugins/effect-scale/render/index.js +3 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/index.d.ts +17 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/index.js +16 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/renderer/animation.d.ts +12 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/renderer/animation.js +123 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/renderer/index.d.ts +10 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/renderer/index.js +82 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale/renderer/style.css +16 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale-word/index.d.ts +14 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale-word/index.js +16 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale-word/renderer/index.d.ts +8 -0
- package/dist/esm/plugins/effect-scale/slot/effect-scale-word/renderer/index.js +35 -0
- package/dist/esm/plugins/effect-scale/slot/index.d.ts +2 -0
- package/dist/esm/plugins/effect-scale/slot/index.js +5 -0
- package/dist/esm/plugins/effect-shad/index.d.ts +4 -0
- package/dist/esm/plugins/effect-shad/index.js +21 -0
- package/dist/esm/plugins/effect-shad/render/effect-shad/index.d.ts +13 -0
- package/dist/esm/plugins/effect-shad/render/effect-shad/index.js +36 -0
- package/dist/esm/plugins/effect-shad/render/effect-shad/utils.d.ts +5 -0
- package/dist/esm/plugins/effect-shad/render/effect-shad/utils.js +21 -0
- package/dist/esm/plugins/effect-shad/render/index.d.ts +1 -0
- package/dist/esm/plugins/effect-shad/render/index.js +3 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/index.d.ts +17 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/index.js +16 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/renderer/index.d.ts +10 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/renderer/index.js +193 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/renderer/style.css +19 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/renderer/utils.d.ts +23 -0
- package/dist/esm/plugins/effect-shad/slot/effect-shad/renderer/utils.js +137 -0
- package/dist/esm/plugins/effect-shad/slot/index.d.ts +1 -0
- package/dist/esm/plugins/effect-shad/slot/index.js +3 -0
- package/dist/esm/plugins/effect-suffix/index.d.ts +2 -0
- package/dist/esm/plugins/effect-suffix/index.js +19 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/index.d.ts +14 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/index.js +16 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/renderer/index.d.ts +9 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/renderer/index.js +62 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/renderer/style.css +63 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/renderer/utils.d.ts +17 -0
- package/dist/esm/plugins/effect-suffix/slot/effect-suffix/renderer/utils.js +36 -0
- package/dist/esm/plugins/effect-suffix/slot/index.d.ts +1 -0
- package/dist/esm/plugins/effect-suffix/slot/index.js +3 -0
- package/dist/esm/plugins/emphasis/index.d.ts +2 -0
- package/dist/esm/plugins/emphasis/index.js +19 -0
- package/dist/esm/plugins/emphasis/slot/emphasis/index.d.ts +13 -0
- package/dist/esm/plugins/emphasis/slot/emphasis/index.js +14 -0
- package/dist/esm/plugins/emphasis/slot/emphasis/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/emphasis/slot/emphasis/renderer/index.js +33 -0
- package/dist/esm/plugins/emphasis/slot/index.d.ts +1 -0
- package/dist/esm/plugins/emphasis/slot/index.js +3 -0
- package/dist/esm/plugins/fallback/index.d.ts +4 -0
- package/dist/esm/plugins/fallback/index.js +21 -0
- package/dist/esm/plugins/fallback/render/fallback/index.d.ts +18 -0
- package/dist/esm/plugins/fallback/render/fallback/index.js +61 -0
- package/dist/esm/plugins/fallback/render/index.d.ts +1 -0
- package/dist/esm/plugins/fallback/render/index.js +3 -0
- package/dist/esm/plugins/fallback/slot/element/index.d.ts +13 -0
- package/dist/esm/plugins/fallback/slot/element/index.js +14 -0
- package/dist/esm/plugins/fallback/slot/element/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/fallback/slot/element/renderer/index.js +305 -0
- package/dist/esm/plugins/fallback/slot/index.d.ts +1 -0
- package/dist/esm/plugins/fallback/slot/index.js +3 -0
- package/dist/esm/plugins/heading/index.d.ts +2 -0
- package/dist/esm/plugins/heading/index.js +19 -0
- package/dist/esm/plugins/heading/slot/heading/index.d.ts +13 -0
- package/dist/esm/plugins/heading/slot/heading/index.js +14 -0
- package/dist/esm/plugins/heading/slot/heading/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/heading/slot/heading/renderer/index.js +44 -0
- package/dist/esm/plugins/heading/slot/index.d.ts +1 -0
- package/dist/esm/plugins/heading/slot/index.js +3 -0
- package/dist/esm/plugins/image/index.d.ts +2 -0
- package/dist/esm/plugins/image/index.js +19 -0
- package/dist/esm/plugins/image/slot/image/index.d.ts +13 -0
- package/dist/esm/plugins/image/slot/image/index.js +14 -0
- package/dist/esm/plugins/image/slot/image/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/image/slot/image/renderer/index.js +48 -0
- package/dist/esm/plugins/image/slot/index.d.ts +1 -0
- package/dist/esm/plugins/image/slot/index.js +3 -0
- package/dist/esm/plugins/link/index.d.ts +2 -0
- package/dist/esm/plugins/link/index.js +19 -0
- package/dist/esm/plugins/link/slot/index.d.ts +1 -0
- package/dist/esm/plugins/link/slot/index.js +3 -0
- package/dist/esm/plugins/link/slot/link/index.d.ts +13 -0
- package/dist/esm/plugins/link/slot/link/index.js +14 -0
- package/dist/esm/plugins/link/slot/link/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/link/slot/link/renderer/index.js +43 -0
- package/dist/esm/plugins/list/index.d.ts +2 -0
- package/dist/esm/plugins/list/index.js +19 -0
- package/dist/esm/plugins/list/slot/index.d.ts +1 -0
- package/dist/esm/plugins/list/slot/index.js +3 -0
- package/dist/esm/plugins/list/slot/list/index.d.ts +13 -0
- package/dist/esm/plugins/list/slot/list/index.js +14 -0
- package/dist/esm/plugins/list/slot/list/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/list/slot/list/renderer/index.js +26 -0
- package/dist/esm/plugins/paragraph/index.d.ts +2 -0
- package/dist/esm/plugins/paragraph/index.js +19 -0
- package/dist/esm/plugins/paragraph/slot/index.d.ts +1 -0
- package/dist/esm/plugins/paragraph/slot/index.js +3 -0
- package/dist/esm/plugins/paragraph/slot/paragraph/index.d.ts +13 -0
- package/dist/esm/plugins/paragraph/slot/paragraph/index.js +14 -0
- package/dist/esm/plugins/paragraph/slot/paragraph/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/paragraph/slot/paragraph/renderer/index.js +29 -0
- package/dist/esm/plugins/strong/index.d.ts +2 -0
- package/dist/esm/plugins/strong/index.js +19 -0
- package/dist/esm/plugins/strong/slot/index.d.ts +1 -0
- package/dist/esm/plugins/strong/slot/index.js +3 -0
- package/dist/esm/plugins/strong/slot/strong/index.d.ts +13 -0
- package/dist/esm/plugins/strong/slot/strong/index.js +14 -0
- package/dist/esm/plugins/strong/slot/strong/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/strong/slot/strong/renderer/index.js +34 -0
- package/dist/esm/plugins/table/index.d.ts +4 -0
- package/dist/esm/plugins/table/index.js +23 -0
- package/dist/esm/plugins/table/render/index.d.ts +2 -0
- package/dist/esm/plugins/table/render/index.js +5 -0
- package/dist/esm/plugins/table/render/table/index.d.ts +13 -0
- package/dist/esm/plugins/table/render/table/index.js +64 -0
- package/dist/esm/plugins/table/render/table-cell/index.d.ts +13 -0
- package/dist/esm/plugins/table/render/table-cell/index.js +45 -0
- package/dist/esm/plugins/table/slot/index.d.ts +2 -0
- package/dist/esm/plugins/table/slot/index.js +5 -0
- package/dist/esm/plugins/table/slot/table/index.d.ts +13 -0
- package/dist/esm/plugins/table/slot/table/index.js +14 -0
- package/dist/esm/plugins/table/slot/table/renderer/index.d.ts +6 -0
- package/dist/esm/plugins/table/slot/table/renderer/index.js +38 -0
- package/dist/esm/plugins/table/slot/table/renderer/style.css +11 -0
- package/dist/esm/plugins/table/slot/table-cell/index.d.ts +13 -0
- package/dist/esm/plugins/table/slot/table-cell/index.js +14 -0
- package/dist/esm/plugins/table/slot/table-cell/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/table/slot/table-cell/renderer/index.js +52 -0
- package/dist/esm/plugins/tex/index.d.ts +2 -0
- package/dist/esm/plugins/tex/index.js +19 -0
- package/dist/esm/plugins/tex/slot/index.d.ts +1 -0
- package/dist/esm/plugins/tex/slot/index.js +3 -0
- package/dist/esm/plugins/tex/slot/tex/index.d.ts +14 -0
- package/dist/esm/plugins/tex/slot/tex/index.js +16 -0
- package/dist/esm/plugins/tex/slot/tex/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/tex/slot/tex/renderer/index.js +36 -0
- package/dist/esm/plugins/tex-mathjax/index.d.ts +3 -0
- package/dist/esm/plugins/tex-mathjax/index.js +19 -0
- package/dist/esm/plugins/tex-mathjax/slot/index.d.ts +1 -0
- package/dist/esm/plugins/tex-mathjax/slot/index.js +3 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/index.d.ts +14 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/index.js +16 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/renderer/index.d.ts +5 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/renderer/index.js +55 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/renderer/utils.d.ts +35 -0
- package/dist/esm/plugins/tex-mathjax/slot/tex-mathjax/renderer/utils.js +197 -0
- package/dist/esm/presets/full/index.d.ts +2 -0
- package/dist/esm/presets/full/index.js +85 -0
- package/dist/esm/presets/lite/index.d.ts +2 -0
- package/dist/esm/presets/lite/index.js +77 -0
- package/dist/esm/typings/index.d.ts +2 -0
- package/dist/esm/typings/index.js +7 -0
- package/dist/esm/typings/plugins/index.d.ts +1 -0
- package/dist/esm/typings/plugins/index.js +5 -0
- package/dist/esm/typings/plugins/plugins.d.ts +20 -0
- package/package.json +88 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createVNode, defineComponent, h, isVNode, mergeProps, shallowRef } from "vue";
|
|
2
|
+
import { AnimatedText, joinClassNames, useTextStyle, useTheme } from "../../../../../base/index.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function _isSlot(s) {
|
|
9
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
10
|
+
}
|
|
11
|
+
const renderAction = ({ key, target })=>{
|
|
12
|
+
if (typeof target === 'function' || target && typeof target === 'object' && !isVNode(target) && !Array.isArray(target)) {
|
|
13
|
+
return createVNode("view", {
|
|
14
|
+
"key": key
|
|
15
|
+
}, [
|
|
16
|
+
h(target)
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
return createVNode("view", {
|
|
20
|
+
"key": key
|
|
21
|
+
}, [
|
|
22
|
+
isVNode(target) ? target : createVNode(AnimatedText, null, _isSlot(target) ? target : {
|
|
23
|
+
default: ()=>[
|
|
24
|
+
target
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
]);
|
|
28
|
+
};
|
|
29
|
+
const CodeHeaderRenderer = /*#__PURE__*/ defineComponent((props, { attrs })=>{
|
|
30
|
+
const copying = shallowRef(false);
|
|
31
|
+
return ()=>{
|
|
32
|
+
const { Raw: _Raw, actions, class: className, code, language, left, meta, onCopy, style, ...elementProps } = props;
|
|
33
|
+
const { tokens } = useTheme();
|
|
34
|
+
const textStyle = useTextStyle({
|
|
35
|
+
color: tokens.colors.fgMuted,
|
|
36
|
+
fontFamily: tokens.typography.fontMono,
|
|
37
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
38
|
+
lineHeight: tokens.typography.lineHeight.sm
|
|
39
|
+
});
|
|
40
|
+
const copy = async ()=>{
|
|
41
|
+
if (!onCopy || copying.value) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
copying.value = true;
|
|
45
|
+
try {
|
|
46
|
+
await onCopy({
|
|
47
|
+
code,
|
|
48
|
+
language,
|
|
49
|
+
meta
|
|
50
|
+
});
|
|
51
|
+
} catch {} finally{
|
|
52
|
+
copying.value = false;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const defaults = onCopy ? [
|
|
56
|
+
{
|
|
57
|
+
key: 'copy',
|
|
58
|
+
target: createVNode(AnimatedText, {
|
|
59
|
+
"style": textStyle,
|
|
60
|
+
"bindtap": ()=>{
|
|
61
|
+
void copy();
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
default: ()=>[
|
|
65
|
+
copying.value ? 'Copying…' : 'Copy'
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
] : [];
|
|
70
|
+
const resolved = typeof actions === 'function' ? actions(defaults) : [
|
|
71
|
+
...defaults,
|
|
72
|
+
...actions ?? []
|
|
73
|
+
];
|
|
74
|
+
return createVNode("view", mergeProps(attrs, elementProps, {
|
|
75
|
+
"class": joinClassNames('fluxdown-code-header', className),
|
|
76
|
+
"style": {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'space-between',
|
|
81
|
+
minHeight: '44px',
|
|
82
|
+
padding: `${tokens.spacing.sm} ${tokens.spacing.md}`,
|
|
83
|
+
borderBottom: `1px solid ${tokens.colors.border}`,
|
|
84
|
+
backgroundColor: tokens.colors.surfaceMuted,
|
|
85
|
+
...style
|
|
86
|
+
}
|
|
87
|
+
}), [
|
|
88
|
+
createVNode(AnimatedText, {
|
|
89
|
+
"style": textStyle
|
|
90
|
+
}, {
|
|
91
|
+
default: ()=>[
|
|
92
|
+
left ?? language ?? 'text'
|
|
93
|
+
]
|
|
94
|
+
}),
|
|
95
|
+
createVNode("view", {
|
|
96
|
+
"style": {
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
gap: tokens.spacing.sm
|
|
100
|
+
}
|
|
101
|
+
}, [
|
|
102
|
+
resolved.map(renderAction)
|
|
103
|
+
])
|
|
104
|
+
]);
|
|
105
|
+
};
|
|
106
|
+
}, {
|
|
107
|
+
name: 'FluxdownCodeHeaderRenderer',
|
|
108
|
+
props: [
|
|
109
|
+
'Raw',
|
|
110
|
+
'actions',
|
|
111
|
+
'class',
|
|
112
|
+
'code',
|
|
113
|
+
'language',
|
|
114
|
+
'left',
|
|
115
|
+
'meta',
|
|
116
|
+
'onCopy',
|
|
117
|
+
'style'
|
|
118
|
+
],
|
|
119
|
+
inheritAttrs: false
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export { CodeHeaderRenderer };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IPluggableConfig } from '@fluxdown/types';
|
|
2
|
+
import { BaseSlotPlugin } from '../../../../base/index.js';
|
|
3
|
+
import { CodeHighlighterRenderer } from './renderer/index.js';
|
|
4
|
+
export * from './renderer/index.js';
|
|
5
|
+
declare global {
|
|
6
|
+
interface VueSlotConfigs {
|
|
7
|
+
'slot-code-highlighter': IPluggableConfig<void>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class CodeHighlighterSlotPlugin extends BaseSlotPlugin<'CodeHighlighter'> {
|
|
11
|
+
static readonly key = "slot-code-highlighter";
|
|
12
|
+
readonly Component: typeof CodeHighlighterRenderer;
|
|
13
|
+
readonly type = "CodeHighlighter";
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseSlotPlugin } from "../../../../base/index.js";
|
|
2
|
+
import { CodeHighlighterRenderer } from "./renderer/index.js";
|
|
3
|
+
|
|
4
|
+
export * from "./renderer/index.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CodeHighlighterSlotPlugin extends BaseSlotPlugin {
|
|
11
|
+
static key = 'slot-code-highlighter';
|
|
12
|
+
Component = CodeHighlighterRenderer;
|
|
13
|
+
type = 'CodeHighlighter';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { CodeHighlighterSlotPlugin };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SetupContext, VNodeChild } from 'vue';
|
|
2
|
+
import type { CodeHighlighterProps } from '../../../../../base/index.js';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
export declare function CodeHighlighterRenderer({ Raw: _Raw, children, class: className, code, language: _language, meta: _meta, style, suffix, ...elementProps }: CodeHighlighterProps & {
|
|
5
|
+
children?: VNodeChild[];
|
|
6
|
+
}, { slots }: Pick<SetupContext, 'slots'>): import("../../../../../jsx-runtime.js").JSX.Element;
|
|
7
|
+
export declare namespace CodeHighlighterRenderer {
|
|
8
|
+
var inheritAttrs: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createVNode, mergeProps, resolveComponent } from "vue";
|
|
2
|
+
import { AnimatedText, TextStyleProvider, joinClassNames, useTextStyle, useTheme } from "../../../../../base/index.js";
|
|
3
|
+
import "./style.css";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const CodeHighlighterRenderer = ({ Raw: _Raw, children, class: className, code, language: _language, meta: _meta, style, suffix, ...elementProps }, { slots })=>{
|
|
12
|
+
const { tokens } = useTheme();
|
|
13
|
+
const textStyle = useTextStyle({
|
|
14
|
+
fontFamily: tokens.typography.fontMono,
|
|
15
|
+
fontSize: tokens.code.fontSize,
|
|
16
|
+
lineHeight: tokens.code.lineHeight
|
|
17
|
+
});
|
|
18
|
+
const isWeb = typeof SystemInfo !== 'undefined' && String(SystemInfo.platform) === 'web';
|
|
19
|
+
const lines = children ?? slots.default?.() ?? code.replace(/\t/g, ' ').split('\n');
|
|
20
|
+
return createVNode(TextStyleProvider, {
|
|
21
|
+
"value": textStyle
|
|
22
|
+
}, {
|
|
23
|
+
default: ()=>[
|
|
24
|
+
createVNode(resolveComponent("scroll-view"), mergeProps(elementProps, {
|
|
25
|
+
"scroll-x": true,
|
|
26
|
+
"class": joinClassNames('fluxdown-code-highlighter', isWeb && 'fluxdown-code-highlighter-web', className),
|
|
27
|
+
"style": {
|
|
28
|
+
width: '100%',
|
|
29
|
+
...style
|
|
30
|
+
}
|
|
31
|
+
}), {
|
|
32
|
+
default: ()=>[
|
|
33
|
+
createVNode("view", {
|
|
34
|
+
"style": {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
padding: tokens.spacing.lg,
|
|
38
|
+
minWidth: '100%'
|
|
39
|
+
}
|
|
40
|
+
}, [
|
|
41
|
+
lines.map((line, index)=>createVNode(AnimatedText, {
|
|
42
|
+
"key": index,
|
|
43
|
+
"style": {
|
|
44
|
+
...textStyle,
|
|
45
|
+
whiteSpace: 'nowrap'
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
default: ()=>[
|
|
49
|
+
line || '\u200b',
|
|
50
|
+
index === lines.length - 1 ? suffix : null
|
|
51
|
+
]
|
|
52
|
+
}))
|
|
53
|
+
])
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
CodeHighlighterRenderer.inheritAttrs = false;
|
|
60
|
+
|
|
61
|
+
export { CodeHighlighterRenderer };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pluginExtends } from "@fluxdown/vue-base-plugins/base";
|
|
2
|
+
import { CodePlugin } from "../code/index.js";
|
|
3
|
+
import { CodePrismSlotPlugin } from "./slot/index.js";
|
|
4
|
+
|
|
5
|
+
export * from "./slot/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const CodePrismPlugin = /*#__PURE__*/ pluginExtends(CodePlugin, {
|
|
14
|
+
slots: [
|
|
15
|
+
CodePrismSlotPlugin
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { CodePrismPlugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IPluggableConfig } from '@fluxdown/types';
|
|
2
|
+
import { BaseSlotPlugin } from '../../../../base/index.js';
|
|
3
|
+
declare global {
|
|
4
|
+
interface VueSlotConfigs {
|
|
5
|
+
'slot-code-prism': IPluggableConfig<void>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class CodePrismSlotPlugin extends BaseSlotPlugin<'CodeHighlighter'> {
|
|
9
|
+
static readonly key = "slot-code-prism";
|
|
10
|
+
readonly Component: import("vue").DefineSetupFnComponent<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes & {
|
|
11
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes>;
|
|
12
|
+
}, {}, {}, Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes & {
|
|
13
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes>;
|
|
14
|
+
} & {}, import("vue").PublicProps>;
|
|
15
|
+
readonly type = "CodeHighlighter";
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseSlotPlugin } from "../../../../base/index.js";
|
|
2
|
+
import { CodePrismRenderer } from "./renderer/index.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CodePrismSlotPlugin extends BaseSlotPlugin {
|
|
9
|
+
static key = 'slot-code-prism';
|
|
10
|
+
Component = CodePrismRenderer;
|
|
11
|
+
type = 'CodeHighlighter';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { CodePrismSlotPlugin };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { computed, shallowRef, watch } from "vue";
|
|
2
|
+
import { highlightCode } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const useHighlighted = (source)=>{
|
|
9
|
+
const highlighted = shallowRef(null);
|
|
10
|
+
watch(()=>[
|
|
11
|
+
source().code,
|
|
12
|
+
source().language ?? 'plaintext'
|
|
13
|
+
], ([code, language], _, onCleanup)=>{
|
|
14
|
+
let active = true;
|
|
15
|
+
onCleanup(()=>{
|
|
16
|
+
active = false;
|
|
17
|
+
});
|
|
18
|
+
void highlightCode(code, language).then((tokens)=>{
|
|
19
|
+
if (active && tokens) highlighted.value = {
|
|
20
|
+
code,
|
|
21
|
+
language,
|
|
22
|
+
tokens
|
|
23
|
+
};
|
|
24
|
+
}, (error)=>{
|
|
25
|
+
console.error(error);
|
|
26
|
+
});
|
|
27
|
+
}, {
|
|
28
|
+
immediate: true
|
|
29
|
+
});
|
|
30
|
+
return computed(()=>{
|
|
31
|
+
const current = source();
|
|
32
|
+
return highlighted.value?.code === current.code && highlighted.value.language === (current.language ?? 'plaintext') ? highlighted.value.tokens : null;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { useHighlighted };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CodePrismRenderer: import("vue").DefineSetupFnComponent<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes & {
|
|
2
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes>;
|
|
3
|
+
}, {}, {}, Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes & {
|
|
4
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").CodeHighlighterProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes>;
|
|
5
|
+
} & {}, import("vue").PublicProps>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { AnimatedText, useTextStyle, useTheme } from "../../../../../base/index.js";
|
|
3
|
+
import { CodeHighlighterRenderer } from "../../../../code/index.js";
|
|
4
|
+
import { useHighlighted } from "./hooks.js";
|
|
5
|
+
import { tokenStyle } from "./utils.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const CodePrismRenderer = /*#__PURE__*/ defineComponent((props, { attrs })=>{
|
|
18
|
+
const lines = useHighlighted(()=>props);
|
|
19
|
+
return ()=>{
|
|
20
|
+
const { tokens } = useTheme();
|
|
21
|
+
const textStyle = useTextStyle({
|
|
22
|
+
fontFamily: tokens.typography.fontMono,
|
|
23
|
+
fontSize: tokens.code.fontSize,
|
|
24
|
+
lineHeight: tokens.code.lineHeight
|
|
25
|
+
});
|
|
26
|
+
const children = lines.value?.map((line, lineIndex)=>createVNode(AnimatedText, {
|
|
27
|
+
"key": lineIndex,
|
|
28
|
+
"style": textStyle
|
|
29
|
+
}, {
|
|
30
|
+
default: ()=>[
|
|
31
|
+
line.length === 0 ? '\u200b' : line.map((token, tokenIndex)=>createVNode(AnimatedText, {
|
|
32
|
+
"key": tokenIndex,
|
|
33
|
+
"style": {
|
|
34
|
+
...textStyle,
|
|
35
|
+
...tokenStyle(token.types, tokens)
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
default: ()=>[
|
|
39
|
+
token.content
|
|
40
|
+
]
|
|
41
|
+
}))
|
|
42
|
+
]
|
|
43
|
+
}));
|
|
44
|
+
return createVNode(CodeHighlighterRenderer, mergeProps(attrs, props, {
|
|
45
|
+
"class": props.class,
|
|
46
|
+
"style": props.style,
|
|
47
|
+
"children": children
|
|
48
|
+
}), null);
|
|
49
|
+
};
|
|
50
|
+
}, {
|
|
51
|
+
name: 'FluxdownCodePrismRenderer',
|
|
52
|
+
props: [
|
|
53
|
+
'Raw',
|
|
54
|
+
'code',
|
|
55
|
+
'language',
|
|
56
|
+
'meta',
|
|
57
|
+
'suffix',
|
|
58
|
+
'class',
|
|
59
|
+
'style'
|
|
60
|
+
],
|
|
61
|
+
inheritAttrs: false
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export { CodePrismRenderer };
|