@popcorn245/cornfield-components 0.52.0 → 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.
@@ -1,10 +1,10 @@
1
1
  import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
2
  import { n as t, r as n, t as r } from "./runtime-DFu6W5g-.js";
3
- import { n as i, t as a } from "./around-D7aqHejs.js";
4
- import { D as o, Gt as s, N as c, P as l, Tn as u, Vt as d, Wt as f, it as p, kn as m, ln as h, on as g, ot as _, pn as v, t as y, tn as b, wn as x } from "./engine-HIgX35hE.js";
5
- import { _ as ee } from "./layers-n1mJVJs8.js";
6
- import "./sheets-TFCL_dIn.js";
7
- var S = (e, t) => `${m(e, "searchNoMatch")} “${t}”`, C = (e) => e.slot("search-status", () => {
3
+ import { n as i, t as a } from "./around-BFqYTZ0K.js";
4
+ import { Dn as o, En as s, F as c, Kt as l, O as u, P as d, Ut as f, cn as p, ct as m, dn as h, hn as g, jn as _, ot as v, qt as y, rn as b, t as x } from "./engine-BmXtSISH.js";
5
+ import { _ as ee } from "./layers-Bj4Tluxe.js";
6
+ import "./sheets-D-sMZzSs.js";
7
+ var S = (e, t) => `${_(e, "searchNoMatch")} “${t}”`, C = (e) => e.slot("search-status", () => {
8
8
  let t = { pending: null };
9
9
  return e.own(() => clearTimeout(t.pending)), t;
10
10
  });
@@ -39,29 +39,29 @@ function O(e, t, n = {}) {
39
39
  if (!r) return o;
40
40
  let s = [];
41
41
  for (let t of e) {
42
- let e = l(t, r);
42
+ let e = c(t, r);
43
43
  e < 0 || s.push({
44
44
  node: t,
45
45
  rank: e,
46
46
  on: !!i(t),
47
- group: c(t),
47
+ group: d(t),
48
48
  parent: a(t)
49
49
  });
50
50
  }
51
51
  s.sort((e, t) => e.rank - t.rank || String(e.node.label).localeCompare(String(t.node.label)) || String(e.node.id).localeCompare(String(t.node.id)));
52
- let u = /* @__PURE__ */ new Map();
52
+ let l = /* @__PURE__ */ new Map();
53
53
  for (let e of s) {
54
54
  let t = e.on ? `on|${e.group}` : "off";
55
- u.has(t) || u.set(t, {
55
+ l.has(t) || l.set(t, {
56
56
  name: e.on ? e.group : D,
57
57
  off: !e.on,
58
58
  rows: []
59
- }), u.get(t).rows.push(e);
59
+ }), l.get(t).rows.push(e);
60
60
  }
61
- let d = [...u.values()].sort((e, t) => Number(e.off) - Number(t.off) || e.rows[0].rank - t.rows[0].rank || e.name.localeCompare(t.name));
62
- o.matches = d.flatMap((e) => e.rows), o.total = o.matches.length, o.onMap = s.filter((e) => e.on).length, o.off = o.total - o.onMap;
61
+ let u = [...l.values()].sort((e, t) => Number(e.off) - Number(t.off) || e.rows[0].rank - t.rows[0].rank || e.name.localeCompare(t.name));
62
+ o.matches = u.flatMap((e) => e.rows), o.total = o.matches.length, o.onMap = s.filter((e) => e.on).length, o.off = o.total - o.onMap;
63
63
  let f = 50;
64
- for (let e of d) {
64
+ for (let e of u) {
65
65
  if (f <= 0) break;
66
66
  o.groups.push({
67
67
  name: e.name,
@@ -115,18 +115,18 @@ var j = (e) => `No node matches “${e}”. Search reads names, files, types and
115
115
  bar: e ? "<div id=\"mobile-search-bar\" class=\"hx-mobile-search glass-header\" role=\"search\" hidden data-corn=\"mobile-search\">\n <input type=\"text\" id=\"mobile-node-search\" class=\"hx-input hx-input--wide\" placeholder=\"Search nodes, apps, components...\" aria-label=\"Search nodes\" data-corn=\"search-input\" />\n <button type=\"button\" class=\"hx-textbtn\" data-action=\"close-mobile-search\" data-corn-kind=\"quiet\">Cancel</button>\n <span id=\"mobile-search-steps\" class=\"hx-search-steps\" data-corn=\"search-steps\" hidden>\n <span id=\"mobile-search-count\" class=\"hx-search-count\" data-corn=\"search-count\" aria-hidden=\"true\"></span>\n <button type=\"button\" class=\"hx-search-btn\" data-action=\"search-prev\" aria-label=\"Previous match\" title=\"Previous match (Shift+Enter)\" data-corn-kind=\"icon\"><svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M3.5 10.5L8 6l4.5 4.5\" /></svg></button>\n <button type=\"button\" class=\"hx-search-btn\" data-action=\"search-next\" aria-label=\"Next match\" title=\"Next match (Enter)\" data-corn-kind=\"icon\"><svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M3.5 5.5L8 10l4.5-4.5\" /></svg></button>\n <button type=\"button\" class=\"hx-search-btn\" data-action=\"clear-search\" aria-label=\"Clear search\" title=\"Clear search (Escape)\" data-corn-kind=\"icon\"><svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 4l8 8M12 4l-8 8\" /></svg></button>\n </span>\n <div id=\"mobile-search-status\" class=\"hx-search-status\" role=\"status\" aria-live=\"polite\" data-corn=\"search-status\"></div>\n <div id=\"mobile-search-results\" class=\"hx-search-results\" data-corn=\"search-results\" hidden></div>\n</div>" : ""
116
116
  });
117
117
  function L(e, t, n, r = !1) {
118
- let i = n ? ` · ${f(t.group)}` : "", a = t.parent ? f(t.parent) : "", o = e.searchCurrent === t.node.id;
119
- return `<button type="button" role="option" class="hx-search-row" data-corn="search-result" data-search-id="${f(t.node.id)}" tabindex="${r ? 0 : -1}" aria-selected="${o}"${o ? " aria-current=\"true\"" : ""}><span class="hx-search-row-label">${f(t.node.label)}</span><span class="hx-search-row-parent">${a}${i}</span></button>`;
118
+ let i = n ? ` · ${l(t.group)}` : "", a = t.parent ? l(t.parent) : "", o = e.searchCurrent === t.node.id;
119
+ return `<button type="button" role="option" class="hx-search-row" data-corn="search-result" data-search-id="${l(t.node.id)}" tabindex="${r ? 0 : -1}" aria-selected="${o}"${o ? " aria-current=\"true\"" : ""}><span class="hx-search-row-label">${l(t.node.label)}</span><span class="hx-search-row-parent">${a}${i}</span></button>`;
120
120
  }
121
121
  function R(e, t, n = "search-listbox") {
122
122
  if (!t.query) return "";
123
- if (!t.total) return `<p class="hx-search-empty" data-corn="search-empty">${f(j(t.query))}</p>`;
124
- let r = t.groups.flatMap((e) => e.rows), i = r.some((t) => t.node.id === e.searchCurrent) ? e.searchCurrent : t.onMap ? F : r[0].node.id, a = t.onMap ? `<button type="button" role="option" aria-selected="false" class="hx-search-row hx-search-frame" data-corn="search-result" data-search-frame tabindex="${i === F ? 0 : -1}">Frame all ${t.onMap}</button>` : "", o = t.groups.map((t) => `<div class="hx-search-group" role="group" aria-label="${f(t.name)}, ${t.count}" data-corn="search-group"><div class="hx-search-group-title" aria-hidden="true">${f(t.name)} <span class="hx-search-group-count">${t.count}</span></div>${t.rows.map((n) => L(e, n, t.off, n.node.id === i)).join("")}</div>`).join(""), s = t.more ? `<p class="hx-search-more">${f(M(t.more))}</p>` : "";
125
- return `<div role="listbox" id="${f(n)}" aria-label="Search results">${a}${o}</div>${s}`;
123
+ if (!t.total) return `<p class="hx-search-empty" data-corn="search-empty">${l(j(t.query))}</p>`;
124
+ let r = t.groups.flatMap((e) => e.rows), i = r.some((t) => t.node.id === e.searchCurrent) ? e.searchCurrent : t.onMap ? F : r[0].node.id, a = t.onMap ? `<button type="button" role="option" aria-selected="false" class="hx-search-row hx-search-frame" data-corn="search-result" data-search-frame tabindex="${i === F ? 0 : -1}">Frame all ${t.onMap}</button>` : "", o = t.groups.map((t) => `<div class="hx-search-group" role="group" aria-label="${l(t.name)}, ${t.count}" data-corn="search-group"><div class="hx-search-group-title" aria-hidden="true">${l(t.name)} <span class="hx-search-group-count">${t.count}</span></div>${t.rows.map((n) => L(e, n, t.off, n.node.id === i)).join("")}</div>`).join(""), s = t.more ? `<p class="hx-search-more">${l(M(t.more))}</p>` : "";
125
+ return `<div role="listbox" id="${l(n)}" aria-label="Search results">${a}${o}</div>${s}`;
126
126
  }
127
127
  var z = (e) => [...e.querySelectorAll("[data-corn=\"search-result\"]")], B = (e) => !!e && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));
128
128
  function V(e, t, n = {}) {
129
- let { state: r } = t, a = u(t), c = [...x(t, e, I({ phone: n.phone !== !1 }).field, n.slots, "field"), ...x(t, e, I({ phone: n.phone !== !1 }).bar, n.slots, "bar")], l = (e) => {
129
+ let { state: r } = t, a = o(t), c = [...s(t, e, I({ phone: n.phone !== !1 }).field, n.slots, "field"), ...s(t, e, I({ phone: n.phone !== !1 }).bar, n.slots, "bar")], l = (e) => {
130
130
  for (let t of c) {
131
131
  if (t.id === e) return t;
132
132
  let n = t.querySelector(`[id="${e}"]`);
@@ -135,8 +135,8 @@ function V(e, t, n = {}) {
135
135
  return null;
136
136
  };
137
137
  a.keepParts(...c);
138
- let d = P.filter((e) => l(e.input)), f = null, m = 0;
139
- function y() {
138
+ let d = P.filter((e) => l(e.input)), f = null, _ = 0;
139
+ function x() {
140
140
  let e = new Map(r.nodes.map((e) => [e.id, e])), t = /* @__PURE__ */ new Map();
141
141
  for (let e of r.edges) e.kind || e.dashed || t.has(e.to) || t.set(e.to, e.from);
142
142
  return (n) => {
@@ -149,7 +149,7 @@ function V(e, t, n = {}) {
149
149
  if (f && f.key === e && f.nodes === r.nodes) return f.result;
150
150
  let n = O(r.nodes, r.searchQuery, {
151
151
  visible: (e) => t.map.isNodeVisible(e),
152
- parentLabel: y()
152
+ parentLabel: x()
153
153
  });
154
154
  return f = {
155
155
  key: e,
@@ -208,19 +208,19 @@ function V(e, t, n = {}) {
208
208
  }
209
209
  function F(e) {
210
210
  let n = [
211
- _(r, e),
212
- o(e),
211
+ m(r, e),
212
+ u(e),
213
213
  e.type === "store" || e.type === "rom" ? "flow" : null,
214
214
  e.type === "core" ? "pkg" : null,
215
215
  e.type === "core" ? "core" : null
216
216
  ];
217
217
  for (let i of n) {
218
218
  if (t.map.isNodeVisible(e)) return;
219
- i && !p(r, i) && ee(t, i);
219
+ i && !v(r, i) && ee(t, i);
220
220
  }
221
221
  }
222
222
  function L(e, n) {
223
- let r = v(t);
223
+ let r = g(t);
224
224
  return {
225
225
  x: r.x + r.width / 2 - e.x * n,
226
226
  y: r.y + r.height / 2 - e.y * n,
@@ -228,16 +228,16 @@ function V(e, t, n = {}) {
228
228
  };
229
229
  }
230
230
  async function V(e, { say: n = !0 } = {}) {
231
- let i = e.node, a = ++m;
231
+ let i = e.node, a = ++_;
232
232
  t.map.isNodeVisible(i) || F(i), r.searchCurrent = i.id, t.touchScene();
233
- let o = S(), c = o.matches.findIndex((e) => e.node.id === i.id);
234
- if (b(t, i, { source: "search" }), a !== m || r.searchCurrent !== i.id) return;
235
- g(t, L(i, Math.max(r.camera.zoom, 1))), D(), t.emit("search", {
233
+ let o = S(), s = o.matches.findIndex((e) => e.node.id === i.id);
234
+ if (b(t, i, { source: "search" }), a !== _ || r.searchCurrent !== i.id) return;
235
+ p(t, L(i, Math.max(r.camera.zoom, 1))), D(), t.emit("search", {
236
236
  query: r.searchQuery,
237
237
  current: r.searchCurrent
238
238
  });
239
- let l = `${c + 1} of ${o.total}: ${i.label}${e.parent ? `, in ${e.parent}` : ""}`;
240
- T(t, ""), n && s(t, l);
239
+ let c = `${s + 1} of ${o.total}: ${i.label}${e.parent ? `, in ${e.parent}` : ""}`;
240
+ T(t, ""), n && y(t, c);
241
241
  }
242
242
  function H(e) {
243
243
  let t = S();
@@ -247,7 +247,7 @@ function V(e, t, n = {}) {
247
247
  }
248
248
  function U() {
249
249
  let e = S(), n = new Set(e.matches.filter((e) => e.on).map((e) => e.node.id));
250
- n.size && (t.map.fitGraphToViewport(t.map.fitPadding(), n), T(t, ""), s(t, `Framed ${n.size} ${n.size === 1 ? "match" : "matches"}`));
250
+ n.size && (t.map.fitGraphToViewport(t.map.fitPadding(), n), T(t, ""), y(t, `Framed ${n.size} ${n.size === 1 ? "match" : "matches"}`));
251
251
  }
252
252
  function W(e, n) {
253
253
  let i = e.currentTarget;
@@ -257,7 +257,7 @@ function V(e, t, n = {}) {
257
257
  let n = i.value.trim();
258
258
  if (n !== r.searchQuery && N(i.value), !n) return;
259
259
  if (!S().total) {
260
- s(t, `No node matches ${n}`);
260
+ y(t, `No node matches ${n}`);
261
261
  return;
262
262
  }
263
263
  H(e.shiftKey ? -1 : 1);
@@ -276,7 +276,7 @@ function V(e, t, n = {}) {
276
276
  e.preventDefault(), j(n);
277
277
  return;
278
278
  }
279
- r.searchQuery && (e.preventDefault(), N(""), s(t, "Search cleared"));
279
+ r.searchQuery && (e.preventDefault(), N(""), y(t, "Search cleared"));
280
280
  }
281
281
  }
282
282
  function G(e, n) {
@@ -392,7 +392,7 @@ function V(e, t, n = {}) {
392
392
  }), a.on("search:active", () => C()), a.on("search:step", (e) => H(e)), a.on("layers", () => {
393
393
  r.searchQuery && D();
394
394
  }), a.own(() => {
395
- m++, c.forEach((e) => e.remove());
395
+ _++, c.forEach((e) => e.remove());
396
396
  }), {
397
397
  elements: c,
398
398
  setQuery: N,
@@ -408,7 +408,7 @@ function V(e, t, n = {}) {
408
408
  e && (e.focus(), e.select());
409
409
  },
410
410
  reset() {
411
- f = null, m++, r.searchQuery = "", r.searchCurrent = null;
411
+ f = null, _++, r.searchQuery = "", r.searchCurrent = null;
412
412
  },
413
413
  update(e) {
414
414
  e && "query" in e ? N(e.query) : D();
@@ -446,8 +446,8 @@ var H = () => "*,:before,:after{box-sizing:border-box}*{--hx-control-h:var(--cor
446
446
  this.unmountPiece(), this.loaded && this.el.isConnected && this.mountPiece();
447
447
  }
448
448
  mountPiece() {
449
- !this.piece && this.el.shadowRoot && (this.changes = {}, this.scope = d(this.el, () => this.remount()), this.piece = a(N, this.el.shadowRoot, this.scope.inst, {
450
- tokens: y,
449
+ !this.piece && this.el.shadowRoot && (this.changes = {}, this.scope = f(this.el, () => this.remount()), this.piece = a(N, this.el.shadowRoot, this.scope.inst, {
450
+ tokens: x,
451
451
  initial: this.query ? { query: this.query } : {},
452
452
  onSearch: (e) => {
453
453
  this.query = e.query, delete this.changes.query, this.cornSearch.emit(e);