@popcorn245/cornfield-components 0.51.8 → 0.52.1
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 +1 -1
- package/dist/chunks/around-BFqYTZ0K.js +78 -0
- package/dist/chunks/corn-layers-Cni5rISZ.js +275 -0
- package/dist/chunks/{corn-map-M7xt4MYk.js → corn-map-B2-YxiEL.js} +8 -5
- package/dist/chunks/corn-node-panel-BkvJThlp.js +42 -0
- package/dist/chunks/{corn-review-yQU3IpY5.js → corn-review-5wf7AT4o.js} +1047 -2564
- package/dist/chunks/corn-search-CXs5d06S.js +484 -0
- package/dist/chunks/{engine-ClfnAsgM.js → engine-BmXtSISH.js} +3691 -3577
- package/dist/chunks/layers-Bj4Tluxe.js +191 -0
- package/dist/chunks/{map-LS9aQk6z.js → map-BZRFOYkt.js} +803 -751
- package/dist/chunks/node-panel-BdvFvWCE.js +1291 -0
- package/dist/chunks/{review-source-CPiFTfyc.js → review-source-CK5tYIqk.js} +1 -1
- package/dist/chunks/{scope-Dg_uzefP.js → scope-CqPbHcKL.js} +24 -23
- package/dist/chunks/sheets-D-sMZzSs.js +204 -0
- package/dist/chunks/source-address-C70zNPIj.js +79 -0
- package/dist/chunks/{status-CYQD5PwL.js → status-DI5QLlAp.js} +78 -77
- package/dist/corn-layers.js +1 -0
- package/dist/corn-map.js +1 -1
- package/dist/corn-node-panel.js +1 -0
- package/dist/corn-review.js +1 -1
- package/dist/corn-scope.js +3 -3
- package/dist/corn-search.js +1 -0
- package/dist/index.js +8 -5
- package/dist/manifest.json +101 -36
- package/dist/tokens.css +8 -2
- package/dist/types/components.d.ts +90 -0
- package/dist/types/corn-layers.d.ts +2 -0
- package/dist/types/corn-node-panel.d.ts +2 -0
- package/dist/types/corn-search.d.ts +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/version.json +1 -1
- package/package.json +14 -2
- package/dist/chunks/source-address-B7hYRgt8.js +0 -251
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { B as e, Bt as t, Ft as n, Lt as r, Pt as i, R as a, Rt as o, Zt as s, _t as c, et as l, jt as u, kt as d, nt as f, p, zt as m } from "./engine-ClfnAsgM.js";
|
|
2
|
-
// ../explorer/engine/layers.js
|
|
3
|
-
var h = (e) => e.match && e.match.type ? [].concat(e.match.type) : [], g = {
|
|
4
|
-
flow: "#fb923c",
|
|
5
|
-
runs: "#5eead4"
|
|
6
|
-
}, _ = (e) => {
|
|
7
|
-
let t = h(e)[0];
|
|
8
|
-
return t && s[t] ? s[t].color : g[e.key];
|
|
9
|
-
}, v = /* @__PURE__ */ new Set([
|
|
10
|
-
"stack",
|
|
11
|
-
"machine",
|
|
12
|
-
"container",
|
|
13
|
-
"device",
|
|
14
|
-
"house",
|
|
15
|
-
"persona"
|
|
16
|
-
]), y = r.map((e) => ({
|
|
17
|
-
...e,
|
|
18
|
-
color: _(e)
|
|
19
|
-
})), b = "cornfield:layers", x = /^[a-z][a-z0-9-]{0,40}$/, S = (e) => e.slot("layers", () => ({
|
|
20
|
-
changes: {},
|
|
21
|
-
storeKey: b
|
|
22
|
-
}));
|
|
23
|
-
function C(e, t) {
|
|
24
|
-
S(e).storeKey = t;
|
|
25
|
-
}
|
|
26
|
-
var w = (e, t) => Object.hasOwn(e.state.layerDefaults, t) ? e.state.layerDefaults[t] : !v.has(t), T = (e, t) => u(e.state, t), E = "#94a3b8", D = "\\d{1,3}(?:\\.\\d+)?%?", O = RegExp(`^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\\(\\s*${D}(?:\\s*,\\s*|\\s+)${D}(?:\\s*,\\s*|\\s+)${D}(?:\\s*[,/]\\s*(?:\\d*\\.)?\\d+%?)?\\s*\\))$`, "i"), k = (e) => typeof e == "string" && e.length <= 64 && O.test(e.trim()) ? e.trim() : E;
|
|
27
|
-
function A(t, n, r) {
|
|
28
|
-
return k(a(e(t).get().values, n) || c(d(r, t.state.theme)));
|
|
29
|
-
}
|
|
30
|
-
var j = (e, t) => {
|
|
31
|
-
let n = h(t);
|
|
32
|
-
return n.length > 1 && n.find((t) => e.state.nodes.some((e) => e.type === t)) || n[0] || t.key;
|
|
33
|
-
};
|
|
34
|
-
function M(e) {
|
|
35
|
-
let { state: r } = e, i = (t) => {
|
|
36
|
-
let n = j(e, t);
|
|
37
|
-
return {
|
|
38
|
-
...t,
|
|
39
|
-
color: A(e, {
|
|
40
|
-
type: n,
|
|
41
|
-
group: t.key
|
|
42
|
-
}, s[n] ? s[n].color : t.color)
|
|
43
|
-
};
|
|
44
|
-
}, a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
45
|
-
r.nodes.forEach((e) => {
|
|
46
|
-
let i = n(r, e);
|
|
47
|
-
if (!i) return;
|
|
48
|
-
a.add(i);
|
|
49
|
-
let s = t(e);
|
|
50
|
-
s !== i && o.add(s);
|
|
51
|
-
});
|
|
52
|
-
let c = (t) => {
|
|
53
|
-
let i = r.nodes.find((e) => n(r, e) === t.key);
|
|
54
|
-
return { color: A(e, i ? {
|
|
55
|
-
type: i.type,
|
|
56
|
-
layer: t.key,
|
|
57
|
-
group: f(i)
|
|
58
|
-
} : {
|
|
59
|
-
type: t.key,
|
|
60
|
-
layer: t.key
|
|
61
|
-
}, i ? l(i) : E) };
|
|
62
|
-
}, u = r.projectLayers.filter((e) => a.has(e.key)).map((e) => ({
|
|
63
|
-
key: e.key,
|
|
64
|
-
label: e.label,
|
|
65
|
-
desc: e.desc || "",
|
|
66
|
-
project: !0,
|
|
67
|
-
...c(e)
|
|
68
|
-
})), d = y.filter((e) => !e.overlay && (a.has(e.key) || !o.has(e.key))).map(i), p = /* @__PURE__ */ new Set([...y.map((e) => e.key), ...r.projectLayers.map((e) => e.key)]), h = [];
|
|
69
|
-
return a.forEach((t) => {
|
|
70
|
-
p.has(t) || (p.add(t), h.push({
|
|
71
|
-
key: t,
|
|
72
|
-
label: t.charAt(0).toUpperCase() + t.slice(1),
|
|
73
|
-
color: A(e, {
|
|
74
|
-
type: t,
|
|
75
|
-
group: t
|
|
76
|
-
}, E),
|
|
77
|
-
desc: `Nodes of the type ${t}`
|
|
78
|
-
}));
|
|
79
|
-
}), {
|
|
80
|
-
layers: [...m(u, d, r.layerOrder), ...h],
|
|
81
|
-
overlays: y.filter((e) => e.overlay).map(i)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function N(e) {
|
|
85
|
-
let t = S(e).storeKey;
|
|
86
|
-
if (!t) return {};
|
|
87
|
-
try {
|
|
88
|
-
let n = JSON.parse(e.store.get(t) || "{}");
|
|
89
|
-
return !n || typeof n != "object" || Array.isArray(n) ? {} : Object.fromEntries(Object.entries(n).filter(([e, t]) => x.test(e) && typeof t == "boolean"));
|
|
90
|
-
} catch {
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function P(e) {
|
|
95
|
-
let { changes: t, storeKey: n } = S(e);
|
|
96
|
-
n && (Object.keys(t).length ? e.store.set(n, JSON.stringify(t)) : e.store.remove(n));
|
|
97
|
-
}
|
|
98
|
-
function F(e, t, n) {
|
|
99
|
-
let { changes: r } = S(e);
|
|
100
|
-
n === w(e, t) ? delete r[t] : r[t] = n;
|
|
101
|
-
}
|
|
102
|
-
function I(e, t) {
|
|
103
|
-
let { state: n } = e, r = o(t);
|
|
104
|
-
n.projectLayers = r.add, n.layerOrder = r.order;
|
|
105
|
-
let i = {};
|
|
106
|
-
for (let e of y) i[e.key] = !v.has(e.key);
|
|
107
|
-
for (let e of r.add) i[e.key] = !0;
|
|
108
|
-
for (let e of r.off) i[e] = !1;
|
|
109
|
-
n.layerDefaults = i;
|
|
110
|
-
let a = S(e);
|
|
111
|
-
a.changes = N(e);
|
|
112
|
-
for (let [e, t] of Object.entries(i)) n.activeLayers[e] = t;
|
|
113
|
-
for (let [e, t] of Object.entries(a.changes)) n.activeLayers[e] = t;
|
|
114
|
-
B(e);
|
|
115
|
-
}
|
|
116
|
-
function L(t) {
|
|
117
|
-
let { state: n } = t, r = /* @__PURE__ */ new Set(), i = [];
|
|
118
|
-
n.nodes.forEach((e) => {
|
|
119
|
-
if (typeof e.kind != "string" || !e.kind) return;
|
|
120
|
-
let t = `${e.type}\u0000${e.kind}`;
|
|
121
|
-
r.has(t) || (r.add(t), i.push([e.type, e.kind]));
|
|
122
|
-
}), e(t).setSubjects({
|
|
123
|
-
kinds: i,
|
|
124
|
-
layers: n.projectLayers.map((e) => e.key)
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
function R(e) {
|
|
128
|
-
let t = e.slot("layers-draw", () => ({ drawing: !1 }));
|
|
129
|
-
t.drawing = !0;
|
|
130
|
-
try {
|
|
131
|
-
L(e);
|
|
132
|
-
} finally {
|
|
133
|
-
t.drawing = !1;
|
|
134
|
-
}
|
|
135
|
-
e.emit("layers:redraw");
|
|
136
|
-
}
|
|
137
|
-
var z = (e, t) => e.on("layers", t);
|
|
138
|
-
function B(e) {
|
|
139
|
-
e.touchScene(), e.emit("layers"), R(e), e.map && (e.map.render(), e.map.ensureFlowLoop());
|
|
140
|
-
}
|
|
141
|
-
function V(e, t, n, { viewer: r = !1, scenario: i = !1 } = {}) {
|
|
142
|
-
let { state: a } = e, o = a.review && a.proposal ? a.review : null;
|
|
143
|
-
if (o ? ((i ? o.step : o.manual)[t] = n, o.rev++) : (a.activeLayers[t] = n, r && (F(e, t, n), P(e))), B(e), r) {
|
|
144
|
-
let { layers: r, overlays: i } = M(e), s = [...r, ...i].find((e) => e.key === t), c = a.nodes.filter((t) => e.map.isNodeVisible(t)).length;
|
|
145
|
-
p(e, `${s ? s.label : t} ${n ? "on" : "off"}${o ? " for this review" : ""}. ${c} ${c === 1 ? "node" : "nodes"} shown.`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function H(e) {
|
|
149
|
-
e.state.review = {
|
|
150
|
-
whole: !1,
|
|
151
|
-
manual: {},
|
|
152
|
-
step: {},
|
|
153
|
-
rev: 0
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function U(e) {
|
|
157
|
-
e.state.review && (e.state.review = null, e.touchScene(), R(e));
|
|
158
|
-
}
|
|
159
|
-
function W(e) {
|
|
160
|
-
let { state: t } = e;
|
|
161
|
-
if (!t.review || !t.proposal || t.review.whole) return "";
|
|
162
|
-
let { layers: r } = M(e), a = new Set(t.nodes.map((e) => n(t, e)));
|
|
163
|
-
return r.some((e) => a.has(e.key) && i(t, e.key)) ? `Showing ${r.filter((t) => T(e, t.key)).length} of ${r.length} layers: the ones this proposal changes.` : "";
|
|
164
|
-
}
|
|
165
|
-
function G(e, t) {
|
|
166
|
-
let { state: n } = e, r = n.review && n.proposal ? n.review : null;
|
|
167
|
-
r && r.whole !== t && (r.whole = t, r.rev++, B(e), p(e, t ? "Showing the whole map." : W(e) || "Showing the change: the rest of the map is greyed."));
|
|
168
|
-
}
|
|
169
|
-
function K(e) {
|
|
170
|
-
let { review: t } = e.state;
|
|
171
|
-
return !t || !Object.keys(t.step).length ? !1 : (t.step = {}, t.rev++, e.touchScene(), R(e), !0);
|
|
172
|
-
}
|
|
173
|
-
// ../explorer/engine/connection.js
|
|
174
|
-
function q(e, t) {
|
|
175
|
-
return e.offline() ? `You are offline. ${t} was not sent; what you typed is kept. Try again when you are back.` : `cornfield did not answer. ${t} was not sent; what you typed is kept.`;
|
|
176
|
-
}
|
|
177
|
-
function J(e) {
|
|
178
|
-
return (t, n) => e.fetch(t, Y(e, t, n));
|
|
179
|
-
}
|
|
180
|
-
function Y(e, t, n) {
|
|
181
|
-
return e.base && X(e, t) ? {
|
|
182
|
-
credentials: "include",
|
|
183
|
-
redirect: "error",
|
|
184
|
-
...n
|
|
185
|
-
} : n;
|
|
186
|
-
}
|
|
187
|
-
function X(e, t) {
|
|
188
|
-
if (!e.base) return !1;
|
|
189
|
-
try {
|
|
190
|
-
return new URL(e.url(String(t)), e.base).origin === new URL(e.base).origin;
|
|
191
|
-
} catch {
|
|
192
|
-
return !1;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
// ../explorer/engine/source-address.js
|
|
196
|
-
var Z = "/auth/start", Q = /[\u0000- \u007f\\]/;
|
|
197
|
-
function $(e) {
|
|
198
|
-
if (typeof e != "string" || !e.trim()) return {
|
|
199
|
-
ok: !1,
|
|
200
|
-
problem: "is empty"
|
|
201
|
-
};
|
|
202
|
-
let t = e.trim();
|
|
203
|
-
if (Q.test(t)) return {
|
|
204
|
-
ok: !1,
|
|
205
|
-
problem: "has a space, a control character or a backslash"
|
|
206
|
-
};
|
|
207
|
-
let n;
|
|
208
|
-
try {
|
|
209
|
-
n = new URL(t);
|
|
210
|
-
} catch {
|
|
211
|
-
return {
|
|
212
|
-
ok: !1,
|
|
213
|
-
problem: "is not an address (an http or https address, as the server is opened in a browser)"
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
return n.protocol !== "https:" && n.protocol !== "http:" ? {
|
|
217
|
-
ok: !1,
|
|
218
|
-
problem: "is not http or https"
|
|
219
|
-
} : /^https?:\/\/[^/?#]/i.test(t) ? n.username || n.password ? {
|
|
220
|
-
ok: !1,
|
|
221
|
-
problem: "has a user name or password"
|
|
222
|
-
} : t.includes("?") || t.includes("#") ? {
|
|
223
|
-
ok: !1,
|
|
224
|
-
problem: "has a query or a fragment"
|
|
225
|
-
} : {
|
|
226
|
-
ok: !0,
|
|
227
|
-
base: n.origin + n.pathname.replace(/\/+$/, ""),
|
|
228
|
-
origin: n.origin
|
|
229
|
-
} : {
|
|
230
|
-
ok: !1,
|
|
231
|
-
problem: "has no host"
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function ee(e, t) {
|
|
235
|
-
let n = "";
|
|
236
|
-
if (typeof t == "string" && /^https?:\/\//i.test(t)) try {
|
|
237
|
-
let e = new URL(t);
|
|
238
|
-
e.username = "", e.password = "", n = `?returnTo=${encodeURIComponent(e.href)}`;
|
|
239
|
-
} catch {
|
|
240
|
-
n = "";
|
|
241
|
-
}
|
|
242
|
-
return `${e}${Z}${n}`;
|
|
243
|
-
}
|
|
244
|
-
function te(e) {
|
|
245
|
-
try {
|
|
246
|
-
return /^https?:/i.test(e) ? new URL(e).origin : "";
|
|
247
|
-
} catch {
|
|
248
|
-
return "";
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
export { G as _, q as a, H as c, C as d, z as f, I as g, V as h, J as i, K as l, W as m, $ as n, Y as o, R as p, ee as r, y as s, te as t, U as u };
|