open-grid 1.3.1 → 1.4.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const OpenGrid = require("./OpenGrid-B7m7ei7f.cjs");
3
+ const Registry = require("./Registry-D74ZmdDz.cjs"), OpenGrid = require("./OpenGrid-BOtTt5aI.cjs");
4
4
  function isStyleRef(e) {
5
5
  return !!e && typeof e.ref == "string";
6
6
  }
@@ -23,20 +23,20 @@ function numeric(e) {
23
23
  function computeColumnStats(e) {
24
24
  const t = numeric(e), n = t.length;
25
25
  if (n === 0) return { count: 0, distinct: 0 };
26
- const r = [...t].sort((m, g) => m - g), i = r[0], o = r[n - 1], a = t.reduce((m, g) => m + g, 0) / n, c = t.reduce((m, g) => m + (g - a) ** 2, 0) / n, l = Math.sqrt(c), f = /* @__PURE__ */ new Map();
26
+ const r = [...t].sort((m, g) => m - g), s = r[0], o = r[n - 1], a = t.reduce((m, g) => m + g, 0) / n, c = t.reduce((m, g) => m + (g - a) ** 2, 0) / n, l = Math.sqrt(c), f = /* @__PURE__ */ new Map();
27
27
  for (const m of t) f.set(m, (f.get(m) ?? 0) + 1);
28
28
  const d = f.size;
29
- return { min: i, max: o, avg: a, stddev: l, count: n, distinct: d, rankOf: (m) => {
29
+ return { min: s, max: o, avg: a, stddev: l, count: n, distinct: d, rankOf: (m) => {
30
30
  let g = 0;
31
- for (const v of t) v > m && g++;
31
+ for (const y of t) y > m && g++;
32
32
  return g + 1;
33
33
  }, rankAscOf: (m) => {
34
34
  let g = 0;
35
- for (const v of t) v < m && g++;
35
+ for (const y of t) y < m && g++;
36
36
  return g + 1;
37
37
  }, percentileOf: (m) => {
38
38
  let g = 0;
39
- for (const v of t) v <= m && g++;
39
+ for (const y of t) y <= m && g++;
40
40
  return g / n;
41
41
  }, countOf: (m) => f.get(m) ?? 0 };
42
42
  }
@@ -44,74 +44,6 @@ function snapshotStats(e) {
44
44
  const t = {};
45
45
  return e.min !== void 0 && (t.min = e.min), e.max !== void 0 && (t.max = e.max), e.avg !== void 0 && (t.avg = e.avg), e.stddev !== void 0 && (t.stddev = e.stddev), e.count !== void 0 && (t.count = e.count), e.distinct !== void 0 && (t.distinct = e.distinct), t;
46
46
  }
47
- const RESERVED_PREFIXES = ["og:", "og-"];
48
- function isReserved(e) {
49
- return RESERVED_PREFIXES.some((t) => e.startsWith(t));
50
- }
51
- function spiMajor(e) {
52
- const t = e.lastIndexOf("@"), n = t >= 0 ? e.slice(t + 1) : e;
53
- return n.split(".")[0] ?? n;
54
- }
55
- function spiCompatible(e, t) {
56
- return spiMajor(e) === spiMajor(t);
57
- }
58
- function buildEntry(e, t, n, r, i) {
59
- const o = { key: e, value: t, origin: n, priority: r.priority ?? 0, seq: i };
60
- return r.pluginId !== void 0 && (o.pluginId = r.pluginId), r.spiVersion !== void 0 && (o.spiVersion = r.spiVersion), r.deprecated !== void 0 && (o.deprecated = r.deprecated), o;
61
- }
62
- class TypedRegistry {
63
- constructor(t = {}) {
64
- this._map = /* @__PURE__ */ new Map(), this._seq = 0, this._disposed = false, this._warned = /* @__PURE__ */ new Set(), this._cfg = t;
65
- }
66
- _warn(t, n) {
67
- const r = `[OpenGrid] ${n}`, i = `${t}::${n}`;
68
- return this._warned.has(i) || (this._warned.add(i), (this._cfg.onWarn ?? ((s) => {
69
- typeof console < "u" && console.warn(s);
70
- }))(r)), r;
71
- }
72
- register(t, n, r = {}) {
73
- if (this._disposed) return { ok: false, action: "rejected", reason: "disposed" };
74
- if (typeof t != "string" || t.length === 0) return { ok: false, action: "rejected", reason: "invalid-key" };
75
- const i = r.origin ?? "user";
76
- if (isReserved(t) && i !== "builtin") return { ok: false, action: "rejected", reason: "reserved-namespace", warning: this._warn(t, `reserved namespace: '${t}' 는 og:* 코어 예약 대역입니다(origin:'builtin' 만 점유).`) };
77
- if (this._cfg.spi && r.spiVersion !== void 0 && !spiCompatible(this._cfg.spi.version, r.spiVersion)) return { ok: false, action: "rejected", reason: "spi-mismatch", warning: this._warn(t, `SPI major 불일치: '${t}' 선언 ${r.spiVersion}, 코어 ${this._cfg.spi.name}@${this._cfg.spi.version}.`) };
78
- const o = this._map.get(t);
79
- return o && !this._resolveConflict(o, r) ? { ok: false, action: "kept", reason: "protected-builtin", warning: this._warn(t, `'${t}' 는 ${o.origin === "builtin" ? "내장(built-in) 보호" : "override 미지정"} — 덮으려면 { override:true }.`) } : (this._map.set(t, buildEntry(t, n, i, r, this._seq++)), { ok: true, action: o ? "replaced" : "added" });
80
- }
81
- _resolveConflict(t, n) {
82
- return t.origin === "builtin" && n.override !== true ? false : this._cfg.duplicatePolicy === "explicit-override" ? n.override === true : true;
83
- }
84
- get(t) {
85
- var _a;
86
- return (_a = this._map.get(t)) == null ? void 0 : _a.value;
87
- }
88
- require(t, n) {
89
- const r = this.get(t);
90
- if (r !== void 0) return r;
91
- if (n !== void 0) return n;
92
- if (this._cfg.placeholder) return this._cfg.placeholder(t);
93
- }
94
- has(t) {
95
- return this._map.has(t);
96
- }
97
- list() {
98
- return [...this._map.keys()];
99
- }
100
- entries() {
101
- return [...this._map.values()];
102
- }
103
- unregister(t) {
104
- return this._map.delete(t);
105
- }
106
- disposePlugin(t) {
107
- let n = 0;
108
- for (const [r, i] of this._map) i.pluginId === t && (this._map.delete(r), n++);
109
- return n;
110
- }
111
- dispose() {
112
- this._map.clear(), this._warned.clear(), this._disposed = true;
113
- }
114
- }
115
47
  function num$1(e) {
116
48
  return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
117
49
  }
@@ -149,9 +81,9 @@ const comparePredicate = { needs: [], test(e, t) {
149
81
  const n = t.value == null ? "" : String(t.value);
150
82
  return e.ci === false ? n.includes(e.text) : n.toLowerCase().includes(e.text.toLowerCase());
151
83
  } }, dateOccurringPredicate = { needs: [], test(e, t, n, r) {
152
- const i = t.value, o = i instanceof Date ? i.getTime() : typeof i == "number" ? i : Date.parse(String(i));
84
+ const s = t.value, o = s instanceof Date ? s.getTime() : typeof s == "number" ? s : Date.parse(String(s));
153
85
  if (!Number.isFinite(o)) return false;
154
- const s = r.now, a = startOfDay(s);
86
+ const i = r.now, a = startOfDay(i);
155
87
  switch (e.rel) {
156
88
  case "today":
157
89
  return startOfDay(o) === a;
@@ -160,19 +92,19 @@ const comparePredicate = { needs: [], test(e, t) {
160
92
  case "tomorrow":
161
93
  return startOfDay(o) === a + DAY;
162
94
  case "thisWeek": {
163
- const c = startOfWeek(s);
95
+ const c = startOfWeek(i);
164
96
  return o >= c && o < c + 7 * DAY;
165
97
  }
166
98
  case "lastWeek": {
167
- const c = startOfWeek(s) - 7 * DAY;
99
+ const c = startOfWeek(i) - 7 * DAY;
168
100
  return o >= c && o < c + 7 * DAY;
169
101
  }
170
102
  case "thisMonth": {
171
- const c = new Date(s);
103
+ const c = new Date(i);
172
104
  return new Date(o).getFullYear() === c.getFullYear() && new Date(o).getMonth() === c.getMonth();
173
105
  }
174
106
  case "lastMonth": {
175
- const c = new Date(s.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
107
+ const c = new Date(i.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
176
108
  return new Date(o).getFullYear() === l.getFullYear() && new Date(o).getMonth() === l.getMonth();
177
109
  }
178
110
  case "next7d":
@@ -188,26 +120,26 @@ const comparePredicate = { needs: [], test(e, t) {
188
120
  } }, topNpctPredicate = { needs: ["percentile"], test(e, t, n) {
189
121
  const r = num$1(t.value);
190
122
  if (!Number.isFinite(r) || !n.percentileOf) return false;
191
- const i = n.percentileOf(r);
192
- return e.bottom ? i <= e.pct / 100 : i >= 1 - e.pct / 100;
123
+ const s = n.percentileOf(r);
124
+ return e.bottom ? s <= e.pct / 100 : s >= 1 - e.pct / 100;
193
125
  } }, aboveAvgPredicate = { needs: ["avg"], test(e, t, n) {
194
126
  const r = num$1(t.value);
195
127
  return !Number.isFinite(r) || n.avg === void 0 ? false : e.below ? r < n.avg : r > n.avg;
196
128
  } }, stdBandPredicate = { needs: ["avg", "stddev"], test(e, t, n) {
197
129
  const r = num$1(t.value);
198
130
  if (!Number.isFinite(r) || n.avg === void 0 || n.stddev === void 0) return false;
199
- const i = Math.abs(r - n.avg), o = e.k * n.stddev;
200
- return e.outside === false ? i <= o : i >= o;
131
+ const s = Math.abs(r - n.avg), o = e.k * n.stddev;
132
+ return e.outside === false ? s <= o : s >= o;
201
133
  } }, duplicatePredicate = { needs: ["cardinality"], test(e, t, n) {
202
134
  const r = num$1(t.value);
203
135
  if (!Number.isFinite(r) || !n.countOf) return false;
204
- const i = n.countOf(r);
205
- return e.unique ? i === 1 : i > 1;
136
+ const s = n.countOf(r);
137
+ return e.unique ? s === 1 : s > 1;
206
138
  } }, customFallbackPredicate = { needs: [], test() {
207
139
  return false;
208
140
  } }, BUILTIN_PREDICATES = Object.freeze({ compare: comparePredicate, textContains: textContainsPredicate, dateOccurring: dateOccurringPredicate, topN: topNPredicate, topNpct: topNpctPredicate, aboveAvg: aboveAvgPredicate, stdBand: stdBandPredicate, duplicate: duplicatePredicate, custom: customFallbackPredicate });
209
141
  function createRuleTypeRegistry() {
210
- const e = new TypedRegistry({ spi: { name: "CFPredicate", version: "1" } });
142
+ const e = new Registry.TypedRegistry({ spi: { name: "CFPredicate", version: "1" } });
211
143
  for (const [t, n] of Object.entries(BUILTIN_PREDICATES)) e.register(t, n, { origin: "builtin" });
212
144
  return e;
213
145
  }
@@ -225,48 +157,48 @@ function clamp01(e) {
225
157
  return e < 0 ? 0 : e > 1 ? 1 : e;
226
158
  }
227
159
  function computeDatum(e, t, n) {
228
- const r = num(t), i = Number.isFinite(r), o = !i || r === 0 ? 0 : r > 0 ? 1 : -1, s = n.min ?? 0, a = n.max ?? 0;
160
+ const r = num(t), s = Number.isFinite(r), o = !s || r === 0 ? 0 : r > 0 ? 1 : -1, i = n.min ?? 0, a = n.max ?? 0;
229
161
  if (e.kind === "bar") {
230
- if (!i) return { sign: 0 };
162
+ if (!s) return { sign: 0 };
231
163
  const c = e.axis ?? "zero";
232
164
  let l, f = false;
233
165
  if (c === "zero") {
234
- const d = Math.max(Math.abs(s), Math.abs(a)) || 1, u = Math.abs(r) / d;
166
+ const d = Math.max(Math.abs(i), Math.abs(a)) || 1, u = Math.abs(r) / d;
235
167
  l = clamp01(u), e.clamp && u > 1 && (f = true);
236
168
  } else {
237
- const d = a - s || 1, u = (r - s) / d;
169
+ const d = a - i || 1, u = (r - i) / d;
238
170
  l = clamp01(u), e.clamp && (u < 0 || u > 1) && (f = true);
239
171
  }
240
172
  return { ratio: l, sign: o, value: r, clamped: f };
241
173
  }
242
174
  if (e.kind === "scale") {
243
- if (!i) return { sign: 0 };
175
+ if (!s) return { sign: 0 };
244
176
  const c = e.mode ?? "discrete";
245
177
  let l;
246
178
  if (e.diverging) {
247
- const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (s + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
179
+ const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (i + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
248
180
  if (r <= u) {
249
- const p = u - s || 1;
250
- l = 0.5 * clamp01((r - s) / p);
181
+ const p = u - i || 1;
182
+ l = 0.5 * clamp01((r - i) / p);
251
183
  } else {
252
184
  const p = a - u || 1;
253
185
  l = 0.5 + 0.5 * clamp01((r - u) / p);
254
186
  }
255
187
  } else {
256
- const u = a - s || 1;
257
- l = clamp01((r - s) / u);
188
+ const u = a - i || 1;
189
+ l = clamp01((r - i) / u);
258
190
  }
259
191
  if (c === "continuous") return { ratio: l, sign: o, value: r };
260
192
  const f = e.diverging ? Math.max(3, Math.min(5, e.bands ?? 3)) : Math.max(2, Math.min(5, e.bands ?? 3)), d = Math.min(f - 1, Math.floor(l * f));
261
193
  return { ratio: l, bandIndex: d, bandCount: f, sign: o, value: r };
262
194
  }
263
195
  if (e.kind === "icon") {
264
- if (!i) return { sign: 0 };
265
- const c = e.steps ?? 3, l = a - s || 1, f = clamp01((r - s) / l);
196
+ if (!s) return { sign: 0 };
197
+ const c = e.steps ?? 3, l = a - i || 1, f = clamp01((r - i) / l);
266
198
  let d = Math.min(c - 1, Math.floor(f * c));
267
199
  return e.reverse && (d = c - 1 - d), { bandIndex: d, bandCount: c, ratio: f, sign: o, value: r };
268
200
  }
269
- return i ? { sign: o, value: r } : { sign: o };
201
+ return s ? { sign: o, value: r } : { sign: o };
270
202
  }
271
203
  function predicateFor(e, t) {
272
204
  return e.get(t);
@@ -275,9 +207,9 @@ class DefaultCFEvaluator {
275
207
  constructor(t) {
276
208
  this.ruleTypes = t;
277
209
  }
278
- evaluate(t, n, r, i) {
210
+ evaluate(t, n, r, s) {
279
211
  const o = sortRules(t.filter((u) => scopeMatches(u, n)));
280
- let s;
212
+ let i;
281
213
  const a = [], c = [];
282
214
  let l;
283
215
  for (const u of o) {
@@ -285,20 +217,20 @@ class DefaultCFEvaluator {
285
217
  if (!p) continue;
286
218
  let h = false;
287
219
  try {
288
- h = p.test(u.when, n, r, i);
220
+ h = p.test(u.when, n, r, s);
289
221
  } catch {
290
222
  h = false;
291
223
  }
292
224
  if (!h) continue;
293
- const b = computeDatum(u.encode, n.value, r), m = { ruleId: u.id, conditionType: u.when.type, threshold: thresholdOf(u), inputValue: n.value, statsUsed: snapshotStats(r), priority: u.priority, wonOver: [] }, g = { ruleId: u.id, fired: true, encode: u.encode, datum: b, ...u.style !== void 0 ? { styleRef: u.style } : {}, lineage: m };
294
- if (u.encode.kind === "bar" || u.encode.kind === "scale" ? (s && c.push(s.ruleId), s = g) : a.push(g), u.stopIfTrue) {
225
+ const v = computeDatum(u.encode, n.value, r), m = { ruleId: u.id, conditionType: u.when.type, threshold: thresholdOf(u), inputValue: n.value, statsUsed: snapshotStats(r), priority: u.priority, wonOver: [] }, g = { ruleId: u.id, fired: true, encode: u.encode, datum: v, ...u.style !== void 0 ? { styleRef: u.style } : {}, lineage: m };
226
+ if (u.encode.kind === "bar" || u.encode.kind === "scale" ? (i && c.push(i.ruleId), i = g) : a.push(g), u.stopIfTrue) {
295
227
  l = u.id;
296
228
  break;
297
229
  }
298
230
  }
299
- s && c.length && (s = { ...s, lineage: { ...s.lineage, wonOver: [...c] } });
300
- const f = s ?? a[0], d = { decorators: a };
301
- return s && (d.background = s), f && (d.winner = f), l !== void 0 && (d.stoppedAt = l), d;
231
+ i && c.length && (i = { ...i, lineage: { ...i.lineage, wonOver: [...c] } });
232
+ const f = i ?? a[0], d = { decorators: a };
233
+ return i && (d.background = i), f && (d.winner = f), l !== void 0 && (d.stoppedAt = l), d;
302
234
  }
303
235
  }
304
236
  function thresholdOf(e) {
@@ -326,23 +258,23 @@ function sequentialColor(e, t) {
326
258
  }
327
259
  function sequentialBands(e, t) {
328
260
  const n = Math.max(2, Math.min(5, Math.floor(t))), r = [];
329
- for (let i = 0; i < n; i++) r.push(sequentialColor(e, n === 1 ? 0 : i / (n - 1)));
261
+ for (let s = 0; s < n; s++) r.push(sequentialColor(e, n === 1 ? 0 : s / (n - 1)));
330
262
  return r;
331
263
  }
332
264
  function divergingColor(e, t, n, r = NEUTRAL_MIDPOINT) {
333
- const i = rgb(r);
334
- return n <= 0.5 ? toHex(mix(rgb(e), i, n / 0.5)) : toHex(mix(i, rgb(t), (n - 0.5) / 0.5));
265
+ const s = rgb(r);
266
+ return n <= 0.5 ? toHex(mix(rgb(e), s, n / 0.5)) : toHex(mix(s, rgb(t), (n - 0.5) / 0.5));
335
267
  }
336
268
  function divergingBands(e, t, n, r = NEUTRAL_MIDPOINT) {
337
- const i = Math.max(3, Math.min(5, Math.floor(n))), o = [];
338
- for (let s = 0; s < i; s++) o.push(divergingColor(e, t, i === 1 ? 0.5 : s / (i - 1), r));
269
+ const s = Math.max(3, Math.min(5, Math.floor(n))), o = [];
270
+ for (let i = 0; i < s; i++) o.push(divergingColor(e, t, s === 1 ? 0.5 : i / (s - 1), r));
339
271
  return o;
340
272
  }
341
273
  const AA_BODY = 4.5, BLACK = "#111111", WHITE = "#ffffff";
342
274
  class DefaultInkResolver {
343
275
  pickInk(t) {
344
- const n = OpenGrid.contrastRatio(BLACK, t), r = OpenGrid.contrastRatio(WHITE, t), i = r >= n, o = i ? WHITE : BLACK, s = i ? r : n;
345
- return s >= AA_BODY ? { color: o, ratio: s } : { color: o, outline: true, outlineColor: i ? BLACK : WHITE, ratio: s };
276
+ const n = OpenGrid.contrastRatio(BLACK, t), r = OpenGrid.contrastRatio(WHITE, t), s = r >= n, o = s ? WHITE : BLACK, i = s ? r : n;
277
+ return i >= AA_BODY ? { color: o, ratio: i } : { color: o, outline: true, outlineColor: s ? BLACK : WHITE, ratio: i };
346
278
  }
347
279
  }
348
280
  function passesInkGate(e) {
@@ -360,9 +292,9 @@ class BarEncoder {
360
292
  this.kind = "bar";
361
293
  }
362
294
  encode(t, n, r) {
363
- const i = t.encode, o = t.datum;
295
+ const s = t.encode, o = t.datum;
364
296
  if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
365
- const s = i.seed ?? (o.sign === -1 ? "graphite" : "primary"), a = n.rampFrom(s), l = (i.axis ?? "zero") === "zero" && o.sign === -1 ? "right" : "left", f = ink.pickInk(a), d = o.ratio ?? 0, u = o.clamped ? " (범위 초과·클램프)" : "", p = i.log ? " (log)" : "", h = `값 ${fmt(o.value)}, 막대 ${pct(d)}${o.sign === -1 ? " 음수" : ""}${u}${p}`;
297
+ const i = s.seed ?? (o.sign === -1 ? "graphite" : "primary"), a = n.rampFrom(i), l = (s.axis ?? "zero") === "zero" && o.sign === -1 ? "right" : "left", f = ink.pickInk(a), d = o.ratio ?? 0, u = o.clamped ? " (범위 초과·클램프)" : "", p = s.log ? " (log)" : "", h = `값 ${fmt(o.value)}, 막대 ${pct(d)}${o.sign === -1 ? " 음수" : ""}${u}${p}`;
366
298
  return { layer: "background", fill: { color: a, from: l, ratio: d }, inkColor: f.color, ...f.outline ? { inkOutline: true } : {}, ...o.clamped ? { clamped: true } : {}, ariaSummary: h };
367
299
  }
368
300
  }
@@ -371,20 +303,20 @@ class ScaleEncoder {
371
303
  this.kind = "scale";
372
304
  }
373
305
  encode(t, n, r) {
374
- const i = t.encode, o = t.datum;
306
+ const s = t.encode, o = t.datum;
375
307
  if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
376
- const s = i.mode ?? "discrete";
308
+ const i = s.mode ?? "discrete";
377
309
  let a, c = "";
378
- if (i.diverging) {
310
+ if (s.diverging) {
379
311
  const d = n.rampFrom("graphite"), u = n.rampFrom("primary");
380
- if (s === "continuous") a = divergingColor(d, u, o.ratio ?? 0.5);
312
+ if (i === "continuous") a = divergingColor(d, u, o.ratio ?? 0.5);
381
313
  else {
382
314
  const p = divergingBands(d, u, o.bandCount ?? 3);
383
315
  a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
384
316
  }
385
317
  } else {
386
- const d = i.seed ?? "graphite", u = n.rampFrom(d);
387
- if (s === "continuous") a = sequentialColor(u, o.ratio ?? 0);
318
+ const d = s.seed ?? "graphite", u = n.rampFrom(d);
319
+ if (i === "continuous") a = sequentialColor(u, o.ratio ?? 0);
388
320
  else {
389
321
  const p = sequentialBands(u, o.bandCount ?? 3);
390
322
  a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
@@ -402,9 +334,9 @@ class IconEncoder {
402
334
  this.kind = "icon";
403
335
  }
404
336
  encode(t, n, r) {
405
- const i = t.encode, o = t.datum;
337
+ const s = t.encode, o = t.datum;
406
338
  if (o.value === void 0) return { layer: "decorator", inkColor: MISSING_INK, ariaSummary: "값 없음" };
407
- const s = o.bandCount ?? i.steps ?? 3, a = o.bandIndex ?? 0, c = shapeFor(a, s), l = sequentialBands(n.rampFrom("graphite"), Math.max(2, s)), f = l[Math.min(l.length - 1, a)] ?? l[0], d = `cf-icon-${a}-of-${s}`, u = a <= 0 ? "하위" : a >= s - 1 ? "상위" : "중간", p = `값 ${fmt(o.value)}, ${u} 구간 ${a + 1}/${s} (${c})`;
339
+ const i = o.bandCount ?? s.steps ?? 3, a = o.bandIndex ?? 0, c = shapeFor(a, i), l = sequentialBands(n.rampFrom("graphite"), Math.max(2, i)), f = l[Math.min(l.length - 1, a)] ?? l[0], d = `cf-icon-${a}-of-${i}`, u = a <= 0 ? "하위" : a >= i - 1 ? "상위" : "중간", p = `값 ${fmt(o.value)}, ${u} 구간 ${a + 1}/${i} (${c})`;
408
340
  return { layer: "decorator", glyph: { role: d, tint: f, shape: c }, inkColor: f, ariaSummary: p };
409
341
  }
410
342
  }
@@ -413,53 +345,53 @@ class SparklineEncoder {
413
345
  this.kind = "sparkline";
414
346
  }
415
347
  encode(t, n, r) {
416
- const i = t.encode, o = t.datum;
417
- return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${i.chart ?? "line"} 스파크, 값 ${fmt(o.value)}` };
348
+ const s = t.encode, o = t.datum;
349
+ return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${s.chart ?? "line"} 스파크, 값 ${fmt(o.value)}` };
418
350
  }
419
351
  }
420
352
  function createEncoderRegistry() {
421
- const e = new TypedRegistry({ spi: { name: "CFEncoder", version: "1" } });
353
+ const e = new Registry.TypedRegistry({ spi: { name: "CFEncoder", version: "1" } });
422
354
  return e.register("bar", new BarEncoder(), { origin: "builtin" }), e.register("scale", new ScaleEncoder(), { origin: "builtin" }), e.register("icon", new IconEncoder(), { origin: "builtin" }), e.register("sparkline", new SparklineEncoder(), { origin: "builtin" }), e;
423
355
  }
424
356
  function createNamedStyleRegistry() {
425
- return new TypedRegistry({ spi: { name: "CFNamedStyle", version: "1" } });
357
+ return new Registry.TypedRegistry({ spi: { name: "CFNamedStyle", version: "1" } });
426
358
  }
427
359
  function isObj(e) {
428
360
  return typeof e == "object" && e !== null;
429
361
  }
430
362
  class DefaultCFRuleLoader {
431
363
  load(t, n) {
432
- const r = [], i = [], o = Array.isArray(t) ? t : isObj(t) && Array.isArray(t.rules) ? t.rules : [];
433
- for (const s of o) {
434
- if (!isObj(s)) {
435
- i.push({ ruleId: "?", reason: "malformed", detail: "not an object" });
364
+ const r = [], s = [], o = Array.isArray(t) ? t : isObj(t) && Array.isArray(t.rules) ? t.rules : [];
365
+ for (const i of o) {
366
+ if (!isObj(i)) {
367
+ s.push({ ruleId: "?", reason: "malformed", detail: "not an object" });
436
368
  continue;
437
369
  }
438
- const a = typeof s.id == "string" ? s.id : "?", c = s.when, l = s.encode, f = s.scope;
439
- if (typeof s.v == "number" && s.v > CF_SCHEMA_VERSION) {
440
- i.push({ ruleId: a, reason: "future-version", detail: `v${s.v} > ${CF_SCHEMA_VERSION}` });
370
+ const a = typeof i.id == "string" ? i.id : "?", c = i.when, l = i.encode, f = i.scope;
371
+ if (typeof i.v == "number" && i.v > CF_SCHEMA_VERSION) {
372
+ s.push({ ruleId: a, reason: "future-version", detail: `v${i.v} > ${CF_SCHEMA_VERSION}` });
441
373
  continue;
442
374
  }
443
375
  if (!isObj(c) || typeof c.type != "string" || !isObj(l) || typeof l.kind != "string" || !isObj(f) || typeof f.columnId != "string") {
444
- i.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
376
+ s.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
445
377
  continue;
446
378
  }
447
379
  if (!n.types.has(c.type)) {
448
- i.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
380
+ s.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
449
381
  continue;
450
382
  }
451
383
  if (!n.encoders.has(l.kind)) {
452
- i.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
384
+ s.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
453
385
  continue;
454
386
  }
455
- const d = s.style;
387
+ const d = i.style;
456
388
  if (isStyleRef(d) && !n.styles.has(d.ref)) {
457
- i.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
389
+ s.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
458
390
  continue;
459
391
  }
460
- r.push(s);
392
+ r.push(i);
461
393
  }
462
- return { rules: r, skipped: i };
394
+ return { rules: r, skipped: s };
463
395
  }
464
396
  }
465
397
  function serializeRules(e) {
@@ -483,38 +415,38 @@ class CFRuleStore {
483
415
  }
484
416
  }
485
417
  class CFEngine {
486
- constructor(t, n = createEncoderRegistry(), r = createRuleTypeRegistry(), i) {
487
- this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = i ?? new DefaultCFEvaluator(r);
418
+ constructor(t, n = createEncoderRegistry(), r = createRuleTypeRegistry(), s) {
419
+ this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = s ?? new DefaultCFEvaluator(r);
488
420
  }
489
421
  get lineage() {
490
422
  return this;
491
423
  }
492
- paintFor(t, n, r, i, o) {
493
- const s = this.evaluator.evaluate(this.rules.rulesFor(t.columnId), t, n, o), a = [];
494
- if (s.background) {
495
- const c = this.encoders.get(s.background.encode.kind);
496
- c && a.push(c.encode(s.background, r, i));
424
+ paintFor(t, n, r, s, o) {
425
+ const i = this.evaluator.evaluate(this.rules.rulesFor(t.columnId), t, n, o), a = [];
426
+ if (i.background) {
427
+ const c = this.encoders.get(i.background.encode.kind);
428
+ c && a.push(c.encode(i.background, r, s));
497
429
  }
498
- for (const c of s.decorators) {
430
+ for (const c of i.decorators) {
499
431
  const l = this.encoders.get(c.encode.kind);
500
- l && a.push(l.encode(c, r, i));
432
+ l && a.push(l.encode(c, r, s));
501
433
  }
502
434
  return a;
503
435
  }
504
436
  statsNeedsFor(t) {
505
437
  const n = /* @__PURE__ */ new Set();
506
438
  for (const r of this.rules.rulesFor(t)) {
507
- const i = this.ruleTypes.get(r.when.type);
508
- if (i) for (const o of i.needs) n.add(o);
439
+ const s = this.ruleTypes.get(r.when.type);
440
+ if (s) for (const o of s.needs) n.add(o);
509
441
  }
510
442
  return [...n].sort();
511
443
  }
512
- explain(t, n, r, i) {
513
- const o = this.evaluator.evaluate(n, t, r, i), s = [];
514
- o.background && s.push(o.background.lineage);
515
- for (const a of o.decorators) s.push(a.lineage);
516
- return s.sort((a, c) => a.priority - c.priority);
444
+ explain(t, n, r, s) {
445
+ const o = this.evaluator.evaluate(n, t, r, s), i = [];
446
+ o.background && i.push(o.background.lineage);
447
+ for (const a of o.decorators) i.push(a.lineage);
448
+ return i.sort((a, c) => a.priority - c.priority);
517
449
  }
518
450
  }
519
451
  exports.AA_BODY = AA_BODY, exports.BUILTIN_PREDICATES = BUILTIN_PREDICATES, exports.BarEncoder = BarEncoder, exports.CFEngine = CFEngine, exports.CFRuleStore = CFRuleStore, exports.CF_SCHEMA_VERSION = CF_SCHEMA_VERSION, exports.DefaultCFEvaluator = DefaultCFEvaluator, exports.DefaultCFRuleLoader = DefaultCFRuleLoader, exports.DefaultInkResolver = DefaultInkResolver, exports.IconEncoder = IconEncoder, exports.NEUTRAL_MIDPOINT = NEUTRAL_MIDPOINT, exports.ScaleEncoder = ScaleEncoder, exports.SparklineEncoder = SparklineEncoder, exports.cfRuleEquals = cfRuleEquals, exports.computeColumnStats = computeColumnStats, exports.computeDatum = computeDatum, exports.createEncoderRegistry = createEncoderRegistry, exports.createNamedStyleRegistry = createNamedStyleRegistry, exports.createRuleTypeRegistry = createRuleTypeRegistry, exports.divergingBands = divergingBands, exports.divergingColor = divergingColor, exports.isStyleRef = isStyleRef, exports.passesInkGate = passesInkGate, exports.scopeMatches = scopeMatches, exports.sequentialBands = sequentialBands, exports.sequentialColor = sequentialColor, exports.serializeRules = serializeRules, exports.snapshotStats = snapshotStats, exports.staticAppearanceView = staticAppearanceView;
520
- //# sourceMappingURL=index-JjfWY3Bt.cjs.map
452
+ //# sourceMappingURL=index-D1l3XFCM.cjs.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime"), React = require("react"), OpenGrid = require("./OpenGrid-B7m7ei7f.cjs");
3
+ const jsxRuntime = require("react/jsx-runtime"), React = require("react"), OpenGrid = require("./OpenGrid-BOtTt5aI.cjs");
4
4
  function OpenGridReact({ data: e, columns: r, height: t = 400, width: u = "100%", editable: i = false, sortable: p = true, filterable: o = true, rowNumber: l = false, checkColumn: d = false, stateColumn: y = false, draggable: R = false, frozenColumns: x = 0, theme: s = "default", options: E, style: T, className: $, onReady: g, onDataChange: O, onCellClick: G, onRowClick: j, onEditEnd: a, onSortChange: b, onFilterChange: q, onRowDrop: S }) {
5
5
  const c = React.useRef(null), n = React.useRef(null), M = { height: typeof t == "number" ? `${t}px` : t, width: typeof u == "number" ? `${u}px` : u, display: "block", boxSizing: "border-box", ...T };
6
6
  return React.useEffect(() => {
@@ -1,6 +1,6 @@
1
1
  import { jsx as W } from "react/jsx-runtime";
2
2
  import J, { useRef as u, useEffect as f } from "react";
3
- import { O as K } from "./OpenGrid-CeUdO_fM.js";
3
+ import { O as K } from "./OpenGrid-sI_vdHQw.js";
4
4
  function q({ data: r, columns: e, height: t = 400, width: c = "100%", editable: o = false, sortable: l = true, filterable: y = true, rowNumber: d = false, checkColumn: O = false, stateColumn: R = false, draggable: x = false, frozenColumns: G = 0, theme: s = "default", options: z, style: A, className: B, onReady: D, onDataChange: m, onCellClick: a, onRowClick: $, onEditEnd: b, onSortChange: j, onFilterChange: v, onRowDrop: S }) {
5
5
  const i = u(null), n = u(null), H = { height: typeof t == "number" ? `${t}px` : t, width: typeof c == "number" ? `${c}px` : c, display: "block", boxSizing: "border-box", ...A };
6
6
  return f(() => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue"), OpenGrid$1 = require("./OpenGrid-B7m7ei7f.cjs"), _sfc_main = vue.defineComponent({ __name: "OpenGrid", props: { data: { default: () => [] }, columns: {}, height: { default: 400 }, width: { default: "100%" }, editable: { type: Boolean, default: false }, sortable: { type: Boolean, default: true }, filterable: { type: Boolean, default: true }, rowNumber: { type: Boolean, default: false }, checkColumn: { type: Boolean, default: false }, stateColumn: { type: Boolean, default: false }, draggable: { type: Boolean, default: false }, frozenColumns: { default: 0 }, theme: { default: "default" }, options: {} }, emits: ["update:data", "ready", "cell-click", "row-click", "edit-end", "sort-change", "filter-change", "row-check"], setup(n, { expose: u, emit: r }) {
3
+ const vue = require("vue"), OpenGrid$1 = require("./OpenGrid-BOtTt5aI.cjs"), _sfc_main = vue.defineComponent({ __name: "OpenGrid", props: { data: { default: () => [] }, columns: {}, height: { default: 400 }, width: { default: "100%" }, editable: { type: Boolean, default: false }, sortable: { type: Boolean, default: true }, filterable: { type: Boolean, default: true }, rowNumber: { type: Boolean, default: false }, checkColumn: { type: Boolean, default: false }, stateColumn: { type: Boolean, default: false }, draggable: { type: Boolean, default: false }, frozenColumns: { default: 0 }, theme: { default: "default" }, options: {} }, emits: ["update:data", "ready", "cell-click", "row-click", "edit-end", "sort-change", "filter-change", "row-check"], setup(n, { expose: u, emit: r }) {
4
4
  const e = n, o = r, c = vue.ref(), a = vue.shallowRef(null);
5
5
  let i = null;
6
6
  const s = vue.computed(() => ({ height: typeof e.height == "number" ? `${e.height}px` : e.height, width: typeof e.width == "number" ? `${e.width}px` : e.width }));
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as f, ref as p, shallowRef as m, computed as h, onMounted as g, watch as d, onUnmounted as y, openBlock as b, createElementBlock as v, normalizeStyle as C } from "vue";
2
- import { O as k } from "./OpenGrid-CeUdO_fM.js";
2
+ import { O as k } from "./OpenGrid-sI_vdHQw.js";
3
3
  const w = f({ __name: "OpenGrid", props: { data: { default: () => [] }, columns: {}, height: { default: 400 }, width: { default: "100%" }, editable: { type: Boolean, default: false }, sortable: { type: Boolean, default: true }, filterable: { type: Boolean, default: true }, rowNumber: { type: Boolean, default: false }, checkColumn: { type: Boolean, default: false }, stateColumn: { type: Boolean, default: false }, draggable: { type: Boolean, default: false }, frozenColumns: { default: 0 }, theme: { default: "default" }, options: {} }, emits: ["update:data", "ready", "cell-click", "row-click", "edit-end", "sort-change", "filter-change", "row-check"], setup(n, { expose: u, emit: r }) {
4
4
  const e = n, o = r, c = p(), a = m(null);
5
5
  let i = null;