@popcorn245/cornfield-components 0.52.1 → 0.54.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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/around-BcnegEdS.js +99 -0
  3. package/dist/chunks/connection-KDiWvV19.js +23 -0
  4. package/dist/chunks/{engine-BmXtSISH.js → engine-xmHJvQY9.js} +1188 -1186
  5. package/dist/chunks/{layers-Bj4Tluxe.js → layers-ho10a2y7.js} +48 -48
  6. package/dist/chunks/{map-BZRFOYkt.js → map-DbfPgQRe.js} +385 -385
  7. package/dist/chunks/node-panel-CC8UrSzJ.js +410 -0
  8. package/dist/chunks/panel-review-ih7RlfkH.js +884 -0
  9. package/dist/chunks/review-pieces-DtRxCDMr.js +2523 -0
  10. package/dist/chunks/{review-source-CK5tYIqk.js → review-source-CmbwaPCM.js} +1 -1
  11. package/dist/chunks/scope-2m2VmJXn.js +185 -0
  12. package/dist/chunks/scope-proposal-T06ndbin.js +116 -0
  13. package/dist/chunks/{sheets-D-sMZzSs.js → sheets-BWANwtZP.js} +7 -2
  14. package/dist/chunks/source-address-DXanAREm.js +57 -0
  15. package/dist/chunks/{status-DI5QLlAp.js → status-DM-iIEsg.js} +4 -3
  16. package/dist/corn-changes.js +43 -0
  17. package/dist/corn-decision.js +52 -0
  18. package/dist/corn-layers.js +275 -1
  19. package/dist/corn-map.js +125 -1
  20. package/dist/corn-node-panel.js +42 -1
  21. package/dist/corn-proposal.js +50 -0
  22. package/dist/corn-review.js +425 -1
  23. package/dist/corn-scope.js +33 -9
  24. package/dist/corn-search.js +484 -1
  25. package/dist/index.js +11 -8
  26. package/dist/manifest.json +95 -70
  27. package/dist/tokens.css +6 -0
  28. package/dist/types/components.d.ts +111 -5
  29. package/dist/types/corn-changes.d.ts +2 -0
  30. package/dist/types/corn-decision.d.ts +2 -0
  31. package/dist/types/corn-proposal.d.ts +2 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/version.json +1 -1
  34. package/package.json +17 -5
  35. package/dist/chunks/around-BFqYTZ0K.js +0 -78
  36. package/dist/chunks/corn-layers-Cni5rISZ.js +0 -275
  37. package/dist/chunks/corn-map-B2-YxiEL.js +0 -125
  38. package/dist/chunks/corn-node-panel-BkvJThlp.js +0 -42
  39. package/dist/chunks/corn-review-5wf7AT4o.js +0 -2900
  40. package/dist/chunks/corn-search-CXs5d06S.js +0 -484
  41. package/dist/chunks/node-panel-BdvFvWCE.js +0 -1291
  42. package/dist/chunks/scope-CqPbHcKL.js +0 -137
  43. package/dist/chunks/source-address-C70zNPIj.js +0 -79
@@ -1,137 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
- import { Bt as t, Gt as n, Ht as r, Mn as i, Vt as a } from "./engine-BmXtSISH.js";
3
- import { n as o, t as s } from "./status-DI5QLlAp.js";
4
- import { n as c } from "./source-address-C70zNPIj.js";
5
- import { o as l } from "./layers-Bj4Tluxe.js";
6
- // ../explorer/pieces/scope.js
7
- var u = /* @__PURE__ */ e({ mountScope: () => f }), d = [
8
- "light",
9
- "dark",
10
- "auto"
11
- ];
12
- function f(e, u = {}) {
13
- let f = {
14
- src: u.src,
15
- theme: u.theme,
16
- useTheme: !!u.useTheme,
17
- topology: u.topology,
18
- config: u.config,
19
- strings: u.strings
20
- }, m = u.pageUrl || (() => ""), h = /* @__PURE__ */ new Set(), g = null, _ = null, v = null, y = !1, b = !1, x = (e) => {
21
- if (b || !g || !e.detail || typeof e.detail.claim != "function") return;
22
- e.stopPropagation();
23
- let t = {
24
- el: e.detail.el,
25
- inst: g,
26
- scope: E,
27
- release: () => h.delete(t)
28
- };
29
- h.add(t), e.detail.claim(t);
30
- };
31
- e.addEventListener(a, x);
32
- function S() {
33
- let n = new Set(p(e));
34
- for (let e of [...h]) h.delete(e), e.el && n.add(e.el);
35
- for (let e of n) e.isConnected !== !1 && e.dispatchEvent(new Event(t));
36
- }
37
- function C() {
38
- v && v.follow();
39
- }
40
- function w() {
41
- let n = f.src === void 0 || f.src === null || f.src === "" ? null : c(f.src);
42
- g = i({
43
- root: e,
44
- base: n && n.ok ? n.base : ""
45
- }), l(g, null);
46
- let a = r(g);
47
- a.host = e, a.theme = d.includes(f.theme) ? f.theme : "auto";
48
- let p = g, h = o(g, {
49
- host: e,
50
- tokens: u.tokens,
51
- version: u.version,
52
- pageUrl: m,
53
- theme: () => d.includes(f.theme) ? f.theme : "auto",
54
- useTheme: () => f.useTheme,
55
- onReady: () => {
56
- !y && g === p && (y = !0, u.onReady && u.onReady());
57
- },
58
- onAuth: (e) => {
59
- u.onAuth && u.onAuth(e);
60
- },
61
- onError: (e) => {
62
- u.onError && u.onError(e);
63
- },
64
- onMode: () => p.emit("scope:theme")
65
- });
66
- v = h, a.serverTheme = h.theme, g.own(() => h.destroy()), _ = h.source, a.source = _, a.mountStatus = s, y = !1;
67
- let x = [];
68
- g.on("piece:refused", (e) => {
69
- e.host && !x.includes(e.host) && x.push(e.host), u.onError && u.onError({
70
- kind: e.reason,
71
- message: e.message
72
- });
73
- }), g.on("attach:released", () => {
74
- Promise.resolve().then(() => {
75
- if (!(b || g !== p)) for (; x.length;) {
76
- let e = x.shift();
77
- if (e.isConnected) {
78
- e.dispatchEvent(new Event(t));
79
- return;
80
- }
81
- }
82
- });
83
- }), n && !n.ok && _.say({
84
- state: "address",
85
- problem: n.problem
86
- }), _.provide({
87
- topology: f.topology || void 0,
88
- config: f.config || void 0,
89
- strings: f.strings || void 0
90
- }), n && n.ok && _.load();
91
- }
92
- function T() {
93
- S(), g && g.destroy(), g = null, _ = null, v = null;
94
- }
95
- let E = {
96
- update(e = {}) {
97
- if (b) return;
98
- let t = !1;
99
- if ("src" in e && e.src !== f.src && (f.src = e.src, t = !0), "theme" in e && e.theme !== f.theme && (f.theme = e.theme, r(g).theme = d.includes(f.theme) ? f.theme : "auto", C()), "useTheme" in e && !!e.useTheme !== f.useTheme && (f.useTheme = !!e.useTheme, v.setUseTheme(f.useTheme)), t) {
100
- let e = g;
101
- v.destroy(), w(), S(), e.destroy();
102
- return;
103
- }
104
- let n = {};
105
- for (let t of [
106
- "topology",
107
- "config",
108
- "strings"
109
- ]) t in e && e[t] !== f[t] && (f[t] = e[t], n[t] = e[t] === void 0 ? null : e[t]);
110
- Object.keys(n).length && _.provide(n);
111
- },
112
- destroy() {
113
- b || (e.removeEventListener(a, x), T(), b = !0, h.clear());
114
- },
115
- get instance() {
116
- return g;
117
- },
118
- get source() {
119
- return _;
120
- }
121
- };
122
- return u.tokens && n(e.getRootNode(), u.tokens), w(), S(), E;
123
- }
124
- function p(e) {
125
- let t = [], n = (e) => {
126
- for (let r of e.children || []) {
127
- let e = r.localName || "";
128
- if (e.startsWith("corn-")) {
129
- if (e === "corn-scope") continue;
130
- t.push(r);
131
- }
132
- r.shadowRoot && n(r.shadowRoot), n(r);
133
- }
134
- };
135
- return n(e), t;
136
- }
137
- export { u as n, f as t };
@@ -1,79 +0,0 @@
1
- // ../explorer/engine/connection.js
2
- function e(e, t) {
3
- 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.`;
4
- }
5
- function t(e) {
6
- return (t, r) => e.fetch(t, n(e, t, r));
7
- }
8
- function n(e, t, n) {
9
- return e.base && r(e, t) ? {
10
- credentials: "include",
11
- redirect: "error",
12
- ...n
13
- } : n;
14
- }
15
- function r(e, t) {
16
- if (!e.base) return !1;
17
- try {
18
- return new URL(e.url(String(t)), e.base).origin === new URL(e.base).origin;
19
- } catch {
20
- return !1;
21
- }
22
- }
23
- // ../explorer/engine/source-address.js
24
- var i = /[\u0000- \u007f\\]/;
25
- function a(e) {
26
- if (typeof e != "string" || !e.trim()) return {
27
- ok: !1,
28
- problem: "is empty"
29
- };
30
- let t = e.trim();
31
- if (i.test(t)) return {
32
- ok: !1,
33
- problem: "has a space, a control character or a backslash"
34
- };
35
- let n;
36
- try {
37
- n = new URL(t);
38
- } catch {
39
- return {
40
- ok: !1,
41
- problem: "is not an address (an http or https address, as the server is opened in a browser)"
42
- };
43
- }
44
- return n.protocol !== "https:" && n.protocol !== "http:" ? {
45
- ok: !1,
46
- problem: "is not http or https"
47
- } : /^https?:\/\/[^/?#]/i.test(t) ? n.username || n.password ? {
48
- ok: !1,
49
- problem: "has a user name or password"
50
- } : t.includes("?") || t.includes("#") ? {
51
- ok: !1,
52
- problem: "has a query or a fragment"
53
- } : {
54
- ok: !0,
55
- base: n.origin + n.pathname.replace(/\/+$/, ""),
56
- origin: n.origin
57
- } : {
58
- ok: !1,
59
- problem: "has no host"
60
- };
61
- }
62
- function o(e, t) {
63
- let n = "";
64
- if (typeof t == "string" && /^https?:\/\//i.test(t)) try {
65
- let e = new URL(t);
66
- e.username = "", e.password = "", n = `?returnTo=${encodeURIComponent(e.href)}`;
67
- } catch {
68
- n = "";
69
- }
70
- return `${e}/auth/start${n}`;
71
- }
72
- function s(e) {
73
- try {
74
- return /^https?:/i.test(e) ? new URL(e).origin : "";
75
- } catch {
76
- return "";
77
- }
78
- }
79
- export { e as a, t as i, a as n, n as o, o as r, s as t };