@calcit/procs 0.8.42 → 0.8.44
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/README.md +1 -1
- package/lib/custom-formatter.mjs +27 -8
- package/lib/js-set.mjs +9 -0
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/ts-src/custom-formatter.mts +37 -8
- package/ts-src/js-set.mts +10 -1
package/README.md
CHANGED
package/lib/custom-formatter.mjs
CHANGED
|
@@ -104,12 +104,13 @@ export let load_console_formatter_$x_ = () => {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
return div({
|
|
107
|
-
color: hasCollection ? hsl(280, 80, 60, 0.4) :
|
|
107
|
+
color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60),
|
|
108
|
+
marginRight: "16px",
|
|
108
109
|
}, `[]`, span({
|
|
109
110
|
fontSize: "8px",
|
|
110
111
|
verticalAlign: "middle",
|
|
111
112
|
color: hsl(280, 80, 80, 0.8),
|
|
112
|
-
}, `${obj.len()}`),
|
|
113
|
+
}, `${obj.len()}`), preview);
|
|
113
114
|
}
|
|
114
115
|
if (obj instanceof CalcitMap || obj instanceof CalcitSliceMap) {
|
|
115
116
|
let preview = "";
|
|
@@ -125,10 +126,27 @@ export let load_console_formatter_$x_ = () => {
|
|
|
125
126
|
break;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
return div({ color: hasCollection ? hsl(280, 80, 60, 0.4) :
|
|
129
|
+
return div({ color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60), marginRight: "16px", maxWidth: "100%", whiteSpace: "normal" }, "{}", preview);
|
|
129
130
|
}
|
|
130
131
|
if (obj instanceof CalcitSet) {
|
|
131
|
-
|
|
132
|
+
let preview = "";
|
|
133
|
+
let hasCollection = false;
|
|
134
|
+
for (let item of obj.values()) {
|
|
135
|
+
preview += " ";
|
|
136
|
+
if (isLiteral(item)) {
|
|
137
|
+
preview += saveString(item);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
preview += "..";
|
|
141
|
+
hasCollection = true;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return div({ color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60), marginRight: "16px" }, "#{}", span({
|
|
146
|
+
fontSize: "8px",
|
|
147
|
+
verticalAlign: "middle",
|
|
148
|
+
color: hsl(280, 80, 80, 0.8),
|
|
149
|
+
}, `${obj.len()}`), preview);
|
|
132
150
|
}
|
|
133
151
|
if (obj instanceof CalcitRecord) {
|
|
134
152
|
let ret = div({ color: hsl(280, 80, 60, 0.4), maxWidth: "100%" }, `%{} ${obj.name} ...`);
|
|
@@ -136,14 +154,14 @@ export let load_console_formatter_$x_ = () => {
|
|
|
136
154
|
}
|
|
137
155
|
if (obj instanceof CalcitTuple) {
|
|
138
156
|
if (obj.klass) {
|
|
139
|
-
let ret = div({}, div({ display: "inline-block", color: hsl(300, 100, 40) }, "%::"), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.klass)), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag)));
|
|
157
|
+
let ret = div({ marginRight: "16px" }, div({ display: "inline-block", color: hsl(300, 100, 40) }, "%::"), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.klass)), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag)));
|
|
140
158
|
for (let idx = 0; idx < obj.extra.length; idx++) {
|
|
141
159
|
ret.push(div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.extra[idx])));
|
|
142
160
|
}
|
|
143
161
|
return ret;
|
|
144
162
|
}
|
|
145
163
|
else {
|
|
146
|
-
let ret = div({}, div({ display: "inline-block", color: hsl(300, 100, 40) }, "::"), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag)));
|
|
164
|
+
let ret = div({ marginRight: "16px" }, div({ display: "inline-block", color: hsl(300, 100, 40) }, "::"), div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag)));
|
|
147
165
|
for (let idx = 0; idx < obj.extra.length; idx++) {
|
|
148
166
|
ret.push(div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.extra[idx])));
|
|
149
167
|
}
|
|
@@ -156,7 +174,7 @@ export let load_console_formatter_$x_ = () => {
|
|
|
156
174
|
}, `Ref ${obj.path}`, div({ color: hsl(280, 80, 60) }, div({ marginLeft: "8px" }, embedObject(obj.value))));
|
|
157
175
|
}
|
|
158
176
|
if (obj instanceof CalcitCirruQuote) {
|
|
159
|
-
return div({ color: hsl(280, 80, 60), display: "flex" }, `CirruQuote`, div({ color: hsl(280, 80, 60), padding: "4px 4px", margin: "0 4px 2px", border: "1px solid hsl(0,70%,90%)", borderRadius: "4px" }, obj.textForm().trim()));
|
|
177
|
+
return div({ color: hsl(280, 80, 60), display: "flex", marginRight: "16px" }, `CirruQuote`, div({ color: hsl(280, 80, 60), padding: "4px 4px", margin: "0 4px 2px", border: "1px solid hsl(0,70%,90%)", borderRadius: "4px" }, obj.textForm().trim()));
|
|
160
178
|
}
|
|
161
179
|
return null;
|
|
162
180
|
},
|
|
@@ -170,7 +188,8 @@ export let load_console_formatter_$x_ = () => {
|
|
|
170
188
|
return obj.len() > 0 && hasCollection;
|
|
171
189
|
}
|
|
172
190
|
if (obj instanceof CalcitSet) {
|
|
173
|
-
|
|
191
|
+
let hasCollection = obj.nestedDataInChildren();
|
|
192
|
+
return obj.len() > 0 && hasCollection;
|
|
174
193
|
}
|
|
175
194
|
if (obj instanceof CalcitRecord) {
|
|
176
195
|
return obj.fields.length > 0;
|
package/lib/js-set.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLiteral } from "./js-primes.mjs";
|
|
1
2
|
import { toString } from "./calcit-data.mjs";
|
|
2
3
|
import { mapLen, assocMap, dissocMap, toPairsArray, contains, initTernaryTreeMapFromArray, initEmptyTernaryTreeMap, } from "@calcit/ternary-tree";
|
|
3
4
|
import * as ternaryTree from "@calcit/ternary-tree";
|
|
@@ -87,4 +88,12 @@ export class CalcitSet {
|
|
|
87
88
|
values() {
|
|
88
89
|
return [...ternaryTree.toKeys(this.value)];
|
|
89
90
|
}
|
|
91
|
+
nestedDataInChildren() {
|
|
92
|
+
for (let k of ternaryTree.toKeys(this.value)) {
|
|
93
|
+
if (!isLiteral(k)) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
90
99
|
}
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -118,7 +118,8 @@ export let load_console_formatter_$x_ = () => {
|
|
|
118
118
|
}
|
|
119
119
|
return div(
|
|
120
120
|
{
|
|
121
|
-
color: hasCollection ? hsl(280, 80, 60, 0.4) :
|
|
121
|
+
color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60),
|
|
122
|
+
marginRight: "16px",
|
|
122
123
|
},
|
|
123
124
|
`[]`,
|
|
124
125
|
span(
|
|
@@ -129,7 +130,6 @@ export let load_console_formatter_$x_ = () => {
|
|
|
129
130
|
},
|
|
130
131
|
`${obj.len()}`
|
|
131
132
|
),
|
|
132
|
-
" ",
|
|
133
133
|
preview
|
|
134
134
|
);
|
|
135
135
|
}
|
|
@@ -146,10 +146,38 @@ export let load_console_formatter_$x_ = () => {
|
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
return div(
|
|
149
|
+
return div(
|
|
150
|
+
{ color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60), marginRight: "16px", maxWidth: "100%", whiteSpace: "normal" },
|
|
151
|
+
"{}",
|
|
152
|
+
preview
|
|
153
|
+
);
|
|
150
154
|
}
|
|
151
155
|
if (obj instanceof CalcitSet) {
|
|
152
|
-
|
|
156
|
+
let preview = "";
|
|
157
|
+
let hasCollection = false;
|
|
158
|
+
for (let item of obj.values()) {
|
|
159
|
+
preview += " ";
|
|
160
|
+
if (isLiteral(item)) {
|
|
161
|
+
preview += saveString(item);
|
|
162
|
+
} else {
|
|
163
|
+
preview += "..";
|
|
164
|
+
hasCollection = true;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return div(
|
|
169
|
+
{ color: hasCollection ? hsl(280, 80, 60, 0.4) : hsl(280, 80, 60), marginRight: "16px" },
|
|
170
|
+
"#{}",
|
|
171
|
+
span(
|
|
172
|
+
{
|
|
173
|
+
fontSize: "8px",
|
|
174
|
+
verticalAlign: "middle",
|
|
175
|
+
color: hsl(280, 80, 80, 0.8),
|
|
176
|
+
},
|
|
177
|
+
`${obj.len()}`
|
|
178
|
+
),
|
|
179
|
+
preview
|
|
180
|
+
);
|
|
153
181
|
}
|
|
154
182
|
if (obj instanceof CalcitRecord) {
|
|
155
183
|
let ret: any[] = div({ color: hsl(280, 80, 60, 0.4), maxWidth: "100%" }, `%{} ${obj.name} ...`);
|
|
@@ -158,7 +186,7 @@ export let load_console_formatter_$x_ = () => {
|
|
|
158
186
|
if (obj instanceof CalcitTuple) {
|
|
159
187
|
if (obj.klass) {
|
|
160
188
|
let ret: any[] = div(
|
|
161
|
-
{},
|
|
189
|
+
{ marginRight: "16px" },
|
|
162
190
|
div({ display: "inline-block", color: hsl(300, 100, 40) }, "%::"),
|
|
163
191
|
div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.klass)),
|
|
164
192
|
div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag))
|
|
@@ -169,7 +197,7 @@ export let load_console_formatter_$x_ = () => {
|
|
|
169
197
|
return ret;
|
|
170
198
|
} else {
|
|
171
199
|
let ret: any[] = div(
|
|
172
|
-
{},
|
|
200
|
+
{ marginRight: "16px" },
|
|
173
201
|
div({ display: "inline-block", color: hsl(300, 100, 40) }, "::"),
|
|
174
202
|
div({ marginLeft: "6px", display: "inline-block" }, embedObject(obj.tag))
|
|
175
203
|
);
|
|
@@ -190,7 +218,7 @@ export let load_console_formatter_$x_ = () => {
|
|
|
190
218
|
}
|
|
191
219
|
if (obj instanceof CalcitCirruQuote) {
|
|
192
220
|
return div(
|
|
193
|
-
{ color: hsl(280, 80, 60), display: "flex" },
|
|
221
|
+
{ color: hsl(280, 80, 60), display: "flex", marginRight: "16px" },
|
|
194
222
|
`CirruQuote`,
|
|
195
223
|
div(
|
|
196
224
|
{ color: hsl(280, 80, 60), padding: "4px 4px", margin: "0 4px 2px", border: "1px solid hsl(0,70%,90%)", borderRadius: "4px" },
|
|
@@ -210,7 +238,8 @@ export let load_console_formatter_$x_ = () => {
|
|
|
210
238
|
return obj.len() > 0 && hasCollection;
|
|
211
239
|
}
|
|
212
240
|
if (obj instanceof CalcitSet) {
|
|
213
|
-
|
|
241
|
+
let hasCollection = obj.nestedDataInChildren();
|
|
242
|
+
return obj.len() > 0 && hasCollection;
|
|
214
243
|
}
|
|
215
244
|
if (obj instanceof CalcitRecord) {
|
|
216
245
|
return obj.fields.length > 0;
|
package/ts-src/js-set.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalcitValue } from "./js-primes.mjs";
|
|
1
|
+
import { CalcitValue, isLiteral } from "./js-primes.mjs";
|
|
2
2
|
import { toString } from "./calcit-data.mjs";
|
|
3
3
|
import {
|
|
4
4
|
TernaryTreeMap,
|
|
@@ -110,4 +110,13 @@ export class CalcitSet {
|
|
|
110
110
|
values() {
|
|
111
111
|
return [...ternaryTree.toKeys(this.value)];
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
nestedDataInChildren(): boolean {
|
|
115
|
+
for (let k of ternaryTree.toKeys(this.value)) {
|
|
116
|
+
if (!isLiteral(k)) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
113
122
|
}
|