@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 CHANGED
@@ -17,7 +17,7 @@ Core design:
17
17
  - Compiles to JavaScript in ES Modules, JavaScript Interop
18
18
  - Hot code swapping friendly
19
19
 
20
- ### Install
20
+ ### Install ![GitHub Release](https://img.shields.io/github/v/release/calcit-lang/calcit)
21
21
 
22
22
  Build and install with Rust:
23
23
 
@@ -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) : null,
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()}`), " ", preview);
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) : undefined, maxWidth: "100%", whiteSpace: "normal" }, "{}", preview);
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
- return div({ color: hsl(280, 80, 60, 0.4) }, obj.toString(true));
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
- return obj.len() > 0;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.8.42",
3
+ "version": "0.8.44",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^20.11.28",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.8.42",
3
+ "version": "0.8.44",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^20.11.28",
@@ -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) : null,
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({ color: hasCollection ? hsl(280, 80, 60, 0.4) : undefined, maxWidth: "100%", whiteSpace: "normal" }, "{}", preview);
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
- return div({ color: hsl(280, 80, 60, 0.4) }, obj.toString(true));
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
- return obj.len() > 0;
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
  }