@netless/fastboard-ui 0.3.22-beta.0 → 0.3.22-beta.2

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.
@@ -12477,15 +12477,15 @@ function create_fragment68(ctx) {
12477
12477
  props: {
12478
12478
  app: (
12479
12479
  /*app*/
12480
- ctx[0]
12480
+ ctx[1]
12481
12481
  ),
12482
12482
  theme: (
12483
12483
  /*theme*/
12484
- ctx[1]
12484
+ ctx[2]
12485
12485
  ),
12486
12486
  language: (
12487
12487
  /*language*/
12488
- ctx[2]
12488
+ ctx[3]
12489
12489
  ),
12490
12490
  disabled: (
12491
12491
  /*disabled*/
@@ -12517,14 +12517,14 @@ function create_fragment68(ctx) {
12517
12517
  ),
12518
12518
  colors: (
12519
12519
  /*colors*/
12520
- ctx[4]
12520
+ ctx[0]
12521
12521
  )
12522
12522
  }
12523
12523
  });
12524
12524
  function select_block_type(ctx2, dirty) {
12525
12525
  if (
12526
12526
  /*collapsed*/
12527
- ctx2[3]
12527
+ ctx2[4]
12528
12528
  )
12529
12529
  return create_if_block15;
12530
12530
  return create_else_block14;
@@ -12545,7 +12545,7 @@ function create_fragment68(ctx) {
12545
12545
  path1 = svg_element("path");
12546
12546
  if_block.c();
12547
12547
  attr(div0, "class", div0_class_value = name6 + "-contents " + /*theme*/
12548
- ctx[1]);
12548
+ ctx[2]);
12549
12549
  set_style(
12550
12550
  div0,
12551
12551
  "height",
@@ -12567,14 +12567,14 @@ function create_fragment68(ctx) {
12567
12567
  attr(svg, "stroke-width", "2");
12568
12568
  attr(svg, "viewBox", "0 0 32 120");
12569
12569
  attr(label, "class", label_class_value = name6 + "-handler " + /*theme*/
12570
- ctx[1]);
12570
+ ctx[2]);
12571
12571
  attr(div1, "class", div1_class_value = name6 + " " + /*theme*/
12572
- ctx[1]);
12572
+ ctx[2]);
12573
12573
  toggle_class(
12574
12574
  div1,
12575
12575
  "collapsed",
12576
12576
  /*collapsed*/
12577
- ctx[3]
12577
+ ctx[4]
12578
12578
  );
12579
12579
  },
12580
12580
  m(target, anchor) {
@@ -12585,7 +12585,7 @@ function create_fragment68(ctx) {
12585
12585
  append(div1, label);
12586
12586
  append(label, input);
12587
12587
  input.checked = /*collapsed*/
12588
- ctx[3];
12588
+ ctx[4];
12589
12589
  append(label, t1);
12590
12590
  append(label, svg);
12591
12591
  append(svg, path0);
@@ -12613,17 +12613,17 @@ function create_fragment68(ctx) {
12613
12613
  p(ctx2, [dirty]) {
12614
12614
  const contents_changes = {};
12615
12615
  if (dirty & /*app*/
12616
- 1)
12616
+ 2)
12617
12617
  contents_changes.app = /*app*/
12618
- ctx2[0];
12618
+ ctx2[1];
12619
12619
  if (dirty & /*theme*/
12620
- 2)
12620
+ 4)
12621
12621
  contents_changes.theme = /*theme*/
12622
- ctx2[1];
12622
+ ctx2[2];
12623
12623
  if (dirty & /*language*/
12624
- 4)
12624
+ 8)
12625
12625
  contents_changes.language = /*language*/
12626
- ctx2[2];
12626
+ ctx2[3];
12627
12627
  if (dirty & /*disabled*/
12628
12628
  1024)
12629
12629
  contents_changes.disabled = /*disabled*/
@@ -12649,13 +12649,13 @@ function create_fragment68(ctx) {
12649
12649
  contents_changes.hide_apps = /*hide_apps*/
12650
12650
  ctx2[5];
12651
12651
  if (dirty & /*colors*/
12652
- 16)
12652
+ 1)
12653
12653
  contents_changes.colors = /*colors*/
12654
- ctx2[4];
12654
+ ctx2[0];
12655
12655
  contents.$set(contents_changes);
12656
12656
  if (!current || dirty & /*theme*/
12657
- 2 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
12658
- ctx2[1])) {
12657
+ 4 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
12658
+ ctx2[2])) {
12659
12659
  attr(div0, "class", div0_class_value);
12660
12660
  }
12661
12661
  if (dirty & /*scrollable, computed_height*/
@@ -12671,9 +12671,9 @@ function create_fragment68(ctx) {
12671
12671
  );
12672
12672
  }
12673
12673
  if (dirty & /*collapsed*/
12674
- 8) {
12674
+ 16) {
12675
12675
  input.checked = /*collapsed*/
12676
- ctx2[3];
12676
+ ctx2[4];
12677
12677
  }
12678
12678
  if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
12679
12679
  if_block.p(ctx2, dirty);
@@ -12686,22 +12686,22 @@ function create_fragment68(ctx) {
12686
12686
  }
12687
12687
  }
12688
12688
  if (!current || dirty & /*theme*/
12689
- 2 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
12690
- ctx2[1])) {
12689
+ 4 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
12690
+ ctx2[2])) {
12691
12691
  attr(label, "class", label_class_value);
12692
12692
  }
12693
12693
  if (!current || dirty & /*theme*/
12694
- 2 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
12695
- ctx2[1])) {
12694
+ 4 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
12695
+ ctx2[2])) {
12696
12696
  attr(div1, "class", div1_class_value);
12697
12697
  }
12698
12698
  if (!current || dirty & /*theme, collapsed*/
12699
- 10) {
12699
+ 20) {
12700
12700
  toggle_class(
12701
12701
  div1,
12702
12702
  "collapsed",
12703
12703
  /*collapsed*/
12704
- ctx2[3]
12704
+ ctx2[4]
12705
12705
  );
12706
12706
  }
12707
12707
  },
@@ -12735,7 +12735,6 @@ function instance68($$self, $$props, $$invalidate) {
12735
12735
  let placement;
12736
12736
  let items;
12737
12737
  let hide_apps;
12738
- let colors2;
12739
12738
  let $container_height;
12740
12739
  let $scroll_height;
12741
12740
  let $phase, $$unsubscribe_phase = noop, $$subscribe_phase = () => ($$unsubscribe_phase(), $$unsubscribe_phase = subscribe(phase, ($$value) => $$invalidate(18, $phase = $$value)), phase);
@@ -12746,6 +12745,7 @@ function instance68($$self, $$props, $$invalidate) {
12746
12745
  let { theme = "light" } = $$props;
12747
12746
  let { language = "en" } = $$props;
12748
12747
  let { config = {} } = $$props;
12748
+ let { colors: colors2 = void 0 } = $$props;
12749
12749
  const extra_height = (32 + 4 + 4) * 2;
12750
12750
  let collapsed = config.collapsed;
12751
12751
  let container_height = writable(0);
@@ -12754,26 +12754,28 @@ function instance68($$self, $$props, $$invalidate) {
12754
12754
  component_subscribe($$self, scroll_height, (value) => $$invalidate(17, $scroll_height = value));
12755
12755
  function input_change_handler() {
12756
12756
  collapsed = this.checked;
12757
- $$invalidate(3, collapsed);
12757
+ $$invalidate(4, collapsed);
12758
12758
  }
12759
12759
  $$self.$$set = ($$props2) => {
12760
12760
  if ("app" in $$props2)
12761
- $$invalidate(0, app = $$props2.app);
12761
+ $$invalidate(1, app = $$props2.app);
12762
12762
  if ("theme" in $$props2)
12763
- $$invalidate(1, theme = $$props2.theme);
12763
+ $$invalidate(2, theme = $$props2.theme);
12764
12764
  if ("language" in $$props2)
12765
- $$invalidate(2, language = $$props2.language);
12765
+ $$invalidate(3, language = $$props2.language);
12766
12766
  if ("config" in $$props2)
12767
12767
  $$invalidate(15, config = $$props2.config);
12768
+ if ("colors" in $$props2)
12769
+ $$invalidate(0, colors2 = $$props2.colors);
12768
12770
  };
12769
12771
  $$self.$$.update = () => {
12770
- var _a;
12772
+ var _a, _b;
12771
12773
  if ($$self.$$.dirty & /*app*/
12772
- 1) {
12774
+ 2) {
12773
12775
  $$subscribe_writable($$invalidate(12, writable2 = app == null ? void 0 : app.writable));
12774
12776
  }
12775
12777
  if ($$self.$$.dirty & /*app*/
12776
- 1) {
12778
+ 2) {
12777
12779
  $$subscribe_phase($$invalidate(11, phase = app == null ? void 0 : app.phase));
12778
12780
  }
12779
12781
  if ($$self.$$.dirty & /*$writable, $phase*/
@@ -12800,17 +12802,28 @@ function instance68($$self, $$props, $$invalidate) {
12800
12802
  32768) {
12801
12803
  $$invalidate(5, hide_apps = ((_a = config.apps) == null ? void 0 : _a.enable) === false);
12802
12804
  }
12803
- if ($$self.$$.dirty & /*config*/
12804
- 32768) {
12805
- $$invalidate(4, colors2 = (config == null ? void 0 : config.colors) && config.colors.length && config.colors || default_colors);
12805
+ if ($$self.$$.dirty & /*app, colors, config*/
12806
+ 32771) {
12807
+ if ((app == null ? void 0 : app.manager) && (app == null ? void 0 : app.manager.room)) {
12808
+ if (colors2 && !((_b = config.colors) == null ? void 0 : _b.length)) {
12809
+ const floatBarOptions = app == null ? void 0 : app.manager.room.floatBarOptions;
12810
+ if (floatBarOptions.colors) {
12811
+ $$invalidate(0, colors2 = floatBarOptions.colors);
12812
+ }
12813
+ } else {
12814
+ $$invalidate(0, colors2 = config.colors);
12815
+ }
12816
+ } else {
12817
+ $$invalidate(0, colors2 = default_colors);
12818
+ }
12806
12819
  }
12807
12820
  };
12808
12821
  return [
12822
+ colors2,
12809
12823
  app,
12810
12824
  theme,
12811
12825
  language,
12812
12826
  collapsed,
12813
- colors2,
12814
12827
  hide_apps,
12815
12828
  items,
12816
12829
  placement,
@@ -12833,10 +12846,11 @@ var Toolbar = class extends SvelteComponent {
12833
12846
  constructor(options) {
12834
12847
  super();
12835
12848
  init(this, options, instance68, create_fragment68, safe_not_equal, {
12836
- app: 0,
12837
- theme: 1,
12838
- language: 2,
12839
- config: 15
12849
+ app: 1,
12850
+ theme: 2,
12851
+ language: 3,
12852
+ config: 15,
12853
+ colors: 0
12840
12854
  });
12841
12855
  }
12842
12856
  };
@@ -14854,15 +14868,11 @@ function createUI(app, div) {
14854
14868
  if (fastboard) {
14855
14869
  fastboard.$destroy();
14856
14870
  }
14857
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
14858
- const _colors = props.config.toolbar.colors;
14859
- if (!_colors && colors2) {
14860
- props.config = __spreadProps(__spreadValues({}, props.config), {
14861
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
14862
- colors: colors2
14863
- })
14864
- });
14871
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
14872
+ if (!(props == null ? void 0 : props.config.toolbar)) {
14873
+ props.config.toolbar = {};
14865
14874
  }
14875
+ props.config.toolbar.colors = colors2;
14866
14876
  }
14867
14877
  fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
14868
14878
  return ui;
@@ -14870,15 +14880,11 @@ function createUI(app, div) {
14870
14880
  update(props) {
14871
14881
  var _a;
14872
14882
  if (fastboard && props) {
14873
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
14874
- const _colors = props.config.toolbar.colors;
14875
- if (!_colors && colors2) {
14876
- props.config = __spreadProps(__spreadValues({}, props.config), {
14877
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
14878
- colors: colors2
14879
- })
14880
- });
14883
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
14884
+ if (!(props == null ? void 0 : props.config.toolbar)) {
14885
+ props.config.toolbar = {};
14881
14886
  }
14887
+ props.config.toolbar.colors = colors2;
14882
14888
  }
14883
14889
  fastboard.$set(props);
14884
14890
  }