@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.mjs CHANGED
@@ -193,6 +193,9 @@ function get_current_component() {
193
193
  throw new Error("Function called outside component initialization");
194
194
  return current_component;
195
195
  }
196
+ function onMount(fn) {
197
+ get_current_component().$$.on_mount.push(fn);
198
+ }
196
199
  function createEventDispatcher() {
197
200
  const component = get_current_component();
198
201
  return (type, detail) => {
@@ -3506,6 +3509,13 @@ var tippy = function(node, props) {
3506
3509
  }
3507
3510
  };
3508
3511
  };
3512
+ function tippy_hide_all() {
3513
+ document.querySelectorAll("[data-tippy-root]").forEach((el) => {
3514
+ const instance59 = el._tippy;
3515
+ if (instance59)
3516
+ instance59.hide();
3517
+ });
3518
+ }
3509
3519
  var tippy_menu = {
3510
3520
  delay: 0,
3511
3521
  placement: "right-start",
@@ -8515,10 +8525,6 @@ function instance54($$self, $$props, $$invalidate) {
8515
8525
  $:
8516
8526
  $$subscribe_status($$invalidate(15, status = app == null ? void 0 : app.appsStatus));
8517
8527
  }
8518
- if ($$self.$$.dirty[0] & 536870944 | $$self.$$.dirty[1] & 1) {
8519
- $:
8520
- max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
8521
- }
8522
8528
  if ($$self.$$.dirty[0] & 192) {
8523
8529
  $:
8524
8530
  if (applianceShapes.includes(appliance)) {
@@ -8527,6 +8533,10 @@ function instance54($$self, $$props, $$invalidate) {
8527
8533
  $$invalidate(9, last_shape = shape);
8528
8534
  }
8529
8535
  }
8536
+ if ($$self.$$.dirty[0] & 536870944 | $$self.$$.dirty[1] & 1) {
8537
+ $:
8538
+ max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
8539
+ }
8530
8540
  };
8531
8541
  return [
8532
8542
  app,
@@ -9801,6 +9811,8 @@ function create_fragment57(ctx) {
9801
9811
  let div1_class_value;
9802
9812
  let div2_class_value;
9803
9813
  let current;
9814
+ let mounted;
9815
+ let dispose;
9804
9816
  playercontrol = new PlayerControl_default({
9805
9817
  props: {
9806
9818
  player: ctx[0],
@@ -9828,6 +9840,10 @@ function create_fragment57(ctx) {
9828
9840
  append(div2, div1);
9829
9841
  mount_component(playercontrol, div1, null);
9830
9842
  current = true;
9843
+ if (!mounted) {
9844
+ dispose = listen(div0, "touchstart", tippy_hide_all, true);
9845
+ mounted = true;
9846
+ }
9831
9847
  },
9832
9848
  p(ctx2, [dirty]) {
9833
9849
  const playercontrol_changes = {};
@@ -9857,6 +9873,8 @@ function create_fragment57(ctx) {
9857
9873
  detach(div2);
9858
9874
  ctx[5](null);
9859
9875
  destroy_component(playercontrol);
9876
+ mounted = false;
9877
+ dispose();
9860
9878
  }
9861
9879
  };
9862
9880
  }
@@ -9867,6 +9885,15 @@ function instance57($$self, $$props, $$invalidate) {
9867
9885
  let { language = "en" } = $$props;
9868
9886
  let { containerRef = void 0 } = $$props;
9869
9887
  let container;
9888
+ onMount(() => {
9889
+ if (containerRef) {
9890
+ containerRef(container);
9891
+ return () => {
9892
+ if (containerRef)
9893
+ containerRef(null);
9894
+ };
9895
+ }
9896
+ });
9870
9897
  function div0_binding($$value) {
9871
9898
  binding_callbacks[$$value ? "unshift" : "push"](() => {
9872
9899
  container = $$value;
@@ -9886,13 +9913,13 @@ function instance57($$self, $$props, $$invalidate) {
9886
9913
  $$self.$$.update = () => {
9887
9914
  if ($$self.$$.dirty & 9) {
9888
9915
  $:
9889
- if (player && container)
9890
- player.bindContainer(container);
9891
- }
9892
- if ($$self.$$.dirty & 24) {
9893
- $:
9894
- if (containerRef)
9895
- containerRef(container || null);
9916
+ try {
9917
+ if (player && container)
9918
+ player.bindContainer(container);
9919
+ } catch (err) {
9920
+ console.error("[fastboard] An error occurred while binding container");
9921
+ console.error(err);
9922
+ }
9896
9923
  }
9897
9924
  };
9898
9925
  return [player, theme, language, container, containerRef, div0_binding];
@@ -9931,6 +9958,8 @@ function create_fragment58(ctx) {
9931
9958
  let div3_class_value;
9932
9959
  let div4_class_value;
9933
9960
  let current;
9961
+ let mounted;
9962
+ let dispose;
9934
9963
  toolbar = new Toolbar_default({
9935
9964
  props: {
9936
9965
  app: ctx[0],
@@ -9997,6 +10026,10 @@ function create_fragment58(ctx) {
9997
10026
  append(div4, div3);
9998
10027
  mount_component(pagecontrol, div3, null);
9999
10028
  current = true;
10029
+ if (!mounted) {
10030
+ dispose = listen(div0, "touchstart", tippy_hide_all, true);
10031
+ mounted = true;
10032
+ }
10000
10033
  },
10001
10034
  p(ctx2, [dirty]) {
10002
10035
  const toolbar_changes = {};
@@ -10059,6 +10092,8 @@ function create_fragment58(ctx) {
10059
10092
  destroy_component(redoundo);
10060
10093
  destroy_component(zoomcontrol);
10061
10094
  destroy_component(pagecontrol);
10095
+ mounted = false;
10096
+ dispose();
10062
10097
  }
10063
10098
  };
10064
10099
  }
@@ -10069,6 +10104,15 @@ function instance58($$self, $$props, $$invalidate) {
10069
10104
  let { language = "en" } = $$props;
10070
10105
  let { containerRef = void 0 } = $$props;
10071
10106
  let container;
10107
+ onMount(() => {
10108
+ if (containerRef) {
10109
+ containerRef(container);
10110
+ return () => {
10111
+ if (containerRef)
10112
+ containerRef(null);
10113
+ };
10114
+ }
10115
+ });
10072
10116
  function div0_binding($$value) {
10073
10117
  binding_callbacks[$$value ? "unshift" : "push"](() => {
10074
10118
  container = $$value;
@@ -10088,13 +10132,13 @@ function instance58($$self, $$props, $$invalidate) {
10088
10132
  $$self.$$.update = () => {
10089
10133
  if ($$self.$$.dirty & 9) {
10090
10134
  $:
10091
- if (app && container)
10092
- app.bindContainer(container);
10093
- }
10094
- if ($$self.$$.dirty & 24) {
10095
- $:
10096
- if (containerRef)
10097
- containerRef(container || null);
10135
+ try {
10136
+ if (app && container)
10137
+ app.bindContainer(container);
10138
+ } catch (err) {
10139
+ console.error("[fastboard] An error occurred while binding container");
10140
+ console.error(err);
10141
+ }
10098
10142
  }
10099
10143
  };
10100
10144
  return [app, theme, language, container, containerRef, div0_binding];