@netless/app-presentation 0.1.13 → 0.1.14

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/README-zh.md CHANGED
@@ -32,6 +32,17 @@ install(register, {
32
32
  })
33
33
  ```
34
34
 
35
+ ### 依赖边界与本地开发
36
+
37
+ 库代码通过 `import type` 引用 WindowManager 和 White SDK 类型;运行时由宿主通过
38
+ `AppContext` 和 `install(register)` 提供。`install()` 也可以直接接收
39
+ `WindowManager.register`。Fastboard 仅用于集成示例中的房间创建和 UI。
40
+
41
+ 使用 `pnpm install` 安装库构建依赖。运行 Fastboard 示例时,再执行
42
+ `pnpm --dir e2e install`,然后运行 `pnpm dev:e2e`;房间的 `VITE_*` 配置放在
43
+ 仓库根目录的 `.env.local`。Fastboard 和教具插件依赖由独立的 `e2e` 私有包管理,
44
+ 不会随库发布。库构建会拒绝对宿主包的运行时导入。
45
+
35
46
  ### 将应用插入房间
36
47
 
37
48
  如果你以 `{ as: 'DocsViewer' }` 的方式安装了这个应用,请调用 [`fastboard.insertDocs()`](https://github.com/netless-io/fastboard#insert-pdf-ppt-and-pptx)。
package/README.md CHANGED
@@ -34,6 +34,19 @@ install(register, {
34
34
  })
35
35
  ```
36
36
 
37
+ ### Dependency boundary and local development
38
+
39
+ The library imports WindowManager and White SDK types with `import type`; their
40
+ runtime is supplied by the host through `AppContext` and `install(register)`.
41
+ `install()` also accepts `WindowManager.register` directly. Fastboard is only
42
+ needed by the integration demo, where it creates the room and UI.
43
+
44
+ Install the library build dependencies with `pnpm install`. To run the Fastboard
45
+ demo, also run `pnpm --dir e2e install`, then `pnpm dev:e2e`. Configure its
46
+ `VITE_*` room settings in the repository's `.env.local`. The private `e2e`
47
+ package owns the Fastboard and appliance plugin dependencies and is not published.
48
+ The library build rejects runtime imports of host packages.
49
+
37
50
  ### Insert This App Into Room
38
51
 
39
52
  Call [`fastboard.insertDocs()`](https://github.com/netless-io/fastboard#insert-pdf-ppt-and-pptx)
package/build.ts CHANGED
@@ -46,6 +46,20 @@ const lazyload = (): esbuild.Plugin => ({
46
46
  }
47
47
  })
48
48
 
49
+ // Host APIs are provided by AppContext or install(register), never imported at runtime.
50
+ const hostTypesOnly = (): esbuild.Plugin => ({
51
+ name: 'host-types-only',
52
+ setup({ onResolve }) {
53
+ onResolve({
54
+ filter: /^(?:@netless\/(?:window-manager|fastboard(?:-[^/]+)?|appliance-plugin)|white-web-sdk)(?:\/|$)/,
55
+ }, args => ({
56
+ errors: [{
57
+ text: `Presentation cannot import ${args.path} at runtime. Use import type for host types; keep host runtime imports in e2e.`,
58
+ }],
59
+ }))
60
+ },
61
+ })
62
+
49
63
  fs.rmSync('dist', { recursive: true, force: true })
50
64
 
51
65
  let bundle = await rollup.rollup({
@@ -62,17 +76,11 @@ let bundle = await rollup.rollup({
62
76
  sourcemap: true,
63
77
  write: false,
64
78
  target: ['es2017'],
65
- plugins: [sass(), lazyload()],
79
+ plugins: [hostTypesOnly(), sass(), lazyload()],
66
80
  define: {
67
81
  __VERSION__: JSON.stringify(version)
68
82
  },
69
- external: Object.keys({
70
- '@netless/window-manager': '*',
71
- '@netless/appliance-plugin': '*',
72
- '@netless/fastboard': '*',
73
- 'white-web-sdk': '*',
74
- ...peerDependencies,
75
- })
83
+ external: Object.keys(peerDependencies)
76
84
  })
77
85
  let code: any, map: any
78
86
  for (const { path, text } of outputFiles) {
@@ -98,4 +106,6 @@ code = code.replace(`await import('jspdf')`, `jspdf`)
98
106
  fs.writeFileSync('dist/index.global.js', code)
99
107
 
100
108
  if (process.env.DTS != '0')
101
- await dts.build('src/index.ts', 'dist/index.d.ts', { exclude: ['@netless/window-manager'] })
109
+ await dts.build('src/index.ts', 'dist/index.d.ts', {
110
+ exclude: ['@netless/window-manager', 'white-web-sdk'],
111
+ })
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { View, NetlessApp, Size, AppContext, WindowManager } from '@netless/window-manager';
1
+ import { View, NetlessApp, AppContext, WindowManager } from '@netless/window-manager';
2
+ import { Size } from 'white-web-sdk';
2
3
 
3
4
  /**
4
5
  * A combination of {@link Disposer} and {@link IDisposable}.
@@ -2187,6 +2187,7 @@ var NetlessAppPresentation = (function (exports) {
2187
2187
  }
2188
2188
  };
2189
2189
  const restoreFocusedResources = () => {
2190
+ appliedFocusState = true;
2190
2191
  if (!blurEpisode)
2191
2192
  return;
2192
2193
  blurEpisode = false;
@@ -2707,7 +2708,7 @@ var NetlessAppPresentation = (function (exports) {
2707
2708
  }
2708
2709
  )
2709
2710
  );
2710
- app.contentDOM.dataset.appPresentationVersion = "0.1.13";
2711
+ app.contentDOM.dataset.appPresentationVersion = "0.1.14";
2711
2712
  app.scaleDocsToFit = scaleDocsToFit;
2712
2713
  app.log = log;
2713
2714
  app.warn = warn;
@@ -3278,7 +3279,7 @@ var NetlessAppPresentation = (function (exports) {
3278
3279
  };
3279
3280
 
3280
3281
  // src/index.ts
3281
- var version = "0.1.13";
3282
+ var version = "0.1.14";
3282
3283
 
3283
3284
  exports.NetlessAppPresentation = NetlessAppPresentation;
3284
3285
  exports.Presentation = Presentation;
package/dist/index.js CHANGED
@@ -2188,6 +2188,7 @@ var setupBlurThumbnailDegradation = (config) => {
2188
2188
  }
2189
2189
  };
2190
2190
  const restoreFocusedResources = () => {
2191
+ appliedFocusState = true;
2191
2192
  if (!blurEpisode)
2192
2193
  return;
2193
2194
  blurEpisode = false;
@@ -2708,7 +2709,7 @@ var NetlessAppPresentation = {
2708
2709
  }
2709
2710
  )
2710
2711
  );
2711
- app.contentDOM.dataset.appPresentationVersion = "0.1.13";
2712
+ app.contentDOM.dataset.appPresentationVersion = "0.1.14";
2712
2713
  app.scaleDocsToFit = scaleDocsToFit;
2713
2714
  app.log = log;
2714
2715
  app.warn = warn;
@@ -3279,7 +3280,7 @@ var install = (register, options = {}) => {
3279
3280
  };
3280
3281
 
3281
3282
  // src/index.ts
3282
- var version = "0.1.13";
3283
+ var version = "0.1.14";
3283
3284
 
3284
3285
  exports.NetlessAppPresentation = NetlessAppPresentation;
3285
3286
  exports.Presentation = Presentation;