@netless/fastboard-ui 1.0.5 → 1.0.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.
@@ -17274,11 +17274,13 @@ function create_fragment78(ctx) {
17274
17274
  );
17275
17275
  let if_block1 = (
17276
17276
  /*config*/
17277
- ((_b = ctx[3].redo_undo) == null ? void 0 : _b.enable) !== false && create_if_block_26(ctx)
17277
+ ((_b = ctx[3].redo_undo) == null ? void 0 : _b.enable) !== false && !/*hidden_redo_undo*/
17278
+ ctx[6] && create_if_block_26(ctx)
17278
17279
  );
17279
17280
  let if_block2 = (
17280
17281
  /*config*/
17281
- ((_c = ctx[3].zoom_control) == null ? void 0 : _c.enable) !== false && create_if_block_112(ctx)
17282
+ ((_c = ctx[3].zoom_control) == null ? void 0 : _c.enable) !== false && !/*hidden_zoom_control*/
17283
+ ctx[7] && create_if_block_112(ctx)
17282
17284
  );
17283
17285
  let if_block3 = (
17284
17286
  /*config*/
@@ -17307,23 +17309,26 @@ function create_fragment78(ctx) {
17307
17309
  attr(div0, "class", name9 + "-view");
17308
17310
  attr(div1, "class", div1_class_value = name9 + "-" + /*config*/
17309
17311
  (((_a2 = ctx[3].toolbar) == null ? void 0 : _a2.placement) || "left"));
17310
- toggle_class(div1, "hidden", !/*toolbar_has_items*/
17311
- ctx[6] || !/*layout*/
17312
- (ctx[5] === "visible" || /*layout*/
17313
- ctx[5] === "toolbar-only"));
17312
+ toggle_class(
17313
+ div1,
17314
+ "hidden",
17315
+ /*hidden_toolbar*/
17316
+ ctx[5]
17317
+ );
17314
17318
  attr(div2, "class", name9 + "-bottom-left");
17315
17319
  toggle_class(
17316
17320
  div2,
17317
17321
  "hidden",
17318
- /*layout*/
17319
- ctx[5] !== "visible"
17322
+ /*hidden_toolbar*/
17323
+ ctx[5] && /*hidden_redo_undo*/
17324
+ ctx[6]
17320
17325
  );
17321
17326
  attr(div3, "class", name9 + "-bottom-right");
17322
17327
  toggle_class(
17323
17328
  div3,
17324
17329
  "hidden",
17325
- /*layout*/
17326
- ctx[5] !== "visible"
17330
+ /*hidden_page_control*/
17331
+ ctx[8]
17327
17332
  );
17328
17333
  attr(div4, "class", name9 + "-root");
17329
17334
  toggle_class(div4, "loading", !/*app*/
@@ -17332,7 +17337,7 @@ function create_fragment78(ctx) {
17332
17337
  m(target, anchor) {
17333
17338
  insert(target, div4, anchor);
17334
17339
  append(div4, div0);
17335
- ctx[16](div0);
17340
+ ctx[26](div0);
17336
17341
  append(div4, t0);
17337
17342
  append(div4, div1);
17338
17343
  if (if_block0)
@@ -17354,7 +17359,7 @@ function create_fragment78(ctx) {
17354
17359
  div0,
17355
17360
  "touchstart",
17356
17361
  /*focus_me*/
17357
- ctx[10],
17362
+ ctx[13],
17358
17363
  { passive: true, capture: true }
17359
17364
  );
17360
17365
  mounted = true;
@@ -17390,21 +17395,24 @@ function create_fragment78(ctx) {
17390
17395
  (((_b2 = ctx2[3].toolbar) == null ? void 0 : _b2.placement) || "left"))) {
17391
17396
  attr(div1, "class", div1_class_value);
17392
17397
  }
17393
- if (!current || dirty & /*config, toolbar_has_items, layout*/
17394
- 104) {
17395
- toggle_class(div1, "hidden", !/*toolbar_has_items*/
17396
- ctx2[6] || !/*layout*/
17397
- (ctx2[5] === "visible" || /*layout*/
17398
- ctx2[5] === "toolbar-only"));
17398
+ if (!current || dirty & /*config, hidden_toolbar*/
17399
+ 40) {
17400
+ toggle_class(
17401
+ div1,
17402
+ "hidden",
17403
+ /*hidden_toolbar*/
17404
+ ctx2[5]
17405
+ );
17399
17406
  }
17400
17407
  if (
17401
17408
  /*config*/
17402
- ((_c2 = ctx2[3].redo_undo) == null ? void 0 : _c2.enable) !== false
17409
+ ((_c2 = ctx2[3].redo_undo) == null ? void 0 : _c2.enable) !== false && !/*hidden_redo_undo*/
17410
+ ctx2[6]
17403
17411
  ) {
17404
17412
  if (if_block1) {
17405
17413
  if_block1.p(ctx2, dirty);
17406
- if (dirty & /*config*/
17407
- 8) {
17414
+ if (dirty & /*config, hidden_redo_undo*/
17415
+ 72) {
17408
17416
  transition_in(if_block1, 1);
17409
17417
  }
17410
17418
  } else {
@@ -17422,12 +17430,13 @@ function create_fragment78(ctx) {
17422
17430
  }
17423
17431
  if (
17424
17432
  /*config*/
17425
- ((_d2 = ctx2[3].zoom_control) == null ? void 0 : _d2.enable) !== false
17433
+ ((_d2 = ctx2[3].zoom_control) == null ? void 0 : _d2.enable) !== false && !/*hidden_zoom_control*/
17434
+ ctx2[7]
17426
17435
  ) {
17427
17436
  if (if_block2) {
17428
17437
  if_block2.p(ctx2, dirty);
17429
- if (dirty & /*config*/
17430
- 8) {
17438
+ if (dirty & /*config, hidden_zoom_control*/
17439
+ 136) {
17431
17440
  transition_in(if_block2, 1);
17432
17441
  }
17433
17442
  } else {
@@ -17443,13 +17452,14 @@ function create_fragment78(ctx) {
17443
17452
  });
17444
17453
  check_outros();
17445
17454
  }
17446
- if (!current || dirty & /*layout*/
17447
- 32) {
17455
+ if (!current || dirty & /*hidden_toolbar, hidden_redo_undo*/
17456
+ 96) {
17448
17457
  toggle_class(
17449
17458
  div2,
17450
17459
  "hidden",
17451
- /*layout*/
17452
- ctx2[5] !== "visible"
17460
+ /*hidden_toolbar*/
17461
+ ctx2[5] && /*hidden_redo_undo*/
17462
+ ctx2[6]
17453
17463
  );
17454
17464
  }
17455
17465
  if (
@@ -17475,13 +17485,13 @@ function create_fragment78(ctx) {
17475
17485
  });
17476
17486
  check_outros();
17477
17487
  }
17478
- if (!current || dirty & /*layout*/
17479
- 32) {
17488
+ if (!current || dirty & /*hidden_page_control*/
17489
+ 256) {
17480
17490
  toggle_class(
17481
17491
  div3,
17482
17492
  "hidden",
17483
- /*layout*/
17484
- ctx2[5] !== "visible"
17493
+ /*hidden_page_control*/
17494
+ ctx2[8]
17485
17495
  );
17486
17496
  }
17487
17497
  if (!current || dirty & /*app*/
@@ -17509,7 +17519,7 @@ function create_fragment78(ctx) {
17509
17519
  d(detaching) {
17510
17520
  if (detaching)
17511
17521
  detach(div4);
17512
- ctx[16](null);
17522
+ ctx[26](null);
17513
17523
  if (if_block0)
17514
17524
  if_block0.d();
17515
17525
  if (if_block1)
@@ -17528,22 +17538,33 @@ function instance78($$self, $$props, $$invalidate) {
17528
17538
  let writable2;
17529
17539
  let boxState;
17530
17540
  let focusedApp;
17541
+ let visibleApps;
17531
17542
  let toolbar_has_items;
17532
- let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(13, $focusedApp = $$value)), focusedApp);
17533
- let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(14, $boxState = $$value)), boxState);
17534
- let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(15, $writable = $$value)), writable2);
17543
+ let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(22, $focusedApp = $$value)), focusedApp);
17544
+ let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(23, $boxState = $$value)), boxState);
17545
+ let $visibleApps, $$unsubscribe_visibleApps = noop, $$subscribe_visibleApps = () => ($$unsubscribe_visibleApps(), $$unsubscribe_visibleApps = subscribe(visibleApps, ($$value) => $$invalidate(24, $visibleApps = $$value)), visibleApps);
17546
+ let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(25, $writable = $$value)), writable2);
17535
17547
  $$self.$$.on_destroy.push(() => $$unsubscribe_focusedApp());
17536
17548
  $$self.$$.on_destroy.push(() => $$unsubscribe_boxState());
17549
+ $$self.$$.on_destroy.push(() => $$unsubscribe_visibleApps());
17537
17550
  $$self.$$.on_destroy.push(() => $$unsubscribe_writable());
17538
17551
  let { app = null } = $$props;
17539
17552
  let { theme = "light" } = $$props;
17540
17553
  let { language = "en" } = $$props;
17541
17554
  let { containerRef = void 0 } = $$props;
17542
17555
  let { config = {} } = $$props;
17543
- const AppsShowToolbar = ["DocsViewer", "Slide"];
17556
+ let { force_show_toolbar = void 0 } = $$props;
17557
+ let { force_show_redo_undo = void 0 } = $$props;
17558
+ let { force_show_zoom_control = void 0 } = $$props;
17559
+ let { force_show_page_control = void 0 } = $$props;
17560
+ const AppsShowToolbar = ["DocsViewer", "Slide", "PDFjs"];
17544
17561
  let container;
17545
17562
  let layout = "hidden";
17546
17563
  let mounted = false;
17564
+ let hidden_toolbar = false;
17565
+ let hidden_redo_undo = false;
17566
+ let hidden_zoom_control = false;
17567
+ let hidden_page_control = false;
17547
17568
  onMount(() => {
17548
17569
  if (containerRef) {
17549
17570
  containerRef(container);
@@ -17572,47 +17593,73 @@ function instance78($$self, $$props, $$invalidate) {
17572
17593
  if ("language" in $$props2)
17573
17594
  $$invalidate(2, language = $$props2.language);
17574
17595
  if ("containerRef" in $$props2)
17575
- $$invalidate(11, containerRef = $$props2.containerRef);
17596
+ $$invalidate(14, containerRef = $$props2.containerRef);
17576
17597
  if ("config" in $$props2)
17577
17598
  $$invalidate(3, config = $$props2.config);
17599
+ if ("force_show_toolbar" in $$props2)
17600
+ $$invalidate(15, force_show_toolbar = $$props2.force_show_toolbar);
17601
+ if ("force_show_redo_undo" in $$props2)
17602
+ $$invalidate(16, force_show_redo_undo = $$props2.force_show_redo_undo);
17603
+ if ("force_show_zoom_control" in $$props2)
17604
+ $$invalidate(17, force_show_zoom_control = $$props2.force_show_zoom_control);
17605
+ if ("force_show_page_control" in $$props2)
17606
+ $$invalidate(18, force_show_page_control = $$props2.force_show_page_control);
17578
17607
  };
17579
17608
  $$self.$$.update = () => {
17580
17609
  if ($$self.$$.dirty & /*app*/
17581
17610
  1) {
17582
- $$subscribe_writable($$invalidate(9, writable2 = app == null ? void 0 : app.writable));
17611
+ $$subscribe_writable($$invalidate(12, writable2 = app == null ? void 0 : app.writable));
17612
+ }
17613
+ if ($$self.$$.dirty & /*app*/
17614
+ 1) {
17615
+ $$subscribe_boxState($$invalidate(11, boxState = app == null ? void 0 : app.boxState));
17583
17616
  }
17584
17617
  if ($$self.$$.dirty & /*app*/
17585
17618
  1) {
17586
- $$subscribe_boxState($$invalidate(8, boxState = app == null ? void 0 : app.boxState));
17619
+ $$subscribe_focusedApp($$invalidate(10, focusedApp = app == null ? void 0 : app.focusedApp));
17587
17620
  }
17588
17621
  if ($$self.$$.dirty & /*app*/
17589
17622
  1) {
17590
- $$subscribe_focusedApp($$invalidate(7, focusedApp = app == null ? void 0 : app.focusedApp));
17623
+ $$subscribe_visibleApps($$invalidate(9, visibleApps = app == null ? void 0 : app.visibleApps));
17591
17624
  }
17592
- if ($$self.$$.dirty & /*$writable, $boxState, $focusedApp*/
17593
- 57344) {
17625
+ if ($$self.$$.dirty & /*$writable, app, $visibleApps, $boxState, $focusedApp*/
17626
+ 62914561) {
17594
17627
  if (!$writable) {
17595
- $$invalidate(5, layout = "hidden");
17628
+ $$invalidate(19, layout = "hidden");
17629
+ } else if (app == null ? void 0 : app.appInMainViewPlugin) {
17630
+ if ($visibleApps && $visibleApps.size > 0) {
17631
+ if ($boxState === "maximized") {
17632
+ if (AppsShowToolbar.some((kind) => ($focusedApp || "").includes(kind))) {
17633
+ $$invalidate(19, layout = "toolbar-only");
17634
+ } else {
17635
+ $$invalidate(19, layout = "hidden");
17636
+ }
17637
+ } else {
17638
+ $$invalidate(19, layout = "visible");
17639
+ }
17640
+ } else {
17641
+ $$invalidate(19, layout = "visible");
17642
+ }
17596
17643
  } else if ($boxState === "maximized") {
17597
17644
  if ($focusedApp && AppsShowToolbar.some((kind) => ($focusedApp || "").includes(kind))) {
17598
- $$invalidate(5, layout = "toolbar-only");
17645
+ $$invalidate(19, layout = "toolbar-only");
17599
17646
  } else {
17600
- $$invalidate(5, layout = "hidden");
17647
+ $$invalidate(19, layout = "hidden");
17601
17648
  }
17602
17649
  } else {
17603
- $$invalidate(5, layout = "visible");
17650
+ $$invalidate(19, layout = "visible");
17604
17651
  }
17605
17652
  }
17606
17653
  if ($$self.$$.dirty & /*config*/
17607
17654
  8) {
17608
- $$invalidate(6, toolbar_has_items = !config.toolbar || !config.toolbar.items || !config.toolbar.apps || config.toolbar.items.length > 0 || config.toolbar.apps.enable !== false);
17655
+ $$invalidate(21, toolbar_has_items = !config.toolbar || !config.toolbar.items || !config.toolbar.apps || config.toolbar.items.length > 0 || config.toolbar.apps.enable !== false);
17609
17656
  }
17610
17657
  if ($$self.$$.dirty & /*app, container*/
17611
17658
  17) {
17612
17659
  try {
17613
17660
  if (app && container) {
17614
17661
  app.bindContainer(container);
17615
- $$invalidate(12, mounted = true);
17662
+ $$invalidate(20, mounted = true);
17616
17663
  }
17617
17664
  } catch (err) {
17618
17665
  console.error("[fastboard] An error occurred while binding container");
@@ -17620,11 +17667,51 @@ function instance78($$self, $$props, $$invalidate) {
17620
17667
  }
17621
17668
  }
17622
17669
  if ($$self.$$.dirty & /*app, theme, mounted*/
17623
- 4099) {
17670
+ 1048579) {
17624
17671
  if (app && theme && mounted) {
17625
17672
  app.manager.setPrefersColorScheme(theme);
17626
17673
  }
17627
17674
  }
17675
+ if ($$self.$$.dirty & /*force_show_toolbar, toolbar_has_items, layout*/
17676
+ 2654208) {
17677
+ if (force_show_toolbar === false) {
17678
+ $$invalidate(5, hidden_toolbar = true);
17679
+ } else if (force_show_toolbar === true) {
17680
+ $$invalidate(5, hidden_toolbar = false);
17681
+ } else {
17682
+ $$invalidate(5, hidden_toolbar = !toolbar_has_items || !(layout === "visible" || layout === "toolbar-only"));
17683
+ }
17684
+ }
17685
+ if ($$self.$$.dirty & /*force_show_redo_undo, layout*/
17686
+ 589824) {
17687
+ if (force_show_redo_undo === false) {
17688
+ $$invalidate(6, hidden_redo_undo = true);
17689
+ } else if (force_show_redo_undo === true) {
17690
+ $$invalidate(6, hidden_redo_undo = false);
17691
+ } else {
17692
+ $$invalidate(6, hidden_redo_undo = layout !== "visible");
17693
+ }
17694
+ }
17695
+ if ($$self.$$.dirty & /*force_show_zoom_control, layout*/
17696
+ 655360) {
17697
+ if (force_show_zoom_control === false) {
17698
+ $$invalidate(7, hidden_zoom_control = true);
17699
+ } else if (force_show_zoom_control === true) {
17700
+ $$invalidate(7, hidden_zoom_control = false);
17701
+ } else {
17702
+ $$invalidate(7, hidden_zoom_control = layout !== "visible");
17703
+ }
17704
+ }
17705
+ if ($$self.$$.dirty & /*force_show_page_control, layout*/
17706
+ 786432) {
17707
+ if (force_show_page_control === false) {
17708
+ $$invalidate(8, hidden_page_control = true);
17709
+ } else if (force_show_page_control === true) {
17710
+ $$invalidate(8, hidden_page_control = false);
17711
+ } else {
17712
+ $$invalidate(8, hidden_page_control = layout !== "visible");
17713
+ }
17714
+ }
17628
17715
  };
17629
17716
  return [
17630
17717
  app,
@@ -17632,16 +17719,26 @@ function instance78($$self, $$props, $$invalidate) {
17632
17719
  language,
17633
17720
  config,
17634
17721
  container,
17635
- layout,
17636
- toolbar_has_items,
17722
+ hidden_toolbar,
17723
+ hidden_redo_undo,
17724
+ hidden_zoom_control,
17725
+ hidden_page_control,
17726
+ visibleApps,
17637
17727
  focusedApp,
17638
17728
  boxState,
17639
17729
  writable2,
17640
17730
  focus_me,
17641
17731
  containerRef,
17732
+ force_show_toolbar,
17733
+ force_show_redo_undo,
17734
+ force_show_zoom_control,
17735
+ force_show_page_control,
17736
+ layout,
17642
17737
  mounted,
17738
+ toolbar_has_items,
17643
17739
  $focusedApp,
17644
17740
  $boxState,
17741
+ $visibleApps,
17645
17742
  $writable,
17646
17743
  div0_binding
17647
17744
  ];
@@ -17653,8 +17750,12 @@ var Fastboard = class extends SvelteComponent {
17653
17750
  app: 0,
17654
17751
  theme: 1,
17655
17752
  language: 2,
17656
- containerRef: 11,
17657
- config: 3
17753
+ containerRef: 14,
17754
+ config: 3,
17755
+ force_show_toolbar: 15,
17756
+ force_show_redo_undo: 16,
17757
+ force_show_zoom_control: 17,
17758
+ force_show_page_control: 18
17658
17759
  });
17659
17760
  }
17660
17761
  };
@@ -17702,6 +17803,66 @@ function createUI(app, div) {
17702
17803
  fastboard.$destroy();
17703
17804
  }
17704
17805
  fastboard = void 0;
17806
+ },
17807
+ forceShowToolbar() {
17808
+ if (fastboard) {
17809
+ fastboard.$set({ force_show_toolbar: true });
17810
+ }
17811
+ },
17812
+ forceHideToolbar() {
17813
+ if (fastboard) {
17814
+ fastboard.$set({ force_show_toolbar: false });
17815
+ }
17816
+ },
17817
+ recoverToolbar() {
17818
+ if (fastboard) {
17819
+ fastboard.$set({ force_show_toolbar: void 0 });
17820
+ }
17821
+ },
17822
+ forceShowPageControl() {
17823
+ if (fastboard) {
17824
+ fastboard.$set({ force_show_page_control: true });
17825
+ }
17826
+ },
17827
+ forceHidePageControl() {
17828
+ if (fastboard) {
17829
+ fastboard.$set({ force_show_page_control: false });
17830
+ }
17831
+ },
17832
+ recoverPageControl() {
17833
+ if (fastboard) {
17834
+ fastboard.$set({ force_show_page_control: void 0 });
17835
+ }
17836
+ },
17837
+ forceShowRedoUndo() {
17838
+ if (fastboard) {
17839
+ fastboard.$set({ force_show_redo_undo: true });
17840
+ }
17841
+ },
17842
+ forceHideRedoUndo() {
17843
+ if (fastboard) {
17844
+ fastboard.$set({ force_show_redo_undo: false });
17845
+ }
17846
+ },
17847
+ recoverRedoUndo() {
17848
+ if (fastboard) {
17849
+ fastboard.$set({ force_show_redo_undo: void 0 });
17850
+ }
17851
+ },
17852
+ forceShowZoomControl() {
17853
+ if (fastboard) {
17854
+ fastboard.$set({ force_show_zoom_control: true });
17855
+ }
17856
+ },
17857
+ forceHideZoomControl() {
17858
+ if (fastboard) {
17859
+ fastboard.$set({ force_show_zoom_control: false });
17860
+ }
17861
+ },
17862
+ recoverZoomControl() {
17863
+ if (fastboard) {
17864
+ fastboard.$set({ force_show_zoom_control: void 0 });
17865
+ }
17705
17866
  }
17706
17867
  };
17707
17868
  if (div) {