@calcit/procs 0.6.6 → 0.6.8

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.
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  // CALCIT VERSION
3
- export const calcit_version = "0.6.6";
3
+ export const calcit_version = "0.6.8";
4
4
  import { parse } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
6
6
  import "./js-primes.mjs";
@@ -359,23 +359,20 @@ export let remove_watch = (a, k) => {
359
359
  a.listeners.delete(k);
360
360
  return null;
361
361
  };
362
- export let range = (n, m, m2) => {
362
+ export let range = (n, m, step = 1) => {
363
363
  var result = new CalcitSliceList([]);
364
- if (m2 != null) {
365
- console.warn("TODO range with 3 arguments"); // TODO
366
- }
367
364
  if (m != null) {
368
365
  var idx = n;
369
366
  while (idx < m) {
370
367
  result = result.append(idx);
371
- idx = idx + 1;
368
+ idx = idx + step;
372
369
  }
373
370
  }
374
371
  else {
375
372
  var idx = 0;
376
373
  while (idx < n) {
377
374
  result = result.append(idx);
378
- idx = idx + 1;
375
+ idx = idx + step;
379
376
  }
380
377
  }
381
378
  return result;
@@ -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.6",
3
+ "version": "0.6.8",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
- "@types/node": "^18.7.18",
7
- "typescript": "^4.8.3"
6
+ "@types/node": "^18.7.23",
7
+ "typescript": "^4.8.4"
8
8
  },
9
9
  "scripts": {
10
10
  "compile": "rm -rfv lib/* && tsc",
@@ -1,5 +1,5 @@
1
1
  // CALCIT VERSION
2
- export const calcit_version = "0.6.6";
2
+ export const calcit_version = "0.6.8";
3
3
 
4
4
  import { parse, ICirruNode } from "@cirru/parser.ts";
5
5
  import { writeCirruCode } from "@cirru/writer.ts";
@@ -418,22 +418,19 @@ export let remove_watch = (a: CalcitRef, k: CalcitKeyword): null => {
418
418
  return null;
419
419
  };
420
420
 
421
- export let range = (n: number, m: number, m2: number): CalcitSliceList | CalcitList => {
421
+ export let range = (n: number, m: number, step: number = 1): CalcitSliceList | CalcitList => {
422
422
  var result: CalcitList | CalcitSliceList = new CalcitSliceList([]);
423
- if (m2 != null) {
424
- console.warn("TODO range with 3 arguments"); // TODO
425
- }
426
423
  if (m != null) {
427
424
  var idx = n;
428
425
  while (idx < m) {
429
426
  result = result.append(idx);
430
- idx = idx + 1;
427
+ idx = idx + step;
431
428
  }
432
429
  } else {
433
430
  var idx = 0;
434
431
  while (idx < n) {
435
432
  result = result.append(idx);
436
- idx = idx + 1;
433
+ idx = idx + step;
437
434
  }
438
435
  }
439
436
  return result;
@@ -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) => {
@@ -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 => {