@baishuyun/ui-mobile 0.7.0 → 0.9.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/dist/AMap/{AMap-DwrSlwyV.js → AMap-B1GiEoPE.js} +2 -2
- package/dist/AMap/index.js +4 -4
- package/dist/ActionSheet/ActionSheet-DVck9uyS.js +85 -0
- package/dist/ActionSheet/index.js +6 -4
- package/dist/Calendar/{Calendar-tYjpphMo.js → Calendar-B1TwDL1q.js} +2 -2
- package/dist/Calendar/index.js +4 -4
- package/dist/ConfigProvider/ConfigProvider-xyGx046s.js +328 -0
- package/dist/ConfigProvider/index.js +4 -3
- package/dist/ConfigProvider/{useLocale-CP8NRZoj.js → useLocale-Bf81I-9U.js} +57 -0
- package/dist/Editor/Editor-DUsPQevQ.js +2051 -0
- package/dist/Editor/index.js +8 -0
- package/dist/Gantt/{Gantt-D2ZGpS5p.js → Gantt-CbHw9RMw.js} +3 -3
- package/dist/Gantt/index.js +8 -6
- package/dist/Icon/{Icon-CFvcrGGg.js → Icon-D3xi1oyo.js} +1 -1
- package/dist/Icon/index.js +2 -2
- package/dist/Overlay/Overlay-CqQWOqO4.js +61 -0
- package/dist/Overlay/index.js +3 -0
- package/dist/Popup/Popup-BIIDAUmB.js +78 -0
- package/dist/Popup/index.js +5 -0
- package/dist/components/ActionSheet/ActionSheet.d.ts +1 -1
- package/dist/components/ActionSheet/interface.d.ts +1 -2
- package/dist/components/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/dist/components/ConfigProvider/context.d.ts +14 -0
- package/dist/components/Editor/Editor.d.ts +6 -0
- package/dist/components/Editor/EditorCore.d.ts +3 -0
- package/dist/components/Editor/EditorHtml.d.ts +3 -0
- package/dist/components/Editor/Thinking.d.ts +22 -0
- package/dist/components/Editor/constants.d.ts +57 -0
- package/dist/components/Editor/index.d.ts +3 -0
- package/dist/components/Editor/interface.d.ts +59 -0
- package/dist/components/Editor/nodes/ExtendedTextNode.d.ts +9 -0
- package/dist/components/Editor/nodes/ImageNode.d.ts +48 -0
- package/dist/components/Editor/plugins/HeadingPlugin.d.ts +2 -0
- package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
- package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +2 -0
- package/dist/components/Editor/sheets.d.ts +43 -0
- package/dist/components/Editor/toolbar/Toolbar.d.ts +10 -0
- package/dist/components/Editor/toolbar/ToolbarColorGlyph.d.ts +8 -0
- package/dist/components/Editor/toolbar/useTextFormats.d.ts +16 -0
- package/dist/components/Editor/utils/applyAiPolish.d.ts +5 -0
- package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
- package/dist/components/Editor/utils/isAcceptedImageType.d.ts +5 -0
- package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/readEditorAiSnapshot.d.ts +8 -0
- package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +1 -0
- package/dist/components/Editor/utils/toPortableEditorHtml.d.ts +1 -0
- package/dist/components/Editor/utils/unwrapTypesetFence.d.ts +6 -0
- package/dist/components/Overlay/OverlayContext.d.ts +17 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Popup/Popup.d.ts +3 -0
- package/dist/components/Popup/index.d.ts +2 -0
- package/dist/components/Popup/interface.d.ts +46 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/index.js +13 -10
- package/dist/locale/lang/en-US.json.d.ts +59 -0
- package/dist/locale/lang/zh-CN.json.d.ts +59 -0
- package/dist/locale/lang/zh-TW.json.d.ts +59 -0
- package/dist/style.css +1 -1
- package/dist/vendors/{version-Dg7dOJFj.js → version-CslTV1sb.js} +1 -1
- package/dist/vite-env.d.ts +5 -0
- package/package.json +12 -3
- package/dist/ActionSheet/ActionSheet-DbrKxa_y.js +0 -133
- package/dist/ConfigProvider/ConfigProvider-DnlakyRE.js +0 -208
- /package/dist/Calendar/{cssVars-UpgK6spf.js → cssVars-DNOooryc.js} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../vendors/version-CslTV1sb.js";
|
|
2
|
+
import "../Popup/Popup-BIIDAUmB.js";
|
|
3
|
+
import "../ActionSheet/ActionSheet-DVck9uyS.js";
|
|
4
|
+
import "../Icon/Icon-D3xi1oyo.js";
|
|
5
|
+
import { n as e, t } from "./Editor-DUsPQevQ.js";
|
|
6
|
+
import "../Overlay/Overlay-CqQWOqO4.js";
|
|
7
|
+
import "../ConfigProvider/useLocale-Bf81I-9U.js";
|
|
8
|
+
export { e as EditorHtml, t as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "../ActionSheet/ActionSheet-
|
|
2
|
-
import { a as t, i as n, t as r } from "../ConfigProvider/useLocale-
|
|
3
|
-
import { i, t as a } from "../Calendar/cssVars-
|
|
1
|
+
import { t as e } from "../ActionSheet/ActionSheet-DVck9uyS.js";
|
|
2
|
+
import { a as t, i as n, t as r } from "../ConfigProvider/useLocale-Bf81I-9U.js";
|
|
3
|
+
import { i, t as a } from "../Calendar/cssVars-DNOooryc.js";
|
|
4
4
|
import { createContext as o, memo as s, useCallback as c, useContext as l, useEffect as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
5
5
|
import { createPortal as h } from "react-dom";
|
|
6
6
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
package/dist/Gantt/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
1
|
+
import "../vendors/version-CslTV1sb.js";
|
|
2
|
+
import "../Popup/Popup-BIIDAUmB.js";
|
|
3
|
+
import "../ActionSheet/ActionSheet-DVck9uyS.js";
|
|
4
|
+
import { n as e, t } from "./Gantt-CbHw9RMw.js";
|
|
5
|
+
import "../Icon/Icon-D3xi1oyo.js";
|
|
6
|
+
import "../Overlay/Overlay-CqQWOqO4.js";
|
|
7
|
+
import "../ConfigProvider/useLocale-Bf81I-9U.js";
|
|
8
|
+
import "../Calendar/cssVars-DNOooryc.js";
|
|
7
9
|
export { e as ALL_ZOOM_LEVELS, t as default };
|
|
@@ -7,7 +7,7 @@ var t = { "bsy-icon": "_bsy-icon_gwzb9_1" }, n = /* @__PURE__ */ new Set();
|
|
|
7
7
|
if (!e || n.has(e) || (n.add(e), [...document.scripts].some((t) => t.getAttribute("src") === e))) return;
|
|
8
8
|
let t = document.createElement("script");
|
|
9
9
|
t.setAttribute("src", e), document.body.appendChild(t);
|
|
10
|
-
})("https://at.alicdn.com/t/c/
|
|
10
|
+
})("https://at.alicdn.com/t/c/font_4786625_bgf4g3m46wv.js");
|
|
11
11
|
var r = ({ name: n, size: r = 16, color: i, className: a }) => /* @__PURE__ */ e("svg", {
|
|
12
12
|
className: [t["bsy-icon"], a].filter(Boolean).join(" "),
|
|
13
13
|
style: {
|
package/dist/Icon/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
2
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import "../vendors/version-CslTV1sb.js";
|
|
2
|
+
import { t as e } from "./Icon-D3xi1oyo.js";
|
|
3
3
|
export { e as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createContext as e, useContext as t, useEffect as n, useMemo as r } from "react";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Overlay/OverlayContext.tsx
|
|
4
|
+
var a = 1e3, o = 10, s = e({
|
|
5
|
+
offset: 0,
|
|
6
|
+
step: 10
|
|
7
|
+
}), c = /* @__PURE__ */ new Map(), l = (e, t) => t === void 0 ? e : Math.min(e, t), u = () => {
|
|
8
|
+
if (c.size === 0) return;
|
|
9
|
+
let e = Math.max(...c.keys()), t = c.get(e);
|
|
10
|
+
return l(e + t.step, t.max);
|
|
11
|
+
}, d = (e) => {
|
|
12
|
+
let t = e ?? u();
|
|
13
|
+
return t === void 0 ? void 0 : { zIndex: t };
|
|
14
|
+
}, f = ({ zIndex: e, offset: a, step: o, max: l, children: u }) => {
|
|
15
|
+
let d = t(s), f = r(() => ({
|
|
16
|
+
parentZ: e ?? d.parentZ,
|
|
17
|
+
offset: a ?? d.offset,
|
|
18
|
+
step: o ?? d.step,
|
|
19
|
+
max: l ?? d.max
|
|
20
|
+
}), [
|
|
21
|
+
l,
|
|
22
|
+
a,
|
|
23
|
+
d.max,
|
|
24
|
+
d.offset,
|
|
25
|
+
d.parentZ,
|
|
26
|
+
d.step,
|
|
27
|
+
o,
|
|
28
|
+
e
|
|
29
|
+
]);
|
|
30
|
+
return n(() => {
|
|
31
|
+
if (e === void 0) return;
|
|
32
|
+
let t = c.get(e);
|
|
33
|
+
return c.set(e, {
|
|
34
|
+
count: (t?.count ?? 0) + 1,
|
|
35
|
+
step: f.step,
|
|
36
|
+
max: f.max
|
|
37
|
+
}), () => {
|
|
38
|
+
let t = c.get(e);
|
|
39
|
+
if (t === void 0 || t.count <= 1) {
|
|
40
|
+
c.delete(e);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
c.set(e, {
|
|
44
|
+
...t,
|
|
45
|
+
count: t.count - 1
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}, [
|
|
49
|
+
e,
|
|
50
|
+
f.max,
|
|
51
|
+
f.step
|
|
52
|
+
]), /* @__PURE__ */ i(s.Provider, {
|
|
53
|
+
value: f,
|
|
54
|
+
children: u
|
|
55
|
+
});
|
|
56
|
+
}, p = (e) => {
|
|
57
|
+
let { parentZ: n, offset: r, step: i, max: o } = t(s);
|
|
58
|
+
return e === void 0 ? n === void 0 ? r + a : l(n + i, o) : e;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { d as a, u as i, o as n, p as o, f as r, a as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../vendors/version-CslTV1sb.js";
|
|
2
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./Overlay-CqQWOqO4.js";
|
|
3
|
+
export { a as OVERLAY_Z_BASE, n as OVERLAY_Z_STEP, i as OverlayProvider, t as getNextImperativeOverlayZIndex, e as imperativeOverlayStyle, r as useOverlayZIndex };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { o as e, r as t } from "../Overlay/Overlay-CqQWOqO4.js";
|
|
2
|
+
import { t as n } from "../ConfigProvider/useLocale-Bf81I-9U.js";
|
|
3
|
+
import { useEffect as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
4
|
+
import { createPortal as s } from "react-dom";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Popup/Popup.module.scss
|
|
7
|
+
var u = {
|
|
8
|
+
"bsy-mobile-popup": "_bsy-mobile-popup_103dr_2",
|
|
9
|
+
"bsy-mobile-popup__mask": "_bsy-mobile-popup__mask_103dr_8",
|
|
10
|
+
"bsy-mobile-popup__panel": "_bsy-mobile-popup__panel_103dr_19",
|
|
11
|
+
"bsy-mobile-popup--bottom": "_bsy-mobile-popup--bottom_103dr_32",
|
|
12
|
+
"bsy-mobile-popup--top": "_bsy-mobile-popup--top_103dr_37",
|
|
13
|
+
"bsy-mobile-popup--round": "_bsy-mobile-popup--round_103dr_42",
|
|
14
|
+
"bsy-mobile-popup--open": "_bsy-mobile-popup--open_103dr_45"
|
|
15
|
+
}, d = (...e) => e.filter(Boolean).join(" "), f = ({ open: f, onClose: p, position: m = "bottom", round: h = !0, zIndex: g, closeOnClickOverlay: _ = !0, getPopupContainer: v, className: y, children: b }) => {
|
|
16
|
+
let { t: x } = n(), S = e(g), [C, w] = o(f), [T, E] = o(!1), D = a(!1), O = a({
|
|
17
|
+
children: b,
|
|
18
|
+
position: m,
|
|
19
|
+
round: h
|
|
20
|
+
});
|
|
21
|
+
f && (O.current = {
|
|
22
|
+
children: b,
|
|
23
|
+
position: m,
|
|
24
|
+
round: h
|
|
25
|
+
});
|
|
26
|
+
let k = O.current;
|
|
27
|
+
r(() => {
|
|
28
|
+
if (f) {
|
|
29
|
+
w(!0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
E(!1), D.current || w(!1);
|
|
33
|
+
}, [f]), i(() => {
|
|
34
|
+
if (!C || !f) return;
|
|
35
|
+
let e = 0, t = requestAnimationFrame(() => {
|
|
36
|
+
e = requestAnimationFrame(() => {
|
|
37
|
+
D.current = !0, E(!0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
cancelAnimationFrame(t), cancelAnimationFrame(e);
|
|
42
|
+
};
|
|
43
|
+
}, [C, f]), r(() => {
|
|
44
|
+
if (!C) return;
|
|
45
|
+
let e = document.body.style.overflow;
|
|
46
|
+
return document.body.style.overflow = "hidden", () => {
|
|
47
|
+
document.body.style.overflow = e;
|
|
48
|
+
};
|
|
49
|
+
}, [C]);
|
|
50
|
+
let A = typeof document > "u" ? null : v?.() || document.body;
|
|
51
|
+
if (!C || !A) return null;
|
|
52
|
+
let j = x("popup.close"), M = k.position === "top";
|
|
53
|
+
return s(/* @__PURE__ */ l("div", {
|
|
54
|
+
className: d(u["bsy-mobile-popup"], M ? u["bsy-mobile-popup--top"] : u["bsy-mobile-popup--bottom"], k.round && u["bsy-mobile-popup--round"], T && f && u["bsy-mobile-popup--open"], y),
|
|
55
|
+
style: { zIndex: S },
|
|
56
|
+
children: [/* @__PURE__ */ c("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
className: u["bsy-mobile-popup__mask"],
|
|
59
|
+
"aria-label": j,
|
|
60
|
+
onClick: () => {
|
|
61
|
+
_ && p();
|
|
62
|
+
}
|
|
63
|
+
}), /* @__PURE__ */ c("div", {
|
|
64
|
+
className: u["bsy-mobile-popup__panel"],
|
|
65
|
+
role: "dialog",
|
|
66
|
+
"aria-modal": "true",
|
|
67
|
+
onTransitionEnd: (e) => {
|
|
68
|
+
e.propertyName === "transform" && (f || (D.current = !1, w(!1)));
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ c(t, {
|
|
71
|
+
zIndex: S,
|
|
72
|
+
children: k.children
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
}), A);
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { f as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActionSheetProps } from './interface';
|
|
2
|
-
declare const ActionSheet: ({ open, onClose, mode, title, actions, onAction, children, zIndex, getPopupContainer, className, }: ActionSheetProps) => import(
|
|
2
|
+
declare const ActionSheet: ({ open, onClose, mode, title, actions, onAction, children, zIndex, getPopupContainer, className, }: ActionSheetProps) => import("react").JSX.Element;
|
|
3
3
|
export default ActionSheet;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigProviderProps } from './context';
|
|
2
|
-
export declare const ConfigProvider: ({ locale: localeProp, amap, children }: ConfigProviderProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const ConfigProvider: ({ locale: localeProp, amap, overlayOffset, overlayStep, overlayMax, children, }: ConfigProviderProps) => import("react").JSX.Element;
|
|
3
3
|
export default ConfigProvider;
|
|
@@ -20,5 +20,19 @@ export type ConfigProviderProps = {
|
|
|
20
20
|
* @description 高德地图配置。任意 App 接入 AMap 的正式入口。
|
|
21
21
|
*/
|
|
22
22
|
amap?: AMapConfig;
|
|
23
|
+
/**
|
|
24
|
+
* @description 全局浮层 z-index 偏移,第一层 = offset + 1000
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
overlayOffset?: number;
|
|
28
|
+
/**
|
|
29
|
+
* @description 嵌套浮层步长
|
|
30
|
+
* @default 10
|
|
31
|
+
*/
|
|
32
|
+
overlayStep?: number;
|
|
33
|
+
/**
|
|
34
|
+
* @description 嵌套浮层 z-index 上限;不传则不封顶
|
|
35
|
+
*/
|
|
36
|
+
overlayMax?: number;
|
|
23
37
|
children?: ReactNode;
|
|
24
38
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EditorAiStatus } from './interface';
|
|
2
|
+
type ThinkingModel = {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
thinking: boolean;
|
|
5
|
+
open: boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
reasoning: string;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const useThinking: (source: {
|
|
11
|
+
status: EditorAiStatus;
|
|
12
|
+
reasoning?: string;
|
|
13
|
+
}, hasAnswer: boolean, scrollViewportRef: {
|
|
14
|
+
readonly current: HTMLDivElement | null;
|
|
15
|
+
}) => ThinkingModel;
|
|
16
|
+
export declare const ThinkingHead: ({ model }: {
|
|
17
|
+
model: ThinkingModel;
|
|
18
|
+
}) => import("react").JSX.Element;
|
|
19
|
+
export declare const ThinkingBody: ({ model }: {
|
|
20
|
+
model: ThinkingModel;
|
|
21
|
+
}) => import("react").JSX.Element | null;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EditorAiPreset, EditorToolbarGroup } from './interface';
|
|
2
|
+
export declare const FONT_SIZES: readonly [{
|
|
3
|
+
readonly label: "12";
|
|
4
|
+
readonly value: "12px";
|
|
5
|
+
}, {
|
|
6
|
+
readonly label: "14";
|
|
7
|
+
readonly value: "14px";
|
|
8
|
+
}, {
|
|
9
|
+
readonly label: "16";
|
|
10
|
+
readonly value: "16px";
|
|
11
|
+
}, {
|
|
12
|
+
readonly label: "18";
|
|
13
|
+
readonly value: "18px";
|
|
14
|
+
}, {
|
|
15
|
+
readonly label: "20";
|
|
16
|
+
readonly value: "20px";
|
|
17
|
+
}, {
|
|
18
|
+
readonly label: "22";
|
|
19
|
+
readonly value: "22px";
|
|
20
|
+
}, {
|
|
21
|
+
readonly label: "24";
|
|
22
|
+
readonly value: "24px";
|
|
23
|
+
}, {
|
|
24
|
+
readonly label: "28";
|
|
25
|
+
readonly value: "28px";
|
|
26
|
+
}, {
|
|
27
|
+
readonly label: "32";
|
|
28
|
+
readonly value: "32px";
|
|
29
|
+
}, {
|
|
30
|
+
readonly label: "36";
|
|
31
|
+
readonly value: "36px";
|
|
32
|
+
}, {
|
|
33
|
+
readonly label: "64";
|
|
34
|
+
readonly value: "64px";
|
|
35
|
+
}, {
|
|
36
|
+
readonly label: "128";
|
|
37
|
+
readonly value: "128px";
|
|
38
|
+
}];
|
|
39
|
+
export declare const DEFAULT_FONT_COLOR = "#000";
|
|
40
|
+
export declare const DEFAULT_BACKGROUND_COLOR = "transparent";
|
|
41
|
+
export declare const EDITOR_COLOR_PRESETS: readonly ["#005eef", "#3642e9", "#7f43c8", "#114bb8", "#1379d9", "#10a9c4", "#119d85", "#ffc502", "#ff9921", "#f06648", "#f168b6", "#d9e8ff", "#dee0ff", "#efe2ff", "#d5e4ff", "#daedff", "#ddfaff", "#d7fff8", "#fff4d0", "#ffecd7", "#ffe3dd", "#ffdef1", "#262626", "#3c3c3d", "#454545", "#515152", "#5d5c5e", "#6c6c6e", "#878789", "#b0afb1", "#d0d0d1", "#e6e6e7", "#f5f5f6"];
|
|
42
|
+
export declare const EDITOR_AI_PRESETS: EditorAiPreset[];
|
|
43
|
+
export declare const EDITOR_AI_PRESET_I18N: {
|
|
44
|
+
readonly quick: "editor.aiPresetQuick";
|
|
45
|
+
readonly formal: "editor.aiPresetFormal";
|
|
46
|
+
readonly colloquial: "editor.aiPresetColloquial";
|
|
47
|
+
readonly lively: "editor.aiPresetLively";
|
|
48
|
+
readonly literary: "editor.aiPresetLiterary";
|
|
49
|
+
readonly retro: "editor.aiPresetRetro";
|
|
50
|
+
};
|
|
51
|
+
export declare const DEFAULT_TOOLBAR_CONFIG: EditorToolbarGroup[];
|
|
52
|
+
export declare const IMAGE_MAX_BYTES: number;
|
|
53
|
+
export declare const EDITOR_IMAGE_FILE_TYPES: readonly ["jpg", "jpeg", "png", "gif", "bmp", "tif"];
|
|
54
|
+
export declare const EDITOR_IMAGE_ACCEPT: string;
|
|
55
|
+
export declare const EDITOR_SHEET_HEIGHT = 300;
|
|
56
|
+
export declare const EDITOR_CONTENT_HEIGHT = 200;
|
|
57
|
+
export declare const EDITOR_AI_SHEET_HEIGHT = "calc(100dvh - 104px)";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default } from './Editor';
|
|
2
|
+
export { EditorHtml } from './EditorHtml';
|
|
3
|
+
export type { EditorAi, EditorAiMode, EditorAiPreset, EditorAiStatus, EditorProps, EditorToolbarConfigButton, EditorToolbarGroup, EditorToolbarProps, EditorUpload, EditorUploadContext, EditorUploadResult, } from './interface';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EditorState } from 'lexical';
|
|
2
|
+
export type EditorAiPreset = 'quick' | 'formal' | 'colloquial' | 'lively' | 'literary' | 'retro';
|
|
3
|
+
export type EditorAiMode = 'typeset' | 'polish';
|
|
4
|
+
export type EditorAiStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
5
|
+
export type EditorAi = {
|
|
6
|
+
typeset?: (input: {
|
|
7
|
+
text: string;
|
|
8
|
+
html: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
polish?: (input: {
|
|
11
|
+
text: string;
|
|
12
|
+
preset: EditorAiPreset;
|
|
13
|
+
}) => void;
|
|
14
|
+
stop?: () => void;
|
|
15
|
+
text?: string;
|
|
16
|
+
reasoning?: string;
|
|
17
|
+
status?: EditorAiStatus;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
};
|
|
20
|
+
export type EditorUploadContext = {
|
|
21
|
+
onProgress?: (percent: number) => void;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
};
|
|
24
|
+
export type EditorUploadResult = {
|
|
25
|
+
url: string;
|
|
26
|
+
attachment?: {
|
|
27
|
+
_id: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type EditorUpload = {
|
|
31
|
+
customRequest?: (file: File, ctx: EditorUploadContext) => Promise<string | EditorUploadResult>;
|
|
32
|
+
};
|
|
33
|
+
export type EditorToolbarButtonName = 'ai' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'align' | 'heading' | 'fontSize' | 'fontColor' | 'fill' | 'outdent' | 'indent' | 'number' | 'bullet' | 'picture' | 'link';
|
|
34
|
+
export type EditorToolbarConfigButton = EditorToolbarButtonName | {
|
|
35
|
+
name: EditorToolbarButtonName;
|
|
36
|
+
props?: {
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type EditorToolbarGroup = {
|
|
41
|
+
key: string;
|
|
42
|
+
buttons: EditorToolbarConfigButton[];
|
|
43
|
+
};
|
|
44
|
+
export type EditorToolbarProps = {
|
|
45
|
+
config?: EditorToolbarGroup[];
|
|
46
|
+
};
|
|
47
|
+
export type EditorProps = {
|
|
48
|
+
onChange: (payload: {
|
|
49
|
+
text: string;
|
|
50
|
+
html: string | null;
|
|
51
|
+
attachments: unknown[];
|
|
52
|
+
}, editorState: EditorState) => void;
|
|
53
|
+
value?: string | null;
|
|
54
|
+
open?: boolean;
|
|
55
|
+
onOpenChange?: (open: boolean) => void;
|
|
56
|
+
toolbar?: EditorToolbarProps;
|
|
57
|
+
upload?: EditorUpload;
|
|
58
|
+
ai?: EditorAi;
|
|
59
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DOMConversionMap, TextNode, SerializedTextNode } from 'lexical';
|
|
2
|
+
export declare class ExtendedTextNode extends TextNode {
|
|
3
|
+
static getType(): string;
|
|
4
|
+
static clone(node: ExtendedTextNode): ExtendedTextNode;
|
|
5
|
+
static importDOM(): DOMConversionMap | null;
|
|
6
|
+
static importJSON(serializedNode: SerializedTextNode): TextNode;
|
|
7
|
+
isSimpleText(): boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const $createExtendedTextNode: (text?: string) => ExtendedTextNode;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DecoratorNode, DOMConversionOutput, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare const ImageUploadProgressContext: import('react').Context<Record<string, number | undefined>>;
|
|
4
|
+
export interface ImagePayload {
|
|
5
|
+
src: string;
|
|
6
|
+
altText?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
dataId?: string;
|
|
10
|
+
key?: NodeKey;
|
|
11
|
+
}
|
|
12
|
+
export type SerializedImageNode = Spread<{
|
|
13
|
+
src: string;
|
|
14
|
+
altText?: string;
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
dataId?: string;
|
|
18
|
+
}, SerializedLexicalNode>;
|
|
19
|
+
export declare class ImageNode extends DecoratorNode<ReactNode> {
|
|
20
|
+
__src: string;
|
|
21
|
+
__altText: string;
|
|
22
|
+
__width?: number;
|
|
23
|
+
__height?: number;
|
|
24
|
+
__dataId?: string;
|
|
25
|
+
static getType(): string;
|
|
26
|
+
static clone(node: ImageNode): ImageNode;
|
|
27
|
+
constructor(src: string, altText?: string, width?: number, height?: number, key?: NodeKey, dataId?: string);
|
|
28
|
+
createDOM(): HTMLElement;
|
|
29
|
+
updateDOM(): false;
|
|
30
|
+
exportDOM(): {
|
|
31
|
+
element: HTMLImageElement;
|
|
32
|
+
};
|
|
33
|
+
getSrc(): string;
|
|
34
|
+
setSrc(src: string): void;
|
|
35
|
+
setDataId(dataId: string): void;
|
|
36
|
+
static importDOM(): {
|
|
37
|
+
img: () => {
|
|
38
|
+
conversion: (domNode: Node) => null | DOMConversionOutput;
|
|
39
|
+
priority: 0;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
static importJSON(serializedNode: SerializedImageNode): ImageNode;
|
|
43
|
+
exportJSON(): SerializedImageNode;
|
|
44
|
+
isInline(): boolean;
|
|
45
|
+
decorate(): ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export declare const $isImageNode: (node: LexicalNode | null | undefined) => node is ImageNode;
|
|
48
|
+
export declare const $createImageNode: ({ src, altText, width, height, dataId, key, }: ImagePayload) => ImageNode;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EditorAi, EditorAiMode, EditorAiPreset } from './interface';
|
|
2
|
+
import { EditorSheetKind } from './toolbar/Toolbar';
|
|
3
|
+
type OptionSheetsProps = {
|
|
4
|
+
sheet: EditorSheetKind | 'aiPreset' | null;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onTypeset: () => void;
|
|
7
|
+
onPolishMenu: () => void;
|
|
8
|
+
onPickPreset: (preset: EditorAiPreset) => void;
|
|
9
|
+
onPicture: (key: 'upload' | 'url') => void;
|
|
10
|
+
canTypeset: boolean;
|
|
11
|
+
canPolish: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const OptionSheets: ({ sheet, onClose, onTypeset, onPolishMenu, onPickPreset, onPicture, canTypeset, canPolish, }: OptionSheetsProps) => import("react").JSX.Element;
|
|
14
|
+
export type LinkDraft = {
|
|
15
|
+
url: string;
|
|
16
|
+
text: string;
|
|
17
|
+
newBlank: boolean;
|
|
18
|
+
};
|
|
19
|
+
type LinkPopupProps = {
|
|
20
|
+
open: boolean;
|
|
21
|
+
seed: LinkDraft | null;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onConfirm: (draft: LinkDraft) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const LinkPopup: ({ open, seed, onClose, onConfirm }: LinkPopupProps) => import("react").JSX.Element;
|
|
26
|
+
type ImageUrlPopupProps = {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
onConfirm: (src: string) => void;
|
|
30
|
+
};
|
|
31
|
+
export declare const ImageUrlPopup: ({ open, onClose, onConfirm }: ImageUrlPopupProps) => import("react").JSX.Element;
|
|
32
|
+
type AiResultPopupProps = {
|
|
33
|
+
open: boolean;
|
|
34
|
+
mode: EditorAiMode | null;
|
|
35
|
+
originalHtml: string;
|
|
36
|
+
ai: EditorAi | undefined;
|
|
37
|
+
polishPreset: EditorAiPreset;
|
|
38
|
+
onClose: () => void;
|
|
39
|
+
onApply: () => void;
|
|
40
|
+
onPickPreset: (preset: EditorAiPreset) => void;
|
|
41
|
+
};
|
|
42
|
+
export declare const AiResultPopup: ({ open, mode, originalHtml, ai, polishPreset, onClose, onApply, onPickPreset, }: AiResultPopupProps) => import("react").JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorToolbarGroup } from '../interface';
|
|
2
|
+
export type EditorSheetKind = 'align' | 'heading' | 'fontSize' | 'fontColor' | 'fill' | 'ai' | 'picture';
|
|
3
|
+
type ToolbarProps = {
|
|
4
|
+
config: EditorToolbarGroup[];
|
|
5
|
+
openSheet: EditorSheetKind | 'aiPreset' | null;
|
|
6
|
+
onOpenSheet: (kind: EditorSheetKind) => void;
|
|
7
|
+
onOpenLink: () => void;
|
|
8
|
+
};
|
|
9
|
+
declare const Toolbar: ({ config, openSheet, onOpenSheet, onOpenLink }: ToolbarProps) => import("react").JSX.Element;
|
|
10
|
+
export default Toolbar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ToolbarColorGlyphVariant = 'fontColor' | 'fill';
|
|
2
|
+
type ToolbarColorGlyphProps = {
|
|
3
|
+
variant: ToolbarColorGlyphVariant;
|
|
4
|
+
barColor: string;
|
|
5
|
+
size: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const ToolbarColorGlyph: ({ variant, barColor, size }: ToolbarColorGlyphProps) => import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type EditorAlign = 'left' | 'center' | 'right';
|
|
2
|
+
type TextFormatsState = {
|
|
3
|
+
bold: boolean;
|
|
4
|
+
italic: boolean;
|
|
5
|
+
underline: boolean;
|
|
6
|
+
strikethrough: boolean;
|
|
7
|
+
fontColor: string;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
align: EditorAlign;
|
|
10
|
+
listType: 'bullet' | 'number' | false;
|
|
11
|
+
canOutdent: boolean;
|
|
12
|
+
headingTag: 'h1' | 'h2' | 'h3' | false;
|
|
13
|
+
hasEditorText: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const useTextFormatsState: () => TextFormatsState;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LexicalEditor } from 'lexical';
|
|
2
|
+
export declare const POLISH_BLOCK_MARKER = "<!--bsy-block-->";
|
|
3
|
+
export declare const collectPolishHtmlBlocks: (html: string) => string[];
|
|
4
|
+
export declare const applyAiPolishToHtml: (html: string, proposed: string) => string;
|
|
5
|
+
export declare const applyAiPolish: (editor: LexicalEditor, proposed: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isEmptyEditorHtml: (html: string, text: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitizeEditorHtml: (html: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stripInlineStyleProperty: (style: string, property: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toPortableEditorHtml: (html: string) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
/** 第一层浮层底座。嵌套时改为 parentZ + step */
|
|
3
|
+
export declare const OVERLAY_Z_BASE = 1000;
|
|
4
|
+
export declare const OVERLAY_Z_STEP = 10;
|
|
5
|
+
export type OverlayProviderProps = PropsWithChildren<{
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
}>;
|
|
11
|
+
/** 无已挂载浮层时返回 undefined,调用方应保持默认层级 */
|
|
12
|
+
export declare const getNextImperativeOverlayZIndex: () => number | undefined;
|
|
13
|
+
/** 只写内联 z-index,不改 CSS 变量 */
|
|
14
|
+
export declare const imperativeOverlayStyle: (zIndex?: number) => CSSProperties | undefined;
|
|
15
|
+
export declare const resetOverlayZIndexRegistryForTest: () => void;
|
|
16
|
+
export declare const OverlayProvider: ({ zIndex, offset, step, max, children }: OverlayProviderProps) => import("react").JSX.Element;
|
|
17
|
+
export declare const useOverlayZIndex: (override?: number) => number;
|