@netless/fastboard 1.0.0-canary.1 → 1.0.0-canary.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 +33 -16
- package/dist/index.js +62 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -3
- package/src/behaviors/index.ts +3 -0
- package/src/behaviors/netless-app.ts +35 -0
- package/src/create.ts +27 -0
- package/src/index.ts +3 -47
- package/src/replay.ts +28 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
import { FastboardApp, FastboardPlayer } from '@netless/fastboard-core';
|
|
1
|
+
import { FastboardOptions, FastboardApp, FastboardReplayOptions, FastboardPlayer } from '@netless/fastboard-core';
|
|
2
2
|
export * from '@netless/fastboard-core';
|
|
3
|
-
import { FastboardProps, ReplayFastboardProps } from '@netless/fastboard-ui';
|
|
4
3
|
export * from '@netless/fastboard-ui';
|
|
5
|
-
export {
|
|
4
|
+
export { Attributes as NetlessAppSlideAttributes, Slide, SlideState, SlideViewer, SlideViewerOptions, previewSlide } from '@netless/app-slide';
|
|
6
5
|
|
|
7
|
-
declare type MountProps = Omit<FastboardProps, "app">;
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
7
|
+
* Create a FastboardApp instance.
|
|
8
|
+
* @example
|
|
9
|
+
* let app = await createFastboard({
|
|
10
|
+
* sdkConfig: {
|
|
11
|
+
* appIdentifier: import.meta.env.VITE_APPID,
|
|
12
|
+
* region: 'cn-hz',
|
|
13
|
+
* },
|
|
14
|
+
* joinRoom: {
|
|
15
|
+
* uid: unique_id,
|
|
16
|
+
* uuid: import.meta.env.VITE_ROOM_UUID,
|
|
17
|
+
* roomToken: import.meta.env.VITE_ROOM_TOKEN,
|
|
18
|
+
* },
|
|
19
|
+
* })
|
|
10
20
|
*/
|
|
11
|
-
declare function
|
|
12
|
-
|
|
13
|
-
destroy(): void;
|
|
14
|
-
};
|
|
15
|
-
declare type ReplayProps = Omit<ReplayFastboardProps, "player">;
|
|
21
|
+
declare function createFastboard<TEventData = any>(options: FastboardOptions): Promise<FastboardApp<TEventData>>;
|
|
22
|
+
|
|
16
23
|
/**
|
|
17
|
-
*
|
|
24
|
+
* Create a FastboardPlayer instance.
|
|
25
|
+
* @example
|
|
26
|
+
* let player = await replayFastboard({
|
|
27
|
+
* sdkConfig: {
|
|
28
|
+
* appIdentifier: import.meta.env.VITE_APPID,
|
|
29
|
+
* region: 'cn-hz',
|
|
30
|
+
* },
|
|
31
|
+
* replayRoom: {
|
|
32
|
+
* room: "room uuid",
|
|
33
|
+
* roomToken: "NETLESSROOM_...",
|
|
34
|
+
* beginTimestamp: 1646619090394,
|
|
35
|
+
* duration: 70448,
|
|
36
|
+
* },
|
|
37
|
+
* })
|
|
18
38
|
*/
|
|
19
|
-
declare function
|
|
20
|
-
update(props?: ReplayProps): void;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
};
|
|
39
|
+
declare function replayFastboard<TEventData = any>(options: FastboardReplayOptions): Promise<FastboardPlayer<TEventData>>;
|
|
23
40
|
|
|
24
|
-
export {
|
|
41
|
+
export { createFastboard, replayFastboard };
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __export = (target, all) => {
|
|
22
|
-
for (var name in all)
|
|
23
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
-
};
|
|
25
|
-
var __copyProps = (to, from, except, desc) => {
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
-
for (let key of __getOwnPropNames(from))
|
|
28
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
-
}
|
|
31
|
-
return to;
|
|
32
|
-
};
|
|
33
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
35
4
|
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var
|
|
5
|
+
var fastboardCore = require('@netless/fastboard-core');
|
|
6
|
+
var fastboardUi = require('@netless/fastboard-ui');
|
|
7
|
+
var windowManager = require('@netless/window-manager');
|
|
8
|
+
var NetlessAppSlide = require('@netless/app-slide');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var NetlessAppSlide__default = /*#__PURE__*/_interopDefaultLegacy(NetlessAppSlide);
|
|
44
13
|
|
|
45
14
|
// inline-sass-helper:inline-sass-style-helper.js
|
|
46
15
|
function injectStyle(text) {
|
|
@@ -57,30 +26,59 @@ var style_default = '.netless-window-manager-playground{width:100%;height:100%;p
|
|
|
57
26
|
|
|
58
27
|
// inline-sass-stub:./src/style.scss
|
|
59
28
|
injectStyle(style_default);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
29
|
+
function registerSlide() {
|
|
30
|
+
if (windowManager.WindowManager.registered.has(NetlessAppSlide__default["default"].kind))
|
|
31
|
+
return;
|
|
32
|
+
windowManager.WindowManager.register({
|
|
33
|
+
kind: NetlessAppSlide__default["default"].kind,
|
|
34
|
+
appOptions: { debug: false },
|
|
35
|
+
src: NetlessAppSlide__default["default"],
|
|
36
|
+
addHooks: NetlessAppSlide.addHooks
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var DefaultApps = {};
|
|
40
|
+
function registerDefaultApps() {
|
|
41
|
+
Object.keys(DefaultApps).forEach((kind) => {
|
|
42
|
+
if (windowManager.WindowManager.registered.has(kind))
|
|
43
|
+
return;
|
|
44
|
+
windowManager.WindowManager.register({ kind, ...DefaultApps[kind] });
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async function createFastboard(options) {
|
|
48
|
+
registerSlide();
|
|
49
|
+
registerDefaultApps();
|
|
50
|
+
return fastboardCore.createFastboardCore(options);
|
|
74
51
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
replayFastboard.$set(props);
|
|
80
|
-
},
|
|
81
|
-
destroy() {
|
|
82
|
-
replayFastboard.$destroy();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
52
|
+
async function replayFastboard(options) {
|
|
53
|
+
registerSlide();
|
|
54
|
+
registerDefaultApps();
|
|
55
|
+
return fastboardCore.replayFastboardCore(options);
|
|
85
56
|
}
|
|
57
|
+
|
|
58
|
+
Object.defineProperty(exports, 'Slide', {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return NetlessAppSlide.Slide; }
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, 'SlideViewer', {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () { return NetlessAppSlide.SlideViewer; }
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, 'previewSlide', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return NetlessAppSlide.previewSlide; }
|
|
69
|
+
});
|
|
70
|
+
exports.createFastboard = createFastboard;
|
|
71
|
+
exports.replayFastboard = replayFastboard;
|
|
72
|
+
Object.keys(fastboardCore).forEach(function (k) {
|
|
73
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () { return fastboardCore[k]; }
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
Object.keys(fastboardUi).forEach(function (k) {
|
|
79
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return fastboardUi[k]; }
|
|
82
|
+
});
|
|
83
|
+
});
|
|
86
84
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/behaviors/netless-app.ts","../src/create.ts","../src/replay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,cAAc;AACd,cAAc;;;ACKd,SAAS,qBAAqB;AAE9B,OAAO,mBAAmB,UAAU,cAAc,OAAO,mBAAmB;AAKrE,SAAS,gBAAgB;AAC9B,MAAI,cAAc,WAAW,IAAI,gBAAgB,IAAI;AAAG;AACxD,gBAAc,SAAS;AAAA,IACrB,MAAM,gBAAgB;AAAA,IACtB,YAAY,EAAE,OAAO,MAAM;AAAA,IAC3B,KAAK;AAAA,IACL;AAAA,EACF,CAAC;AACH;AAEA,IAAM,cAEF,CAAC;AAEE,SAAS,sBAAsB;AACpC,SAAO,KAAK,WAAW,EAAE,QAAQ,UAAQ;AACvC,QAAI,cAAc,WAAW,IAAI,IAAI;AAAG;AACxC,kBAAc,SAAS,EAAE,MAAM,GAAG,YAAY,MAAM,CAAC;AAAA,EACvD,CAAC;AACH;;;AChCA,SAAS,2BAA2B;AAkBpC,eAAsB,gBACpB,SACmC;AACnC,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD;;;ACxBA,SAAS,2BAA2B;AAmBpC,eAAsB,gBACpB,SACsC;AACtC,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD","sourcesContent":["import \"./style.scss\";\n\nexport * from \"@netless/fastboard-core\";\nexport * from \"@netless/fastboard-ui\";\n\nexport * from \"./behaviors\";\nexport * from \"./create\";\nexport * from \"./replay\";\n","import type {\n AppOptions as NetlessAppSlideAppOptions,\n Attributes as NetlessAppSlideAttributes,\n SlideState,\n SlideViewerOptions,\n} from \"@netless/app-slide\";\nimport type { RegisterParams } from \"@netless/window-manager\";\n\nimport { WindowManager } from \"@netless/window-manager\";\n\nimport NetlessAppSlide, { addHooks, previewSlide, Slide, SlideViewer } from \"@netless/app-slide\";\n\nexport { Slide, SlideViewer, previewSlide };\nexport type { NetlessAppSlideAttributes, SlideState, SlideViewerOptions };\n\nexport function registerSlide() {\n if (WindowManager.registered.has(NetlessAppSlide.kind)) return;\n WindowManager.register({\n kind: NetlessAppSlide.kind,\n appOptions: { debug: false } as NetlessAppSlideAppOptions,\n src: NetlessAppSlide,\n addHooks,\n });\n}\n\nconst DefaultApps: {\n [kind: string]: Omit<RegisterParams, \"kind\">;\n} = {};\n\nexport function registerDefaultApps() {\n Object.keys(DefaultApps).forEach(kind => {\n if (WindowManager.registered.has(kind)) return;\n WindowManager.register({ kind, ...DefaultApps[kind] });\n });\n}\n","import type { FastboardApp, FastboardOptions } from \"@netless/fastboard-core\";\n\nimport { createFastboardCore } from \"@netless/fastboard-core\";\nimport { registerDefaultApps, registerSlide } from \"./behaviors/netless-app\";\n\n/**\n * Create a FastboardApp instance.\n * @example\n * let app = await createFastboard({\n * sdkConfig: {\n * appIdentifier: import.meta.env.VITE_APPID,\n * region: 'cn-hz',\n * },\n * joinRoom: {\n * uid: unique_id,\n * uuid: import.meta.env.VITE_ROOM_UUID,\n * roomToken: import.meta.env.VITE_ROOM_TOKEN,\n * },\n * })\n */\nexport async function createFastboard<TEventData = any>(\n options: FastboardOptions\n): Promise<FastboardApp<TEventData>> {\n registerSlide();\n registerDefaultApps();\n return createFastboardCore<TEventData>(options);\n}\n","import type { FastboardPlayer, FastboardReplayOptions } from \"@netless/fastboard-core\";\n\nimport { replayFastboardCore } from \"@netless/fastboard-core\";\nimport { registerDefaultApps, registerSlide } from \"./behaviors/netless-app\";\n\n/**\n * Create a FastboardPlayer instance.\n * @example\n * let player = await replayFastboard({\n * sdkConfig: {\n * appIdentifier: import.meta.env.VITE_APPID,\n * region: 'cn-hz',\n * },\n * replayRoom: {\n * room: \"room uuid\",\n * roomToken: \"NETLESSROOM_...\",\n * beginTimestamp: 1646619090394,\n * duration: 70448,\n * },\n * })\n */\nexport async function replayFastboard<TEventData = any>(\n options: FastboardReplayOptions\n): Promise<FastboardPlayer<TEventData>> {\n registerSlide();\n registerDefaultApps();\n return replayFastboardCore<TEventData>(options);\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export * from '@netless/fastboard-ui';
|
|
1
|
+
import { createFastboardCore, replayFastboardCore } from '@netless/fastboard-core';
|
|
3
2
|
export * from '@netless/fastboard-core';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
3
|
+
export * from '@netless/fastboard-ui';
|
|
4
|
+
import { WindowManager } from '@netless/window-manager';
|
|
5
|
+
import NetlessAppSlide, { addHooks } from '@netless/app-slide';
|
|
6
|
+
export { Slide, SlideViewer, previewSlide } from '@netless/app-slide';
|
|
21
7
|
|
|
22
8
|
// inline-sass-helper:inline-sass-style-helper.js
|
|
23
9
|
function injectStyle(text) {
|
|
@@ -34,28 +20,34 @@ var style_default = '.netless-window-manager-playground{width:100%;height:100%;p
|
|
|
34
20
|
|
|
35
21
|
// inline-sass-stub:./src/style.scss
|
|
36
22
|
injectStyle(style_default);
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
function registerSlide() {
|
|
24
|
+
if (WindowManager.registered.has(NetlessAppSlide.kind))
|
|
25
|
+
return;
|
|
26
|
+
WindowManager.register({
|
|
27
|
+
kind: NetlessAppSlide.kind,
|
|
28
|
+
appOptions: { debug: false },
|
|
29
|
+
src: NetlessAppSlide,
|
|
30
|
+
addHooks
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
var DefaultApps = {};
|
|
34
|
+
function registerDefaultApps() {
|
|
35
|
+
Object.keys(DefaultApps).forEach((kind) => {
|
|
36
|
+
if (WindowManager.registered.has(kind))
|
|
37
|
+
return;
|
|
38
|
+
WindowManager.register({ kind, ...DefaultApps[kind] });
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async function createFastboard(options) {
|
|
42
|
+
registerSlide();
|
|
43
|
+
registerDefaultApps();
|
|
44
|
+
return createFastboardCore(options);
|
|
47
45
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
replayFastboard.$set(props);
|
|
53
|
-
},
|
|
54
|
-
destroy() {
|
|
55
|
-
replayFastboard.$destroy();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
46
|
+
async function replayFastboard(options) {
|
|
47
|
+
registerSlide();
|
|
48
|
+
registerDefaultApps();
|
|
49
|
+
return replayFastboardCore(options);
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
export {
|
|
52
|
+
export { createFastboard, replayFastboard };
|
|
61
53
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/behaviors/netless-app.ts","../src/create.ts","../src/replay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,cAAc;AACd,cAAc;;;ACKd,SAAS,qBAAqB;AAE9B,OAAO,mBAAmB,UAAU,cAAc,OAAO,mBAAmB;AAKrE,SAAS,gBAAgB;AAC9B,MAAI,cAAc,WAAW,IAAI,gBAAgB,IAAI;AAAG;AACxD,gBAAc,SAAS;AAAA,IACrB,MAAM,gBAAgB;AAAA,IACtB,YAAY,EAAE,OAAO,MAAM;AAAA,IAC3B,KAAK;AAAA,IACL;AAAA,EACF,CAAC;AACH;AAEA,IAAM,cAEF,CAAC;AAEE,SAAS,sBAAsB;AACpC,SAAO,KAAK,WAAW,EAAE,QAAQ,UAAQ;AACvC,QAAI,cAAc,WAAW,IAAI,IAAI;AAAG;AACxC,kBAAc,SAAS,EAAE,MAAM,GAAG,YAAY,MAAM,CAAC;AAAA,EACvD,CAAC;AACH;;;AChCA,SAAS,2BAA2B;AAkBpC,eAAsB,gBACpB,SACmC;AACnC,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD;;;ACxBA,SAAS,2BAA2B;AAmBpC,eAAsB,gBACpB,SACsC;AACtC,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD","sourcesContent":["import \"./style.scss\";\n\nexport * from \"@netless/fastboard-core\";\nexport * from \"@netless/fastboard-ui\";\n\nexport * from \"./behaviors\";\nexport * from \"./create\";\nexport * from \"./replay\";\n","import type {\n AppOptions as NetlessAppSlideAppOptions,\n Attributes as NetlessAppSlideAttributes,\n SlideState,\n SlideViewerOptions,\n} from \"@netless/app-slide\";\nimport type { RegisterParams } from \"@netless/window-manager\";\n\nimport { WindowManager } from \"@netless/window-manager\";\n\nimport NetlessAppSlide, { addHooks, previewSlide, Slide, SlideViewer } from \"@netless/app-slide\";\n\nexport { Slide, SlideViewer, previewSlide };\nexport type { NetlessAppSlideAttributes, SlideState, SlideViewerOptions };\n\nexport function registerSlide() {\n if (WindowManager.registered.has(NetlessAppSlide.kind)) return;\n WindowManager.register({\n kind: NetlessAppSlide.kind,\n appOptions: { debug: false } as NetlessAppSlideAppOptions,\n src: NetlessAppSlide,\n addHooks,\n });\n}\n\nconst DefaultApps: {\n [kind: string]: Omit<RegisterParams, \"kind\">;\n} = {};\n\nexport function registerDefaultApps() {\n Object.keys(DefaultApps).forEach(kind => {\n if (WindowManager.registered.has(kind)) return;\n WindowManager.register({ kind, ...DefaultApps[kind] });\n });\n}\n","import type { FastboardApp, FastboardOptions } from \"@netless/fastboard-core\";\n\nimport { createFastboardCore } from \"@netless/fastboard-core\";\nimport { registerDefaultApps, registerSlide } from \"./behaviors/netless-app\";\n\n/**\n * Create a FastboardApp instance.\n * @example\n * let app = await createFastboard({\n * sdkConfig: {\n * appIdentifier: import.meta.env.VITE_APPID,\n * region: 'cn-hz',\n * },\n * joinRoom: {\n * uid: unique_id,\n * uuid: import.meta.env.VITE_ROOM_UUID,\n * roomToken: import.meta.env.VITE_ROOM_TOKEN,\n * },\n * })\n */\nexport async function createFastboard<TEventData = any>(\n options: FastboardOptions\n): Promise<FastboardApp<TEventData>> {\n registerSlide();\n registerDefaultApps();\n return createFastboardCore<TEventData>(options);\n}\n","import type { FastboardPlayer, FastboardReplayOptions } from \"@netless/fastboard-core\";\n\nimport { replayFastboardCore } from \"@netless/fastboard-core\";\nimport { registerDefaultApps, registerSlide } from \"./behaviors/netless-app\";\n\n/**\n * Create a FastboardPlayer instance.\n * @example\n * let player = await replayFastboard({\n * sdkConfig: {\n * appIdentifier: import.meta.env.VITE_APPID,\n * region: 'cn-hz',\n * },\n * replayRoom: {\n * room: \"room uuid\",\n * roomToken: \"NETLESSROOM_...\",\n * beginTimestamp: 1646619090394,\n * duration: 70448,\n * },\n * })\n */\nexport async function replayFastboard<TEventData = any>(\n options: FastboardReplayOptions\n): Promise<FastboardPlayer<TEventData>> {\n registerSlide();\n registerDefaultApps();\n return replayFastboardCore<TEventData>(options);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.4",
|
|
4
4
|
"description": "A tiny wrapper of white-web-sdk and @netless/window-manager.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,9 +8,14 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"repository": "netless-io/fastboard",
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@netless/window-manager": ">=1.0.0-canary.0",
|
|
13
|
+
"white-web-sdk": ">=2.16.0"
|
|
14
|
+
},
|
|
11
15
|
"dependencies": {
|
|
12
|
-
"@netless/
|
|
13
|
-
"@netless/fastboard-
|
|
16
|
+
"@netless/app-slide": "0.3.0-canary.7",
|
|
17
|
+
"@netless/fastboard-core": "1.0.0-canary.4",
|
|
18
|
+
"@netless/fastboard-ui": "1.0.0-canary.4"
|
|
14
19
|
},
|
|
15
20
|
"devDependencies": {
|
|
16
21
|
"@netless/esbuild-plugin-inline-sass": "0.1.0"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AppOptions as NetlessAppSlideAppOptions,
|
|
3
|
+
Attributes as NetlessAppSlideAttributes,
|
|
4
|
+
SlideState,
|
|
5
|
+
SlideViewerOptions,
|
|
6
|
+
} from "@netless/app-slide";
|
|
7
|
+
import type { RegisterParams } from "@netless/window-manager";
|
|
8
|
+
|
|
9
|
+
import { WindowManager } from "@netless/window-manager";
|
|
10
|
+
|
|
11
|
+
import NetlessAppSlide, { addHooks, previewSlide, Slide, SlideViewer } from "@netless/app-slide";
|
|
12
|
+
|
|
13
|
+
export { Slide, SlideViewer, previewSlide };
|
|
14
|
+
export type { NetlessAppSlideAttributes, SlideState, SlideViewerOptions };
|
|
15
|
+
|
|
16
|
+
export function registerSlide() {
|
|
17
|
+
if (WindowManager.registered.has(NetlessAppSlide.kind)) return;
|
|
18
|
+
WindowManager.register({
|
|
19
|
+
kind: NetlessAppSlide.kind,
|
|
20
|
+
appOptions: { debug: false } as NetlessAppSlideAppOptions,
|
|
21
|
+
src: NetlessAppSlide,
|
|
22
|
+
addHooks,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DefaultApps: {
|
|
27
|
+
[kind: string]: Omit<RegisterParams, "kind">;
|
|
28
|
+
} = {};
|
|
29
|
+
|
|
30
|
+
export function registerDefaultApps() {
|
|
31
|
+
Object.keys(DefaultApps).forEach(kind => {
|
|
32
|
+
if (WindowManager.registered.has(kind)) return;
|
|
33
|
+
WindowManager.register({ kind, ...DefaultApps[kind] });
|
|
34
|
+
});
|
|
35
|
+
}
|
package/src/create.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FastboardApp, FastboardOptions } from "@netless/fastboard-core";
|
|
2
|
+
|
|
3
|
+
import { createFastboardCore } from "@netless/fastboard-core";
|
|
4
|
+
import { registerDefaultApps, registerSlide } from "./behaviors/netless-app";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a FastboardApp instance.
|
|
8
|
+
* @example
|
|
9
|
+
* let app = await createFastboard({
|
|
10
|
+
* sdkConfig: {
|
|
11
|
+
* appIdentifier: import.meta.env.VITE_APPID,
|
|
12
|
+
* region: 'cn-hz',
|
|
13
|
+
* },
|
|
14
|
+
* joinRoom: {
|
|
15
|
+
* uid: unique_id,
|
|
16
|
+
* uuid: import.meta.env.VITE_ROOM_UUID,
|
|
17
|
+
* roomToken: import.meta.env.VITE_ROOM_TOKEN,
|
|
18
|
+
* },
|
|
19
|
+
* })
|
|
20
|
+
*/
|
|
21
|
+
export async function createFastboard<TEventData = any>(
|
|
22
|
+
options: FastboardOptions
|
|
23
|
+
): Promise<FastboardApp<TEventData>> {
|
|
24
|
+
registerSlide();
|
|
25
|
+
registerDefaultApps();
|
|
26
|
+
return createFastboardCore<TEventData>(options);
|
|
27
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
import type { FastboardApp, FastboardPlayer } from "@netless/fastboard-core";
|
|
2
|
-
import type {
|
|
3
|
-
FastboardProps,
|
|
4
|
-
GenericIcon,
|
|
5
|
-
Language,
|
|
6
|
-
ReplayFastboardProps,
|
|
7
|
-
Theme,
|
|
8
|
-
} from "@netless/fastboard-ui";
|
|
9
|
-
|
|
10
|
-
import { Fastboard, ReplayFastboard } from "@netless/fastboard-ui";
|
|
11
|
-
|
|
12
1
|
import "./style.scss";
|
|
13
2
|
|
|
14
3
|
export * from "@netless/fastboard-core";
|
|
15
4
|
export * from "@netless/fastboard-ui";
|
|
16
|
-
export type { Theme, Language, GenericIcon };
|
|
17
|
-
|
|
18
|
-
export type MountProps = Omit<FastboardProps, "app">;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use `createUI` instead.
|
|
22
|
-
*/
|
|
23
|
-
export function mount(app: FastboardApp, div: HTMLDivElement, options?: MountProps) {
|
|
24
|
-
const fastboard = new Fastboard({ target: div, props: { app, ...options } });
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
update(props?: MountProps) {
|
|
28
|
-
fastboard.$set(props);
|
|
29
|
-
},
|
|
30
|
-
destroy() {
|
|
31
|
-
fastboard.$destroy();
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type ReplayProps = Omit<ReplayFastboardProps, "player">;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Use `createReplayUI` instead.
|
|
40
|
-
*/
|
|
41
|
-
export function replay(player: FastboardPlayer, div: HTMLDivElement, options?: ReplayProps) {
|
|
42
|
-
const replayFastboard = new ReplayFastboard({ target: div, props: { player, ...options } });
|
|
43
5
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
destroy() {
|
|
49
|
-
replayFastboard.$destroy();
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
6
|
+
export * from "./behaviors";
|
|
7
|
+
export * from "./create";
|
|
8
|
+
export * from "./replay";
|
package/src/replay.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FastboardPlayer, FastboardReplayOptions } from "@netless/fastboard-core";
|
|
2
|
+
|
|
3
|
+
import { replayFastboardCore } from "@netless/fastboard-core";
|
|
4
|
+
import { registerDefaultApps, registerSlide } from "./behaviors/netless-app";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a FastboardPlayer instance.
|
|
8
|
+
* @example
|
|
9
|
+
* let player = await replayFastboard({
|
|
10
|
+
* sdkConfig: {
|
|
11
|
+
* appIdentifier: import.meta.env.VITE_APPID,
|
|
12
|
+
* region: 'cn-hz',
|
|
13
|
+
* },
|
|
14
|
+
* replayRoom: {
|
|
15
|
+
* room: "room uuid",
|
|
16
|
+
* roomToken: "NETLESSROOM_...",
|
|
17
|
+
* beginTimestamp: 1646619090394,
|
|
18
|
+
* duration: 70448,
|
|
19
|
+
* },
|
|
20
|
+
* })
|
|
21
|
+
*/
|
|
22
|
+
export async function replayFastboard<TEventData = any>(
|
|
23
|
+
options: FastboardReplayOptions
|
|
24
|
+
): Promise<FastboardPlayer<TEventData>> {
|
|
25
|
+
registerSlide();
|
|
26
|
+
registerDefaultApps();
|
|
27
|
+
return replayFastboardCore<TEventData>(options);
|
|
28
|
+
}
|