@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,92 @@
|
|
|
1
|
+
import type { IPluggable } from '@fluxdown/types';
|
|
2
|
+
import type { CodeBlockBaseContent, SlotBaseProps as SharedSlotBaseProps, ISlotPlugin as SharedSlotPlugin, SlotProps as SharedSlotProps, SlotType } from '@fluxdown/vue-base-plugins/base';
|
|
3
|
+
import type { BaseEvent, CSSProperties, StandardProps } from '@lynx-js/types';
|
|
4
|
+
import type { ElementContent, Parent } from 'hast';
|
|
5
|
+
import type { FunctionalComponent, VNodeChild } from 'vue';
|
|
6
|
+
export interface SlotBaseAttributes extends Omit<StandardProps, 'style' | 'children' | 'ref' | 'key' | 'className'> {
|
|
7
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
8
|
+
class?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export interface ImageSlotAttributes {
|
|
12
|
+
onTap?: (params: {
|
|
13
|
+
event: BaseEvent;
|
|
14
|
+
src: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface LinkSlotAttributes {
|
|
18
|
+
onTap?: (params: {
|
|
19
|
+
event: BaseEvent;
|
|
20
|
+
href: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
}
|
|
23
|
+
/** The host performs the clipboard write; Lynx does not provide a universal clipboard API. */
|
|
24
|
+
export type CodeBlockHandleCopyFunction = (content: CodeBlockBaseContent) => void | Promise<void>;
|
|
25
|
+
type NodeProps = {
|
|
26
|
+
current: ElementContent;
|
|
27
|
+
parents: Parent[];
|
|
28
|
+
render: (node: ElementContent) => VNodeChild;
|
|
29
|
+
};
|
|
30
|
+
interface ExtraProps {
|
|
31
|
+
Image: ImageSlotAttributes;
|
|
32
|
+
Link: LinkSlotAttributes;
|
|
33
|
+
CodeBlock: NodeProps & {
|
|
34
|
+
onCopy?: CodeBlockHandleCopyFunction;
|
|
35
|
+
};
|
|
36
|
+
CodeHeader: {
|
|
37
|
+
onCopy?: CodeBlockHandleCopyFunction;
|
|
38
|
+
};
|
|
39
|
+
Table: NodeProps & {
|
|
40
|
+
columns: number;
|
|
41
|
+
};
|
|
42
|
+
TableCell: NodeProps;
|
|
43
|
+
Element: NodeProps & {
|
|
44
|
+
checked?: boolean;
|
|
45
|
+
start?: number;
|
|
46
|
+
columns?: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export type SlotProps = SharedSlotProps<SlotBaseAttributes, ExtraProps>;
|
|
50
|
+
export type BlockquoteProps = SlotProps['Blockquote'];
|
|
51
|
+
export type BreakLineProps = SlotProps['BreakLine'];
|
|
52
|
+
export type CodeBlockProps = SlotProps['CodeBlock'];
|
|
53
|
+
export type CodeHeaderProps = SlotProps['CodeHeader'];
|
|
54
|
+
export type CodeHighlighterProps = SlotProps['CodeHighlighter'];
|
|
55
|
+
export type EmphasisProps = SlotProps['Emphasis'];
|
|
56
|
+
export type HeadingProps = SlotProps['Heading'];
|
|
57
|
+
export type ImageProps = SlotProps['Image'];
|
|
58
|
+
export type LinkProps = SlotProps['Link'];
|
|
59
|
+
export type ListProps = SlotProps['List'];
|
|
60
|
+
export type ParagraphProps = SlotProps['Paragraph'];
|
|
61
|
+
export type StrongProps = SlotProps['Strong'];
|
|
62
|
+
export type TableProps = SlotProps['Table'];
|
|
63
|
+
export type TableCellProps = SlotProps['TableCell'];
|
|
64
|
+
export type ElementProps = SlotProps['Element'];
|
|
65
|
+
export type ChunkProps = SlotProps['Chunk'];
|
|
66
|
+
export type ScaleProps = SlotProps['Scale'];
|
|
67
|
+
export type ScaleWordProps = SlotProps['ScaleWord'];
|
|
68
|
+
export type ShadProps = SlotProps['Shad'];
|
|
69
|
+
export type SuffixProps = SlotProps['Suffix'];
|
|
70
|
+
export type TexProps = SlotProps['Tex'];
|
|
71
|
+
export type FallbackProps = SlotProps['Fallback'];
|
|
72
|
+
export type WrapperProps = SlotProps['Wrapper'];
|
|
73
|
+
export type SlotBaseProps<T extends object = {}, HasChildren extends boolean = false, HasNode extends boolean = false> = SharedSlotBaseProps<T, HasChildren, HasNode, SlotBaseAttributes>;
|
|
74
|
+
export type SlotInputProps<T extends SlotType = SlotType> = {
|
|
75
|
+
[K in T]: Omit<SlotProps[K], 'Raw'>;
|
|
76
|
+
}[T];
|
|
77
|
+
export type ISlotPlugin<T extends SlotType> = SharedSlotPlugin<T, SlotProps[T]>;
|
|
78
|
+
export type ISlotPluggable<T extends SlotType, O = unknown> = IPluggable<ISlotPlugin<T>, O>;
|
|
79
|
+
declare global {
|
|
80
|
+
interface VueSlotConfigs {
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export type AnySlotPlugin = {
|
|
84
|
+
[T in SlotType]: ISlotPlugin<T>;
|
|
85
|
+
}[SlotType];
|
|
86
|
+
export type AnySlotPluggable<O = unknown> = IPluggable<AnySlotPlugin, O>;
|
|
87
|
+
export type Slots = {
|
|
88
|
+
[T in SlotType]: ISlotPlugin<T>[];
|
|
89
|
+
};
|
|
90
|
+
export type RuntimeSlotProps = SlotProps[SlotType];
|
|
91
|
+
export type RuntimeSlotInputComponent = FunctionalComponent<SlotInputProps>;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const joinClassNames: (...names: (string | undefined | false)[]) => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const normalizePublicUrl = (value, { allowHash = false, allowMailto = false } = {})=>{
|
|
2
|
+
const source = value?.trim();
|
|
3
|
+
if (!source || [
|
|
4
|
+
...source
|
|
5
|
+
].some((character)=>character.charCodeAt(0) <= 32 || character.charCodeAt(0) === 127)) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (source.startsWith('#')) {
|
|
9
|
+
return allowHash ? source : undefined;
|
|
10
|
+
}
|
|
11
|
+
const scheme = /^([a-z][a-z\d+.-]*):/i.exec(source)?.[1]?.toLowerCase();
|
|
12
|
+
if (!scheme) {
|
|
13
|
+
return source;
|
|
14
|
+
}
|
|
15
|
+
if (allowMailto && scheme === 'mailto') {
|
|
16
|
+
return source.slice(7) ? source : undefined;
|
|
17
|
+
}
|
|
18
|
+
return (scheme === 'https' || scheme === 'http') && /^https?:\/\/[^/\s]+/i.test(source) ? source : undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { normalizePublicUrl };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
+
import type { ComputedRef, VNodeChild } from 'vue';
|
|
3
|
+
import type { Theme, ThemeConfig } from './type.js';
|
|
4
|
+
export * from './type.js';
|
|
5
|
+
export * from './presets/index.js';
|
|
6
|
+
export * from './utils.js';
|
|
7
|
+
export declare const useThemeConfig: (source?: () => Theme) => ComputedRef<ThemeConfig>;
|
|
8
|
+
export declare const useTheme: () => ThemeConfig;
|
|
9
|
+
export declare const getTextStyle: ({ tokens }: ThemeConfig) => CSSProperties;
|
|
10
|
+
export declare const useTextStyle: (override?: CSSProperties) => CSSProperties;
|
|
11
|
+
export declare const TextStyleProvider: import("vue").DefineSetupFnComponent<{
|
|
12
|
+
value: CSSProperties;
|
|
13
|
+
children?: VNodeChild;
|
|
14
|
+
}, {}, {}, {
|
|
15
|
+
value: CSSProperties;
|
|
16
|
+
children?: VNodeChild;
|
|
17
|
+
} & {}, import("vue").PublicProps>;
|
|
18
|
+
export declare const ThemeProvider: import("vue").DefineSetupFnComponent<{
|
|
19
|
+
value: ThemeConfig;
|
|
20
|
+
children?: VNodeChild;
|
|
21
|
+
}, {}, {}, {
|
|
22
|
+
value: ThemeConfig;
|
|
23
|
+
children?: VNodeChild;
|
|
24
|
+
} & {}, import("vue").PublicProps>;
|
|
25
|
+
export declare const useTextStyleSource: (override?: () => CSSProperties | undefined) => ComputedRef<CSSProperties>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { computed, defineComponent, inject, provide } from "vue";
|
|
2
|
+
import { useTextAnimation } from "../context/index.js";
|
|
3
|
+
import { LIGHT_THEME } from "./presets/light.js";
|
|
4
|
+
import { resolveTheme } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
export * from "./type.js";
|
|
7
|
+
export * from "./presets/index.js";
|
|
8
|
+
export * from "./utils.js";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const ThemeContext = /*#__PURE__*/ Symbol('FluxdownTheme');
|
|
21
|
+
const TextStyleContext = /*#__PURE__*/ Symbol('FluxdownTextStyle');
|
|
22
|
+
const useThemeConfig = (source = ()=>'light')=>computed(()=>resolveTheme(source()));
|
|
23
|
+
const useTheme = ()=>inject(ThemeContext, null)?.value ?? LIGHT_THEME;
|
|
24
|
+
const getTextStyle = ({ tokens })=>({
|
|
25
|
+
color: tokens.colors.fg,
|
|
26
|
+
fontFamily: tokens.typography.fontSans,
|
|
27
|
+
fontSize: tokens.typography.fontSize.md,
|
|
28
|
+
fontWeight: String(tokens.typography.fontWeight.normal),
|
|
29
|
+
fontStyle: 'normal',
|
|
30
|
+
lineHeight: tokens.typography.lineHeight.md
|
|
31
|
+
});
|
|
32
|
+
const useTextStyle = (override)=>{
|
|
33
|
+
const inherited = inject(TextStyleContext, null)?.value;
|
|
34
|
+
const animation = useTextAnimation();
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const resolved = {
|
|
37
|
+
...inherited ?? getTextStyle(theme),
|
|
38
|
+
...override
|
|
39
|
+
};
|
|
40
|
+
return animation && !('arrival' in animation) ? {
|
|
41
|
+
...resolved,
|
|
42
|
+
...animation,
|
|
43
|
+
'--fluxdown-text-color': resolved.color
|
|
44
|
+
} : resolved;
|
|
45
|
+
};
|
|
46
|
+
const TextStyleProvider = /*#__PURE__*/ defineComponent((props, { slots })=>{
|
|
47
|
+
provide(TextStyleContext, computed(()=>props.value));
|
|
48
|
+
return ()=>slots.default?.() ?? props.children;
|
|
49
|
+
}, {
|
|
50
|
+
name: 'FluxdownTextStyleProvider',
|
|
51
|
+
props: [
|
|
52
|
+
'value',
|
|
53
|
+
'children'
|
|
54
|
+
],
|
|
55
|
+
inheritAttrs: false
|
|
56
|
+
});
|
|
57
|
+
const ThemeProvider = /*#__PURE__*/ defineComponent((props, { slots })=>{
|
|
58
|
+
provide(ThemeContext, computed(()=>props.value));
|
|
59
|
+
provide(TextStyleContext, computed(()=>getTextStyle(props.value)));
|
|
60
|
+
return ()=>slots.default?.() ?? props.children;
|
|
61
|
+
}, {
|
|
62
|
+
name: 'FluxdownThemeProvider',
|
|
63
|
+
props: [
|
|
64
|
+
'value',
|
|
65
|
+
'children'
|
|
66
|
+
],
|
|
67
|
+
inheritAttrs: false
|
|
68
|
+
});
|
|
69
|
+
const useTextStyleSource = (override = ()=>undefined)=>{
|
|
70
|
+
const inherited = inject(TextStyleContext, null);
|
|
71
|
+
const theme = inject(ThemeContext, null);
|
|
72
|
+
return computed(()=>({
|
|
73
|
+
...inherited?.value ?? getTextStyle(theme?.value ?? LIGHT_THEME),
|
|
74
|
+
...override()
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { TextStyleProvider, ThemeProvider, getTextStyle, useTextStyle, useTextStyleSource, useTheme, useThemeConfig };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { PREFIX } from "../../consts/index.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const BASE_TOKENS = {
|
|
6
|
+
typography: {
|
|
7
|
+
fontSans: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif",
|
|
8
|
+
fontMono: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
|
|
9
|
+
fontSmoothing: 'antialiased',
|
|
10
|
+
fontSize: {
|
|
11
|
+
xs: '12px',
|
|
12
|
+
sm: '14px',
|
|
13
|
+
md: '16px'
|
|
14
|
+
},
|
|
15
|
+
lineHeight: {
|
|
16
|
+
sm: 1.4,
|
|
17
|
+
md: 1.65,
|
|
18
|
+
lg: 1.8
|
|
19
|
+
},
|
|
20
|
+
fontWeight: {
|
|
21
|
+
normal: 400,
|
|
22
|
+
medium: 600,
|
|
23
|
+
bold: 650
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
heading: {
|
|
27
|
+
h1: {
|
|
28
|
+
fontSize: '32px',
|
|
29
|
+
fontWeight: 650,
|
|
30
|
+
lineHeight: 1.25,
|
|
31
|
+
marginTop: '32px',
|
|
32
|
+
marginBottom: '16px'
|
|
33
|
+
},
|
|
34
|
+
h2: {
|
|
35
|
+
fontSize: '24px',
|
|
36
|
+
fontWeight: 650,
|
|
37
|
+
lineHeight: 1.3,
|
|
38
|
+
marginTop: '28px',
|
|
39
|
+
marginBottom: '14px'
|
|
40
|
+
},
|
|
41
|
+
h3: {
|
|
42
|
+
fontSize: '20px',
|
|
43
|
+
fontWeight: 600,
|
|
44
|
+
lineHeight: 1.4,
|
|
45
|
+
marginTop: '24px',
|
|
46
|
+
marginBottom: '12px'
|
|
47
|
+
},
|
|
48
|
+
h4: {
|
|
49
|
+
fontSize: '18px',
|
|
50
|
+
fontWeight: 600,
|
|
51
|
+
lineHeight: 1.4,
|
|
52
|
+
marginTop: '20px',
|
|
53
|
+
marginBottom: '10px'
|
|
54
|
+
},
|
|
55
|
+
h5: {
|
|
56
|
+
fontSize: '16px',
|
|
57
|
+
fontWeight: 600,
|
|
58
|
+
lineHeight: 1.5,
|
|
59
|
+
marginTop: '16px',
|
|
60
|
+
marginBottom: '8px'
|
|
61
|
+
},
|
|
62
|
+
h6: {
|
|
63
|
+
fontSize: '14px',
|
|
64
|
+
fontWeight: 600,
|
|
65
|
+
lineHeight: 1.5,
|
|
66
|
+
marginTop: '16px',
|
|
67
|
+
marginBottom: '8px'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
paragraph: {
|
|
71
|
+
marginTop: '0',
|
|
72
|
+
marginBottom: '16px'
|
|
73
|
+
},
|
|
74
|
+
code: {
|
|
75
|
+
fontSize: '14px',
|
|
76
|
+
lineHeight: 1.65
|
|
77
|
+
},
|
|
78
|
+
inlineCode: {
|
|
79
|
+
paddingBlock: '0.15em',
|
|
80
|
+
paddingInline: '0.35em',
|
|
81
|
+
border: `1px solid var(--${PREFIX}-colors-border)`,
|
|
82
|
+
borderRadius: `var(--${PREFIX}-radius-sm)`,
|
|
83
|
+
background: `var(--${PREFIX}-colors-surface-muted)`,
|
|
84
|
+
fontFamily: `var(--${PREFIX}-typography-font-mono)`,
|
|
85
|
+
fontSize: '0.875em',
|
|
86
|
+
whiteSpace: 'normal'
|
|
87
|
+
},
|
|
88
|
+
divider: {
|
|
89
|
+
height: '1px',
|
|
90
|
+
marginBlock: `var(--${PREFIX}-spacing-xl)`,
|
|
91
|
+
marginInline: '0',
|
|
92
|
+
border: '0',
|
|
93
|
+
borderBlockEnd: `var(--${PREFIX}-divider-border)`,
|
|
94
|
+
background: `var(--${PREFIX}-colors-border)`
|
|
95
|
+
},
|
|
96
|
+
footnotes: {
|
|
97
|
+
marginTop: `var(--${PREFIX}-spacing-xl)`,
|
|
98
|
+
paddingTop: `var(--${PREFIX}-spacing-lg)`,
|
|
99
|
+
borderTop: `1px solid var(--${PREFIX}-colors-border)`,
|
|
100
|
+
color: `var(--${PREFIX}-colors-fg-muted)`,
|
|
101
|
+
fontSize: `var(--${PREFIX}-typography-font-size-sm)`
|
|
102
|
+
},
|
|
103
|
+
radius: {
|
|
104
|
+
sm: '4px',
|
|
105
|
+
md: '8px',
|
|
106
|
+
lg: '14px'
|
|
107
|
+
},
|
|
108
|
+
spacing: {
|
|
109
|
+
xs: '4px',
|
|
110
|
+
sm: '8px',
|
|
111
|
+
md: '12px',
|
|
112
|
+
lg: '16px',
|
|
113
|
+
xl: '24px'
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export { BASE_TOKENS };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BASE_TOKENS } from "./base.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const DARK_THEME = {
|
|
6
|
+
tokens: {
|
|
7
|
+
...BASE_TOKENS,
|
|
8
|
+
colors: {
|
|
9
|
+
fg: '#ececf1',
|
|
10
|
+
fgMuted: '#a6a8b0',
|
|
11
|
+
bg: '#212121',
|
|
12
|
+
border: '#3c3e42',
|
|
13
|
+
accent: '#82b7ff',
|
|
14
|
+
accentHover: '#b1d2ff',
|
|
15
|
+
surfaceMuted: '#353639',
|
|
16
|
+
surfaceSubtle: '#292a2d',
|
|
17
|
+
borderEmphasis: '#666970'
|
|
18
|
+
},
|
|
19
|
+
syntax: {
|
|
20
|
+
comment: '#9da7b3',
|
|
21
|
+
keyword: '#ff7b72',
|
|
22
|
+
string: '#a5d6ff',
|
|
23
|
+
number: '#79c0ff',
|
|
24
|
+
function: '#d2a8ff',
|
|
25
|
+
variable: '#ffa657',
|
|
26
|
+
punctuation: '#c9d1d9',
|
|
27
|
+
inserted: '#7ee787',
|
|
28
|
+
deleted: '#ffa198'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { DARK_THEME };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BASE_TOKENS } from "./base.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const LIGHT_THEME = {
|
|
6
|
+
tokens: {
|
|
7
|
+
...BASE_TOKENS,
|
|
8
|
+
colors: {
|
|
9
|
+
fg: '#202123',
|
|
10
|
+
fgMuted: '#64676b',
|
|
11
|
+
bg: '#ffffff',
|
|
12
|
+
border: '#e5e7eb',
|
|
13
|
+
accent: '#0969da',
|
|
14
|
+
accentHover: '#0550ae',
|
|
15
|
+
surfaceMuted: '#f1f2f4',
|
|
16
|
+
surfaceSubtle: '#f7f8fa',
|
|
17
|
+
borderEmphasis: '#b5bac1'
|
|
18
|
+
},
|
|
19
|
+
syntax: {
|
|
20
|
+
comment: '#6e7781',
|
|
21
|
+
keyword: '#cf222e',
|
|
22
|
+
string: '#0a3069',
|
|
23
|
+
number: '#0550ae',
|
|
24
|
+
function: '#8250df',
|
|
25
|
+
variable: '#953800',
|
|
26
|
+
punctuation: '#57606a',
|
|
27
|
+
inserted: '#116329',
|
|
28
|
+
deleted: '#a40e26'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { LIGHT_THEME };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export interface ThemeTokens {
|
|
2
|
+
/**
|
|
3
|
+
* Foreground, background, border, and interaction colors.
|
|
4
|
+
*/
|
|
5
|
+
colors: {
|
|
6
|
+
fg: string;
|
|
7
|
+
fgMuted: string;
|
|
8
|
+
bg: string;
|
|
9
|
+
border: string;
|
|
10
|
+
accent: string;
|
|
11
|
+
/** Available to host slots; built-in native links have no hover state. */
|
|
12
|
+
accentHover: string;
|
|
13
|
+
surfaceMuted: string;
|
|
14
|
+
surfaceSubtle: string;
|
|
15
|
+
borderEmphasis: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Shared font families, sizes, line heights, and weights.
|
|
19
|
+
*/
|
|
20
|
+
typography: {
|
|
21
|
+
fontSans: string;
|
|
22
|
+
fontMono: string;
|
|
23
|
+
/** Compatibility token; native text rasterization is controlled by the host. */
|
|
24
|
+
fontSmoothing: string;
|
|
25
|
+
fontSize: {
|
|
26
|
+
xs: string;
|
|
27
|
+
sm: string;
|
|
28
|
+
md: string;
|
|
29
|
+
};
|
|
30
|
+
lineHeight: {
|
|
31
|
+
sm: number | string;
|
|
32
|
+
md: number | string;
|
|
33
|
+
lg: number | string;
|
|
34
|
+
};
|
|
35
|
+
fontWeight: {
|
|
36
|
+
normal: number | string;
|
|
37
|
+
medium: number | string;
|
|
38
|
+
bold: number | string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Typography and spacing for each heading level.
|
|
43
|
+
*/
|
|
44
|
+
heading: Record<'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', HeadingThemeTokens>;
|
|
45
|
+
/**
|
|
46
|
+
* Vertical spacing around paragraphs.
|
|
47
|
+
*/
|
|
48
|
+
paragraph: {
|
|
49
|
+
marginTop: string;
|
|
50
|
+
marginBottom: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Font size and line height for fenced code blocks.
|
|
54
|
+
*/
|
|
55
|
+
code: {
|
|
56
|
+
fontSize: string;
|
|
57
|
+
lineHeight: number | string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Presentation of inline code outside preformatted blocks.
|
|
61
|
+
*/
|
|
62
|
+
inlineCode: {
|
|
63
|
+
paddingBlock: string;
|
|
64
|
+
paddingInline: string;
|
|
65
|
+
border: string;
|
|
66
|
+
borderRadius: string;
|
|
67
|
+
background: string;
|
|
68
|
+
fontFamily: string;
|
|
69
|
+
fontSize: string;
|
|
70
|
+
/** Native text supports normal and nowrap; other values use normal. */
|
|
71
|
+
whiteSpace: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Dimensions, spacing, and borders of thematic breaks.
|
|
75
|
+
*/
|
|
76
|
+
divider: {
|
|
77
|
+
height: string;
|
|
78
|
+
marginBlock: string;
|
|
79
|
+
marginInline: string;
|
|
80
|
+
border: string;
|
|
81
|
+
borderBlockEnd: string;
|
|
82
|
+
background: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Spacing, border, and typography of the footnotes section.
|
|
86
|
+
*/
|
|
87
|
+
footnotes: {
|
|
88
|
+
marginTop: string;
|
|
89
|
+
paddingTop: string;
|
|
90
|
+
borderTop: string;
|
|
91
|
+
color: string;
|
|
92
|
+
fontSize: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Colors for syntax highlighting token categories.
|
|
96
|
+
*/
|
|
97
|
+
syntax: {
|
|
98
|
+
comment: string;
|
|
99
|
+
keyword: string;
|
|
100
|
+
string: string;
|
|
101
|
+
number: string;
|
|
102
|
+
function: string;
|
|
103
|
+
variable: string;
|
|
104
|
+
punctuation: string;
|
|
105
|
+
inserted: string;
|
|
106
|
+
deleted: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Border radii shared by slot containers and controls.
|
|
110
|
+
*/
|
|
111
|
+
radius: {
|
|
112
|
+
sm: string;
|
|
113
|
+
md: string;
|
|
114
|
+
lg: string;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Spacing scale for margins, padding, and gaps.
|
|
118
|
+
*/
|
|
119
|
+
spacing: {
|
|
120
|
+
xs: string;
|
|
121
|
+
sm: string;
|
|
122
|
+
md: string;
|
|
123
|
+
lg: string;
|
|
124
|
+
xl: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface HeadingThemeTokens {
|
|
128
|
+
fontSize: string;
|
|
129
|
+
fontWeight: number;
|
|
130
|
+
lineHeight: number | string;
|
|
131
|
+
marginTop: string;
|
|
132
|
+
marginBottom: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ThemeConfig {
|
|
135
|
+
tokens: ThemeTokens;
|
|
136
|
+
}
|
|
137
|
+
export type PartialThemeConfig<T = ThemeConfig> = {
|
|
138
|
+
[K in keyof T]?: T[K] extends object ? PartialThemeConfig<T[K]> : T[K];
|
|
139
|
+
};
|
|
140
|
+
export type PresetKeys = 'light' | 'dark';
|
|
141
|
+
export type Theme = PresetKeys | PartialThemeConfig | [PresetKeys, PartialThemeConfig];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forOwn, isArray, isObject, isString, merge, replace, toLower, toString as external_lodash_es_toString } from "lodash-es";
|
|
2
|
+
import { PREFIX } from "../consts/index.js";
|
|
3
|
+
import { PRESET_THEME_MAP } from "./presets/index.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const isThemeTuple = (theme)=>isArray(theme);
|
|
12
|
+
const resolveTheme = (theme = 'light')=>{
|
|
13
|
+
if (isString(theme)) {
|
|
14
|
+
return PRESET_THEME_MAP[theme];
|
|
15
|
+
}
|
|
16
|
+
const [preset, overrides] = isThemeTuple(theme) ? theme : [
|
|
17
|
+
'light',
|
|
18
|
+
theme
|
|
19
|
+
];
|
|
20
|
+
return merge({}, PRESET_THEME_MAP[preset], overrides);
|
|
21
|
+
};
|
|
22
|
+
const mapTokensToStyles = (tokens)=>{
|
|
23
|
+
const styles = {};
|
|
24
|
+
const visit = (value, path)=>{
|
|
25
|
+
forOwn(value, (token, key)=>{
|
|
26
|
+
const name = `${path}-${replace(key, /[A-Z]/g, (letter)=>`-${toLower(letter)}`)}`;
|
|
27
|
+
if (isObject(token)) {
|
|
28
|
+
visit(token, name);
|
|
29
|
+
} else {
|
|
30
|
+
styles[name] = external_lodash_es_toString(token);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
visit(tokens, `--${PREFIX}`);
|
|
35
|
+
return styles;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { mapTokensToStyles, resolveTheme };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@rsbuild/core/types" />
|