@calcit/procs 0.6.5 → 0.6.7
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/lib/calcit.procs.mjs +6 -3
- package/lib/custom-formatter.mjs +13 -0
- package/lib/js-cirru.mjs +5 -1
- package/package.json +3 -3
- package/ts-src/calcit.procs.mts +6 -3
- package/ts-src/custom-formatter.mts +13 -0
- package/ts-src/js-cirru.mts +5 -1
package/lib/calcit.procs.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
// CALCIT VERSION
|
|
3
|
-
export const calcit_version = "0.6.
|
|
3
|
+
export const calcit_version = "0.6.7";
|
|
4
4
|
import { parse } from "@cirru/parser.ts";
|
|
5
5
|
import { writeCirruCode } from "@cirru/writer.ts";
|
|
6
6
|
import "./js-primes.mjs";
|
|
@@ -20,7 +20,7 @@ import { CalcitList, CalcitSliceList, foldl } from "./js-list.mjs";
|
|
|
20
20
|
import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
|
|
21
21
|
import { CalcitSet } from "./js-set.mjs";
|
|
22
22
|
import { CalcitTuple } from "./js-tuple.mjs";
|
|
23
|
-
import { to_calcit_data, extract_cirru_edn } from "./js-cirru.mjs";
|
|
23
|
+
import { to_calcit_data, extract_cirru_edn, CalcitCirruQuote } from "./js-cirru.mjs";
|
|
24
24
|
let inNodeJs = typeof process !== "undefined" && ((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === "node";
|
|
25
25
|
export let type_of = (x) => {
|
|
26
26
|
if (typeof x === "string") {
|
|
@@ -56,6 +56,9 @@ export let type_of = (x) => {
|
|
|
56
56
|
if (x instanceof CalcitRecord) {
|
|
57
57
|
return kwd("record");
|
|
58
58
|
}
|
|
59
|
+
if (x instanceof CalcitCirruQuote) {
|
|
60
|
+
return kwd("cirru-quote");
|
|
61
|
+
}
|
|
59
62
|
if (x === true || x === false) {
|
|
60
63
|
return kwd("bool");
|
|
61
64
|
}
|
|
@@ -1063,7 +1066,7 @@ export let write_file = (path, content) => {
|
|
|
1063
1066
|
}
|
|
1064
1067
|
};
|
|
1065
1068
|
export let parse_cirru = (code) => {
|
|
1066
|
-
return
|
|
1069
|
+
return new CalcitCirruQuote(parse(code));
|
|
1067
1070
|
};
|
|
1068
1071
|
// for JavaScript, it's same as parse_cirru
|
|
1069
1072
|
export let parse_cirru_list = (code) => {
|
package/lib/custom-formatter.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
|
|
|
5
5
|
import { CalcitList, CalcitSliceList } from "./js-list.mjs";
|
|
6
6
|
import { CalcitSet } from "./js-set.mjs";
|
|
7
7
|
import { CalcitTuple } from "./js-tuple.mjs";
|
|
8
|
+
import { CalcitCirruQuote } from "./js-cirru.mjs";
|
|
8
9
|
let embedObject = (x) => {
|
|
9
10
|
if (x == null) {
|
|
10
11
|
return null;
|
|
@@ -68,6 +69,18 @@ export let load_console_formatter_$x_ = () => {
|
|
|
68
69
|
["div", { style: "color: hsl(280, 80%, 60%)" }, ["div", { style: "margin-left: 8px;" }, embedObject(obj.value)]],
|
|
69
70
|
];
|
|
70
71
|
}
|
|
72
|
+
if (obj instanceof CalcitCirruQuote) {
|
|
73
|
+
return [
|
|
74
|
+
"div",
|
|
75
|
+
{ style: "color: hsl(240, 80%, 60%); display: flex;" },
|
|
76
|
+
`CirruQuote`,
|
|
77
|
+
[
|
|
78
|
+
"div",
|
|
79
|
+
{ style: "color: hsl(280, 80%, 60%); padding: 4px 4px; margin: 0 4px 2px; border: 1px solid hsl(0,70%,90%); border-radius: 4px;" },
|
|
80
|
+
obj.textForm().trim(),
|
|
81
|
+
],
|
|
82
|
+
];
|
|
83
|
+
}
|
|
71
84
|
return null;
|
|
72
85
|
},
|
|
73
86
|
hasBody: (obj) => {
|
package/lib/js-cirru.mjs
CHANGED
|
@@ -12,11 +12,15 @@ export class CalcitCirruQuote {
|
|
|
12
12
|
this.value = value;
|
|
13
13
|
}
|
|
14
14
|
toString() {
|
|
15
|
-
return `(cirru-quote ${JSON.stringify(this.value)})`;
|
|
15
|
+
return `(&cirru-quote ${JSON.stringify(this.value)})`;
|
|
16
16
|
}
|
|
17
17
|
toList() {
|
|
18
18
|
return to_calcit_data(this.value, true);
|
|
19
19
|
}
|
|
20
|
+
/** provide a simple text representation in Console or std out, with indentations */
|
|
21
|
+
textForm() {
|
|
22
|
+
return writeCirruCode(this.value);
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
export let format_cirru = (data, useInline) => {
|
|
22
26
|
if (data instanceof CalcitCirruQuote) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calcit/procs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"main": "./lib/calcit.procs.mjs",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@types/node": "^18.7.
|
|
7
|
-
"typescript": "^4.8.
|
|
6
|
+
"@types/node": "^18.7.23",
|
|
7
|
+
"typescript": "^4.8.4"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"compile": "rm -rfv lib/* && tsc",
|
package/ts-src/calcit.procs.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// CALCIT VERSION
|
|
2
|
-
export const calcit_version = "0.6.
|
|
2
|
+
export const calcit_version = "0.6.7";
|
|
3
3
|
|
|
4
4
|
import { parse, ICirruNode } from "@cirru/parser.ts";
|
|
5
5
|
import { writeCirruCode } from "@cirru/writer.ts";
|
|
@@ -75,6 +75,9 @@ export let type_of = (x: any): CalcitKeyword => {
|
|
|
75
75
|
if (x instanceof CalcitRecord) {
|
|
76
76
|
return kwd("record");
|
|
77
77
|
}
|
|
78
|
+
if (x instanceof CalcitCirruQuote) {
|
|
79
|
+
return kwd("cirru-quote");
|
|
80
|
+
}
|
|
78
81
|
if (x === true || x === false) {
|
|
79
82
|
return kwd("bool");
|
|
80
83
|
}
|
|
@@ -1162,8 +1165,8 @@ export let write_file = (path: string, content: string): void => {
|
|
|
1162
1165
|
}
|
|
1163
1166
|
};
|
|
1164
1167
|
|
|
1165
|
-
export let parse_cirru = (code: string):
|
|
1166
|
-
return
|
|
1168
|
+
export let parse_cirru = (code: string): CalcitCirruQuote => {
|
|
1169
|
+
return new CalcitCirruQuote(parse(code));
|
|
1167
1170
|
};
|
|
1168
1171
|
|
|
1169
1172
|
// for JavaScript, it's same as parse_cirru
|
|
@@ -6,6 +6,7 @@ import { CalcitMap, CalcitSliceMap } from "./js-map.mjs";
|
|
|
6
6
|
import { CalcitList, CalcitSliceList } from "./js-list.mjs";
|
|
7
7
|
import { CalcitSet } from "./js-set.mjs";
|
|
8
8
|
import { CalcitTuple } from "./js-tuple.mjs";
|
|
9
|
+
import { CalcitCirruQuote } from "./js-cirru.mjs";
|
|
9
10
|
|
|
10
11
|
declare global {
|
|
11
12
|
interface Window {
|
|
@@ -81,6 +82,18 @@ export let load_console_formatter_$x_ = () => {
|
|
|
81
82
|
["div", { style: "color: hsl(280, 80%, 60%)" }, ["div", { style: "margin-left: 8px;" }, embedObject(obj.value)]],
|
|
82
83
|
];
|
|
83
84
|
}
|
|
85
|
+
if (obj instanceof CalcitCirruQuote) {
|
|
86
|
+
return [
|
|
87
|
+
"div",
|
|
88
|
+
{ style: "color: hsl(240, 80%, 60%); display: flex;" },
|
|
89
|
+
`CirruQuote`,
|
|
90
|
+
[
|
|
91
|
+
"div",
|
|
92
|
+
{ style: "color: hsl(280, 80%, 60%); padding: 4px 4px; margin: 0 4px 2px; border: 1px solid hsl(0,70%,90%); border-radius: 4px;" },
|
|
93
|
+
obj.textForm().trim(),
|
|
94
|
+
],
|
|
95
|
+
];
|
|
96
|
+
}
|
|
84
97
|
return null;
|
|
85
98
|
},
|
|
86
99
|
hasBody: (obj) => {
|
package/ts-src/js-cirru.mts
CHANGED
|
@@ -17,11 +17,15 @@ export class CalcitCirruQuote {
|
|
|
17
17
|
this.value = value;
|
|
18
18
|
}
|
|
19
19
|
toString(): string {
|
|
20
|
-
return `(cirru-quote ${JSON.stringify(this.value)})`;
|
|
20
|
+
return `(&cirru-quote ${JSON.stringify(this.value)})`;
|
|
21
21
|
}
|
|
22
22
|
toList(): CalcitValue {
|
|
23
23
|
return to_calcit_data(this.value, true);
|
|
24
24
|
}
|
|
25
|
+
/** provide a simple text representation in Console or std out, with indentations */
|
|
26
|
+
textForm(): string {
|
|
27
|
+
return writeCirruCode(this.value);
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export let format_cirru = (data: CalcitCirruQuote | CalcitList, useInline: boolean): string => {
|