@fluxdown/solid 0.0.0-stage → 0.2.0
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 +17 -0
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/dist/cjs/assets/raw-Dob3BCyv.css +56 -0
- package/dist/cjs/chunks/raw-DlzW8_Im.cjs +609 -0
- package/dist/cjs/components/block-reconciler/index.d.cts +2 -0
- package/dist/cjs/components/block-reconciler/type.d.cts +22 -0
- package/dist/cjs/components/block-reconciler/utils.d.cts +2 -0
- package/dist/cjs/components/index.d.cts +2 -0
- package/dist/cjs/components/root-reconciler/index.d.cts +6 -0
- package/dist/cjs/consts/config.d.cts +2 -0
- package/dist/cjs/consts/defaults.d.cts +2 -0
- package/dist/cjs/consts/index.d.cts +4 -0
- package/dist/cjs/consts/smooth.d.cts +3 -0
- package/dist/cjs/consts/styles.d.cts +1 -0
- package/dist/cjs/context/index.d.cts +1 -0
- package/dist/cjs/context/render/index.d.cts +6 -0
- package/dist/cjs/env.d.cts +1 -0
- package/dist/cjs/full.browser.cjs +2 -0
- package/dist/cjs/full.cjs +13 -0
- package/dist/cjs/hooks/index.d.cts +1 -0
- package/dist/cjs/hooks/plugins.d.cts +6 -0
- package/dist/cjs/lite.browser.cjs +2 -0
- package/dist/cjs/lite.cjs +13 -0
- package/dist/cjs/modules/index.d.cts +1 -0
- package/dist/cjs/modules/solid-renderer/index.d.cts +9 -0
- package/dist/cjs/modules/solid-renderer/type.d.cts +4 -0
- package/dist/cjs/packs/full/index.d.cts +5 -0
- package/dist/cjs/packs/full/type.d.cts +3 -0
- package/dist/cjs/packs/lite/index.d.cts +5 -0
- package/dist/cjs/packs/lite/type.d.cts +3 -0
- package/dist/cjs/packs/raw/index.d.cts +5 -0
- package/dist/cjs/packs/raw/type.d.cts +77 -0
- package/dist/cjs/packs/raw/utils.d.cts +2 -0
- package/dist/cjs/packs/utils/config.d.cts +13 -0
- package/dist/cjs/packs/utils/effect.d.cts +4 -0
- package/dist/cjs/packs/utils/index.d.cts +3 -0
- package/dist/cjs/packs/utils/patches.d.cts +2 -0
- package/dist/cjs/raw.browser.cjs +2 -0
- package/dist/cjs/raw.cjs +3 -0
- package/dist/cjs/server/full.cjs +13 -0
- package/dist/cjs/server/lite.cjs +13 -0
- package/dist/cjs/server/raw.cjs +593 -0
- package/dist/cjs/styles.css +2 -0
- package/dist/cjs/theme/consts.d.cts +4 -0
- package/dist/cjs/theme/hooks.d.cts +2 -0
- package/dist/cjs/theme/index.d.cts +1 -0
- package/dist/cjs/theme/presets/base.d.cts +2 -0
- package/dist/cjs/theme/presets/dark.d.cts +2 -0
- package/dist/cjs/theme/presets/index.d.cts +4 -0
- package/dist/cjs/theme/presets/light.d.cts +2 -0
- package/dist/cjs/theme/utils.d.cts +4 -0
- package/dist/cjs/types/index.d.cts +2 -0
- package/dist/cjs/types/theme.d.cts +138 -0
- package/dist/esm/assets/raw-Dob3BCyv.css +56 -0
- package/dist/esm/chunks/raw-ULd4Y10B.js +598 -0
- package/dist/esm/components/block-reconciler/index.d.ts +2 -0
- package/dist/esm/components/block-reconciler/type.d.ts +22 -0
- package/dist/esm/components/block-reconciler/utils.d.ts +2 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/root-reconciler/index.d.ts +6 -0
- package/dist/esm/consts/config.d.ts +2 -0
- package/dist/esm/consts/defaults.d.ts +2 -0
- package/dist/esm/consts/index.d.ts +4 -0
- package/dist/esm/consts/smooth.d.ts +3 -0
- package/dist/esm/consts/styles.d.ts +1 -0
- package/dist/esm/context/index.d.ts +1 -0
- package/dist/esm/context/render/index.d.ts +6 -0
- package/dist/esm/env.d.ts +1 -0
- package/dist/esm/full.browser.js +2 -0
- package/dist/esm/full.js +12 -0
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/plugins.d.ts +6 -0
- package/dist/esm/lite.browser.js +2 -0
- package/dist/esm/lite.js +12 -0
- package/dist/esm/modules/index.d.ts +1 -0
- package/dist/esm/modules/solid-renderer/index.d.ts +9 -0
- package/dist/esm/modules/solid-renderer/type.d.ts +4 -0
- package/dist/esm/packs/full/index.d.ts +5 -0
- package/dist/esm/packs/full/type.d.ts +3 -0
- package/dist/esm/packs/lite/index.d.ts +5 -0
- package/dist/esm/packs/lite/type.d.ts +3 -0
- package/dist/esm/packs/raw/index.d.ts +5 -0
- package/dist/esm/packs/raw/type.d.ts +77 -0
- package/dist/esm/packs/raw/utils.d.ts +2 -0
- package/dist/esm/packs/utils/config.d.ts +13 -0
- package/dist/esm/packs/utils/effect.d.ts +4 -0
- package/dist/esm/packs/utils/index.d.ts +3 -0
- package/dist/esm/packs/utils/patches.d.ts +2 -0
- package/dist/esm/raw.browser.js +2 -0
- package/dist/esm/raw.js +2 -0
- package/dist/esm/server/full.js +12 -0
- package/dist/esm/server/lite.js +12 -0
- package/dist/esm/server/raw.js +591 -0
- package/dist/esm/styles.css +2 -0
- package/dist/esm/theme/consts.d.ts +4 -0
- package/dist/esm/theme/hooks.d.ts +2 -0
- package/dist/esm/theme/index.d.ts +1 -0
- package/dist/esm/theme/presets/base.d.ts +2 -0
- package/dist/esm/theme/presets/dark.d.ts +2 -0
- package/dist/esm/theme/presets/index.d.ts +4 -0
- package/dist/esm/theme/presets/light.d.ts +2 -0
- package/dist/esm/theme/utils.d.ts +4 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/types/theme.d.ts +138 -0
- package/package.json +121 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IPluginItem } from '@fluxdown/solid-plugins/typings';
|
|
2
|
+
import type { Accessor } from 'solid-js';
|
|
3
|
+
type PluginChannel = Exclude<keyof IPluginItem, 'config'>;
|
|
4
|
+
export declare const createPlugins: <K extends PluginChannel>(items: Accessor<IPluginItem[]>, type: K) => Accessor<NonNullable<IPluginItem[K]>>;
|
|
5
|
+
export declare const createMergedPlugins: (presets: IPluginItem[], plugins: Accessor<IPluginItem | IPluginItem[] | undefined>) => Accessor<IPluginItem>;
|
|
6
|
+
export {};
|
package/dist/esm/lite.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as createMergedPlugins, t as FluxdownRaw } from "./chunks/raw-ULd4Y10B.js";
|
|
2
|
+
import { createComponent, mergeProps } from "solid-js/web";
|
|
3
|
+
import { PRESET_LITE_PLUGINS } from "@fluxdown/solid-plugins/lite";
|
|
4
|
+
//#region src/packs/lite/index.tsx
|
|
5
|
+
var FluxdownLite = (props) => {
|
|
6
|
+
const plugins = createMergedPlugins(PRESET_LITE_PLUGINS, () => props.plugins);
|
|
7
|
+
return createComponent(FluxdownRaw, mergeProps(props, { get plugins() {
|
|
8
|
+
return plugins();
|
|
9
|
+
} }));
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FluxdownLite };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './solid-renderer/index.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SolidRenderExtraParams } from '@fluxdown/solid-plugins/base';
|
|
2
|
+
import type { IBlockState } from '@fluxdown/types';
|
|
3
|
+
import type { ElementContent, Parent, Root } from 'hast';
|
|
4
|
+
import type { JSX } from 'solid-js';
|
|
5
|
+
import { BaseRenderer } from '@fluxdown/core';
|
|
6
|
+
export type * from './type.js';
|
|
7
|
+
export declare class SolidRenderer extends BaseRenderer<Root, ElementContent, Parent, JSX.Element, SolidRenderExtraParams> {
|
|
8
|
+
protected renderItem(item: IBlockState<Root>): JSX.Element;
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FluxdownProps } from './type.js';
|
|
2
|
+
export type { BaseBuildConfig, EffectItem, FluxdownRawProps, FluxdownRef, SmoothConfig, StreamingConfig, } from '../raw/index.js';
|
|
3
|
+
export * from '../../types/index.js';
|
|
4
|
+
export * from './type.js';
|
|
5
|
+
export declare const Fluxdown: (props: FluxdownProps) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FluxdownLiteProps } from './type.js';
|
|
2
|
+
export type { BaseBuildConfig, EffectItem, FluxdownRawProps, FluxdownRef, SmoothConfig, StreamingConfig, } from '../raw/index.js';
|
|
3
|
+
export * from '../../types/index.js';
|
|
4
|
+
export * from './type.js';
|
|
5
|
+
export declare const FluxdownLite: (props: FluxdownLiteProps) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { BlockCompilerConfig, IPatchItem, MapperPluggable } from '@fluxdown/core';
|
|
2
|
+
import type { SchedulerType, SmoothSchedulerClass, SmoothTickerClass, TickerType } from '@fluxdown/core-plugins/plugins/mapper/smooth';
|
|
3
|
+
import type { IPluginItem } from '@fluxdown/solid-plugins/typings';
|
|
4
|
+
import type { IPluggableConfig } from '@fluxdown/types';
|
|
5
|
+
import type { JSX } from 'solid-js';
|
|
6
|
+
import type { IReadableClosure } from 'stative';
|
|
7
|
+
import type { Theme } from '../../types/index.js';
|
|
8
|
+
export type BaseBuildConfig = Partial<Omit<BlockCompilerConfig, 'repairEnding'>>;
|
|
9
|
+
export type EffectItem = keyof EffectConfigs | {
|
|
10
|
+
[K in keyof EffectConfigs]: [K, IPluggableConfig<EffectConfigs[K]>];
|
|
11
|
+
}[keyof EffectConfigs] | MapperPluggable;
|
|
12
|
+
export interface SmoothConfig {
|
|
13
|
+
/**
|
|
14
|
+
* Reveal newly compiled content over successive ticks.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Built-in timestamp source name or a custom ticker constructor.
|
|
20
|
+
*/
|
|
21
|
+
ticker: TickerType | SmoothTickerClass;
|
|
22
|
+
/**
|
|
23
|
+
* Built-in progress scheduler name or a custom scheduler constructor.
|
|
24
|
+
*/
|
|
25
|
+
scheduler: SchedulerType | SmoothSchedulerClass;
|
|
26
|
+
}
|
|
27
|
+
export interface StreamingConfig {
|
|
28
|
+
/**
|
|
29
|
+
* Repair incomplete Markdown syntax at the end of the document.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
repairEnding?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Smoothly reveal appended compiled content.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
smooth?: boolean | SmoothConfig;
|
|
38
|
+
/**
|
|
39
|
+
* One effect or an ordered list of effects applied to newly revealed content.
|
|
40
|
+
* Set to true to enable the default scale entrance, or false to disable effects.
|
|
41
|
+
* @default 'scale'
|
|
42
|
+
*/
|
|
43
|
+
effect?: boolean | EffectItem | EffectItem[];
|
|
44
|
+
}
|
|
45
|
+
export interface FluxdownRawProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'ref'> {
|
|
46
|
+
/**
|
|
47
|
+
* Receive the underlying readable Core instance.
|
|
48
|
+
*/
|
|
49
|
+
ref?: (core: FluxdownRef) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Markdown source text to compile and render.
|
|
52
|
+
*/
|
|
53
|
+
text: string;
|
|
54
|
+
/**
|
|
55
|
+
* Static build configuration.
|
|
56
|
+
*/
|
|
57
|
+
build?: BaseBuildConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Streaming effect configuration.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
streaming?: boolean | StreamingConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Inline render patches applied to the Markdown source.
|
|
65
|
+
*/
|
|
66
|
+
patches?: IPatchItem<JSX.Element>[];
|
|
67
|
+
/**
|
|
68
|
+
* One plugin pack or an ordered list extending the compiler and Solid renderer.
|
|
69
|
+
*/
|
|
70
|
+
plugins: IPluginItem | IPluginItem[];
|
|
71
|
+
/**
|
|
72
|
+
* Preset theme, deep partial overrides of light, or a preset/overrides tuple.
|
|
73
|
+
*/
|
|
74
|
+
theme?: Theme;
|
|
75
|
+
}
|
|
76
|
+
/** Readable Core state containing internal renderer blocks. */
|
|
77
|
+
export type FluxdownRef = IReadableClosure<unknown[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BlockCompilerConfig } from '@fluxdown/core';
|
|
2
|
+
import type { BaseSmoothConfig, SchedulerType, SmoothSchedulerClass, SmoothTickerClass, TickerType } from '@fluxdown/core-plugins/plugins/mapper/smooth';
|
|
3
|
+
import type { BaseBuildConfig, SmoothConfig, StreamingConfig } from '../raw/type.js';
|
|
4
|
+
export interface ToBuildConfigParams {
|
|
5
|
+
base: BaseBuildConfig;
|
|
6
|
+
repairEnding: boolean;
|
|
7
|
+
idPrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const getTickerByType: (type: TickerType | SmoothTickerClass) => SmoothTickerClass;
|
|
10
|
+
export declare const getSchedulerByType: (type: SchedulerType | SmoothSchedulerClass) => SmoothSchedulerClass;
|
|
11
|
+
export declare const toSmoothConfig: (config: boolean | SmoothConfig) => BaseSmoothConfig;
|
|
12
|
+
export declare const toStreamingConfig: (config?: boolean | StreamingConfig) => Required<StreamingConfig>;
|
|
13
|
+
export declare const toBuildConfig: ({ base, repairEnding, idPrefix, }: ToBuildConfigParams) => BlockCompilerConfig;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Mapper, MapperPluggable } from '@fluxdown/core';
|
|
2
|
+
import type { EffectItem, StreamingConfig } from '../raw/type.js';
|
|
3
|
+
export declare const toEffects: (effect?: StreamingConfig['effect']) => EffectItem[];
|
|
4
|
+
export declare const toEffectMappers: (effects: EffectItem[], presets: Mapper[]) => MapperPluggable[];
|
package/dist/esm/raw.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FluxdownRaw, t as createMergedPlugins } from "./raw.js";
|
|
2
|
+
import { createComponent, mergeProps } from "solid-js/web";
|
|
3
|
+
import { PRESET_FULL_PLUGINS } from "@fluxdown/solid-plugins/full";
|
|
4
|
+
//#region src/packs/full/index.tsx
|
|
5
|
+
var Fluxdown = (props) => {
|
|
6
|
+
const plugins = createMergedPlugins(PRESET_FULL_PLUGINS, () => props.plugins);
|
|
7
|
+
return createComponent(FluxdownRaw, mergeProps(props, { get plugins() {
|
|
8
|
+
return plugins();
|
|
9
|
+
} }));
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Fluxdown };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FluxdownRaw, t as createMergedPlugins } from "./raw.js";
|
|
2
|
+
import { createComponent, mergeProps } from "solid-js/web";
|
|
3
|
+
import { PRESET_LITE_PLUGINS } from "@fluxdown/solid-plugins/lite";
|
|
4
|
+
//#region src/packs/lite/index.tsx
|
|
5
|
+
var FluxdownLite = (props) => {
|
|
6
|
+
const plugins = createMergedPlugins(PRESET_LITE_PLUGINS, () => props.plugins);
|
|
7
|
+
return createComponent(FluxdownRaw, mergeProps(props, { get plugins() {
|
|
8
|
+
return plugins();
|
|
9
|
+
} }));
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FluxdownLite };
|