@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,11 @@
|
|
|
1
|
+
import prismjs from "prismjs";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
prismjs.manual = true; // Language components share Prism through the runtime's global object.
|
|
6
|
+
Object.assign(globalThis, {
|
|
7
|
+
Prism: prismjs
|
|
8
|
+
});
|
|
9
|
+
/* export default */ const runtime = (prismjs);
|
|
10
|
+
|
|
11
|
+
export default runtime;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
+
import type { ThemeTokens } from '../../../../../base/theme/index.js';
|
|
3
|
+
import './languages.js';
|
|
4
|
+
export interface CodeToken {
|
|
5
|
+
content: string;
|
|
6
|
+
types: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const highlightCode: (code: string, language: string) => Promise<CodeToken[][] | null>;
|
|
9
|
+
export declare const tokenStyle: (types: string[], { syntax }: ThemeTokens) => CSSProperties;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { castArray, has, isObjectLike, isString, toLower, trim } from "lodash-es";
|
|
2
|
+
import "./languages.js";
|
|
3
|
+
import runtime from "./runtime.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const getGrammar = (language)=>{
|
|
12
|
+
const grammar = has(runtime.languages, [
|
|
13
|
+
language
|
|
14
|
+
]) ? runtime.languages[language] : undefined;
|
|
15
|
+
return isObjectLike(grammar) ? grammar : null;
|
|
16
|
+
};
|
|
17
|
+
const splitTokens = (tokens)=>{
|
|
18
|
+
const lines = [
|
|
19
|
+
[]
|
|
20
|
+
];
|
|
21
|
+
const append = (stream, types)=>{
|
|
22
|
+
if (isString(stream)) {
|
|
23
|
+
stream.split('\n').forEach((content, index)=>{
|
|
24
|
+
if (index > 0) lines.push([]);
|
|
25
|
+
if (content) lines[lines.length - 1].push({
|
|
26
|
+
content,
|
|
27
|
+
types
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const token of castArray(stream)){
|
|
33
|
+
if (isString(token)) {
|
|
34
|
+
append(token, types);
|
|
35
|
+
} else {
|
|
36
|
+
append(token.content, [
|
|
37
|
+
...types,
|
|
38
|
+
token.type,
|
|
39
|
+
...castArray(token.alias ?? [])
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
append(tokens, []);
|
|
45
|
+
return lines;
|
|
46
|
+
};
|
|
47
|
+
const highlightCode = async (code, language)=>{
|
|
48
|
+
const name = toLower(trim(language));
|
|
49
|
+
if (!name || getGrammar(name) === runtime.languages.plaintext) return null;
|
|
50
|
+
const grammar = getGrammar(name);
|
|
51
|
+
if (!grammar) return null;
|
|
52
|
+
const environment = {
|
|
53
|
+
code: code.replace(/\t/g, ' '),
|
|
54
|
+
grammar,
|
|
55
|
+
language: name
|
|
56
|
+
};
|
|
57
|
+
runtime.hooks.run('before-tokenize', environment);
|
|
58
|
+
environment.tokens = runtime.tokenize(environment.code, environment.grammar);
|
|
59
|
+
runtime.hooks.run('after-tokenize', environment);
|
|
60
|
+
return splitTokens(environment.tokens);
|
|
61
|
+
};
|
|
62
|
+
const tokenStyle = (types, { syntax })=>{
|
|
63
|
+
const colors = {
|
|
64
|
+
comment: syntax.comment,
|
|
65
|
+
prolog: syntax.comment,
|
|
66
|
+
doctype: syntax.comment,
|
|
67
|
+
cdata: syntax.comment,
|
|
68
|
+
keyword: syntax.keyword,
|
|
69
|
+
atrule: syntax.keyword,
|
|
70
|
+
string: syntax.string,
|
|
71
|
+
char: syntax.string,
|
|
72
|
+
'attr-value': syntax.string,
|
|
73
|
+
tag: syntax.string,
|
|
74
|
+
number: syntax.number,
|
|
75
|
+
boolean: syntax.number,
|
|
76
|
+
constant: syntax.number,
|
|
77
|
+
function: syntax.function,
|
|
78
|
+
'class-name': syntax.function,
|
|
79
|
+
property: syntax.variable,
|
|
80
|
+
variable: syntax.variable,
|
|
81
|
+
'attr-name': syntax.variable,
|
|
82
|
+
punctuation: syntax.punctuation,
|
|
83
|
+
operator: syntax.punctuation,
|
|
84
|
+
inserted: syntax.inserted,
|
|
85
|
+
deleted: syntax.deleted
|
|
86
|
+
};
|
|
87
|
+
const style = {};
|
|
88
|
+
for (const type of types){
|
|
89
|
+
if (has(colors, [
|
|
90
|
+
type
|
|
91
|
+
])) style.color = colors[type];
|
|
92
|
+
if (type === 'bold') style.fontWeight = '700';
|
|
93
|
+
if (type === 'italic') style.fontStyle = 'italic';
|
|
94
|
+
}
|
|
95
|
+
return style;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { highlightCode, tokenStyle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './code-prism/index.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pluginExtends } from "@fluxdown/vue-base-plugins/base";
|
|
2
|
+
import { CodePlugin } from "../code/index.js";
|
|
3
|
+
import { CodeShikiSlotPlugin } from "./slot/index.js";
|
|
4
|
+
|
|
5
|
+
export * from "./slot/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const CodeShikiPlugin = /*#__PURE__*/ pluginExtends(CodePlugin, {
|
|
14
|
+
slots: [
|
|
15
|
+
CodeShikiSlotPlugin
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { CodeShikiPlugin };
|
|
@@ -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-shiki': IPluggableConfig<void>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class CodeShikiSlotPlugin extends BaseSlotPlugin<'CodeHighlighter'> {
|
|
9
|
+
static readonly key = "slot-code-shiki";
|
|
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 { CodeShikiRenderer } from "./renderer/index.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CodeShikiSlotPlugin extends BaseSlotPlugin {
|
|
9
|
+
static key = 'slot-code-shiki';
|
|
10
|
+
Component = CodeShikiRenderer;
|
|
11
|
+
type = 'CodeHighlighter';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { CodeShikiSlotPlugin };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { onScopeDispose, shallowRef } from "vue";
|
|
2
|
+
import { createCodeHighlighter } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const useHighlighter = ()=>{
|
|
9
|
+
const highlighter = shallowRef(null);
|
|
10
|
+
let active = true;
|
|
11
|
+
void createCodeHighlighter().then((value)=>{
|
|
12
|
+
if (active) highlighter.value = value;
|
|
13
|
+
}, (error)=>{
|
|
14
|
+
console.error(error);
|
|
15
|
+
});
|
|
16
|
+
onScopeDispose(()=>{
|
|
17
|
+
active = false;
|
|
18
|
+
});
|
|
19
|
+
return highlighter;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { useHighlighter };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CodeShikiRenderer: 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,80 @@
|
|
|
1
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { AnimatedText, useTextStyle, useTheme } from "../../../../../base/index.js";
|
|
3
|
+
import { CodeHighlighterRenderer } from "../../../../code/slot/code-highlighter/renderer/index.js";
|
|
4
|
+
import { useHighlighter } from "./hooks.js";
|
|
5
|
+
import { createCodeTheme } from "./utils.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const CodeShikiRenderer = /*#__PURE__*/ defineComponent((input, { attrs })=>{
|
|
18
|
+
const highlighter = useHighlighter();
|
|
19
|
+
return ()=>{
|
|
20
|
+
const { code, language = 'plaintext', ...props } = input;
|
|
21
|
+
const { tokens } = useTheme();
|
|
22
|
+
const textStyle = useTextStyle({
|
|
23
|
+
fontFamily: tokens.typography.fontMono,
|
|
24
|
+
fontSize: tokens.code.fontSize,
|
|
25
|
+
lineHeight: tokens.code.lineHeight
|
|
26
|
+
});
|
|
27
|
+
const lang = highlighter.value?.getLoadedLanguages().includes(language) ? language : 'text';
|
|
28
|
+
let lines;
|
|
29
|
+
try {
|
|
30
|
+
lines = highlighter.value?.codeToTokens(code.replace(/\t/g, ' '), {
|
|
31
|
+
lang,
|
|
32
|
+
theme: createCodeTheme(tokens)
|
|
33
|
+
}).tokens;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error(error);
|
|
36
|
+
}
|
|
37
|
+
const children = lines?.map((line, lineIndex)=>createVNode(AnimatedText, {
|
|
38
|
+
"key": lineIndex,
|
|
39
|
+
"style": textStyle
|
|
40
|
+
}, {
|
|
41
|
+
default: ()=>[
|
|
42
|
+
line.length === 0 ? '\u200b' : line.map((token, tokenIndex)=>createVNode(AnimatedText, {
|
|
43
|
+
"key": tokenIndex,
|
|
44
|
+
"style": {
|
|
45
|
+
...textStyle,
|
|
46
|
+
color: token.color,
|
|
47
|
+
fontStyle: token.fontStyle && token.fontStyle & 1 ? 'italic' : 'normal',
|
|
48
|
+
fontWeight: token.fontStyle && token.fontStyle & 2 ? '700' : textStyle.fontWeight,
|
|
49
|
+
textDecoration: token.fontStyle && token.fontStyle & 4 ? 'underline' : undefined
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
default: ()=>[
|
|
53
|
+
token.content
|
|
54
|
+
]
|
|
55
|
+
}))
|
|
56
|
+
]
|
|
57
|
+
}));
|
|
58
|
+
return createVNode(CodeHighlighterRenderer, mergeProps(attrs, props, {
|
|
59
|
+
"class": props.class,
|
|
60
|
+
"style": props.style,
|
|
61
|
+
"code": code,
|
|
62
|
+
"language": language,
|
|
63
|
+
"children": children
|
|
64
|
+
}), null);
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
name: 'FluxdownCodeShikiRenderer',
|
|
68
|
+
props: [
|
|
69
|
+
'Raw',
|
|
70
|
+
'code',
|
|
71
|
+
'language',
|
|
72
|
+
'meta',
|
|
73
|
+
'suffix',
|
|
74
|
+
'class',
|
|
75
|
+
'style'
|
|
76
|
+
],
|
|
77
|
+
inheritAttrs: false
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export { CodeShikiRenderer };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HighlighterCore, ThemeRegistration } from 'shiki/core';
|
|
2
|
+
import 'core-js/modules/web.atob.js';
|
|
3
|
+
import type { ThemeTokens } from '../../../../../base/theme/index.js';
|
|
4
|
+
export declare const createCodeHighlighter: () => Promise<HighlighterCore>;
|
|
5
|
+
export declare const createCodeTheme: ({ colors, syntax }: ThemeTokens) => ThemeRegistration;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import "core-js/modules/web.atob.js";
|
|
2
|
+
import { createHighlighterCore } from "shiki/core";
|
|
3
|
+
import { createOnigurumaEngine } from "shiki/engine/oniguruma";
|
|
4
|
+
import bash from "shiki/langs/bash.mjs";
|
|
5
|
+
import css from "shiki/langs/css.mjs";
|
|
6
|
+
import html from "shiki/langs/html.mjs";
|
|
7
|
+
import javascript from "shiki/langs/javascript.mjs";
|
|
8
|
+
import json from "shiki/langs/json.mjs";
|
|
9
|
+
import python from "shiki/langs/python.mjs";
|
|
10
|
+
import typescript from "shiki/langs/typescript.mjs";
|
|
11
|
+
import { wasmBinary } from "shiki/wasm";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
let highlighterPromise;
|
|
36
|
+
const createCodeHighlighter = ()=>{
|
|
37
|
+
highlighterPromise ??= createHighlighterCore({
|
|
38
|
+
langs: [
|
|
39
|
+
bash,
|
|
40
|
+
css,
|
|
41
|
+
html,
|
|
42
|
+
javascript,
|
|
43
|
+
json,
|
|
44
|
+
python,
|
|
45
|
+
typescript
|
|
46
|
+
],
|
|
47
|
+
themes: [],
|
|
48
|
+
engine: createOnigurumaEngine({
|
|
49
|
+
instantiator: async (imports)=>new WebAssembly.Instance(new WebAssembly.Module(wasmBinary), imports)
|
|
50
|
+
})
|
|
51
|
+
}).catch((error)=>{
|
|
52
|
+
highlighterPromise = undefined;
|
|
53
|
+
throw error;
|
|
54
|
+
});
|
|
55
|
+
return highlighterPromise;
|
|
56
|
+
};
|
|
57
|
+
const createCodeTheme = ({ colors, syntax })=>({
|
|
58
|
+
name: 'fluxdown',
|
|
59
|
+
colors: {
|
|
60
|
+
'editor.foreground': colors.fg,
|
|
61
|
+
'editor.background': colors.surfaceSubtle
|
|
62
|
+
},
|
|
63
|
+
tokenColors: [
|
|
64
|
+
{
|
|
65
|
+
scope: [
|
|
66
|
+
'comment'
|
|
67
|
+
],
|
|
68
|
+
settings: {
|
|
69
|
+
foreground: syntax.comment
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
scope: [
|
|
74
|
+
'keyword',
|
|
75
|
+
'storage'
|
|
76
|
+
],
|
|
77
|
+
settings: {
|
|
78
|
+
foreground: syntax.keyword
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
scope: [
|
|
83
|
+
'string'
|
|
84
|
+
],
|
|
85
|
+
settings: {
|
|
86
|
+
foreground: syntax.string
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
scope: [
|
|
91
|
+
'constant.numeric'
|
|
92
|
+
],
|
|
93
|
+
settings: {
|
|
94
|
+
foreground: syntax.number
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
scope: [
|
|
99
|
+
'entity.name.function',
|
|
100
|
+
'support.function'
|
|
101
|
+
],
|
|
102
|
+
settings: {
|
|
103
|
+
foreground: syntax.function
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
scope: [
|
|
108
|
+
'variable',
|
|
109
|
+
'entity.name.tag'
|
|
110
|
+
],
|
|
111
|
+
settings: {
|
|
112
|
+
foreground: syntax.variable
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
scope: [
|
|
117
|
+
'punctuation'
|
|
118
|
+
],
|
|
119
|
+
settings: {
|
|
120
|
+
foreground: syntax.punctuation
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
scope: [
|
|
125
|
+
'markup.inserted'
|
|
126
|
+
],
|
|
127
|
+
settings: {
|
|
128
|
+
foreground: syntax.inserted
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
scope: [
|
|
133
|
+
'markup.deleted'
|
|
134
|
+
],
|
|
135
|
+
settings: {
|
|
136
|
+
foreground: syntax.deleted
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export { createCodeHighlighter, createCodeTheme };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './code-shiki/index.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pluginExtends } from "@fluxdown/vue-base-plugins/base";
|
|
2
|
+
import { EffectChunkPlugin } from "@fluxdown/vue-base-plugins/plugins/effect-chunk";
|
|
3
|
+
import { EffectChunkSlotPlugin } from "./slot/index.js";
|
|
4
|
+
|
|
5
|
+
export * from "./slot/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const effect_chunk_EffectChunkPlugin = /*#__PURE__*/ pluginExtends(EffectChunkPlugin, {
|
|
14
|
+
slots: [
|
|
15
|
+
EffectChunkSlotPlugin
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { effect_chunk_EffectChunkPlugin as EffectChunkPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IPluggableConfig } from '@fluxdown/types';
|
|
2
|
+
import { BaseSlotPlugin } from '../../../../base/index.js';
|
|
3
|
+
export * from './renderer/index.js';
|
|
4
|
+
declare global {
|
|
5
|
+
interface VueSlotConfigs {
|
|
6
|
+
'slot-chunk': IPluggableConfig<void>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class EffectChunkSlotPlugin extends BaseSlotPlugin<'Chunk'> {
|
|
10
|
+
static readonly key = "slot-chunk";
|
|
11
|
+
readonly Component: import("vue").DefineSetupFnComponent<import("./renderer/index.js").ChunkRendererProps, {}, {}, Omit<Omit<import("@fluxdown/vue-base-plugins/base").ChunkProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes & {
|
|
12
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").ChunkProps, "Raw" | keyof import("../../../../base/index.js").SlotBaseAttributes> & import("../../../../base/index.js").SlotBaseAttributes>;
|
|
13
|
+
}, "Raw"> & {
|
|
14
|
+
Raw?: import("../../../../base/index.js").ChunkProps['Raw'];
|
|
15
|
+
} & {}, import("vue").PublicProps>;
|
|
16
|
+
readonly type = "Chunk";
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseSlotPlugin } from "../../../../base/index.js";
|
|
2
|
+
import { ChunkRenderer } from "./renderer/index.js";
|
|
3
|
+
|
|
4
|
+
export * from "./renderer/index.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EffectChunkSlotPlugin extends BaseSlotPlugin {
|
|
11
|
+
static key = 'slot-chunk';
|
|
12
|
+
Component = ChunkRenderer;
|
|
13
|
+
type = 'Chunk';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { EffectChunkSlotPlugin };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChunkProps } from '../../../../../base/index.js';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
export type ChunkRendererProps = Omit<ChunkProps, 'Raw'> & {
|
|
4
|
+
Raw?: ChunkProps['Raw'];
|
|
5
|
+
};
|
|
6
|
+
export declare const ChunkRenderer: import("vue").DefineSetupFnComponent<ChunkRendererProps, {}, {}, Omit<Omit<import("@fluxdown/vue-base-plugins/base").ChunkProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes & {
|
|
7
|
+
Raw: import("@fluxdown/vue-base-plugins/base").SlotPositionType<Omit<import("@fluxdown/vue-base-plugins/base").ChunkProps, "Raw" | keyof import("../../../../../base/index.js").SlotBaseAttributes> & import("../../../../../base/index.js").SlotBaseAttributes>;
|
|
8
|
+
}, "Raw"> & {
|
|
9
|
+
Raw?: ChunkProps['Raw'];
|
|
10
|
+
} & {}, import("vue").PublicProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { computed, createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { getTime } from "@fluxdown/utils";
|
|
3
|
+
import { AnimatedText, TextAnimationProvider, joinClassNames, useTextStyle } from "../../../../../base/index.js";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const ChunkRenderer = /*#__PURE__*/ defineComponent((props, { attrs, slots })=>{
|
|
16
|
+
const delay = computed(()=>props.start >= 0 ? Math.min(0, props.start - getTime()) : 0);
|
|
17
|
+
const animation = computed(()=>props.start >= 0 ? {
|
|
18
|
+
arrival: Date.now() + props.start - getTime(),
|
|
19
|
+
duration: props.duration
|
|
20
|
+
} : null);
|
|
21
|
+
return ()=>{
|
|
22
|
+
const { Raw: _Raw, children, start, duration, class: className, style, ...elementProps } = props;
|
|
23
|
+
const textStyle = useTextStyle(style);
|
|
24
|
+
const active = start >= 0 && delay.value > -duration;
|
|
25
|
+
return createVNode(TextAnimationProvider, {
|
|
26
|
+
"value": animation.value
|
|
27
|
+
}, {
|
|
28
|
+
default: ()=>[
|
|
29
|
+
createVNode(AnimatedText, mergeProps(attrs, elementProps, {
|
|
30
|
+
"class": joinClassNames(active ? 'fluxdown-chunk fluxdown-chunk-active' : 'fluxdown-chunk', className),
|
|
31
|
+
"key": start,
|
|
32
|
+
"style": textStyle
|
|
33
|
+
}), {
|
|
34
|
+
default: ()=>[
|
|
35
|
+
slots.default?.() ?? children
|
|
36
|
+
]
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
name: 'FluxdownChunkRenderer',
|
|
43
|
+
props: [
|
|
44
|
+
'Raw',
|
|
45
|
+
'children',
|
|
46
|
+
'start',
|
|
47
|
+
'duration',
|
|
48
|
+
'class',
|
|
49
|
+
'style'
|
|
50
|
+
],
|
|
51
|
+
inheritAttrs: false
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export { ChunkRenderer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './effect-chunk/index.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EffectScaleRenderPlugin } from "./render/index.js";
|
|
2
|
+
import { EffectScaleSlotPlugin, EffectScaleWordSlotPlugin } from "./slot/index.js";
|
|
3
|
+
|
|
4
|
+
export * from "./render/index.js";
|
|
5
|
+
export * from "./slot/index.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const EffectScalePlugin = {
|
|
13
|
+
renders: [
|
|
14
|
+
EffectScaleRenderPlugin
|
|
15
|
+
],
|
|
16
|
+
slots: [
|
|
17
|
+
EffectScaleSlotPlugin,
|
|
18
|
+
EffectScaleWordSlotPlugin
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { EffectScalePlugin };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPluggableConfig } from '@fluxdown/types';
|
|
2
|
+
import type { VueRenderMatchParams, VueRenderParams } from '@fluxdown/vue-base-plugins/base';
|
|
3
|
+
import { BaseVueRenderPlugin } from '@fluxdown/vue-base-plugins/base';
|
|
4
|
+
declare global {
|
|
5
|
+
interface VueRenderConfigs {
|
|
6
|
+
'render-scale': IPluggableConfig<void>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class EffectScaleRenderPlugin extends BaseVueRenderPlugin {
|
|
10
|
+
static readonly key = "render-scale";
|
|
11
|
+
match({ node }: VueRenderMatchParams): boolean;
|
|
12
|
+
render({ node, renderChildren }: VueRenderParams): import("../../../../jsx-runtime.js").JSX.Element;
|
|
13
|
+
}
|