@code0-tech/pictor 0.0.0-mvp.40 → 0.0.0-mvp.42

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 (56) hide show
  1. package/dist/assets/components/data-table/DataTable.style.css +1 -0
  2. package/dist/assets/components/menu/Menu.style.css +1 -1
  3. package/dist/components/d-flow/DFlow.service.js +80 -100
  4. package/dist/components/d-flow-data-type/DFlowDataType.service.js +6 -7
  5. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.d.ts +1 -1
  6. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js +15 -15
  7. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.d.ts +1 -1
  8. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js +17 -17
  9. package/dist/components/d-flow-data-type/rules/DFlowDataTypeParentRule.d.ts +1 -1
  10. package/dist/components/d-flow-data-type/rules/DFlowDataTypeParentRule.js +1 -1
  11. package/dist/components/d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.d.ts +2 -1
  12. package/dist/components/d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js +87 -85
  13. package/dist/components/d-flow-data-type/rules/DFlowDataTypeRule.d.ts +2 -1
  14. package/dist/components/d-flow-function/DFlowFunction.input.hook.d.ts +2 -1
  15. package/dist/components/d-flow-function/DFlowFunction.input.hook.js +5 -5
  16. package/dist/components/d-flow-function/DFlowFunction.return.hook.d.ts +2 -1
  17. package/dist/components/d-flow-function/DFlowFunction.return.hook.js +5 -5
  18. package/dist/components/d-flow-input/DFlowInputDataTypeEditDialog.js +1 -1
  19. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +17 -17
  20. package/dist/components/d-flow-node/DFlowNode.return.hook.d.ts +5 -0
  21. package/dist/components/d-flow-node/DFlowNode.return.hook.js +27 -0
  22. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +90 -91
  23. package/dist/components/d-flow-validation/DDataTypeValidation.hook.js +1 -1
  24. package/dist/components/d-flow-validation/DNodeValidation.hook.js +33 -33
  25. package/dist/components/d-flow-validation/DValueValidation.hook.d.ts +2 -1
  26. package/dist/components/d-flow-validation/DValueValidation.hook.js +5 -5
  27. package/dist/components/d-project/DNamespaceProject.service.d.ts +2 -1
  28. package/dist/components/data-table/DataTable.d.ts +23 -0
  29. package/dist/components/data-table/DataTable.js +41 -0
  30. package/dist/components/data-table/DataTableColumn.d.ts +6 -0
  31. package/dist/components/data-table/DataTableColumn.js +22 -0
  32. package/dist/components/data-table/DataTableFilterInput.d.ts +18 -0
  33. package/dist/components/data-table/DataTableFilterInput.js +210 -0
  34. package/dist/components/data-table/DataTableFilterSuggestionMenu.d.ts +7 -0
  35. package/dist/components/data-table/DataTableFilterSuggestionMenu.js +53 -0
  36. package/dist/components/data-table/index.d.ts +4 -0
  37. package/dist/components/data-table/index.js +11 -0
  38. package/dist/components/editor/Editor.d.ts +9 -3
  39. package/dist/components/editor/Editor.js +249 -174
  40. package/dist/components/menu/Menu.d.ts +5 -1
  41. package/dist/components/menu/Menu.js +73 -57
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +182 -171
  44. package/dist/node_modules/@lezer/highlight/dist/index.js +132 -169
  45. package/dist/utils/generics.d.ts +2 -1
  46. package/dist/utils/generics.js +84 -80
  47. package/package.json +32 -21
  48. package/dist/node_modules/@codemirror/language/dist/index.js +0 -429
  49. package/dist/node_modules/@codemirror/lint/dist/index.js +0 -515
  50. package/dist/node_modules/@codemirror/state/dist/index.js +0 -2614
  51. package/dist/node_modules/@codemirror/view/dist/index.js +0 -6227
  52. package/dist/node_modules/@lezer/common/dist/index.js +0 -1357
  53. package/dist/node_modules/@marijn/find-cluster-break/src/index.js +0 -69
  54. package/dist/node_modules/crelt/index.js +0 -27
  55. package/dist/node_modules/style-mod/src/style-mod.js +0 -109
  56. package/dist/node_modules/w3c-keyname/index.js +0 -88
@@ -0,0 +1,210 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { c as Q } from "../../_virtual/compiler-runtime.js";
3
+ import { Editor as z } from "../editor/Editor.js";
4
+ import { StreamLanguage as U, syntaxTree as J } from "@codemirror/language";
5
+ import { EditorState as K } from "@uiw/react-codemirror";
6
+ import { Badge as b } from "../badge/Badge.js";
7
+ import { hashToColor as X } from "../d-flow/DFlow.util.js";
8
+ import { DataTableFilterSuggestionMenu as j } from "./DataTableFilterSuggestionMenu.js";
9
+ import { MenuItem as G } from "../menu/Menu.js";
10
+ const $ = {
11
+ "=": "isOneOf",
12
+ "!=": "isNotOneOf"
13
+ }, H = {
14
+ isOneOf: "is one of",
15
+ isNotOneOf: "is not one of"
16
+ }, Y = {
17
+ isOneOf: "=",
18
+ isNotOneOf: "!="
19
+ }, y = (r) => r.replace(/^\\|\\$/g, ""), Z = (r) => U.define({
20
+ startState: () => ({
21
+ tokens: []
22
+ }),
23
+ token(e, n) {
24
+ if (e.eatSpace()) return null;
25
+ if (e.match("!=") || e.match("=") && e.peek() !== "=")
26
+ return n.tokens.push("operator"), "operator";
27
+ if (e.peek() === "\\") {
28
+ e.next();
29
+ const k = [];
30
+ for (; !e.eol() && e.peek() !== "\\"; ) k.push(e.next());
31
+ if (e.peek() === "\\") {
32
+ e.next();
33
+ const S = k.join("");
34
+ if (r.includes(S) && n.tokens[n.tokens.length - 1] !== "propertyName")
35
+ return n.tokens.push("propertyName"), "propertyName";
36
+ if (n.tokens[n.tokens.length - 1] !== "literal")
37
+ return n.tokens.push("literal"), "literal";
38
+ }
39
+ return null;
40
+ }
41
+ return e.next(), null;
42
+ }
43
+ }), he = (r) => {
44
+ const e = Q.c(17), {
45
+ filterTokens: n,
46
+ onChange: k
47
+ } = r;
48
+ let S;
49
+ e[0] !== n ? (S = Z(n?.map(q) || []), e[0] = n, e[1] = S) : S = e[1];
50
+ const A = S;
51
+ let v;
52
+ e[2] !== n ? (v = (o) => {
53
+ if (!o.trim())
54
+ return {};
55
+ const d = {}, l = o.split(/\\/).filter(Boolean);
56
+ for (let i = 0; i + 2 < l.length; i = i + 3, i) {
57
+ const p = l[i], a = l[i + 1], _ = l[i + 2];
58
+ if (!p || !a || !_)
59
+ continue;
60
+ const L = n?.find((t) => t.token === p);
61
+ if (!L)
62
+ continue;
63
+ const h = $[a];
64
+ if (!h)
65
+ continue;
66
+ const O = _.split(",").map(x).filter(Boolean);
67
+ O.length > 0 && (d[L.key] = {
68
+ operator: h,
69
+ value: O
70
+ });
71
+ }
72
+ return d;
73
+ }, e[2] = n, e[3] = v) : v = e[3];
74
+ const B = v;
75
+ let w;
76
+ e[4] !== k || e[5] !== B ? (w = (o) => {
77
+ const d = B(o);
78
+ k?.(d);
79
+ }, e[4] = k, e[5] = B, e[6] = w) : w = e[6];
80
+ const F = w;
81
+ let C;
82
+ e[7] !== n ? (C = (o) => {
83
+ const d = J(o.state), l = d.resolveInner(o.pos, -1), i = d.resolveInner(o.pos, 1), {
84
+ propertyNode: p,
85
+ operatorNode: a
86
+ } = (() => {
87
+ const t = {
88
+ propertyNode: null,
89
+ operatorNode: null
90
+ };
91
+ for (let s = l; s; s = s.prevSibling)
92
+ s.name === "propertyName" && !t.propertyNode && (t.propertyNode = s), s.name === "operator" && !t.operatorNode && (t.operatorNode = s);
93
+ return t;
94
+ })(), _ = p ? o.pos < p.to ? "propertyName" : o.pos === p.to ? "operator" : a ? o.pos < a.to ? "operator" : o.pos === a.to ? "literal" : l.name === "literal" ? "propertyName" : l.name === "invalid" && o.state.sliceDoc(l.from, l.to).startsWith("\\") ? "literal" : (() => {
95
+ const t = o.state.sliceDoc(a.to, o.pos);
96
+ return t.trim() ? t.includes(" ") ? "propertyName" : "literal" : t.length > 0 ? "propertyName" : "literal";
97
+ })() : (i.name === "operator", "operator") : "propertyName", L = p ? y(o.state.sliceDoc(p.from, p.to)) : "", h = n?.find((t) => t.token === L), O = (t, s, c, g) => {
98
+ g ? o.view?.dispatch({
99
+ changes: {
100
+ from: t,
101
+ to: s,
102
+ insert: c
103
+ },
104
+ selection: {
105
+ anchor: o.pos
106
+ },
107
+ scrollIntoView: !1
108
+ }) : (o.view?.dispatch({
109
+ changes: {
110
+ from: t,
111
+ to: s,
112
+ insert: c
113
+ },
114
+ selection: {
115
+ anchor: t + c.length
116
+ },
117
+ scrollIntoView: !0
118
+ }), o.view?.focus());
119
+ };
120
+ if (_ === "propertyName") {
121
+ const t = /* @__PURE__ */ new Set(), s = o.matchBefore(/\\?[\w-]*/), c = s ? s.from : o.pos, g = p && o.pos <= p.to, N = i.name === "propertyName" ? i.to : g ? p.to : o.pos, m = g && p.from < c ? p.from : c, W = y(o.state.sliceDoc(m, o.pos)), R = n?.filter((f) => f.token.startsWith(W) && !t.has(f.token)) || [];
122
+ if (d.iterate({
123
+ enter: (f) => {
124
+ f.name === "propertyName" && t.add(y(o.state.sliceDoc(f.from, f.to)));
125
+ }
126
+ }), R.length)
127
+ return /* @__PURE__ */ u(j, { context: o, children: R.map((f) => /* @__PURE__ */ u(G, { onSelect: () => {
128
+ let M = `\\${f.token}\\`;
129
+ l.name === "literal" && o.state.sliceDoc(N, N + 1) !== "\\" && (M = "\\" + M), O(m, N, M);
130
+ }, children: f.token }, f.token)) });
131
+ }
132
+ if (_ === "operator" && h) {
133
+ const t = o.matchBefore(/[!=]+/), s = t ? t.from : o.pos, c = a && o.pos <= a.to, g = i.name === "operator" ? i.to : c ? a.to : o.pos, N = c && a.from < s ? a.from : s;
134
+ return /* @__PURE__ */ u(j, { context: o, children: h.operators.map((m) => /* @__PURE__ */ u(G, { onSelect: () => O(N, g, Y[m]), children: H[m] }, m)) });
135
+ }
136
+ if (_ === "literal" && h?.suggestion) {
137
+ const t = a ? o.state.sliceDoc(a.from, a.to) : "", s = $[t];
138
+ if (s && h.operators.includes(s)) {
139
+ const c = i.name === "literal" ? o.state.sliceDoc(i.from, i.to) : "";
140
+ return h.suggestion(o, s, y(c), (g, N) => {
141
+ const m = l.name === "literal" || l.name === "invalid" && o.state.sliceDoc(l.from, l.to).startsWith("\\"), W = m ? l.from : o.pos, R = m ? l.to : i.name === "literal" ? i.to : o.pos;
142
+ O(W, R, `\\${g}\\`, N);
143
+ });
144
+ }
145
+ }
146
+ return null;
147
+ }, e[7] = n, e[8] = C) : C = e[8];
148
+ const V = C;
149
+ let D, I;
150
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = {
151
+ backgroundColor: "rgba(255,255,255,.1)",
152
+ padding: "0.35rem",
153
+ boxSizing: "border-box",
154
+ borderRadius: "1rem",
155
+ boxShadow: "inset 0 1px 1px 0 rgba(255,255,255,.2)"
156
+ }, I = {
157
+ literal: oe,
158
+ operator: te,
159
+ propertyName: re
160
+ }, e[9] = D, e[10] = I) : (D = e[9], I = e[10]);
161
+ let T, E;
162
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = [K.transactionFilter.of(ne)], E = {
163
+ lineNumbers: !1,
164
+ foldGutter: !1,
165
+ highlightActiveLine: !1,
166
+ highlightActiveLineGutter: !1,
167
+ dropCursor: !1,
168
+ indentOnInput: !1
169
+ }, e[11] = T, e[12] = E) : (T = e[11], E = e[12]);
170
+ let P;
171
+ return e[13] !== V || e[14] !== F || e[15] !== A ? (P = /* @__PURE__ */ u(z, { w: "100%", initialValue: "", onChange: F, style: D, tokenHighlights: I, showTooltips: !1, showValidation: !1, customSuggestionComponent: !0, suggestions: V, extensions: T, basicSetup: E, language: A }), e[13] = V, e[14] = F, e[15] = A, e[16] = P) : P = e[16], P;
172
+ };
173
+ function q(r) {
174
+ return r.token;
175
+ }
176
+ function x(r) {
177
+ return r.trim();
178
+ }
179
+ function ee(r) {
180
+ return /* @__PURE__ */ u(b, { style: {
181
+ boxShadow: "none"
182
+ }, color: "secondary", children: r }, r);
183
+ }
184
+ function oe(r) {
185
+ const {
186
+ content: e
187
+ } = r, n = y(e).split(",");
188
+ return n.length > 1 ? /* @__PURE__ */ u(b, { p: 0.175, mx: 0.175, children: n.map(ee) }) : /* @__PURE__ */ u(b, { mx: 0.175, children: y(e) });
189
+ }
190
+ function te(r) {
191
+ const {
192
+ content: e
193
+ } = r;
194
+ return /* @__PURE__ */ u(b, { color: "tertiary", style: {
195
+ boxShadow: "none"
196
+ }, children: H[$[e]] || e });
197
+ }
198
+ function re(r) {
199
+ const {
200
+ content: e
201
+ } = r;
202
+ return /* @__PURE__ */ u(b, { mx: 0.175, color: X(y(e)), children: y(e) });
203
+ }
204
+ function ne(r) {
205
+ return r.docChanged && r.newDoc.lines > 1 ? [] : r;
206
+ }
207
+ export {
208
+ he as DataTableFilterInput,
209
+ Z as createFilterQueryLanguage
210
+ };
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { CompletionContext } from '@codemirror/autocomplete';
3
+ export interface DataTableFilterSuggestionMenuProps {
4
+ children?: React.ReactNode;
5
+ context?: CompletionContext;
6
+ }
7
+ export declare const DataTableFilterSuggestionMenu: React.FC<DataTableFilterSuggestionMenuProps>;
@@ -0,0 +1,53 @@
1
+ import { jsx as f, jsxs as d } from "react/jsx-runtime";
2
+ import { c as v } from "../../_virtual/compiler-runtime.js";
3
+ import w from "react";
4
+ import { MenuTrigger as y, MenuContent as _, Menu as g } from "../menu/Menu.js";
5
+ const T = (t) => {
6
+ const e = v.c(11), {
7
+ children: l,
8
+ context: u
9
+ } = t, [m, p] = w.useState(!0), h = _;
10
+ let r;
11
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = (a) => p(a), e[0] = r) : r = e[0];
12
+ let i;
13
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ f(y, { asChild: !0, children: /* @__PURE__ */ f("div", { style: {
14
+ position: "absolute",
15
+ top: 0,
16
+ left: 0,
17
+ width: 0,
18
+ height: 0
19
+ } }) }), e[1] = i) : i = e[1];
20
+ let n;
21
+ e[2] !== u?.view ? (n = (a) => {
22
+ ["Escape", "ArrowUp", "ArrowDown"].includes(a.key) || u?.view?.focus();
23
+ }, e[2] = u?.view, e[3] = n) : n = e[3];
24
+ let s;
25
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
26
+ position: "fixed",
27
+ top: 0,
28
+ left: 0,
29
+ pointerEvents: "auto"
30
+ }, e[4] = s) : s = e[4];
31
+ let o;
32
+ e[5] !== l || e[6] !== n ? (o = /* @__PURE__ */ f(h, { w: "200px", onInteractOutside: b, onOpenAutoFocus: D, onKeyDown: n, style: s, children: l }), e[5] = l, e[6] = n, e[7] = o) : o = e[7];
33
+ let c;
34
+ return e[8] !== m || e[9] !== o ? (c = /* @__PURE__ */ d(g, { open: m, onOpenChange: r, modal: !1, children: [
35
+ i,
36
+ o
37
+ ] }), e[8] = m, e[9] = o, e[10] = c) : c = e[10], c;
38
+ };
39
+ function x(t) {
40
+ return t;
41
+ }
42
+ function S(t) {
43
+ return t.startsWith("cm-");
44
+ }
45
+ function b(t) {
46
+ Array.from(t.currentTarget.classList).map(x).some(S) && t.preventDefault();
47
+ }
48
+ function D(t) {
49
+ t.preventDefault(), t.currentTarget.querySelector('[role="menuitem"]')?.focus();
50
+ }
51
+ export {
52
+ T as DataTableFilterSuggestionMenu
53
+ };
@@ -0,0 +1,4 @@
1
+ export * from './DataTable';
2
+ export * from './DataTableColumn';
3
+ export * from './DataTableFilterInput';
4
+ export * from './DataTableFilterSuggestionMenu';
@@ -0,0 +1,11 @@
1
+ import { DataTable as t } from "./DataTable.js";
2
+ import { DataTableColumn as o } from "./DataTableColumn.js";
3
+ import { DataTableFilterInput as u, createFilterQueryLanguage as m } from "./DataTableFilterInput.js";
4
+ import { DataTableFilterSuggestionMenu as p } from "./DataTableFilterSuggestionMenu.js";
5
+ export {
6
+ t as DataTable,
7
+ o as DataTableColumn,
8
+ u as DataTableFilterInput,
9
+ p as DataTableFilterSuggestionMenu,
10
+ m as createFilterQueryLanguage
11
+ };
@@ -2,7 +2,9 @@ import { default as React } from 'react';
2
2
  import { Code0Component } from '../../utils';
3
3
  import { ValidationProps } from '../form';
4
4
  import { Extension } from '@uiw/react-codemirror';
5
+ import { StreamLanguage } from '@codemirror/language';
5
6
  import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
7
+ import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
6
8
  export type EditorTokenizer = (content: string) => string | null;
7
9
  export interface EditorRendererProps {
8
10
  content: string;
@@ -10,14 +12,18 @@ export interface EditorRendererProps {
10
12
  export interface EditorTokenHighlights {
11
13
  [tokenName: string]: (props: EditorRendererProps) => React.ReactNode;
12
14
  }
13
- export interface EditorInputProps extends Omit<Code0Component<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'>, ValidationProps<object> {
14
- language?: 'json';
15
+ export interface EditorInputProps extends Omit<Code0Component<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'>, ValidationProps<any> {
16
+ language?: 'json' | StreamLanguage<unknown>;
15
17
  tokenizer?: EditorTokenizer;
16
18
  tokenHighlights?: EditorTokenHighlights;
17
- suggestions?: (context: CompletionContext) => CompletionResult | null;
19
+ suggestions?: (context: CompletionContext) => CompletionResult | React.ReactNode | null;
20
+ customSuggestionComponent?: boolean;
18
21
  onChange?: (value: any) => void;
19
22
  extensions?: Extension[];
20
23
  disabled?: boolean;
21
24
  readonly?: boolean;
25
+ showTooltips?: boolean;
26
+ showValidation?: boolean;
27
+ basicSetup?: BasicSetupOptions;
22
28
  }
23
29
  export declare const Editor: React.FC<EditorInputProps>;