@netless/fastboard-ui 0.3.8 → 0.3.9

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.8",
3
+ "version": "0.3.9",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -10,19 +10,20 @@
10
10
  ],
11
11
  "repository": "netless-io/fastboard",
12
12
  "peerDependencies": {
13
- "@netless/fastboard-core": "0.3.8"
13
+ "@netless/fastboard-core": "0.3.9"
14
14
  },
15
15
  "dependencies": {
16
16
  "tippy.js": "^6.3.7"
17
17
  },
18
18
  "devDependencies": {
19
- "@netless/fastboard-core": "0.3.8",
20
- "@netless/esbuild-plugin-inline-sass": "0.1.0"
19
+ "@netless/fastboard-core": "0.3.9",
20
+ "@netless/esbuild-plugin-inline-sass": "0.1.0",
21
+ "@netless/buildtool": "0.1.0"
21
22
  },
22
23
  "scripts": {
23
24
  "cleanup": "rimraf dist",
24
25
  "check": "tsc --noEmit && svelte-check",
25
- "build": "tsup",
26
+ "build": "buildtool",
26
27
  "dev": "vite",
27
28
  "test:ssr": "esbuild-dev test/ssr.ts"
28
29
  },
@@ -1,10 +1,9 @@
1
1
  import type { Instance, Props } from "tippy.js";
2
2
  import type { SvelteAction } from "../typings";
3
- import { is_client } from "svelte/internal";
4
3
 
5
4
  import Tippy from "tippy.js";
6
5
 
7
- if (is_client) {
6
+ if (typeof window !== "undefined") {
8
7
  Tippy.setDefaultProps({
9
8
  delay: [1000, 400],
10
9
  duration: 300,
@@ -1,6 +1,6 @@
1
- import { SvelteComponentTyped } from "svelte";
2
1
  import type { Content, Placement } from "tippy.js";
3
2
  import type { Theme } from "../../typings";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface ButtonProps {
6
6
  class?: string;
@@ -1,6 +1,6 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, FastboardUIConfig } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface FastboardProps {
6
6
  app?: FastboardApp | null;
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script lang="ts">
4
4
  import type { FastboardPlayer } from "@netless/fastboard-core";
5
- import type { Language, Theme } from "../../typings";
5
+ import type { Language, ReplayFastboardUIConfig, Theme } from "../../typings";
6
6
  import { onMount } from "svelte";
7
7
  import { tippy_hide_all } from "../../actions/tippy";
8
8
  import PlayerControl from "../PlayerControl";
@@ -11,6 +11,7 @@
11
11
  export let theme: Theme = "light";
12
12
  export let language: Language = "en";
13
13
  export let containerRef: ((element: HTMLDivElement | null) => void) | undefined = undefined;
14
+ export let config: ReplayFastboardUIConfig = {};
14
15
 
15
16
  const name = "fastboard";
16
17
 
@@ -51,6 +52,8 @@
51
52
  <div class="{name}-root" class:loading={!player}>
52
53
  <div class="{name}-view" bind:this={container} on:touchstart|capture={focus_me} />
53
54
  <div class="{name}-bottom">
54
- <PlayerControl {player} {theme} {language} />
55
+ {#if config.player_control?.enable !== false}
56
+ <PlayerControl {player} {theme} {language} />
57
+ {/if}
55
58
  </div>
56
59
  </div>
@@ -1,12 +1,13 @@
1
1
  import type { FastboardPlayer } from "@netless/fastboard-core";
2
- import type { Theme, Language } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
2
+ import type { Theme, Language, ReplayFastboardUIConfig } from "../../typings";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface ReplayFastboardProps {
6
6
  player?: FastboardPlayer | null;
7
7
  theme?: Theme;
8
8
  language?: Language;
9
9
  containerRef?: (container: HTMLDivElement | null) => void;
10
+ config?: ReplayFastboardUIConfig;
10
11
  }
11
12
 
12
13
  declare class ReplayFastboard extends SvelteComponentTyped<ReplayFastboardProps> {}
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponentTyped } from "../../typings";
2
2
 
3
3
  export declare interface IconProps {
4
4
  src?: string;
@@ -1,6 +1,6 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, GenericIcon } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface PageControlProps {
6
6
  app?: FastboardApp | null;
@@ -1,6 +1,6 @@
1
1
  import type { FastboardPlayer } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, GenericIcon } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface PlayerControlProps {
6
6
  player?: FastboardPlayer | null;
@@ -1,6 +1,6 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, GenericIcon } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface RedoUndoProps {
6
6
  app?: FastboardApp | null;
@@ -1,6 +1,6 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, ToolbarConfig } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface ToolbarProps {
6
6
  app?: FastboardApp | null;
@@ -22,7 +22,9 @@ $thumb-color: white;
22
22
  background: $thumb-color;
23
23
  border: 0;
24
24
  border-radius: 100%;
25
- box-shadow: 0 1px 1px rgba($shadow-color, 0.15), 0 0 0 1px rgba($shadow-color, 0.2);
25
+ box-shadow:
26
+ 0 1px 1px rgba($shadow-color, 0.15),
27
+ 0 0 0 1px rgba($shadow-color, 0.2);
26
28
  width: $thumb-height;
27
29
  height: $thumb-height;
28
30
  position: relative;
@@ -39,7 +39,6 @@
39
39
  class="{name}-track {theme}"
40
40
  class:grabbing
41
41
  type="range"
42
- role="slider"
43
42
  {disabled}
44
43
  {min}
45
44
  {max}
@@ -24,7 +24,7 @@ export const shapes = [
24
24
  "speechBalloon",
25
25
  ] as const;
26
26
 
27
- export type Shape = typeof shapes[number];
27
+ export type Shape = (typeof shapes)[number];
28
28
 
29
29
  export const applianceShapes = shapes.slice(0, 4) as Appliance[];
30
30
 
@@ -1,6 +1,6 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
2
  import type { Theme, Language, GenericIcon } from "../../typings";
3
- import { SvelteComponentTyped } from "svelte";
3
+ import { SvelteComponentTyped } from "../../typings";
4
4
 
5
5
  export declare interface ZoomControlProps {
6
6
  app?: FastboardApp | null;
@@ -29,7 +29,7 @@ export function createUI(app?: FastboardApp | null, div?: Element): UI {
29
29
  return ui;
30
30
  },
31
31
  update(props?: FastboardProps) {
32
- if (fastboard) {
32
+ if (fastboard && props) {
33
33
  fastboard.$set(props);
34
34
  }
35
35
  },
@@ -74,7 +74,7 @@ export function createReplayUI(player?: FastboardPlayer | null, div?: Element):
74
74
  return ui;
75
75
  },
76
76
  update(props?: ReplayFastboardProps) {
77
- if (fastboard) {
77
+ if (fastboard && props) {
78
78
  fastboard.$set(props);
79
79
  }
80
80
  },
package/src/typings.ts CHANGED
@@ -1,5 +1,12 @@
1
+ /// <reference types="svelte/types/runtime/ambient.d.ts" />
2
+
3
+ export { SvelteComponentTyped } from "svelte/internal";
4
+
1
5
  export interface SvelteAction<T = void> {
2
- (node: HTMLElement, parameters: T): void | {
6
+ (
7
+ node: HTMLElement,
8
+ parameters: T
9
+ ): void | {
3
10
  update?: (parameters: T) => void;
4
11
  destroy?: () => void;
5
12
  };
@@ -36,3 +43,9 @@ export interface FastboardUIConfig {
36
43
  enable?: boolean;
37
44
  };
38
45
  }
46
+
47
+ export interface ReplayFastboardUIConfig {
48
+ player_control?: {
49
+ enable?: boolean;
50
+ };
51
+ }