@pibit.ai/cure-design-system 0.6.49 → 0.6.51
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/code-editor/chrome.d.ts +9 -0
- package/dist/code-editor/chrome.d.ts.map +1 -0
- package/dist/code-editor/chrome.js +77 -0
- package/dist/code-editor/code-editor.d.ts.map +1 -1
- package/dist/code-editor/code-editor.js +97 -161
- package/dist/code-editor/diff-editor.d.ts +46 -0
- package/dist/code-editor/diff-editor.d.ts.map +1 -0
- package/dist/code-editor/diff-editor.js +178 -0
- package/dist/code-editor/index.d.ts +1 -0
- package/dist/code-editor/index.d.ts.map +1 -1
- package/dist/code-editor/index.js +10 -8
- package/dist/rich-text/index.d.ts +1 -0
- package/dist/rich-text/index.d.ts.map +1 -1
- package/dist/rich-text/index.js +34 -26
- package/dist/rich-text/token-input/index.d.ts +5 -0
- package/dist/rich-text/token-input/index.d.ts.map +1 -0
- package/dist/rich-text/token-input/segments.d.ts +27 -0
- package/dist/rich-text/token-input/segments.d.ts.map +1 -0
- package/dist/rich-text/token-input/segments.js +48 -0
- package/dist/rich-text/token-input/token-input.d.ts +96 -0
- package/dist/rich-text/token-input/token-input.d.ts.map +1 -0
- package/dist/rich-text/token-input/token-input.js +286 -0
- package/dist/rich-text/token-input/token-node.d.ts +30 -0
- package/dist/rich-text/token-input/token-node.d.ts.map +1 -0
- package/dist/rich-text/token-input/token-node.js +89 -0
- package/dist/rich-text/token-input/token-suggestion.d.ts +37 -0
- package/dist/rich-text/token-input/token-suggestion.d.ts.map +1 -0
- package/dist/rich-text/token-input/token-suggestion.js +110 -0
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { cureCodeMirrorTheme as e, cureEditorChrome as t, cureHighlightStyle as
|
|
2
|
-
import { CodeEditor as
|
|
3
|
-
import {
|
|
1
|
+
import { cureCodeMirrorTheme as e, cureEditorChrome as t, cureHighlightStyle as i } from "./theme.js";
|
|
2
|
+
import { CodeEditor as f } from "./code-editor.js";
|
|
3
|
+
import { DiffEditor as x } from "./diff-editor.js";
|
|
4
|
+
import { loadLanguageExtension as E } from "./languages.js";
|
|
4
5
|
import { JsonCodeEditor as n } from "./json-code-editor.js";
|
|
5
|
-
import { formatJsonEditorValue as
|
|
6
|
+
import { formatJsonEditorValue as g } from "./formatJsonEditorValue.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
f as CodeEditor,
|
|
9
|
+
x as DiffEditor,
|
|
8
10
|
n as JsonCodeEditor,
|
|
9
11
|
e as cureCodeMirrorTheme,
|
|
10
12
|
t as cureEditorChrome,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
i as cureHighlightStyle,
|
|
14
|
+
g as formatJsonEditorValue,
|
|
15
|
+
E as loadLanguageExtension
|
|
14
16
|
};
|
|
@@ -14,4 +14,5 @@ export { MentionList, createMentionSuggestion, type MentionUser, } from './text-
|
|
|
14
14
|
export { CharacterCount } from './text-editor-character-count';
|
|
15
15
|
export { isStrikethroughShortcut } from './text-editor-shortcuts';
|
|
16
16
|
export { getPlatformShortcutLabel, isMacPlatform } from './platform';
|
|
17
|
+
export * from './token-input';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rich-text/index.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,KAAK,WAAW,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rich-text/index.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,KAAK,WAAW,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,cAAc,eAAe,CAAC"}
|
package/dist/rich-text/index.js
CHANGED
|
@@ -1,40 +1,48 @@
|
|
|
1
|
-
import { RichTextEditor as r, useRichTextEditorContext as
|
|
1
|
+
import { RichTextEditor as r, useRichTextEditorContext as i } from "./text-editor.js";
|
|
2
2
|
import { RichTextEditorToolbar as c } from "./text-editor-toolbar.js";
|
|
3
|
-
import { RichTextEditorTooltip as
|
|
4
|
-
import { RichTextEditorAlignCenter as
|
|
5
|
-
import { EditorButton as
|
|
6
|
-
import { MentionList as M, createMentionSuggestion as
|
|
7
|
-
import { CharacterCount as
|
|
8
|
-
import { isStrikethroughShortcut as
|
|
3
|
+
import { RichTextEditorTooltip as h } from "./text-editor-tooltip.js";
|
|
4
|
+
import { RichTextEditorAlignCenter as n, RichTextEditorAlignLeft as E, RichTextEditorBlockquote as R, RichTextEditorBold as m, RichTextEditorBulletList as l, RichTextEditorColor as f, RichTextEditorFontFamily as p, RichTextEditorFontSize as a, RichTextEditorGenerate as g, RichTextEditorHeading as s, RichTextEditorImage as u, RichTextEditorItalic as S, RichTextEditorLink as C, RichTextEditorOrderedList as L, RichTextEditorStrikethrough as k, RichTextEditorUnderline as B } from "./text-editor-extensions.js";
|
|
5
|
+
import { EditorButton as A } from "./text-editor-button.js";
|
|
6
|
+
import { MentionList as M, createMentionSuggestion as P } from "./text-editor-mention.js";
|
|
7
|
+
import { CharacterCount as b } from "./text-editor-character-count.js";
|
|
8
|
+
import { isStrikethroughShortcut as N } from "./text-editor-shortcuts.js";
|
|
9
9
|
import { getPlatformShortcutLabel as q, isMacPlatform as y } from "./platform.js";
|
|
10
|
+
import { TokenInput as D, TokenPill as G } from "./token-input/token-input.js";
|
|
11
|
+
import { TokenSuggestionList as X } from "./token-input/token-suggestion.js";
|
|
12
|
+
import { docToSegments as v, segmentsToDoc as w } from "./token-input/segments.js";
|
|
10
13
|
const t = "cure-rich-text";
|
|
11
14
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
b as CharacterCount,
|
|
16
|
+
A as EditorButton,
|
|
14
17
|
M as MentionList,
|
|
15
18
|
t as RICH_TEXT_CONTENT_CLASS,
|
|
16
19
|
r as RichTextEditor,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
n as RichTextEditorAlignCenter,
|
|
21
|
+
E as RichTextEditorAlignLeft,
|
|
22
|
+
R as RichTextEditorBlockquote,
|
|
23
|
+
m as RichTextEditorBold,
|
|
24
|
+
l as RichTextEditorBulletList,
|
|
25
|
+
f as RichTextEditorColor,
|
|
26
|
+
p as RichTextEditorFontFamily,
|
|
27
|
+
a as RichTextEditorFontSize,
|
|
28
|
+
g as RichTextEditorGenerate,
|
|
29
|
+
s as RichTextEditorHeading,
|
|
30
|
+
u as RichTextEditorImage,
|
|
31
|
+
S as RichTextEditorItalic,
|
|
32
|
+
C as RichTextEditorLink,
|
|
30
33
|
L as RichTextEditorOrderedList,
|
|
31
34
|
k as RichTextEditorStrikethrough,
|
|
32
35
|
c as RichTextEditorToolbar,
|
|
33
|
-
|
|
36
|
+
h as RichTextEditorTooltip,
|
|
34
37
|
B as RichTextEditorUnderline,
|
|
35
|
-
|
|
38
|
+
D as TokenInput,
|
|
39
|
+
G as TokenPill,
|
|
40
|
+
X as TokenSuggestionList,
|
|
41
|
+
P as createMentionSuggestion,
|
|
42
|
+
v as docToSegments,
|
|
36
43
|
q as getPlatformShortcutLabel,
|
|
37
44
|
y as isMacPlatform,
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
N as isStrikethroughShortcut,
|
|
46
|
+
w as segmentsToDoc,
|
|
47
|
+
i as useRichTextEditorContext
|
|
40
48
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { TokenInput, TokenPill, type TokenDisplay, type TokenInputHandle, type TokenInputProps, type TokenTextContext, } from './token-input';
|
|
2
|
+
export type { TokenRenderProps } from './token-node';
|
|
3
|
+
export { TokenSuggestionList, type TokenSuggestionItem, type TokenSuggestionTrigger, } from './token-suggestion';
|
|
4
|
+
export { docToSegments, segmentsToDoc, type TokenInputSegment, } from './segments';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rich-text/token-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
/**
|
|
4
|
+
* The app-facing shape of a TokenInput value. Consumers map their stored
|
|
5
|
+
* format (formula, `{{field}}` reference, `{variable}` …) to and from these
|
|
6
|
+
* segments with `parse` / `serialize`; the editor never sees the raw format.
|
|
7
|
+
*/
|
|
8
|
+
export type TokenInputSegment = {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "token";
|
|
13
|
+
value: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "newline";
|
|
16
|
+
};
|
|
17
|
+
export declare const TOKEN_NODE_NAME = "token";
|
|
18
|
+
/** Segments → editor document: each newline segment starts a new paragraph. */
|
|
19
|
+
export declare function segmentsToDoc(segments: TokenInputSegment[]): JSONContent;
|
|
20
|
+
/** Editor document → segments: paragraphs are joined by newline segments. */
|
|
21
|
+
export declare function docToSegments(doc: JSONContent): TokenInputSegment[];
|
|
22
|
+
/**
|
|
23
|
+
* Plain text for a document range, tokens rendered with `tokenText` — used for
|
|
24
|
+
* copy/cut so a paste can rebuild the tokens.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rangeToText(doc: ProseMirrorNode, from: number, to: number, tokenText: (value: string) => string): string;
|
|
27
|
+
//# sourceMappingURL=segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../src/rich-text/token-input/segments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAExB,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,WAAW,CA0BxE;AAcD,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB,EAAE,CAQnE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACnC,MAAM,CAQR"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const a = "token";
|
|
2
|
+
function i(t) {
|
|
3
|
+
const e = [[]];
|
|
4
|
+
for (const n of t)
|
|
5
|
+
n.type === "newline" ? e.push([]) : n.type === "text" ? n.text && e[e.length - 1].push({
|
|
6
|
+
type: "text",
|
|
7
|
+
text: n.text
|
|
8
|
+
}) : n.value && e[e.length - 1].push({
|
|
9
|
+
type: a,
|
|
10
|
+
attrs: { value: n.value }
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
type: "doc",
|
|
14
|
+
content: e.map((n) => ({
|
|
15
|
+
type: "paragraph",
|
|
16
|
+
content: n.length ? n : void 0
|
|
17
|
+
}))
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function s(t, e) {
|
|
21
|
+
var n;
|
|
22
|
+
if (t.type === "text" && t.text)
|
|
23
|
+
e.push({ type: "text", text: t.text });
|
|
24
|
+
else if (t.type === a && ((n = t.attrs) != null && n.value))
|
|
25
|
+
e.push({ type: "token", value: String(t.attrs.value) });
|
|
26
|
+
else if (t.type === "hardBreak")
|
|
27
|
+
e.push({ type: "newline" });
|
|
28
|
+
else if (t.content)
|
|
29
|
+
for (const r of t.content) s(r, e);
|
|
30
|
+
}
|
|
31
|
+
function u(t) {
|
|
32
|
+
if (!t || t.type !== "doc" || !t.content) return [];
|
|
33
|
+
const e = [];
|
|
34
|
+
return t.content.forEach((n, r) => {
|
|
35
|
+
r > 0 && e.push({ type: "newline" }), s(n, e);
|
|
36
|
+
}), e;
|
|
37
|
+
}
|
|
38
|
+
function f(t, e, n, r) {
|
|
39
|
+
return t.textBetween(e, n, `
|
|
40
|
+
`, (p) => p.type.name === a && p.attrs.value ? r(String(p.attrs.value)) : p.type.name === "hardBreak" ? `
|
|
41
|
+
` : "");
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
a as TOKEN_NODE_NAME,
|
|
45
|
+
u as docToSegments,
|
|
46
|
+
f as rangeToText,
|
|
47
|
+
i as segmentsToDoc
|
|
48
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnyExtension } from '@tiptap/core';
|
|
3
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
+
import { Editor } from '@tiptap/react';
|
|
5
|
+
import { TokenInputSegment } from './segments';
|
|
6
|
+
import { TokenRenderProps } from './token-node';
|
|
7
|
+
import { TokenSuggestionTrigger } from './token-suggestion';
|
|
8
|
+
export interface TokenDisplay {
|
|
9
|
+
label: string;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** @default "neutral" */
|
|
12
|
+
tone?: "neutral" | "brand" | "error";
|
|
13
|
+
}
|
|
14
|
+
export interface TokenTextContext {
|
|
15
|
+
/** Whole document text, tokens excluded. */
|
|
16
|
+
docText: string;
|
|
17
|
+
/** Document text before the insertion point, tokens excluded. */
|
|
18
|
+
textBefore: string;
|
|
19
|
+
/** The full typed or pasted chunk this text came from. */
|
|
20
|
+
raw: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TokenInputHandle {
|
|
23
|
+
/** The Tiptap editor, once mounted. */
|
|
24
|
+
editor: Editor | null;
|
|
25
|
+
/** Inserts a token at the selection and focuses the editor. */
|
|
26
|
+
insertToken: (value: string) => void;
|
|
27
|
+
focus: () => void;
|
|
28
|
+
/** The current value in the app's stored format. */
|
|
29
|
+
getValue: () => string;
|
|
30
|
+
}
|
|
31
|
+
export interface TokenInputProps {
|
|
32
|
+
value: string;
|
|
33
|
+
onChange: (value: string) => void;
|
|
34
|
+
/** Stored value → segments. */
|
|
35
|
+
parse: (value: string) => TokenInputSegment[];
|
|
36
|
+
/** Segments → stored value. Must round-trip `parse`. */
|
|
37
|
+
serialize: (segments: TokenInputSegment[]) => string;
|
|
38
|
+
/** Renders a token. Defaults to a DS pill built from `getTokenDisplay`. */
|
|
39
|
+
renderToken?: (props: TokenRenderProps) => ReactNode;
|
|
40
|
+
/** Label, icon and tone for the default pill. @default the raw value */
|
|
41
|
+
getTokenDisplay?: (value: string) => TokenDisplay;
|
|
42
|
+
/** Menus opened by trigger characters such as "/", "{{" or "@". */
|
|
43
|
+
suggestions?: TokenSuggestionTrigger[];
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
isInvalid?: boolean;
|
|
47
|
+
/** Enter inserts a new line. Off: single-line, Enter is ignored. */
|
|
48
|
+
allowNewlines?: boolean;
|
|
49
|
+
/** Keep line breaks in pasted text. @default allowNewlines */
|
|
50
|
+
preservePastedNewlines?: boolean;
|
|
51
|
+
/** Rebuild tokens from pasted text via `parse`. @default true */
|
|
52
|
+
tokenPaste?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Filters typed and pasted text before it enters the document; return ""
|
|
55
|
+
* to drop the input. Tokens are never filtered.
|
|
56
|
+
*/
|
|
57
|
+
filterTextInput?: (text: string, context: TokenTextContext) => string;
|
|
58
|
+
/** Runs before TokenInput's own key handling; return true to stop it. */
|
|
59
|
+
onKeyDownCapture?: (view: EditorView, event: KeyboardEvent) => boolean;
|
|
60
|
+
/** Runs after TokenInput's own key handling; return true when handled. */
|
|
61
|
+
onKeyDown?: (view: EditorView, event: KeyboardEvent) => boolean;
|
|
62
|
+
onFocus?: (event: FocusEvent) => void;
|
|
63
|
+
onBlur?: (event: FocusEvent) => void;
|
|
64
|
+
/** Extra Tiptap extensions. Read once, when the editor is created. */
|
|
65
|
+
extensions?: AnyExtension[];
|
|
66
|
+
/** Called once the editor exists (and with null on unmount). */
|
|
67
|
+
onEditorChange?: (editor: Editor | null) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Render the DS input frame (border, focus ring, invalid state). Off: only
|
|
70
|
+
* the editable surface, for hosts that draw their own frame.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
chrome?: boolean;
|
|
74
|
+
/** Frame classes (with `chrome`). */
|
|
75
|
+
className?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Classes for the editor surface (Tiptap's EditorContent). Replaces the
|
|
78
|
+
* default surface classes (paragraph margin, placeholder) entirely.
|
|
79
|
+
*/
|
|
80
|
+
contentClassName?: string;
|
|
81
|
+
/** Attributes for the ProseMirror element. Read once, at creation. */
|
|
82
|
+
contentAttributes?: {
|
|
83
|
+
class?: string;
|
|
84
|
+
style?: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export declare function TokenPill({ label, icon, tone, selected, }: TokenDisplay & {
|
|
88
|
+
selected?: boolean;
|
|
89
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* Text input where some content is an inline token rendered as a pill, with
|
|
92
|
+
* tokens inserted from a trigger-character menu or by the host (`insertToken`).
|
|
93
|
+
* The stored format belongs to the app through `parse` / `serialize`.
|
|
94
|
+
*/
|
|
95
|
+
export declare const TokenInput: import('react').ForwardRefExoticComponent<TokenInputProps & import('react').RefAttributes<TokenInputHandle>>;
|
|
96
|
+
//# sourceMappingURL=token-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-input.d.ts","sourceRoot":"","sources":["../../../src/rich-text/token-input/token-input.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { jsx as m, jsxs as ie } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as le, useRef as _, useState as ae, useMemo as ce, useEffect as P, useImperativeHandle as ue } from "react";
|
|
3
|
+
import { Placeholder as fe } from "@tiptap/extension-placeholder";
|
|
4
|
+
import { useEditor as de, EditorContent as pe } from "@tiptap/react";
|
|
5
|
+
import { StarterKit as me } from "@tiptap/starter-kit";
|
|
6
|
+
import { cx as z } from "../../utils/cn.js";
|
|
7
|
+
import { segmentsToDoc as E, rangeToText as xe, docToSegments as be } from "./segments.js";
|
|
8
|
+
import { TokenNode as ye } from "./token-node.js";
|
|
9
|
+
import { createTokenSuggestionExtension as ke } from "./token-suggestion.js";
|
|
10
|
+
const Te = {
|
|
11
|
+
neutral: "border-secondary bg-primary text-secondary",
|
|
12
|
+
brand: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700",
|
|
13
|
+
error: "border-utility-error-200 bg-utility-error-50 text-utility-error-700"
|
|
14
|
+
};
|
|
15
|
+
function ge({
|
|
16
|
+
label: x,
|
|
17
|
+
icon: i,
|
|
18
|
+
tone: b = "neutral",
|
|
19
|
+
selected: f
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ ie(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: z(
|
|
25
|
+
"inline-flex max-w-60 items-center gap-1 rounded-md border px-1.5 py-px text-xs font-medium",
|
|
26
|
+
Te[b],
|
|
27
|
+
f && "ring-2 ring-brand"
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
i && /* @__PURE__ */ m("span", { className: "flex size-3.5 shrink-0 items-center", children: i }),
|
|
31
|
+
/* @__PURE__ */ m("span", { className: "truncate", children: x })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const I = (x) => x.replace(/\r\n|\r|\n/g, ""), Re = le(
|
|
37
|
+
function({
|
|
38
|
+
value: i,
|
|
39
|
+
onChange: b,
|
|
40
|
+
parse: f,
|
|
41
|
+
serialize: R,
|
|
42
|
+
renderToken: S,
|
|
43
|
+
getTokenDisplay: w,
|
|
44
|
+
suggestions: y,
|
|
45
|
+
placeholder: v,
|
|
46
|
+
readOnly: k = !1,
|
|
47
|
+
isInvalid: K = !1,
|
|
48
|
+
allowNewlines: T = !1,
|
|
49
|
+
preservePastedNewlines: U,
|
|
50
|
+
tokenPaste: j = !0,
|
|
51
|
+
filterTextInput: F,
|
|
52
|
+
onKeyDownCapture: L,
|
|
53
|
+
onKeyDown: V,
|
|
54
|
+
onFocus: q,
|
|
55
|
+
onBlur: H,
|
|
56
|
+
extensions: C,
|
|
57
|
+
onEditorChange: d,
|
|
58
|
+
chrome: ee = !0,
|
|
59
|
+
className: te,
|
|
60
|
+
contentClassName: re,
|
|
61
|
+
contentAttributes: ne
|
|
62
|
+
}, se) {
|
|
63
|
+
const o = _({
|
|
64
|
+
value: i,
|
|
65
|
+
onChange: b,
|
|
66
|
+
parse: f,
|
|
67
|
+
serialize: R,
|
|
68
|
+
renderToken: S,
|
|
69
|
+
getTokenDisplay: w,
|
|
70
|
+
allowNewlines: T,
|
|
71
|
+
preservePastedNewlines: U ?? T,
|
|
72
|
+
tokenPaste: j,
|
|
73
|
+
filterTextInput: F,
|
|
74
|
+
onKeyDownCapture: L,
|
|
75
|
+
onKeyDown: V,
|
|
76
|
+
onFocus: q,
|
|
77
|
+
onBlur: H
|
|
78
|
+
});
|
|
79
|
+
o.current = {
|
|
80
|
+
value: i,
|
|
81
|
+
onChange: b,
|
|
82
|
+
parse: f,
|
|
83
|
+
serialize: R,
|
|
84
|
+
renderToken: S,
|
|
85
|
+
getTokenDisplay: w,
|
|
86
|
+
allowNewlines: T,
|
|
87
|
+
preservePastedNewlines: U ?? T,
|
|
88
|
+
tokenPaste: j,
|
|
89
|
+
filterTextInput: F,
|
|
90
|
+
onKeyDownCapture: L,
|
|
91
|
+
onKeyDown: V,
|
|
92
|
+
onFocus: q,
|
|
93
|
+
onBlur: H
|
|
94
|
+
};
|
|
95
|
+
const D = _(!1), J = _(!1), [A, G] = ae(!1), O = (t) => o.current.serialize([{ type: "token", value: t }]), M = (t) => o.current.serialize(be(t.getJSON())), oe = ce(
|
|
96
|
+
() => [
|
|
97
|
+
me.configure({
|
|
98
|
+
bold: !1,
|
|
99
|
+
blockquote: !1,
|
|
100
|
+
bulletList: !1,
|
|
101
|
+
code: !1,
|
|
102
|
+
codeBlock: !1,
|
|
103
|
+
heading: !1,
|
|
104
|
+
horizontalRule: !1,
|
|
105
|
+
italic: !1,
|
|
106
|
+
link: !1,
|
|
107
|
+
orderedList: !1,
|
|
108
|
+
strike: !1,
|
|
109
|
+
underline: !1,
|
|
110
|
+
listItem: !1,
|
|
111
|
+
listKeymap: !1
|
|
112
|
+
}),
|
|
113
|
+
fe.configure({ placeholder: v ?? "" }),
|
|
114
|
+
ye.configure({
|
|
115
|
+
getRenderToken: () => o.current.renderToken ?? ((t) => {
|
|
116
|
+
var n, r;
|
|
117
|
+
return /* @__PURE__ */ m(
|
|
118
|
+
ge,
|
|
119
|
+
{
|
|
120
|
+
...((r = (n = o.current).getTokenDisplay) == null ? void 0 : r.call(n, t.value)) ?? {
|
|
121
|
+
label: t.value
|
|
122
|
+
},
|
|
123
|
+
selected: t.selected
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}),
|
|
127
|
+
getTokenText: () => O
|
|
128
|
+
}),
|
|
129
|
+
...y != null && y.length ? [
|
|
130
|
+
ke(y, (t) => {
|
|
131
|
+
J.current = t;
|
|
132
|
+
})
|
|
133
|
+
] : [],
|
|
134
|
+
...C ?? []
|
|
135
|
+
],
|
|
136
|
+
// Extensions are fixed for the editor's lifetime, like the original inputs.
|
|
137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
+
[]
|
|
139
|
+
), e = de({
|
|
140
|
+
immediatelyRender: !1,
|
|
141
|
+
editable: !k,
|
|
142
|
+
extensions: oe,
|
|
143
|
+
content: E(f(i)),
|
|
144
|
+
editorProps: {
|
|
145
|
+
attributes: ne ?? {
|
|
146
|
+
class: "w-full outline-none text-sm text-primary"
|
|
147
|
+
},
|
|
148
|
+
handleDOMEvents: {
|
|
149
|
+
focus: (t, n) => {
|
|
150
|
+
var r, s;
|
|
151
|
+
return G(!0), (s = (r = o.current).onFocus) == null || s.call(r, n), !1;
|
|
152
|
+
},
|
|
153
|
+
blur: (t, n) => {
|
|
154
|
+
var r, s;
|
|
155
|
+
return G(!1), (s = (r = o.current).onBlur) == null || s.call(r, n), !1;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
clipboardTextSerializer: (t, n) => {
|
|
159
|
+
const { from: r, to: s } = n.state.selection;
|
|
160
|
+
return xe(n.state.doc, r, s, O);
|
|
161
|
+
},
|
|
162
|
+
handlePaste: (t, n) => {
|
|
163
|
+
var $;
|
|
164
|
+
n.preventDefault();
|
|
165
|
+
const r = o.current;
|
|
166
|
+
let s = (($ = n.clipboardData) == null ? void 0 : $.getData("text/plain")) || "";
|
|
167
|
+
if (!s || !r.preservePastedNewlines && (s = I(s), !s))
|
|
168
|
+
return !0;
|
|
169
|
+
const { from: a, to: p } = t.state.selection, X = {
|
|
170
|
+
docText: t.state.doc.textBetween(
|
|
171
|
+
0,
|
|
172
|
+
t.state.doc.content.size,
|
|
173
|
+
"",
|
|
174
|
+
""
|
|
175
|
+
),
|
|
176
|
+
textBefore: t.state.doc.textBetween(0, a, "", ""),
|
|
177
|
+
raw: s
|
|
178
|
+
}, g = r.filterTextInput, Y = Q.current, Z = r.tokenPaste ? r.parse(s) : [];
|
|
179
|
+
if (Y && Z.some((c) => c.type === "token")) {
|
|
180
|
+
const c = [];
|
|
181
|
+
for (const l of Z)
|
|
182
|
+
if (l.type === "token")
|
|
183
|
+
c.push({ token: l.value });
|
|
184
|
+
else {
|
|
185
|
+
const u = l.type === "newline" ? `
|
|
186
|
+
` : l.text, B = c[c.length - 1];
|
|
187
|
+
B && "text" in B ? B.text += u : c.push({ text: u });
|
|
188
|
+
}
|
|
189
|
+
const N = Y.chain().focus();
|
|
190
|
+
for (const l of c)
|
|
191
|
+
if ("token" in l)
|
|
192
|
+
N.insertToken(l.token);
|
|
193
|
+
else {
|
|
194
|
+
let u = g ? g(l.text, X) : l.text;
|
|
195
|
+
r.preservePastedNewlines || (u = I(u)), u && N.insertContent(u);
|
|
196
|
+
}
|
|
197
|
+
return N.run(), !0;
|
|
198
|
+
}
|
|
199
|
+
let h = g ? g(s, X) : s;
|
|
200
|
+
return r.preservePastedNewlines || (h = I(h)), h && t.dispatch(t.state.tr.insertText(h, a, p)), !0;
|
|
201
|
+
},
|
|
202
|
+
handleTextInput: (t, n, r, s) => {
|
|
203
|
+
const a = o.current.filterTextInput;
|
|
204
|
+
if (!a) return !1;
|
|
205
|
+
const p = a(s, {
|
|
206
|
+
docText: t.state.doc.textBetween(
|
|
207
|
+
0,
|
|
208
|
+
t.state.doc.content.size,
|
|
209
|
+
"",
|
|
210
|
+
""
|
|
211
|
+
),
|
|
212
|
+
textBefore: t.state.doc.textBetween(0, n, "", ""),
|
|
213
|
+
raw: s
|
|
214
|
+
});
|
|
215
|
+
return p === s ? !1 : (p && t.dispatch(t.state.tr.insertText(p, n, r)), !0);
|
|
216
|
+
},
|
|
217
|
+
handleKeyDown: (t, n) => {
|
|
218
|
+
var s, a;
|
|
219
|
+
const r = o.current;
|
|
220
|
+
return (s = r.onKeyDownCapture) != null && s.call(r, t, n) ? !0 : J.current ? !1 : !r.allowNewlines && n.key === "Enter" ? (n.preventDefault(), !0) : ((a = r.onKeyDown) == null ? void 0 : a.call(r, t, n)) ?? !1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}), Q = _(null);
|
|
224
|
+
Q.current = e, P(() => (d == null || d(e), () => d == null ? void 0 : d(null)), [e]), P(() => {
|
|
225
|
+
!e || e.isDestroyed || (!D.current && M(e) !== i && e.commands.setContent(E(f(i)), {
|
|
226
|
+
emitUpdate: !1
|
|
227
|
+
}), D.current = !1);
|
|
228
|
+
}, [i, e]), P(() => {
|
|
229
|
+
!e || e.isDestroyed || e.setEditable(!k);
|
|
230
|
+
}, [e, k]), P(() => {
|
|
231
|
+
if (!e || e.isDestroyed) return;
|
|
232
|
+
const t = () => {
|
|
233
|
+
const n = M(e);
|
|
234
|
+
n !== o.current.value && (D.current = !0, o.current.onChange(n));
|
|
235
|
+
};
|
|
236
|
+
return e.on("update", t), () => {
|
|
237
|
+
e.off("update", t);
|
|
238
|
+
};
|
|
239
|
+
}, [e]), ue(
|
|
240
|
+
se,
|
|
241
|
+
() => ({
|
|
242
|
+
editor: e,
|
|
243
|
+
insertToken: (t) => {
|
|
244
|
+
e == null || e.chain().focus().insertToken(t).run();
|
|
245
|
+
},
|
|
246
|
+
focus: () => e == null ? void 0 : e.commands.focus(),
|
|
247
|
+
getValue: () => e && !e.isDestroyed ? M(e) : ""
|
|
248
|
+
}),
|
|
249
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
250
|
+
[e]
|
|
251
|
+
);
|
|
252
|
+
const W = /* @__PURE__ */ m(
|
|
253
|
+
pe,
|
|
254
|
+
{
|
|
255
|
+
editor: e,
|
|
256
|
+
className: (
|
|
257
|
+
// A host's own surface classes replace the defaults wholesale: custom
|
|
258
|
+
// colour tokens can't be de-duplicated by tailwind-merge.
|
|
259
|
+
re ?? z(
|
|
260
|
+
"[&_.ProseMirror_p]:m-0",
|
|
261
|
+
"[&_.ProseMirror_p.is-empty::before]:pointer-events-none [&_.ProseMirror_p.is-empty::before]:float-left [&_.ProseMirror_p.is-empty::before]:h-0 [&_.ProseMirror_p.is-empty::before]:text-placeholder [&_.ProseMirror_p.is-empty::before]:content-[attr(data-placeholder)]",
|
|
262
|
+
"[&_.ProseMirror-selectednode]:outline-none"
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
return ee ? /* @__PURE__ */ m(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
onClick: () => e == null ? void 0 : e.commands.focus(),
|
|
271
|
+
className: z(
|
|
272
|
+
"w-full cursor-text rounded-lg bg-primary px-3 py-2 shadow-xs ring-1 ring-inset transition duration-100 ease-linear",
|
|
273
|
+
K ? "ring-error_subtle" : A ? "ring-2 ring-brand" : "ring-primary",
|
|
274
|
+
K && A && "ring-2 ring-error",
|
|
275
|
+
k && "cursor-default bg-disabled_subtle",
|
|
276
|
+
te
|
|
277
|
+
),
|
|
278
|
+
children: W
|
|
279
|
+
}
|
|
280
|
+
) : W;
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
export {
|
|
284
|
+
Re as TokenInput,
|
|
285
|
+
ge as TokenPill
|
|
286
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { TOKEN_NODE_NAME } from './segments';
|
|
4
|
+
export interface TokenRenderProps {
|
|
5
|
+
/** The token's value, as produced by `parse` (e.g. a field path). */
|
|
6
|
+
value: string;
|
|
7
|
+
/** True when the editor is read-only. */
|
|
8
|
+
readOnly: boolean;
|
|
9
|
+
/** True when the token is the selected node. */
|
|
10
|
+
selected: boolean;
|
|
11
|
+
/** Removes this token from the document. */
|
|
12
|
+
remove: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface TokenNodeOptions {
|
|
15
|
+
/** Read at render time so the latest app renderer is always used. */
|
|
16
|
+
getRenderToken: () => (props: TokenRenderProps) => ReactNode;
|
|
17
|
+
/** Plain-text form of a token, for copy and `editor.getText()`. */
|
|
18
|
+
getTokenText: () => (value: string) => string;
|
|
19
|
+
}
|
|
20
|
+
declare module "@tiptap/core" {
|
|
21
|
+
interface Commands<ReturnType> {
|
|
22
|
+
[TOKEN_NODE_NAME]: {
|
|
23
|
+
/** Inserts a token at the selection. */
|
|
24
|
+
insertToken: (value: string) => ReturnType;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Inline atom node holding one token; deleted as a single unit. */
|
|
29
|
+
export declare const TokenNode: Node<TokenNodeOptions, any>;
|
|
30
|
+
//# sourceMappingURL=token-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-node.d.ts","sourceRoot":"","sources":["../../../src/rich-text/token-input/token-node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAMrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,QAAQ,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,KAAK,SAAS,CAAC;IAC7D,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,CAAC,eAAe,CAAC,EAAE;YACjB,wCAAwC;YACxC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC;SAC5C,CAAC;KACH;CACF;AAqCD,oEAAoE;AACpE,eAAO,MAAM,SAAS,6BAuEpB,CAAC"}
|