@netless/fastboard 1.0.0-canary.1 → 1.0.0-canary.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.d.ts CHANGED
@@ -1,24 +1,42 @@
1
- import { FastboardApp, FastboardPlayer } from '@netless/fastboard-core';
1
+ import * as _netless_fastboard_core from '@netless/fastboard-core';
2
+ import { FastboardOptions, FastboardReplayOptions } from '@netless/fastboard-core';
2
3
  export * from '@netless/fastboard-core';
3
- import { FastboardProps, ReplayFastboardProps } from '@netless/fastboard-ui';
4
4
  export * from '@netless/fastboard-ui';
5
- export { GenericIcon, Language, Theme } from '@netless/fastboard-ui';
5
+ export { Attributes as NetlessAppSlideAttributes, Slide, SlideState, SlideViewer, SlideViewerOptions, previewSlide } from '@netless/app-slide';
6
6
 
7
- declare type MountProps = Omit<FastboardProps, "app">;
8
7
  /**
9
- * @deprecated Use `createUI` instead.
8
+ * Create a FastboardApp instance.
9
+ * @example
10
+ * let app = await createFastboard({
11
+ * sdkConfig: {
12
+ * appIdentifier: import.meta.env.VITE_APPID,
13
+ * region: 'cn-hz',
14
+ * },
15
+ * joinRoom: {
16
+ * uid: unique_id,
17
+ * uuid: import.meta.env.VITE_ROOM_UUID,
18
+ * roomToken: import.meta.env.VITE_ROOM_TOKEN,
19
+ * },
20
+ * })
10
21
  */
11
- declare function mount(app: FastboardApp, div: HTMLDivElement, options?: MountProps): {
12
- update(props?: MountProps): void;
13
- destroy(): void;
14
- };
15
- declare type ReplayProps = Omit<ReplayFastboardProps, "player">;
22
+ declare function createFastboard<TEventData = any>(options: FastboardOptions): Promise<_netless_fastboard_core.FastboardApp<TEventData>>;
23
+
16
24
  /**
17
- * @deprecated Use `createReplayUI` instead.
25
+ * Create a FastboardPlayer instance.
26
+ * @example
27
+ * let player = await replayFastboard({
28
+ * sdkConfig: {
29
+ * appIdentifier: import.meta.env.VITE_APPID,
30
+ * region: 'cn-hz',
31
+ * },
32
+ * replayRoom: {
33
+ * room: "room uuid",
34
+ * roomToken: "NETLESSROOM_...",
35
+ * beginTimestamp: 1646619090394,
36
+ * duration: 70448,
37
+ * },
38
+ * })
18
39
  */
19
- declare function replay(player: FastboardPlayer, div: HTMLDivElement, options?: ReplayProps): {
20
- update(props?: ReplayProps): void;
21
- destroy(): void;
22
- };
40
+ declare function replayFastboard<TEventData = any>(options: FastboardReplayOptions): Promise<_netless_fastboard_core.FastboardPlayer<TEventData>>;
23
41
 
24
- export { MountProps, ReplayProps, mount, replay };
42
+ export { createFastboard, replayFastboard };
package/dist/index.js CHANGED
@@ -1,46 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var __defProp = Object.defineProperty;
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
- // src/index.ts
37
- var src_exports = {};
38
- __export(src_exports, {
39
- mount: () => mount,
40
- replay: () => replay
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- var import_fastboard_ui = require("@netless/fastboard-ui");
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
- // src/index.ts
62
- __reExport(src_exports, require("@netless/fastboard-core"), module.exports);
63
- __reExport(src_exports, require("@netless/fastboard-ui"), module.exports);
64
- function mount(app, div, options) {
65
- const fastboard = new import_fastboard_ui.Fastboard({ target: div, props: __spreadValues({ app }, options) });
66
- return {
67
- update(props) {
68
- fastboard.$set(props);
69
- },
70
- destroy() {
71
- fastboard.$destroy();
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 replay(player, div, options) {
76
- const replayFastboard = new import_fastboard_ui.ReplayFastboard({ target: div, props: __spreadValues({ player }, options) });
77
- return {
78
- update(props) {
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,0BAA2C;;;;;;;;;;;;;;;;;;;AAI3C,wBAAc,oCAbd;AAcA,wBAAc,kCAdd;AAsBO,eAAe,KAAmB,KAAqB,SAAsB;AAClF,QAAM,YAAY,IAAI,8BAAU,EAAE,QAAQ,KAAK,OAAO,iBAAE,OAAQ,SAAU,CAAC;AAE3E,SAAO;AAAA,IACL,OAAO,OAAoB;AACzB,gBAAU,KAAK,KAAK;AAAA,IACtB;AAAA,IACA,UAAU;AACR,gBAAU,SAAS;AAAA,IACrB;AAAA,EACF;AACF;AAOO,gBAAgB,QAAyB,KAAqB,SAAuB;AAC1F,QAAM,kBAAkB,IAAI,oCAAgB,EAAE,QAAQ,KAAK,OAAO,iBAAE,UAAW,SAAU,CAAC;AAE1F,SAAO;AAAA,IACL,OAAO,OAAqB;AAC1B,sBAAgB,KAAK,KAAK;AAAA,IAC5B;AAAA,IACA,UAAU;AACR,sBAAgB,SAAS;AAAA,IAC3B;AAAA,EACF;AACF","sourcesContent":["import type { FastboardApp, FastboardPlayer } from \"@netless/fastboard-core\";\nimport type {\n FastboardProps,\n GenericIcon,\n Language,\n ReplayFastboardProps,\n Theme,\n} from \"@netless/fastboard-ui\";\n\nimport { Fastboard, ReplayFastboard } from \"@netless/fastboard-ui\";\n\nimport \"./style.scss\";\n\nexport * from \"@netless/fastboard-core\";\nexport * from \"@netless/fastboard-ui\";\nexport type { Theme, Language, GenericIcon };\n\nexport type MountProps = Omit<FastboardProps, \"app\">;\n\n/**\n * @deprecated Use `createUI` instead.\n */\nexport function mount(app: FastboardApp, div: HTMLDivElement, options?: MountProps) {\n const fastboard = new Fastboard({ target: div, props: { app, ...options } });\n\n return {\n update(props?: MountProps) {\n fastboard.$set(props);\n },\n destroy() {\n fastboard.$destroy();\n },\n };\n}\n\nexport type ReplayProps = Omit<ReplayFastboardProps, \"player\">;\n\n/**\n * @deprecated Use `createReplayUI` instead.\n */\nexport function replay(player: FastboardPlayer, div: HTMLDivElement, options?: ReplayProps) {\n const replayFastboard = new ReplayFastboard({ target: div, props: { player, ...options } });\n\n return {\n update(props?: ReplayProps) {\n replayFastboard.$set(props);\n },\n destroy() {\n replayFastboard.$destroy();\n },\n };\n}\n"]}
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,gBAAkC,SAA2B;AACjF,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD;;;ACtBA,SAAS,2BAA2B;AAmBpC,eAAsB,gBAAkC,SAAiC;AACvF,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 { 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>(options: FastboardOptions) {\n registerSlide();\n registerDefaultApps();\n return createFastboardCore<TEventData>(options);\n}\n","import type { 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>(options: FastboardReplayOptions) {\n registerSlide();\n registerDefaultApps();\n return replayFastboardCore<TEventData>(options);\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,23 +1,9 @@
1
- import { Fastboard, ReplayFastboard } from '@netless/fastboard-ui';
2
- export * from '@netless/fastboard-ui';
1
+ import { createFastboardCore, replayFastboardCore } from '@netless/fastboard-core';
3
2
  export * from '@netless/fastboard-core';
4
-
5
- var __defProp = Object.defineProperty;
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
- };
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 mount(app, div, options) {
38
- const fastboard = new Fastboard({ target: div, props: __spreadValues({ app }, options) });
39
- return {
40
- update(props) {
41
- fastboard.$set(props);
42
- },
43
- destroy() {
44
- fastboard.$destroy();
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 replay(player, div, options) {
49
- const replayFastboard = new ReplayFastboard({ target: div, props: __spreadValues({ player }, options) });
50
- return {
51
- update(props) {
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 { mount, replay };
52
+ export { createFastboard, replayFastboard };
61
53
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;AAIA;AACA;AAQO,eAAe,KAAmB,KAAqB,SAAsB;AAClF,QAAM,YAAY,IAAI,UAAU,EAAE,QAAQ,KAAK,OAAO,iBAAE,OAAQ,SAAU,CAAC;AAE3E,SAAO;AAAA,IACL,OAAO,OAAoB;AACzB,gBAAU,KAAK,KAAK;AAAA,IACtB;AAAA,IACA,UAAU;AACR,gBAAU,SAAS;AAAA,IACrB;AAAA,EACF;AACF;AAOO,gBAAgB,QAAyB,KAAqB,SAAuB;AAC1F,QAAM,kBAAkB,IAAI,gBAAgB,EAAE,QAAQ,KAAK,OAAO,iBAAE,UAAW,SAAU,CAAC;AAE1F,SAAO;AAAA,IACL,OAAO,OAAqB;AAC1B,sBAAgB,KAAK,KAAK;AAAA,IAC5B;AAAA,IACA,UAAU;AACR,sBAAgB,SAAS;AAAA,IAC3B;AAAA,EACF;AACF","sourcesContent":["import type { FastboardApp, FastboardPlayer } from \"@netless/fastboard-core\";\nimport type {\n FastboardProps,\n GenericIcon,\n Language,\n ReplayFastboardProps,\n Theme,\n} from \"@netless/fastboard-ui\";\n\nimport { Fastboard, ReplayFastboard } from \"@netless/fastboard-ui\";\n\nimport \"./style.scss\";\n\nexport * from \"@netless/fastboard-core\";\nexport * from \"@netless/fastboard-ui\";\nexport type { Theme, Language, GenericIcon };\n\nexport type MountProps = Omit<FastboardProps, \"app\">;\n\n/**\n * @deprecated Use `createUI` instead.\n */\nexport function mount(app: FastboardApp, div: HTMLDivElement, options?: MountProps) {\n const fastboard = new Fastboard({ target: div, props: { app, ...options } });\n\n return {\n update(props?: MountProps) {\n fastboard.$set(props);\n },\n destroy() {\n fastboard.$destroy();\n },\n };\n}\n\nexport type ReplayProps = Omit<ReplayFastboardProps, \"player\">;\n\n/**\n * @deprecated Use `createReplayUI` instead.\n */\nexport function replay(player: FastboardPlayer, div: HTMLDivElement, options?: ReplayProps) {\n const replayFastboard = new ReplayFastboard({ target: div, props: { player, ...options } });\n\n return {\n update(props?: ReplayProps) {\n replayFastboard.$set(props);\n },\n destroy() {\n replayFastboard.$destroy();\n },\n };\n}\n"]}
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,gBAAkC,SAA2B;AACjF,gBAAc;AACd,sBAAoB;AACpB,SAAO,oBAAgC,OAAO;AAChD;;;ACtBA,SAAS,2BAA2B;AAmBpC,eAAsB,gBAAkC,SAAiC;AACvF,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 { 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>(options: FastboardOptions) {\n registerSlide();\n registerDefaultApps();\n return createFastboardCore<TEventData>(options);\n}\n","import type { 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>(options: FastboardReplayOptions) {\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.1",
3
+ "version": "1.0.0-canary.2",
4
4
  "description": "A tiny wrapper of white-web-sdk and @netless/window-manager.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -8,12 +8,19 @@
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/fastboard-core": "1.0.0-canary.1",
13
- "@netless/fastboard-ui": "1.0.0-canary.1"
16
+ "@netless/app-slide": "0.3.0-canary.7",
17
+ "@netless/fastboard-core": "1.0.0-canary.2",
18
+ "@netless/fastboard-ui": "1.0.0-canary.2",
19
+ "@netless/synced-store": "^2.0.6"
14
20
  },
15
21
  "devDependencies": {
16
- "@netless/esbuild-plugin-inline-sass": "0.1.0"
22
+ "@netless/esbuild-plugin-inline-sass": "0.1.0",
23
+ "white-web-sdk": "^2.16.33"
17
24
  },
18
25
  "scripts": {
19
26
  "cleanup": "rimraf dist",
@@ -0,0 +1,3 @@
1
+ export type { NetlessAppSlideAttributes, SlideState, SlideViewerOptions } from "./netless-app";
2
+
3
+ export { previewSlide, Slide, SlideViewer } from "./netless-app";
@@ -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
+ }
@@ -0,0 +1,15 @@
1
+ import { name, version } from "@netless/fastboard-core";
2
+
3
+ interface InjectTarget {
4
+ __netlessUA?: string;
5
+ }
6
+
7
+ let injected = false;
8
+ export function ensureNetlessUA() {
9
+ if (typeof window !== "undefined" && !injected) {
10
+ injected = true;
11
+ let str = (window as InjectTarget).__netlessUA || "";
12
+ str += ` ${name}/${version} `;
13
+ (window as InjectTarget).__netlessUA = str;
14
+ }
15
+ }
package/src/create.ts ADDED
@@ -0,0 +1,25 @@
1
+ import type { 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>(options: FastboardOptions) {
22
+ registerSlide();
23
+ registerDefaultApps();
24
+ return createFastboardCore<TEventData>(options);
25
+ }
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
- return {
45
- update(props?: ReplayProps) {
46
- replayFastboard.$set(props);
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,26 @@
1
+ import type { 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>(options: FastboardReplayOptions) {
23
+ registerSlide();
24
+ registerDefaultApps();
25
+ return replayFastboardCore<TEventData>(options);
26
+ }