@netless/fastboard-ui 0.3.4-canary.1 → 0.3.5-canary.0
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.d.ts +30 -1
- package/dist/index.js +107 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -22
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +105 -22
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/Fastboard/Fastboard.svelte +14 -3
- package/src/components/Fastboard/ReplayFastboard.svelte +14 -3
- package/src/helpers/index.ts +94 -0
- package/src/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,35 @@ declare interface FastboardProps {
|
|
|
100
100
|
declare class Fastboard extends SvelteComponentTyped<FastboardProps> {
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
interface UI {
|
|
104
|
+
/** render UI to div */
|
|
105
|
+
mount(div: Element, props?: Omit<FastboardProps, "app">): UI;
|
|
106
|
+
/** update UI (theme, language, etc.) */
|
|
107
|
+
update(props?: Omit<FastboardProps, "app">): void;
|
|
108
|
+
/** remove UI */
|
|
109
|
+
destroy(): void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @example
|
|
113
|
+
* let ui = createUI(fastboardApp, document.getElementById("whiteboard"));
|
|
114
|
+
* ui.update({ theme: "dark" })
|
|
115
|
+
*/
|
|
116
|
+
declare function createUI(app: FastboardApp, div?: Element): UI;
|
|
117
|
+
interface ReplayUI {
|
|
118
|
+
/** render UI to div */
|
|
119
|
+
mount(div: Element, props?: Omit<ReplayFastboardProps, "player">): ReplayUI;
|
|
120
|
+
/** update UI (theme, language, etc.) */
|
|
121
|
+
update(props?: Omit<ReplayFastboardProps, "player">): void;
|
|
122
|
+
/** remove UI */
|
|
123
|
+
destroy(): void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @example
|
|
127
|
+
* let ui = createReplayUI(fastboardPlayer, document.getElementById("whiteboard"));
|
|
128
|
+
* ui.update({ theme: "dark" })
|
|
129
|
+
*/
|
|
130
|
+
declare function createReplayUI(player: FastboardPlayer, div?: Element): ReplayUI;
|
|
131
|
+
|
|
103
132
|
interface AppInToolbar {
|
|
104
133
|
kind: string;
|
|
105
134
|
icon: string;
|
|
@@ -121,4 +150,4 @@ declare class AppsInToolbar {
|
|
|
121
150
|
|
|
122
151
|
declare const apps: AppsInToolbar;
|
|
123
152
|
|
|
124
|
-
export { AppInToolbar, AppsInToolbar, Fastboard, FastboardProps, FastboardUIConfig, GenericIcon, I18nData, IconType, Language, PageControl, PageControlProps, PlayerControl, PlayerControlProps, RedoUndo, RedoUndoProps, ReplayFastboard, ReplayFastboardProps, SvelteAction, Theme, Toolbar, ToolbarConfig, ToolbarProps, ZoomControl, ZoomControlProps, apps };
|
|
153
|
+
export { AppInToolbar, AppsInToolbar, Fastboard, FastboardProps, FastboardUIConfig, GenericIcon, I18nData, IconType, Language, PageControl, PageControlProps, PlayerControl, PlayerControlProps, RedoUndo, RedoUndoProps, ReplayFastboard, ReplayFastboardProps, ReplayUI, SvelteAction, Theme, Toolbar, ToolbarConfig, ToolbarProps, UI, ZoomControl, ZoomControlProps, apps, createReplayUI, createUI };
|
package/dist/index.js
CHANGED
|
@@ -48,7 +48,9 @@ __export(src_exports, {
|
|
|
48
48
|
ReplayFastboard: () => ReplayFastboard_default,
|
|
49
49
|
Toolbar: () => Toolbar_default,
|
|
50
50
|
ZoomControl: () => ZoomControl_default,
|
|
51
|
-
apps: () => apps
|
|
51
|
+
apps: () => apps,
|
|
52
|
+
createReplayUI: () => createReplayUI,
|
|
53
|
+
createUI: () => createUI
|
|
52
54
|
});
|
|
53
55
|
module.exports = __toCommonJS(src_exports);
|
|
54
56
|
|
|
@@ -9965,13 +9967,13 @@ function create_fragment57(ctx) {
|
|
|
9965
9967
|
m(target, anchor) {
|
|
9966
9968
|
insert(target, div2, anchor);
|
|
9967
9969
|
append(div2, div0);
|
|
9968
|
-
ctx[
|
|
9970
|
+
ctx[7](div0);
|
|
9969
9971
|
append(div2, t);
|
|
9970
9972
|
append(div2, div1);
|
|
9971
9973
|
mount_component(playercontrol, div1, null);
|
|
9972
9974
|
current = true;
|
|
9973
9975
|
if (!mounted) {
|
|
9974
|
-
dispose = listen(div0, "touchstart",
|
|
9976
|
+
dispose = listen(div0, "touchstart", ctx[4], { passive: true, capture: true });
|
|
9975
9977
|
mounted = true;
|
|
9976
9978
|
}
|
|
9977
9979
|
},
|
|
@@ -10001,7 +10003,7 @@ function create_fragment57(ctx) {
|
|
|
10001
10003
|
d(detaching) {
|
|
10002
10004
|
if (detaching)
|
|
10003
10005
|
detach(div2);
|
|
10004
|
-
ctx[
|
|
10006
|
+
ctx[7](null);
|
|
10005
10007
|
destroy_component(playercontrol);
|
|
10006
10008
|
mounted = false;
|
|
10007
10009
|
dispose();
|
|
@@ -10015,6 +10017,7 @@ function instance57($$self, $$props, $$invalidate) {
|
|
|
10015
10017
|
let { language = "en" } = $$props;
|
|
10016
10018
|
let { containerRef = void 0 } = $$props;
|
|
10017
10019
|
let container;
|
|
10020
|
+
let mounted = false;
|
|
10018
10021
|
onMount(() => {
|
|
10019
10022
|
if (containerRef) {
|
|
10020
10023
|
containerRef(container);
|
|
@@ -10024,6 +10027,11 @@ function instance57($$self, $$props, $$invalidate) {
|
|
|
10024
10027
|
};
|
|
10025
10028
|
}
|
|
10026
10029
|
});
|
|
10030
|
+
function focus_me() {
|
|
10031
|
+
tippy_hide_all();
|
|
10032
|
+
let a = document.activeElement;
|
|
10033
|
+
a && a.blur && a.blur();
|
|
10034
|
+
}
|
|
10027
10035
|
function div0_binding($$value) {
|
|
10028
10036
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
10029
10037
|
container = $$value;
|
|
@@ -10038,25 +10046,36 @@ function instance57($$self, $$props, $$invalidate) {
|
|
|
10038
10046
|
if ("language" in $$props2)
|
|
10039
10047
|
$$invalidate(2, language = $$props2.language);
|
|
10040
10048
|
if ("containerRef" in $$props2)
|
|
10041
|
-
$$invalidate(
|
|
10049
|
+
$$invalidate(5, containerRef = $$props2.containerRef);
|
|
10042
10050
|
};
|
|
10043
10051
|
$$self.$$.update = () => {
|
|
10044
10052
|
if ($$self.$$.dirty & 9) {
|
|
10045
10053
|
try {
|
|
10046
|
-
if (player && container)
|
|
10054
|
+
if (player && container) {
|
|
10047
10055
|
player.bindContainer(container);
|
|
10056
|
+
$$invalidate(6, mounted = true);
|
|
10057
|
+
}
|
|
10048
10058
|
} catch (err) {
|
|
10049
10059
|
console.error("[fastboard] An error occurred while binding container");
|
|
10050
10060
|
console.error(err);
|
|
10051
10061
|
}
|
|
10052
10062
|
}
|
|
10053
|
-
if ($$self.$$.dirty &
|
|
10054
|
-
if (player && theme) {
|
|
10063
|
+
if ($$self.$$.dirty & 67) {
|
|
10064
|
+
if (player && theme && mounted) {
|
|
10055
10065
|
player.manager.setPrefersColorScheme(theme);
|
|
10056
10066
|
}
|
|
10057
10067
|
}
|
|
10058
10068
|
};
|
|
10059
|
-
return [
|
|
10069
|
+
return [
|
|
10070
|
+
player,
|
|
10071
|
+
theme,
|
|
10072
|
+
language,
|
|
10073
|
+
container,
|
|
10074
|
+
focus_me,
|
|
10075
|
+
containerRef,
|
|
10076
|
+
mounted,
|
|
10077
|
+
div0_binding
|
|
10078
|
+
];
|
|
10060
10079
|
}
|
|
10061
10080
|
var ReplayFastboard = class extends SvelteComponent {
|
|
10062
10081
|
constructor(options) {
|
|
@@ -10065,7 +10084,7 @@ var ReplayFastboard = class extends SvelteComponent {
|
|
|
10065
10084
|
player: 0,
|
|
10066
10085
|
theme: 1,
|
|
10067
10086
|
language: 2,
|
|
10068
|
-
containerRef:
|
|
10087
|
+
containerRef: 5
|
|
10069
10088
|
});
|
|
10070
10089
|
}
|
|
10071
10090
|
};
|
|
@@ -10297,7 +10316,7 @@ function create_fragment58(ctx) {
|
|
|
10297
10316
|
m(target, anchor) {
|
|
10298
10317
|
insert(target, div4, anchor);
|
|
10299
10318
|
append(div4, div0);
|
|
10300
|
-
ctx[
|
|
10319
|
+
ctx[15](div0);
|
|
10301
10320
|
append(div4, t0);
|
|
10302
10321
|
append(div4, div1);
|
|
10303
10322
|
if (if_block0)
|
|
@@ -10315,7 +10334,7 @@ function create_fragment58(ctx) {
|
|
|
10315
10334
|
if_block3.m(div3, null);
|
|
10316
10335
|
current = true;
|
|
10317
10336
|
if (!mounted) {
|
|
10318
|
-
dispose = listen(div0, "touchstart",
|
|
10337
|
+
dispose = listen(div0, "touchstart", ctx[9], { passive: true, capture: true });
|
|
10319
10338
|
mounted = true;
|
|
10320
10339
|
}
|
|
10321
10340
|
},
|
|
@@ -10429,7 +10448,7 @@ function create_fragment58(ctx) {
|
|
|
10429
10448
|
d(detaching) {
|
|
10430
10449
|
if (detaching)
|
|
10431
10450
|
detach(div4);
|
|
10432
|
-
ctx[
|
|
10451
|
+
ctx[15](null);
|
|
10433
10452
|
if (if_block0)
|
|
10434
10453
|
if_block0.d();
|
|
10435
10454
|
if (if_block1)
|
|
@@ -10448,9 +10467,9 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10448
10467
|
let writable2;
|
|
10449
10468
|
let boxState;
|
|
10450
10469
|
let focusedApp;
|
|
10451
|
-
let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(
|
|
10452
|
-
let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(
|
|
10453
|
-
let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(
|
|
10470
|
+
let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(12, $focusedApp = $$value)), focusedApp);
|
|
10471
|
+
let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(13, $boxState = $$value)), boxState);
|
|
10472
|
+
let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(14, $writable = $$value)), writable2);
|
|
10454
10473
|
$$self.$$.on_destroy.push(() => $$unsubscribe_focusedApp());
|
|
10455
10474
|
$$self.$$.on_destroy.push(() => $$unsubscribe_boxState());
|
|
10456
10475
|
$$self.$$.on_destroy.push(() => $$unsubscribe_writable());
|
|
@@ -10462,6 +10481,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10462
10481
|
const AppsShowToolbar = ["DocsViewer", "Slide"];
|
|
10463
10482
|
let container;
|
|
10464
10483
|
let layout = "hidden";
|
|
10484
|
+
let mounted = false;
|
|
10465
10485
|
onMount(() => {
|
|
10466
10486
|
if (containerRef) {
|
|
10467
10487
|
containerRef(container);
|
|
@@ -10471,6 +10491,11 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10471
10491
|
};
|
|
10472
10492
|
}
|
|
10473
10493
|
});
|
|
10494
|
+
function focus_me() {
|
|
10495
|
+
tippy_hide_all();
|
|
10496
|
+
let a = document.activeElement;
|
|
10497
|
+
a && a.blur && a.blur();
|
|
10498
|
+
}
|
|
10474
10499
|
function div0_binding($$value) {
|
|
10475
10500
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
10476
10501
|
container = $$value;
|
|
@@ -10485,7 +10510,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10485
10510
|
if ("language" in $$props2)
|
|
10486
10511
|
$$invalidate(2, language = $$props2.language);
|
|
10487
10512
|
if ("containerRef" in $$props2)
|
|
10488
|
-
$$invalidate(
|
|
10513
|
+
$$invalidate(10, containerRef = $$props2.containerRef);
|
|
10489
10514
|
if ("config" in $$props2)
|
|
10490
10515
|
$$invalidate(3, config = $$props2.config);
|
|
10491
10516
|
};
|
|
@@ -10499,7 +10524,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10499
10524
|
if ($$self.$$.dirty & 1) {
|
|
10500
10525
|
$$subscribe_focusedApp($$invalidate(6, focusedApp = app == null ? void 0 : app.focusedApp));
|
|
10501
10526
|
}
|
|
10502
|
-
if ($$self.$$.dirty &
|
|
10527
|
+
if ($$self.$$.dirty & 28672) {
|
|
10503
10528
|
if (!$writable) {
|
|
10504
10529
|
$$invalidate(5, layout = "hidden");
|
|
10505
10530
|
} else if ($boxState === "maximized") {
|
|
@@ -10514,15 +10539,17 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10514
10539
|
}
|
|
10515
10540
|
if ($$self.$$.dirty & 17) {
|
|
10516
10541
|
try {
|
|
10517
|
-
if (app && container)
|
|
10542
|
+
if (app && container) {
|
|
10518
10543
|
app.bindContainer(container);
|
|
10544
|
+
$$invalidate(11, mounted = true);
|
|
10545
|
+
}
|
|
10519
10546
|
} catch (err) {
|
|
10520
10547
|
console.error("[fastboard] An error occurred while binding container");
|
|
10521
10548
|
console.error(err);
|
|
10522
10549
|
}
|
|
10523
10550
|
}
|
|
10524
|
-
if ($$self.$$.dirty &
|
|
10525
|
-
if (app && theme) {
|
|
10551
|
+
if ($$self.$$.dirty & 2051) {
|
|
10552
|
+
if (app && theme && mounted) {
|
|
10526
10553
|
app.manager.setPrefersColorScheme(theme);
|
|
10527
10554
|
}
|
|
10528
10555
|
}
|
|
@@ -10537,7 +10564,9 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10537
10564
|
focusedApp,
|
|
10538
10565
|
boxState,
|
|
10539
10566
|
writable2,
|
|
10567
|
+
focus_me,
|
|
10540
10568
|
containerRef,
|
|
10569
|
+
mounted,
|
|
10541
10570
|
$focusedApp,
|
|
10542
10571
|
$boxState,
|
|
10543
10572
|
$writable,
|
|
@@ -10551,13 +10580,69 @@ var Fastboard = class extends SvelteComponent {
|
|
|
10551
10580
|
app: 0,
|
|
10552
10581
|
theme: 1,
|
|
10553
10582
|
language: 2,
|
|
10554
|
-
containerRef:
|
|
10583
|
+
containerRef: 10,
|
|
10555
10584
|
config: 3
|
|
10556
10585
|
});
|
|
10557
10586
|
}
|
|
10558
10587
|
};
|
|
10559
10588
|
var Fastboard_default = Fastboard;
|
|
10560
10589
|
|
|
10590
|
+
// src/helpers/index.ts
|
|
10591
|
+
function createUI(app, div) {
|
|
10592
|
+
let fastboard;
|
|
10593
|
+
const ui = {
|
|
10594
|
+
mount(div2, props) {
|
|
10595
|
+
if (fastboard) {
|
|
10596
|
+
fastboard.$destroy();
|
|
10597
|
+
}
|
|
10598
|
+
fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
|
|
10599
|
+
return ui;
|
|
10600
|
+
},
|
|
10601
|
+
update(props) {
|
|
10602
|
+
if (fastboard) {
|
|
10603
|
+
fastboard.$set(props);
|
|
10604
|
+
}
|
|
10605
|
+
},
|
|
10606
|
+
destroy() {
|
|
10607
|
+
if (fastboard) {
|
|
10608
|
+
fastboard.$destroy();
|
|
10609
|
+
}
|
|
10610
|
+
fastboard = void 0;
|
|
10611
|
+
}
|
|
10612
|
+
};
|
|
10613
|
+
if (div) {
|
|
10614
|
+
ui.mount(div);
|
|
10615
|
+
}
|
|
10616
|
+
return ui;
|
|
10617
|
+
}
|
|
10618
|
+
function createReplayUI(player, div) {
|
|
10619
|
+
let fastboard;
|
|
10620
|
+
const ui = {
|
|
10621
|
+
mount(div2, props) {
|
|
10622
|
+
if (fastboard) {
|
|
10623
|
+
fastboard.$destroy();
|
|
10624
|
+
}
|
|
10625
|
+
fastboard = new ReplayFastboard_default({ target: div2, props: __spreadValues({ player }, props) });
|
|
10626
|
+
return ui;
|
|
10627
|
+
},
|
|
10628
|
+
update(props) {
|
|
10629
|
+
if (fastboard) {
|
|
10630
|
+
fastboard.$set(props);
|
|
10631
|
+
}
|
|
10632
|
+
},
|
|
10633
|
+
destroy() {
|
|
10634
|
+
if (fastboard) {
|
|
10635
|
+
fastboard.$destroy();
|
|
10636
|
+
}
|
|
10637
|
+
fastboard = void 0;
|
|
10638
|
+
}
|
|
10639
|
+
};
|
|
10640
|
+
if (div) {
|
|
10641
|
+
ui.mount(div);
|
|
10642
|
+
}
|
|
10643
|
+
return ui;
|
|
10644
|
+
}
|
|
10645
|
+
|
|
10561
10646
|
// inline-sass-helper:inline-sass-style-helper.js
|
|
10562
10647
|
function injectStyle(text2) {
|
|
10563
10648
|
if (typeof document !== "undefined") {
|