@code0-tech/pictor 0.0.0-mvp.29 → 0.0.0-mvp.30
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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/react-contenteditable.js +7 -0
- package/dist/_virtual/react-contenteditable2.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
- package/dist/_virtual/react-dom-server.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server.browser.production.js +4 -0
- package/dist/_virtual/react-is.development.js +4 -0
- package/dist/_virtual/react-is.production.min.js +4 -0
- package/dist/_virtual/server.browser.js +5 -0
- package/dist/_virtual/server.browser2.js +4 -0
- package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
- package/dist/assets/components/form/Input.style.css +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +12 -12
- package/dist/components/button-group/ButtonGroup.js +12 -12
- package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
- package/dist/components/d-flow/DFlow.js +304 -268
- package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
- package/dist/components/d-flow/DFlow.service.d.ts +3 -2
- package/dist/components/d-flow/DFlow.service.js +62 -47
- package/dist/components/d-flow/DFlow.util.d.ts +4 -0
- package/dist/components/d-flow/DFlow.util.js +63 -0
- package/dist/components/d-flow/DFlowEdge.js +34 -34
- package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
- package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
- package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
- package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
- package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
- package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
- package/dist/components/d-flow-file/DFlowTabs.js +26 -27
- package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
- package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
- package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
- package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
- package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
- package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
- package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
- package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
- package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
- package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
- package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
- package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
- package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
- package/dist/components/d-flow-panel/DFlowExport.js +1 -1
- package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
- package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
- package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
- package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
- package/dist/components/d-flow-type/DFlowType.view.js +22 -12
- package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
- package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
- package/dist/components/d-resizable/DResizable.d.ts +4 -4
- package/dist/components/d-resizable/DResizable.js +22 -21
- package/dist/components/d-user/DUserInput.js +23 -21
- package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
- package/dist/components/file-tabs/FileTabs.service.js +49 -53
- package/dist/components/form/EmailInput.js +9 -9
- package/dist/components/form/Input.d.ts +2 -1
- package/dist/components/form/Input.js +294 -397
- package/dist/components/form/Input.syntax.hook.d.ts +1 -18
- package/dist/components/form/Input.syntax.hook.js +7 -73
- package/dist/components/form/Input.utils.d.ts +1 -2
- package/dist/components/form/Input.utils.js +26 -21
- package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
- package/dist/components/form/InputContentEditable.hook.js +471 -0
- package/dist/components/form/InputSuggestion.d.ts +2 -2
- package/dist/components/form/InputSuggestion.js +169 -107
- package/dist/components/form/PasswordInput.js +8 -8
- package/dist/components/form/TextInput.js +11 -11
- package/dist/components/form/useForm.d.ts +1 -0
- package/dist/components/form/useForm.js +45 -60
- package/dist/components/menu/Menu.js +4 -4
- package/dist/index.js +155 -154
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
- package/dist/node_modules/fast-deep-equal/index.js +31 -0
- package/dist/node_modules/object-assign/index.js +49 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
- package/dist/node_modules/prop-types/index.js +17 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
- package/dist/node_modules/prop-types/lib/has.js +7 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
- package/dist/node_modules/react-dom/server.browser.js +15 -0
- package/dist/utils/generics.d.ts +2 -0
- package/dist/utils/generics.js +93 -80
- package/dist/utils/index.js +22 -21
- package/dist/utils/inspection.d.ts +4 -2
- package/dist/utils/inspection.js +27 -2
- package/package.json +10 -8
- package/dist/components/form/Input.selection.hook.d.ts +0 -17
- package/dist/components/form/Input.selection.hook.js +0 -78
- package/dist/components/form/InputSyntax.d.ts +0 -19
- package/dist/components/form/InputSyntax.js +0 -52
- package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
- package/dist/components/form/inputSyntaxMapping.js +0 -42
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { InputSuggestion } from './InputSuggestion';
|
|
3
2
|
export type InputSyntaxSegment = {
|
|
4
3
|
type: "text" | "block";
|
|
4
|
+
value?: any;
|
|
5
5
|
start: number;
|
|
6
6
|
end: number;
|
|
7
7
|
visualLength?: number;
|
|
8
8
|
content?: string | React.ReactNode;
|
|
9
9
|
};
|
|
10
|
-
export type VisualizedInputSyntaxSegment = InputSyntaxSegment & {
|
|
11
|
-
visualStart: number;
|
|
12
|
-
visualEnd: number;
|
|
13
|
-
};
|
|
14
10
|
export declare const buildDefaultSyntax: (value: any) => InputSyntaxSegment[];
|
|
15
|
-
export declare const visualizeSyntaxSegments: (syntaxSegments: InputSyntaxSegment[]) => VisualizedInputSyntaxSegment[];
|
|
16
|
-
export declare const useSyntaxModel: (value: any, transformSyntax: ((value: any, appliedSyntaxParts?: (InputSuggestion | any)[]) => InputSyntaxSegment[]) | undefined, inputRef: React.RefObject<HTMLInputElement>, appliedSyntaxParts?: (InputSuggestion | any)[]) => {
|
|
17
|
-
syntaxSegments: InputSyntaxSegment[];
|
|
18
|
-
visualizedSyntaxSegments: VisualizedInputSyntaxSegment[];
|
|
19
|
-
expandSelectionRangeToBlockBoundaries: (rawStart: number, rawEnd: number) => {
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
hasBlockOverlap: boolean;
|
|
23
|
-
};
|
|
24
|
-
mapVisualIndexToRawIndex: (visualIndex: number) => number;
|
|
25
|
-
mapRawIndexToVisualIndex: (rawIndex: number) => number;
|
|
26
|
-
totalVisualLength: number;
|
|
27
|
-
};
|
|
@@ -1,80 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const a = i ?? "", s = typeof a == "string" ? a : String(a);
|
|
1
|
+
const a = (n) => {
|
|
2
|
+
const e = n ?? "", t = typeof e == "string" ? e : String(e);
|
|
4
3
|
return [{
|
|
5
4
|
type: "text",
|
|
5
|
+
value: t,
|
|
6
6
|
start: 0,
|
|
7
|
-
end:
|
|
8
|
-
visualLength:
|
|
9
|
-
content:
|
|
7
|
+
end: t.length,
|
|
8
|
+
visualLength: t.length,
|
|
9
|
+
content: t
|
|
10
10
|
}];
|
|
11
|
-
}, p = (i) => {
|
|
12
|
-
let a = 0;
|
|
13
|
-
return i.map((s) => {
|
|
14
|
-
const h = {
|
|
15
|
-
...s,
|
|
16
|
-
visualStart: a,
|
|
17
|
-
visualEnd: a + (s?.visualLength ?? 0)
|
|
18
|
-
};
|
|
19
|
-
return a = h.visualEnd, h;
|
|
20
|
-
});
|
|
21
|
-
}, d = (i, a, s) => Math.max(a, Math.min(i, s)), y = (i, a, s, h) => {
|
|
22
|
-
const g = c.useMemo(() => {
|
|
23
|
-
if (a) {
|
|
24
|
-
const n = a(i, h);
|
|
25
|
-
if (n?.length) return n;
|
|
26
|
-
}
|
|
27
|
-
return S(i);
|
|
28
|
-
}, [h, a, i]), u = c.useMemo(() => p(g), [g]), v = c.useCallback((n, t) => {
|
|
29
|
-
let r = Math.min(n, t), l = Math.max(n, t), o = !1;
|
|
30
|
-
return u.forEach((e) => {
|
|
31
|
-
e.type !== "block" || !(r < e.end && l > e.start) || (r = Math.min(r, e.start), l = Math.max(l, e.end), o = !0);
|
|
32
|
-
}), {
|
|
33
|
-
start: r,
|
|
34
|
-
end: l,
|
|
35
|
-
hasBlockOverlap: o
|
|
36
|
-
};
|
|
37
|
-
}, [u]), m = c.useCallback((n) => {
|
|
38
|
-
const t = u.find((e) => n >= e.visualStart && n <= e.visualEnd);
|
|
39
|
-
if (!t) {
|
|
40
|
-
const e = s.current?.value.length ?? 0;
|
|
41
|
-
return d(n, 0, e);
|
|
42
|
-
}
|
|
43
|
-
const r = t.end - t.start, l = d(n - t.visualStart, 0, t?.visualLength ?? 0);
|
|
44
|
-
if (r <= 0) return t.start;
|
|
45
|
-
if (t.type === "text")
|
|
46
|
-
return Math.min(t.start + Math.round(l), t.end);
|
|
47
|
-
if ((t?.visualLength ?? 0) <= 0) return t.start;
|
|
48
|
-
const o = l / (t?.visualLength ?? 0);
|
|
49
|
-
return Math.round(t.start + o * r);
|
|
50
|
-
}, [s, u]), f = c.useCallback((n) => {
|
|
51
|
-
const t = u.find((e) => n >= e.start && n <= e.end);
|
|
52
|
-
if (!t) {
|
|
53
|
-
const e = s.current?.value.length ?? 0;
|
|
54
|
-
return d(n, 0, e);
|
|
55
|
-
}
|
|
56
|
-
const r = t.end - t.start, l = d(n - t.start, 0, r);
|
|
57
|
-
if (r <= 0) return t.visualStart;
|
|
58
|
-
if (t.type === "text")
|
|
59
|
-
return Math.min(t.visualStart + l, t.visualEnd);
|
|
60
|
-
if ((t?.visualLength ?? 0) <= 0) return t.visualStart;
|
|
61
|
-
const o = l / r;
|
|
62
|
-
return Math.min(t.visualStart + o * (t?.visualLength ?? 0), t.visualEnd);
|
|
63
|
-
}, [s, u]), M = c.useMemo(() => {
|
|
64
|
-
const n = u[u.length - 1];
|
|
65
|
-
return n ? n.visualEnd : 0;
|
|
66
|
-
}, [u]);
|
|
67
|
-
return {
|
|
68
|
-
syntaxSegments: g,
|
|
69
|
-
visualizedSyntaxSegments: u,
|
|
70
|
-
expandSelectionRangeToBlockBoundaries: v,
|
|
71
|
-
mapVisualIndexToRawIndex: m,
|
|
72
|
-
mapRawIndexToVisualIndex: f,
|
|
73
|
-
totalVisualLength: M
|
|
74
|
-
};
|
|
75
11
|
};
|
|
76
12
|
export {
|
|
77
|
-
|
|
78
|
-
y as useSyntaxModel,
|
|
79
|
-
p as visualizeSyntaxSegments
|
|
13
|
+
a as buildDefaultSyntax
|
|
80
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
export declare const setElementKey: (element: HTMLElement, key: string, value: any, event: string) => void;
|
|
2
|
+
export declare const clearInputElement: (element: HTMLElement | null) => void;
|
|
3
3
|
export declare const setSelectionRangeSafe: (target: HTMLInputElement, start: number, end: number, direction?: "forward" | "backward" | "none") => void;
|
|
4
4
|
export declare const getSelectionMetrics: (target: HTMLInputElement) => {
|
|
5
5
|
selectionStart: number;
|
|
@@ -8,4 +8,3 @@ export declare const getSelectionMetrics: (target: HTMLInputElement) => {
|
|
|
8
8
|
rawEnd: number;
|
|
9
9
|
direction: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const useSyncSyntaxScroll: (inputRef: React.RefObject<HTMLInputElement | null>, syntaxRef: React.RefObject<HTMLDivElement | null>) => () => void;
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
o && o !== n ? n?.call(t, e) : o?.call(t, e), t.dispatchEvent(new Event(c, {
|
|
1
|
+
const a = (t, e, n, c) => {
|
|
2
|
+
const r = Object.getOwnPropertyDescriptor(t, e)?.set, s = Object.getPrototypeOf(t), o = Object.getOwnPropertyDescriptor(s, e)?.set;
|
|
3
|
+
r && r !== o ? o?.call(t, n) : r?.call(t, n), t.dispatchEvent(new Event(c, {
|
|
5
4
|
bubbles: !0
|
|
6
5
|
}));
|
|
7
|
-
},
|
|
6
|
+
}, i = (t) => {
|
|
7
|
+
if (t) {
|
|
8
|
+
if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) {
|
|
9
|
+
a(t, "value", "", "change");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
t.isContentEditable && (t.innerHTML = "", t.dispatchEvent(new Event("input", {
|
|
13
|
+
bubbles: !0
|
|
14
|
+
})), t.dispatchEvent(new Event("change", {
|
|
15
|
+
bubbles: !0
|
|
16
|
+
})));
|
|
17
|
+
}
|
|
18
|
+
}, p = (t, e, n, c) => {
|
|
8
19
|
try {
|
|
9
|
-
t.setSelectionRange(
|
|
20
|
+
t.setSelectionRange(e, n, c);
|
|
10
21
|
} catch {
|
|
11
22
|
}
|
|
12
|
-
},
|
|
13
|
-
const
|
|
23
|
+
}, b = (t) => {
|
|
24
|
+
const e = t.selectionStart ?? 0, n = t.selectionEnd ?? e;
|
|
14
25
|
return {
|
|
15
|
-
selectionStart:
|
|
16
|
-
selectionEnd:
|
|
17
|
-
rawStart: Math.min(
|
|
18
|
-
rawEnd: Math.max(
|
|
26
|
+
selectionStart: e,
|
|
27
|
+
selectionEnd: n,
|
|
28
|
+
rawStart: Math.min(e, n),
|
|
29
|
+
rawEnd: Math.max(e, n),
|
|
19
30
|
direction: t.selectionDirection === "backward" ? "backward" : "forward"
|
|
20
31
|
};
|
|
21
|
-
}, u = (t, r) => {
|
|
22
|
-
const e = l.c(3);
|
|
23
|
-
let c;
|
|
24
|
-
return e[0] !== t || e[1] !== r ? (c = () => {
|
|
25
|
-
!t.current || !r.current || (r.current.scrollLeft = t.current.scrollLeft);
|
|
26
|
-
}, e[0] = t, e[1] = r, e[2] = c) : c = e[2], c;
|
|
27
32
|
};
|
|
28
33
|
export {
|
|
29
|
-
|
|
34
|
+
i as clearInputElement,
|
|
35
|
+
b as getSelectionMetrics,
|
|
30
36
|
a as setElementKey,
|
|
31
|
-
|
|
32
|
-
u as useSyncSyntaxScroll
|
|
37
|
+
p as setSelectionRangeSafe
|
|
33
38
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputSuggestion } from './InputSuggestion';
|
|
3
|
+
import { InputSyntaxSegment } from './Input.syntax.hook';
|
|
4
|
+
import { ContentEditableEvent } from 'react-contenteditable';
|
|
5
|
+
/**
|
|
6
|
+
* =========================
|
|
7
|
+
* Types
|
|
8
|
+
* =========================
|
|
9
|
+
*/
|
|
10
|
+
type EditorPart = string | InputSuggestion | any;
|
|
11
|
+
export type UseContentEditableControllerProps = {
|
|
12
|
+
editorRef: React.RefObject<HTMLElement>;
|
|
13
|
+
transformSyntax?: ((value: any, appliedSyntaxParts?: (InputSuggestion | any)[]) => InputSyntaxSegment[]) | undefined;
|
|
14
|
+
filterSuggestionsByLastToken?: boolean;
|
|
15
|
+
onLastTokenChange?: (token: string | null) => void;
|
|
16
|
+
onStateChange?: (payload: {
|
|
17
|
+
value: string;
|
|
18
|
+
tokens: InputSuggestion[];
|
|
19
|
+
segments?: InputSyntaxSegment[] | null;
|
|
20
|
+
}) => void;
|
|
21
|
+
};
|
|
22
|
+
export type UseContentEditableControllerReturn = {
|
|
23
|
+
editorHtml: string;
|
|
24
|
+
setEditorHtml: React.Dispatch<React.SetStateAction<string>>;
|
|
25
|
+
initializeFromExternalValue: (externalValue: string) => string;
|
|
26
|
+
updateEditorState: (rootEl: HTMLElement | null) => void;
|
|
27
|
+
applySuggestionValueSyntax: (suggestion: InputSuggestion) => void;
|
|
28
|
+
handlePaste: (event: React.ClipboardEvent<HTMLDivElement>) => void;
|
|
29
|
+
handleChange: (event: ContentEditableEvent) => void;
|
|
30
|
+
handleKeyDownCapture: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
31
|
+
handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare const serializeEditorParts: (rootEl: HTMLElement | null) => EditorPart[];
|
|
34
|
+
/**
|
|
35
|
+
* =========================
|
|
36
|
+
* Hook
|
|
37
|
+
* =========================
|
|
38
|
+
*/
|
|
39
|
+
export declare const useContentEditableController: (props: UseContentEditableControllerProps) => UseContentEditableControllerReturn;
|
|
40
|
+
export {};
|