@baishuyun/ui-mobile 0.9.0 → 0.10.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 (64) hide show
  1. package/dist/AMap/{AMap-B1GiEoPE.js → AMap-BkfhkrnK.js} +106 -106
  2. package/dist/AMap/index.js +4 -4
  3. package/dist/ActionSheet/{ActionSheet-DVck9uyS.js → ActionSheet-DJyeduZq.js} +7 -7
  4. package/dist/ActionSheet/index.js +6 -6
  5. package/dist/Calendar/{Calendar-B1TwDL1q.js → Calendar-Cf81JVOC.js} +353 -356
  6. package/dist/Calendar/index.js +5 -4
  7. package/dist/Calendar/{cssVars-DNOooryc.js → timeUtils-t4A3-Hr6.js} +1 -3
  8. package/dist/ConfigProvider/{ConfigProvider-xyGx046s.js → ConfigProvider-CNWefxiV.js} +14 -2
  9. package/dist/ConfigProvider/index.js +4 -4
  10. package/dist/ConfigProvider/{useLocale-Bf81I-9U.js → useLocale-DiKogqPs.js} +6 -0
  11. package/dist/Editor/Editor-CfA-ye-u.js +2774 -0
  12. package/dist/Editor/index.js +8 -8
  13. package/dist/Gantt/{Gantt-CbHw9RMw.js → Gantt-Bhvbj3l8.js} +220 -219
  14. package/dist/Gantt/index.js +8 -8
  15. package/dist/Icon/Icon-BKlmJSoE.js +23 -0
  16. package/dist/Icon/index.js +2 -2
  17. package/dist/Overlay/index.js +2 -2
  18. package/dist/Popup/{Popup-BIIDAUmB.js → Popup-Cg3t422z.js} +2 -2
  19. package/dist/Popup/index.js +4 -4
  20. package/dist/Segmented/Segmented-CxQ3Pd05.js +85 -0
  21. package/dist/Segmented/index.js +3 -0
  22. package/dist/components/Editor/{EditorHtml.d.ts → EditorHtmlPreview.d.ts} +1 -1
  23. package/dist/components/Editor/color/EditorColorPicker.d.ts +11 -0
  24. package/dist/components/Editor/color/colorUtils.d.ts +32 -0
  25. package/dist/components/Editor/constants/codeLanguages.d.ts +6 -0
  26. package/dist/components/Editor/hooks/useEditorAiSession.d.ts +20 -0
  27. package/dist/components/Editor/hooks/useEditorFocus.d.ts +1 -0
  28. package/dist/components/Editor/hooks/useEditorImageUpload.d.ts +17 -0
  29. package/dist/components/Editor/hooks/useEditorLink.d.ts +15 -0
  30. package/dist/components/Editor/hooks/useEditorValueBridge.d.ts +10 -0
  31. package/dist/components/Editor/htmlConfig.d.ts +2 -0
  32. package/dist/components/Editor/index.d.ts +1 -1
  33. package/dist/components/Editor/nodes/ExtendedLinkNode.d.ts +9 -0
  34. package/dist/components/Editor/plugins/CodeHighlightPlugin.d.ts +2 -0
  35. package/dist/components/Editor/plugins/EnterKeyPlugin.d.ts +1 -0
  36. package/dist/components/Editor/plugins/TablePlugin.d.ts +2 -0
  37. package/dist/components/Editor/popups/AiResultPopup.d.ts +13 -0
  38. package/dist/components/Editor/popups/ImageUrlPopup.d.ts +7 -0
  39. package/dist/components/Editor/popups/LinkPopup.d.ts +13 -0
  40. package/dist/components/Editor/popups/OptionSheets.d.ts +23 -0
  41. package/dist/components/Editor/popups/index.d.ts +4 -0
  42. package/dist/components/Editor/popups/shared.d.ts +11 -0
  43. package/dist/components/Editor/toolbar/Toolbar.d.ts +7 -1
  44. package/dist/components/Editor/toolbar/useTextFormats.d.ts +2 -15
  45. package/dist/components/Editor/utils/codeHighlighter.d.ts +12 -0
  46. package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +4 -0
  47. package/dist/components/Editor/utils/readTextFormats.d.ts +21 -0
  48. package/dist/components/Editor/utils/retainCodeSelection.d.ts +3 -0
  49. package/dist/components/Segmented/Segmented.d.ts +7 -0
  50. package/dist/components/Segmented/index.d.ts +2 -0
  51. package/dist/components/Segmented/interface.d.ts +42 -0
  52. package/dist/components/index.d.ts +3 -1
  53. package/dist/index.js +14 -13
  54. package/dist/locale/lang/en-US.json.d.ts +6 -0
  55. package/dist/locale/lang/zh-CN.json.d.ts +6 -0
  56. package/dist/locale/lang/zh-TW.json.d.ts +6 -0
  57. package/dist/style.css +1 -1
  58. package/dist/vendors/cssVars-BbL_cmFM.js +6 -0
  59. package/dist/vendors/{version-CslTV1sb.js → version-C0got4sp.js} +1 -1
  60. package/package.json +7 -1
  61. package/dist/Editor/Editor-DUsPQevQ.js +0 -2051
  62. package/dist/Icon/Icon-D3xi1oyo.js +0 -23
  63. package/dist/components/Editor/sheets.d.ts +0 -43
  64. /package/dist/Overlay/{Overlay-CqQWOqO4.js → Overlay-DFiZYsBs.js} +0 -0
@@ -1,9 +1,9 @@
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";
1
+ import "../vendors/version-C0got4sp.js";
2
+ import "../Overlay/Overlay-DFiZYsBs.js";
3
+ import "../ConfigProvider/useLocale-DiKogqPs.js";
4
+ import "../Popup/Popup-Cg3t422z.js";
5
+ import "../Icon/Icon-BKlmJSoE.js";
6
+ import "../ActionSheet/ActionSheet-DJyeduZq.js";
7
+ import { n as e, t } from "./Gantt-Bhvbj3l8.js";
8
+ import "../Calendar/timeUtils-t4A3-Hr6.js";
9
9
  export { e as ALL_ZOOM_LEVELS, t as default };
@@ -0,0 +1,23 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/components/Icon/loadIconfont.ts
3
+ var t = /* @__PURE__ */ new Set(), n = (e) => {
4
+ if (!e || t.has(e) || (t.add(e), [...document.scripts].some((t) => t.getAttribute("src") === e))) return;
5
+ let n = document.createElement("script");
6
+ n.setAttribute("src", e), document.body.appendChild(n);
7
+ }, r = { "bsy-icon": "_bsy-icon_gwzb9_1" };
8
+ //#endregion
9
+ //#region src/components/Icon/Icon.tsx
10
+ n("https://at.alicdn.com/t/c/font_4786625_bgf4g3m46wv.js");
11
+ var i = ({ name: t, size: n = 16, color: i, className: a }) => /* @__PURE__ */ e("svg", {
12
+ className: [r["bsy-icon"], a].filter(Boolean).join(" "),
13
+ style: {
14
+ color: i,
15
+ fontSize: `${n}px`
16
+ },
17
+ "aria-hidden": !0,
18
+ focusable: "false",
19
+ children: /* @__PURE__ */ e("use", { href: `#icon-${t}` })
20
+ });
21
+ i.displayName = "BsyIcon";
22
+ //#endregion
23
+ export { i as t };
@@ -1,3 +1,3 @@
1
- import "../vendors/version-CslTV1sb.js";
2
- import { t as e } from "./Icon-D3xi1oyo.js";
1
+ import "../vendors/version-C0got4sp.js";
2
+ import { t as e } from "./Icon-BKlmJSoE.js";
3
3
  export { e as default };
@@ -1,3 +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";
1
+ import "../vendors/version-C0got4sp.js";
2
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./Overlay-DFiZYsBs.js";
3
3
  export { a as OVERLAY_Z_BASE, n as OVERLAY_Z_STEP, i as OverlayProvider, t as getNextImperativeOverlayZIndex, e as imperativeOverlayStyle, r as useOverlayZIndex };
@@ -1,5 +1,5 @@
1
- import { o as e, r as t } from "../Overlay/Overlay-CqQWOqO4.js";
2
- import { t as n } from "../ConfigProvider/useLocale-Bf81I-9U.js";
1
+ import { o as e, r as t } from "../Overlay/Overlay-DFiZYsBs.js";
2
+ import { t as n } from "../ConfigProvider/useLocale-DiKogqPs.js";
3
3
  import { useEffect as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
4
4
  import { createPortal as s } from "react-dom";
5
5
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- import "../vendors/version-CslTV1sb.js";
2
- import { t as e } from "./Popup-BIIDAUmB.js";
3
- import "../Overlay/Overlay-CqQWOqO4.js";
4
- import "../ConfigProvider/useLocale-Bf81I-9U.js";
1
+ import "../vendors/version-C0got4sp.js";
2
+ import "../Overlay/Overlay-DFiZYsBs.js";
3
+ import "../ConfigProvider/useLocale-DiKogqPs.js";
4
+ import { t as e } from "./Popup-Cg3t422z.js";
5
5
  export { e as default };
@@ -0,0 +1,85 @@
1
+ import { t as e } from "../vendors/cssVars-BbL_cmFM.js";
2
+ import { useCallback as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
3
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { useControllableValue as c } from "ahooks";
5
+ //#region src/components/Segmented/Segmented.module.scss
6
+ var l = {
7
+ "bsy-mobile-segmented": "_bsy-mobile-segmented_1lzwm_1",
8
+ "bsy-mobile-segmented--block": "_bsy-mobile-segmented--block_1lzwm_13",
9
+ "bsy-mobile-segmented__item": "_bsy-mobile-segmented__item_1lzwm_18",
10
+ "bsy-mobile-segmented__item--block": "_bsy-mobile-segmented__item--block_1lzwm_37",
11
+ "bsy-mobile-segmented__item--active": "_bsy-mobile-segmented__item--active_1lzwm_44",
12
+ "bsy-mobile-segmented__item--inactive": "_bsy-mobile-segmented__item--inactive_1lzwm_47",
13
+ "bsy-mobile-segmented__item--disabled": "_bsy-mobile-segmented__item--disabled_1lzwm_53",
14
+ "bsy-mobile-segmented__slider": "_bsy-mobile-segmented__slider_1lzwm_64",
15
+ "bsy-mobile-segmented__slider--animated": "_bsy-mobile-segmented__slider--animated_1lzwm_74"
16
+ }, u = (u) => {
17
+ let { options: d, block: f = !1, disabled: p = !1, enableAnimation: m = !1, theme: h, className: g } = u, [_, v] = c(u), [y, b] = a({
18
+ width: 0,
19
+ left: 0
20
+ }), x = i(null), S = i(/* @__PURE__ */ new Map()), C = i(!1), w = d.some((e) => e.value === _), T = t(() => {
21
+ if (_ == null || !d.some((e) => e.value === _)) return;
22
+ let e = S.current.get(_), t = x.current;
23
+ if (!e || !t) return;
24
+ let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
25
+ b({
26
+ width: r.width,
27
+ left: r.left - n.left
28
+ });
29
+ }, [_, d]);
30
+ n(() => {
31
+ if (m && C.current) {
32
+ let e = requestAnimationFrame(T);
33
+ return () => cancelAnimationFrame(e);
34
+ }
35
+ T();
36
+ }, [m, T]), n(() => {
37
+ let e = new ResizeObserver(T), t = x.current;
38
+ return t && e.observe(t), () => e.disconnect();
39
+ }, [T]);
40
+ let E = r(() => {
41
+ let t = {};
42
+ return e(t, "--bsy-mobile-segmented-color", h?.colorText), e(t, "--bsy-mobile-segmented-background", h?.trackBg), e(t, "--bsy-mobile-segmented-hover-background", h?.itemHoverBg), e(t, "--bsy-mobile-segmented-hover-border", h?.itemHoverBorder), e(t, "--bsy-mobile-segmented-pressed-background", h?.itemPressedBg), e(t, "--bsy-mobile-segmented-disabled-color", h?.disabledColor), h?.itemSelectedBg && (t["--bsy-mobile-segmented-active-color"] = "#fff", t["--bsy-mobile-segmented-slider-background"] = h.itemSelectedBg, t["--bsy-mobile-segmented-slider-border"] = h.itemSelectedBg), t;
43
+ }, [h]), D = (e) => {
44
+ p || e.disabled || e.value === _ || (m && (C.current = !0), v(e.value));
45
+ };
46
+ return /* @__PURE__ */ s("div", {
47
+ ref: x,
48
+ className: [
49
+ l["bsy-mobile-segmented"],
50
+ f ? l["bsy-mobile-segmented--block"] : "",
51
+ g
52
+ ].filter(Boolean).join(" "),
53
+ style: {
54
+ ...E,
55
+ ...f && d.length > 0 ? { gridTemplateColumns: `repeat(${d.length}, minmax(0, 1fr))` } : void 0
56
+ },
57
+ children: [w ? /* @__PURE__ */ o("div", {
58
+ className: [l["bsy-mobile-segmented__slider"], m && C.current ? l["bsy-mobile-segmented__slider--animated"] : ""].filter(Boolean).join(" "),
59
+ style: {
60
+ width: y.width,
61
+ transform: `translateX(${y.left}px)`
62
+ }
63
+ }) : null, d.map((e) => {
64
+ let t = _ === e.value, n = p || e.disabled;
65
+ return /* @__PURE__ */ o("button", {
66
+ ref: (t) => {
67
+ t ? S.current.set(e.value, t) : S.current.delete(e.value);
68
+ },
69
+ type: "button",
70
+ disabled: n,
71
+ className: [
72
+ l["bsy-mobile-segmented__item"],
73
+ f ? l["bsy-mobile-segmented__item--block"] : "",
74
+ t ? l["bsy-mobile-segmented__item--active"] : l["bsy-mobile-segmented__item--inactive"],
75
+ n ? l["bsy-mobile-segmented__item--disabled"] : ""
76
+ ].filter(Boolean).join(" "),
77
+ onClick: () => D(e),
78
+ children: e.label
79
+ }, e.value);
80
+ })]
81
+ });
82
+ };
83
+ u.displayName = "BsyMobileSegmented";
84
+ //#endregion
85
+ export { u as t };
@@ -0,0 +1,3 @@
1
+ import "../vendors/version-C0got4sp.js";
2
+ import { t as e } from "./Segmented-CxQ3Pd05.js";
3
+ export { e as default };
@@ -1,3 +1,3 @@
1
- export declare const EditorHtml: ({ html }: {
1
+ export declare const EditorHtmlPreview: ({ html }: {
2
2
  html: string;
3
3
  }) => import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ export type EditorColorPickerMode = 'fontColor' | 'fill';
2
+ type EditorColorPickerProps = {
3
+ mode: EditorColorPickerMode;
4
+ currentColor: string;
5
+ customColors: string[];
6
+ onApply: (color: string) => void;
7
+ onCustomDraftChange: (color: string | null) => void;
8
+ onCustomConfirm: (color: string) => void;
9
+ };
10
+ export declare const EditorColorPicker: ({ mode, currentColor, customColors, onApply, onCustomDraftChange, onCustomConfirm, }: EditorColorPickerProps) => import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,32 @@
1
+ export type RGB = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ };
6
+ export type HSL = {
7
+ h: number;
8
+ s: number;
9
+ l: number;
10
+ };
11
+ export declare const EDITOR_COLOR_COLS = 11;
12
+ export declare const clamp01: (value: number) => number;
13
+ export declare const isTransparent: (value: string) => boolean;
14
+ export declare const normalizeHex: (value: string) => string | null;
15
+ export declare const parseColor: (value: string) => RGB | null;
16
+ export declare const rgbToHex: ({ r, g, b }: RGB) => string;
17
+ export declare const colorsEqual: (left: string, right: string) => boolean;
18
+ export declare const rgbToHsl: (rgb: RGB) => HSL;
19
+ export declare const hslToRgb: ({ h, s, l }: HSL) => RGB;
20
+ export declare const hslToHex: (hsl: HSL) => string;
21
+ export declare const hslFromSpectrumPoint: (x: number, y: number) => HSL;
22
+ export declare const spectrumPointFromHsl: (hsl: HSL) => {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ export declare const pointFromPointer: (clientX: number, clientY: number, rect: DOMRect) => {
27
+ x: number;
28
+ y: number;
29
+ };
30
+ export declare const pushCustomColor: (list: string[], color: string, max?: number) => string[];
31
+ export declare const getVisibleCustomColorCount: (width: number, itemSize?: number, gap?: number) => number;
32
+ export declare const ringColorForBasicSwatch: (presets: readonly string[], index: number) => string;
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT_CODE_LANGUAGE = "plaintext";
2
+ export declare const CODE_HIGHLIGHT_THEME = "github-light";
3
+ declare const CODE_LANGUAGE_IDS: readonly ["plaintext", "css", "html", "xml", "javascript", "typescript", "jsx", "go", "php", "c", "python", "java", "cpp", "csharp", "vb", "sql", "ruby", "swift", "bash", "lua", "markdown"];
4
+ export type CodeLanguageId = (typeof CODE_LANGUAGE_IDS)[number];
5
+ export declare const normalizeCodeLanguage: (language: string | null | undefined) => CodeLanguageId;
6
+ export {};
@@ -0,0 +1,20 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ import { EditorAi, EditorAiMode, EditorAiPreset } from '../interface';
3
+ type UseEditorAiSessionOptions = {
4
+ editor: LexicalEditor;
5
+ ai?: EditorAi;
6
+ };
7
+ export declare const useEditorAiSession: ({ editor, ai }: UseEditorAiSessionOptions) => {
8
+ mode: EditorAiMode | null;
9
+ snapshot: {
10
+ html: string;
11
+ text: string;
12
+ polishText: string;
13
+ };
14
+ preset: EditorAiPreset;
15
+ startTypeset: () => void;
16
+ startPolish: (nextPreset: EditorAiPreset) => void;
17
+ close: () => void;
18
+ apply: () => void;
19
+ };
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const useEditorFocus: () => boolean;
@@ -0,0 +1,17 @@
1
+ import { BaseSelection, LexicalEditor } from 'lexical';
2
+ import { ChangeEvent, RefObject } from 'react';
3
+ import { EditorUpload } from '../interface';
4
+ type UseEditorImageUploadOptions = {
5
+ editor: LexicalEditor;
6
+ upload?: EditorUpload;
7
+ savedSelectionRef: RefObject<BaseSelection | null>;
8
+ attachmentsBySrc: Map<string, unknown>;
9
+ };
10
+ export declare const useEditorImageUpload: ({ editor, upload, savedSelectionRef, attachmentsBySrc, }: UseEditorImageUploadOptions) => {
11
+ fileInputRef: RefObject<HTMLInputElement>;
12
+ uploadProgress: Record<string, number | undefined>;
13
+ insertImage: (src: string, altText: string, dataId?: string) => string;
14
+ onFileChange: (event: ChangeEvent<HTMLInputElement>) => Promise<void>;
15
+ abortUpload: () => void;
16
+ };
17
+ export {};
@@ -0,0 +1,15 @@
1
+ import { BaseSelection, LexicalEditor } from 'lexical';
2
+ import { RefObject } from 'react';
3
+ import { LinkDraft } from '../popups';
4
+ type UseEditorLinkOptions = {
5
+ editor: LexicalEditor;
6
+ savedSelectionRef: RefObject<BaseSelection | null>;
7
+ captureSelection: () => void;
8
+ };
9
+ export declare const useEditorLink: ({ editor, savedSelectionRef, captureSelection, }: UseEditorLinkOptions) => {
10
+ linkForm: LinkDraft | null;
11
+ openLink: () => void;
12
+ confirmLink: (draft: LinkDraft) => void;
13
+ closeLink: () => void;
14
+ };
15
+ export {};
@@ -0,0 +1,10 @@
1
+ import { EditorState, LexicalEditor } from 'lexical';
2
+ import { EditorProps } from '../interface';
3
+ type UseEditorValueBridgeOptions = {
4
+ editor: LexicalEditor;
5
+ value: EditorProps['value'];
6
+ onChange: EditorProps['onChange'];
7
+ attachmentsBySrc: Map<string, unknown>;
8
+ };
9
+ export declare const useEditorValueBridge: ({ editor, value, onChange, attachmentsBySrc, }: UseEditorValueBridgeOptions) => (editorState: EditorState) => void;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import { HTMLConfig } from 'lexical';
2
+ export declare const editorHtmlConfig: HTMLConfig;
@@ -1,3 +1,3 @@
1
1
  export { default } from './Editor';
2
- export { EditorHtml } from './EditorHtml';
2
+ export { EditorHtmlPreview } from './EditorHtmlPreview';
3
3
  export type { EditorAi, EditorAiMode, EditorAiPreset, EditorAiStatus, EditorProps, EditorToolbarConfigButton, EditorToolbarGroup, EditorToolbarProps, EditorUpload, EditorUploadContext, EditorUploadResult, } from './interface';
@@ -0,0 +1,9 @@
1
+ import { LinkNode, LinkAttributes, SerializedLinkNode } from '@lexical/link';
2
+ import { NodeKey } from 'lexical';
3
+ export declare class ExtendedLinkNode extends LinkNode {
4
+ constructor(url?: string, attributes?: LinkAttributes, key?: NodeKey);
5
+ static getType(): string;
6
+ static clone(node: ExtendedLinkNode): ExtendedLinkNode;
7
+ static importJSON(serializedNode: SerializedLinkNode): ExtendedLinkNode;
8
+ sanitizeUrl(url: string): string;
9
+ }
@@ -0,0 +1,2 @@
1
+ declare const CodeHighlightPlugin: () => null;
2
+ export default CodeHighlightPlugin;
@@ -0,0 +1 @@
1
+ export declare const EnterKeyPlugin: () => null;
@@ -0,0 +1,2 @@
1
+ declare const TablePlugin: () => null;
2
+ export default TablePlugin;
@@ -0,0 +1,13 @@
1
+ import { EditorAi, EditorAiMode, EditorAiPreset } from '../interface';
2
+ type AiResultPopupProps = {
3
+ open: boolean;
4
+ mode: EditorAiMode | null;
5
+ originalHtml: string;
6
+ ai: EditorAi | undefined;
7
+ polishPreset: EditorAiPreset;
8
+ onClose: () => void;
9
+ onApply: () => void;
10
+ onPickPreset: (preset: EditorAiPreset) => void;
11
+ };
12
+ export declare const AiResultPopup: ({ open, mode, originalHtml, ai, polishPreset, onClose, onApply, onPickPreset, }: AiResultPopupProps) => import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ type ImageUrlPopupProps = {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ onConfirm: (src: string) => void;
5
+ };
6
+ export declare const ImageUrlPopup: ({ open, onClose, onConfirm }: ImageUrlPopupProps) => import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,13 @@
1
+ export type LinkDraft = {
2
+ url: string;
3
+ text: string;
4
+ newBlank: boolean;
5
+ };
6
+ type LinkPopupProps = {
7
+ open: boolean;
8
+ seed: LinkDraft | null;
9
+ onClose: () => void;
10
+ onConfirm: (draft: LinkDraft) => void;
11
+ };
12
+ export declare const LinkPopup: ({ open, seed, onClose, onConfirm }: LinkPopupProps) => import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,23 @@
1
+ import { BaseSelection } from 'lexical';
2
+ import { EditorAiPreset } from '../interface';
3
+ import { EditorSheetKind } from '../toolbar/Toolbar';
4
+ type OptionSheetsProps = {
5
+ sheet: EditorSheetKind | 'aiPreset' | null;
6
+ onClose: () => void;
7
+ onTypeset: () => void;
8
+ onPolishMenu: () => void;
9
+ onPickPreset: (preset: EditorAiPreset) => void;
10
+ onPicture: (key: 'upload' | 'url') => void;
11
+ savedSelectionRef: {
12
+ current: BaseSelection | null;
13
+ };
14
+ committedColors: {
15
+ fontColor: string;
16
+ fill: string;
17
+ };
18
+ onColorCommit: (mode: 'fontColor' | 'fill', color: string) => void;
19
+ canTypeset: boolean;
20
+ canPolish: boolean;
21
+ };
22
+ export declare const OptionSheets: ({ sheet, onClose, onTypeset, onPolishMenu, onPickPreset, onPicture, savedSelectionRef, committedColors, onColorCommit, canTypeset, canPolish, }: OptionSheetsProps) => import("react").JSX.Element;
23
+ export {};
@@ -0,0 +1,4 @@
1
+ export { OptionSheets } from './OptionSheets';
2
+ export { LinkPopup, type LinkDraft } from './LinkPopup';
3
+ export { ImageUrlPopup } from './ImageUrlPopup';
4
+ export { AiResultPopup } from './AiResultPopup';
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ type SheetFormProps = {
3
+ open: boolean;
4
+ title: string;
5
+ bodyClassName?: string;
6
+ onClose: () => void;
7
+ onConfirm: () => void;
8
+ children: ReactNode;
9
+ };
10
+ export declare const SheetForm: ({ open, title, bodyClassName, onClose, onConfirm, children, }: SheetFormProps) => import("react").JSX.Element;
11
+ export {};
@@ -1,10 +1,16 @@
1
1
  import { EditorToolbarGroup } from '../interface';
2
+ import { TextFormatsState } from './useTextFormats';
2
3
  export type EditorSheetKind = 'align' | 'heading' | 'fontSize' | 'fontColor' | 'fill' | 'ai' | 'picture';
3
4
  type ToolbarProps = {
4
5
  config: EditorToolbarGroup[];
6
+ formats: TextFormatsState;
7
+ colorValues: {
8
+ fontColor: string;
9
+ fill: string;
10
+ };
5
11
  openSheet: EditorSheetKind | 'aiPreset' | null;
6
12
  onOpenSheet: (kind: EditorSheetKind) => void;
7
13
  onOpenLink: () => void;
8
14
  };
9
- declare const Toolbar: ({ config, openSheet, onOpenSheet, onOpenLink }: ToolbarProps) => import("react").JSX.Element;
15
+ declare const Toolbar: ({ config, formats, colorValues, openSheet, onOpenSheet, onOpenLink, }: ToolbarProps) => import("react").JSX.Element;
10
16
  export default Toolbar;
@@ -1,16 +1,3 @@
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
- };
1
+ import { TextFormatsState } from '../utils/readTextFormats';
2
+ export type { TextFormatsState };
15
3
  export declare const useTextFormatsState: () => TextFormatsState;
16
- export {};
@@ -0,0 +1,12 @@
1
+ import { CodeNode } from '@lexical/code-core';
2
+ import { HighlighterCore } from '@shikijs/core';
3
+ import { LexicalNode } from 'lexical';
4
+ import { CodeLanguageId } from '../constants/codeLanguages';
5
+ type HighlightLang = Exclude<CodeLanguageId, 'plaintext'>;
6
+ export declare const isHighlightLang: (language: string) => language is HighlightLang;
7
+ export declare const loadCodeHighlighter: () => Promise<HighlighterCore>;
8
+ export declare const isCodeLanguageReady: (highlighter: HighlighterCore, language: string) => language is HighlightLang;
9
+ export declare const loadCodeLanguage: (language: HighlightLang) => Promise<HighlighterCore>;
10
+ export declare const loadCodeTheme: () => Promise<HighlighterCore>;
11
+ export declare const $tokenizeCodeNode: (codeNode: CodeNode, language: string, highlighter: HighlighterCore | null) => LexicalNode[];
12
+ export {};
@@ -0,0 +1,4 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ export declare const $placeProgrammaticCaret: (focused: boolean) => void;
3
+ export declare const $ensureRangeSelection: () => void;
4
+ export declare const ensureEditableRangeSelection: (editor: LexicalEditor) => void;
@@ -0,0 +1,21 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ type EditorAlign = 'left' | 'center' | 'right';
3
+ export type TextFormatsState = {
4
+ bold: boolean;
5
+ italic: boolean;
6
+ underline: boolean;
7
+ strikethrough: boolean;
8
+ fontColor: string;
9
+ backgroundColor: string;
10
+ align: EditorAlign;
11
+ listType: 'bullet' | 'number' | false;
12
+ canOutdent: boolean;
13
+ headingTag: 'h1' | 'h2' | 'h3' | false;
14
+ hasRangeSelection: boolean;
15
+ hasEditorText: boolean;
16
+ };
17
+ export declare const IDLE_TEXT_FORMATS: TextFormatsState;
18
+ export declare const $readTextFormats: (isFocused: boolean) => TextFormatsState;
19
+ export declare const applyWithLiveFormats: (editor: LexicalEditor, apply: (formats: TextFormatsState) => void) => void;
20
+ export declare const ensureEditableLiveFormats: (editor: LexicalEditor) => TextFormatsState;
21
+ export {};
@@ -0,0 +1,3 @@
1
+ import { NodeKey } from 'lexical';
2
+ /** 仅恢复原本位于当前 CodeNode 内的光标,避免高亮过程抢占其他编辑位置。 */
3
+ export declare const $updateAndRetainSelection: (nodeKey: NodeKey, updateFn: () => boolean) => void;
@@ -0,0 +1,7 @@
1
+ import { Key } from 'react';
2
+ import { SegmentedProps } from './interface';
3
+ declare const Segmented: {
4
+ <T extends Key = string | number>(props: SegmentedProps<T>): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ export default Segmented;
@@ -0,0 +1,2 @@
1
+ export { default } from './Segmented';
2
+ export type { SegmentedOption, SegmentedProps, SegmentedTheme } from './interface';
@@ -0,0 +1,42 @@
1
+ import { Key, ReactNode } from 'react';
2
+ export interface SegmentedOption<T extends Key = string | number> {
3
+ label: ReactNode;
4
+ value: T;
5
+ disabled?: boolean;
6
+ }
7
+ export interface SegmentedTheme {
8
+ /** 普通文字颜色 */
9
+ colorText?: string;
10
+ /** 选中项背景色;传入后选中文字为白色 */
11
+ itemSelectedBg?: string;
12
+ /** 支持 hover 的指针设备上,未选中项的悬停背景色 */
13
+ itemHoverBg?: string;
14
+ /** 支持 hover 的指针设备上,未选中项的悬停边框色 */
15
+ itemHoverBorder?: string;
16
+ /** 轨道背景色 */
17
+ trackBg?: string;
18
+ /** 按压未选中项时的背景色 */
19
+ itemPressedBg?: string;
20
+ /** 禁用文字颜色 */
21
+ disabledColor?: string;
22
+ }
23
+ export interface SegmentedProps<T extends Key = string | number> {
24
+ /** 数据化配置选项内容 */
25
+ options: readonly SegmentedOption<T>[];
26
+ /** 当前选中的值 */
27
+ value?: T;
28
+ /** 非受控模式的初始值 */
29
+ defaultValue?: T;
30
+ /** 选项变化时触发 */
31
+ onChange?: (value: T) => void;
32
+ /** 是否整组禁用 */
33
+ disabled?: boolean;
34
+ /** 是否撑满父容器并等分选项 */
35
+ block?: boolean;
36
+ /** 用户切换时是否启用滑块动画 */
37
+ enableAnimation?: boolean;
38
+ /** 组件级颜色 token */
39
+ theme?: SegmentedTheme;
40
+ /** 根节点附加类名 */
41
+ className?: string;
42
+ }
@@ -7,6 +7,8 @@ export type { GanttProps, GanttTask, ZoomLevel, GanttTheme } from './Gantt';
7
7
  export { ALL_ZOOM_LEVELS } from './Gantt';
8
8
  export { default as Calendar } from './Calendar';
9
9
  export type { CalendarProps, CalendarEvent, CalendarViewMode, CalendarTheme, CalendarPanelBgImagePosition, } from './Calendar';
10
+ export { default as Segmented } from './Segmented';
11
+ export type { SegmentedOption, SegmentedProps, SegmentedTheme } from './Segmented';
10
12
  export { default as AMap, useAMap } from './AMap';
11
13
  export type { AMapControlsProps, AMapLabelColor, AMapLocateProps, AMapMarker, AMapMarkerDisplayChange, AMapMarkerSize, AMapMarkersProps, AMapPoiItem, AMapPoiSearchProps, AMapRootProps, Location, } from './AMap';
12
14
  export { ConfigProvider, useLocale } from './ConfigProvider';
@@ -15,5 +17,5 @@ export { OverlayProvider, useOverlayZIndex, OVERLAY_Z_BASE, OVERLAY_Z_STEP, getN
15
17
  export type { OverlayProviderProps } from './Overlay';
16
18
  export { default as Icon } from './Icon';
17
19
  export type { IconProps } from './Icon';
18
- export { default as Editor, EditorHtml } from './Editor';
20
+ export { default as Editor, EditorHtmlPreview } from './Editor';
19
21
  export type { EditorAi, EditorAiMode, EditorAiPreset, EditorAiStatus, EditorProps, EditorToolbarConfigButton, EditorToolbarGroup, EditorToolbarProps, EditorUpload, EditorUploadContext, EditorUploadResult, } from './Editor';
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
- import "./vendors/version-CslTV1sb.js";
2
- import { t as e } from "./Popup/Popup-BIIDAUmB.js";
3
- import { t } from "./ActionSheet/ActionSheet-DVck9uyS.js";
4
- import { n, t as r } from "./Gantt/Gantt-CbHw9RMw.js";
5
- import { t as i } from "./Calendar/Calendar-B1TwDL1q.js";
6
- import { t as a } from "./Icon/Icon-D3xi1oyo.js";
7
- import { n as o, t as s } from "./AMap/AMap-B1GiEoPE.js";
8
- import { n as c, t as l } from "./Editor/Editor-DUsPQevQ.js";
9
- import { a as u, i as d, n as f, o as p, r as m, t as h } from "./Overlay/Overlay-CqQWOqO4.js";
10
- import { t as g } from "./ConfigProvider/useLocale-Bf81I-9U.js";
11
- import "./Calendar/cssVars-DNOooryc.js";
12
- import { t as _ } from "./ConfigProvider/ConfigProvider-xyGx046s.js";
13
- export { n as ALL_ZOOM_LEVELS, s as AMap, t as ActionSheet, i as Calendar, _ as ConfigProvider, l as Editor, c as EditorHtml, r as Gantt, a as Icon, h as OVERLAY_Z_BASE, f as OVERLAY_Z_STEP, m as OverlayProvider, e as Popup, d as getNextImperativeOverlayZIndex, u as imperativeOverlayStyle, o as useAMap, g as useLocale, p as useOverlayZIndex };
1
+ import "./vendors/version-C0got4sp.js";
2
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./Overlay/Overlay-DFiZYsBs.js";
3
+ import { t as o } from "./ConfigProvider/useLocale-DiKogqPs.js";
4
+ import { t as s } from "./Popup/Popup-Cg3t422z.js";
5
+ import { t as c } from "./Icon/Icon-BKlmJSoE.js";
6
+ import { t as l } from "./ActionSheet/ActionSheet-DJyeduZq.js";
7
+ import { n as u, t as d } from "./Gantt/Gantt-Bhvbj3l8.js";
8
+ import "./Calendar/timeUtils-t4A3-Hr6.js";
9
+ import { t as f } from "./Calendar/Calendar-Cf81JVOC.js";
10
+ import { t as p } from "./Segmented/Segmented-CxQ3Pd05.js";
11
+ import { n as m, t as h } from "./AMap/AMap-BkfhkrnK.js";
12
+ import { t as g } from "./ConfigProvider/ConfigProvider-CNWefxiV.js";
13
+ import { n as _, t as v } from "./Editor/Editor-CfA-ye-u.js";
14
+ export { u as ALL_ZOOM_LEVELS, h as AMap, l as ActionSheet, f as Calendar, g as ConfigProvider, v as Editor, _ as EditorHtmlPreview, d as Gantt, c as Icon, a as OVERLAY_Z_BASE, n as OVERLAY_Z_STEP, i as OverlayProvider, s as Popup, p as Segmented, t as getNextImperativeOverlayZIndex, e as imperativeOverlayStyle, m as useAMap, o as useLocale, r as useOverlayZIndex };
@@ -118,6 +118,12 @@ declare const _default: {
118
118
  "fontColor": "Font color",
119
119
  "fill": "Fill",
120
120
  "fillNone": "No fill",
121
+ "presetColors": "Preset colors",
122
+ "customColor": "Custom",
123
+ "customColors": "Custom colors",
124
+ "addSwatch": "Add color",
125
+ "colorBack": "Back to colors",
126
+ "colorSpectrum": "Color spectrum",
121
127
  "picture": "Image",
122
128
  "uploadImage": "Upload image",
123
129
  "imageUrl": "Image URL",