@fluxdown/uni-app 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.
Files changed (66) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +16 -2
  4. package/dist/components/block-reconciler/consts.d.ts +3 -0
  5. package/dist/components/block-reconciler/consts.js +15 -0
  6. package/dist/components/block-reconciler/index.d.ts +1 -0
  7. package/dist/components/block-reconciler/index.js +2 -0
  8. package/dist/components/block-reconciler/main.uvue +49 -0
  9. package/dist/components/block-reconciler/main.uvue.d.ts +12 -0
  10. package/dist/components/block-reconciler/spacing.d.ts +4 -0
  11. package/dist/components/block-reconciler/spacing.js +47 -0
  12. package/dist/components/block-reconciler/type.d.ts +24 -0
  13. package/dist/components/block-reconciler/type.js +0 -0
  14. package/dist/components/block-reconciler/utils.d.ts +6 -0
  15. package/dist/components/block-reconciler/utils.js +68 -0
  16. package/dist/components/root-reconciler/index.d.ts +1 -0
  17. package/dist/components/root-reconciler/index.js +2 -0
  18. package/dist/components/root-reconciler/main.uvue +13 -0
  19. package/dist/components/root-reconciler/main.uvue.d.ts +12 -0
  20. package/dist/components/root-reconciler/type.d.ts +5 -0
  21. package/dist/components/root-reconciler/type.js +0 -0
  22. package/dist/consts/config.d.ts +2 -0
  23. package/dist/consts/config.js +11 -0
  24. package/dist/consts/defaults.d.ts +2 -0
  25. package/dist/consts/defaults.js +5 -0
  26. package/dist/consts/index.d.ts +3 -0
  27. package/dist/consts/index.js +4 -0
  28. package/dist/consts/smooth.d.ts +3 -0
  29. package/dist/consts/smooth.js +6 -0
  30. package/dist/context/render/index.d.ts +6 -0
  31. package/dist/context/render/index.js +13 -0
  32. package/dist/hooks/index.d.ts +1 -0
  33. package/dist/hooks/index.js +2 -0
  34. package/dist/hooks/plugins.d.ts +5 -0
  35. package/dist/hooks/plugins.js +23 -0
  36. package/dist/modules/uni-renderer/index.d.ts +7 -0
  37. package/dist/modules/uni-renderer/index.js +20 -0
  38. package/dist/packs/full/index.d.ts +3 -0
  39. package/dist/packs/full/index.js +3 -0
  40. package/dist/packs/full/main.uvue +32 -0
  41. package/dist/packs/full/main.uvue.d.ts +32 -0
  42. package/dist/packs/full/type.d.ts +3 -0
  43. package/dist/packs/full/type.js +0 -0
  44. package/dist/packs/lite/index.d.ts +3 -0
  45. package/dist/packs/lite/index.js +3 -0
  46. package/dist/packs/lite/main.uvue +32 -0
  47. package/dist/packs/lite/main.uvue.d.ts +32 -0
  48. package/dist/packs/lite/type.d.ts +3 -0
  49. package/dist/packs/lite/type.js +0 -0
  50. package/dist/packs/raw/consts.d.ts +30 -0
  51. package/dist/packs/raw/consts.js +28 -0
  52. package/dist/packs/raw/index.d.ts +2 -0
  53. package/dist/packs/raw/index.js +3 -0
  54. package/dist/packs/raw/main.uvue +137 -0
  55. package/dist/packs/raw/main.uvue.d.ts +30 -0
  56. package/dist/packs/raw/type.d.ts +70 -0
  57. package/dist/packs/raw/type.js +0 -0
  58. package/dist/packs/utils/config.d.ts +13 -0
  59. package/dist/packs/utils/config.js +53 -0
  60. package/dist/packs/utils/effect.d.ts +4 -0
  61. package/dist/packs/utils/effect.js +22 -0
  62. package/dist/packs/utils/index.d.ts +3 -0
  63. package/dist/packs/utils/index.js +4 -0
  64. package/dist/packs/utils/patches.d.ts +2 -0
  65. package/dist/packs/utils/patches.js +13 -0
  66. package/package.json +95 -3
@@ -0,0 +1,32 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{
2
+ readonly plugins: {
3
+ readonly required: false;
4
+ readonly type: import("vue").PropType<import(".").FluxdownRawProps["plugins"]>;
5
+ };
6
+ readonly text: {
7
+ readonly type: StringConstructor;
8
+ readonly required: true;
9
+ };
10
+ readonly build: import("vue").PropType<import(".").FluxdownRawProps["build"]>;
11
+ readonly streaming: import("vue").PropType<import(".").FluxdownRawProps["streaming"]>;
12
+ readonly patches: import("vue").PropType<import(".").FluxdownRawProps["patches"]>;
13
+ readonly theme: import("vue").PropType<import(".").FluxdownRawProps["theme"]>;
14
+ }, {
15
+ readonly value: import("stative").IReactiveState<import("@fluxdown/uni-app-plugins/typings").UniRenderNode[]> | undefined;
16
+ destroy(): void;
17
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
+ readonly plugins: {
19
+ readonly required: false;
20
+ readonly type: import("vue").PropType<import(".").FluxdownRawProps["plugins"]>;
21
+ };
22
+ readonly text: {
23
+ readonly type: StringConstructor;
24
+ readonly required: true;
25
+ };
26
+ readonly build: import("vue").PropType<import(".").FluxdownRawProps["build"]>;
27
+ readonly streaming: import("vue").PropType<import(".").FluxdownRawProps["streaming"]>;
28
+ readonly patches: import("vue").PropType<import(".").FluxdownRawProps["patches"]>;
29
+ readonly theme: import("vue").PropType<import(".").FluxdownRawProps["theme"]>;
30
+ }>>, {}, {}>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { PartialBy } from '@fluxdown/utils';
2
+ import type { FluxdownRawProps } from '../raw';
3
+ export type FluxdownLiteProps = PartialBy<FluxdownRawProps, 'plugins'>;
File without changes
@@ -0,0 +1,30 @@
1
+ import type { PropType } from 'vue';
2
+ import type { FluxdownRawProps } from './type';
3
+ export declare const RAW_PROPS: {
4
+ readonly text: {
5
+ readonly type: StringConstructor;
6
+ readonly required: true;
7
+ };
8
+ readonly build: PropType<FluxdownRawProps["build"]>;
9
+ readonly streaming: PropType<FluxdownRawProps["streaming"]>;
10
+ readonly patches: PropType<FluxdownRawProps["patches"]>;
11
+ readonly plugins: {
12
+ readonly type: PropType<FluxdownRawProps["plugins"]>;
13
+ readonly required: true;
14
+ };
15
+ readonly theme: PropType<FluxdownRawProps["theme"]>;
16
+ };
17
+ export declare const PRESET_PROPS: {
18
+ readonly plugins: {
19
+ readonly required: false;
20
+ readonly type: PropType<FluxdownRawProps["plugins"]>;
21
+ };
22
+ readonly text: {
23
+ readonly type: StringConstructor;
24
+ readonly required: true;
25
+ };
26
+ readonly build: PropType<FluxdownRawProps["build"]>;
27
+ readonly streaming: PropType<FluxdownRawProps["streaming"]>;
28
+ readonly patches: PropType<FluxdownRawProps["patches"]>;
29
+ readonly theme: PropType<FluxdownRawProps["theme"]>;
30
+ };
@@ -0,0 +1,28 @@
1
+ //#region src/packs/raw/consts.ts
2
+ var RAW_PROPS = {
3
+ text: {
4
+ type: String,
5
+ required: true
6
+ },
7
+ build: Object,
8
+ streaming: [Boolean, Object],
9
+ patches: Array,
10
+ plugins: {
11
+ type: [Object, Array],
12
+ required: true
13
+ },
14
+ theme: [
15
+ String,
16
+ Object,
17
+ Array
18
+ ]
19
+ };
20
+ var PRESET_PROPS = {
21
+ ...RAW_PROPS,
22
+ plugins: {
23
+ ...RAW_PROPS.plugins,
24
+ required: false
25
+ }
26
+ };
27
+ //#endregion
28
+ export { PRESET_PROPS, RAW_PROPS };
@@ -0,0 +1,2 @@
1
+ export { default as FluxdownRaw } from './main.uvue';
2
+ export * from './type';
@@ -0,0 +1,3 @@
1
+ import "./type.js";
2
+ import FluxdownRaw from "./main.uvue";
3
+ export { FluxdownRaw };
@@ -0,0 +1,137 @@
1
+ <script setup lang="ts">
2
+ import type { MapperPluggable } from '@fluxdown/core';
3
+ import type { PluggableConfigs, PluginSet } from '@fluxdown/types';
4
+ import type { UniRenderExtraParams, UniRenderNode } from '@fluxdown/uni-app-plugins/base';
5
+
6
+ import { Core, isPluggablesEqual, isPluginSetEqual } from '@fluxdown/core';
7
+ import { PRESET_MAPPER_PLUGINS } from '@fluxdown/core-plugins/presets/mapper';
8
+ import {
9
+ getUniProps,
10
+ provideSlots,
11
+ provideTheme,
12
+ useStateOf,
13
+ } from '@fluxdown/uni-app-plugins/base';
14
+ import { castArray, uniqueId } from 'lodash-es';
15
+ import { shallowEqual } from 'shallow-equal';
16
+ import { D, render, S } from 'stative';
17
+ import { computed, onScopeDispose } from 'vue';
18
+
19
+ import { RootReconciler } from '../../components/root-reconciler';
20
+ import { EL, EO } from '../../consts';
21
+ import { provideRender } from '../../context/render';
22
+ import { usePlugins } from '../../hooks';
23
+ import { UniRenderer } from '../../modules/uni-renderer';
24
+ import {
25
+ isPatchesEqual,
26
+ toBuildConfig,
27
+ toEffectMappers,
28
+ toEffects,
29
+ toSmoothConfig,
30
+ toStreamingConfig,
31
+ } from '../utils';
32
+ import { RAW_PROPS } from './consts';
33
+
34
+ defineOptions({ name: 'FluxdownRaw' });
35
+
36
+ const props = defineProps(RAW_PROPS);
37
+
38
+ const streaming = computed(() => toStreamingConfig(props.streaming));
39
+
40
+ const effects = computed(() =>
41
+ toEffectMappers(toEffects(streaming.value.effect), PRESET_MAPPER_PLUGINS),
42
+ );
43
+
44
+ const idPrefix = uniqueId('fluxdown-');
45
+
46
+ const build = useStateOf(
47
+ () =>
48
+ toBuildConfig({
49
+ base: props.build ?? EO,
50
+ repairEnding: streaming.value.repairEnding,
51
+ idPrefix,
52
+ }),
53
+ shallowEqual,
54
+ );
55
+
56
+ const patches = useStateOf(() => props.patches ?? EL, isPatchesEqual);
57
+
58
+ const text = useStateOf(() => props.text);
59
+
60
+ const plugins = computed(() => castArray(props.plugins));
61
+
62
+ const _remarks = usePlugins(() => plugins.value, 'remarks');
63
+
64
+ const _rehypes = usePlugins(() => plugins.value, 'rehypes');
65
+
66
+ const _repairs = usePlugins(() => plugins.value, 'repairs');
67
+
68
+ const _mappers = usePlugins(() => plugins.value, 'mappers');
69
+
70
+ const _renders = usePlugins(() => plugins.value, 'renders');
71
+
72
+ const slots = usePlugins(() => plugins.value, 'slots');
73
+
74
+ const remarks = useStateOf(() => _remarks.value, isPluggablesEqual);
75
+
76
+ const rehypes = useStateOf(() => _rehypes.value, isPluggablesEqual);
77
+
78
+ const repairs = useStateOf(() => _repairs.value, isPluggablesEqual);
79
+
80
+ const mappers = useStateOf<PluginSet<MapperPluggable, PluggableConfigs<MapperConfigs>>>(
81
+ () => [[..._mappers.value, ...effects.value], { smooth: toSmoothConfig(streaming.value.smooth) }],
82
+ isPluginSetEqual,
83
+ );
84
+
85
+ const renders = useStateOf(() => _renders.value, isPluggablesEqual);
86
+
87
+ const core = render(
88
+ S([
89
+ Core<UniRenderNode, UniRenderExtraParams>,
90
+ {
91
+ Renderer: D(UniRenderer),
92
+ build,
93
+ patches,
94
+ rehypes,
95
+ remarks,
96
+ renders,
97
+ repairs,
98
+ mappers,
99
+ text,
100
+ },
101
+ ]),
102
+ );
103
+
104
+ const theme = provideTheme(() => props.theme ?? 'light');
105
+
106
+ const style = computed(() => {
107
+ const { colors, typography } = theme.value.tokens;
108
+
109
+ return {
110
+ color: colors.fg,
111
+ ...(typography.fontSans ? { fontFamily: typography.fontSans } : {}),
112
+ fontSize: `${typography.fontSize.md}px`,
113
+ lineHeight: `${typography.fontSize.md * typography.lineHeight.md}px`,
114
+ };
115
+ });
116
+
117
+ provideRender({ getProps: getUniProps });
118
+
119
+ provideSlots(() => slots.value);
120
+
121
+ defineExpose(core);
122
+
123
+ onScopeDispose(() => core.destroy());
124
+ </script>
125
+
126
+ <template>
127
+ <view class="fluxdown" :style="style">
128
+ <RootReconciler :value="core.value" />
129
+ </view>
130
+ </template>
131
+
132
+ <style>
133
+ .fluxdown {
134
+ display: flex;
135
+ flex-direction: column;
136
+ }
137
+ </style>
@@ -0,0 +1,30 @@
1
+ import type { UniRenderNode } from '@fluxdown/uni-app-plugins/base';
2
+ declare const __VLS_export: import("vue").DefineComponent<{
3
+ readonly text: {
4
+ readonly type: StringConstructor;
5
+ readonly required: true;
6
+ };
7
+ readonly build: import("vue").PropType<import("./type").FluxdownRawProps["build"]>;
8
+ readonly streaming: import("vue").PropType<import("./type").FluxdownRawProps["streaming"]>;
9
+ readonly patches: import("vue").PropType<import("./type").FluxdownRawProps["patches"]>;
10
+ readonly plugins: {
11
+ readonly type: import("vue").PropType<import("./type").FluxdownRawProps["plugins"]>;
12
+ readonly required: true;
13
+ };
14
+ readonly theme: import("vue").PropType<import("./type").FluxdownRawProps["theme"]>;
15
+ }, import("stative").IReadableClosure<UniRenderNode[]>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
+ readonly text: {
17
+ readonly type: StringConstructor;
18
+ readonly required: true;
19
+ };
20
+ readonly build: import("vue").PropType<import("./type").FluxdownRawProps["build"]>;
21
+ readonly streaming: import("vue").PropType<import("./type").FluxdownRawProps["streaming"]>;
22
+ readonly patches: import("vue").PropType<import("./type").FluxdownRawProps["patches"]>;
23
+ readonly plugins: {
24
+ readonly type: import("vue").PropType<import("./type").FluxdownRawProps["plugins"]>;
25
+ readonly required: true;
26
+ };
27
+ readonly theme: import("vue").PropType<import("./type").FluxdownRawProps["theme"]>;
28
+ }>>, {}, {}>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
@@ -0,0 +1,70 @@
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 { IPluggableConfig } from '@fluxdown/types';
4
+ import type { IPluginItem, Theme, UniRenderNode } from '@fluxdown/uni-app-plugins/typings';
5
+ import type { IReadableClosure } from 'stative';
6
+ export type BaseBuildConfig = Partial<Omit<BlockCompilerConfig, 'repairEnding'>>;
7
+ export type EffectItem = keyof EffectConfigs | {
8
+ [K in keyof EffectConfigs]: [K, IPluggableConfig<EffectConfigs[K]>];
9
+ }[keyof EffectConfigs] | MapperPluggable;
10
+ export interface SmoothConfig {
11
+ /**
12
+ * Reveal newly compiled content over successive ticks.
13
+ * @default false
14
+ */
15
+ enabled?: boolean;
16
+ /**
17
+ * Built-in timestamp source name or a custom ticker constructor.
18
+ */
19
+ ticker: TickerType | SmoothTickerClass;
20
+ /**
21
+ * Built-in progress scheduler name or a custom scheduler constructor.
22
+ */
23
+ scheduler: SchedulerType | SmoothSchedulerClass;
24
+ }
25
+ export interface StreamingConfig {
26
+ /**
27
+ * Repair incomplete Markdown syntax at the end of the document.
28
+ * @default true
29
+ */
30
+ repairEnding?: boolean;
31
+ /**
32
+ * Smoothly reveal appended compiled content.
33
+ * @default true
34
+ */
35
+ smooth?: boolean | SmoothConfig;
36
+ /**
37
+ * One effect or an ordered list of effects applied to newly revealed content.
38
+ * Set to true to enable the default scale entrance, or false to disable effects.
39
+ * @default 'scale'
40
+ */
41
+ effect?: boolean | EffectItem | EffectItem[];
42
+ }
43
+ export interface FluxdownRawProps {
44
+ /**
45
+ * Markdown source text to compile and render.
46
+ */
47
+ text: string;
48
+ /**
49
+ * Static build configuration.
50
+ */
51
+ build?: BaseBuildConfig;
52
+ /**
53
+ * Streaming effect configuration.
54
+ * @default false
55
+ */
56
+ streaming?: boolean | StreamingConfig;
57
+ /**
58
+ * Inline render patches applied to the Markdown source.
59
+ */
60
+ patches?: IPatchItem<UniRenderNode>[];
61
+ /**
62
+ * One plugin pack or an ordered list extending the compiler and uni-app renderer.
63
+ */
64
+ plugins: IPluginItem | IPluginItem[];
65
+ /**
66
+ * Preset theme, deep partial overrides of light, or a preset/overrides tuple.
67
+ */
68
+ theme?: Theme;
69
+ }
70
+ export type FluxdownRef = IReadableClosure<UniRenderNode[]>;
File without changes
@@ -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';
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,53 @@
1
+ import { DEFAULT_CONFIG } from "../../consts/config.js";
2
+ import { ALL_SCHEDULERS, ALL_TICKERS } from "../../consts/smooth.js";
3
+ import { isBoolean, isString } from "lodash-es";
4
+ import { assert, defaultsBy, isEnableRAF } from "@fluxdown/utils";
5
+ //#region src/packs/utils/config.ts
6
+ var getTickerByType = (type) => {
7
+ if (!isString(type)) return type;
8
+ const ticker = ALL_TICKERS.find((item) => item.name === type);
9
+ assert(ticker, `Unknown ticker type: ${type}`);
10
+ return ticker;
11
+ };
12
+ var getSchedulerByType = (type) => {
13
+ if (!isString(type)) return type;
14
+ const scheduler = ALL_SCHEDULERS.find((item) => item.name === type);
15
+ assert(scheduler, `Unknown scheduler type: ${type}`);
16
+ return scheduler;
17
+ };
18
+ var toSmoothConfig = (config) => {
19
+ const { enabled = false, ticker, scheduler } = isBoolean(config) ? {
20
+ enabled: config,
21
+ ticker: isEnableRAF() ? "raf" : "interval",
22
+ scheduler: "spring"
23
+ } : config;
24
+ return {
25
+ enabled,
26
+ ticker: getTickerByType(ticker),
27
+ scheduler: getSchedulerByType(scheduler)
28
+ };
29
+ };
30
+ var toStreamingConfig = (config = false) => {
31
+ if (isBoolean(config)) return {
32
+ repairEnding: config,
33
+ smooth: config,
34
+ effect: config ? "scale" : false
35
+ };
36
+ const { repairEnding = true, smooth = true, effect = "scale" } = config;
37
+ return {
38
+ repairEnding,
39
+ smooth,
40
+ effect
41
+ };
42
+ };
43
+ var toBuildConfig = ({ base, repairEnding, idPrefix }) => {
44
+ return {
45
+ ...defaultsBy(base, {
46
+ ...DEFAULT_CONFIG,
47
+ idPrefix
48
+ }),
49
+ repairEnding
50
+ };
51
+ };
52
+ //#endregion
53
+ export { getSchedulerByType, getTickerByType, toBuildConfig, toSmoothConfig, toStreamingConfig };
@@ -0,0 +1,4 @@
1
+ import type { Mapper, MapperPluggable } from '@fluxdown/core';
2
+ import type { EffectItem, StreamingConfig } from '../raw/type';
3
+ export declare const toEffects: (effect?: StreamingConfig["effect"]) => EffectItem[];
4
+ export declare const toEffectMappers: (effects: EffectItem[], presets: Mapper[]) => MapperPluggable[];
@@ -0,0 +1,22 @@
1
+ import { EO } from "../../consts/defaults.js";
2
+ import { defaults, isArray, isObjectLike, isString } from "lodash-es";
3
+ import { assert } from "@fluxdown/utils";
4
+ //#region src/packs/utils/effect.ts
5
+ var toEffects = (effect = false) => {
6
+ if (effect === false) return [];
7
+ if (effect === true) return ["scale"];
8
+ if (!isArray(effect)) return [effect];
9
+ if (effect.length === 2 && !isArray(effect[1]) && isObjectLike(effect[1])) return [effect];
10
+ return effect;
11
+ };
12
+ var toEffectMappers = (effects, presets) => {
13
+ return effects.map((effect) => {
14
+ const [key, config] = isArray(effect) ? effect : [effect, EO];
15
+ if (!isString(key)) return effect;
16
+ const Mapper = presets.find((item) => item.key === key);
17
+ assert(Mapper, `Unknown effect: ${key}`);
18
+ return [Mapper, defaults({ ...config }, { enabled: true })];
19
+ });
20
+ };
21
+ //#endregion
22
+ export { toEffectMappers, toEffects };
@@ -0,0 +1,3 @@
1
+ export * from './config';
2
+ export * from './effect';
3
+ export * from './patches';
@@ -0,0 +1,4 @@
1
+ import { getSchedulerByType, getTickerByType, toBuildConfig, toSmoothConfig, toStreamingConfig } from "./config.js";
2
+ import { toEffectMappers, toEffects } from "./effect.js";
3
+ import { isPatchesEqual } from "./patches.js";
4
+ export { getSchedulerByType, getTickerByType, isPatchesEqual, toBuildConfig, toEffectMappers, toEffects, toSmoothConfig, toStreamingConfig };
@@ -0,0 +1,2 @@
1
+ import type { IPatchItem } from '@fluxdown/core';
2
+ export declare const isPatchesEqual: <R>(left: IPatchItem<R>[], right: IPatchItem<R>[]) => boolean;
@@ -0,0 +1,13 @@
1
+ import { isNumber } from "lodash-es";
2
+ //#region src/packs/utils/patches.ts
3
+ var isPatchRangeEqual = (left, right) => {
4
+ return left === right || (isNumber(left) ? left : left[0]) === (isNumber(right) ? right : right[0]) && (isNumber(left) ? left : left[1]) === (isNumber(right) ? right : right[1]);
5
+ };
6
+ var isPatchesEqual = (left, right) => {
7
+ return left === right || left.length === right.length && left.every((patch, index) => {
8
+ const other = right[index];
9
+ return other !== void 0 && patch.key === other.key && isPatchRangeEqual(patch.range, other.range) && patch.render === other.render;
10
+ });
11
+ };
12
+ //#endregion
13
+ export { isPatchesEqual };
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
2
  "name": "@fluxdown/uni-app",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Streaming Markdown renderer for uni-app x Vapor AI chat, with syntax repair, smooth output, and customizable components.",
5
+ "keywords": [
6
+ "ai-chat",
7
+ "hast",
8
+ "llm",
9
+ "markdown",
10
+ "markdown-renderer",
11
+ "renderer",
12
+ "streaming",
13
+ "streaming-markdown",
14
+ "uni-app",
15
+ "uni-app-x",
16
+ "vapor"
17
+ ],
18
+ "homepage": "https://fluxdown.dev/guide/uni-app/quick-start.html",
19
+ "bugs": {
20
+ "url": "https://github.com/hexmora/fluxdown/issues"
21
+ },
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/hexmora/fluxdown.git",
26
+ "directory": "packages/uni-app"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "CHANGELOG.md"
31
+ ],
32
+ "type": "module",
33
+ "sideEffects": [
34
+ "**/*.uvue",
35
+ "**/*.css"
36
+ ],
37
+ "main": "./dist/packs/full/index.js",
38
+ "module": "./dist/packs/full/index.js",
39
+ "types": "./dist/packs/full/index.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/packs/full/index.d.ts",
43
+ "default": "./dist/packs/full/index.js"
44
+ },
45
+ "./*": {
46
+ "types": "./dist/packs/*/index.d.ts",
47
+ "default": "./dist/packs/*/index.js"
48
+ }
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "dependencies": {
54
+ "@fluxdown/core": "^0.12.8",
55
+ "@fluxdown/core-plugins": "^0.13.0",
56
+ "@fluxdown/types": "^0.10.2",
57
+ "@fluxdown/uni-app-plugins": "^0.2.0",
58
+ "@fluxdown/utils": "^0.7.3",
59
+ "lodash-es": "^4.18.1",
60
+ "shallow-equal": "^3.1.0",
61
+ "stative": "^2.1.1"
62
+ },
63
+ "devDependencies": {
64
+ "@dcloudio/uni-app-x": "0.7.134",
65
+ "@storybook/addon-docs": "^10.4.4",
66
+ "@storybook/vue3-vite": "10.6.3",
67
+ "@types/hast": "3.0.4",
68
+ "@types/lodash-es": "^4.17.12",
69
+ "@types/node": "^25.9.3",
70
+ "@vitejs/plugin-vue": "^6.0.10",
71
+ "@vue/test-utils": "^2.5.1",
72
+ "expect-type": "1.4.0",
73
+ "jsdom": "29.0.0",
74
+ "oxlint": "^1.69.0",
75
+ "storybook": "^10.5.3",
76
+ "typescript": "npm:@typescript/typescript6@6.0.2",
77
+ "vite": "^8.0.16",
78
+ "vitest": "^5.0.5",
79
+ "vue": "3.4.21",
80
+ "vue-tsc": "^3.3.13"
81
+ },
82
+ "peerDependencies": {
83
+ "vue": "^3.4.21"
84
+ },
85
+ "engines": {
86
+ "node": ">=22.18.0"
87
+ },
88
+ "scripts": {
89
+ "build": "vite build",
90
+ "lint": "oxlint .",
91
+ "test": "vitest run",
92
+ "typecheck": "vue-tsc --noEmit",
93
+ "dev": "pnpm build:preview && storybook dev -p 6011 --no-open",
94
+ "storybook": "pnpm build:preview && storybook dev -p 6011",
95
+ "build:storybook": "pnpm build:preview && storybook build",
96
+ "build:preview": "pnpm --filter @fluxdown/uni-app-playground build"
97
+ }
6
98
  }