@netless/fastboard-ui 0.3.0-canary.3 → 0.3.0-canary.6

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.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
  }
@@ -9905,6 +9923,15 @@ function instance57($$self, $$props, $$invalidate) {
9905
9923
  let { language = "en" } = $$props;
9906
9924
  let { containerRef = void 0 } = $$props;
9907
9925
  let container;
9926
+ onMount(() => {
9927
+ if (containerRef) {
9928
+ containerRef(container);
9929
+ return () => {
9930
+ if (containerRef)
9931
+ containerRef(null);
9932
+ };
9933
+ }
9934
+ });
9908
9935
  function div0_binding($$value) {
9909
9936
  binding_callbacks[$$value ? "unshift" : "push"](() => {
9910
9937
  container = $$value;
@@ -9924,13 +9951,13 @@ function instance57($$self, $$props, $$invalidate) {
9924
9951
  $$self.$$.update = () => {
9925
9952
  if ($$self.$$.dirty & 9) {
9926
9953
  $:
9927
- if (player && container)
9928
- player.bindContainer(container);
9929
- }
9930
- if ($$self.$$.dirty & 24) {
9931
- $:
9932
- if (containerRef)
9933
- containerRef(container || null);
9954
+ try {
9955
+ if (player && container)
9956
+ player.bindContainer(container);
9957
+ } catch (err) {
9958
+ console.error("[fastboard] An error occurred while binding container");
9959
+ console.error(err);
9960
+ }
9934
9961
  }
9935
9962
  };
9936
9963
  return [player, theme, language, container, containerRef, div0_binding];
@@ -9969,6 +9996,8 @@ function create_fragment58(ctx) {
9969
9996
  let div3_class_value;
9970
9997
  let div4_class_value;
9971
9998
  let current;
9999
+ let mounted;
10000
+ let dispose;
9972
10001
  toolbar = new Toolbar_default({
9973
10002
  props: {
9974
10003
  app: ctx[0],
@@ -10035,6 +10064,10 @@ function create_fragment58(ctx) {
10035
10064
  append(div4, div3);
10036
10065
  mount_component(pagecontrol, div3, null);
10037
10066
  current = true;
10067
+ if (!mounted) {
10068
+ dispose = listen(div0, "touchstart", tippy_hide_all, true);
10069
+ mounted = true;
10070
+ }
10038
10071
  },
10039
10072
  p(ctx2, [dirty]) {
10040
10073
  const toolbar_changes = {};
@@ -10097,6 +10130,8 @@ function create_fragment58(ctx) {
10097
10130
  destroy_component(redoundo);
10098
10131
  destroy_component(zoomcontrol);
10099
10132
  destroy_component(pagecontrol);
10133
+ mounted = false;
10134
+ dispose();
10100
10135
  }
10101
10136
  };
10102
10137
  }
@@ -10107,6 +10142,15 @@ function instance58($$self, $$props, $$invalidate) {
10107
10142
  let { language = "en" } = $$props;
10108
10143
  let { containerRef = void 0 } = $$props;
10109
10144
  let container;
10145
+ onMount(() => {
10146
+ if (containerRef) {
10147
+ containerRef(container);
10148
+ return () => {
10149
+ if (containerRef)
10150
+ containerRef(null);
10151
+ };
10152
+ }
10153
+ });
10110
10154
  function div0_binding($$value) {
10111
10155
  binding_callbacks[$$value ? "unshift" : "push"](() => {
10112
10156
  container = $$value;
@@ -10126,13 +10170,13 @@ function instance58($$self, $$props, $$invalidate) {
10126
10170
  $$self.$$.update = () => {
10127
10171
  if ($$self.$$.dirty & 9) {
10128
10172
  $:
10129
- if (app && container)
10130
- app.bindContainer(container);
10131
- }
10132
- if ($$self.$$.dirty & 24) {
10133
- $:
10134
- if (containerRef)
10135
- containerRef(container || null);
10173
+ try {
10174
+ if (app && container)
10175
+ app.bindContainer(container);
10176
+ } catch (err) {
10177
+ console.error("[fastboard] An error occurred while binding container");
10178
+ console.error(err);
10179
+ }
10136
10180
  }
10137
10181
  };
10138
10182
  return [app, theme, language, container, containerRef, div0_binding];