@brett_lamy/ui 5.13.0 → 5.15.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.
Files changed (118) hide show
  1. package/dist/components/call-stack.d.ts +26 -0
  2. package/dist/components/call-stack.d.ts.map +1 -0
  3. package/dist/components/call-stack.js +236 -0
  4. package/dist/components/code-editor-window.d.ts +191 -0
  5. package/dist/components/code-editor-window.d.ts.map +1 -0
  6. package/dist/components/code-editor-window.js +1474 -0
  7. package/dist/components/code-editor.d.ts +213 -0
  8. package/dist/components/code-editor.d.ts.map +1 -0
  9. package/dist/components/code-editor.js +484 -0
  10. package/dist/components/file-upload.d.ts +1 -1
  11. package/dist/components/file-upload.d.ts.map +1 -1
  12. package/dist/components/file-upload.js +1 -1
  13. package/dist/components/filter-input.d.ts +1 -1
  14. package/dist/components/filter-input.d.ts.map +1 -1
  15. package/dist/components/filter-input.js +1 -1
  16. package/dist/components/filter.d.ts +1 -1
  17. package/dist/components/filter.d.ts.map +1 -1
  18. package/dist/components/filter.js +1 -1
  19. package/dist/components/log-list.d.ts +95 -0
  20. package/dist/components/log-list.d.ts.map +1 -0
  21. package/dist/components/log-list.js +549 -0
  22. package/dist/components/object-tree.d.ts +30 -0
  23. package/dist/components/object-tree.d.ts.map +1 -0
  24. package/dist/components/object-tree.js +415 -0
  25. package/dist/components/object-value.d.ts +13 -0
  26. package/dist/components/object-value.d.ts.map +1 -0
  27. package/dist/components/object-value.js +69 -0
  28. package/dist/components/request-table.d.ts +78 -0
  29. package/dist/components/request-table.d.ts.map +1 -0
  30. package/dist/components/request-table.js +697 -0
  31. package/dist/components/spreadsheet.d.ts +1 -1
  32. package/dist/components/spreadsheet.d.ts.map +1 -1
  33. package/dist/components/spreadsheet.js +1 -1
  34. package/dist/components/syntax-highlighting.d.ts +45 -77
  35. package/dist/components/syntax-highlighting.d.ts.map +1 -1
  36. package/dist/components/syntax-highlighting.js +36 -275
  37. package/dist/components/terminal.d.ts +62 -0
  38. package/dist/components/terminal.d.ts.map +1 -0
  39. package/dist/components/terminal.js +172 -0
  40. package/dist/components/trace-timeline.d.ts +97 -0
  41. package/dist/components/trace-timeline.d.ts.map +1 -0
  42. package/dist/components/trace-timeline.js +850 -0
  43. package/dist/components/tree.d.ts.map +1 -1
  44. package/dist/components/tree.js +99 -91
  45. package/dist/components/video-preview.d.ts +1 -1
  46. package/dist/components/video-preview.d.ts.map +1 -1
  47. package/dist/components/video-preview.js +1 -1
  48. package/dist/components/video-timeline.d.ts +1 -1
  49. package/dist/components/video-timeline.d.ts.map +1 -1
  50. package/dist/components/video-timeline.js +1 -1
  51. package/dist/components/workspace.d.ts.map +1 -1
  52. package/dist/components/workspace.js +1 -1
  53. package/dist/index.css +1 -1
  54. package/dist/index.d.ts +45 -11
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +119 -100
  57. package/dist/lib/call-stack-model.d.ts +75 -0
  58. package/dist/lib/call-stack-model.d.ts.map +1 -0
  59. package/dist/lib/call-stack-model.js +114 -0
  60. package/dist/lib/code-document.d.ts +229 -0
  61. package/dist/lib/code-document.d.ts.map +1 -0
  62. package/dist/lib/code-document.js +727 -0
  63. package/dist/lib/code-editor-gpu.d.ts +9 -0
  64. package/dist/lib/code-editor-gpu.d.ts.map +1 -0
  65. package/dist/lib/code-editor-gpu.js +23 -0
  66. package/dist/lib/code-editor-model.d.ts +371 -0
  67. package/dist/lib/code-editor-model.d.ts.map +1 -0
  68. package/dist/lib/code-editor-model.js +1105 -0
  69. package/dist/lib/{file-upload.d.ts → file-upload-model.d.ts} +1 -1
  70. package/dist/lib/file-upload-model.d.ts.map +1 -0
  71. package/dist/lib/{file-upload.js → file-upload-model.js} +1 -1
  72. package/dist/lib/{filter.d.ts → filter-model.d.ts} +1 -1
  73. package/dist/lib/filter-model.d.ts.map +1 -0
  74. package/dist/lib/{filter.js → filter-model.js} +1 -1
  75. package/dist/lib/filter-query.d.ts +1 -1
  76. package/dist/lib/filter-query.d.ts.map +1 -1
  77. package/dist/lib/filter-query.js +1 -1
  78. package/dist/lib/log-list-model.d.ts +132 -0
  79. package/dist/lib/log-list-model.d.ts.map +1 -0
  80. package/dist/lib/log-list-model.js +214 -0
  81. package/dist/lib/log-list-window.d.ts +121 -0
  82. package/dist/lib/log-list-window.d.ts.map +1 -0
  83. package/dist/lib/log-list-window.js +245 -0
  84. package/dist/lib/object-tree-model.d.ts +162 -0
  85. package/dist/lib/object-tree-model.d.ts.map +1 -0
  86. package/dist/lib/object-tree-model.js +347 -0
  87. package/dist/lib/object-tree-value.d.ts +139 -0
  88. package/dist/lib/object-tree-value.d.ts.map +1 -0
  89. package/dist/lib/object-tree-value.js +410 -0
  90. package/dist/lib/request-table-model.d.ts +85 -0
  91. package/dist/lib/request-table-model.d.ts.map +1 -0
  92. package/dist/lib/request-table-model.js +105 -0
  93. package/dist/lib/{spreadsheet.d.ts → spreadsheet-model.d.ts} +1 -1
  94. package/dist/lib/spreadsheet-model.d.ts.map +1 -0
  95. package/dist/lib/{spreadsheet.js → spreadsheet-model.js} +1 -1
  96. package/dist/lib/syntax.d.ts +19 -7
  97. package/dist/lib/syntax.d.ts.map +1 -1
  98. package/dist/lib/syntax.js +54 -50
  99. package/dist/lib/terminal-line.d.ts +155 -0
  100. package/dist/lib/terminal-line.d.ts.map +1 -0
  101. package/dist/lib/terminal-line.js +463 -0
  102. package/dist/lib/trace-timeline-draw.d.ts +109 -0
  103. package/dist/lib/trace-timeline-draw.d.ts.map +1 -0
  104. package/dist/lib/trace-timeline-draw.js +252 -0
  105. package/dist/lib/trace-timeline-model.d.ts +324 -0
  106. package/dist/lib/trace-timeline-model.d.ts.map +1 -0
  107. package/dist/lib/trace-timeline-model.js +510 -0
  108. package/dist/lib/video-render.d.ts +1 -1
  109. package/dist/lib/video-render.d.ts.map +1 -1
  110. package/dist/lib/video-render.js +1 -1
  111. package/dist/lib/{video-timeline.d.ts → video-timeline-model.d.ts} +1 -1
  112. package/dist/lib/video-timeline-model.d.ts.map +1 -0
  113. package/dist/lib/{video-timeline.js → video-timeline-model.js} +1 -1
  114. package/package.json +7 -1
  115. package/dist/lib/file-upload.d.ts.map +0 -1
  116. package/dist/lib/filter.d.ts.map +0 -1
  117. package/dist/lib/spreadsheet.d.ts.map +0 -1
  118. package/dist/lib/video-timeline.d.ts.map +0 -1
@@ -0,0 +1,347 @@
1
+ import { copyTextOf as e, isTypedArray as t, previewFromValue as n, previewText as r } from "./object-tree-value.js";
2
+ //#region src/lib/object-tree-model.ts
3
+ function i(e) {
4
+ return e.hasChildren === void 0 ? e.children ? e.children.length > 0 : !!e.section : e.hasChildren;
5
+ }
6
+ var a = /* @__PURE__ */ new WeakMap();
7
+ function o(e) {
8
+ if (typeof e != "object" || !e || e instanceof Date || e instanceof RegExp) return !1;
9
+ if (e instanceof Error) return !0;
10
+ if (Array.isArray(e) || t(e)) return e.length > 0;
11
+ if (e instanceof Map || e instanceof Set) return e.size > 0;
12
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t)) return !0;
13
+ return !1;
14
+ }
15
+ function s(e, t, r, i) {
16
+ let s, c = "owner" in r, l = {
17
+ id: e,
18
+ name: t,
19
+ get value() {
20
+ return s ??= c ? { type: "accessor" } : n(r.value);
21
+ },
22
+ get hasChildren() {
23
+ return !c && o(r.value);
24
+ },
25
+ ...i ? { dim: i } : {}
26
+ };
27
+ return a.set(l, r), l;
28
+ }
29
+ function c(e, t = {}) {
30
+ let n = s(t.id ?? t.name ?? "value", t.name ?? "", { value: e });
31
+ return t.defaultExpanded !== void 0 && (n.defaultExpanded = t.defaultExpanded), n;
32
+ }
33
+ function l(e) {
34
+ let r = a.get(e);
35
+ if (!r || !r.value || typeof r.value != "object") return [];
36
+ let i = r.value, o = [], c = (e, t, n = String(e)) => o.push(s(n, n, { value: t }));
37
+ if (Array.isArray(i)) i.forEach((e, t) => c(t, e));
38
+ else if (t(i)) for (let e = 0; e < i.length; e++) c(e, i[e]);
39
+ else if (i instanceof Set) {
40
+ let e = 0;
41
+ for (let t of i) c(e++, t);
42
+ } else if (i instanceof Map) {
43
+ let e = 0;
44
+ for (let [t, r] of i) {
45
+ let i = String(e++);
46
+ o.push({
47
+ id: i,
48
+ name: i,
49
+ value: {
50
+ type: "entry",
51
+ key: n(t, 1),
52
+ value: n(r, 1)
53
+ },
54
+ children: [s("key", "key", { value: t }), s("value", "value", { value: r })]
55
+ });
56
+ }
57
+ }
58
+ i instanceof Error && (o.push(s("message", "message", { value: i.message }, !0)), i.stack && o.push(s("stack", "stack", { value: i.stack }, !0)));
59
+ let l = Array.isArray(i) || t(i);
60
+ for (let e of Object.keys(i)) {
61
+ if (l && /^\d+$/.test(e)) continue;
62
+ let t = Object.getOwnPropertyDescriptor(i, e);
63
+ o.push(s(e, e, t?.get || t?.set ? {
64
+ owner: i,
65
+ key: e
66
+ } : { value: t?.value }));
67
+ }
68
+ return Array.isArray(i) && o.push(s("length", "length", { value: i.length }, !0)), (i instanceof Map || i instanceof Set) && o.push(s("size", "size", { value: i.size }, !0)), o;
69
+ }
70
+ function u(e) {
71
+ return a.has(e);
72
+ }
73
+ function d(e) {
74
+ let t = a.get(e);
75
+ if (!t?.owner) throw Error("This getter has nothing to call it with");
76
+ return s(e.id, e.name, { value: Reflect.get(t.owner, t.key) });
77
+ }
78
+ function f(e) {
79
+ let t = a.get(e);
80
+ if (!t || "owner" in t) return;
81
+ let i = [];
82
+ return JSON.stringify(t.value, function(e, t) {
83
+ for (; i.length && i[i.length - 1] !== this;) i.pop();
84
+ if (typeof t == "bigint" || typeof t == "symbol" || typeof t == "function") return r(n(t));
85
+ if (t instanceof RegExp) return String(t);
86
+ if (t instanceof Error) return t.stack ?? String(t);
87
+ if (typeof t != "object" || !t) return t;
88
+ if (i.includes(t)) return "[Circular]";
89
+ let a = t instanceof Map || t instanceof Set ? [...t] : t;
90
+ return i.push(a), a;
91
+ }, 2);
92
+ }
93
+ function p(t) {
94
+ let n = t.value;
95
+ return n ? n.type === "string" || n.type === "error" ? e(n) : f(t) ?? e(n) : t.name;
96
+ }
97
+ var m = 1e3;
98
+ function h(e, t = 100) {
99
+ let n = t;
100
+ for (; e / n > t;) n *= t;
101
+ return n;
102
+ }
103
+ function g(e, t, n = 100) {
104
+ let r = t - e + 1;
105
+ if (r <= n) return [];
106
+ let i = h(r, n), a = [];
107
+ for (let n = e; n <= t; n += i) a.push([n, Math.min(n + i - 1, t)]);
108
+ return a;
109
+ }
110
+ function _(e) {
111
+ if (!e || e.length > 16) return !1;
112
+ for (let t = 0; t < e.length; t++) {
113
+ let n = e.charCodeAt(t);
114
+ if (n < 48 || n > 57) return !1;
115
+ }
116
+ return !0;
117
+ }
118
+ var v = /* @__PURE__ */ new WeakMap();
119
+ function y(e, t = 100) {
120
+ let n = v.get(e);
121
+ if (n?.size === t) return n.plan;
122
+ let r = 0;
123
+ for (; r < e.length && _(e[r].name);) r++;
124
+ let i = [], a = (e, n, r) => {
125
+ let a = n - e + 1;
126
+ if (!(a <= 0)) {
127
+ if (a > r) i.push(...g(e, n, t));
128
+ else for (let t = e; t <= n; t++) i.push(t);
129
+ }
130
+ };
131
+ return a(0, r - 1, t), a(r, e.length - 1, Math.max(m, t)), v.set(e, {
132
+ size: t,
133
+ plan: i
134
+ }), i;
135
+ }
136
+ function b(e, t, n) {
137
+ return `[${e[t].name} … ${e[n].name}]`;
138
+ }
139
+ function x(e) {
140
+ return {
141
+ root: e,
142
+ open: /* @__PURE__ */ new Map(),
143
+ loads: /* @__PURE__ */ new Map(),
144
+ previous: /* @__PURE__ */ new Map(),
145
+ getters: /* @__PURE__ */ new Map()
146
+ };
147
+ }
148
+ function S(e, t, n) {
149
+ let r = /* @__PURE__ */ new Map();
150
+ for (let t of n) {
151
+ let n = e.loads.get(t), i = n?.status === "loaded" ? n.children : e.previous.get(t);
152
+ i && r.set(t, i);
153
+ }
154
+ return {
155
+ root: t,
156
+ open: e.open,
157
+ loads: /* @__PURE__ */ new Map(),
158
+ previous: r,
159
+ getters: /* @__PURE__ */ new Map()
160
+ };
161
+ }
162
+ function C(e, t, n) {
163
+ let r = new Map(e);
164
+ return n === void 0 ? r.delete(t) : r.set(t, n), r;
165
+ }
166
+ function w(e, t, n) {
167
+ return {
168
+ ...e,
169
+ loads: C(e.loads, t, {
170
+ status: "loading",
171
+ token: n
172
+ })
173
+ };
174
+ }
175
+ function T(e, t, n, r) {
176
+ if (e.loads.get(t)?.token !== n) return e;
177
+ let i = "children" in r ? {
178
+ status: "loaded",
179
+ token: n,
180
+ children: r.children
181
+ } : {
182
+ status: "failed",
183
+ token: n,
184
+ error: r.error
185
+ };
186
+ return {
187
+ ...e,
188
+ loads: C(e.loads, t, i),
189
+ previous: C(e.previous, t, void 0)
190
+ };
191
+ }
192
+ function E(e, t) {
193
+ return {
194
+ ...e,
195
+ loads: C(e.loads, t, void 0)
196
+ };
197
+ }
198
+ function D(e, t, n) {
199
+ return {
200
+ ...e,
201
+ getters: C(e.getters, t, {
202
+ status: "invoking",
203
+ token: n
204
+ })
205
+ };
206
+ }
207
+ function O(e, t, n, r) {
208
+ if (e.getters.get(t)?.token !== n) return e;
209
+ let i = "result" in r ? {
210
+ status: "done",
211
+ token: n,
212
+ result: r.result
213
+ } : {
214
+ status: "failed",
215
+ token: n,
216
+ error: r.error
217
+ };
218
+ return {
219
+ ...e,
220
+ getters: C(e.getters, t, i)
221
+ };
222
+ }
223
+ function k(e, t, n) {
224
+ return {
225
+ ...e,
226
+ open: C(e.open, t, n)
227
+ };
228
+ }
229
+ function A(e, t, n) {
230
+ let r = new Map(e.open);
231
+ for (let e of n) t.has(e) || r.set(e, !0);
232
+ for (let e of t) n.has(e) || r.set(e, !1);
233
+ return {
234
+ ...e,
235
+ open: r
236
+ };
237
+ }
238
+ function j(e, t) {
239
+ let n = {
240
+ ...e,
241
+ ...t,
242
+ id: e.id,
243
+ name: e.name
244
+ }, r = t && a.get(t);
245
+ return r && a.set(n, r), n;
246
+ }
247
+ var M = "", N = (e, t) => e ? `${e}${M}${t}` : t;
248
+ function P(e, t) {
249
+ if (e === t) return !0;
250
+ if (!e || !t || e.length !== t.length) return !1;
251
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
252
+ return !0;
253
+ }
254
+ function F(e, t = {}, n) {
255
+ let r = t.groupSize ?? 100, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = [], c = (e, t) => {
256
+ let r = n?.byKey.get(e.key), i = r && r.kind === e.kind && t(r) ? r : e;
257
+ return a.set(e.key, i), i;
258
+ }, l = (t, r, a) => {
259
+ let s = N(r, t.id), l = e.getters.get(s), u = n?.byKey.get(s), f = t;
260
+ l?.status === "done" && (f = u?.kind === "node" && u.source === t && u.getter === l ? u.node : j(t, l.result));
261
+ let p = i(f), m = p && (e.open.get(s) ?? f.defaultExpanded ?? !!f.section);
262
+ m && o.add(s);
263
+ let h = m ? d(f, s, a) : void 0;
264
+ return c({
265
+ kind: "node",
266
+ key: s,
267
+ node: f,
268
+ source: t,
269
+ expandable: p,
270
+ expanded: m,
271
+ getter: l,
272
+ stale: a,
273
+ children: h
274
+ }, (e) => e.source === t && e.node === f && e.getter === l && e.expanded === m && e.expandable === p && e.stale === a && P(e.children, h));
275
+ }, u = (e) => c({
276
+ kind: "loading",
277
+ key: `${e}${M}\u0001loading`,
278
+ owner: e
279
+ }, () => !0), d = (t, n, r) => {
280
+ if (t.children) return m(t.children, n, r);
281
+ let i = e.loads.get(n);
282
+ if (i?.status === "loaded") return m(i.children ?? [], n, r);
283
+ if (i?.status === "failed") {
284
+ let e = i.error ?? "";
285
+ return [c({
286
+ kind: "failed",
287
+ key: `${n}${M}\u0001failed`,
288
+ owner: n,
289
+ error: e
290
+ }, (t) => t.error === e)];
291
+ }
292
+ !i && !r && s.push({
293
+ key: n,
294
+ node: t
295
+ });
296
+ let a = e.previous.get(n);
297
+ return a?.length ? m(a, n, !0) : [u(n)];
298
+ }, f = (t, n, r, i, a) => {
299
+ let s = `${n}${M}\u0001[${r}-${i}]`, l = b(t, r, i), u = e.open.get(s) ?? !1;
300
+ u && o.add(s);
301
+ let d = u ? p(t, n, r, i, a) : void 0;
302
+ return c({
303
+ kind: "range",
304
+ key: s,
305
+ label: l,
306
+ from: r,
307
+ to: i,
308
+ expanded: u,
309
+ stale: a,
310
+ children: d
311
+ }, (e) => e.label === l && e.expanded === u && e.stale === a && P(e.children, d));
312
+ }, p = (e, t, n, i, a) => {
313
+ let o = g(n, i, r);
314
+ if (o.length) return o.map(([n, r]) => f(e, t, n, r, a));
315
+ let s = [];
316
+ for (let r = n; r <= i; r++) s.push(l(e[r], t, a));
317
+ return s;
318
+ }, m = (e, t, n) => e.length ? y(e, r).map((r) => typeof r == "number" ? l(e[r], t, n) : f(e, t, r[0], r[1], n)) : [c({
319
+ kind: "empty",
320
+ key: `${t}${M}\u0001empty`
321
+ }, () => !0)], h = Array.isArray(e.root) ? e.root : [e.root], _ = y(h, r).map((e) => typeof e == "number" ? l(h[e], "", !1) : f(h, "", e[0], e[1], !1));
322
+ return {
323
+ rows: n && P(n.rows, _) ? n.rows : _,
324
+ byKey: a,
325
+ expandedKeys: o,
326
+ needsLoad: s
327
+ };
328
+ }
329
+ function I(e) {
330
+ switch (e.kind) {
331
+ case "node": {
332
+ let { name: t, value: n } = e.node;
333
+ if (!n) return t;
334
+ let i = r(n, { maxString: 80 });
335
+ return t ? `${t}: ${i}` : i;
336
+ }
337
+ case "range": return e.label;
338
+ case "loading": return "Loading";
339
+ case "failed": return `Couldn't load: ${e.error}`;
340
+ case "empty": return "No properties";
341
+ }
342
+ }
343
+ function L(e) {
344
+ return e instanceof Error ? e.message || e.name : typeof e == "string" && e ? e : "Something went wrong";
345
+ }
346
+ //#endregion
347
+ export { A as applyExpanded, F as buildRows, l as childrenOfValue, p as copyTextOfNode, x as createTreeState, L as errorText, d as invokeGetterOfValue, i as isNodeExpandable, u as isValueNode, f as jsonOfValue, c as nodeFromValue, y as planRanges, h as rangeBucketSize, g as rangeBuckets, b as rangeLabel, S as rebaseTreeState, E as retryLoad, I as rowText, k as setRowOpen, O as settleGetter, T as settleLoad, D as startGetter, w as startLoad };
@@ -0,0 +1,139 @@
1
+ /** A named value inside an object's one-line preview. */
2
+ export interface ValueProperty {
3
+ name: string;
4
+ value: ValuePreview;
5
+ }
6
+ /** A key and value inside a map's one-line preview. */
7
+ export interface ValueMapEntry {
8
+ key: ValuePreview;
9
+ value: ValuePreview;
10
+ }
11
+ /** What a value is and what to show for it. Plain data, so it can arrive from anywhere: another process, a recording,
12
+ * a server. `previewFromValue` makes one from a live JavaScript value. */
13
+ export type ValuePreview = {
14
+ type: 'string';
15
+ value: string;
16
+ }
17
+ /** A string for what JSON can't carry: `NaN`, `-0`, `Infinity`. */
18
+ | {
19
+ type: 'number';
20
+ value: number | string;
21
+ } | {
22
+ type: 'boolean';
23
+ value: boolean;
24
+ } | {
25
+ type: 'null';
26
+ } | {
27
+ type: 'undefined';
28
+ }
29
+ /** Digits; a trailing `n` is added if it isn't there. */
30
+ | {
31
+ type: 'bigint';
32
+ value: bigint | string;
33
+ }
34
+ /** The text to show, as `Symbol(id)`. */
35
+ | {
36
+ type: 'symbol';
37
+ value: string;
38
+ } | {
39
+ type: 'function';
40
+ name?: string;
41
+ params?: string;
42
+ flavor?: 'async' | 'generator' | 'async generator' | 'class';
43
+ }
44
+ /** `properties` is what the preview knows, not all there is: `overflow` says more exist. */
45
+ | {
46
+ type: 'object';
47
+ className?: string;
48
+ properties?: readonly ValueProperty[];
49
+ overflow?: boolean;
50
+ }
51
+ /** Also typed arrays, with their `className`. */
52
+ | {
53
+ type: 'array';
54
+ className?: string;
55
+ length?: number;
56
+ items?: readonly ValuePreview[];
57
+ overflow?: boolean;
58
+ } | {
59
+ type: 'map';
60
+ className?: string;
61
+ size?: number;
62
+ entries?: readonly ValueMapEntry[];
63
+ overflow?: boolean;
64
+ } | {
65
+ type: 'set';
66
+ className?: string;
67
+ size?: number;
68
+ items?: readonly ValuePreview[];
69
+ overflow?: boolean;
70
+ }
71
+ /** The text to show. */
72
+ | {
73
+ type: 'date';
74
+ value: string;
75
+ }
76
+ /** The text to show, as `/a+/g`. */
77
+ | {
78
+ type: 'regexp';
79
+ value: string;
80
+ } | {
81
+ type: 'error';
82
+ name?: string;
83
+ message?: string;
84
+ stack?: string;
85
+ }
86
+ /** A getter or accessor nobody has called: `(...)`. */
87
+ | {
88
+ type: 'accessor';
89
+ }
90
+ /** One entry of a map, `key => value`. */
91
+ | {
92
+ type: 'entry';
93
+ key: ValuePreview;
94
+ value: ValuePreview;
95
+ }
96
+ /** A value that can't be read: `<unavailable>`, or your own `label`, as `<uninitialized>`. */
97
+ | {
98
+ type: 'unavailable';
99
+ label?: string;
100
+ };
101
+ export type ValueType = ValuePreview['type'];
102
+ /** How a piece of a preview is tinted. */
103
+ export type ValueTint = 'string' | 'number' | 'keyword' | 'nullish' | 'function' | 'functionMark' | 'symbol' | 'regexp' | 'date' | 'error' | 'className' | 'key' | 'punctuation' | 'muted' | 'plain';
104
+ /** One tinted run of a preview's text. */
105
+ export interface ValueToken {
106
+ text: string;
107
+ tint: ValueTint;
108
+ }
109
+ /** Characters of a string a preview shows before truncating it. */
110
+ export declare const STRING_PREVIEW_LENGTH = 100;
111
+ /** A string cut to at most `max` characters, never through the middle of an emoji. */
112
+ export declare function clipString(text: string, max: number): string;
113
+ export interface ValuePreviewOptions {
114
+ /** Characters of a string to show. Default `STRING_PREVIEW_LENGTH`. */
115
+ maxString?: number;
116
+ /** Quote strings, as a value. `false` for the bare text a console shows for a top-level string. Default `true`. */
117
+ quote?: boolean;
118
+ /** Show an error's stack rather than its one-line message. */
119
+ expanded?: boolean;
120
+ }
121
+ /** A preview as tinted runs of text, DevTools-style: `{a: 1, b: "x", …}`, `(3) [1, 2, 3]`, `Map(2) {"a" => 1}`. */
122
+ export declare function previewTokens(value: ValuePreview, options?: ValuePreviewOptions): ValueToken[];
123
+ /** A preview as plain text. */
124
+ export declare function previewText(value: ValuePreview, options?: ValuePreviewOptions): string;
125
+ /** What copying a value gives you: a string's own text, an error's stack, otherwise what the preview says. */
126
+ export declare function copyTextOf(value: ValuePreview): string;
127
+ /** All there is to read of a string or an error. Nothing else can be cut short. */
128
+ export declare function fullLength(value: ValuePreview): number;
129
+ /** How many characters of a value `shown` leaves out: what a Show more would reveal. */
130
+ export declare function hiddenLength(value: ValuePreview, shown: number, expanded?: boolean): number;
131
+ /** How much a Show more adds: ten times as much each press, so a many-megabyte string takes a few presses rather than a
132
+ * long stall. Anything up to 128 KB comes at once. */
133
+ export declare function nextShownLength(length: number, shown: number): number;
134
+ /** `812 B`, `1.2 kB`, `3.4 MB`. */
135
+ export declare function formatLength(length: number): string;
136
+ export declare function isTypedArray(value: object): value is Uint8Array;
137
+ /** Describes a live JavaScript value, one level deep. */
138
+ export declare function previewFromValue(value: unknown, depth?: number): ValuePreview;
139
+ //# sourceMappingURL=object-tree-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-tree-value.d.ts","sourceRoot":"","sources":["../../src/lib/object-tree-value.ts"],"names":[],"mappings":"AAKA,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED;2EAC2E;AAC3E,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACnC,mEAAmE;GACjE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE;AACvB,yDAAyD;GACvD;IAAE,I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