@bikdotai/bik-component-library 0.0.850-beta.1 → 0.0.850-beta.3
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/cjs/assets/icons/ShipStation.svg.js +1 -1
- package/dist/cjs/assets/icons/ShipStation.svg.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +14 -8
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +32 -24
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +2 -2
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +2 -2
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/cjs/components/bik-layout/CommonStyles.js +6 -4
- package/dist/cjs/components/bik-layout/CommonStyles.js.map +1 -1
- package/dist/cjs/components/button/themes.js +3 -3
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePicker.js +1 -1
- package/dist/cjs/components/datePicker/DatePicker.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePicker.styled.js +14 -20
- package/dist/cjs/components/datePicker/DatePicker.styled.js.map +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js.map +1 -1
- package/dist/cjs/components/dropdown/Common.styled.js +5 -6
- package/dist/cjs/components/dropdown/Common.styled.js.map +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/input/Input.styled.js +12 -25
- package/dist/cjs/components/input/Input.styled.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.js +1 -1
- package/dist/cjs/components/tabs/Tabs.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.styles.js +8 -22
- package/dist/cjs/components/tabs/Tabs.styles.js.map +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.js.map +1 -1
- package/dist/cjs/components/tag/Tag.styled.js +0 -4
- package/dist/cjs/components/tag/Tag.styled.js.map +1 -1
- package/dist/cjs/components/tag/model.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +21 -16
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/editor/extensions/characterLimit/CharacterLimitExtension.js +3 -3
- package/dist/cjs/editor/extensions/characterLimit/CharacterLimitExtension.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionChipNodeView.js +2 -0
- package/dist/cjs/editor/extensions/mention/MentionChipNodeView.js.map +1 -0
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/ShipStation.svg.js +2 -2
- package/dist/esm/assets/icons/ShipStation.svg.js.map +1 -1
- package/dist/esm/assets/icons/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +21 -15
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +5 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +243 -227
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.js +57 -49
- package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +26 -22
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.js +93 -77
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +194 -168
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +118 -109
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +117 -110
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/tools.d.ts +10 -0
- package/dist/esm/components/agent-builder/constants/tools.js +27 -14
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +6 -2
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +46 -43
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +132 -117
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +3 -2
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +24 -19
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +9 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +15 -9
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.js +71 -69
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.model.d.ts +6 -0
- package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
- package/dist/esm/components/agent-listing/AgentTable.js +29 -27
- package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableRow.d.ts +2 -0
- package/dist/esm/components/agent-listing/AgentTableRow.js +50 -36
- package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/esm/components/bik-layout/CommonStyles.js +3 -1
- package/dist/esm/components/bik-layout/CommonStyles.js.map +1 -1
- package/dist/esm/components/button/themes.js +1 -1
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/datePicker/DatePicker.js +21 -22
- package/dist/esm/components/datePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/datePicker/DatePicker.styled.d.ts +0 -10
- package/dist/esm/components/datePicker/DatePicker.styled.js +16 -23
- package/dist/esm/components/datePicker/DatePicker.styled.js.map +1 -1
- package/dist/esm/components/dropdown/ChipInput.d.ts +0 -1
- package/dist/esm/components/dropdown/ChipInput.js +30 -37
- package/dist/esm/components/dropdown/ChipInput.js.map +1 -1
- package/dist/esm/components/dropdown/Common.styled.js +6 -7
- package/dist/esm/components/dropdown/Common.styled.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -2
- package/dist/esm/components/dropdown/Dropdown.js +89 -96
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +95 -103
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.d.ts +0 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +17 -17
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js.map +1 -1
- package/dist/esm/components/dropdown/type.d.ts +0 -2
- package/dist/esm/components/input/Input.js +101 -104
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +0 -2
- package/dist/esm/components/input/Input.styled.d.ts +0 -2
- package/dist/esm/components/input/Input.styled.js +25 -38
- package/dist/esm/components/input/Input.styled.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.js +81 -103
- package/dist/esm/components/tabs/Tabs.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.model.d.ts +0 -7
- package/dist/esm/components/tabs/Tabs.styles.d.ts +0 -2
- package/dist/esm/components/tabs/Tabs.styles.js +9 -23
- package/dist/esm/components/tabs/Tabs.styles.js.map +1 -1
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +15 -17
- package/dist/esm/components/tag/Tag.js.map +1 -1
- package/dist/esm/components/tag/Tag.styled.d.ts +0 -1
- package/dist/esm/components/tag/Tag.styled.js +6 -10
- package/dist/esm/components/tag/Tag.styled.js.map +1 -1
- package/dist/esm/components/tag/model.d.ts +0 -5
- package/dist/esm/components/tag/model.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +129 -126
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +24 -19
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +17 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.d.ts +7 -0
- package/dist/esm/editor/extensions/buildExtensions.js +30 -24
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.d.ts +20 -3
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.js +40 -25
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionChipNodeView.d.ts +17 -0
- package/dist/esm/editor/extensions/mention/MentionChipNodeView.js +39 -0
- package/dist/esm/editor/extensions/mention/MentionChipNodeView.js.map +1 -0
- package/dist/esm/editor/extensions/mention/MentionExtension.d.ts +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +67 -45
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/index.js +761 -759
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
2
|
-
import { getMarkRange as
|
|
3
|
-
import { useEditor as
|
|
4
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as u, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { getMarkRange as vt } from "../node_modules/@tiptap/core/dist/index.js";
|
|
3
|
+
import { useEditor as bt, EditorContent as X } from "@tiptap/react";
|
|
4
|
+
import { forwardRef as Et, useState as A, useRef as a, useEffect as At, useImperativeHandle as Tt } from "react";
|
|
5
5
|
import { BodyCaption as Y } from "../components/TypographyStyle.js";
|
|
6
|
-
import { BikEditorShell as
|
|
6
|
+
import { BikEditorShell as It, BikJsonHeader as Rt, BikJsonBody as Jt, BikJsonEmptyState as Lt, BikJsonError as Mt } from "./BikEditor.styles.js";
|
|
7
7
|
import { DEFAULT_FORMAT_STATE as tt } from "./BikEditor.types.js";
|
|
8
|
-
import { buildJsonCodeBlockHtml as
|
|
9
|
-
import { buildExtensions as
|
|
10
|
-
import { LinkBubbleMenu as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
function
|
|
8
|
+
import { buildJsonCodeBlockHtml as Ot, buildSectionedContent as et, normalizeHtml as s, extractActiveFormats as nt, extractContent as ot, getCodeBlockText as g, parseJson as p, extractBodyContent as Ft, extractSectionContent as zt, setCodeBlockText as x, findSectionEndPos as rt, findSectionStartPos as Nt, setSectionContentInEditor as T, insertInlineHtml as jt } from "./BikEditor.utils.js";
|
|
9
|
+
import { buildExtensions as Ht } from "./extensions/buildExtensions.js";
|
|
10
|
+
import { LinkBubbleMenu as wt } from "./floating/LinkBubbleMenu.js";
|
|
11
|
+
import Pt from "../icons/BIK AI specific/WandSparkles.js";
|
|
12
|
+
import Dt from "../icons/Actions/Formatting/Copy.js";
|
|
13
|
+
import qt from "../icons/Actions/Common actions/Code.js";
|
|
14
|
+
import Ut from "../icons/Informational/General/Info.js";
|
|
15
|
+
function $t(k) {
|
|
16
16
|
return Object.entries(k).map(
|
|
17
17
|
([v, C]) => `${v.replace(/([A-Z])/g, (y) => `-${y.toLowerCase()}`)}:${C}`
|
|
18
18
|
).join(";");
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const Wt = (k, v) => {
|
|
21
21
|
const {
|
|
22
22
|
initialContent: C,
|
|
23
23
|
sections: y,
|
|
24
24
|
features: B,
|
|
25
|
-
disabled:
|
|
26
|
-
maxCharacters:
|
|
27
|
-
characterLimit:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
disabled: it,
|
|
26
|
+
maxCharacters: I,
|
|
27
|
+
characterLimit: st,
|
|
28
|
+
characterLimitHard: ct,
|
|
29
|
+
shortcuts: at,
|
|
30
|
+
sendShortcut: lt,
|
|
31
|
+
mentions: l,
|
|
31
32
|
slashCommands: S,
|
|
32
|
-
link:
|
|
33
|
-
onPaste:
|
|
34
|
-
onReady:
|
|
33
|
+
link: dt,
|
|
34
|
+
onPaste: ut,
|
|
35
|
+
onReady: R,
|
|
35
36
|
onChange: J,
|
|
36
37
|
onSend: b,
|
|
37
38
|
onFocus: L,
|
|
38
39
|
onBlur: M,
|
|
39
40
|
onSelectionChange: O,
|
|
40
|
-
minHeight:
|
|
41
|
-
maxHeight:
|
|
42
|
-
style:
|
|
43
|
-
className:
|
|
41
|
+
minHeight: mt,
|
|
42
|
+
maxHeight: ft,
|
|
43
|
+
style: gt,
|
|
44
|
+
className: ht,
|
|
44
45
|
editorClassName: F,
|
|
45
46
|
editorStyle: z,
|
|
46
47
|
renderJsonError: N
|
|
47
|
-
} = k, m = !!B?.jsonMode, [f, j] = A(null), [
|
|
48
|
+
} = k, m = !!B?.jsonMode, [f, j] = A(null), [pt, H] = A(!1), [Ct, w] = A(
|
|
48
49
|
m && !(C ?? "").trim()
|
|
49
|
-
),
|
|
50
|
-
|
|
51
|
-
y.map((t) => ({ ...t, content:
|
|
52
|
-
) :
|
|
53
|
-
D.current =
|
|
50
|
+
), St = m ? Ot(C ?? "") : y?.length ? et(
|
|
51
|
+
s(C ?? ""),
|
|
52
|
+
y.map((t) => ({ ...t, content: s(t.content) }))
|
|
53
|
+
) : s(C ?? ""), E = a([]), P = a(!1), D = a(R);
|
|
54
|
+
D.current = R;
|
|
54
55
|
const q = a(J);
|
|
55
56
|
q.current = J;
|
|
56
57
|
const U = a(O);
|
|
@@ -61,44 +62,46 @@ const $t = (k, v) => {
|
|
|
61
62
|
V.current = M;
|
|
62
63
|
const _ = a(b);
|
|
63
64
|
_.current = b;
|
|
64
|
-
const Q = a(
|
|
65
|
-
Q.current =
|
|
66
|
-
const Z = a(
|
|
67
|
-
Z.current =
|
|
65
|
+
const Q = a(l?.agents ?? []);
|
|
66
|
+
Q.current = l?.agents ?? [];
|
|
67
|
+
const Z = a(l?.teams ?? []);
|
|
68
|
+
Z.current = l?.teams ?? [];
|
|
68
69
|
const G = a(S?.items ?? []);
|
|
69
70
|
G.current = S?.items ?? [];
|
|
70
|
-
const n =
|
|
71
|
-
extensions:
|
|
71
|
+
const n = bt({
|
|
72
|
+
extensions: Ht({
|
|
72
73
|
features: B,
|
|
73
74
|
placeholder: k.placeholder,
|
|
74
|
-
maxCharacters:
|
|
75
|
-
characterLimit:
|
|
75
|
+
maxCharacters: I,
|
|
76
|
+
characterLimit: st,
|
|
77
|
+
characterLimitHard: ct,
|
|
76
78
|
hasSections: (y?.length ?? 0) > 0,
|
|
77
79
|
mentions: {
|
|
78
|
-
agents:
|
|
79
|
-
teams:
|
|
80
|
+
agents: l ? Q : void 0,
|
|
81
|
+
teams: l ? Z : void 0
|
|
80
82
|
},
|
|
81
83
|
slashCommands: S ? G : void 0,
|
|
82
|
-
onPaste:
|
|
84
|
+
onPaste: ut,
|
|
83
85
|
onSend: b ? (t) => _.current?.(t) : void 0,
|
|
84
|
-
sendShortcut:
|
|
85
|
-
shortcuts:
|
|
86
|
-
onMentionSelected:
|
|
86
|
+
sendShortcut: lt,
|
|
87
|
+
shortcuts: at,
|
|
88
|
+
onMentionSelected: l?.onSelect,
|
|
87
89
|
onSlashCommandSelected: S?.onSelect,
|
|
88
|
-
renderMentionItem:
|
|
89
|
-
renderMentionDropdown:
|
|
90
|
-
removeMentionTriggerOnDismiss:
|
|
90
|
+
renderMentionItem: l?.renderItem,
|
|
91
|
+
renderMentionDropdown: l?.renderDropdown,
|
|
92
|
+
removeMentionTriggerOnDismiss: l?.removeTriggerOnDismiss,
|
|
93
|
+
renderMentionChipIcon: l?.renderChipIcon,
|
|
91
94
|
renderSlashCommandItem: S?.renderItem,
|
|
92
95
|
renderSlashCommandDropdown: S?.renderDropdown
|
|
93
96
|
}),
|
|
94
|
-
content:
|
|
95
|
-
editable: !
|
|
97
|
+
content: St,
|
|
98
|
+
editable: !it,
|
|
96
99
|
immediatelyRender: !1,
|
|
97
100
|
// SSR-safe — NEVER remove this
|
|
98
101
|
editorProps: {
|
|
99
102
|
attributes: {
|
|
100
103
|
...F ? { class: F } : {},
|
|
101
|
-
...z ? { style:
|
|
104
|
+
...z ? { style: $t(z) } : {}
|
|
102
105
|
}
|
|
103
106
|
},
|
|
104
107
|
onUpdate: ({ editor: t }) => {
|
|
@@ -114,46 +117,46 @@ const $t = (k, v) => {
|
|
|
114
117
|
onFocus: () => W.current?.(),
|
|
115
118
|
onBlur: () => V.current?.()
|
|
116
119
|
});
|
|
117
|
-
function
|
|
120
|
+
function i(t) {
|
|
118
121
|
n ? t(n) : E.current.push(t);
|
|
119
122
|
}
|
|
120
|
-
|
|
123
|
+
At(() => {
|
|
121
124
|
if (n && (E.current.length > 0 && E.current.splice(0).forEach((e) => e(n)), P.current || (P.current = !0, D.current?.()), m)) {
|
|
122
125
|
const t = g(n), e = p(t);
|
|
123
126
|
j(e.valid ? null : e), w(!t.trim());
|
|
124
127
|
}
|
|
125
|
-
}, [n, m]),
|
|
128
|
+
}, [n, m]), Tt(
|
|
126
129
|
v,
|
|
127
130
|
() => ({
|
|
128
131
|
// ── Focus ────────────────────────────────────────────────────────
|
|
129
|
-
focus: (t) =>
|
|
130
|
-
blur: () =>
|
|
132
|
+
focus: (t) => i((e) => e.commands.focus(t)),
|
|
133
|
+
blur: () => i((t) => t.commands.blur()),
|
|
131
134
|
// ── Content ──────────────────────────────────────────────────────
|
|
132
|
-
clearContent: () =>
|
|
135
|
+
clearContent: () => i((t) => t.commands.clearContent(!0)),
|
|
133
136
|
setContent: (t) => {
|
|
134
|
-
const e =
|
|
135
|
-
|
|
137
|
+
const e = s(t);
|
|
138
|
+
i((o) => o.commands.setContent(e, { emitUpdate: !0 }));
|
|
136
139
|
},
|
|
137
140
|
insertContent: (t) => {
|
|
138
|
-
const e =
|
|
139
|
-
|
|
141
|
+
const e = s(t);
|
|
142
|
+
i((o) => o.commands.insertContent(e));
|
|
140
143
|
},
|
|
141
144
|
insertInlineContent: (t) => {
|
|
142
|
-
|
|
145
|
+
i((e) => jt(e, t));
|
|
143
146
|
},
|
|
144
147
|
insertAtStart: (t) => {
|
|
145
|
-
const e =
|
|
146
|
-
|
|
148
|
+
const e = s(t);
|
|
149
|
+
i((o) => o.commands.insertContentAt(1, e));
|
|
147
150
|
},
|
|
148
151
|
insertBlock: (t) => {
|
|
149
|
-
const e =
|
|
150
|
-
|
|
152
|
+
const e = s(t);
|
|
153
|
+
i(
|
|
151
154
|
(o) => o.commands.insertContentAt(o.state.doc.content.size, e)
|
|
152
155
|
);
|
|
153
156
|
},
|
|
154
157
|
appendInline: (t) => {
|
|
155
|
-
const e =
|
|
156
|
-
|
|
158
|
+
const e = s(t);
|
|
159
|
+
i(
|
|
157
160
|
(o) => o.commands.insertContentAt(o.state.doc.content.size - 1, e)
|
|
158
161
|
);
|
|
159
162
|
},
|
|
@@ -179,8 +182,8 @@ const $t = (k, v) => {
|
|
|
179
182
|
return { from: t, to: e };
|
|
180
183
|
},
|
|
181
184
|
insertAtPosition: (t, e) => {
|
|
182
|
-
const o =
|
|
183
|
-
|
|
185
|
+
const o = s(e);
|
|
186
|
+
i((r) => r.commands.insertContentAt(t, o));
|
|
184
187
|
},
|
|
185
188
|
getSelectedText: () => {
|
|
186
189
|
if (!n) return "";
|
|
@@ -189,7 +192,7 @@ const $t = (k, v) => {
|
|
|
189
192
|
return t.doc.textBetween(e, o, " ");
|
|
190
193
|
const c = t.schema.marks.link;
|
|
191
194
|
if (c) {
|
|
192
|
-
const h =
|
|
195
|
+
const h = vt(t.doc.resolve(e), c);
|
|
193
196
|
if (h)
|
|
194
197
|
return t.doc.textBetween(h.from, h.to, " ");
|
|
195
198
|
}
|
|
@@ -198,16 +201,16 @@ const $t = (k, v) => {
|
|
|
198
201
|
// ── Character count ───────────────────────────────────────────────
|
|
199
202
|
getCharacterCount: () => ({
|
|
200
203
|
count: n?.storage.characterCount?.characters?.() ?? n?.getText().length ?? 0,
|
|
201
|
-
limit:
|
|
204
|
+
limit: I ?? null
|
|
202
205
|
}),
|
|
203
206
|
// ── Sections ─────────────────────────────────────────────────────
|
|
204
|
-
getSectionContent: (t) => n ?
|
|
207
|
+
getSectionContent: (t) => n ? zt(n, t) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
|
|
205
208
|
setSectionContent: (t, e) => {
|
|
206
|
-
const o =
|
|
207
|
-
|
|
209
|
+
const o = s(e);
|
|
210
|
+
i((r) => T(r, t, o));
|
|
208
211
|
},
|
|
209
212
|
focusSection: (t) => {
|
|
210
|
-
|
|
213
|
+
i((e) => {
|
|
211
214
|
if (t === "body") {
|
|
212
215
|
let r = e.state.doc.content.size - 1;
|
|
213
216
|
e.state.doc.descendants((c, h) => (c.type.name === "sectionDivider" && r === e.state.doc.content.size - 1 && (r = h - 1), r === e.state.doc.content.size - 1)), r < 1 && (r = 1), e.chain().focus().setTextSelection(r).run();
|
|
@@ -221,27 +224,27 @@ const $t = (k, v) => {
|
|
|
221
224
|
});
|
|
222
225
|
},
|
|
223
226
|
clearSection: (t) => {
|
|
224
|
-
|
|
227
|
+
i((e) => T(e, t, "<p></p>"));
|
|
225
228
|
},
|
|
226
229
|
// ── Convenience body shorthands ───────────────────────────────────
|
|
227
|
-
getBodyContent: () => n ?
|
|
230
|
+
getBodyContent: () => n ? Ft(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
|
|
228
231
|
setBodyContent: (t) => {
|
|
229
|
-
const e =
|
|
230
|
-
|
|
232
|
+
const e = s(t);
|
|
233
|
+
i((o) => T(o, "body", e));
|
|
231
234
|
},
|
|
232
235
|
setBodyAndSections: (t, e) => {
|
|
233
236
|
const o = et(
|
|
234
|
-
|
|
237
|
+
s(t),
|
|
235
238
|
e.map((r) => ({
|
|
236
239
|
id: r.id,
|
|
237
|
-
content:
|
|
240
|
+
content: s(r.content)
|
|
238
241
|
}))
|
|
239
242
|
);
|
|
240
|
-
|
|
243
|
+
i((r) => r.commands.setContent(o, { emitUpdate: !0 }));
|
|
241
244
|
},
|
|
242
245
|
appendBodyContent: (t) => {
|
|
243
|
-
const e =
|
|
244
|
-
|
|
246
|
+
const e = s(t);
|
|
247
|
+
i((o) => {
|
|
245
248
|
const r = rt(o, "body");
|
|
246
249
|
o.commands.insertContentAt(r - 1, e, {
|
|
247
250
|
parseOptions: { preserveWhitespace: !0 }
|
|
@@ -249,17 +252,17 @@ const $t = (k, v) => {
|
|
|
249
252
|
});
|
|
250
253
|
},
|
|
251
254
|
insertAtSectionStart: (t, e) => {
|
|
252
|
-
const o =
|
|
253
|
-
|
|
254
|
-
const c =
|
|
255
|
+
const o = s(e);
|
|
256
|
+
i((r) => {
|
|
257
|
+
const c = Nt(r, t);
|
|
255
258
|
c !== -1 && r.commands.insertContentAt(c, o, {
|
|
256
259
|
parseOptions: { preserveWhitespace: !0 }
|
|
257
260
|
});
|
|
258
261
|
});
|
|
259
262
|
},
|
|
260
263
|
insertAtSectionEnd: (t, e) => {
|
|
261
|
-
const o =
|
|
262
|
-
|
|
264
|
+
const o = s(e);
|
|
265
|
+
i((r) => {
|
|
263
266
|
const c = rt(r, t);
|
|
264
267
|
r.commands.insertContentAt(c, o, {
|
|
265
268
|
parseOptions: { preserveWhitespace: !0 }
|
|
@@ -288,17 +291,17 @@ const $t = (k, v) => {
|
|
|
288
291
|
n && (e !== void 0 ? n.chain().focus().extendMarkRange("link").command(({ tr: o, state: r }) => {
|
|
289
292
|
const { from: c, to: h } = o.selection, K = r.schema.marks.link;
|
|
290
293
|
if (!K) return !1;
|
|
291
|
-
const
|
|
294
|
+
const Bt = r.schema.text(e, [
|
|
292
295
|
K.create({ href: t })
|
|
293
|
-
]),
|
|
294
|
-
return o.replaceWith(c, h, [
|
|
296
|
+
]), xt = r.schema.text(" ");
|
|
297
|
+
return o.replaceWith(c, h, [Bt, xt]), !0;
|
|
295
298
|
}).run() : n.chain().focus().extendMarkRange("link").setLink({ href: t }).insertContent(" ").run());
|
|
296
299
|
},
|
|
297
300
|
updateLink: (t) => n?.chain().focus().extendMarkRange("link").setLink({ href: t }).run(),
|
|
298
301
|
removeLink: () => n?.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
299
302
|
insertEmoji: (t) => n?.chain().focus().insertContent(t).run(),
|
|
300
303
|
insertVariable: (t) => n?.chain().focus().insertContent(`{{${t}}}`).run(),
|
|
301
|
-
insertHtml: (t) => n?.commands.insertContent(
|
|
304
|
+
insertHtml: (t) => n?.commands.insertContent(s(t)),
|
|
302
305
|
undo: () => n?.chain().focus().undo().run(),
|
|
303
306
|
redo: () => n?.chain().focus().redo().run(),
|
|
304
307
|
canUndo: () => n?.can().undo() ?? !1,
|
|
@@ -310,14 +313,14 @@ const $t = (k, v) => {
|
|
|
310
313
|
// ── JSON body ─────────────────────────────────────────────────────
|
|
311
314
|
json: B?.jsonMode ? {
|
|
312
315
|
getText: () => n ? g(n) : "",
|
|
313
|
-
setText: (t) =>
|
|
316
|
+
setText: (t) => i((e) => x(e, t)),
|
|
314
317
|
parse: () => p(n ? g(n) : ""),
|
|
315
318
|
isValid: () => p(n ? g(n) : "").valid,
|
|
316
|
-
format: (t = 2) =>
|
|
319
|
+
format: (t = 2) => i((e) => {
|
|
317
320
|
const { valid: o, value: r } = p(g(e));
|
|
318
321
|
!o || r === null || x(e, JSON.stringify(r, null, t));
|
|
319
322
|
}),
|
|
320
|
-
minify: () =>
|
|
323
|
+
minify: () => i((t) => {
|
|
321
324
|
const { valid: e, value: o } = p(g(t));
|
|
322
325
|
!e || o === null || x(t, JSON.stringify(o));
|
|
323
326
|
})
|
|
@@ -326,55 +329,55 @@ const $t = (k, v) => {
|
|
|
326
329
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
327
330
|
[n]
|
|
328
331
|
);
|
|
329
|
-
const
|
|
332
|
+
const kt = () => {
|
|
330
333
|
if (!n) return;
|
|
331
334
|
const { valid: t, value: e } = p(g(n));
|
|
332
335
|
!t || e === null || x(n, JSON.stringify(e, null, 2));
|
|
333
|
-
},
|
|
336
|
+
}, yt = () => {
|
|
334
337
|
n && (navigator.clipboard?.writeText(g(n)), H(!0), setTimeout(() => H(!1), 1500));
|
|
335
338
|
};
|
|
336
339
|
return n ? /* @__PURE__ */ u(
|
|
337
|
-
|
|
340
|
+
It,
|
|
338
341
|
{
|
|
339
|
-
minHeight:
|
|
340
|
-
maxHeight:
|
|
342
|
+
minHeight: mt,
|
|
343
|
+
maxHeight: ft,
|
|
341
344
|
tightParagraphs: !B?.richPaste,
|
|
342
345
|
jsonMode: m,
|
|
343
|
-
style:
|
|
344
|
-
className:
|
|
346
|
+
style: gt,
|
|
347
|
+
className: ht,
|
|
345
348
|
children: [
|
|
346
349
|
m && /* @__PURE__ */ u(Rt, { children: [
|
|
347
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ d("span", { className: "bik-json-header-label", children: "JSON" }),
|
|
348
351
|
/* @__PURE__ */ u("div", { className: "bik-json-header-actions", children: [
|
|
349
352
|
/* @__PURE__ */ u(
|
|
350
353
|
"button",
|
|
351
354
|
{
|
|
352
355
|
type: "button",
|
|
353
|
-
onClick:
|
|
356
|
+
onClick: kt,
|
|
354
357
|
disabled: !!f,
|
|
355
358
|
title: "Format JSON",
|
|
356
359
|
children: [
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ d(Pt, { size: 16 }),
|
|
361
|
+
/* @__PURE__ */ d(Y, { children: "Beautify" })
|
|
359
362
|
]
|
|
360
363
|
}
|
|
361
364
|
),
|
|
362
|
-
/* @__PURE__ */ u("button", { type: "button", onClick:
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
|
|
365
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: yt, title: "Copy JSON", children: [
|
|
366
|
+
/* @__PURE__ */ d(Dt, { size: 16 }),
|
|
367
|
+
pt && /* @__PURE__ */ d(Y, { children: "Copied" })
|
|
365
368
|
] })
|
|
366
369
|
] })
|
|
367
370
|
] }),
|
|
368
|
-
m ? /* @__PURE__ */ u(
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
371
|
+
m ? /* @__PURE__ */ u(Jt, { $error: !!f, children: [
|
|
372
|
+
/* @__PURE__ */ d(X, { editor: n }),
|
|
373
|
+
Ct && /* @__PURE__ */ u(Lt, { "aria-hidden": !0, children: [
|
|
374
|
+
/* @__PURE__ */ d(qt, { size: 20 }),
|
|
375
|
+
/* @__PURE__ */ d("span", { children: k.placeholder ?? "Type or paste JSON here" })
|
|
373
376
|
] })
|
|
374
|
-
] }) : /* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
m && f ? N ? N(f) : /* @__PURE__ */ u(
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
] }) : /* @__PURE__ */ d(X, { editor: n }),
|
|
378
|
+
/* @__PURE__ */ d(wt, { editor: n, renderLinkTooltip: dt?.renderTooltip }),
|
|
379
|
+
m && f ? N ? N(f) : /* @__PURE__ */ u(Mt, { children: [
|
|
380
|
+
/* @__PURE__ */ d(Ut, { size: 16 }),
|
|
378
381
|
/* @__PURE__ */ u("span", { children: [
|
|
379
382
|
f.line != null && /* @__PURE__ */ u("strong", { children: [
|
|
380
383
|
"Line ",
|
|
@@ -389,11 +392,11 @@ const $t = (k, v) => {
|
|
|
389
392
|
]
|
|
390
393
|
}
|
|
391
394
|
) : null;
|
|
392
|
-
},
|
|
393
|
-
|
|
395
|
+
}, Vt = Et(
|
|
396
|
+
Wt
|
|
394
397
|
);
|
|
395
|
-
|
|
398
|
+
Vt.displayName = "BikEditor";
|
|
396
399
|
export {
|
|
397
|
-
|
|
400
|
+
Vt as BikEditor
|
|
398
401
|
};
|
|
399
402
|
//# sourceMappingURL=BikEditor.js.map
|