@netless/fastboard-ui 0.3.0-canary.2 → 0.3.0-canary.5

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.d.ts CHANGED
@@ -58,7 +58,7 @@ declare interface ReplayFastboardProps {
58
58
  player?: FastboardPlayer | null;
59
59
  theme?: Theme;
60
60
  language?: Language;
61
- ref?: (container: HTMLDivElement | null) => void;
61
+ containerRef?: (container: HTMLDivElement | null) => void;
62
62
  }
63
63
  declare class ReplayFastboard extends SvelteComponentTyped<ReplayFastboardProps> {
64
64
  }
@@ -67,7 +67,7 @@ declare interface FastboardProps {
67
67
  app?: FastboardApp | null;
68
68
  theme?: Theme;
69
69
  language?: Language;
70
- ref?: (container: HTMLDivElement | null) => void;
70
+ containerRef?: (container: HTMLDivElement | null) => void;
71
71
  }
72
72
  declare class Fastboard extends SvelteComponentTyped<FastboardProps> {
73
73
  }
package/dist/index.js CHANGED
@@ -231,6 +231,9 @@ function get_current_component() {
231
231
  throw new Error("Function called outside component initialization");
232
232
  return current_component;
233
233
  }
234
+ function onMount(fn) {
235
+ get_current_component().$$.on_mount.push(fn);
236
+ }
234
237
  function createEventDispatcher() {
235
238
  const component = get_current_component();
236
239
  return (type, detail) => {
@@ -3544,6 +3547,13 @@ var tippy = function(node, props) {
3544
3547
  }
3545
3548
  };
3546
3549
  };
3550
+ function tippy_hide_all() {
3551
+ document.querySelectorAll("[data-tippy-root]").forEach((el) => {
3552
+ const instance59 = el._tippy;
3553
+ if (instance59)
3554
+ instance59.hide();
3555
+ });
3556
+ }
3547
3557
  var tippy_menu = {
3548
3558
  delay: 0,
3549
3559
  placement: "right-start",
@@ -8553,10 +8563,6 @@ function instance54($$self, $$props, $$invalidate) {
8553
8563
  $:
8554
8564
  $$subscribe_status($$invalidate(15, status = app == null ? void 0 : app.appsStatus));
8555
8565
  }
8556
- if ($$self.$$.dirty[0] & 536870944 | $$self.$$.dirty[1] & 1) {
8557
- $:
8558
- max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
8559
- }
8560
8566
  if ($$self.$$.dirty[0] & 192) {
8561
8567
  $:
8562
8568
  if (applianceShapes.includes(appliance)) {
@@ -8565,6 +8571,10 @@ function instance54($$self, $$props, $$invalidate) {
8565
8571
  $$invalidate(9, last_shape = shape);
8566
8572
  }
8567
8573
  }
8574
+ if ($$self.$$.dirty[0] & 536870944 | $$self.$$.dirty[1] & 1) {
8575
+ $:
8576
+ max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
8577
+ }
8568
8578
  };
8569
8579
  return [
8570
8580
  app,
@@ -9839,6 +9849,8 @@ function create_fragment57(ctx) {
9839
9849
  let div1_class_value;
9840
9850
  let div2_class_value;
9841
9851
  let current;
9852
+ let mounted;
9853
+ let dispose;
9842
9854
  playercontrol = new PlayerControl_default({
9843
9855
  props: {
9844
9856
  player: ctx[0],
@@ -9866,6 +9878,10 @@ function create_fragment57(ctx) {
9866
9878
  append(div2, div1);
9867
9879
  mount_component(playercontrol, div1, null);
9868
9880
  current = true;
9881
+ if (!mounted) {
9882
+ dispose = listen(div0, "touchstart", tippy_hide_all, true);
9883
+ mounted = true;
9884
+ }
9869
9885
  },
9870
9886
  p(ctx2, [dirty]) {
9871
9887
  const playercontrol_changes = {};
@@ -9895,6 +9911,8 @@ function create_fragment57(ctx) {
9895
9911
  detach(div2);
9896
9912
  ctx[5](null);
9897
9913
  destroy_component(playercontrol);
9914
+ mounted = false;
9915
+ dispose();
9898
9916
  }
9899
9917
  };
9900
9918
  }
@@ -9903,7 +9921,7 @@ function instance57($$self, $$props, $$invalidate) {
9903
9921
  let { player = null } = $$props;
9904
9922
  let { theme = "light" } = $$props;
9905
9923
  let { language = "en" } = $$props;
9906
- let { ref = void 0 } = $$props;
9924
+ let { containerRef = void 0 } = $$props;
9907
9925
  let container;
9908
9926
  function div0_binding($$value) {
9909
9927
  binding_callbacks[$$value ? "unshift" : "push"](() => {
@@ -9918,8 +9936,8 @@ function instance57($$self, $$props, $$invalidate) {
9918
9936
  $$invalidate(1, theme = $$props2.theme);
9919
9937
  if ("language" in $$props2)
9920
9938
  $$invalidate(2, language = $$props2.language);
9921
- if ("ref" in $$props2)
9922
- $$invalidate(4, ref = $$props2.ref);
9939
+ if ("containerRef" in $$props2)
9940
+ $$invalidate(4, containerRef = $$props2.containerRef);
9923
9941
  };
9924
9942
  $$self.$$.update = () => {
9925
9943
  if ($$self.$$.dirty & 9) {
@@ -9929,16 +9947,21 @@ function instance57($$self, $$props, $$invalidate) {
9929
9947
  }
9930
9948
  if ($$self.$$.dirty & 24) {
9931
9949
  $:
9932
- if (ref)
9933
- ref(container || null);
9950
+ if (containerRef)
9951
+ containerRef(container || null);
9934
9952
  }
9935
9953
  };
9936
- return [player, theme, language, container, ref, div0_binding];
9954
+ return [player, theme, language, container, containerRef, div0_binding];
9937
9955
  }
9938
9956
  var ReplayFastboard = class extends SvelteComponent {
9939
9957
  constructor(options) {
9940
9958
  super();
9941
- init(this, options, instance57, create_fragment57, safe_not_equal, { player: 0, theme: 1, language: 2, ref: 4 });
9959
+ init(this, options, instance57, create_fragment57, safe_not_equal, {
9960
+ player: 0,
9961
+ theme: 1,
9962
+ language: 2,
9963
+ containerRef: 4
9964
+ });
9942
9965
  }
9943
9966
  };
9944
9967
  var ReplayFastboard_default = ReplayFastboard;
@@ -9964,6 +9987,8 @@ function create_fragment58(ctx) {
9964
9987
  let div3_class_value;
9965
9988
  let div4_class_value;
9966
9989
  let current;
9990
+ let mounted;
9991
+ let dispose;
9967
9992
  toolbar = new Toolbar_default({
9968
9993
  props: {
9969
9994
  app: ctx[0],
@@ -10030,6 +10055,10 @@ function create_fragment58(ctx) {
10030
10055
  append(div4, div3);
10031
10056
  mount_component(pagecontrol, div3, null);
10032
10057
  current = true;
10058
+ if (!mounted) {
10059
+ dispose = listen(div0, "touchstart", tippy_hide_all, true);
10060
+ mounted = true;
10061
+ }
10033
10062
  },
10034
10063
  p(ctx2, [dirty]) {
10035
10064
  const toolbar_changes = {};
@@ -10092,6 +10121,8 @@ function create_fragment58(ctx) {
10092
10121
  destroy_component(redoundo);
10093
10122
  destroy_component(zoomcontrol);
10094
10123
  destroy_component(pagecontrol);
10124
+ mounted = false;
10125
+ dispose();
10095
10126
  }
10096
10127
  };
10097
10128
  }
@@ -10100,8 +10131,17 @@ function instance58($$self, $$props, $$invalidate) {
10100
10131
  let { app = null } = $$props;
10101
10132
  let { theme = "light" } = $$props;
10102
10133
  let { language = "en" } = $$props;
10103
- let { ref = void 0 } = $$props;
10134
+ let { containerRef = void 0 } = $$props;
10104
10135
  let container;
10136
+ onMount(() => {
10137
+ if (containerRef) {
10138
+ containerRef(container);
10139
+ return () => {
10140
+ if (containerRef)
10141
+ containerRef(null);
10142
+ };
10143
+ }
10144
+ });
10105
10145
  function div0_binding($$value) {
10106
10146
  binding_callbacks[$$value ? "unshift" : "push"](() => {
10107
10147
  container = $$value;
@@ -10115,8 +10155,8 @@ function instance58($$self, $$props, $$invalidate) {
10115
10155
  $$invalidate(1, theme = $$props2.theme);
10116
10156
  if ("language" in $$props2)
10117
10157
  $$invalidate(2, language = $$props2.language);
10118
- if ("ref" in $$props2)
10119
- $$invalidate(4, ref = $$props2.ref);
10158
+ if ("containerRef" in $$props2)
10159
+ $$invalidate(4, containerRef = $$props2.containerRef);
10120
10160
  };
10121
10161
  $$self.$$.update = () => {
10122
10162
  if ($$self.$$.dirty & 9) {
@@ -10124,18 +10164,18 @@ function instance58($$self, $$props, $$invalidate) {
10124
10164
  if (app && container)
10125
10165
  app.bindContainer(container);
10126
10166
  }
10127
- if ($$self.$$.dirty & 24) {
10128
- $:
10129
- if (ref)
10130
- ref(container || null);
10131
- }
10132
10167
  };
10133
- return [app, theme, language, container, ref, div0_binding];
10168
+ return [app, theme, language, container, containerRef, div0_binding];
10134
10169
  }
10135
10170
  var Fastboard = class extends SvelteComponent {
10136
10171
  constructor(options) {
10137
10172
  super();
10138
- init(this, options, instance58, create_fragment58, safe_not_equal, { app: 0, theme: 1, language: 2, ref: 4 });
10173
+ init(this, options, instance58, create_fragment58, safe_not_equal, {
10174
+ app: 0,
10175
+ theme: 1,
10176
+ language: 2,
10177
+ containerRef: 4
10178
+ });
10139
10179
  }
10140
10180
  };
10141
10181
  var Fastboard_default = Fastboard;