@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.
package/dist/index.mjs CHANGED
@@ -13211,15 +13211,15 @@ function create_fragment68(ctx) {
13211
13211
  props: {
13212
13212
  app: (
13213
13213
  /*app*/
13214
- ctx[0]
13214
+ ctx[1]
13215
13215
  ),
13216
13216
  theme: (
13217
13217
  /*theme*/
13218
- ctx[1]
13218
+ ctx[2]
13219
13219
  ),
13220
13220
  language: (
13221
13221
  /*language*/
13222
- ctx[2]
13222
+ ctx[3]
13223
13223
  ),
13224
13224
  disabled: (
13225
13225
  /*disabled*/
@@ -13251,14 +13251,14 @@ function create_fragment68(ctx) {
13251
13251
  ),
13252
13252
  colors: (
13253
13253
  /*colors*/
13254
- ctx[4]
13254
+ ctx[0]
13255
13255
  )
13256
13256
  }
13257
13257
  });
13258
13258
  function select_block_type(ctx2, dirty) {
13259
13259
  if (
13260
13260
  /*collapsed*/
13261
- ctx2[3]
13261
+ ctx2[4]
13262
13262
  )
13263
13263
  return create_if_block15;
13264
13264
  return create_else_block14;
@@ -13279,7 +13279,7 @@ function create_fragment68(ctx) {
13279
13279
  path1 = svg_element("path");
13280
13280
  if_block.c();
13281
13281
  attr(div0, "class", div0_class_value = name6 + "-contents " + /*theme*/
13282
- ctx[1]);
13282
+ ctx[2]);
13283
13283
  set_style(
13284
13284
  div0,
13285
13285
  "height",
@@ -13301,14 +13301,14 @@ function create_fragment68(ctx) {
13301
13301
  attr(svg, "stroke-width", "2");
13302
13302
  attr(svg, "viewBox", "0 0 32 120");
13303
13303
  attr(label, "class", label_class_value = name6 + "-handler " + /*theme*/
13304
- ctx[1]);
13304
+ ctx[2]);
13305
13305
  attr(div1, "class", div1_class_value = name6 + " " + /*theme*/
13306
- ctx[1]);
13306
+ ctx[2]);
13307
13307
  toggle_class(
13308
13308
  div1,
13309
13309
  "collapsed",
13310
13310
  /*collapsed*/
13311
- ctx[3]
13311
+ ctx[4]
13312
13312
  );
13313
13313
  },
13314
13314
  m(target, anchor) {
@@ -13319,7 +13319,7 @@ function create_fragment68(ctx) {
13319
13319
  append(div1, label);
13320
13320
  append(label, input);
13321
13321
  input.checked = /*collapsed*/
13322
- ctx[3];
13322
+ ctx[4];
13323
13323
  append(label, t1);
13324
13324
  append(label, svg);
13325
13325
  append(svg, path0);
@@ -13347,17 +13347,17 @@ function create_fragment68(ctx) {
13347
13347
  p(ctx2, [dirty]) {
13348
13348
  const contents_changes = {};
13349
13349
  if (dirty & /*app*/
13350
- 1)
13350
+ 2)
13351
13351
  contents_changes.app = /*app*/
13352
- ctx2[0];
13352
+ ctx2[1];
13353
13353
  if (dirty & /*theme*/
13354
- 2)
13354
+ 4)
13355
13355
  contents_changes.theme = /*theme*/
13356
- ctx2[1];
13356
+ ctx2[2];
13357
13357
  if (dirty & /*language*/
13358
- 4)
13358
+ 8)
13359
13359
  contents_changes.language = /*language*/
13360
- ctx2[2];
13360
+ ctx2[3];
13361
13361
  if (dirty & /*disabled*/
13362
13362
  1024)
13363
13363
  contents_changes.disabled = /*disabled*/
@@ -13383,13 +13383,13 @@ function create_fragment68(ctx) {
13383
13383
  contents_changes.hide_apps = /*hide_apps*/
13384
13384
  ctx2[5];
13385
13385
  if (dirty & /*colors*/
13386
- 16)
13386
+ 1)
13387
13387
  contents_changes.colors = /*colors*/
13388
- ctx2[4];
13388
+ ctx2[0];
13389
13389
  contents.$set(contents_changes);
13390
13390
  if (!current || dirty & /*theme*/
13391
- 2 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
13392
- ctx2[1])) {
13391
+ 4 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
13392
+ ctx2[2])) {
13393
13393
  attr(div0, "class", div0_class_value);
13394
13394
  }
13395
13395
  if (dirty & /*scrollable, computed_height*/
@@ -13405,9 +13405,9 @@ function create_fragment68(ctx) {
13405
13405
  );
13406
13406
  }
13407
13407
  if (dirty & /*collapsed*/
13408
- 8) {
13408
+ 16) {
13409
13409
  input.checked = /*collapsed*/
13410
- ctx2[3];
13410
+ ctx2[4];
13411
13411
  }
13412
13412
  if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
13413
13413
  if_block.p(ctx2, dirty);
@@ -13420,22 +13420,22 @@ function create_fragment68(ctx) {
13420
13420
  }
13421
13421
  }
13422
13422
  if (!current || dirty & /*theme*/
13423
- 2 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
13424
- ctx2[1])) {
13423
+ 4 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
13424
+ ctx2[2])) {
13425
13425
  attr(label, "class", label_class_value);
13426
13426
  }
13427
13427
  if (!current || dirty & /*theme*/
13428
- 2 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
13429
- ctx2[1])) {
13428
+ 4 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
13429
+ ctx2[2])) {
13430
13430
  attr(div1, "class", div1_class_value);
13431
13431
  }
13432
13432
  if (!current || dirty & /*theme, collapsed*/
13433
- 10) {
13433
+ 20) {
13434
13434
  toggle_class(
13435
13435
  div1,
13436
13436
  "collapsed",
13437
13437
  /*collapsed*/
13438
- ctx2[3]
13438
+ ctx2[4]
13439
13439
  );
13440
13440
  }
13441
13441
  },
@@ -13469,7 +13469,6 @@ function instance68($$self, $$props, $$invalidate) {
13469
13469
  let placement;
13470
13470
  let items;
13471
13471
  let hide_apps;
13472
- let colors2;
13473
13472
  let $container_height;
13474
13473
  let $scroll_height;
13475
13474
  let $phase, $$unsubscribe_phase = noop, $$subscribe_phase = () => ($$unsubscribe_phase(), $$unsubscribe_phase = subscribe(phase, ($$value) => $$invalidate(18, $phase = $$value)), phase);
@@ -13480,6 +13479,7 @@ function instance68($$self, $$props, $$invalidate) {
13480
13479
  let { theme = "light" } = $$props;
13481
13480
  let { language = "en" } = $$props;
13482
13481
  let { config = {} } = $$props;
13482
+ let { colors: colors2 = void 0 } = $$props;
13483
13483
  const extra_height = (32 + 4 + 4) * 2;
13484
13484
  let collapsed = config.collapsed;
13485
13485
  let container_height = writable(0);
@@ -13488,26 +13488,28 @@ function instance68($$self, $$props, $$invalidate) {
13488
13488
  component_subscribe($$self, scroll_height, (value) => $$invalidate(17, $scroll_height = value));
13489
13489
  function input_change_handler() {
13490
13490
  collapsed = this.checked;
13491
- $$invalidate(3, collapsed);
13491
+ $$invalidate(4, collapsed);
13492
13492
  }
13493
13493
  $$self.$$set = ($$props2) => {
13494
13494
  if ("app" in $$props2)
13495
- $$invalidate(0, app = $$props2.app);
13495
+ $$invalidate(1, app = $$props2.app);
13496
13496
  if ("theme" in $$props2)
13497
- $$invalidate(1, theme = $$props2.theme);
13497
+ $$invalidate(2, theme = $$props2.theme);
13498
13498
  if ("language" in $$props2)
13499
- $$invalidate(2, language = $$props2.language);
13499
+ $$invalidate(3, language = $$props2.language);
13500
13500
  if ("config" in $$props2)
13501
13501
  $$invalidate(15, config = $$props2.config);
13502
+ if ("colors" in $$props2)
13503
+ $$invalidate(0, colors2 = $$props2.colors);
13502
13504
  };
13503
13505
  $$self.$$.update = () => {
13504
- var _a;
13506
+ var _a, _b;
13505
13507
  if ($$self.$$.dirty & /*app*/
13506
- 1) {
13508
+ 2) {
13507
13509
  $$subscribe_writable($$invalidate(12, writable2 = app == null ? void 0 : app.writable));
13508
13510
  }
13509
13511
  if ($$self.$$.dirty & /*app*/
13510
- 1) {
13512
+ 2) {
13511
13513
  $$subscribe_phase($$invalidate(11, phase = app == null ? void 0 : app.phase));
13512
13514
  }
13513
13515
  if ($$self.$$.dirty & /*$writable, $phase*/
@@ -13534,17 +13536,28 @@ function instance68($$self, $$props, $$invalidate) {
13534
13536
  32768) {
13535
13537
  $$invalidate(5, hide_apps = ((_a = config.apps) == null ? void 0 : _a.enable) === false);
13536
13538
  }
13537
- if ($$self.$$.dirty & /*config*/
13538
- 32768) {
13539
- $$invalidate(4, colors2 = (config == null ? void 0 : config.colors) && config.colors.length && config.colors || default_colors);
13539
+ if ($$self.$$.dirty & /*app, colors, config*/
13540
+ 32771) {
13541
+ if ((app == null ? void 0 : app.manager) && (app == null ? void 0 : app.manager.room)) {
13542
+ if (colors2 && !((_b = config.colors) == null ? void 0 : _b.length)) {
13543
+ const floatBarOptions = app == null ? void 0 : app.manager.room.floatBarOptions;
13544
+ if (floatBarOptions.colors) {
13545
+ $$invalidate(0, colors2 = floatBarOptions.colors);
13546
+ }
13547
+ } else {
13548
+ $$invalidate(0, colors2 = config.colors);
13549
+ }
13550
+ } else {
13551
+ $$invalidate(0, colors2 = default_colors);
13552
+ }
13540
13553
  }
13541
13554
  };
13542
13555
  return [
13556
+ colors2,
13543
13557
  app,
13544
13558
  theme,
13545
13559
  language,
13546
13560
  collapsed,
13547
- colors2,
13548
13561
  hide_apps,
13549
13562
  items,
13550
13563
  placement,
@@ -13567,10 +13580,11 @@ var Toolbar = class extends SvelteComponent {
13567
13580
  constructor(options) {
13568
13581
  super();
13569
13582
  init(this, options, instance68, create_fragment68, safe_not_equal, {
13570
- app: 0,
13571
- theme: 1,
13572
- language: 2,
13573
- config: 15
13583
+ app: 1,
13584
+ theme: 2,
13585
+ language: 3,
13586
+ config: 15,
13587
+ colors: 0
13574
13588
  });
13575
13589
  }
13576
13590
  };
@@ -15594,15 +15608,11 @@ function createUI(app, div) {
15594
15608
  if (fastboard) {
15595
15609
  fastboard.$destroy();
15596
15610
  }
15597
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
15598
- const _colors = props.config.toolbar.colors;
15599
- if (!_colors && colors2) {
15600
- props.config = __spreadProps(__spreadValues({}, props.config), {
15601
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
15602
- colors: colors2
15603
- })
15604
- });
15611
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
15612
+ if (!(props == null ? void 0 : props.config.toolbar)) {
15613
+ props.config.toolbar = {};
15605
15614
  }
15615
+ props.config.toolbar.colors = colors2;
15606
15616
  }
15607
15617
  fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
15608
15618
  return ui;
@@ -15610,15 +15620,11 @@ function createUI(app, div) {
15610
15620
  update(props) {
15611
15621
  var _a;
15612
15622
  if (fastboard && props) {
15613
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
15614
- const _colors = props.config.toolbar.colors;
15615
- if (!_colors && colors2) {
15616
- props.config = __spreadProps(__spreadValues({}, props.config), {
15617
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
15618
- colors: colors2
15619
- })
15620
- });
15623
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
15624
+ if (!(props == null ? void 0 : props.config.toolbar)) {
15625
+ props.config.toolbar = {};
15621
15626
  }
15627
+ props.config.toolbar.colors = colors2;
15622
15628
  }
15623
15629
  fastboard.$set(props);
15624
15630
  }