@quarb/wasm 0.14.0 → 0.18.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/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  [Quarb](https://quarb.org) — the arboreal query engine —
4
4
  compiled to WebAssembly, with TypeScript types. One path
5
5
  language over JSON, YAML, TOML, CSV/TSV, XML, HTML, and
6
- Markdown, running entirely client-side: no server, no native
6
+ Markdown — including the text-level reading of HTML, Markdown,
7
+ and plain text (sections, paragraphs, quotes, lists) — running
8
+ entirely client-side: no server, no native
7
9
  dependency, the same engine that powers the
8
10
  [playground](https://demo.quarb.org) and the Quarb Scraper
9
11
  browser extension.
package/index.d.ts CHANGED
@@ -9,7 +9,10 @@ export type Format =
9
9
  | 'tsv'
10
10
  | 'xml'
11
11
  | 'html'
12
- | 'markdown';
12
+ | 'markdown'
13
+ | 'text-html'
14
+ | 'text-markdown'
15
+ | 'text';
13
16
 
14
17
  /**
15
18
  * Initialize the engine once; subsequent calls share the load.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quarb/wasm",
3
- "version": "0.14.0",
3
+ "version": "0.18.0",
4
4
  "description": "Quarb \u2014 the arboreal query engine \u2014 compiled to WebAssembly, with TypeScript types. One-shot queries over JSON, YAML, TOML, CSV, XML, HTML, and Markdown, plus the quai session engine (multi-source mounts, joins, &N history, kaiv, SQLite) \u2014 entirely client-side.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/quai.d.ts CHANGED
@@ -19,6 +19,9 @@ export interface Source {
19
19
  | 'xml'
20
20
  | 'html'
21
21
  | 'markdown'
22
+ | 'text-html'
23
+ | 'text-markdown'
24
+ | 'text'
22
25
  | 'kaiv'
23
26
  | 'daiv'
24
27
  | 'sqlite';
package/quai_wasm.d.ts CHANGED
@@ -35,6 +35,14 @@ export class QuaiSession {
35
35
  * session's `now()` (pass `Date.now()`).
36
36
  */
37
37
  constructor(format: string, input: string, now_millis: number);
38
+ /**
39
+ * Run a line and render its results as exportable markup:
40
+ * `kind` is `md`, `html`, or `txt`. Text-level node results
41
+ * render structurally (sections back to headings, lists to
42
+ * lists); anything else degrades to prose lines. History refs
43
+ * (`&N`) resolve as in a normal line.
44
+ */
45
+ render(line: string, kind: string): string;
38
46
  /**
39
47
  * Clear the history and restart numbering.
40
48
  */
@@ -92,6 +100,7 @@ export interface InitOutput {
92
100
  readonly quaisession_mount: (a: number, b: number, c: number) => [number, number, number];
93
101
  readonly quaisession_mountWithModel: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
94
102
  readonly quaisession_new: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
103
+ readonly quaisession_render: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
95
104
  readonly quaisession_reset: (a: number) => void;
96
105
  readonly quaisession_restore: (a: number, b: number, c: number) => void;
97
106
  readonly quaisession_run: (a: number, b: number, c: number) => [number, number];
package/quai_wasm.js CHANGED
@@ -108,6 +108,38 @@ export class QuaiSession {
108
108
  QuaiSessionFinalization.register(this, this.__wbg_ptr, this);
109
109
  return this;
110
110
  }
111
+ /**
112
+ * Run a line and render its results as exportable markup:
113
+ * `kind` is `md`, `html`, or `txt`. Text-level node results
114
+ * render structurally (sections back to headings, lists to
115
+ * lists); anything else degrades to prose lines. History refs
116
+ * (`&N`) resolve as in a normal line.
117
+ * @param {string} line
118
+ * @param {string} kind
119
+ * @returns {string}
120
+ */
121
+ render(line, kind) {
122
+ let deferred4_0;
123
+ let deferred4_1;
124
+ try {
125
+ const ptr0 = passStringToWasm0(line, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
126
+ const len0 = WASM_VECTOR_LEN;
127
+ const ptr1 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
128
+ const len1 = WASM_VECTOR_LEN;
129
+ const ret = wasm.quaisession_render(this.__wbg_ptr, ptr0, len0, ptr1, len1);
130
+ var ptr3 = ret[0];
131
+ var len3 = ret[1];
132
+ if (ret[3]) {
133
+ ptr3 = 0; len3 = 0;
134
+ throw takeFromExternrefTable0(ret[2]);
135
+ }
136
+ deferred4_0 = ptr3;
137
+ deferred4_1 = len3;
138
+ return getStringFromWasm0(ptr3, len3);
139
+ } finally {
140
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
141
+ }
142
+ }
111
143
  /**
112
144
  * Clear the history and restart numbering.
113
145
  */
package/quai_wasm_bg.wasm CHANGED
Binary file
package/quarb_wasm.d.ts CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
  /**
5
5
  * Execute `query` against `input` parsed as `format`
6
- * (json | yaml | toml | csv | tsv | xml | html | markdown).
6
+ * (json | yaml | toml | csv | tsv | xml | html | markdown |
7
+ * text-html | text-markdown | text).
7
8
  * `now_millis` is the invocation instant for `now()`, as from
8
9
  * `Date.now()`. Returns a JSON envelope; never throws.
9
10
  */
package/quarb_wasm.js CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  /**
4
4
  * Execute `query` against `input` parsed as `format`
5
- * (json | yaml | toml | csv | tsv | xml | html | markdown).
5
+ * (json | yaml | toml | csv | tsv | xml | html | markdown |
6
+ * text-html | text-markdown | text).
6
7
  * `now_millis` is the invocation instant for `now()`, as from
7
8
  * `Date.now()`. Returns a JSON envelope; never throws.
8
9
  * @param {string} format
Binary file