@netless/fastboard-ui 0.3.2-canary.2 → 0.3.2-canary.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-ui",
3
- "version": "0.3.2-canary.2",
3
+ "version": "0.3.2-canary.3",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "repository": "netless-io/fastboard",
12
12
  "peerDependencies": {
13
- "@netless/fastboard-core": "0.3.2-canary.2"
13
+ "@netless/fastboard-core": "0.3.2-canary.3"
14
14
  },
15
15
  "dependencies": {
16
16
  "tippy.js": "^6.3.7"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@netless/esbuild-plugin-inline-sass": "0.1.0",
20
- "@netless/fastboard-core": "0.3.2-canary.2"
20
+ "@netless/fastboard-core": "0.3.2-canary.3"
21
21
  },
22
22
  "scripts": {
23
23
  "cleanup": "rimraf dist",
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { FastboardApp } from "@netless/fastboard-core";
3
- import type { Language, Theme } from "../../typings";
3
+ import type { Language, Theme, FastboardUIConfig } from "../../typings";
4
4
  import { onMount } from "svelte";
5
5
  import { tippy_hide_all } from "../../actions/tippy";
6
6
  import RedoUndo from "../RedoUndo";
@@ -12,6 +12,7 @@
12
12
  export let theme: Theme = "light";
13
13
  export let language: Language = "en";
14
14
  export let containerRef: ((element: HTMLDivElement | null) => void) | undefined = undefined;
15
+ export let config: FastboardUIConfig = {};
15
16
 
16
17
  const name = "fastboard";
17
18
  const AppsShowToolbar = ["DocsViewer", "Slide"];
@@ -59,13 +60,21 @@
59
60
  <div class="{name}-root" class:loading={!app}>
60
61
  <div class="{name}-view" bind:this={container} on:touchstart|capture={tippy_hide_all} />
61
62
  <div class="{name}-left" class:hidden={!(layout === "visible" || layout === "toolbar-only")}>
62
- <Toolbar {app} {theme} {language} />
63
+ {#if config.toolbar?.enable !== false}
64
+ <Toolbar {app} {theme} {language} />
65
+ {/if}
63
66
  </div>
64
67
  <div class="{name}-bottom-left" class:hidden={layout !== "visible"}>
65
- <RedoUndo {app} {theme} {language} />
66
- <ZoomControl {app} {theme} {language} />
68
+ {#if config.redo_undo?.enable !== false}
69
+ <RedoUndo {app} {theme} {language} />
70
+ {/if}
71
+ {#if config.zoom_control?.enable !== false}
72
+ <ZoomControl {app} {theme} {language} />
73
+ {/if}
67
74
  </div>
68
75
  <div class="{name}-bottom-right" class:hidden={layout !== "visible"}>
69
- <PageControl {app} {theme} {language} />
76
+ {#if config.page_control?.enable !== false}
77
+ <PageControl {app} {theme} {language} />
78
+ {/if}
70
79
  </div>
71
80
  </div>
@@ -1,5 +1,5 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
- import type { Theme, Language } from "../../typings";
2
+ import type { Theme, Language, FastboardUIConfig } from "../../typings";
3
3
  import { SvelteComponentTyped } from "svelte";
4
4
 
5
5
  export declare interface FastboardProps {
@@ -7,6 +7,7 @@ export declare interface FastboardProps {
7
7
  theme?: Theme;
8
8
  language?: Language;
9
9
  containerRef?: (container: HTMLDivElement | null) => void;
10
+ config?: FastboardUIConfig;
10
11
  }
11
12
 
12
13
  declare class Fastboard extends SvelteComponentTyped<FastboardProps> {}
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { GenericIcon, Language, Theme } from "./typings";
1
+ export * from "./typings";
2
2
 
3
3
  export { default as RedoUndo, type RedoUndoProps } from "./components/RedoUndo";
4
4
  export { default as PageControl, type PageControlProps } from "./components/PageControl";
package/src/typings.ts CHANGED
@@ -15,3 +15,18 @@ export type GenericIcon<K extends string, E extends string = IconType> = {
15
15
  };
16
16
 
17
17
  export type I18nData<T extends string> = Record<Language, Record<T, string>>;
18
+
19
+ export interface FastboardUIConfig {
20
+ toolbar?: {
21
+ enable?: boolean;
22
+ };
23
+ redo_undo?: {
24
+ enable?: boolean;
25
+ };
26
+ zoom_control?: {
27
+ enable?: boolean;
28
+ };
29
+ page_control?: {
30
+ enable?: boolean;
31
+ };
32
+ }