@netless/fastboard-ui 0.3.4-canary.0 → 0.3.4

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.
@@ -9269,7 +9269,7 @@ function create_fragment57(ctx) {
9269
9269
  m(target, anchor) {
9270
9270
  insert(target, div2, anchor);
9271
9271
  append(div2, div0);
9272
- ctx[5](div0);
9272
+ ctx[6](div0);
9273
9273
  append(div2, t);
9274
9274
  append(div2, div1);
9275
9275
  mount_component(playercontrol, div1, null);
@@ -9305,7 +9305,7 @@ function create_fragment57(ctx) {
9305
9305
  d(detaching) {
9306
9306
  if (detaching)
9307
9307
  detach(div2);
9308
- ctx[5](null);
9308
+ ctx[6](null);
9309
9309
  destroy_component(playercontrol);
9310
9310
  mounted = false;
9311
9311
  dispose();
@@ -9319,6 +9319,7 @@ function instance57($$self, $$props, $$invalidate) {
9319
9319
  let { language = "en" } = $$props;
9320
9320
  let { containerRef = void 0 } = $$props;
9321
9321
  let container;
9322
+ let mounted = false;
9322
9323
  onMount(() => {
9323
9324
  if (containerRef) {
9324
9325
  containerRef(container);
@@ -9347,20 +9348,22 @@ function instance57($$self, $$props, $$invalidate) {
9347
9348
  $$self.$$.update = () => {
9348
9349
  if ($$self.$$.dirty & 9) {
9349
9350
  try {
9350
- if (player && container)
9351
+ if (player && container) {
9351
9352
  player.bindContainer(container);
9353
+ $$invalidate(5, mounted = true);
9354
+ }
9352
9355
  } catch (err) {
9353
9356
  console.error("[fastboard] An error occurred while binding container");
9354
9357
  console.error(err);
9355
9358
  }
9356
9359
  }
9357
- if ($$self.$$.dirty & 3) {
9358
- if (player && theme) {
9360
+ if ($$self.$$.dirty & 35) {
9361
+ if (player && theme && mounted) {
9359
9362
  player.manager.setPrefersColorScheme(theme);
9360
9363
  }
9361
9364
  }
9362
9365
  };
9363
- return [player, theme, language, container, containerRef, div0_binding];
9366
+ return [player, theme, language, container, containerRef, mounted, div0_binding];
9364
9367
  }
9365
9368
  var ReplayFastboard = class extends SvelteComponent {
9366
9369
  constructor(options) {
@@ -9599,7 +9602,7 @@ function create_fragment58(ctx) {
9599
9602
  m(target, anchor) {
9600
9603
  insert(target, div4, anchor);
9601
9604
  append(div4, div0);
9602
- ctx[13](div0);
9605
+ ctx[14](div0);
9603
9606
  append(div4, t0);
9604
9607
  append(div4, div1);
9605
9608
  if (if_block0)
@@ -9731,7 +9734,7 @@ function create_fragment58(ctx) {
9731
9734
  d(detaching) {
9732
9735
  if (detaching)
9733
9736
  detach(div4);
9734
- ctx[13](null);
9737
+ ctx[14](null);
9735
9738
  if (if_block0)
9736
9739
  if_block0.d();
9737
9740
  if (if_block1)
@@ -9750,9 +9753,9 @@ function instance58($$self, $$props, $$invalidate) {
9750
9753
  let writable2;
9751
9754
  let boxState;
9752
9755
  let focusedApp;
9753
- let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(10, $focusedApp = $$value)), focusedApp);
9754
- let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(11, $boxState = $$value)), boxState);
9755
- let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(12, $writable = $$value)), writable2);
9756
+ let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(11, $focusedApp = $$value)), focusedApp);
9757
+ let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(12, $boxState = $$value)), boxState);
9758
+ let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(13, $writable = $$value)), writable2);
9756
9759
  $$self.$$.on_destroy.push(() => $$unsubscribe_focusedApp());
9757
9760
  $$self.$$.on_destroy.push(() => $$unsubscribe_boxState());
9758
9761
  $$self.$$.on_destroy.push(() => $$unsubscribe_writable());
@@ -9764,6 +9767,7 @@ function instance58($$self, $$props, $$invalidate) {
9764
9767
  const AppsShowToolbar = ["DocsViewer", "Slide"];
9765
9768
  let container;
9766
9769
  let layout = "hidden";
9770
+ let mounted = false;
9767
9771
  onMount(() => {
9768
9772
  if (containerRef) {
9769
9773
  containerRef(container);
@@ -9801,7 +9805,7 @@ function instance58($$self, $$props, $$invalidate) {
9801
9805
  if ($$self.$$.dirty & 1) {
9802
9806
  $$subscribe_focusedApp($$invalidate(6, focusedApp = app == null ? void 0 : app.focusedApp));
9803
9807
  }
9804
- if ($$self.$$.dirty & 7168) {
9808
+ if ($$self.$$.dirty & 14336) {
9805
9809
  if (!$writable) {
9806
9810
  $$invalidate(5, layout = "hidden");
9807
9811
  } else if ($boxState === "maximized") {
@@ -9816,15 +9820,17 @@ function instance58($$self, $$props, $$invalidate) {
9816
9820
  }
9817
9821
  if ($$self.$$.dirty & 17) {
9818
9822
  try {
9819
- if (app && container)
9823
+ if (app && container) {
9820
9824
  app.bindContainer(container);
9825
+ $$invalidate(10, mounted = true);
9826
+ }
9821
9827
  } catch (err) {
9822
9828
  console.error("[fastboard] An error occurred while binding container");
9823
9829
  console.error(err);
9824
9830
  }
9825
9831
  }
9826
- if ($$self.$$.dirty & 3) {
9827
- if (app && theme) {
9832
+ if ($$self.$$.dirty & 1027) {
9833
+ if (app && theme && mounted) {
9828
9834
  app.manager.setPrefersColorScheme(theme);
9829
9835
  }
9830
9836
  }
@@ -9840,6 +9846,7 @@ function instance58($$self, $$props, $$invalidate) {
9840
9846
  boxState,
9841
9847
  writable2,
9842
9848
  containerRef,
9849
+ mounted,
9843
9850
  $focusedApp,
9844
9851
  $boxState,
9845
9852
  $writable,
@@ -9860,6 +9867,62 @@ var Fastboard = class extends SvelteComponent {
9860
9867
  };
9861
9868
  var Fastboard_default = Fastboard;
9862
9869
 
9870
+ // src/helpers/index.ts
9871
+ function createUI(app, div) {
9872
+ let fastboard;
9873
+ const ui = {
9874
+ mount(div2, props) {
9875
+ if (fastboard) {
9876
+ fastboard.$destroy();
9877
+ }
9878
+ fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
9879
+ return ui;
9880
+ },
9881
+ update(props) {
9882
+ if (fastboard) {
9883
+ fastboard.$set(props);
9884
+ }
9885
+ },
9886
+ destroy() {
9887
+ if (fastboard) {
9888
+ fastboard.$destroy();
9889
+ }
9890
+ fastboard = void 0;
9891
+ }
9892
+ };
9893
+ if (div) {
9894
+ ui.mount(div);
9895
+ }
9896
+ return ui;
9897
+ }
9898
+ function createReplayUI(player, div) {
9899
+ let fastboard;
9900
+ const ui = {
9901
+ mount(div2, props) {
9902
+ if (fastboard) {
9903
+ fastboard.$destroy();
9904
+ }
9905
+ fastboard = new ReplayFastboard_default({ target: div2, props: __spreadValues({ player }, props) });
9906
+ return ui;
9907
+ },
9908
+ update(props) {
9909
+ if (fastboard) {
9910
+ fastboard.$set(props);
9911
+ }
9912
+ },
9913
+ destroy() {
9914
+ if (fastboard) {
9915
+ fastboard.$destroy();
9916
+ }
9917
+ fastboard = void 0;
9918
+ }
9919
+ };
9920
+ if (div) {
9921
+ ui.mount(div);
9922
+ }
9923
+ return ui;
9924
+ }
9925
+
9863
9926
  // inline-sass-helper:inline-sass-style-helper.js
9864
9927
  function injectStyle(text4) {
9865
9928
  if (typeof document !== "undefined") {
@@ -9876,5 +9939,5 @@ var style_default = '.tippy-box[data-animation=fade][data-state=hidden]{opacity:
9876
9939
  // inline-sass-stub:./src/style.scss
9877
9940
  injectStyle(style_default);
9878
9941
 
9879
- 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, apps };
9942
+ 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, apps, createReplayUI, createUI };
9880
9943
  //# sourceMappingURL=index.svelte.mjs.map