@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.js CHANGED
@@ -13217,15 +13217,15 @@ function create_fragment68(ctx) {
13217
13217
  props: {
13218
13218
  app: (
13219
13219
  /*app*/
13220
- ctx[0]
13220
+ ctx[1]
13221
13221
  ),
13222
13222
  theme: (
13223
13223
  /*theme*/
13224
- ctx[1]
13224
+ ctx[2]
13225
13225
  ),
13226
13226
  language: (
13227
13227
  /*language*/
13228
- ctx[2]
13228
+ ctx[3]
13229
13229
  ),
13230
13230
  disabled: (
13231
13231
  /*disabled*/
@@ -13257,14 +13257,14 @@ function create_fragment68(ctx) {
13257
13257
  ),
13258
13258
  colors: (
13259
13259
  /*colors*/
13260
- ctx[4]
13260
+ ctx[0]
13261
13261
  )
13262
13262
  }
13263
13263
  });
13264
13264
  function select_block_type(ctx2, dirty) {
13265
13265
  if (
13266
13266
  /*collapsed*/
13267
- ctx2[3]
13267
+ ctx2[4]
13268
13268
  )
13269
13269
  return create_if_block15;
13270
13270
  return create_else_block14;
@@ -13285,7 +13285,7 @@ function create_fragment68(ctx) {
13285
13285
  path1 = svg_element("path");
13286
13286
  if_block.c();
13287
13287
  attr(div0, "class", div0_class_value = name6 + "-contents " + /*theme*/
13288
- ctx[1]);
13288
+ ctx[2]);
13289
13289
  set_style(
13290
13290
  div0,
13291
13291
  "height",
@@ -13307,14 +13307,14 @@ function create_fragment68(ctx) {
13307
13307
  attr(svg, "stroke-width", "2");
13308
13308
  attr(svg, "viewBox", "0 0 32 120");
13309
13309
  attr(label, "class", label_class_value = name6 + "-handler " + /*theme*/
13310
- ctx[1]);
13310
+ ctx[2]);
13311
13311
  attr(div1, "class", div1_class_value = name6 + " " + /*theme*/
13312
- ctx[1]);
13312
+ ctx[2]);
13313
13313
  toggle_class(
13314
13314
  div1,
13315
13315
  "collapsed",
13316
13316
  /*collapsed*/
13317
- ctx[3]
13317
+ ctx[4]
13318
13318
  );
13319
13319
  },
13320
13320
  m(target, anchor) {
@@ -13325,7 +13325,7 @@ function create_fragment68(ctx) {
13325
13325
  append(div1, label);
13326
13326
  append(label, input);
13327
13327
  input.checked = /*collapsed*/
13328
- ctx[3];
13328
+ ctx[4];
13329
13329
  append(label, t1);
13330
13330
  append(label, svg);
13331
13331
  append(svg, path0);
@@ -13353,17 +13353,17 @@ function create_fragment68(ctx) {
13353
13353
  p(ctx2, [dirty]) {
13354
13354
  const contents_changes = {};
13355
13355
  if (dirty & /*app*/
13356
- 1)
13356
+ 2)
13357
13357
  contents_changes.app = /*app*/
13358
- ctx2[0];
13358
+ ctx2[1];
13359
13359
  if (dirty & /*theme*/
13360
- 2)
13360
+ 4)
13361
13361
  contents_changes.theme = /*theme*/
13362
- ctx2[1];
13362
+ ctx2[2];
13363
13363
  if (dirty & /*language*/
13364
- 4)
13364
+ 8)
13365
13365
  contents_changes.language = /*language*/
13366
- ctx2[2];
13366
+ ctx2[3];
13367
13367
  if (dirty & /*disabled*/
13368
13368
  1024)
13369
13369
  contents_changes.disabled = /*disabled*/
@@ -13389,13 +13389,13 @@ function create_fragment68(ctx) {
13389
13389
  contents_changes.hide_apps = /*hide_apps*/
13390
13390
  ctx2[5];
13391
13391
  if (dirty & /*colors*/
13392
- 16)
13392
+ 1)
13393
13393
  contents_changes.colors = /*colors*/
13394
- ctx2[4];
13394
+ ctx2[0];
13395
13395
  contents.$set(contents_changes);
13396
13396
  if (!current || dirty & /*theme*/
13397
- 2 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
13398
- ctx2[1])) {
13397
+ 4 && div0_class_value !== (div0_class_value = name6 + "-contents " + /*theme*/
13398
+ ctx2[2])) {
13399
13399
  attr(div0, "class", div0_class_value);
13400
13400
  }
13401
13401
  if (dirty & /*scrollable, computed_height*/
@@ -13411,9 +13411,9 @@ function create_fragment68(ctx) {
13411
13411
  );
13412
13412
  }
13413
13413
  if (dirty & /*collapsed*/
13414
- 8) {
13414
+ 16) {
13415
13415
  input.checked = /*collapsed*/
13416
- ctx2[3];
13416
+ ctx2[4];
13417
13417
  }
13418
13418
  if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
13419
13419
  if_block.p(ctx2, dirty);
@@ -13426,22 +13426,22 @@ function create_fragment68(ctx) {
13426
13426
  }
13427
13427
  }
13428
13428
  if (!current || dirty & /*theme*/
13429
- 2 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
13430
- ctx2[1])) {
13429
+ 4 && label_class_value !== (label_class_value = name6 + "-handler " + /*theme*/
13430
+ ctx2[2])) {
13431
13431
  attr(label, "class", label_class_value);
13432
13432
  }
13433
13433
  if (!current || dirty & /*theme*/
13434
- 2 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
13435
- ctx2[1])) {
13434
+ 4 && div1_class_value !== (div1_class_value = name6 + " " + /*theme*/
13435
+ ctx2[2])) {
13436
13436
  attr(div1, "class", div1_class_value);
13437
13437
  }
13438
13438
  if (!current || dirty & /*theme, collapsed*/
13439
- 10) {
13439
+ 20) {
13440
13440
  toggle_class(
13441
13441
  div1,
13442
13442
  "collapsed",
13443
13443
  /*collapsed*/
13444
- ctx2[3]
13444
+ ctx2[4]
13445
13445
  );
13446
13446
  }
13447
13447
  },
@@ -13475,7 +13475,6 @@ function instance68($$self, $$props, $$invalidate) {
13475
13475
  let placement;
13476
13476
  let items;
13477
13477
  let hide_apps;
13478
- let colors2;
13479
13478
  let $container_height;
13480
13479
  let $scroll_height;
13481
13480
  let $phase, $$unsubscribe_phase = noop, $$subscribe_phase = () => ($$unsubscribe_phase(), $$unsubscribe_phase = subscribe(phase, ($$value) => $$invalidate(18, $phase = $$value)), phase);
@@ -13486,6 +13485,7 @@ function instance68($$self, $$props, $$invalidate) {
13486
13485
  let { theme = "light" } = $$props;
13487
13486
  let { language = "en" } = $$props;
13488
13487
  let { config = {} } = $$props;
13488
+ let { colors: colors2 = void 0 } = $$props;
13489
13489
  const extra_height = (32 + 4 + 4) * 2;
13490
13490
  let collapsed = config.collapsed;
13491
13491
  let container_height = writable(0);
@@ -13494,26 +13494,28 @@ function instance68($$self, $$props, $$invalidate) {
13494
13494
  component_subscribe($$self, scroll_height, (value) => $$invalidate(17, $scroll_height = value));
13495
13495
  function input_change_handler() {
13496
13496
  collapsed = this.checked;
13497
- $$invalidate(3, collapsed);
13497
+ $$invalidate(4, collapsed);
13498
13498
  }
13499
13499
  $$self.$$set = ($$props2) => {
13500
13500
  if ("app" in $$props2)
13501
- $$invalidate(0, app = $$props2.app);
13501
+ $$invalidate(1, app = $$props2.app);
13502
13502
  if ("theme" in $$props2)
13503
- $$invalidate(1, theme = $$props2.theme);
13503
+ $$invalidate(2, theme = $$props2.theme);
13504
13504
  if ("language" in $$props2)
13505
- $$invalidate(2, language = $$props2.language);
13505
+ $$invalidate(3, language = $$props2.language);
13506
13506
  if ("config" in $$props2)
13507
13507
  $$invalidate(15, config = $$props2.config);
13508
+ if ("colors" in $$props2)
13509
+ $$invalidate(0, colors2 = $$props2.colors);
13508
13510
  };
13509
13511
  $$self.$$.update = () => {
13510
- var _a;
13512
+ var _a, _b;
13511
13513
  if ($$self.$$.dirty & /*app*/
13512
- 1) {
13514
+ 2) {
13513
13515
  $$subscribe_writable($$invalidate(12, writable2 = app == null ? void 0 : app.writable));
13514
13516
  }
13515
13517
  if ($$self.$$.dirty & /*app*/
13516
- 1) {
13518
+ 2) {
13517
13519
  $$subscribe_phase($$invalidate(11, phase = app == null ? void 0 : app.phase));
13518
13520
  }
13519
13521
  if ($$self.$$.dirty & /*$writable, $phase*/
@@ -13540,17 +13542,28 @@ function instance68($$self, $$props, $$invalidate) {
13540
13542
  32768) {
13541
13543
  $$invalidate(5, hide_apps = ((_a = config.apps) == null ? void 0 : _a.enable) === false);
13542
13544
  }
13543
- if ($$self.$$.dirty & /*config*/
13544
- 32768) {
13545
- $$invalidate(4, colors2 = (config == null ? void 0 : config.colors) && config.colors.length && config.colors || default_colors);
13545
+ if ($$self.$$.dirty & /*app, colors, config*/
13546
+ 32771) {
13547
+ if ((app == null ? void 0 : app.manager) && (app == null ? void 0 : app.manager.room)) {
13548
+ if (colors2 && !((_b = config.colors) == null ? void 0 : _b.length)) {
13549
+ const floatBarOptions = app == null ? void 0 : app.manager.room.floatBarOptions;
13550
+ if (floatBarOptions.colors) {
13551
+ $$invalidate(0, colors2 = floatBarOptions.colors);
13552
+ }
13553
+ } else {
13554
+ $$invalidate(0, colors2 = config.colors);
13555
+ }
13556
+ } else {
13557
+ $$invalidate(0, colors2 = default_colors);
13558
+ }
13546
13559
  }
13547
13560
  };
13548
13561
  return [
13562
+ colors2,
13549
13563
  app,
13550
13564
  theme,
13551
13565
  language,
13552
13566
  collapsed,
13553
- colors2,
13554
13567
  hide_apps,
13555
13568
  items,
13556
13569
  placement,
@@ -13573,10 +13586,11 @@ var Toolbar = class extends SvelteComponent {
13573
13586
  constructor(options) {
13574
13587
  super();
13575
13588
  init(this, options, instance68, create_fragment68, safe_not_equal, {
13576
- app: 0,
13577
- theme: 1,
13578
- language: 2,
13579
- config: 15
13589
+ app: 1,
13590
+ theme: 2,
13591
+ language: 3,
13592
+ config: 15,
13593
+ colors: 0
13580
13594
  });
13581
13595
  }
13582
13596
  };
@@ -15600,15 +15614,11 @@ function createUI(app, div) {
15600
15614
  if (fastboard) {
15601
15615
  fastboard.$destroy();
15602
15616
  }
15603
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
15604
- const _colors = props.config.toolbar.colors;
15605
- if (!_colors && colors2) {
15606
- props.config = __spreadProps(__spreadValues({}, props.config), {
15607
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
15608
- colors: colors2
15609
- })
15610
- });
15617
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
15618
+ if (!(props == null ? void 0 : props.config.toolbar)) {
15619
+ props.config.toolbar = {};
15611
15620
  }
15621
+ props.config.toolbar.colors = colors2;
15612
15622
  }
15613
15623
  fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
15614
15624
  return ui;
@@ -15616,15 +15626,11 @@ function createUI(app, div) {
15616
15626
  update(props) {
15617
15627
  var _a;
15618
15628
  if (fastboard && props) {
15619
- if ((_a = props == null ? void 0 : props.config) == null ? void 0 : _a.toolbar) {
15620
- const _colors = props.config.toolbar.colors;
15621
- if (!_colors && colors2) {
15622
- props.config = __spreadProps(__spreadValues({}, props.config), {
15623
- toolbar: __spreadProps(__spreadValues({}, props.config.toolbar), {
15624
- colors: colors2
15625
- })
15626
- });
15629
+ if (colors2 && (props == null ? void 0 : props.config) && !((_a = props.config.toolbar) == null ? void 0 : _a.colors)) {
15630
+ if (!(props == null ? void 0 : props.config.toolbar)) {
15631
+ props.config.toolbar = {};
15627
15632
  }
15633
+ props.config.toolbar.colors = colors2;
15628
15634
  }
15629
15635
  fastboard.$set(props);
15630
15636
  }