@netless/fastboard-ui 1.0.0-canary.7 → 1.0.0-canary.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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import Tippy from 'tippy.js';
2
2
 
3
- // ../../node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/internal/index.mjs
3
+ // ../../node_modules/.pnpm/svelte@3.53.0/node_modules/svelte/internal/index.mjs
4
4
  function noop() {
5
5
  }
6
6
  function assign(tar, src) {
@@ -106,7 +106,9 @@ function insert(target, node, anchor) {
106
106
  target.insertBefore(node, anchor || null);
107
107
  }
108
108
  function detach(node) {
109
- node.parentNode.removeChild(node);
109
+ if (node.parentNode) {
110
+ node.parentNode.removeChild(node);
111
+ }
110
112
  }
111
113
  function destroy_each(iterations, detaching) {
112
114
  for (let i = 0; i < iterations.length; i += 1) {
@@ -168,6 +170,9 @@ function custom_event(type, detail, { bubbles = false, cancelable = false } = {}
168
170
  e.initCustomEvent(type, bubbles, cancelable, detail);
169
171
  return e;
170
172
  }
173
+ function construct_svelte_component(component, props) {
174
+ return new component(props);
175
+ }
171
176
  var current_component;
172
177
  function set_current_component(component) {
173
178
  current_component = component;
@@ -411,13 +416,13 @@ function create_component(block) {
411
416
  block && block.c();
412
417
  }
413
418
  function mount_component(component, target, anchor, customElement) {
414
- const { fragment, on_mount, on_destroy, after_update } = component.$$;
419
+ const { fragment, after_update } = component.$$;
415
420
  fragment && fragment.m(target, anchor);
416
421
  if (!customElement) {
417
422
  add_render_callback(() => {
418
- const new_on_destroy = on_mount.map(run).filter(is_function);
419
- if (on_destroy) {
420
- on_destroy.push(...new_on_destroy);
423
+ const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
424
+ if (component.$$.on_destroy) {
425
+ component.$$.on_destroy.push(...new_on_destroy);
421
426
  } else {
422
427
  run_all(new_on_destroy);
423
428
  }
@@ -448,7 +453,7 @@ function init(component, options, instance62, create_fragment62, not_equal2, pro
448
453
  set_current_component(component);
449
454
  const $$ = component.$$ = {
450
455
  fragment: null,
451
- ctx: null,
456
+ ctx: [],
452
457
  props,
453
458
  update: noop,
454
459
  not_equal: not_equal2,
@@ -501,6 +506,9 @@ var SvelteComponent = class {
501
506
  this.$destroy = noop;
502
507
  }
503
508
  $on(type, callback) {
509
+ if (!is_function(callback)) {
510
+ return noop;
511
+ }
504
512
  const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
505
513
  callbacks.push(callback);
506
514
  return () => {
@@ -3636,7 +3644,7 @@ function create_else_block_1(ctx) {
3636
3644
  if (!current || dirty & 16) {
3637
3645
  button.disabled = ctx2[4];
3638
3646
  }
3639
- if (dirty & 15) {
3647
+ if (!current || dirty & 15) {
3640
3648
  toggle_class(button, "is-active", ctx2[3]);
3641
3649
  }
3642
3650
  },
@@ -3784,7 +3792,7 @@ function create_else_block2(ctx) {
3784
3792
  placement: ctx2[6],
3785
3793
  className: ctx2[0]
3786
3794
  });
3787
- if (dirty & 15) {
3795
+ if (!current || dirty & 15) {
3788
3796
  toggle_class(button, "is-active", ctx2[3]);
3789
3797
  }
3790
3798
  },
@@ -3894,7 +3902,7 @@ function create_if_block_1(ctx) {
3894
3902
  theme: ctx2[2],
3895
3903
  className: "fastboard-panel"
3896
3904
  });
3897
- if (dirty & 15) {
3905
+ if (!current || dirty & 15) {
3898
3906
  toggle_class(button, "is-active", ctx2[3]);
3899
3907
  }
3900
3908
  if (!current || dirty & 2 && span0_class_value !== (span0_class_value = ctx2[1] + "-triangle")) {
@@ -5494,7 +5502,7 @@ function instance50($$self, $$props, $$invalidate) {
5494
5502
  $$invalidate(4, type = disabled ? "disable" : "normal");
5495
5503
  }
5496
5504
  if ($$self.$$.dirty & 16384) {
5497
- $$subscribe_camera($$invalidate(8, camera = app?.baseCamera));
5505
+ $$subscribe_camera($$invalidate(8, camera = app?.camera));
5498
5506
  }
5499
5507
  if ($$self.$$.dirty & 8) {
5500
5508
  $$invalidate(16, scale = $camera?.scale ?? 1);
@@ -5543,7 +5551,7 @@ var ZoomControl = class extends SvelteComponent {
5543
5551
  };
5544
5552
  var ZoomControl_default = ZoomControl;
5545
5553
 
5546
- // ../../node_modules/.pnpm/svelte@3.49.0/node_modules/svelte/store/index.mjs
5554
+ // ../../node_modules/.pnpm/svelte@3.53.0/node_modules/svelte/store/index.mjs
5547
5555
  var subscriber_queue = [];
5548
5556
  function writable(value, start = noop) {
5549
5557
  let stop;
@@ -6062,7 +6070,7 @@ function create_each_block(key_1, ctx) {
6062
6070
  span = element("span");
6063
6071
  t = space();
6064
6072
  attr(span, "class", "fastboard-toolbar-color-item");
6065
- set_style(span, "background-color", ctx[7], false);
6073
+ set_style(span, "background-color", ctx[7]);
6066
6074
  attr(button, "class", button_class_value = "fastboard-toolbar-btn fastboard-toolbar-color-btn " + ctx[0]);
6067
6075
  attr(button, "data-color-key", ctx[7]);
6068
6076
  button.disabled = ctx[1];
@@ -6313,7 +6321,7 @@ function create_each_block2(key_1, ctx) {
6313
6321
  span = element("span");
6314
6322
  t = space();
6315
6323
  attr(span, "class", "fastboard-toolbar-color-item");
6316
- set_style(span, "background-color", ctx[7], false);
6324
+ set_style(span, "background-color", ctx[7]);
6317
6325
  attr(button, "class", button_class_value = "fastboard-toolbar-btn fastboard-toolbar-color-btn " + ctx[0]);
6318
6326
  attr(button, "data-color-key", ctx[7]);
6319
6327
  button.disabled = ctx[1];
@@ -6460,7 +6468,7 @@ function create_else_block5(ctx) {
6460
6468
  return { props: { theme: ctx2[0] } };
6461
6469
  }
6462
6470
  if (switch_value) {
6463
- switch_instance = new switch_value(switch_props(ctx));
6471
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
6464
6472
  }
6465
6473
  return {
6466
6474
  c() {
@@ -6469,9 +6477,8 @@ function create_else_block5(ctx) {
6469
6477
  switch_instance_anchor = empty();
6470
6478
  },
6471
6479
  m(target, anchor) {
6472
- if (switch_instance) {
6480
+ if (switch_instance)
6473
6481
  mount_component(switch_instance, target, anchor);
6474
- }
6475
6482
  insert(target, switch_instance_anchor, anchor);
6476
6483
  current = true;
6477
6484
  },
@@ -6489,7 +6496,7 @@ function create_else_block5(ctx) {
6489
6496
  check_outros();
6490
6497
  }
6491
6498
  if (switch_value) {
6492
- switch_instance = new switch_value(switch_props(ctx2));
6499
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
6493
6500
  create_component(switch_instance.$$.fragment);
6494
6501
  transition_in(switch_instance.$$.fragment, 1);
6495
6502
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -6531,7 +6538,7 @@ function create_if_block5(ctx) {
6531
6538
  };
6532
6539
  }
6533
6540
  if (switch_value) {
6534
- switch_instance = new switch_value(switch_props(ctx));
6541
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
6535
6542
  }
6536
6543
  return {
6537
6544
  c() {
@@ -6540,9 +6547,8 @@ function create_if_block5(ctx) {
6540
6547
  switch_instance_anchor = empty();
6541
6548
  },
6542
6549
  m(target, anchor) {
6543
- if (switch_instance) {
6550
+ if (switch_instance)
6544
6551
  mount_component(switch_instance, target, anchor);
6545
- }
6546
6552
  insert(target, switch_instance_anchor, anchor);
6547
6553
  current = true;
6548
6554
  },
@@ -6560,7 +6566,7 @@ function create_if_block5(ctx) {
6560
6566
  check_outros();
6561
6567
  }
6562
6568
  if (switch_value) {
6563
- switch_instance = new switch_value(switch_props(ctx2));
6569
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
6564
6570
  create_component(switch_instance.$$.fragment);
6565
6571
  transition_in(switch_instance.$$.fragment, 1);
6566
6572
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -6669,7 +6675,7 @@ function create_each_block3(key_1, ctx) {
6669
6675
  content: tooltip(ctx[6][ctx[12]], ctx[2][ctx[12]]),
6670
6676
  placement: "top"
6671
6677
  });
6672
- if (dirty & 25) {
6678
+ if (!current || dirty & 25) {
6673
6679
  toggle_class(button, "is-active", ctx[13]);
6674
6680
  }
6675
6681
  },
@@ -7500,7 +7506,7 @@ function create_else_block_6(ctx) {
7500
7506
  return { props: { theme: ctx2[1] } };
7501
7507
  }
7502
7508
  if (switch_value) {
7503
- switch_instance = new switch_value(switch_props(ctx));
7509
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
7504
7510
  }
7505
7511
  return {
7506
7512
  c() {
@@ -7509,9 +7515,8 @@ function create_else_block_6(ctx) {
7509
7515
  switch_instance_anchor = empty();
7510
7516
  },
7511
7517
  m(target, anchor) {
7512
- if (switch_instance) {
7518
+ if (switch_instance)
7513
7519
  mount_component(switch_instance, target, anchor);
7514
- }
7515
7520
  insert(target, switch_instance_anchor, anchor);
7516
7521
  current = true;
7517
7522
  },
@@ -7529,7 +7534,7 @@ function create_else_block_6(ctx) {
7529
7534
  check_outros();
7530
7535
  }
7531
7536
  if (switch_value) {
7532
- switch_instance = new switch_value(switch_props(ctx2));
7537
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
7533
7538
  create_component(switch_instance.$$.fragment);
7534
7539
  transition_in(switch_instance.$$.fragment, 1);
7535
7540
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -7571,7 +7576,7 @@ function create_if_block_12(ctx) {
7571
7576
  };
7572
7577
  }
7573
7578
  if (switch_value) {
7574
- switch_instance = new switch_value(switch_props(ctx));
7579
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
7575
7580
  }
7576
7581
  return {
7577
7582
  c() {
@@ -7580,9 +7585,8 @@ function create_if_block_12(ctx) {
7580
7585
  switch_instance_anchor = empty();
7581
7586
  },
7582
7587
  m(target, anchor) {
7583
- if (switch_instance) {
7588
+ if (switch_instance)
7584
7589
  mount_component(switch_instance, target, anchor);
7585
- }
7586
7590
  insert(target, switch_instance_anchor, anchor);
7587
7591
  current = true;
7588
7592
  },
@@ -7600,7 +7604,7 @@ function create_if_block_12(ctx) {
7600
7604
  check_outros();
7601
7605
  }
7602
7606
  if (switch_value) {
7603
- switch_instance = new switch_value(switch_props(ctx2));
7607
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
7604
7608
  create_component(switch_instance.$$.fragment);
7605
7609
  transition_in(switch_instance.$$.fragment, 1);
7606
7610
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -7882,7 +7886,7 @@ function create_else_block_5(ctx) {
7882
7886
  return { props: { theme: ctx2[1] } };
7883
7887
  }
7884
7888
  if (switch_value) {
7885
- switch_instance = new switch_value(switch_props(ctx));
7889
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
7886
7890
  }
7887
7891
  return {
7888
7892
  c() {
@@ -7891,9 +7895,8 @@ function create_else_block_5(ctx) {
7891
7895
  switch_instance_anchor = empty();
7892
7896
  },
7893
7897
  m(target, anchor) {
7894
- if (switch_instance) {
7898
+ if (switch_instance)
7895
7899
  mount_component(switch_instance, target, anchor);
7896
- }
7897
7900
  insert(target, switch_instance_anchor, anchor);
7898
7901
  current = true;
7899
7902
  },
@@ -7911,7 +7914,7 @@ function create_else_block_5(ctx) {
7911
7914
  check_outros();
7912
7915
  }
7913
7916
  if (switch_value) {
7914
- switch_instance = new switch_value(switch_props(ctx2));
7917
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
7915
7918
  create_component(switch_instance.$$.fragment);
7916
7919
  transition_in(switch_instance.$$.fragment, 1);
7917
7920
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -7953,7 +7956,7 @@ function create_if_block_11(ctx) {
7953
7956
  };
7954
7957
  }
7955
7958
  if (switch_value) {
7956
- switch_instance = new switch_value(switch_props(ctx));
7959
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
7957
7960
  }
7958
7961
  return {
7959
7962
  c() {
@@ -7962,9 +7965,8 @@ function create_if_block_11(ctx) {
7962
7965
  switch_instance_anchor = empty();
7963
7966
  },
7964
7967
  m(target, anchor) {
7965
- if (switch_instance) {
7968
+ if (switch_instance)
7966
7969
  mount_component(switch_instance, target, anchor);
7967
- }
7968
7970
  insert(target, switch_instance_anchor, anchor);
7969
7971
  current = true;
7970
7972
  },
@@ -7982,7 +7984,7 @@ function create_if_block_11(ctx) {
7982
7984
  check_outros();
7983
7985
  }
7984
7986
  if (switch_value) {
7985
- switch_instance = new switch_value(switch_props(ctx2));
7987
+ switch_instance = construct_svelte_component(switch_value, switch_props(ctx2));
7986
7988
  create_component(switch_instance.$$.fragment);
7987
7989
  transition_in(switch_instance.$$.fragment, 1);
7988
7990
  mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
@@ -9638,7 +9640,7 @@ function create_fragment57(ctx) {
9638
9640
  }
9639
9641
  if (scrollHeight_action && is_function(scrollHeight_action.update) && dirty[0] & 16)
9640
9642
  scrollHeight_action.update.call(null, ctx2[4]);
9641
- if (dirty[0] & 32) {
9643
+ if (!current || dirty[0] & 32) {
9642
9644
  toggle_class(div0, "scrollable", ctx2[5]);
9643
9645
  }
9644
9646
  if (ctx2[5]) {
@@ -10194,12 +10196,7 @@ function create_fragment58(ctx) {
10194
10196
  path = svg_element("path");
10195
10197
  if_block.c();
10196
10198
  attr(div0, "class", div0_class_value = name6 + "-contents " + ctx[1]);
10197
- set_style(
10198
- div0,
10199
- "height",
10200
- ctx[6] ? ctx[7] + "px" : "auto",
10201
- false
10202
- );
10199
+ set_style(div0, "height", ctx[6] ? ctx[7] + "px" : "auto");
10203
10200
  attr(input, "type", "checkbox");
10204
10201
  attr(path, "d", "M0 41H12C14.2091 41 16 39.2091 16 37V5C16 2.79086 14.2091 1 12 1H0");
10205
10202
  attr(path, "stroke", "#000");
@@ -10257,12 +10254,7 @@ function create_fragment58(ctx) {
10257
10254
  attr(div0, "class", div0_class_value);
10258
10255
  }
10259
10256
  if (dirty & 192) {
10260
- set_style(
10261
- div0,
10262
- "height",
10263
- ctx2[6] ? ctx2[7] + "px" : "auto",
10264
- false
10265
- );
10257
+ set_style(div0, "height", ctx2[6] ? ctx2[7] + "px" : "auto");
10266
10258
  }
10267
10259
  if (dirty & 8) {
10268
10260
  input.checked = ctx2[3];
@@ -10283,7 +10275,7 @@ function create_fragment58(ctx) {
10283
10275
  if (!current || dirty & 2 && div1_class_value !== (div1_class_value = name6 + " " + ctx2[1])) {
10284
10276
  attr(div1, "class", div1_class_value);
10285
10277
  }
10286
- if (dirty & 10) {
10278
+ if (!current || dirty & 10) {
10287
10279
  toggle_class(div1, "collapsed", ctx2[3]);
10288
10280
  }
10289
10281
  },
@@ -11393,7 +11385,7 @@ function create_fragment60(ctx) {
11393
11385
  });
11394
11386
  check_outros();
11395
11387
  }
11396
- if (dirty & 1) {
11388
+ if (!current || dirty & 1) {
11397
11389
  toggle_class(div2, "loading", !ctx2[0]);
11398
11390
  }
11399
11391
  },
@@ -11779,7 +11771,7 @@ function create_fragment61(ctx) {
11779
11771
  });
11780
11772
  check_outros();
11781
11773
  }
11782
- if (dirty & 32) {
11774
+ if (!current || dirty & 32) {
11783
11775
  toggle_class(div1, "hidden", !(ctx2[5] === "visible" || ctx2[5] === "toolbar-only"));
11784
11776
  }
11785
11777
  if (ctx2[3].redo_undo?.enable !== false) {
@@ -11820,7 +11812,7 @@ function create_fragment61(ctx) {
11820
11812
  });
11821
11813
  check_outros();
11822
11814
  }
11823
- if (dirty & 32) {
11815
+ if (!current || dirty & 32) {
11824
11816
  toggle_class(div2, "hidden", ctx2[5] !== "visible");
11825
11817
  }
11826
11818
  if (ctx2[3].page_control?.enable !== false) {
@@ -11842,10 +11834,10 @@ function create_fragment61(ctx) {
11842
11834
  });
11843
11835
  check_outros();
11844
11836
  }
11845
- if (dirty & 32) {
11837
+ if (!current || dirty & 32) {
11846
11838
  toggle_class(div3, "hidden", ctx2[5] !== "visible");
11847
11839
  }
11848
- if (dirty & 1) {
11840
+ if (!current || dirty & 1) {
11849
11841
  toggle_class(div4, "loading", !ctx2[0]);
11850
11842
  }
11851
11843
  },
@@ -12076,4 +12068,3 @@ function createReplayUI(player, div) {
12076
12068
  }
12077
12069
 
12078
12070
  export { Fastboard_default as Fastboard, PageControl_default as PageControl, PlayerControl_default as PlayerControl, RedoUndo_default as RedoUndo, ReplayFastboard_default as ReplayFastboard, Toolbar_default as Toolbar, ZoomControl_default as ZoomControl, createReplayUI, createUI, stockedApps };
12079
- //# sourceMappingURL=index.mjs.map