@netless/fastboard-ui 0.3.4-canary.0 → 0.3.4
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 +81 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -16
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +79 -16
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/Fastboard/Fastboard.svelte +6 -2
- package/src/components/Fastboard/ReplayFastboard.svelte +6 -2
- 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,7 +9967,7 @@ function create_fragment57(ctx) {
|
|
|
9965
9967
|
m(target, anchor) {
|
|
9966
9968
|
insert(target, div2, anchor);
|
|
9967
9969
|
append(div2, div0);
|
|
9968
|
-
ctx[
|
|
9970
|
+
ctx[6](div0);
|
|
9969
9971
|
append(div2, t);
|
|
9970
9972
|
append(div2, div1);
|
|
9971
9973
|
mount_component(playercontrol, div1, null);
|
|
@@ -10001,7 +10003,7 @@ function create_fragment57(ctx) {
|
|
|
10001
10003
|
d(detaching) {
|
|
10002
10004
|
if (detaching)
|
|
10003
10005
|
detach(div2);
|
|
10004
|
-
ctx[
|
|
10006
|
+
ctx[6](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);
|
|
@@ -10043,20 +10046,22 @@ function instance57($$self, $$props, $$invalidate) {
|
|
|
10043
10046
|
$$self.$$.update = () => {
|
|
10044
10047
|
if ($$self.$$.dirty & 9) {
|
|
10045
10048
|
try {
|
|
10046
|
-
if (player && container)
|
|
10049
|
+
if (player && container) {
|
|
10047
10050
|
player.bindContainer(container);
|
|
10051
|
+
$$invalidate(5, mounted = true);
|
|
10052
|
+
}
|
|
10048
10053
|
} catch (err) {
|
|
10049
10054
|
console.error("[fastboard] An error occurred while binding container");
|
|
10050
10055
|
console.error(err);
|
|
10051
10056
|
}
|
|
10052
10057
|
}
|
|
10053
|
-
if ($$self.$$.dirty &
|
|
10054
|
-
if (player && theme) {
|
|
10058
|
+
if ($$self.$$.dirty & 35) {
|
|
10059
|
+
if (player && theme && mounted) {
|
|
10055
10060
|
player.manager.setPrefersColorScheme(theme);
|
|
10056
10061
|
}
|
|
10057
10062
|
}
|
|
10058
10063
|
};
|
|
10059
|
-
return [player, theme, language, container, containerRef, div0_binding];
|
|
10064
|
+
return [player, theme, language, container, containerRef, mounted, div0_binding];
|
|
10060
10065
|
}
|
|
10061
10066
|
var ReplayFastboard = class extends SvelteComponent {
|
|
10062
10067
|
constructor(options) {
|
|
@@ -10297,7 +10302,7 @@ function create_fragment58(ctx) {
|
|
|
10297
10302
|
m(target, anchor) {
|
|
10298
10303
|
insert(target, div4, anchor);
|
|
10299
10304
|
append(div4, div0);
|
|
10300
|
-
ctx[
|
|
10305
|
+
ctx[14](div0);
|
|
10301
10306
|
append(div4, t0);
|
|
10302
10307
|
append(div4, div1);
|
|
10303
10308
|
if (if_block0)
|
|
@@ -10429,7 +10434,7 @@ function create_fragment58(ctx) {
|
|
|
10429
10434
|
d(detaching) {
|
|
10430
10435
|
if (detaching)
|
|
10431
10436
|
detach(div4);
|
|
10432
|
-
ctx[
|
|
10437
|
+
ctx[14](null);
|
|
10433
10438
|
if (if_block0)
|
|
10434
10439
|
if_block0.d();
|
|
10435
10440
|
if (if_block1)
|
|
@@ -10448,9 +10453,9 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10448
10453
|
let writable2;
|
|
10449
10454
|
let boxState;
|
|
10450
10455
|
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(
|
|
10456
|
+
let $focusedApp, $$unsubscribe_focusedApp = noop, $$subscribe_focusedApp = () => ($$unsubscribe_focusedApp(), $$unsubscribe_focusedApp = subscribe(focusedApp, ($$value) => $$invalidate(11, $focusedApp = $$value)), focusedApp);
|
|
10457
|
+
let $boxState, $$unsubscribe_boxState = noop, $$subscribe_boxState = () => ($$unsubscribe_boxState(), $$unsubscribe_boxState = subscribe(boxState, ($$value) => $$invalidate(12, $boxState = $$value)), boxState);
|
|
10458
|
+
let $writable, $$unsubscribe_writable = noop, $$subscribe_writable = () => ($$unsubscribe_writable(), $$unsubscribe_writable = subscribe(writable2, ($$value) => $$invalidate(13, $writable = $$value)), writable2);
|
|
10454
10459
|
$$self.$$.on_destroy.push(() => $$unsubscribe_focusedApp());
|
|
10455
10460
|
$$self.$$.on_destroy.push(() => $$unsubscribe_boxState());
|
|
10456
10461
|
$$self.$$.on_destroy.push(() => $$unsubscribe_writable());
|
|
@@ -10462,6 +10467,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10462
10467
|
const AppsShowToolbar = ["DocsViewer", "Slide"];
|
|
10463
10468
|
let container;
|
|
10464
10469
|
let layout = "hidden";
|
|
10470
|
+
let mounted = false;
|
|
10465
10471
|
onMount(() => {
|
|
10466
10472
|
if (containerRef) {
|
|
10467
10473
|
containerRef(container);
|
|
@@ -10499,7 +10505,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10499
10505
|
if ($$self.$$.dirty & 1) {
|
|
10500
10506
|
$$subscribe_focusedApp($$invalidate(6, focusedApp = app == null ? void 0 : app.focusedApp));
|
|
10501
10507
|
}
|
|
10502
|
-
if ($$self.$$.dirty &
|
|
10508
|
+
if ($$self.$$.dirty & 14336) {
|
|
10503
10509
|
if (!$writable) {
|
|
10504
10510
|
$$invalidate(5, layout = "hidden");
|
|
10505
10511
|
} else if ($boxState === "maximized") {
|
|
@@ -10514,15 +10520,17 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10514
10520
|
}
|
|
10515
10521
|
if ($$self.$$.dirty & 17) {
|
|
10516
10522
|
try {
|
|
10517
|
-
if (app && container)
|
|
10523
|
+
if (app && container) {
|
|
10518
10524
|
app.bindContainer(container);
|
|
10525
|
+
$$invalidate(10, mounted = true);
|
|
10526
|
+
}
|
|
10519
10527
|
} catch (err) {
|
|
10520
10528
|
console.error("[fastboard] An error occurred while binding container");
|
|
10521
10529
|
console.error(err);
|
|
10522
10530
|
}
|
|
10523
10531
|
}
|
|
10524
|
-
if ($$self.$$.dirty &
|
|
10525
|
-
if (app && theme) {
|
|
10532
|
+
if ($$self.$$.dirty & 1027) {
|
|
10533
|
+
if (app && theme && mounted) {
|
|
10526
10534
|
app.manager.setPrefersColorScheme(theme);
|
|
10527
10535
|
}
|
|
10528
10536
|
}
|
|
@@ -10538,6 +10546,7 @@ function instance58($$self, $$props, $$invalidate) {
|
|
|
10538
10546
|
boxState,
|
|
10539
10547
|
writable2,
|
|
10540
10548
|
containerRef,
|
|
10549
|
+
mounted,
|
|
10541
10550
|
$focusedApp,
|
|
10542
10551
|
$boxState,
|
|
10543
10552
|
$writable,
|
|
@@ -10558,6 +10567,62 @@ var Fastboard = class extends SvelteComponent {
|
|
|
10558
10567
|
};
|
|
10559
10568
|
var Fastboard_default = Fastboard;
|
|
10560
10569
|
|
|
10570
|
+
// src/helpers/index.ts
|
|
10571
|
+
function createUI(app, div) {
|
|
10572
|
+
let fastboard;
|
|
10573
|
+
const ui = {
|
|
10574
|
+
mount(div2, props) {
|
|
10575
|
+
if (fastboard) {
|
|
10576
|
+
fastboard.$destroy();
|
|
10577
|
+
}
|
|
10578
|
+
fastboard = new Fastboard_default({ target: div2, props: __spreadValues({ app }, props) });
|
|
10579
|
+
return ui;
|
|
10580
|
+
},
|
|
10581
|
+
update(props) {
|
|
10582
|
+
if (fastboard) {
|
|
10583
|
+
fastboard.$set(props);
|
|
10584
|
+
}
|
|
10585
|
+
},
|
|
10586
|
+
destroy() {
|
|
10587
|
+
if (fastboard) {
|
|
10588
|
+
fastboard.$destroy();
|
|
10589
|
+
}
|
|
10590
|
+
fastboard = void 0;
|
|
10591
|
+
}
|
|
10592
|
+
};
|
|
10593
|
+
if (div) {
|
|
10594
|
+
ui.mount(div);
|
|
10595
|
+
}
|
|
10596
|
+
return ui;
|
|
10597
|
+
}
|
|
10598
|
+
function createReplayUI(player, div) {
|
|
10599
|
+
let fastboard;
|
|
10600
|
+
const ui = {
|
|
10601
|
+
mount(div2, props) {
|
|
10602
|
+
if (fastboard) {
|
|
10603
|
+
fastboard.$destroy();
|
|
10604
|
+
}
|
|
10605
|
+
fastboard = new ReplayFastboard_default({ target: div2, props: __spreadValues({ player }, props) });
|
|
10606
|
+
return ui;
|
|
10607
|
+
},
|
|
10608
|
+
update(props) {
|
|
10609
|
+
if (fastboard) {
|
|
10610
|
+
fastboard.$set(props);
|
|
10611
|
+
}
|
|
10612
|
+
},
|
|
10613
|
+
destroy() {
|
|
10614
|
+
if (fastboard) {
|
|
10615
|
+
fastboard.$destroy();
|
|
10616
|
+
}
|
|
10617
|
+
fastboard = void 0;
|
|
10618
|
+
}
|
|
10619
|
+
};
|
|
10620
|
+
if (div) {
|
|
10621
|
+
ui.mount(div);
|
|
10622
|
+
}
|
|
10623
|
+
return ui;
|
|
10624
|
+
}
|
|
10625
|
+
|
|
10561
10626
|
// inline-sass-helper:inline-sass-style-helper.js
|
|
10562
10627
|
function injectStyle(text2) {
|
|
10563
10628
|
if (typeof document !== "undefined") {
|