@celljs/ta-glance 4.32.1 → 4.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extension/index.mjs +22 -0
- package/package.json +3 -3
- package/web/index.js +22 -0
package/extension/index.mjs
CHANGED
|
@@ -206,6 +206,7 @@ var GlanceJson;
|
|
|
206
206
|
let escaped = false;
|
|
207
207
|
let last = "";
|
|
208
208
|
let out = "";
|
|
209
|
+
let closed = [];
|
|
209
210
|
for (let index = 0;index < text.length; index++) {
|
|
210
211
|
const char = text[index];
|
|
211
212
|
if (inString) {
|
|
@@ -260,6 +261,22 @@ var GlanceJson;
|
|
|
260
261
|
index = end < 0 ? text.length : text[index + 1] === "/" ? end - 1 : end + 1;
|
|
261
262
|
continue;
|
|
262
263
|
}
|
|
264
|
+
if (char === "," && closed.length && (!open.length || open[open.length - 1] === "}" && /[{[]/.test(after(text, index)))) {
|
|
265
|
+
const undone = [...closed];
|
|
266
|
+
const reopened = [...open];
|
|
267
|
+
let at = -1;
|
|
268
|
+
for (let each = undone.pop();each && reopened[reopened.length - 1] !== "]"; each = undone.pop()) {
|
|
269
|
+
reopened.push(each.char);
|
|
270
|
+
at = each.at;
|
|
271
|
+
}
|
|
272
|
+
if (at >= 0 && reopened[reopened.length - 1] === "]") {
|
|
273
|
+
open.splice(0, open.length, ...reopened);
|
|
274
|
+
out = out.slice(0, at);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (char !== "}" && char !== "]") {
|
|
278
|
+
closed = [];
|
|
279
|
+
}
|
|
263
280
|
const number = (_a = /^-?\d+(?:\.\d*)?(?:[eE][+-]?\d*)?/.exec(text.slice(index, index + 64))) === null || _a === undefined ? undefined : _a[0];
|
|
264
281
|
if (number) {
|
|
265
282
|
if (/["}\]\w.]/.test(last)) {
|
|
@@ -302,12 +319,17 @@ var GlanceJson;
|
|
|
302
319
|
continue;
|
|
303
320
|
}
|
|
304
321
|
open.pop();
|
|
322
|
+
closed.push({ char, at: out.length });
|
|
305
323
|
}
|
|
306
324
|
last = char;
|
|
307
325
|
out += char;
|
|
308
326
|
}
|
|
309
327
|
return { text: out, open, inString, escaped };
|
|
310
328
|
}
|
|
329
|
+
function after(text, index) {
|
|
330
|
+
var _a;
|
|
331
|
+
return (_a = text.slice(index + 1).trimStart()[0]) !== null && _a !== undefined ? _a : "";
|
|
332
|
+
}
|
|
311
333
|
function ends(text, index) {
|
|
312
334
|
for (let next = index + 1;next < text.length; next++) {
|
|
313
335
|
const char = text[next];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-glance",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.33.0",
|
|
4
4
|
"description": "A pi package for Ta: replies lead with the answer, short, and show results as cards (key numbers, files, steps, comparisons, choices) rather than paragraphs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@celljs/ta-protocol": "4.
|
|
30
|
-
"@celljs/ta-web": "4.
|
|
29
|
+
"@celljs/ta-protocol": "4.33.0",
|
|
30
|
+
"@celljs/ta-web": "4.33.0",
|
|
31
31
|
"@types/react": "^19.3.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -59,6 +59,7 @@ var GlanceJson;
|
|
|
59
59
|
let escaped = false;
|
|
60
60
|
let last = "";
|
|
61
61
|
let out = "";
|
|
62
|
+
let closed = [];
|
|
62
63
|
for (let index = 0;index < text.length; index++) {
|
|
63
64
|
const char = text[index];
|
|
64
65
|
if (inString) {
|
|
@@ -113,6 +114,22 @@ var GlanceJson;
|
|
|
113
114
|
index = end < 0 ? text.length : text[index + 1] === "/" ? end - 1 : end + 1;
|
|
114
115
|
continue;
|
|
115
116
|
}
|
|
117
|
+
if (char === "," && closed.length && (!open.length || open[open.length - 1] === "}" && /[{[]/.test(after(text, index)))) {
|
|
118
|
+
const undone = [...closed];
|
|
119
|
+
const reopened = [...open];
|
|
120
|
+
let at = -1;
|
|
121
|
+
for (let each = undone.pop();each && reopened[reopened.length - 1] !== "]"; each = undone.pop()) {
|
|
122
|
+
reopened.push(each.char);
|
|
123
|
+
at = each.at;
|
|
124
|
+
}
|
|
125
|
+
if (at >= 0 && reopened[reopened.length - 1] === "]") {
|
|
126
|
+
open.splice(0, open.length, ...reopened);
|
|
127
|
+
out = out.slice(0, at);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (char !== "}" && char !== "]") {
|
|
131
|
+
closed = [];
|
|
132
|
+
}
|
|
116
133
|
const number = (_a = /^-?\d+(?:\.\d*)?(?:[eE][+-]?\d*)?/.exec(text.slice(index, index + 64))) === null || _a === undefined ? undefined : _a[0];
|
|
117
134
|
if (number) {
|
|
118
135
|
if (/["}\]\w.]/.test(last)) {
|
|
@@ -155,12 +172,17 @@ var GlanceJson;
|
|
|
155
172
|
continue;
|
|
156
173
|
}
|
|
157
174
|
open.pop();
|
|
175
|
+
closed.push({ char, at: out.length });
|
|
158
176
|
}
|
|
159
177
|
last = char;
|
|
160
178
|
out += char;
|
|
161
179
|
}
|
|
162
180
|
return { text: out, open, inString, escaped };
|
|
163
181
|
}
|
|
182
|
+
function after(text, index) {
|
|
183
|
+
var _a;
|
|
184
|
+
return (_a = text.slice(index + 1).trimStart()[0]) !== null && _a !== undefined ? _a : "";
|
|
185
|
+
}
|
|
164
186
|
function ends(text, index) {
|
|
165
187
|
for (let next = index + 1;next < text.length; next++) {
|
|
166
188
|
const char = text[next];
|