@cratis/event-models 0.175.0 → 0.176.0
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/screen-editor/BindingExpressionPropertyEditor-DbYpy_bX.js +426 -0
- package/dist/screen-editor/BooleanEditor-eC1yCpz0.js +17 -0
- package/dist/screen-editor/CollectionEditor-C7eX8Hw7.js +320 -0
- package/dist/screen-editor/ColorEditor-Cc6Xq8pW.js +49 -0
- package/dist/screen-editor/ColumnListEditor-Cku6GGLp.js +103 -0
- package/dist/screen-editor/EnumEditor-DNnnf9i3.js +26 -0
- package/dist/screen-editor/FieldEditor-SquvComm.js +66 -0
- package/dist/screen-editor/FieldListEditor-CNxskXPf.js +56 -0
- package/dist/screen-editor/IconEditor-C0ibqn-e.js +22 -0
- package/dist/screen-editor/InheritanceModeEditor-CtdsACnc.js +65 -0
- package/dist/screen-editor/ListEditor-CfFPVVJ4.js +53 -0
- package/dist/screen-editor/NavigationTargetEditor-DGnW5pVF.js +41 -0
- package/dist/screen-editor/NumberEditor-Cyo9_23Z.js +48 -0
- package/dist/screen-editor/QueryBindingEditor-3C_utVJm.js +17 -0
- package/dist/screen-editor/QueryBindingPropertyEditor-DLlC-slh.js +169 -0
- package/dist/screen-editor/ReferenceEditor-BnI2Qd7H.js +32 -0
- package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +19 -0
- package/dist/screen-editor/RenderingSlotEditor-Cani_PtT.js +128 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -4
- package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
- package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
- package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
- package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
- package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
- package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
- package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
- package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
- package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
- package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
- package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
- package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
- package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
- package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
- package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
- package/dist/screen-editor/index.js +2997 -4376
- package/dist/screen-editor/screen-editor.css +1 -1
- package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
- package/package.json +12 -12
- package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useState as b } from "react";
|
|
2
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
var u = [
|
|
4
|
+
"inherit",
|
|
5
|
+
"extend",
|
|
6
|
+
"override"
|
|
7
|
+
], g = ({ value: i, onChange: n, context: d, disabled: p, id: c }) => {
|
|
8
|
+
const t = d.strings.editors.inheritanceMode, o = i !== void 0 && u.includes(i) ? i : "inherit", [h, s] = b(!1), m = (e) => {
|
|
9
|
+
if (e !== o) {
|
|
10
|
+
if (o === "inherit" && e === "override") {
|
|
11
|
+
s(!0);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
s(!1), n(e);
|
|
15
|
+
}
|
|
16
|
+
}, a = (e) => {
|
|
17
|
+
s(!1), n("override"), d.session?.copyInheritedItems?.(e);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ l("div", {
|
|
20
|
+
id: c,
|
|
21
|
+
className: "studio-editor-mode",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ r("div", {
|
|
24
|
+
className: "studio-editor-segments",
|
|
25
|
+
role: "radiogroup",
|
|
26
|
+
"aria-labelledby": `${c}-label`,
|
|
27
|
+
children: u.map((e) => /* @__PURE__ */ r("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
role: "radio",
|
|
30
|
+
"aria-checked": e === o,
|
|
31
|
+
disabled: p,
|
|
32
|
+
className: `studio-editor-segment${e === o ? " studio-editor-segment--chosen" : ""}`,
|
|
33
|
+
onClick: () => m(e),
|
|
34
|
+
children: t.modes[e].label
|
|
35
|
+
}, e))
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ r("p", {
|
|
38
|
+
className: "studio-editor-properties__hint",
|
|
39
|
+
children: t.modes[o].effect
|
|
40
|
+
}),
|
|
41
|
+
h && /* @__PURE__ */ l("div", {
|
|
42
|
+
className: "studio-editor-mode__prompt",
|
|
43
|
+
role: "alertdialog",
|
|
44
|
+
"aria-label": t.copyPrompt,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ r("span", { children: t.copyPrompt }),
|
|
47
|
+
/* @__PURE__ */ r("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
autoFocus: !0,
|
|
50
|
+
onClick: () => a(!0),
|
|
51
|
+
children: t.copyYes
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ r("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
onClick: () => a(!1),
|
|
56
|
+
children: t.copyNo
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
g as InheritanceModeEditor
|
|
65
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { l as d, t as g, v as N, y as _ } from "./structuredValue-vqCZttsk.js";
|
|
2
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
var k = ({ value: m, onChange: b, descriptor: n, context: h, disabled: p, id: v }) => {
|
|
4
|
+
const l = h.strings.editors.list, a = n.editorKind === "numberList", e = g(m), i = (o) => b(o.length === 0 ? void 0 : o);
|
|
5
|
+
return /* @__PURE__ */ c("fieldset", {
|
|
6
|
+
id: v,
|
|
7
|
+
className: "studio-editor-list",
|
|
8
|
+
disabled: p,
|
|
9
|
+
children: [e.map((o, t) => /* @__PURE__ */ c("div", {
|
|
10
|
+
className: "studio-editor-list__row",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ s("input", {
|
|
13
|
+
className: "studio-editor-field__input",
|
|
14
|
+
type: a ? "number" : "text",
|
|
15
|
+
"aria-label": `${n.label} ${t + 1}`,
|
|
16
|
+
defaultValue: String(o ?? ""),
|
|
17
|
+
onBlur: (f) => {
|
|
18
|
+
const u = f.target.value, r = a ? Number(u) : u;
|
|
19
|
+
r !== o && (!a || Number.isFinite(r)) && i(N(e, t, r));
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ s("button", {
|
|
23
|
+
type: "button",
|
|
24
|
+
"aria-label": l.moveUp,
|
|
25
|
+
disabled: t === 0,
|
|
26
|
+
onClick: () => i(d(e, t, -1)),
|
|
27
|
+
children: "↑"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ s("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
"aria-label": l.moveDown,
|
|
32
|
+
disabled: t === e.length - 1,
|
|
33
|
+
onClick: () => i(d(e, t, 1)),
|
|
34
|
+
children: "↓"
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ s("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
"aria-label": l.remove,
|
|
39
|
+
onClick: () => i(_(e, t)),
|
|
40
|
+
children: "×"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}, t)), /* @__PURE__ */ s("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
className: "studio-editor-list__add",
|
|
46
|
+
onClick: () => i([...e, a ? 0 : ""]),
|
|
47
|
+
children: l.add
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
k as ListEditor
|
|
53
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { o as g } from "./structuredValue-vqCZttsk.js";
|
|
2
|
+
import { t as v } from "./SearchableSelect-WUNlC3tk.js";
|
|
3
|
+
import { Fragment as f, jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
4
|
+
var T = (o) => typeof o == "string" && o !== "" ? o : g(o) && typeof o.screen == "string" && o.screen !== "" ? o.screen : void 0, C = ({ value: o, onChange: b, descriptor: t, context: n, disabled: h, id: c }) => {
|
|
5
|
+
const r = n.strings.editors, d = n.lookups.destinations, s = T(o), a = d.find((e) => e.id === s), i = s !== void 0 && a === void 0, m = t.valueType === "destination", p = d.map((e) => ({
|
|
6
|
+
value: e.id,
|
|
7
|
+
label: e.label,
|
|
8
|
+
...e.group ? { group: e.group } : {}
|
|
9
|
+
})), u = (e) => [...e.group ? e.group.split(/\s*[>›/]\s*/) : [], e.label].join(" › ");
|
|
10
|
+
return /* @__PURE__ */ y(f, { children: [/* @__PURE__ */ l(v, {
|
|
11
|
+
id: c,
|
|
12
|
+
options: i ? [...p, {
|
|
13
|
+
value: s,
|
|
14
|
+
label: s
|
|
15
|
+
}] : p,
|
|
16
|
+
value: s,
|
|
17
|
+
disabled: h,
|
|
18
|
+
invalid: i,
|
|
19
|
+
placeholder: r.navigationTarget.placeholder,
|
|
20
|
+
searchLabel: r.select.search,
|
|
21
|
+
emptyLabel: r.select.empty,
|
|
22
|
+
clearLabel: r.select.clear,
|
|
23
|
+
clearable: t.constraints?.required !== !0,
|
|
24
|
+
"aria-labelledby": `${c}-label`,
|
|
25
|
+
renderClosed: (e) => /* @__PURE__ */ l("span", {
|
|
26
|
+
className: e ? void 0 : "studio-editor-select__placeholder",
|
|
27
|
+
children: a ? u(a) : e?.label ?? r.navigationTarget.placeholder
|
|
28
|
+
}),
|
|
29
|
+
onChange: (e) => b(e === void 0 ? void 0 : m ? {
|
|
30
|
+
...g(o) ? o : {},
|
|
31
|
+
screen: e
|
|
32
|
+
} : e)
|
|
33
|
+
}), i && /* @__PURE__ */ l("span", {
|
|
34
|
+
className: "studio-editor-chip studio-editor-chip--error",
|
|
35
|
+
role: "alert",
|
|
36
|
+
children: r.navigationTarget.unresolved(s)
|
|
37
|
+
})] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
C as NavigationTargetEditor
|
|
41
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as h } from "./draftProblem-BGC5Gfsv.js";
|
|
2
|
+
import { useEffect as j, useState as b } from "react";
|
|
3
|
+
import { jsx as y, jsxs as k } from "react/jsx-runtime";
|
|
4
|
+
var S = ({ value: s, onChange: a, descriptor: e, context: N, disabled: g, problem: x, id: d }) => {
|
|
5
|
+
const t = typeof s == "number" ? String(s) : "", [o, r] = b(t), [E, n] = b();
|
|
6
|
+
j(() => {
|
|
7
|
+
r(t), n(void 0);
|
|
8
|
+
}, [t]);
|
|
9
|
+
const { minimum: m, maximum: u, integer: _ } = e.constraints ?? {}, c = e.editorOptions?.step ?? (_ ? 1 : void 0), l = e.editorOptions?.unit, f = E ?? x, p = () => {
|
|
10
|
+
if (o === t) return;
|
|
11
|
+
if (o.trim() === "") {
|
|
12
|
+
n(void 0), a(void 0);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const i = Number(o), v = Number.isFinite(i) ? h(e, i) : {
|
|
16
|
+
code: "invalidValue",
|
|
17
|
+
message: N.strings.editors.number.invalid
|
|
18
|
+
};
|
|
19
|
+
n(v), v || a(i);
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ k("span", {
|
|
22
|
+
className: "studio-editor-number",
|
|
23
|
+
children: [/* @__PURE__ */ y("input", {
|
|
24
|
+
id: d,
|
|
25
|
+
type: "number",
|
|
26
|
+
inputMode: "decimal",
|
|
27
|
+
className: "studio-editor-field__input",
|
|
28
|
+
value: o,
|
|
29
|
+
disabled: g,
|
|
30
|
+
...m !== void 0 ? { min: m } : {},
|
|
31
|
+
...u !== void 0 ? { max: u } : {},
|
|
32
|
+
...c !== void 0 ? { step: c } : {},
|
|
33
|
+
"aria-invalid": f ? !0 : void 0,
|
|
34
|
+
"aria-describedby": f ? `${d}-problem` : void 0,
|
|
35
|
+
onChange: (i) => r(i.target.value),
|
|
36
|
+
onBlur: p,
|
|
37
|
+
onKeyDown: (i) => {
|
|
38
|
+
i.key === "Enter" && p(), i.key === "Escape" && (r(t), n(void 0));
|
|
39
|
+
}
|
|
40
|
+
}), l && /* @__PURE__ */ y("span", {
|
|
41
|
+
className: "studio-editor-number__unit",
|
|
42
|
+
children: l
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
S as NumberEditor
|
|
48
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
var i = ({ diagnostics: t, label: s }) => {
|
|
3
|
+
if (t.length === 0) return null;
|
|
4
|
+
const a = [...t].sort((r, e) => +(e.severity === "error") - +(r.severity === "error"));
|
|
5
|
+
return /* @__PURE__ */ l("ul", {
|
|
6
|
+
className: "studio-editor-diagnostics",
|
|
7
|
+
role: "alert",
|
|
8
|
+
"aria-label": s,
|
|
9
|
+
children: a.map((r, e) => /* @__PURE__ */ l("li", {
|
|
10
|
+
"data-severity": r.severity,
|
|
11
|
+
children: r.message
|
|
12
|
+
}, `${r.code}:${r.path ?? ""}:${e}`))
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
i as t
|
|
17
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { t as N } from "./QueryBindingEditor-3C_utVJm.js";
|
|
2
|
+
import { useState as C } from "react";
|
|
3
|
+
import { validateBinding as E } from "@cratis/scene.engine";
|
|
4
|
+
import { Fragment as I, jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
function j(e) {
|
|
6
|
+
return {
|
|
7
|
+
queryId: e.id,
|
|
8
|
+
query: e.name,
|
|
9
|
+
arguments: [],
|
|
10
|
+
results: []
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function B(e) {
|
|
14
|
+
const r = e;
|
|
15
|
+
return !!r && typeof r == "object" && typeof r.queryId == "string" && Array.isArray(r.arguments) && Array.isArray(r.results);
|
|
16
|
+
}
|
|
17
|
+
function L(e, r, i) {
|
|
18
|
+
const s = e.arguments.filter((c) => c.parameter !== r);
|
|
19
|
+
return {
|
|
20
|
+
...e,
|
|
21
|
+
arguments: i.trim() === "" ? s : [...s, {
|
|
22
|
+
parameter: r,
|
|
23
|
+
source: { path: i.trim() }
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function A(e, r, i = r) {
|
|
28
|
+
return e.results.some((s) => s.field === r) ? e : {
|
|
29
|
+
...e,
|
|
30
|
+
results: [...e.results, {
|
|
31
|
+
target: i,
|
|
32
|
+
field: r
|
|
33
|
+
}]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function M(e, r) {
|
|
37
|
+
return {
|
|
38
|
+
...e,
|
|
39
|
+
results: e.results.filter((i) => i.field !== r)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var S = (e, r) => e.arguments.find((i) => i.parameter === r.name)?.source.path ?? "", F = (e, r) => e.results.some((i) => i.field === r.name), u = /* @__PURE__ */ (function(e) {
|
|
43
|
+
return e.NoQuery = "noQuery", e.MissingQuery = "missingQuery", e.Loading = "loading", e.Empty = "empty", e.Error = "error", e.Ready = "ready", e;
|
|
44
|
+
})({});
|
|
45
|
+
function R({ binding: e, candidate: r, isLoading: i, error: s, rowCount: c }) {
|
|
46
|
+
return e ? r ? s != null ? u.Error : i ? u.Loading : c === 0 ? u.Empty : u.Ready : u.MissingQuery : u.NoQuery;
|
|
47
|
+
}
|
|
48
|
+
function v(e, r, i, s) {
|
|
49
|
+
const c = E(e, r, i, s);
|
|
50
|
+
return {
|
|
51
|
+
diagnostics: c,
|
|
52
|
+
isStorable: c.every((y) => y.severity !== "error")
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var k = (e) => e.origin.map((r) => r.name).join(" / "), D = ({ property: e, candidates: r, scope: i, strings: s, disabled: c, onChange: y }) => {
|
|
56
|
+
const l = s.properties.query, [q, h] = C(), Q = B(e.effectiveValue) ? e.effectiveValue : void 0, t = q ?? Q, m = t ? r.find((n) => n.id === t.queryId) : void 0, b = t ? v(e.descriptor, m, t, i).diagnostics : [], p = (n) => {
|
|
57
|
+
if (!n) {
|
|
58
|
+
h(void 0), y(void 0);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const a = v(e.descriptor, r.find((g) => g.id === n.queryId), n, i);
|
|
62
|
+
h(a.isStorable ? void 0 : n), a.isStorable && y(n);
|
|
63
|
+
}, f = R({
|
|
64
|
+
binding: t,
|
|
65
|
+
candidate: m,
|
|
66
|
+
isLoading: !1
|
|
67
|
+
}), _ = Object.keys(i.types);
|
|
68
|
+
return /* @__PURE__ */ d("fieldset", {
|
|
69
|
+
className: "studio-editor-query",
|
|
70
|
+
disabled: c,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ o("legend", { children: e.descriptor.label }),
|
|
73
|
+
/* @__PURE__ */ d("label", { children: [/* @__PURE__ */ o("span", { children: l.label }), /* @__PURE__ */ d("select", {
|
|
74
|
+
value: t?.queryId ?? "",
|
|
75
|
+
onChange: (n) => {
|
|
76
|
+
const a = r.find((g) => g.id === n.target.value);
|
|
77
|
+
p(a ? j(a) : void 0);
|
|
78
|
+
},
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ o("option", {
|
|
81
|
+
value: "",
|
|
82
|
+
children: l.none
|
|
83
|
+
}),
|
|
84
|
+
t && !m && /* @__PURE__ */ o("option", {
|
|
85
|
+
value: t.queryId,
|
|
86
|
+
children: t.query
|
|
87
|
+
}),
|
|
88
|
+
r.map((n) => /* @__PURE__ */ d("option", {
|
|
89
|
+
value: n.id,
|
|
90
|
+
children: [
|
|
91
|
+
n.name,
|
|
92
|
+
" - ",
|
|
93
|
+
k(n)
|
|
94
|
+
]
|
|
95
|
+
}, n.id))
|
|
96
|
+
]
|
|
97
|
+
})] }),
|
|
98
|
+
t && !m && /* @__PURE__ */ o("p", {
|
|
99
|
+
className: "studio-editor-query__missing",
|
|
100
|
+
role: "alert",
|
|
101
|
+
children: l.missing
|
|
102
|
+
}),
|
|
103
|
+
t && m && /* @__PURE__ */ d(I, { children: [m.parameters.length > 0 && /* @__PURE__ */ d("div", {
|
|
104
|
+
className: "studio-editor-query__group",
|
|
105
|
+
children: [/* @__PURE__ */ o("strong", { children: l.parameters }), m.parameters.map((n) => /* @__PURE__ */ d("label", { children: [/* @__PURE__ */ d("span", { children: [l.sourceFor(n.name), n.required ? " *" : ""] }), /* @__PURE__ */ d("select", {
|
|
106
|
+
value: S(t, n),
|
|
107
|
+
onChange: (a) => p(L(t, n.name, a.target.value)),
|
|
108
|
+
children: [/* @__PURE__ */ o("option", {
|
|
109
|
+
value: "",
|
|
110
|
+
children: l.noSource
|
|
111
|
+
}), _.map((a) => /* @__PURE__ */ o("option", {
|
|
112
|
+
value: a,
|
|
113
|
+
children: a
|
|
114
|
+
}, a))]
|
|
115
|
+
})] }, n.name))]
|
|
116
|
+
}), /* @__PURE__ */ d("div", {
|
|
117
|
+
className: "studio-editor-query__group",
|
|
118
|
+
children: [/* @__PURE__ */ o("strong", { children: l.columns }), m.resultFields.map((n) => /* @__PURE__ */ d("label", {
|
|
119
|
+
className: "studio-editor-query__column",
|
|
120
|
+
children: [/* @__PURE__ */ o("input", {
|
|
121
|
+
type: "checkbox",
|
|
122
|
+
checked: F(t, n),
|
|
123
|
+
onChange: (a) => p(a.target.checked ? A(t, n.name) : M(t, n.name))
|
|
124
|
+
}), /* @__PURE__ */ o("span", { children: l.showColumn(n.name) })]
|
|
125
|
+
}, n.name))]
|
|
126
|
+
})] }),
|
|
127
|
+
/* @__PURE__ */ o("p", {
|
|
128
|
+
className: "studio-editor-query__preview",
|
|
129
|
+
role: "status",
|
|
130
|
+
"data-state": f,
|
|
131
|
+
children: O(f, l.preview)
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ o(N, {
|
|
134
|
+
diagnostics: b,
|
|
135
|
+
label: s.properties.diagnostics
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
function O(e, r) {
|
|
141
|
+
switch (e) {
|
|
142
|
+
case u.NoQuery:
|
|
143
|
+
return r.noQuery;
|
|
144
|
+
case u.MissingQuery:
|
|
145
|
+
return r.missingQuery;
|
|
146
|
+
case u.Loading:
|
|
147
|
+
return r.loading;
|
|
148
|
+
case u.Empty:
|
|
149
|
+
return r.empty;
|
|
150
|
+
case u.Error:
|
|
151
|
+
return r.error;
|
|
152
|
+
case u.Ready:
|
|
153
|
+
return "";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
var H = ({ onChange: e, context: r, disabled: i }) => {
|
|
157
|
+
const { session: s } = r;
|
|
158
|
+
return s ? /* @__PURE__ */ o(D, {
|
|
159
|
+
property: s.property,
|
|
160
|
+
candidates: r.lookups.queryCandidates,
|
|
161
|
+
scope: s.bindingScope,
|
|
162
|
+
strings: s.screenStrings,
|
|
163
|
+
disabled: i === !0,
|
|
164
|
+
onChange: e
|
|
165
|
+
}) : null;
|
|
166
|
+
};
|
|
167
|
+
export {
|
|
168
|
+
H as QueryBindingPropertyEditor
|
|
169
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as h } from "./SearchableSelect-WUNlC3tk.js";
|
|
2
|
+
import { Fragment as v, jsx as p, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
var L = ({ value: s, onChange: d, descriptor: i, context: l, disabled: u, problem: b, id: n }) => {
|
|
4
|
+
const o = l.strings.editors.select, c = i.editorOptions?.reference, m = c ? l.lookups.references(c.target) : [], r = typeof s == "string" && s !== "" ? s : void 0, t = m.map((e) => ({
|
|
5
|
+
value: e.id,
|
|
6
|
+
label: e.label,
|
|
7
|
+
...e.group ? { group: e.group } : {}
|
|
8
|
+
})), a = r !== void 0 && !t.some((e) => e.value === r);
|
|
9
|
+
return /* @__PURE__ */ g(v, { children: [/* @__PURE__ */ p(h, {
|
|
10
|
+
id: n,
|
|
11
|
+
options: a ? [...t, {
|
|
12
|
+
value: r,
|
|
13
|
+
label: r
|
|
14
|
+
}] : t,
|
|
15
|
+
value: r,
|
|
16
|
+
disabled: u,
|
|
17
|
+
invalid: a || b !== void 0,
|
|
18
|
+
placeholder: o.placeholder,
|
|
19
|
+
searchLabel: o.search,
|
|
20
|
+
emptyLabel: o.empty,
|
|
21
|
+
clearLabel: o.clear,
|
|
22
|
+
clearable: i.constraints?.required !== !0,
|
|
23
|
+
"aria-labelledby": `${n}-label`,
|
|
24
|
+
onChange: d
|
|
25
|
+
}), a && /* @__PURE__ */ p("span", {
|
|
26
|
+
className: "studio-editor-chip studio-editor-chip--error",
|
|
27
|
+
children: l.strings.editors.unresolved
|
|
28
|
+
})] });
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
L as ReferenceEditor
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReferenceEditor as o } from "./ReferenceEditor-BnI2Qd7H.js";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
var r = (t) => (e) => /* @__PURE__ */ i(o, {
|
|
4
|
+
...e,
|
|
5
|
+
descriptor: {
|
|
6
|
+
...e.descriptor,
|
|
7
|
+
editorOptions: {
|
|
8
|
+
...e.descriptor.editorOptions,
|
|
9
|
+
reference: {
|
|
10
|
+
target: t,
|
|
11
|
+
...e.descriptor.editorOptions?.reference
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}), m = r("template"), p = r("sampleData");
|
|
16
|
+
export {
|
|
17
|
+
p as SampleDataEditor,
|
|
18
|
+
m as TemplateEditor
|
|
19
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as s, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
function u(i, n) {
|
|
3
|
+
switch (i.toLowerCase()) {
|
|
4
|
+
case "header":
|
|
5
|
+
case "top":
|
|
6
|
+
case "topbar":
|
|
7
|
+
return {
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0,
|
|
10
|
+
width: 1,
|
|
11
|
+
height: 0.2
|
|
12
|
+
};
|
|
13
|
+
case "footer":
|
|
14
|
+
case "bottom":
|
|
15
|
+
return {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0.8,
|
|
18
|
+
width: 1,
|
|
19
|
+
height: 0.2
|
|
20
|
+
};
|
|
21
|
+
case "side":
|
|
22
|
+
case "sidebar":
|
|
23
|
+
case "start":
|
|
24
|
+
case "left":
|
|
25
|
+
return {
|
|
26
|
+
x: 0,
|
|
27
|
+
y: 0.2,
|
|
28
|
+
width: 0.25,
|
|
29
|
+
height: 0.6
|
|
30
|
+
};
|
|
31
|
+
case "aside":
|
|
32
|
+
case "end":
|
|
33
|
+
case "right":
|
|
34
|
+
return {
|
|
35
|
+
x: 0.75,
|
|
36
|
+
y: 0.2,
|
|
37
|
+
width: 0.25,
|
|
38
|
+
height: 0.6
|
|
39
|
+
};
|
|
40
|
+
case "content":
|
|
41
|
+
case "main":
|
|
42
|
+
case "body":
|
|
43
|
+
return {
|
|
44
|
+
x: 0.25,
|
|
45
|
+
y: 0.2,
|
|
46
|
+
width: 0.5,
|
|
47
|
+
height: 0.6
|
|
48
|
+
};
|
|
49
|
+
default: {
|
|
50
|
+
const o = n.filter((r) => ![
|
|
51
|
+
"header",
|
|
52
|
+
"top",
|
|
53
|
+
"topbar",
|
|
54
|
+
"footer",
|
|
55
|
+
"bottom",
|
|
56
|
+
"side",
|
|
57
|
+
"sidebar",
|
|
58
|
+
"start",
|
|
59
|
+
"left",
|
|
60
|
+
"aside",
|
|
61
|
+
"end",
|
|
62
|
+
"right",
|
|
63
|
+
"content",
|
|
64
|
+
"main",
|
|
65
|
+
"body"
|
|
66
|
+
].includes(r.toLowerCase())), h = o.indexOf(i);
|
|
67
|
+
return {
|
|
68
|
+
x: 0.25 + 0.5 * (Math.max(h, 0) / Math.max(o.length, 1)),
|
|
69
|
+
y: 0.2,
|
|
70
|
+
width: 0.5 / Math.max(o.length, 1),
|
|
71
|
+
height: 0.6
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var p = ({ value: i, onChange: n, context: o, disabled: h, id: r }) => {
|
|
77
|
+
const l = o.strings.editors.renderingSlot, c = o.lookups.slots, t = typeof i == "string" && i !== "" ? i : void 0, a = t !== void 0 && !c.includes(t) ? [...c, t] : c;
|
|
78
|
+
return a.length === 0 ? /* @__PURE__ */ s("p", {
|
|
79
|
+
id: r,
|
|
80
|
+
className: "studio-editor-properties__hint",
|
|
81
|
+
children: l.none
|
|
82
|
+
}) : /* @__PURE__ */ g("div", {
|
|
83
|
+
id: r,
|
|
84
|
+
className: "studio-editor-slot",
|
|
85
|
+
role: "radiogroup",
|
|
86
|
+
"aria-labelledby": `${r}-label`,
|
|
87
|
+
children: [/* @__PURE__ */ s("div", {
|
|
88
|
+
className: "studio-editor-chips",
|
|
89
|
+
children: a.map((e) => /* @__PURE__ */ s("button", {
|
|
90
|
+
type: "button",
|
|
91
|
+
role: "radio",
|
|
92
|
+
"aria-checked": e === t,
|
|
93
|
+
disabled: h,
|
|
94
|
+
className: `studio-editor-chip${e === t ? " studio-editor-chip--chosen" : ""}`,
|
|
95
|
+
onClick: () => n(e === t ? void 0 : e),
|
|
96
|
+
children: e
|
|
97
|
+
}, e))
|
|
98
|
+
}), /* @__PURE__ */ g("svg", {
|
|
99
|
+
className: "studio-editor-slot__diagram",
|
|
100
|
+
viewBox: "0 0 100 60",
|
|
101
|
+
role: "img",
|
|
102
|
+
"aria-label": t ? l.diagram(t) : "",
|
|
103
|
+
children: [/* @__PURE__ */ s("rect", {
|
|
104
|
+
x: "0.5",
|
|
105
|
+
y: "0.5",
|
|
106
|
+
width: "99",
|
|
107
|
+
height: "59",
|
|
108
|
+
rx: "3",
|
|
109
|
+
className: "studio-editor-slot__page"
|
|
110
|
+
}), a.map((e) => {
|
|
111
|
+
const d = u(e, a);
|
|
112
|
+
return /* @__PURE__ */ s("rect", {
|
|
113
|
+
"data-slot": e,
|
|
114
|
+
"data-chosen": e === t || void 0,
|
|
115
|
+
x: d.x * 100 + 1,
|
|
116
|
+
y: d.y * 60 + 1,
|
|
117
|
+
width: d.width * 100 - 2,
|
|
118
|
+
height: d.height * 60 - 2,
|
|
119
|
+
rx: "2",
|
|
120
|
+
className: `studio-editor-slot__region${e === t ? " studio-editor-slot__region--chosen" : ""}`
|
|
121
|
+
}, e);
|
|
122
|
+
})]
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
p as RenderingSlotEditor
|
|
128
|
+
};
|
|
@@ -5,6 +5,8 @@ import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
|
5
5
|
import type { QuillLoader } from '@cratis/scene.primereact';
|
|
6
6
|
import type { StateChangeSlice } from '../Actions/StateChangeSlice';
|
|
7
7
|
import type { ScreenEditorFileUpload } from './ScreenEditorFileUpload';
|
|
8
|
+
import type { ColorToken, EditorReference, EditorSlice } from '../PropertyEditors/Registry/PropertyEditorProps';
|
|
9
|
+
import type { PropertyEditorRegistry } from '../PropertyEditors/Registry/PropertyEditorRegistry';
|
|
8
10
|
export interface ScreenEditorSubject {
|
|
9
11
|
documentText?: string;
|
|
10
12
|
document?: SceneDocument;
|
|
@@ -23,6 +25,13 @@ export interface ScreenEditorEnvironment {
|
|
|
23
25
|
availableSources: Record<string, string>;
|
|
24
26
|
richText?: QuillLoader;
|
|
25
27
|
fileUpload?: ScreenEditorFileUpload;
|
|
28
|
+
propertyEditors?: {
|
|
29
|
+
registry?: PropertyEditorRegistry;
|
|
30
|
+
slices?: readonly EditorSlice[];
|
|
31
|
+
slots?: readonly string[];
|
|
32
|
+
colorTokens?: readonly ColorToken[];
|
|
33
|
+
references?: (target: string) => readonly EditorReference[];
|
|
34
|
+
};
|
|
26
35
|
templateScope?: TemplateScope;
|
|
27
36
|
}
|
|
28
37
|
export interface ScreenEditorResult {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ChangeLayoutTypeEdit, type NodeInspection } from '@cratis/scene.model';
|
|
2
|
-
import {
|
|
2
|
+
import type { SceneOrderedItem } from '../Collections/orderedItems';
|
|
3
3
|
import type { ScreenEditorController } from '../Host/ScreenEditorController';
|
|
4
4
|
import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
|
|
5
|
-
import { isSimpleProperty } from '../Properties/toPropertyGroups';
|
|
6
5
|
import type { ScreenEditorStrings } from './ScreenEditorStrings';
|
|
7
6
|
import type { Ownership } from '../Structure/Ownership';
|
|
8
7
|
export interface PropertiesPanelProps {
|
|
@@ -14,4 +13,3 @@ export interface PropertiesPanelProps {
|
|
|
14
13
|
}
|
|
15
14
|
export declare const PropertiesPanel: ({ controller, environment, strings, ownership, authoringTemplate }: PropertiesPanelProps) => import("react").JSX.Element;
|
|
16
15
|
export type { NodeInspection, ChangeLayoutTypeEdit, SceneOrderedItem };
|
|
17
|
-
export { isSimpleProperty };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IconPickerLabels } from '@cratis/components/IconPicker';
|
|
2
2
|
import type { IconPropertyFieldStrings } from '../../Icons/IconPropertyFieldStrings';
|
|
3
|
+
import type { PropertyEditorStrings } from '../PropertyEditors/Registry/PropertyEditorStrings';
|
|
3
4
|
import type { StructuredEditorStrings } from '../PropertyEditors/Structured/StructuredEditorStrings';
|
|
4
5
|
import type { Ownership } from '../Structure/Ownership';
|
|
5
6
|
import type { SceneDocumentProblem } from '../Document/readSceneDocument';
|
|
@@ -71,10 +72,7 @@ export interface ScreenEditorStrings {
|
|
|
71
72
|
icon: IconPropertyFieldStrings;
|
|
72
73
|
iconPickerLabels?: IconPickerLabels;
|
|
73
74
|
structured?: StructuredEditorStrings;
|
|
74
|
-
|
|
75
|
-
label: string;
|
|
76
|
-
message: (property: string, valueType: string, editorKind: string | undefined) => string;
|
|
77
|
-
};
|
|
75
|
+
editors?: PropertyEditorStrings;
|
|
78
76
|
templates: {
|
|
79
77
|
label: string;
|
|
80
78
|
choose: string;
|
|
@@ -4,3 +4,12 @@ export declare const selectedChoiceKey: (value: unknown) => string;
|
|
|
4
4
|
export declare function choiceValueOf(property: InspectedProperty, key: unknown): {
|
|
5
5
|
value: unknown;
|
|
6
6
|
} | undefined;
|
|
7
|
+
export interface ChoiceOption {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare function choiceOptions(choices: readonly {
|
|
13
|
+
value: unknown;
|
|
14
|
+
label: string;
|
|
15
|
+
}[], stored: unknown): ChoiceOption[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type InspectedProperty } from '@cratis/scene.model';
|
|
2
|
-
import type { PropertyDescriptor as ControlDescriptor, PropertyGroup } from '@cratis/components/ConfigurationEditor';
|
|
3
|
-
export declare const isSimpleProperty: (property: InspectedProperty) => boolean;
|
|
4
2
|
export declare const isDrawnByItsOwnEditor: (typeId: string, path: string) => boolean;
|
|
5
|
-
export declare
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
export declare const editableProperties: (properties: readonly InspectedProperty[], typeId: string, isDrawnElsewhere?: (property: InspectedProperty) => boolean) => InspectedProperty[];
|
|
4
|
+
export interface PropertyGroup {
|
|
5
|
+
name: string;
|
|
6
|
+
properties: InspectedProperty[];
|
|
7
|
+
}
|
|
8
|
+
export declare function groupProperties(properties: readonly InspectedProperty[]): PropertyGroup[];
|