@popcorn245/cornfield-components 0.52.0 → 0.53.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/README.md +1 -1
- package/dist/chunks/around-BcnegEdS.js +99 -0
- package/dist/chunks/connection-KDiWvV19.js +23 -0
- package/dist/chunks/{engine-HIgX35hE.js → engine-xmHJvQY9.js} +1360 -1343
- package/dist/chunks/{layers-n1mJVJs8.js → layers-ho10a2y7.js} +68 -68
- package/dist/chunks/{map-CeP9M2_w.js → map-DbfPgQRe.js} +736 -705
- package/dist/chunks/node-panel-CC8UrSzJ.js +410 -0
- package/dist/chunks/panel-review-ih7RlfkH.js +884 -0
- package/dist/chunks/review-pieces-DtRxCDMr.js +2523 -0
- package/dist/chunks/{review-source-DWisOXyR.js → review-source-CmbwaPCM.js} +1 -1
- package/dist/chunks/scope-2m2VmJXn.js +185 -0
- package/dist/chunks/scope-proposal-T06ndbin.js +116 -0
- package/dist/chunks/sheets-BWANwtZP.js +209 -0
- package/dist/chunks/source-address-DXanAREm.js +57 -0
- package/dist/chunks/{status-CsFpnQxw.js → status-DM-iIEsg.js} +57 -56
- package/dist/corn-changes.js +43 -0
- package/dist/corn-decision.js +52 -0
- package/dist/corn-layers.js +275 -1
- package/dist/corn-map.js +125 -1
- package/dist/corn-node-panel.js +42 -1
- package/dist/corn-proposal.js +50 -0
- package/dist/corn-review.js +425 -1
- package/dist/corn-scope.js +33 -9
- package/dist/corn-search.js +484 -1
- package/dist/index.js +11 -8
- package/dist/manifest.json +95 -70
- package/dist/tokens.css +6 -0
- package/dist/types/components.d.ts +111 -5
- package/dist/types/corn-changes.d.ts +2 -0
- package/dist/types/corn-decision.d.ts +2 -0
- package/dist/types/corn-proposal.d.ts +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/version.json +1 -1
- package/package.json +17 -5
- package/dist/chunks/around-D7aqHejs.js +0 -78
- package/dist/chunks/corn-layers-g9AprK6G.js +0 -275
- package/dist/chunks/corn-map-DE-pg-A0.js +0 -125
- package/dist/chunks/corn-node-panel-CdtFb9IZ.js +0 -42
- package/dist/chunks/corn-review-9krtLSPK.js +0 -2900
- package/dist/chunks/corn-search-BY1Po63S.js +0 -484
- package/dist/chunks/node-panel-CY5xnuKC.js +0 -1291
- package/dist/chunks/scope-CUhp8mkf.js +0 -137
- package/dist/chunks/sheets-TFCL_dIn.js +0 -204
- package/dist/chunks/source-address-C70zNPIj.js +0 -79
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
+
import { Dn as t, En as n, Jt as r, Kt as i, Tn as a, an as o, dn as s, fn as c, in as l, jn as u, kt as d, nn as f, on as p, qt as m, rn as h, sn as g } from "./engine-xmHJvQY9.js";
|
|
3
|
+
import { D as _, F as v, I as ee, L as y, a as te, b, f as x, g as S, i as C, l as ne, t as w } from "./panel-review-ih7RlfkH.js";
|
|
4
|
+
import { a as re, c as ie, d as ae, i as oe, n as se, o as T, u as E } from "./sheets-BWANwtZP.js";
|
|
5
|
+
// ../explorer/engine/flow-ui.js
|
|
6
|
+
function ce(e, t) {
|
|
7
|
+
let { state: n } = e, r = (e) => (n.nodes.find((t) => t.id === e) || { label: e }).label, a = n.edges.filter((e) => e.kind === "flow" && (e.from === t.id || e.to === t.id)), o = (e, t, n) => t.length ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">${e}</div><div class="hx-fact-v">${C(t.map((e) => `<div class="hx-line"><span><span class="hx-name">${i(r(n ? e.to : e.from))}</span> · ${i(e.label)}${e.status === "live" ? "" : " <span class=\"hx-warn\">(proposed)</span>"}</span></div>`))}</div></div>` : "";
|
|
8
|
+
return o("Sends to", a.filter((e) => e.from === t.id), !0) + o("Gets from", a.filter((e) => e.to === t.id && e.from !== t.id), !1);
|
|
9
|
+
}
|
|
10
|
+
// ../explorer/mockups-model.js
|
|
11
|
+
var D = {
|
|
12
|
+
approved: "Reviewed",
|
|
13
|
+
changed: "Changed since you approved",
|
|
14
|
+
unreviewed: "Not reviewed yet",
|
|
15
|
+
missing: "File not found"
|
|
16
|
+
}, O = (e) => D[e] || D.unreviewed, k = (e) => /\.html$/i.test(String(e)) ? "page" : "image";
|
|
17
|
+
function A(e, t, n) {
|
|
18
|
+
return `/proposals/${encodeURIComponent(e)}/mockups/${n}${t ? `?source=${encodeURIComponent(t)}` : ""}`;
|
|
19
|
+
}
|
|
20
|
+
function j(e, t, n, r, i = {}) {
|
|
21
|
+
return !e || !t ? [] : x(e).filter((e) => e.node === r).map((e) => ({
|
|
22
|
+
...e,
|
|
23
|
+
type: k(e.path),
|
|
24
|
+
url: A(t, n, e.index),
|
|
25
|
+
state: i[e.index] || "unreviewed"
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function M(e) {
|
|
29
|
+
if (!e.length) return "";
|
|
30
|
+
let t = e.map((e) => `<li class="hx-mockup-item" data-corn="row">
|
|
31
|
+
<button data-corn-kind="secondary" type="button" class="hx-btn hx-mockup-open" data-mockup="${e.index}" aria-haspopup="dialog">${i(e.title)}<span class="hx-sr-only"> (${e.type === "page" ? "page" : "image"}, opens in a window)</span></button>
|
|
32
|
+
<span class="hx-mockup-state hx-mockup-state--${i(e.state)}" data-corn="state-pill"${v(e.state)}>${i(O(e.state))}</span>
|
|
33
|
+
</li>`).join("");
|
|
34
|
+
return `<div class="hx-sec hx-mockups" data-mockups data-corn="section">
|
|
35
|
+
<h3 class="hx-sec-title" id="hx-mockups-h">${e.length === 1 ? "Mockup" : "Mockups"}</h3>
|
|
36
|
+
<ul class="hx-mockup-list" aria-labelledby="hx-mockups-h">${t}</ul>
|
|
37
|
+
</div>`;
|
|
38
|
+
}
|
|
39
|
+
function le(e, t) {
|
|
40
|
+
return M(j(e.proposal, e.proposalSlug, e.proposalSource, t, e.mockupStates || {}));
|
|
41
|
+
}
|
|
42
|
+
// ../explorer/file-url.js
|
|
43
|
+
var N = {
|
|
44
|
+
github: "blob",
|
|
45
|
+
forgejo: "src/branch"
|
|
46
|
+
};
|
|
47
|
+
function P(e) {
|
|
48
|
+
if (typeof e != "string" || !e || /[\\\u0000-\u001f\u007f]/.test(e) || e.startsWith("/") || /^[A-Za-z][A-Za-z0-9+.-]*:/.test(e)) return null;
|
|
49
|
+
let t = e.split("/");
|
|
50
|
+
return t.every((e) => e && e !== "." && e !== "..") ? t : null;
|
|
51
|
+
}
|
|
52
|
+
function ue(e, t, n) {
|
|
53
|
+
let r = e && Object.hasOwn(N, e.type) && N[e.type], i = P(t), a = P(n || "HEAD"), o = P(e && e.repo);
|
|
54
|
+
if (!r || !i || !a || !o || o.length !== 2) return null;
|
|
55
|
+
try {
|
|
56
|
+
let t = new URL(e.url);
|
|
57
|
+
if (t.protocol !== "https:" || t.username || t.password || String(e.url).includes("\\")) return null;
|
|
58
|
+
let n = (e) => e.map(encodeURIComponent).join("/");
|
|
59
|
+
return t.pathname = `${t.pathname.replace(/\/+$/, "")}/${n(o)}/${r}/${n(a)}/${n(i)}`, t.search = "", t.hash = "", t.href;
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// ../explorer/engine/feedback.js
|
|
65
|
+
var F = 6e3, I = (e) => e.slot("feedback", () => /* @__PURE__ */ new Map());
|
|
66
|
+
function L(e, t, n, r = !0) {
|
|
67
|
+
I(e).set(t, {
|
|
68
|
+
text: n,
|
|
69
|
+
ok: r
|
|
70
|
+
}), m(e, n);
|
|
71
|
+
}
|
|
72
|
+
function R(e, t) {
|
|
73
|
+
I(e).delete(t);
|
|
74
|
+
}
|
|
75
|
+
function z(e, t, n) {
|
|
76
|
+
if (!t) return;
|
|
77
|
+
let r = I(e).get(n);
|
|
78
|
+
t.hidden = !r, t.textContent = r ? r.text : "", r ? t.dataset.cornState = r.ok ? "success" : "failure" : delete t.dataset.cornState;
|
|
79
|
+
}
|
|
80
|
+
// ../explorer/selection-words.js
|
|
81
|
+
var B = [
|
|
82
|
+
"ownership",
|
|
83
|
+
"usage",
|
|
84
|
+
"flow",
|
|
85
|
+
"reads",
|
|
86
|
+
"writes",
|
|
87
|
+
"calls",
|
|
88
|
+
"triggers",
|
|
89
|
+
"delivers",
|
|
90
|
+
"runs-on",
|
|
91
|
+
"uses",
|
|
92
|
+
"extends"
|
|
93
|
+
], V = (e) => Object.hasOwn(o, e) ? o[e].panel : String(e);
|
|
94
|
+
function de(e) {
|
|
95
|
+
let t = (e) => {
|
|
96
|
+
let t = B.indexOf(e);
|
|
97
|
+
return t < 0 ? B.length : t;
|
|
98
|
+
};
|
|
99
|
+
return [...e.kinds.entries()].sort((e, n) => t(e[0]) - t(n[0]) || (e[0] < n[0] ? -1 : +(e[0] > n[0]))).map(([e, t]) => ({
|
|
100
|
+
kind: e,
|
|
101
|
+
count: t,
|
|
102
|
+
word: V(e)
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
function fe(e, t) {
|
|
106
|
+
let n = [], r = /* @__PURE__ */ new Set();
|
|
107
|
+
for (let i of e.edges) {
|
|
108
|
+
if (g(i) !== t) continue;
|
|
109
|
+
let a = i.from === e.selectedId, o = a ? i.to : i.from;
|
|
110
|
+
r.has(o) || (r.add(o), n.push({
|
|
111
|
+
id: o,
|
|
112
|
+
out: a
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
return n;
|
|
116
|
+
}
|
|
117
|
+
function H(e, t) {
|
|
118
|
+
return t > 0 ? `${e} connected · ${t} off screen` : `${e} connected · all on screen`;
|
|
119
|
+
}
|
|
120
|
+
// ../explorer/pieces/node-panel.js
|
|
121
|
+
var U = /* @__PURE__ */ e({
|
|
122
|
+
LINES_CAP: () => 12,
|
|
123
|
+
copySpec: () => Q,
|
|
124
|
+
diffPillWords: () => Y,
|
|
125
|
+
markup: () => X,
|
|
126
|
+
mount: () => $
|
|
127
|
+
}), W = (e) => `<code class="hx-code">${i(e)}</code>`, G = (e) => `<div class="hx-line">${e}</div>`, K = {
|
|
128
|
+
"Uses design tokens": "Tokens",
|
|
129
|
+
"Loaded by the server per request": "Loaded by",
|
|
130
|
+
"Domains served (Caddyfile → service)": "Domains",
|
|
131
|
+
"Compose file": "File",
|
|
132
|
+
"Baked pages": "Baked",
|
|
133
|
+
"Reads tables": "Reads",
|
|
134
|
+
"Writes tables": "Writes",
|
|
135
|
+
"Self-hosted": "Role",
|
|
136
|
+
"Pushes to (webhook)": "Pushes to",
|
|
137
|
+
"Calls outside": "Calls",
|
|
138
|
+
"Client modules": "Modules",
|
|
139
|
+
"Data flows": "Flows"
|
|
140
|
+
}, pe = /^(?:Defines )?\d+ (?:CSS )?(variable|service)\(s\)$/, me = (e) => {
|
|
141
|
+
let t = e.replace(/:$/, ""), n = pe.exec(t);
|
|
142
|
+
return n ? n[1] === "service" ? "Services" : t.startsWith("Defines") ? "Defines" : "Variables" : K[t] || t;
|
|
143
|
+
}, q = (e, t) => t.length ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">${i(me(e))}</div><div class="hx-fact-v">${C(t)}</div></div>` : "", J = (e) => `<div class="hx-chips">${C(e.map((e) => `<code class="hx-var">${i(e)}</code>`))}</div>`;
|
|
144
|
+
function he(e) {
|
|
145
|
+
if (e.type === "external" && e.kind) return e.kind === "web" ? "Public web" : "Cloud";
|
|
146
|
+
let t = e.type.charAt(0).toUpperCase() + e.type.slice(1);
|
|
147
|
+
return typeof e.kind == "string" && e.kind ? `${t} · ${e.kind}` : t;
|
|
148
|
+
}
|
|
149
|
+
function ge(e) {
|
|
150
|
+
if (e.url) try {
|
|
151
|
+
return new URL(e.url).host;
|
|
152
|
+
} catch {}
|
|
153
|
+
return e.host || "";
|
|
154
|
+
}
|
|
155
|
+
function Y(e, t) {
|
|
156
|
+
let n = e && e.mark;
|
|
157
|
+
if (!n || n === "none") return "";
|
|
158
|
+
if (n === "edit") return `${e.editOp === "removed" ? "Removed" : "Added"} by your edit`;
|
|
159
|
+
let r = t && typeof t.title == "string" ? t.title : "";
|
|
160
|
+
return r ? `${S[n] || n} by ${r}` : `${S[n] || n} by this proposal`;
|
|
161
|
+
}
|
|
162
|
+
var X = () => ({
|
|
163
|
+
drawer: "<aside id=\"spec-drawer\" class=\"hx-drawer glass\" aria-label=\"Node details\" inert data-corn=\"node-panel\"><div class=\"hx-drawer-body\"><div class=\"hx-drawer-head\"><div class=\"hx-drawer-id\"><p class=\"hx-kicker\"><span id=\"drawer-badge\" data-corn=\"badge\">Atom</span><span id=\"drawer-host\" data-corn=\"node-host\"></span><span id=\"drawer-diff\" class=\"hx-diffpill\" data-corn=\"diff-pill\" hidden></span></p><h2 id=\"drawer-title\" class=\"hx-drawer-title\" data-corn=\"node-title\"><pop-button></h2></div><button type=\"button\" class=\"hx-close\" data-action=\"close-drawer\" aria-label=\"Close\" data-corn-kind=\"icon\">✕</button></div><p id=\"drawer-description\" class=\"hx-lead\" hidden></p><div class=\"hx-block\"><div id=\"drawer-meta-list\" class=\"hx-meta\"></div></div></div><div class=\"hx-drawer-foot\" data-corn=\"node-foot\"><a data-corn=\"open-link\" id=\"drawer-file-btn\" data-corn-kind=\"primary\" class=\"hx-open\" href=\"#\" target=\"_blank\" rel=\"noreferrer\" hidden>Open file ↗</a><a data-corn=\"open-link\" id=\"drawer-open-btn\" data-corn-kind=\"primary\" class=\"hx-open\" href=\"#\" target=\"_blank\" rel=\"noreferrer\" hidden>Open route ↗</a><button data-corn-kind=\"secondary\" type=\"button\" id=\"drawer-run-btn\" class=\"hx-btn hx-foot-btn\" data-action=\"start-run\" data-corn-string=\"startRun\" hidden>Start a run</button><button data-corn-kind=\"quiet\" type=\"button\" class=\"hx-btn hx-btn--quiet hx-foot-btn\" data-action=\"copy-spec\" data-corn-string=\"copySpec\">Copy Spec</button><p id=\"copy-spec-result\" class=\"hx-forge-result\" data-corn=\"result\" hidden></p></div></aside>",
|
|
164
|
+
backdrop: "<div id=\"drawer-backdrop\" class=\"hx-backdrop\" data-action=\"close-drawer\" hidden data-corn=\"backdrop\"></div>"
|
|
165
|
+
}), Z = (e) => e.slot("copy-spec", () => ({ timer: 0 }));
|
|
166
|
+
async function Q(e, t) {
|
|
167
|
+
let { state: n } = e;
|
|
168
|
+
if (!n.selectedNode) return;
|
|
169
|
+
let r = Z(e), i = JSON.stringify({ node: n.selectedNode }, null, 2);
|
|
170
|
+
clearTimeout(r.timer), R(e, "copy-spec");
|
|
171
|
+
try {
|
|
172
|
+
await e.win.navigator.clipboard.writeText(i), L(e, "copy-spec", `Copied the spec of ${n.selectedNode.label || n.selectedNode.id} to the clipboard.`, !0);
|
|
173
|
+
} catch {
|
|
174
|
+
L(e, "copy-spec", "The browser did not allow copying, so nothing was copied. Allow clipboard access for this page, then press Copy Spec again.", !1);
|
|
175
|
+
}
|
|
176
|
+
z(e, t, "copy-spec"), r.timer = setTimeout(() => {
|
|
177
|
+
R(e, "copy-spec"), z(e, t, "copy-spec");
|
|
178
|
+
}, F);
|
|
179
|
+
}
|
|
180
|
+
function _e(e) {
|
|
181
|
+
let { state: t } = e, n = (e) => t.nodes.find((t) => t.id === e), r = (e) => (n(e) || { label: e }).label, a = (e) => `<span class="hx-name">${i(r(e))}</span>`, o = (e, n, r) => t.edges.filter((t) => t.kind === e && t[n] === r);
|
|
182
|
+
function s(e) {
|
|
183
|
+
let s = t.edges.filter((e) => e.kind === "reads"), c = t.edges.filter((e) => e.kind === "writes"), l = t.edges.filter((t) => t.kind === "uses" && t.from === e.id), u = q("Extends:", t.edges.filter((t) => t.kind === "extends" && t.from === e.id).map((e) => G(a(e.to)))) + q("Uses design tokens:", l.map((e) => G(`${a(e.to)} · ${e.vars.length}${J(e.vars)}`))) + (e.type !== "token" && e.vars ? q(`Defines ${e.vars.length} CSS variable(s):`, [J(e.vars)]) : "");
|
|
184
|
+
if (e.type === "app") {
|
|
185
|
+
let n = e.deployed ? G(`${/^https?:\/\//.test(e.url) ? `<a data-corn="text-link" class="hx-link" href="${i(e.url)}" target="_blank" rel="noreferrer">${i(e.url)}</a>` : W(e.url)} → ${(e.upstreams || []).map(W).join(" ")}${e.stack ? ` <span class="hx-faint">[${i(e.stack)}]</span>` : ""}`) : G("Not deployed by any stack in this repo"), r = t.edges.filter((t) => t.kind === "runs-on" && t.from === e.id).map((e) => G(`${a(e.to)}${(e.mappings || []).map((e) => `<div class="hx-faint">${W(e.host)} → ${W(e.upstream)}${e.service ? ` = ${W(e.service)}` : ""}</div>`).join("")}`));
|
|
186
|
+
return q("Served:", [n]) + q("Runs on:", r) + q("Loaded by the server per request:", s.filter((t) => t.to === e.id).map((e) => G(a(e.from)))) + u;
|
|
187
|
+
}
|
|
188
|
+
if (e.type === "token") {
|
|
189
|
+
let n = t.edges.filter((t) => t.kind === "uses" && t.to === e.id);
|
|
190
|
+
return q(`${e.vars.length} variable(s):`, [J(e.vars)]) + q("Used by:", n.map((e) => G(`${a(e.from)} · ${i(e.vars.join(" "))}`)));
|
|
191
|
+
}
|
|
192
|
+
if ([
|
|
193
|
+
"atom",
|
|
194
|
+
"molecule",
|
|
195
|
+
"core"
|
|
196
|
+
].includes(e.type)) {
|
|
197
|
+
let n = t.edges.filter((t) => t.dashed && t.to === e.id).map((e) => G(a(e.from)));
|
|
198
|
+
return (e.table ? q("Record of:", [G(`${i(e.model)} · table ${W(e.table)}`)]) : "") + q("Rendered by:", n) + u;
|
|
199
|
+
}
|
|
200
|
+
if (e.type === "stack") return q("Domains served (Caddyfile → service):", t.edges.filter((t) => t.kind === "runs-on" && t.to === e.id).flatMap((e) => (e.mappings || []).map((e) => G(`<span class="hx-name">${i(e.host)}</span> → ${W(e.upstream)}${e.service ? ` = ${W(e.service)}` : ""}`)))) + q(`${(e.services || []).length} service(s):`, (e.services || []).map((e) => G(`<span class="hx-name">${i(e.name)}</span>${e.image ? ` <span class="hx-faint">${i(e.image)}</span>` : ""}${e.ports.length ? `<div>${e.ports.map(W).join(" ")}</div>` : ""}${e.volumes.length ? `<div class="hx-faint">${e.volumes.map(i).join("<br>")}</div>` : ""}`))) + q("Compose file:", [G(W(e.file))]);
|
|
201
|
+
if (e.type === "table") {
|
|
202
|
+
let t = s.filter((t) => t.from === e.id), o = c.filter((t) => t.to === e.id), l = t.filter((e) => (n(e.to) || {}).render?.rom === "bake");
|
|
203
|
+
return (e.model ? q("Model:", [G(i(e.model))]) : "") + q("Read by:", t.map((e) => G(`${a(e.to)} · ${e.keys.map(W).join(" ")}`))) + q("Written by:", o.map((e) => G(`${a(e.from)} · ${i(e.label)}`))) + (l.length ? q("Baked pages:", [G(`a write here re-bakes <span class="hx-rom hx-bold">${l.length}</span> file(s): ${l.map((e) => i(r(e.to))).join(", ")}`)]) : "");
|
|
204
|
+
}
|
|
205
|
+
if (e.type === "service") {
|
|
206
|
+
let t = (e, t) => `${a(e[t])}${e.label && e.label !== "imports" ? ` · ${i(e.label)}` : ""}`;
|
|
207
|
+
return (e.summary && !String(e.desc || "").includes(e.summary) ? q("Summary:", [G(`<span class="hx-faint">${i(e.summary)}</span>`)]) : "") + q("Started by:", [...(e.triggers || []).map((e) => G(i(e))), ...o("triggers", "to", e.id).map((e) => G(t(e, "from")))]) + q("Jobs:", (e.jobs || []).map((e) => G(`${W(e.name)} · cron ${W(e.cron)}`))) + q("Runs:", o("triggers", "from", e.id).map((e) => G(t(e, "to")))) + q("Calls:", o("calls", "from", e.id).map((e) => G(t(e, "to")))) + q("Called by:", o("calls", "to", e.id).map((e) => G(t(e, "from")))) + q("Reads tables:", s.filter((t) => t.to === e.id).map((e) => G(a(e.from)))) + q("Writes tables:", c.filter((t) => t.from === e.id).map((e) => G(a(e.to)))) + q("Mechanisms:", (e.mechanisms || []).map((e) => G(i(e))));
|
|
208
|
+
}
|
|
209
|
+
if (e.type === "container" && e.selfHosted) {
|
|
210
|
+
let o = (e, t) => `${a(e[t])}${e.label && e.label !== "calls" ? ` · ${i(e.label)}` : ""}`, s = t.edges.filter((t) => t.to === e.id && (t.kind === "calls" || t.kind === "flow" && t.flow === "api")), c = (e) => s.filter((t) => n(t.from)?.type === e).map((e) => G(o(e, "from"))), l = new Set(t.nodes.filter((t) => t.type === "container" && t.stack === e.stack).map((e) => e.id));
|
|
211
|
+
return q("Self-hosted:", [G(i(e.summary || ""))]) + q("Called by services:", c("service")) + q("Called by endpoints:", c("page")) + q("Called by apps:", c("app")) + q("Pushes to (webhook):", t.edges.filter((e) => e.kind === "delivers" && l.has(e.from) && n(e.to)?.type === "page").map((t) => G(`${a(t.to)}${t.from === e.id ? "" : ` <span class="hx-faint">from ${i(r(t.from))}</span>`}`)));
|
|
212
|
+
}
|
|
213
|
+
if (e.type === "external" && e.kind) return w(e, t.nodes, t.edges);
|
|
214
|
+
if (e.type === "external") {
|
|
215
|
+
let t = (t) => o("calls", "to", e.id).filter((e) => n(e.from)?.type === t);
|
|
216
|
+
return q("System:", [G(`${i(e.summary || "")}${e.host ? `<div class="hx-faint">Runs here as ${W(e.host)}</div>` : "<div class=\"hx-faint\">Not run by this stack</div>"}`)]) + q("Client modules:", (e.modules || []).map((e) => G(W(e)))) + q("Called by services:", t("service").map((e) => G(a(e.from)))) + q("Called by endpoints:", t("page").map((e) => G(a(e.from)))) + q("Pushes to (webhook):", o("delivers", "from", e.id).map((e) => G(a(e.to))));
|
|
217
|
+
}
|
|
218
|
+
if (e.type === "page") {
|
|
219
|
+
let n = e.render, r = t.edges.filter((t) => t.dashed && t.from === e.id).map((e) => G(a(e.to)));
|
|
220
|
+
return (e.methods ? q("Methods:", [G(e.methods.map(W).join(" "))]) : "") + (e.render_fn ? q("Rendered by:", [G(`${W(e.render_fn)} · ${i(e.file)}`)]) : "") + q("Calls outside:", o("calls", "from", e.id).map((e) => G(a(e.to)))) + q("Pushed to by:", o("delivers", "to", e.id).map((e) => G(`${a(e.from)} · ${i(e.label)}`))) + q("Starts:", o("triggers", "from", e.id).map((e) => G(`${a(e.to)} · ${i(e.label)}`))) + q("Renders:", r) + q("Reads:", s.filter((t) => t.to === e.id).map((e) => G(`${a(e.from)} · ${e.keys.map(W).join(" ")}`))) + q("Writes:", c.filter((t) => t.from === e.id).map((e) => G(`${a(e.to)} · ${i(e.label)}`))) + (n ? q("Render:", [G(`today: ${W(n.now)} · ROM: ${n.rom === "bake" ? "<span class=\"hx-rom hx-bold\">bake</span>" : "<span class=\"hx-faint\">skip (per request)</span>"}${n.note ? `<div class="hx-faint">${i(n.note)}</div>` : ""}`)]) : "");
|
|
221
|
+
}
|
|
222
|
+
return "";
|
|
223
|
+
}
|
|
224
|
+
function c(t) {
|
|
225
|
+
let n = e.ask("threads:index", t.id);
|
|
226
|
+
if (!n) return "";
|
|
227
|
+
let r = n.threads, a = n.start ? `<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-textact" data-thread-start="${i(t.id)}" aria-label="Start a thread about this: opens the New idea form for ${i(n.forge)}, with this node mentioned">Start a thread about this</button>` : "";
|
|
228
|
+
return !r || !r.length ? a : `<div class="hx-sec-block" data-corn="section"><h3 class="hx-sec-title">Threads</h3><ul class="hx-rows">${r.map((e) => {
|
|
229
|
+
let t = Number(e.comments) || 0;
|
|
230
|
+
return `<li><button type="button" class="hx-row hx-thread-open" data-thread-open="${i(e.number)}" data-corn="row" aria-label="Open thread #${i(e.number)}, ${i(e.title)}, ${t} ${t === 1 ? "comment" : "comments"}, in the issues and pull requests panel"><span class="hx-row-title">${i(e.title)}</span><span class="hx-row-meta">#${i(e.number)} · ${t}</span></button></li>`;
|
|
231
|
+
}).join("")}</ul>${a}</div>`;
|
|
232
|
+
}
|
|
233
|
+
function l(e) {
|
|
234
|
+
let n = d(e);
|
|
235
|
+
if (!Y(e, t.proposal)) return "";
|
|
236
|
+
let r = (e, t) => `<div class="hx-diff-k">${i(e)}</div><div class="hx-diff-v">${t}</div>`, a = [r("id", i(e.id))], o = t.edges.find((t) => !t.kind && !t.dashed && t.to === e.id);
|
|
237
|
+
o && a.push(r("parent", i(o.from)));
|
|
238
|
+
let s = t.edges.filter((t) => t.from === e.id || t.to === e.id), c = s.filter((e) => d(e) === "added").length, l = s.filter((e) => d(e) === "removed").length;
|
|
239
|
+
if ((c || l) && a.push(r("edges", i([c ? `+${c}` : "", l ? `−${l}` : ""].filter(Boolean).join(" ")))), n === "changed") for (let t of b(e)) a.push(r(t.field, `<span class="hx-change-before">${i(t.before) || "<em>nothing</em>"}</span> <span aria-hidden="true">→</span><span class="hx-sr-only"> became </span> <span class="hx-change-after">${i(t.after) || "<em>nothing</em>"}</span>`));
|
|
240
|
+
return `<div class="hx-sec-block" data-proposal-mark="${i(e.mark)}" data-corn="section"><h3 class="hx-sec-title">In this proposal</h3>${e.why ? `<p class="hx-why">${i(e.why)}</p>` : ""}<div class="hx-diff hx-diff--${i(n)}" data-corn="diff-block"${y(e.mark)}>${a.join("")}</div></div>`;
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
dataSummary: s,
|
|
244
|
+
threadsSection: c,
|
|
245
|
+
diffSection: l,
|
|
246
|
+
nameOf: r,
|
|
247
|
+
nodeById: n
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function $(e, o, d = {}) {
|
|
251
|
+
let { state: g } = o, v = t(o), y = _e(o), b = d.inline === !0, x = [...n(o, e, X().drawer, d.slots, "drawer"), ...b ? n(o, e, `<p class="hx-panel-empty" data-corn="empty">${i(u(o, "nodePanelEmpty"))}</p>`, null, "empty") : n(o, e, X().backdrop, d.slots, "backdrop")], S = (e) => {
|
|
252
|
+
for (let t of x) {
|
|
253
|
+
if (t.id === e) return t;
|
|
254
|
+
let n = t.querySelector(`[id="${e}"]`);
|
|
255
|
+
if (n) return n;
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
};
|
|
259
|
+
v.keepParts(...x);
|
|
260
|
+
let w = S("spec-drawer"), D = b ? { hidden: !0 } : S("drawer-backdrop"), O = b ? x.find((e) => e.matches("[data-corn=\"empty\"]")) : null, k = (e) => {
|
|
261
|
+
O && (O.hidden = !e);
|
|
262
|
+
}, A = !1, j = () => p(g.selectedNode, o.viewEdges(), {
|
|
263
|
+
throughChildren: g.throughChildren,
|
|
264
|
+
kind: g.selectedKind
|
|
265
|
+
});
|
|
266
|
+
function M(e) {
|
|
267
|
+
let t = j();
|
|
268
|
+
if (!t || !t.kinds.size) return "";
|
|
269
|
+
let n = de(t).map(({ kind: e, count: n, word: r }) => `<button type="button" class="hx-lines-kind" data-corn="lines-kind" data-corn-kind="quiet" data-lines-kind="${i(e)}" data-focus-key="kind:${i(e)}" aria-pressed="${t.kind === e}">${i(r)} <span class="hx-lines-count" data-corn="count">${n}</span></button>`).join(""), r = t.kind ? fe(t, t.kind).map((e) => `<button type="button" class="hx-linkbtn" data-corn="node-link" data-action="select-node" data-id="${i(e.id)}"><span class="hx-sr-only">${e.out ? "to " : "from "}</span><span aria-hidden="true">${e.out ? "→" : "←"}</span> ${i(y.nameOf(e.id))}</button>`) : [], a = r.length ? `<div class="hx-lines-list">${C(r, 12)}</div>` : "", s = p(e, o.viewEdges(), { throughChildren: !1 }).childIds.size > 0 ? `<label class="hx-lines-switch"><input type="checkbox" data-corn="lines-switch" data-lines-switch data-focus-key="switch"${g.throughChildren ? " checked" : ""}> <span>${i(u(o, "throughChildren"))}</span></label>` : "", { connected: c, off: d } = l(o);
|
|
270
|
+
return `<div class="hx-sec-block hx-lines" id="drawer-lines" data-corn="lines-by-kind"><h3 class="hx-sec-title">Lines</h3><div class="hx-chips" role="group" aria-label="Lit lines by kind">${n}</div>${a}${s}<div class="hx-lines-reach"><span data-lines-reach>${i(H(c, d))}</span> <button type="button" data-corn="frame-button" data-corn-kind="secondary" class="hx-btn hx-btn--secondary" data-action="frame-selection" data-focus-key="frame">${i(u(o, "frame"))}</button></div></div>`;
|
|
271
|
+
}
|
|
272
|
+
function N() {
|
|
273
|
+
let e = S("drawer-lines");
|
|
274
|
+
if (!e || !g.selectedNode) return;
|
|
275
|
+
let t = o.active(), n = t && e.contains(t) ? t.dataset.focusKey : "", r = o.doc.createElement("div");
|
|
276
|
+
r.innerHTML = M(g.selectedNode), a(r);
|
|
277
|
+
let i = r.firstElementChild;
|
|
278
|
+
if (i ? e.replaceWith(i) : e.remove(), n) {
|
|
279
|
+
let e = S("drawer-lines"), t = e && [...e.querySelectorAll("[data-focus-key]")].find((e) => e.dataset.focusKey === n);
|
|
280
|
+
t && t.focus();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function P(e) {
|
|
284
|
+
let t = e.target.closest && e.target.closest("[data-lines-kind]");
|
|
285
|
+
if (!t || !g.selectedNode) return !1;
|
|
286
|
+
let n = t.dataset.linesKind;
|
|
287
|
+
g.selectedKind = g.selectedKind === n ? null : n, o.touchScene(), o.map.render(), N();
|
|
288
|
+
let r = j();
|
|
289
|
+
return m(o, r && r.kind ? `Showing ${V(r.kind).toLowerCase()} only: ${r.edges.length} ${r.edges.length === 1 ? "line" : "lines"}` : "Showing every kind of line"), !0;
|
|
290
|
+
}
|
|
291
|
+
function F(e) {
|
|
292
|
+
let t = e.target.closest && e.target.closest("[data-lines-switch]");
|
|
293
|
+
if (!t || !g.selectedNode) return;
|
|
294
|
+
g.throughChildren = !!t.checked, g.selectedKind = null, o.touchScene(), o.map.render(), N();
|
|
295
|
+
let n = j();
|
|
296
|
+
m(o, `${g.throughChildren ? "Including" : "Not including"} its children's lines: ${n ? n.connectedNodeIds.size - 1 : 0} connected`);
|
|
297
|
+
}
|
|
298
|
+
let I = S("drawer-meta-list");
|
|
299
|
+
v.listen(I, "click", (e) => {
|
|
300
|
+
P(e) || te(e.target);
|
|
301
|
+
}), v.listen(I, "change", F), v.own(o.map.onPaint(() => {
|
|
302
|
+
if (!g.selectedNode) return;
|
|
303
|
+
let e = w.querySelector("[data-lines-reach]");
|
|
304
|
+
if (!e) return;
|
|
305
|
+
let { connected: t, off: n } = l(o), r = H(t, n);
|
|
306
|
+
e.textContent !== r && (e.textContent = r);
|
|
307
|
+
}));
|
|
308
|
+
function L() {
|
|
309
|
+
let e = S("drawer-threads");
|
|
310
|
+
e && g.selectedNode && (e.innerHTML = y.threadsSection(g.selectedNode), a(e));
|
|
311
|
+
}
|
|
312
|
+
function R(e, { frame: t = !1 } = {}) {
|
|
313
|
+
if (!e || A) return;
|
|
314
|
+
let n = S("drawer-title");
|
|
315
|
+
n.textContent = e.tag ? `<${e.tag}>` : e.label, n.classList.toggle("hx-mono", e.type === "page" || !!e.tag), S("drawer-badge").textContent = he(e);
|
|
316
|
+
let r = ge(e);
|
|
317
|
+
S("drawer-host").textContent = r ? ` · ${r}` : "";
|
|
318
|
+
let i = Y(e, g.proposal), s = S("drawer-diff");
|
|
319
|
+
s.textContent = i, s.hidden = !i;
|
|
320
|
+
let c = ee(i ? e.mark : "");
|
|
321
|
+
c ? s.dataset.cornState = c : delete s.dataset.cornState;
|
|
322
|
+
let l = S("drawer-description");
|
|
323
|
+
l.textContent = e.desc || "", l.hidden = !e.desc;
|
|
324
|
+
let d = `${e.file ? q("File", [W(e.file)]) : ""}${ce(o, e)}${y.dataSummary(e)}`, f = o.ask("live:section", e) || "";
|
|
325
|
+
I.innerHTML = `${M(e)}${d ? `<div class="hx-facts">${d}</div>` : ""}
|
|
326
|
+
<div id="drawer-live">${f}</div>
|
|
327
|
+
${le(g, e.id)}
|
|
328
|
+
<div id="drawer-threads">${y.threadsSection(e)}</div>
|
|
329
|
+
${y.diffSection(e)}`, a(I), o.emit("threads:ensure"), o.emit("live:hydrate", S("drawer-live"));
|
|
330
|
+
let p = S("drawer-file-btn"), m = S("drawer-open-btn"), h = e.file && g.forge ? ue(g.forge, e.file, g.forge.baseBranch) : null;
|
|
331
|
+
p.hidden = !h, h ? p.href = h : p.removeAttribute("href");
|
|
332
|
+
let _ = !!(e.url && /^https?:\/\//.test(e.url));
|
|
333
|
+
_ ? m.href = e.url : m.removeAttribute("href"), m.hidden = !_, m.className = h ? "hx-btn hx-btn--quiet hx-foot-btn" : "hx-open", h ? m.dataset.cornKind = "quiet" : m.dataset.cornKind = "primary", m.textContent = `${u(o, "openRoute")} ↗`, p.textContent = `${u(o, "openFile")} ↗`, S("drawer-run-btn").hidden = !(g.proposalSlug && o.ask("forge:can-start")), w.classList.add("drawer-open"), w.inert = !1, D.hidden = !1, k(!1), b || E(o, "drawer"), !t && !b && B(), o.emit("node:painted", { node: e });
|
|
334
|
+
}
|
|
335
|
+
function z(e) {
|
|
336
|
+
if (!e || A) return;
|
|
337
|
+
let t = (e, t) => t ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">${i(e)}</div><div class="hx-fact-v">${i(t)}</div></div>` : "", n = t("Kind", e.kind || (e.dashed ? "usage" : "ownership")) + t("Flow", e.flow) + t("Label", e.label) + t("Reads", Array.isArray(e.keys) ? e.keys.join(", ") : ""), r = S("drawer-title");
|
|
338
|
+
r.textContent = `${y.nameOf(e.from)} → ${y.nameOf(e.to)}`, r.classList.remove("hx-mono"), S("drawer-badge").textContent = "Edge", S("drawer-host").textContent = "", S("drawer-diff").hidden = !0;
|
|
339
|
+
let o = S("drawer-description");
|
|
340
|
+
o.textContent = "", o.hidden = !0, I.innerHTML = `${n ? `<div class="hx-facts">${n}</div>` : ""}
|
|
341
|
+
<div class="hx-facts">
|
|
342
|
+
<div class="hx-fact" data-corn="section"><div class="hx-fact-k">From</div><div class="hx-fact-v"><button data-corn="node-link" type="button" class="hx-linkbtn" data-action="select-node" data-id="${i(e.from)}">${i(y.nameOf(e.from))}</button></div></div>
|
|
343
|
+
<div class="hx-fact" data-corn="section"><div class="hx-fact-k">To</div><div class="hx-fact-v"><button data-corn="node-link" type="button" class="hx-linkbtn" data-action="select-node" data-id="${i(e.to)}">${i(y.nameOf(e.to))}</button></div></div>
|
|
344
|
+
</div>${_(e)}`, a(I), S("drawer-open-btn").hidden = !0, S("drawer-file-btn").hidden = !0, S("drawer-run-btn").hidden = !0, w.classList.add("drawer-open"), w.inert = !1, D.hidden = !1, k(!1);
|
|
345
|
+
}
|
|
346
|
+
function B() {
|
|
347
|
+
let e = g.selectedNode;
|
|
348
|
+
if (!e || !g.width || !s(o) || A) return;
|
|
349
|
+
let t = c(o), n = ne(g.camera, e, {
|
|
350
|
+
left: 0,
|
|
351
|
+
top: 0,
|
|
352
|
+
right: g.width,
|
|
353
|
+
bottom: g.height - t
|
|
354
|
+
}, e.r * g.camera.zoom + 16);
|
|
355
|
+
n && (Object.assign(g.camera, n), o.map.render());
|
|
356
|
+
}
|
|
357
|
+
function U() {
|
|
358
|
+
w.classList.remove("drawer-open"), w.inert = !0, D.hidden = !0, k(!0), b || se(o, "drawer");
|
|
359
|
+
}
|
|
360
|
+
function G() {
|
|
361
|
+
g.proposalSlug && o.emit("forge:start", {
|
|
362
|
+
slug: g.proposalSlug,
|
|
363
|
+
returnTo: "#drawer-run-btn"
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
v.own(() => clearTimeout(Z(o).timer));
|
|
367
|
+
let K = {
|
|
368
|
+
"close-drawer": () => f(o, { source: "tap" }),
|
|
369
|
+
"copy-spec": () => Q(o, S("copy-spec-result")),
|
|
370
|
+
"start-run": () => G(),
|
|
371
|
+
"select-node": (e) => h(o, y.nodeById(e.dataset.id), {
|
|
372
|
+
frame: !0,
|
|
373
|
+
source: "link"
|
|
374
|
+
}),
|
|
375
|
+
"frame-selection": () => r(o)
|
|
376
|
+
};
|
|
377
|
+
return v.listen(w, "click", (e) => {
|
|
378
|
+
let t = e.target.closest && e.target.closest("[data-action]");
|
|
379
|
+
if (!t) return;
|
|
380
|
+
let n = K[t.dataset.action];
|
|
381
|
+
n && n(t), t.dataset.action === "close-drawer" && g.canvas && v.timeout(() => g.canvas.focus(), 0);
|
|
382
|
+
}), v.listen(w, "click", (e) => {
|
|
383
|
+
let t = e.target.closest && e.target.closest("[data-thread-open]");
|
|
384
|
+
t ? o.emit("thread:open", { number: Number(t.dataset.threadOpen) }) : e.target.closest && e.target.closest("[data-thread-start]") && g.selectedNode && o.emit("thread:start", { node: g.selectedNode });
|
|
385
|
+
}), v.on("threads:changed", () => L()), b || v.listen(D, "click", (e) => {
|
|
386
|
+
s(o) ? re(o, e) : f(o, { source: "tap" });
|
|
387
|
+
}, !0), v.listen(w, "keydown", (e) => {
|
|
388
|
+
e.key !== "Escape" || e.defaultPrevented || e.target.closest && e.target.closest("select, input, textarea") || (e.preventDefault(), f(o, { source: "keyboard" }), g.canvas && g.canvas.focus(), m(o, "Panel closed"));
|
|
389
|
+
}), v.on("panel:present", () => !0), v.on("panel:covers", () => !b && !A && !w.hidden && w.classList.contains("drawer-open") ? { right: w.offsetWidth } : void 0), v.on("node:show", ({ node: e, frame: t }) => R(e, { frame: t })), v.on("node:close", U), v.on("node:show-edge", ({ edge: e }) => z(e)), v.on("node:focus", () => {
|
|
390
|
+
let e = S("drawer-title");
|
|
391
|
+
if (!e) return;
|
|
392
|
+
let t = o.active();
|
|
393
|
+
b && t && t !== e && typeof t.matches == "function" && t.matches("[data-corn=\"node-title\"]") || (e.setAttribute("tabindex", "-1"), e.focus());
|
|
394
|
+
}), b || (v.own(T(o, () => B())), oe(o), ie(o, "drawer", w, { stub: () => ({ title: S("drawer-title") && S("drawer-title").textContent || "Node" }) }), v.own(() => ae(o, "drawer"))), g.selectedNode && R(g.selectedNode, { frame: !1 }), v.own(() => {
|
|
395
|
+
A = !0, x.forEach((e) => e.remove());
|
|
396
|
+
}), {
|
|
397
|
+
elements: x,
|
|
398
|
+
show: R,
|
|
399
|
+
close: U,
|
|
400
|
+
repaintThreads: L,
|
|
401
|
+
copySpec: () => Q(o, S("copy-spec-result")),
|
|
402
|
+
startRun: G,
|
|
403
|
+
keepSelectedInView: B,
|
|
404
|
+
update(e) {
|
|
405
|
+
e && "node" in e ? e.node ? h(o, e.node, { source: "api" }) : f(o, { source: "api" }) : g.selectedNode && w.classList.contains("drawer-open") && R(g.selectedNode, { frame: !1 });
|
|
406
|
+
},
|
|
407
|
+
destroy: () => v.destroy()
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
export { U as n, $ as t };
|