qsharp-lang 1.0.28-dev → 1.0.30-dev

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.
@@ -6,32 +6,7 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
8
 
9
- let heap_next = heap.length;
10
-
11
- function dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
15
- }
16
-
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
20
- return ret;
21
- }
22
-
23
- function addHeapObject(obj) {
24
- if (heap_next === heap.length) heap.push(heap.length + 1);
25
- const idx = heap_next;
26
- heap_next = heap[idx];
27
-
28
- heap[idx] = obj;
29
- return idx;
30
- }
31
-
32
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
-
34
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
9
+ let WASM_VECTOR_LEN = 0;
35
10
 
36
11
  let cachedUint8Memory0 = null;
37
12
 
@@ -42,13 +17,6 @@ function getUint8Memory0() {
42
17
  return cachedUint8Memory0;
43
18
  }
44
19
 
45
- function getStringFromWasm0(ptr, len) {
46
- ptr = ptr >>> 0;
47
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
48
- }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
20
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
53
21
 
54
22
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -124,6 +92,38 @@ function getFloat64Memory0() {
124
92
  return cachedFloat64Memory0;
125
93
  }
126
94
 
95
+ let heap_next = heap.length;
96
+
97
+ function dropObject(idx) {
98
+ if (idx < 132) return;
99
+ heap[idx] = heap_next;
100
+ heap_next = idx;
101
+ }
102
+
103
+ function takeObject(idx) {
104
+ const ret = getObject(idx);
105
+ dropObject(idx);
106
+ return ret;
107
+ }
108
+
109
+ function addHeapObject(obj) {
110
+ if (heap_next === heap.length) heap.push(heap.length + 1);
111
+ const idx = heap_next;
112
+ heap_next = heap[idx];
113
+
114
+ heap[idx] = obj;
115
+ return idx;
116
+ }
117
+
118
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
119
+
120
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
121
+
122
+ function getStringFromWasm0(ptr, len) {
123
+ ptr = ptr >>> 0;
124
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
125
+ }
126
+
127
127
  function debugString(val) {
128
128
  // primitive types
129
129
  const type = typeof val;
@@ -189,12 +189,32 @@ function debugString(val) {
189
189
  return className;
190
190
  }
191
191
 
192
- let stack_pointer = 128;
192
+ function makeMutClosure(arg0, arg1, dtor, f) {
193
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
194
+ const real = (...args) => {
195
+ // First up with a closure we increment the internal reference
196
+ // count. This ensures that the Rust closure environment won't
197
+ // be deallocated while we're invoking it.
198
+ state.cnt++;
199
+ const a = state.a;
200
+ state.a = 0;
201
+ try {
202
+ return f(a, state.b, ...args);
203
+ } finally {
204
+ if (--state.cnt === 0) {
205
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
193
206
 
194
- function addBorrowedObject(obj) {
195
- if (stack_pointer == 1) throw new Error('out of js stack');
196
- heap[--stack_pointer] = obj;
197
- return stack_pointer;
207
+ } else {
208
+ state.a = a;
209
+ }
210
+ }
211
+ };
212
+ real.original = state;
213
+
214
+ return real;
215
+ }
216
+ function __wbg_adapter_44(arg0, arg1, arg2) {
217
+ wasm.__wbindgen_export_3(arg0, arg1, addHeapObject(arg2));
198
218
  }
199
219
 
200
220
  let cachedUint32Memory0 = null;
@@ -206,13 +226,6 @@ function getUint32Memory0() {
206
226
  return cachedUint32Memory0;
207
227
  }
208
228
 
209
- function passArray32ToWasm0(arg, malloc) {
210
- const ptr = malloc(arg.length * 4, 4) >>> 0;
211
- getUint32Memory0().set(arg, ptr / 4);
212
- WASM_VECTOR_LEN = arg.length;
213
- return ptr;
214
- }
215
-
216
229
  function passArrayJsValueToWasm0(array, malloc) {
217
230
  const ptr = malloc(array.length * 4, 4) >>> 0;
218
231
  const mem = getUint32Memory0();
@@ -223,6 +236,21 @@ function passArrayJsValueToWasm0(array, malloc) {
223
236
  return ptr;
224
237
  }
225
238
 
239
+ let stack_pointer = 128;
240
+
241
+ function addBorrowedObject(obj) {
242
+ if (stack_pointer == 1) throw new Error('out of js stack');
243
+ heap[--stack_pointer] = obj;
244
+ return stack_pointer;
245
+ }
246
+
247
+ function passArray32ToWasm0(arg, malloc) {
248
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
249
+ getUint32Memory0().set(arg, ptr / 4);
250
+ WASM_VECTOR_LEN = arg.length;
251
+ return ptr;
252
+ }
253
+
226
254
  function getArrayJsValueFromWasm0(ptr, len) {
227
255
  ptr = ptr >>> 0;
228
256
  const mem = getUint32Memory0();
@@ -274,20 +302,20 @@ export function git_hash() {
274
302
  return getStringFromWasm0(r0, r1);
275
303
  } finally {
276
304
  wasm.__wbindgen_add_to_stack_pointer(16);
277
- wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
305
+ wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
278
306
  }
279
307
  }
280
308
 
281
309
  /**
282
- * @param {string} code
310
+ * @param {(Array<any>)[]} sources
283
311
  * @returns {string}
284
312
  */
285
- export function get_qir(code) {
313
+ export function get_qir(sources) {
286
314
  let deferred3_0;
287
315
  let deferred3_1;
288
316
  try {
289
317
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
290
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
318
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
291
319
  const len0 = WASM_VECTOR_LEN;
292
320
  wasm.get_qir(retptr, ptr0, len0);
293
321
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -305,21 +333,21 @@ export function get_qir(code) {
305
333
  return getStringFromWasm0(ptr2, len2);
306
334
  } finally {
307
335
  wasm.__wbindgen_add_to_stack_pointer(16);
308
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
336
+ wasm.__wbindgen_export_4(deferred3_0, deferred3_1, 1);
309
337
  }
310
338
  }
311
339
 
312
340
  /**
313
- * @param {string} code
341
+ * @param {(Array<any>)[]} sources
314
342
  * @param {string} params
315
343
  * @returns {string}
316
344
  */
317
- export function get_estimates(code, params) {
345
+ export function get_estimates(sources, params) {
318
346
  let deferred4_0;
319
347
  let deferred4_1;
320
348
  try {
321
349
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
350
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
323
351
  const len0 = WASM_VECTOR_LEN;
324
352
  const ptr1 = passStringToWasm0(params, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
325
353
  const len1 = WASM_VECTOR_LEN;
@@ -339,7 +367,7 @@ export function get_estimates(code, params) {
339
367
  return getStringFromWasm0(ptr3, len3);
340
368
  } finally {
341
369
  wasm.__wbindgen_add_to_stack_pointer(16);
342
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
370
+ wasm.__wbindgen_export_4(deferred4_0, deferred4_1, 1);
343
371
  }
344
372
  }
345
373
 
@@ -358,7 +386,7 @@ export function get_library_source_content(name) {
358
386
  let v2;
359
387
  if (r0 !== 0) {
360
388
  v2 = getStringFromWasm0(r0, r1).slice();
361
- wasm.__wbindgen_export_2(r0, r1 * 1);
389
+ wasm.__wbindgen_export_4(r0, r1 * 1);
362
390
  }
363
391
  return v2;
364
392
  } finally {
@@ -385,21 +413,21 @@ export function get_hir(code) {
385
413
  return getStringFromWasm0(r0, r1);
386
414
  } finally {
387
415
  wasm.__wbindgen_add_to_stack_pointer(16);
388
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
416
+ wasm.__wbindgen_export_4(deferred2_0, deferred2_1, 1);
389
417
  }
390
418
  }
391
419
 
392
420
  /**
393
- * @param {string} code
421
+ * @param {(Array<any>)[]} sources
394
422
  * @param {string} expr
395
423
  * @param {Function} event_cb
396
424
  * @param {number} shots
397
425
  * @returns {boolean}
398
426
  */
399
- export function run(code, expr, event_cb, shots) {
427
+ export function run(sources, expr, event_cb, shots) {
400
428
  try {
401
429
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
402
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
430
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
403
431
  const len0 = WASM_VECTOR_LEN;
404
432
  const ptr1 = passStringToWasm0(expr, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
405
433
  const len1 = WASM_VECTOR_LEN;
@@ -438,9 +466,13 @@ function handleError(f, args) {
438
466
  try {
439
467
  return f.apply(this, args);
440
468
  } catch (e) {
441
- wasm.__wbindgen_export_3(addHeapObject(e));
469
+ wasm.__wbindgen_export_5(addHeapObject(e));
442
470
  }
443
471
  }
472
+ function __wbg_adapter_145(arg0, arg1, arg2, arg3) {
473
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
474
+ }
475
+
444
476
  /**
445
477
  */
446
478
  export const StepResultId = Object.freeze({ BreakpointHit:0,"0":"BreakpointHit",Next:1,"1":"Next",StepIn:2,"2":"StepIn",StepOut:3,"3":"StepOut",Return:4,"4":"Return", });
@@ -474,34 +506,31 @@ export class DebugService {
474
506
  return DebugService.__wrap(ret);
475
507
  }
476
508
  /**
477
- * @param {string} path
478
- * @param {string} source
509
+ * @param {(Array<any>)[]} sources
479
510
  * @param {string} target_profile
480
511
  * @param {string | undefined} entry
481
512
  * @returns {string}
482
513
  */
483
- load_source(path, source, target_profile, entry) {
484
- let deferred5_0;
485
- let deferred5_1;
514
+ load_source(sources, target_profile, entry) {
515
+ let deferred4_0;
516
+ let deferred4_1;
486
517
  try {
487
518
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
488
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
519
+ const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
489
520
  const len0 = WASM_VECTOR_LEN;
490
- const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
521
+ const ptr1 = passStringToWasm0(target_profile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
491
522
  const len1 = WASM_VECTOR_LEN;
492
- const ptr2 = passStringToWasm0(target_profile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
493
- const len2 = WASM_VECTOR_LEN;
494
- var ptr3 = isLikeNone(entry) ? 0 : passStringToWasm0(entry, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
495
- var len3 = WASM_VECTOR_LEN;
496
- wasm.debugservice_load_source(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
523
+ var ptr2 = isLikeNone(entry) ? 0 : passStringToWasm0(entry, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
524
+ var len2 = WASM_VECTOR_LEN;
525
+ wasm.debugservice_load_source(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
497
526
  var r0 = getInt32Memory0()[retptr / 4 + 0];
498
527
  var r1 = getInt32Memory0()[retptr / 4 + 1];
499
- deferred5_0 = r0;
500
- deferred5_1 = r1;
528
+ deferred4_0 = r0;
529
+ deferred4_1 = r1;
501
530
  return getStringFromWasm0(r0, r1);
502
531
  } finally {
503
532
  wasm.__wbindgen_add_to_stack_pointer(16);
504
- wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
533
+ wasm.__wbindgen_export_4(deferred4_0, deferred4_1, 1);
505
534
  }
506
535
  }
507
536
  /**
@@ -652,13 +681,28 @@ export class LanguageService {
652
681
  wasm.__wbg_languageservice_free(ptr);
653
682
  }
654
683
  /**
655
- * @param {(uri: string, version: number | undefined, diagnostics: VSDiagnostic[]) => void} diagnostics_callback
656
684
  */
657
- constructor(diagnostics_callback) {
658
- const ret = wasm.languageservice_new(addHeapObject(diagnostics_callback));
685
+ constructor() {
686
+ const ret = wasm.languageservice_new();
659
687
  return LanguageService.__wrap(ret);
660
688
  }
661
689
  /**
690
+ * @param {(uri: string, version: number | undefined, diagnostics: VSDiagnostic[]) => void} diagnostics_callback
691
+ * @param {(uri: string) => Promise<string | null>} read_file
692
+ * @param {(uri: string) => Promise<[string, number][]>} list_directory
693
+ * @param {(uri: string) => Promise<{ manifestDirectory: string }| null>} get_manifest
694
+ * @returns {Promise<any>}
695
+ */
696
+ start_background_work(diagnostics_callback, read_file, list_directory, get_manifest) {
697
+ const ret = wasm.languageservice_start_background_work(this.__wbg_ptr, addHeapObject(diagnostics_callback), addHeapObject(read_file), addHeapObject(list_directory), addHeapObject(get_manifest));
698
+ return takeObject(ret);
699
+ }
700
+ /**
701
+ */
702
+ stop_background_work() {
703
+ wasm.languageservice_stop_background_work(this.__wbg_ptr);
704
+ }
705
+ /**
662
706
  * @param {IWorkspaceConfiguration} config
663
707
  */
664
708
  update_configuration(config) {
@@ -698,14 +742,11 @@ export class LanguageService {
698
742
  }
699
743
  /**
700
744
  * @param {string} notebook_uri
701
- * @param {(string)[]} cell_uris
702
745
  */
703
- close_notebook_document(notebook_uri, cell_uris) {
746
+ close_notebook_document(notebook_uri) {
704
747
  const ptr0 = passStringToWasm0(notebook_uri, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
705
748
  const len0 = WASM_VECTOR_LEN;
706
- const ptr1 = passArrayJsValueToWasm0(cell_uris, wasm.__wbindgen_export_0);
707
- const len1 = WASM_VECTOR_LEN;
708
- wasm.languageservice_close_notebook_document(this.__wbg_ptr, ptr0, len0, ptr1, len1);
749
+ wasm.languageservice_close_notebook_document(this.__wbg_ptr, ptr0, len0);
709
750
  }
710
751
  /**
711
752
  * @param {string} uri
@@ -744,7 +785,7 @@ export class LanguageService {
744
785
  var r0 = getInt32Memory0()[retptr / 4 + 0];
745
786
  var r1 = getInt32Memory0()[retptr / 4 + 1];
746
787
  var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
747
- wasm.__wbindgen_export_2(r0, r1 * 4);
788
+ wasm.__wbindgen_export_4(r0, r1 * 4);
748
789
  return v2;
749
790
  } finally {
750
791
  wasm.__wbindgen_add_to_stack_pointer(16);
@@ -798,6 +839,49 @@ export class LanguageService {
798
839
  return takeObject(ret);
799
840
  }
800
841
  }
842
+ /**
843
+ * a minimal implementation for interacting with async JS filesystem callbacks to
844
+ * load project files
845
+ */
846
+ export class ProjectLoader {
847
+
848
+ static __wrap(ptr) {
849
+ ptr = ptr >>> 0;
850
+ const obj = Object.create(ProjectLoader.prototype);
851
+ obj.__wbg_ptr = ptr;
852
+
853
+ return obj;
854
+ }
855
+
856
+ __destroy_into_raw() {
857
+ const ptr = this.__wbg_ptr;
858
+ this.__wbg_ptr = 0;
859
+
860
+ return ptr;
861
+ }
862
+
863
+ free() {
864
+ const ptr = this.__destroy_into_raw();
865
+ wasm.__wbg_projectloader_free(ptr);
866
+ }
867
+ /**
868
+ * @param {(uri: string) => Promise<string | null>} read_file
869
+ * @param {(uri: string) => Promise<[string, number][]>} list_directory
870
+ * @param {(uri: string) => Promise<{ manifestDirectory: string }| null>} get_manifest
871
+ */
872
+ constructor(read_file, list_directory, get_manifest) {
873
+ const ret = wasm.projectloader_new(addHeapObject(read_file), addHeapObject(list_directory), addHeapObject(get_manifest));
874
+ return ProjectLoader.__wrap(ret);
875
+ }
876
+ /**
877
+ * @param {{ manifestDirectory: string }} manifest
878
+ * @returns {Promise<[string, string][]>}
879
+ */
880
+ load_project(manifest) {
881
+ const ret = wasm.projectloader_load_project(this.__wbg_ptr, addHeapObject(manifest));
882
+ return takeObject(ret);
883
+ }
884
+ }
801
885
 
802
886
  async function __wbg_load(module, imports) {
803
887
  if (typeof Response === 'function' && module instanceof Response) {
@@ -833,9 +917,32 @@ async function __wbg_load(module, imports) {
833
917
  function __wbg_get_imports() {
834
918
  const imports = {};
835
919
  imports.wbg = {};
920
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
921
+ const obj = getObject(arg1);
922
+ const ret = typeof(obj) === 'string' ? obj : undefined;
923
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
924
+ var len1 = WASM_VECTOR_LEN;
925
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
926
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
927
+ };
928
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
929
+ const obj = getObject(arg1);
930
+ const ret = typeof(obj) === 'number' ? obj : undefined;
931
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
932
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
933
+ };
836
934
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
837
935
  takeObject(arg0);
838
936
  };
937
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
938
+ const obj = takeObject(arg0).original;
939
+ if (obj.cnt-- == 1) {
940
+ obj.a = 0;
941
+ return true;
942
+ }
943
+ const ret = false;
944
+ return ret;
945
+ };
839
946
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
840
947
  const ret = BigInt.asUintN(64, arg0);
841
948
  return addHeapObject(ret);
@@ -857,14 +964,6 @@ function __wbg_get_imports() {
857
964
  const ret = getObject(arg0) in getObject(arg1);
858
965
  return ret;
859
966
  };
860
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
861
- const obj = getObject(arg1);
862
- const ret = typeof(obj) === 'string' ? obj : undefined;
863
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
864
- var len1 = WASM_VECTOR_LEN;
865
- getInt32Memory0()[arg0 / 4 + 1] = len1;
866
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
867
- };
868
967
  imports.wbg.__wbindgen_number_new = function(arg0) {
869
968
  const ret = arg0;
870
969
  return addHeapObject(ret);
@@ -884,10 +983,18 @@ function __wbg_get_imports() {
884
983
  getInt32Memory0()[arg0 / 4 + 1] = len1;
885
984
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
886
985
  };
986
+ imports.wbg.__wbindgen_is_null = function(arg0) {
987
+ const ret = getObject(arg0) === null;
988
+ return ret;
989
+ };
887
990
  imports.wbg.__wbindgen_is_function = function(arg0) {
888
991
  const ret = typeof(getObject(arg0)) === 'function';
889
992
  return ret;
890
993
  };
994
+ imports.wbg.__wbindgen_typeof = function(arg0) {
995
+ const ret = typeof getObject(arg0);
996
+ return addHeapObject(ret);
997
+ };
891
998
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
892
999
  const ret = getObject(arg0);
893
1000
  return addHeapObject(ret);
@@ -901,12 +1008,6 @@ function __wbg_get_imports() {
901
1008
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
902
1009
  return ret;
903
1010
  };
904
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
905
- const obj = getObject(arg1);
906
- const ret = typeof(obj) === 'number' ? obj : undefined;
907
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
908
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
909
- };
910
1011
  imports.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea = function(arg0, arg1) {
911
1012
  const ret = getObject(arg0)[getObject(arg1)];
912
1013
  return addHeapObject(ret);
@@ -1003,6 +1104,10 @@ function __wbg_get_imports() {
1003
1104
  const ret = Array.isArray(getObject(arg0));
1004
1105
  return ret;
1005
1106
  };
1107
+ imports.wbg.__wbg_push_ca1c26067ef907ac = function(arg0, arg1) {
1108
+ const ret = getObject(arg0).push(getObject(arg1));
1109
+ return ret;
1110
+ };
1006
1111
  imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function(arg0) {
1007
1112
  let result;
1008
1113
  try {
@@ -1029,6 +1134,36 @@ function __wbg_get_imports() {
1029
1134
  const ret = getObject(arg0).buffer;
1030
1135
  return addHeapObject(ret);
1031
1136
  };
1137
+ imports.wbg.__wbg_new_43f1b47c28813cbd = function(arg0, arg1) {
1138
+ try {
1139
+ var state0 = {a: arg0, b: arg1};
1140
+ var cb0 = (arg0, arg1) => {
1141
+ const a = state0.a;
1142
+ state0.a = 0;
1143
+ try {
1144
+ return __wbg_adapter_145(a, state0.b, arg0, arg1);
1145
+ } finally {
1146
+ state0.a = a;
1147
+ }
1148
+ };
1149
+ const ret = new Promise(cb0);
1150
+ return addHeapObject(ret);
1151
+ } finally {
1152
+ state0.a = state0.b = 0;
1153
+ }
1154
+ };
1155
+ imports.wbg.__wbg_resolve_53698b95aaf7fcf8 = function(arg0) {
1156
+ const ret = Promise.resolve(getObject(arg0));
1157
+ return addHeapObject(ret);
1158
+ };
1159
+ imports.wbg.__wbg_then_f7e06ee3c11698eb = function(arg0, arg1) {
1160
+ const ret = getObject(arg0).then(getObject(arg1));
1161
+ return addHeapObject(ret);
1162
+ };
1163
+ imports.wbg.__wbg_then_b2267541e2a73865 = function(arg0, arg1, arg2) {
1164
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1165
+ return addHeapObject(ret);
1166
+ };
1032
1167
  imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
1033
1168
  const ret = self.self;
1034
1169
  return addHeapObject(ret);
@@ -1092,6 +1227,10 @@ function __wbg_get_imports() {
1092
1227
  const ret = wasm.memory;
1093
1228
  return addHeapObject(ret);
1094
1229
  };
1230
+ imports.wbg.__wbindgen_closure_wrapper533 = function(arg0, arg1, arg2) {
1231
+ const ret = makeMutClosure(arg0, arg1, 156, __wbg_adapter_44);
1232
+ return addHeapObject(ret);
1233
+ };
1095
1234
 
1096
1235
  return imports;
1097
1236
  }
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qsharp-lang",
3
3
  "description": "qsharp language package for quantum development",
4
- "version": "1.0.28-dev",
4
+ "version": "1.0.30-dev",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=16.17.0"
package/ux/index.ts CHANGED
@@ -8,4 +8,4 @@ import "./qsharp-ux.css";
8
8
  export { Histogram } from "./histogram.js";
9
9
  export { ReTable, type ReData } from "./reTable.js";
10
10
  export { SpaceChart } from "./spaceChart.js";
11
- export { ResultsTable, type CellValue } from "./resultsTable.js";
11
+ export { ResultsTable } from "./resultsTable.js";
package/ux/reTable.tsx CHANGED
@@ -25,6 +25,7 @@ export type ReData = {
25
25
  }[];
26
26
  assumptions: string[];
27
27
  };
28
+ new: boolean;
28
29
  };
29
30
 
30
31
  export function ReTable(props: {
@@ -2,13 +2,14 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import { useRef, useState } from "preact/hooks";
5
+ import { type ReData } from "./reTable.js";
5
6
 
6
- export type CellValue = string | number | { value: string; sortBy: number };
7
+ type CellValue = string | number | { value: string; sortBy: number };
7
8
 
8
9
  // Note: column 0 is expected to be unique amongst all rows
9
10
  export function ResultsTable(props: {
10
11
  columnNames: string[];
11
- rows: CellValue[][];
12
+ data: ReData[];
12
13
  initialColumns: number[];
13
14
  ensureSelected: boolean;
14
15
  onRowSelected(rowId: string): void;
@@ -23,8 +24,20 @@ export function ResultsTable(props: {
23
24
  const [showColumnMenu, setShowColumnMenu] = useState(false);
24
25
  const [showRowMenu, setShowRowMenu] = useState("");
25
26
 
26
- if (!selectedRow && props.ensureSelected && props.rows.length > 0) {
27
- const rowId = props.rows[0][0].toString();
27
+ const rows = props.data.map(ReDataToRow);
28
+
29
+ // Find the first row that is new in the current sort order
30
+ const newest = getSortedRows(rows).find(
31
+ (row) => (row[row.length - 1] as string) === "New",
32
+ );
33
+
34
+ // Select the first of the newest rows, otherwise preserve the existing selection
35
+ if (newest && props.ensureSelected) {
36
+ const rowId = newest[0].toString();
37
+ setSelectedRow(rowId);
38
+ props.onRowSelected(rowId);
39
+ } else if (!selectedRow && props.ensureSelected && rows.length > 0) {
40
+ const rowId = rows[0][0].toString();
28
41
  setSelectedRow(rowId);
29
42
  props.onRowSelected(rowId);
30
43
  }
@@ -331,7 +344,7 @@ export function ResultsTable(props: {
331
344
  </tr>
332
345
  </thead>
333
346
  <tbody>
334
- {getSortedRows(props.rows).map((row) => {
347
+ {getSortedRows(rows).map((row) => {
335
348
  const rowId = row[0].toString();
336
349
  return (
337
350
  <tr
@@ -383,3 +396,25 @@ export function ResultsTable(props: {
383
396
  </table>
384
397
  );
385
398
  }
399
+
400
+ function ReDataToRow(data: ReData): CellValue[] {
401
+ return [
402
+ data.jobParams.runName,
403
+ data.jobParams.qubitParams.name,
404
+ data.jobParams.qecScheme.name,
405
+ data.jobParams.errorBudget,
406
+ data.physicalCounts.breakdown.algorithmicLogicalQubits,
407
+ data.physicalCounts.breakdown.algorithmicLogicalDepth,
408
+ data.logicalQubit.codeDistance,
409
+ data.physicalCounts.breakdown.numTstates,
410
+ data.physicalCounts.breakdown.numTfactories,
411
+ data.physicalCountsFormatted.physicalQubitsForTfactoriesPercentage,
412
+ {
413
+ value: data.physicalCountsFormatted.runtime,
414
+ sortBy: data.physicalCounts.runtime,
415
+ },
416
+ data.physicalCounts.rqops,
417
+ data.physicalCounts.physicalQubits,
418
+ data.new ? "New" : "Cached",
419
+ ];
420
+ }