@cmdless/ui-runtime 0.0.4 → 0.0.5
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/README.md +13 -12
- package/out/main/bin.js +24 -41
- package/out/main/cleanup.js +20 -0
- package/out/main/host.js +79 -0
- package/out/main/hosting.js +448 -0
- package/out/{main/index.js → preload/index.cjs} +1522 -290
- package/out/renderer/assets/Card-BUDQ1UVY.js +15054 -0
- package/out/renderer/assets/Form-B5fhb-x2.css +1121 -0
- package/out/renderer/assets/Form-CE3B5mnl.js +26 -0
- package/out/renderer/assets/Mantine.context-oJEjRkJu.js +574 -0
- package/out/renderer/assets/MantineThemeProvider-DHX5fzKn.js +995 -0
- package/out/renderer/assets/SchemaInput-CACjraGT.js +69 -0
- package/out/renderer/assets/preload-helper-DVzrZ_Op.js +64 -0
- package/out/renderer/assets/use-media-query-d0EeyoH9.js +34 -0
- package/out/renderer/assets/validator-_xTzn1fv.js +31760 -0
- package/out/renderer/assets/view-Chm2p5Ws.js +20542 -0
- package/out/renderer/assets/view-DptMSuIE.css +10034 -0
- package/out/renderer/view.html +21 -0
- package/package.json +23 -6
- package/out/preload/index.mjs +0 -6
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports, a as reactExports, c as reportHeight } from "./Mantine.context-oJEjRkJu.js";
|
|
2
|
+
import { c as clientExports, M as MantineProvider } from "./view-Chm2p5Ws.js";
|
|
3
|
+
import { F as Form, v as validator } from "./validator-_xTzn1fv.js";
|
|
4
|
+
import { I as Input, G as GlobalRegistry } from "./Card-BUDQ1UVY.js";
|
|
5
|
+
import "./preload-helper-DVzrZ_Op.js";
|
|
6
|
+
import "./MantineThemeProvider-DHX5fzKn.js";
|
|
7
|
+
import "./use-media-query-d0EeyoH9.js";
|
|
8
|
+
function Drawn({ children }) {
|
|
9
|
+
reactExports.useLayoutEffect(reportHeight, []);
|
|
10
|
+
return children;
|
|
11
|
+
}
|
|
12
|
+
class SchemaInput extends Input {
|
|
13
|
+
static typeName = "Input.JsonSchema";
|
|
14
|
+
schema = { type: "object" };
|
|
15
|
+
uiSchema;
|
|
16
|
+
data;
|
|
17
|
+
form;
|
|
18
|
+
getJsonTypeName() {
|
|
19
|
+
return SchemaInput.typeName;
|
|
20
|
+
}
|
|
21
|
+
// schema, uiSchema and value are taken as they are: they're JSON
|
|
22
|
+
// themselves, not card properties
|
|
23
|
+
internalParse(source, context) {
|
|
24
|
+
super.internalParse(source, context);
|
|
25
|
+
if (source.schema && typeof source.schema === "object") this.schema = source.schema;
|
|
26
|
+
if (source.uiSchema && typeof source.uiSchema === "object") this.uiSchema = source.uiSchema;
|
|
27
|
+
this.data = source.value;
|
|
28
|
+
}
|
|
29
|
+
internalRender() {
|
|
30
|
+
const element = document.createElement("div");
|
|
31
|
+
element.className = "ac-jsonSchemaInput";
|
|
32
|
+
clientExports.createRoot(element).render(
|
|
33
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MantineProvider, { defaultColorScheme: "auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Drawn, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
34
|
+
Form,
|
|
35
|
+
{
|
|
36
|
+
ref: (form) => {
|
|
37
|
+
this.form = form;
|
|
38
|
+
},
|
|
39
|
+
schema: this.schema,
|
|
40
|
+
uiSchema: this.uiSchema,
|
|
41
|
+
formData: this.data,
|
|
42
|
+
validator,
|
|
43
|
+
showErrorList: false,
|
|
44
|
+
onChange: ({ formData }) => {
|
|
45
|
+
this.data = formData;
|
|
46
|
+
this.valueChanged();
|
|
47
|
+
},
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
|
|
49
|
+
}
|
|
50
|
+
) }) })
|
|
51
|
+
);
|
|
52
|
+
return element;
|
|
53
|
+
}
|
|
54
|
+
get value() {
|
|
55
|
+
return this.data;
|
|
56
|
+
}
|
|
57
|
+
isSet() {
|
|
58
|
+
return this.data !== void 0;
|
|
59
|
+
}
|
|
60
|
+
// validates through the form, so its errors show under its fields
|
|
61
|
+
isValid() {
|
|
62
|
+
if (this.form) return this.form.validateForm();
|
|
63
|
+
return Object.keys(validator.validateFormData(this.data, this.schema).errorSchema).length === 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
GlobalRegistry.elements.register(SchemaInput.typeName, SchemaInput);
|
|
67
|
+
export {
|
|
68
|
+
SchemaInput
|
|
69
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const scriptRel = /* @__PURE__ */ (function detectScriptRel() {
|
|
2
|
+
const relList = typeof document !== "undefined" && document.createElement("link").relList;
|
|
3
|
+
return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
|
|
4
|
+
})();
|
|
5
|
+
const assetsURL = function(dep, importerUrl) {
|
|
6
|
+
return new URL(dep, importerUrl).href;
|
|
7
|
+
};
|
|
8
|
+
const seen = {};
|
|
9
|
+
const __vitePreload = function preload(baseModule, deps, importerUrl) {
|
|
10
|
+
let promise = Promise.resolve();
|
|
11
|
+
if (deps && deps.length > 0) {
|
|
12
|
+
let allSettled = function(promises$2) {
|
|
13
|
+
return Promise.all(promises$2.map((p) => Promise.resolve(p).then((value$1) => ({
|
|
14
|
+
status: "fulfilled",
|
|
15
|
+
value: value$1
|
|
16
|
+
}), (reason) => ({
|
|
17
|
+
status: "rejected",
|
|
18
|
+
reason
|
|
19
|
+
}))));
|
|
20
|
+
};
|
|
21
|
+
const links = document.getElementsByTagName("link");
|
|
22
|
+
const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
|
|
23
|
+
const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
|
|
24
|
+
promise = allSettled(deps.map((dep) => {
|
|
25
|
+
dep = assetsURL(dep, importerUrl);
|
|
26
|
+
if (dep in seen) return;
|
|
27
|
+
seen[dep] = true;
|
|
28
|
+
const isCss = dep.endsWith(".css");
|
|
29
|
+
const cssSelector = isCss ? '[rel="stylesheet"]' : "";
|
|
30
|
+
if (!!importerUrl) for (let i$1 = links.length - 1; i$1 >= 0; i$1--) {
|
|
31
|
+
const link$1 = links[i$1];
|
|
32
|
+
if (link$1.href === dep && (!isCss || link$1.rel === "stylesheet")) return;
|
|
33
|
+
}
|
|
34
|
+
else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) return;
|
|
35
|
+
const link = document.createElement("link");
|
|
36
|
+
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
37
|
+
if (!isCss) link.as = "script";
|
|
38
|
+
link.crossOrigin = "";
|
|
39
|
+
link.href = dep;
|
|
40
|
+
if (cspNonce) link.setAttribute("nonce", cspNonce);
|
|
41
|
+
document.head.appendChild(link);
|
|
42
|
+
if (isCss) return new Promise((res, rej) => {
|
|
43
|
+
link.addEventListener("load", res);
|
|
44
|
+
link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
|
|
45
|
+
});
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function handlePreloadError(err$2) {
|
|
49
|
+
const e$1 = new Event("vite:preloadError", { cancelable: true });
|
|
50
|
+
e$1.payload = err$2;
|
|
51
|
+
window.dispatchEvent(e$1);
|
|
52
|
+
if (!e$1.defaultPrevented) throw err$2;
|
|
53
|
+
}
|
|
54
|
+
return promise.then((res) => {
|
|
55
|
+
for (const item of res || []) {
|
|
56
|
+
if (item.status !== "rejected") continue;
|
|
57
|
+
handlePreloadError(item.reason);
|
|
58
|
+
}
|
|
59
|
+
return baseModule().catch(handlePreloadError);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
__vitePreload as _
|
|
64
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as reactExports } from "./Mantine.context-oJEjRkJu.js";
|
|
2
|
+
const noop = () => {
|
|
3
|
+
};
|
|
4
|
+
function getInitialValue(query, initialValue) {
|
|
5
|
+
if (typeof window !== "undefined" && "matchMedia" in window) try {
|
|
6
|
+
return window.matchMedia(query).matches;
|
|
7
|
+
} catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function useMediaQuery(query, initialValue, { getInitialValueInEffect } = { getInitialValueInEffect: true }) {
|
|
13
|
+
const [matches, setMatches] = reactExports.useState(getInitialValueInEffect ? initialValue : getInitialValue(query));
|
|
14
|
+
reactExports.useEffect(() => {
|
|
15
|
+
try {
|
|
16
|
+
if ("matchMedia" in window) {
|
|
17
|
+
const mediaQuery = window.matchMedia(query);
|
|
18
|
+
setMatches(mediaQuery.matches);
|
|
19
|
+
const callback = (event) => setMatches(event.matches);
|
|
20
|
+
mediaQuery.addEventListener("change", callback);
|
|
21
|
+
return () => {
|
|
22
|
+
mediaQuery.removeEventListener("change", callback);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}, [query]);
|
|
29
|
+
return matches || false;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
noop as n,
|
|
33
|
+
useMediaQuery as u
|
|
34
|
+
};
|