@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.
Files changed (125) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +4 -0
  3. package/dist/_virtual/index2.js +4 -0
  4. package/dist/_virtual/react-contenteditable.js +7 -0
  5. package/dist/_virtual/react-contenteditable2.js +4 -0
  6. package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
  7. package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
  8. package/dist/_virtual/react-dom-server.browser.development.js +4 -0
  9. package/dist/_virtual/react-dom-server.browser.production.js +4 -0
  10. package/dist/_virtual/react-is.development.js +4 -0
  11. package/dist/_virtual/react-is.production.min.js +4 -0
  12. package/dist/_virtual/server.browser.js +5 -0
  13. package/dist/_virtual/server.browser2.js +4 -0
  14. package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
  15. package/dist/assets/components/form/Input.style.css +1 -1
  16. package/dist/components/breadcrumb/Breadcrumb.js +12 -12
  17. package/dist/components/button-group/ButtonGroup.js +12 -12
  18. package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
  19. package/dist/components/d-flow/DFlow.js +304 -268
  20. package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
  21. package/dist/components/d-flow/DFlow.service.d.ts +3 -2
  22. package/dist/components/d-flow/DFlow.service.js +62 -47
  23. package/dist/components/d-flow/DFlow.util.d.ts +4 -0
  24. package/dist/components/d-flow/DFlow.util.js +63 -0
  25. package/dist/components/d-flow/DFlowEdge.js +34 -34
  26. package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
  27. package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
  28. package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
  29. package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
  30. package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
  31. package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
  32. package/dist/components/d-flow-file/DFlowTabs.js +26 -27
  33. package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
  34. package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
  35. package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
  36. package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
  37. package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
  38. package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
  39. package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
  40. package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
  41. package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
  42. package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
  43. package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
  44. package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
  45. package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
  46. package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
  47. package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
  48. package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
  49. package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
  50. package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
  51. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
  52. package/dist/components/d-flow-panel/DFlowExport.js +1 -1
  53. package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
  54. package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
  55. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
  56. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
  57. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
  58. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
  59. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
  60. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
  61. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
  62. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
  63. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
  64. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
  65. package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
  66. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
  67. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
  68. package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
  69. package/dist/components/d-flow-type/DFlowType.view.js +22 -12
  70. package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
  71. package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
  72. package/dist/components/d-resizable/DResizable.d.ts +4 -4
  73. package/dist/components/d-resizable/DResizable.js +22 -21
  74. package/dist/components/d-user/DUserInput.js +23 -21
  75. package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
  76. package/dist/components/file-tabs/FileTabs.service.js +49 -53
  77. package/dist/components/form/EmailInput.js +9 -9
  78. package/dist/components/form/Input.d.ts +2 -1
  79. package/dist/components/form/Input.js +294 -397
  80. package/dist/components/form/Input.syntax.hook.d.ts +1 -18
  81. package/dist/components/form/Input.syntax.hook.js +7 -73
  82. package/dist/components/form/Input.utils.d.ts +1 -2
  83. package/dist/components/form/Input.utils.js +26 -21
  84. package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
  85. package/dist/components/form/InputContentEditable.hook.js +471 -0
  86. package/dist/components/form/InputSuggestion.d.ts +2 -2
  87. package/dist/components/form/InputSuggestion.js +169 -107
  88. package/dist/components/form/PasswordInput.js +8 -8
  89. package/dist/components/form/TextInput.js +11 -11
  90. package/dist/components/form/useForm.d.ts +1 -0
  91. package/dist/components/form/useForm.js +45 -60
  92. package/dist/components/menu/Menu.js +4 -4
  93. package/dist/index.js +155 -154
  94. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
  95. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
  96. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
  97. package/dist/node_modules/fast-deep-equal/index.js +31 -0
  98. package/dist/node_modules/object-assign/index.js +49 -0
  99. package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
  100. package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  101. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  102. package/dist/node_modules/prop-types/index.js +17 -0
  103. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  104. package/dist/node_modules/prop-types/lib/has.js +7 -0
  105. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
  106. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
  107. package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
  108. package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
  109. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
  110. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
  111. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
  112. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
  113. package/dist/node_modules/react-dom/server.browser.js +15 -0
  114. package/dist/utils/generics.d.ts +2 -0
  115. package/dist/utils/generics.js +93 -80
  116. package/dist/utils/index.js +22 -21
  117. package/dist/utils/inspection.d.ts +4 -2
  118. package/dist/utils/inspection.js +27 -2
  119. package/package.json +10 -8
  120. package/dist/components/form/Input.selection.hook.d.ts +0 -17
  121. package/dist/components/form/Input.selection.hook.js +0 -78
  122. package/dist/components/form/InputSyntax.d.ts +0 -19
  123. package/dist/components/form/InputSyntax.js +0 -52
  124. package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
  125. 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
- import c from "react";
2
- const S = (i) => {
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: s.length,
8
- visualLength: s.length,
9
- content: s
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
- S as buildDefaultSyntax,
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
- import { c as l } from "../../_virtual/compiler-runtime.js";
2
- const a = (t, r, e, c) => {
3
- const o = Object.getOwnPropertyDescriptor(t, r)?.set, s = Object.getPrototypeOf(t), n = Object.getOwnPropertyDescriptor(s, r)?.set;
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
- }, S = (t, r, e, c) => {
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(r, e, c);
20
+ t.setSelectionRange(e, n, c);
10
21
  } catch {
11
22
  }
12
- }, p = (t) => {
13
- const r = t.selectionStart ?? 0, e = t.selectionEnd ?? r;
23
+ }, b = (t) => {
24
+ const e = t.selectionStart ?? 0, n = t.selectionEnd ?? e;
14
25
  return {
15
- selectionStart: r,
16
- selectionEnd: e,
17
- rawStart: Math.min(r, e),
18
- rawEnd: Math.max(r, e),
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
- p as getSelectionMetrics,
34
+ i as clearInputElement,
35
+ b as getSelectionMetrics,
30
36
  a as setElementKey,
31
- S as setSelectionRangeSafe,
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 {};