open-grid 1.7.0 → 1.7.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/CHANGELOG.md +34 -0
- package/dist/ExportProgressView-BYPw8osg.cjs +2 -0
- package/dist/ExportProgressView-Bt5-z7rE.js +2 -0
- package/dist/LcpMergeOrderer-CeP6C6G1.cjs +2 -0
- package/dist/LcpMergeOrderer-Ebwuir-r.js +2 -0
- package/dist/OpenGrid-Bh1NMOcm.cjs +98 -0
- package/dist/OpenGrid-CeXt04ho.js +98 -0
- package/dist/Registry-CrT46EAO.js +2 -0
- package/dist/Registry-DpHOpU5V.cjs +2 -0
- package/dist/XlsxChannel-CuOZ3LQz.js +2 -0
- package/dist/XlsxChannel-DQHLGend.cjs +2 -0
- package/dist/XlsxWorkbookWriter-DixuNGtw.cjs +3 -0
- package/dist/XlsxWorkbookWriter-VgbibI0Z.js +3 -0
- package/dist/fflate-Cs3txMgg.js +2 -0
- package/dist/fflate-G9RAFEgF.cjs +2 -0
- package/dist/index-1OXjJmct.js +2 -0
- package/dist/index-B5V7e4Xc.js +2 -0
- package/dist/index-DbKDox8y.cjs +2 -0
- package/dist/index-HaDoF1HM.cjs +2 -0
- package/dist/open-grid-react.cjs +1 -27
- package/dist/open-grid-react.js +1 -30
- package/dist/open-grid-vue.cjs +1 -31
- package/dist/open-grid-vue.js +1 -33
- package/dist/open-grid.cjs +6 -275
- package/dist/open-grid.js +6 -293
- package/dist/sinks-BCZFMGQJ.cjs +2 -0
- package/dist/sinks-qkBJ5bKn.js +2 -0
- package/dist/types/core/ExportManager.d.ts +1 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +9 -1
- package/dist/types/core/export/channels/XlsxRichTextRun.d.ts +14 -0
- package/dist/types/core/export/channels/XlsxSheetXml.d.ts +19 -0
- package/dist/types/core/export/channels/XlsxStyleEntries.d.ts +80 -0
- package/dist/types/core/export/channels/XlsxStylesRegistry.d.ts +20 -0
- package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +7 -4
- package/dist/types/core/export/channels/XlsxXml.d.ts +6 -0
- package/dist/types/core/export/types.d.ts +63 -0
- package/dist/types/core/types.d.ts +24 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/xlsx.min-CMvrM6b4.cjs +138 -0
- package/dist/xlsx.min-i_b-4PvU.js +138 -0
- package/package.json +2 -1
- package/dist/ExportProgressView-9Kt1SQxv.js +0 -48
- package/dist/ExportProgressView-B59uHIwt.cjs +0 -48
- package/dist/LcpMergeOrderer-BdUtV67j.js +0 -114
- package/dist/LcpMergeOrderer-C_ANVkGk.cjs +0 -113
- package/dist/OpenGrid-BUYQs1_w.cjs +0 -9806
- package/dist/OpenGrid-BmagF0yo.js +0 -9819
- package/dist/Registry-CPJYOqCn.js +0 -74
- package/dist/Registry-D74ZmdDz.cjs +0 -71
- package/dist/XlsxChannel-DOeHeP7h.cjs +0 -95
- package/dist/XlsxChannel-DdaiytFR.js +0 -95
- package/dist/XlsxWorkbookWriter-BTNtZ80J.js +0 -199
- package/dist/XlsxWorkbookWriter-_u5stfg4.cjs +0 -198
- package/dist/index-B9_g5Eg3.js +0 -481
- package/dist/index-CeJ-0-80.cjs +0 -260
- package/dist/index-CnyumyPV.cjs +0 -452
- package/dist/index-DnarQ4eR.js +0 -266
- package/dist/sinks-BWkWQexV.js +0 -149
- package/dist/sinks-DPK0VxYG.cjs +0 -143
- package/dist/xlsx.min-BQ1o3sB6.cjs +0 -11793
- package/dist/xlsx.min-Bbz2ZypC.js +0 -11794
package/dist/index-CnyumyPV.cjs
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Registry = require("./Registry-D74ZmdDz.cjs"), OpenGrid = require("./OpenGrid-BUYQs1_w.cjs");
|
|
4
|
-
function isStyleRef(e) {
|
|
5
|
-
return !!e && typeof e.ref == "string";
|
|
6
|
-
}
|
|
7
|
-
const CF_SCHEMA_VERSION = 1;
|
|
8
|
-
function cfRuleEquals(e, t) {
|
|
9
|
-
return JSON.stringify(e) === JSON.stringify(t);
|
|
10
|
-
}
|
|
11
|
-
function staticAppearanceView(e) {
|
|
12
|
-
const t = (e == null ? void 0 : e.primary) ?? "#1976d2", n = (e == null ? void 0 : e.graphite) ?? "#3a3f45";
|
|
13
|
-
return { rampFrom: (r) => r === "primary" ? t : n };
|
|
14
|
-
}
|
|
15
|
-
function numeric(e) {
|
|
16
|
-
const t = [];
|
|
17
|
-
for (const n of e) {
|
|
18
|
-
const r = typeof n == "number" ? n : typeof n == "string" && n.trim() !== "" ? Number(n) : NaN;
|
|
19
|
-
Number.isFinite(r) && t.push(r);
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
}
|
|
23
|
-
function computeColumnStats(e) {
|
|
24
|
-
const t = numeric(e), n = t.length;
|
|
25
|
-
if (n === 0) return { count: 0, distinct: 0 };
|
|
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
|
-
for (const m of t) f.set(m, (f.get(m) ?? 0) + 1);
|
|
28
|
-
const d = f.size;
|
|
29
|
-
return { min: s, max: o, avg: a, stddev: l, count: n, distinct: d, rankOf: (m) => {
|
|
30
|
-
let g = 0;
|
|
31
|
-
for (const y of t) y > m && g++;
|
|
32
|
-
return g + 1;
|
|
33
|
-
}, rankAscOf: (m) => {
|
|
34
|
-
let g = 0;
|
|
35
|
-
for (const y of t) y < m && g++;
|
|
36
|
-
return g + 1;
|
|
37
|
-
}, percentileOf: (m) => {
|
|
38
|
-
let g = 0;
|
|
39
|
-
for (const y of t) y <= m && g++;
|
|
40
|
-
return g / n;
|
|
41
|
-
}, countOf: (m) => f.get(m) ?? 0 };
|
|
42
|
-
}
|
|
43
|
-
function snapshotStats(e) {
|
|
44
|
-
const t = {};
|
|
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
|
-
}
|
|
47
|
-
function num$1(e) {
|
|
48
|
-
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
49
|
-
}
|
|
50
|
-
const DAY = 864e5;
|
|
51
|
-
function startOfDay(e) {
|
|
52
|
-
const t = new Date(e);
|
|
53
|
-
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
54
|
-
}
|
|
55
|
-
function startOfWeek(e) {
|
|
56
|
-
const t = startOfDay(e), n = new Date(t).getDay();
|
|
57
|
-
return t - n * DAY;
|
|
58
|
-
}
|
|
59
|
-
const comparePredicate = { needs: [], test(e, t) {
|
|
60
|
-
const n = num$1(t.value);
|
|
61
|
-
if (!Number.isFinite(n)) return false;
|
|
62
|
-
switch (e.op) {
|
|
63
|
-
case ">":
|
|
64
|
-
return n > e.a;
|
|
65
|
-
case ">=":
|
|
66
|
-
return n >= e.a;
|
|
67
|
-
case "<":
|
|
68
|
-
return n < e.a;
|
|
69
|
-
case "<=":
|
|
70
|
-
return n <= e.a;
|
|
71
|
-
case "=":
|
|
72
|
-
return n === e.a;
|
|
73
|
-
case "!=":
|
|
74
|
-
return n !== e.a;
|
|
75
|
-
case "between":
|
|
76
|
-
return e.b !== void 0 && n >= Math.min(e.a, e.b) && n <= Math.max(e.a, e.b);
|
|
77
|
-
default:
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
} }, textContainsPredicate = { needs: [], test(e, t) {
|
|
81
|
-
const n = t.value == null ? "" : String(t.value);
|
|
82
|
-
return e.ci === false ? n.includes(e.text) : n.toLowerCase().includes(e.text.toLowerCase());
|
|
83
|
-
} }, dateOccurringPredicate = { needs: [], test(e, t, n, r) {
|
|
84
|
-
const s = t.value, o = s instanceof Date ? s.getTime() : typeof s == "number" ? s : Date.parse(String(s));
|
|
85
|
-
if (!Number.isFinite(o)) return false;
|
|
86
|
-
const i = r.now, a = startOfDay(i);
|
|
87
|
-
switch (e.rel) {
|
|
88
|
-
case "today":
|
|
89
|
-
return startOfDay(o) === a;
|
|
90
|
-
case "yesterday":
|
|
91
|
-
return startOfDay(o) === a - DAY;
|
|
92
|
-
case "tomorrow":
|
|
93
|
-
return startOfDay(o) === a + DAY;
|
|
94
|
-
case "thisWeek": {
|
|
95
|
-
const c = startOfWeek(i);
|
|
96
|
-
return o >= c && o < c + 7 * DAY;
|
|
97
|
-
}
|
|
98
|
-
case "lastWeek": {
|
|
99
|
-
const c = startOfWeek(i) - 7 * DAY;
|
|
100
|
-
return o >= c && o < c + 7 * DAY;
|
|
101
|
-
}
|
|
102
|
-
case "thisMonth": {
|
|
103
|
-
const c = new Date(i);
|
|
104
|
-
return new Date(o).getFullYear() === c.getFullYear() && new Date(o).getMonth() === c.getMonth();
|
|
105
|
-
}
|
|
106
|
-
case "lastMonth": {
|
|
107
|
-
const c = new Date(i.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
|
|
108
|
-
return new Date(o).getFullYear() === l.getFullYear() && new Date(o).getMonth() === l.getMonth();
|
|
109
|
-
}
|
|
110
|
-
case "next7d":
|
|
111
|
-
return o >= a && o < a + 7 * DAY;
|
|
112
|
-
case "last7d":
|
|
113
|
-
return o < a + DAY && o >= a - 6 * DAY;
|
|
114
|
-
default:
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
} }, topNPredicate = { needs: ["rank"], test(e, t, n) {
|
|
118
|
-
const r = num$1(t.value);
|
|
119
|
-
return Number.isFinite(r) ? e.bottom ? n.rankAscOf ? n.rankAscOf(r) <= e.n : false : n.rankOf ? n.rankOf(r) <= e.n : false : false;
|
|
120
|
-
} }, topNpctPredicate = { needs: ["percentile"], test(e, t, n) {
|
|
121
|
-
const r = num$1(t.value);
|
|
122
|
-
if (!Number.isFinite(r) || !n.percentileOf) return false;
|
|
123
|
-
const s = n.percentileOf(r);
|
|
124
|
-
return e.bottom ? s <= e.pct / 100 : s >= 1 - e.pct / 100;
|
|
125
|
-
} }, aboveAvgPredicate = { needs: ["avg"], test(e, t, n) {
|
|
126
|
-
const r = num$1(t.value);
|
|
127
|
-
return !Number.isFinite(r) || n.avg === void 0 ? false : e.below ? r < n.avg : r > n.avg;
|
|
128
|
-
} }, stdBandPredicate = { needs: ["avg", "stddev"], test(e, t, n) {
|
|
129
|
-
const r = num$1(t.value);
|
|
130
|
-
if (!Number.isFinite(r) || n.avg === void 0 || n.stddev === void 0) return false;
|
|
131
|
-
const s = Math.abs(r - n.avg), o = e.k * n.stddev;
|
|
132
|
-
return e.outside === false ? s <= o : s >= o;
|
|
133
|
-
} }, duplicatePredicate = { needs: ["cardinality"], test(e, t, n) {
|
|
134
|
-
const r = num$1(t.value);
|
|
135
|
-
if (!Number.isFinite(r) || !n.countOf) return false;
|
|
136
|
-
const s = n.countOf(r);
|
|
137
|
-
return e.unique ? s === 1 : s > 1;
|
|
138
|
-
} }, customFallbackPredicate = { needs: [], test() {
|
|
139
|
-
return false;
|
|
140
|
-
} }, BUILTIN_PREDICATES = Object.freeze({ compare: comparePredicate, textContains: textContainsPredicate, dateOccurring: dateOccurringPredicate, topN: topNPredicate, topNpct: topNpctPredicate, aboveAvg: aboveAvgPredicate, stdBand: stdBandPredicate, duplicate: duplicatePredicate, custom: customFallbackPredicate });
|
|
141
|
-
function createRuleTypeRegistry() {
|
|
142
|
-
const e = new Registry.TypedRegistry({ spi: { name: "CFPredicate", version: "1" } });
|
|
143
|
-
for (const [t, n] of Object.entries(BUILTIN_PREDICATES)) e.register(t, n, { origin: "builtin" });
|
|
144
|
-
return e;
|
|
145
|
-
}
|
|
146
|
-
function scopeMatches(e, t) {
|
|
147
|
-
const n = e.scope;
|
|
148
|
-
return !(n.columnId !== t.columnId || n.range && (t.rowIndex < n.range.startRow || t.rowIndex >= n.range.endRow) || n.rowState && n.rowState !== t.rowState);
|
|
149
|
-
}
|
|
150
|
-
function sortRules(e) {
|
|
151
|
-
return [...e].sort((t, n) => t.priority - n.priority || (t.id < n.id ? -1 : t.id > n.id ? 1 : 0));
|
|
152
|
-
}
|
|
153
|
-
function num(e) {
|
|
154
|
-
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
155
|
-
}
|
|
156
|
-
function clamp01(e) {
|
|
157
|
-
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
158
|
-
}
|
|
159
|
-
function computeDatum(e, t, n) {
|
|
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;
|
|
161
|
-
if (e.kind === "bar") {
|
|
162
|
-
if (!s) return { sign: 0 };
|
|
163
|
-
const c = e.axis ?? "zero";
|
|
164
|
-
let l, f = false;
|
|
165
|
-
if (c === "zero") {
|
|
166
|
-
const d = Math.max(Math.abs(i), Math.abs(a)) || 1, u = Math.abs(r) / d;
|
|
167
|
-
l = clamp01(u), e.clamp && u > 1 && (f = true);
|
|
168
|
-
} else {
|
|
169
|
-
const d = a - i || 1, u = (r - i) / d;
|
|
170
|
-
l = clamp01(u), e.clamp && (u < 0 || u > 1) && (f = true);
|
|
171
|
-
}
|
|
172
|
-
return { ratio: l, sign: o, value: r, clamped: f };
|
|
173
|
-
}
|
|
174
|
-
if (e.kind === "scale") {
|
|
175
|
-
if (!s) return { sign: 0 };
|
|
176
|
-
const c = e.mode ?? "discrete";
|
|
177
|
-
let l;
|
|
178
|
-
if (e.diverging) {
|
|
179
|
-
const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (i + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
|
|
180
|
-
if (r <= u) {
|
|
181
|
-
const p = u - i || 1;
|
|
182
|
-
l = 0.5 * clamp01((r - i) / p);
|
|
183
|
-
} else {
|
|
184
|
-
const p = a - u || 1;
|
|
185
|
-
l = 0.5 + 0.5 * clamp01((r - u) / p);
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
const u = a - i || 1;
|
|
189
|
-
l = clamp01((r - i) / u);
|
|
190
|
-
}
|
|
191
|
-
if (c === "continuous") return { ratio: l, sign: o, value: r };
|
|
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));
|
|
193
|
-
return { ratio: l, bandIndex: d, bandCount: f, sign: o, value: r };
|
|
194
|
-
}
|
|
195
|
-
if (e.kind === "icon") {
|
|
196
|
-
if (!s) return { sign: 0 };
|
|
197
|
-
const c = e.steps ?? 3, l = a - i || 1, f = clamp01((r - i) / l);
|
|
198
|
-
let d = Math.min(c - 1, Math.floor(f * c));
|
|
199
|
-
return e.reverse && (d = c - 1 - d), { bandIndex: d, bandCount: c, ratio: f, sign: o, value: r };
|
|
200
|
-
}
|
|
201
|
-
return s ? { sign: o, value: r } : { sign: o };
|
|
202
|
-
}
|
|
203
|
-
function predicateFor(e, t) {
|
|
204
|
-
return e.get(t);
|
|
205
|
-
}
|
|
206
|
-
class DefaultCFEvaluator {
|
|
207
|
-
constructor(t) {
|
|
208
|
-
this.ruleTypes = t;
|
|
209
|
-
}
|
|
210
|
-
evaluate(t, n, r, s) {
|
|
211
|
-
const o = sortRules(t.filter((u) => scopeMatches(u, n)));
|
|
212
|
-
let i;
|
|
213
|
-
const a = [], c = [];
|
|
214
|
-
let l;
|
|
215
|
-
for (const u of o) {
|
|
216
|
-
const p = predicateFor(this.ruleTypes, u.when.type);
|
|
217
|
-
if (!p) continue;
|
|
218
|
-
let h = false;
|
|
219
|
-
try {
|
|
220
|
-
h = p.test(u.when, n, r, s);
|
|
221
|
-
} catch {
|
|
222
|
-
h = false;
|
|
223
|
-
}
|
|
224
|
-
if (!h) continue;
|
|
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) {
|
|
227
|
-
l = u.id;
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
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;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function thresholdOf(e) {
|
|
237
|
-
const { type: t, ...n } = e.when;
|
|
238
|
-
return n;
|
|
239
|
-
}
|
|
240
|
-
const NEUTRAL_MIDPOINT = "#f4f5f6";
|
|
241
|
-
function toHex(e) {
|
|
242
|
-
const t = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
243
|
-
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
244
|
-
}
|
|
245
|
-
function mix(e, t, n) {
|
|
246
|
-
const r = n < 0 ? 0 : n > 1 ? 1 : n;
|
|
247
|
-
return { r: e.r + (t.r - e.r) * r, g: e.g + (t.g - e.g) * r, b: e.b + (t.b - e.b) * r };
|
|
248
|
-
}
|
|
249
|
-
function rgb(e) {
|
|
250
|
-
return OpenGrid.parseColor(e) ?? { r: 58, g: 63, b: 69 };
|
|
251
|
-
}
|
|
252
|
-
function lightAnchorOf(e) {
|
|
253
|
-
return mix({ r: 255, g: 255, b: 255 }, e, 0.08);
|
|
254
|
-
}
|
|
255
|
-
function sequentialColor(e, t) {
|
|
256
|
-
const n = rgb(e);
|
|
257
|
-
return toHex(mix(lightAnchorOf(n), n, t));
|
|
258
|
-
}
|
|
259
|
-
function sequentialBands(e, t) {
|
|
260
|
-
const n = Math.max(2, Math.min(5, Math.floor(t))), r = [];
|
|
261
|
-
for (let s = 0; s < n; s++) r.push(sequentialColor(e, n === 1 ? 0 : s / (n - 1)));
|
|
262
|
-
return r;
|
|
263
|
-
}
|
|
264
|
-
function divergingColor(e, t, n, r = NEUTRAL_MIDPOINT) {
|
|
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));
|
|
267
|
-
}
|
|
268
|
-
function divergingBands(e, t, n, r = NEUTRAL_MIDPOINT) {
|
|
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));
|
|
271
|
-
return o;
|
|
272
|
-
}
|
|
273
|
-
const AA_BODY = 4.5, BLACK = "#111111", WHITE = "#ffffff";
|
|
274
|
-
class DefaultInkResolver {
|
|
275
|
-
pickInk(t) {
|
|
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 };
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function passesInkGate(e) {
|
|
281
|
-
return Math.max(OpenGrid.contrastRatio(BLACK, e), OpenGrid.contrastRatio(WHITE, e)) >= AA_BODY;
|
|
282
|
-
}
|
|
283
|
-
const ink = new DefaultInkResolver(), MISSING_INK = "#111111";
|
|
284
|
-
function fmt(e) {
|
|
285
|
-
return e === void 0 || !Number.isFinite(e) ? "—" : Number.isInteger(e) ? String(e) : String(Math.round(e * 1e3) / 1e3);
|
|
286
|
-
}
|
|
287
|
-
function pct(e) {
|
|
288
|
-
return e === void 0 ? "—" : `${Math.round(e * 100)}%`;
|
|
289
|
-
}
|
|
290
|
-
class BarEncoder {
|
|
291
|
-
constructor() {
|
|
292
|
-
this.kind = "bar";
|
|
293
|
-
}
|
|
294
|
-
encode(t, n, r) {
|
|
295
|
-
const s = t.encode, o = t.datum;
|
|
296
|
-
if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
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}`;
|
|
298
|
-
return { layer: "background", fill: { color: a, from: l, ratio: d }, inkColor: f.color, ...f.outline ? { inkOutline: true } : {}, ...o.clamped ? { clamped: true } : {}, ariaSummary: h };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
class ScaleEncoder {
|
|
302
|
-
constructor() {
|
|
303
|
-
this.kind = "scale";
|
|
304
|
-
}
|
|
305
|
-
encode(t, n, r) {
|
|
306
|
-
const s = t.encode, o = t.datum;
|
|
307
|
-
if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
308
|
-
const i = s.mode ?? "discrete";
|
|
309
|
-
let a, c = "";
|
|
310
|
-
if (s.diverging) {
|
|
311
|
-
const d = n.rampFrom("graphite"), u = n.rampFrom("primary");
|
|
312
|
-
if (i === "continuous") a = divergingColor(d, u, o.ratio ?? 0.5);
|
|
313
|
-
else {
|
|
314
|
-
const p = divergingBands(d, u, o.bandCount ?? 3);
|
|
315
|
-
a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
|
|
316
|
-
}
|
|
317
|
-
} else {
|
|
318
|
-
const d = s.seed ?? "graphite", u = n.rampFrom(d);
|
|
319
|
-
if (i === "continuous") a = sequentialColor(u, o.ratio ?? 0);
|
|
320
|
-
else {
|
|
321
|
-
const p = sequentialBands(u, o.bandCount ?? 3);
|
|
322
|
-
a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
const l = ink.pickInk(a), f = `값 ${fmt(o.value)}, 히트맵 ${pct(o.ratio)}${c}`;
|
|
326
|
-
return { layer: "background", fill: { color: a, ratio: o.ratio ?? 0 }, inkColor: l.color, ...l.outline ? { inkOutline: true } : {}, ariaSummary: f };
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function shapeFor(e, t) {
|
|
330
|
-
return t <= 1 ? "circle" : e <= 0 ? "triangleDown" : e >= t - 1 ? "triangleUp" : "circle";
|
|
331
|
-
}
|
|
332
|
-
class IconEncoder {
|
|
333
|
-
constructor() {
|
|
334
|
-
this.kind = "icon";
|
|
335
|
-
}
|
|
336
|
-
encode(t, n, r) {
|
|
337
|
-
const s = t.encode, o = t.datum;
|
|
338
|
-
if (o.value === void 0) return { layer: "decorator", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
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})`;
|
|
340
|
-
return { layer: "decorator", glyph: { role: d, tint: f, shape: c }, inkColor: f, ariaSummary: p };
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
class SparklineEncoder {
|
|
344
|
-
constructor() {
|
|
345
|
-
this.kind = "sparkline";
|
|
346
|
-
}
|
|
347
|
-
encode(t, n, r) {
|
|
348
|
-
const s = t.encode, o = t.datum;
|
|
349
|
-
return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${s.chart ?? "line"} 스파크, 값 ${fmt(o.value)}` };
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function createEncoderRegistry() {
|
|
353
|
-
const e = new Registry.TypedRegistry({ spi: { name: "CFEncoder", version: "1" } });
|
|
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;
|
|
355
|
-
}
|
|
356
|
-
function createNamedStyleRegistry() {
|
|
357
|
-
return new Registry.TypedRegistry({ spi: { name: "CFNamedStyle", version: "1" } });
|
|
358
|
-
}
|
|
359
|
-
function isObj(e) {
|
|
360
|
-
return typeof e == "object" && e !== null;
|
|
361
|
-
}
|
|
362
|
-
class DefaultCFRuleLoader {
|
|
363
|
-
load(t, n) {
|
|
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" });
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
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}` });
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
if (!isObj(c) || typeof c.type != "string" || !isObj(l) || typeof l.kind != "string" || !isObj(f) || typeof f.columnId != "string") {
|
|
376
|
-
s.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
if (!n.types.has(c.type)) {
|
|
380
|
-
s.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
if (!n.encoders.has(l.kind)) {
|
|
384
|
-
s.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
|
|
385
|
-
continue;
|
|
386
|
-
}
|
|
387
|
-
const d = i.style;
|
|
388
|
-
if (isStyleRef(d) && !n.styles.has(d.ref)) {
|
|
389
|
-
s.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
|
|
390
|
-
continue;
|
|
391
|
-
}
|
|
392
|
-
r.push(i);
|
|
393
|
-
}
|
|
394
|
-
return { rules: r, skipped: s };
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function serializeRules(e) {
|
|
398
|
-
return JSON.stringify({ v: CF_SCHEMA_VERSION, rules: e });
|
|
399
|
-
}
|
|
400
|
-
class CFRuleStore {
|
|
401
|
-
constructor(t = []) {
|
|
402
|
-
this.byColumn = /* @__PURE__ */ new Map(), this.all = [];
|
|
403
|
-
for (const n of t) this.add(n);
|
|
404
|
-
}
|
|
405
|
-
add(t) {
|
|
406
|
-
this.all.push(t);
|
|
407
|
-
const n = this.byColumn.get(t.scope.columnId) ?? [];
|
|
408
|
-
n.push(t), this.byColumn.set(t.scope.columnId, n);
|
|
409
|
-
}
|
|
410
|
-
rulesFor(t) {
|
|
411
|
-
return this.byColumn.get(t) ?? [];
|
|
412
|
-
}
|
|
413
|
-
list() {
|
|
414
|
-
return this.all;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
class CFEngine {
|
|
418
|
-
constructor(t, n = createEncoderRegistry(), r = createRuleTypeRegistry(), s) {
|
|
419
|
-
this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = s ?? new DefaultCFEvaluator(r);
|
|
420
|
-
}
|
|
421
|
-
get lineage() {
|
|
422
|
-
return this;
|
|
423
|
-
}
|
|
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));
|
|
429
|
-
}
|
|
430
|
-
for (const c of i.decorators) {
|
|
431
|
-
const l = this.encoders.get(c.encode.kind);
|
|
432
|
-
l && a.push(l.encode(c, r, s));
|
|
433
|
-
}
|
|
434
|
-
return a;
|
|
435
|
-
}
|
|
436
|
-
statsNeedsFor(t) {
|
|
437
|
-
const n = /* @__PURE__ */ new Set();
|
|
438
|
-
for (const r of this.rules.rulesFor(t)) {
|
|
439
|
-
const s = this.ruleTypes.get(r.when.type);
|
|
440
|
-
if (s) for (const o of s.needs) n.add(o);
|
|
441
|
-
}
|
|
442
|
-
return [...n].sort();
|
|
443
|
-
}
|
|
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);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
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;
|
|
452
|
-
//# sourceMappingURL=index-CnyumyPV.cjs.map
|