@netless/fastboard-ui 0.3.23-beta.0 → 1.0.0-beta.0

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.23-beta.0",
3
+ "version": "1.0.0-beta.0",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -11,14 +11,14 @@
11
11
  ],
12
12
  "repository": "netless-io/fastboard",
13
13
  "peerDependencies": {
14
- "@netless/fastboard-core": "0.3.23-beta.0"
14
+ "@netless/fastboard-core": "1.0.0-beta.0"
15
15
  },
16
16
  "dependencies": {
17
17
  "tippy.js": "^6.3.7"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@netless/buildtool": "0.1.0",
21
- "@netless/fastboard-core": "0.3.23-beta.0",
21
+ "@netless/fastboard-core": "1.0.0-beta.0",
22
22
  "@netless/esbuild-plugin-inline-sass": "0.1.0"
23
23
  },
24
24
  "scripts": {
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { Theme } from "../../typings";
3
+
4
+ export let theme: Theme = "light";
5
+ export let active = false;
6
+ </script>
7
+
8
+ <svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
+ <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10)">
10
+ <path
11
+ class="fastboard-icon-stroke-color"
12
+ clip-rule="evenodd"
13
+ d="m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"
14
+ />
15
+ <path
16
+ class="fastboard-icon-stroke-color"
17
+ d="m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"
18
+ />
19
+ </g>
20
+ </svg>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { Theme } from "../../typings";
3
+
4
+ export let theme: Theme = "light";
5
+ export let active = false;
6
+ </script>
7
+
8
+ <svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
+ <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10)">
10
+ <path
11
+ class="fastboard-icon-fill-color"
12
+ clip-rule="evenodd"
13
+ d="m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"
14
+ />
15
+ <path
16
+ class="fastboard-icon-stroke-color"
17
+ d="m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"
18
+ />
19
+ </g>
20
+ </svg>
@@ -45,6 +45,8 @@ import WhiteboardAdd from "./WhiteboardAdd.svelte";
45
45
  import Play from "./Play.svelte";
46
46
  import Pause from "./Pause.svelte";
47
47
  import Loading from "./Loading.svelte";
48
+ import LaserPen from "./LaserPen.svelte";
49
+ import LaserPenFilled from "./LaserPenFilled.svelte";
48
50
 
49
51
  const Icons = {
50
52
  Apps,
@@ -94,6 +96,8 @@ const Icons = {
94
96
  Play,
95
97
  Pause,
96
98
  Loading,
99
+ LaserPen,
100
+ LaserPenFilled,
97
101
  };
98
102
 
99
103
  export default Icons;
@@ -60,6 +60,15 @@ $name: "fastboard-toolbar";
60
60
  display: none;
61
61
  }
62
62
 
63
+ .#{$name}-panel-switch-pencil {
64
+ display: flex;
65
+ }
66
+
67
+ .#{$name}-panel-switch-btn {
68
+ width: 24px;
69
+ height: 24px;
70
+ }
71
+
63
72
  .#{$name}-panel {
64
73
  display: flex;
65
74
  flex-direction: column;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { FastboardApp } from "@netless/fastboard-core";
2
+ import type { FastboardApp, ExtendMemberState } from "@netless/fastboard-core";
3
3
  import type { Writable } from "svelte/store";
4
4
  import type { Language, Theme, ToolbarItem } from "../../../typings";
5
5
  import { writable } from "svelte/store";
@@ -74,6 +74,9 @@
74
74
 
75
75
  $: max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
76
76
 
77
+ $: hasAppliancePlugin = !!app?.appliancePlugin;
78
+ $: hasUseLaserPen = (hasAppliancePlugin && ($memberState as ExtendMemberState)?.useLaserPen) || false;
79
+
77
80
  let top = writable(0);
78
81
 
79
82
  function scroll_up() {
@@ -107,6 +110,9 @@
107
110
  function clear() {
108
111
  app?.cleanCurrentScene();
109
112
  }
113
+ function useLaserPen() {
114
+ app?.setAppliance("laserPen");
115
+ }
110
116
  </script>
111
117
 
112
118
  {#if scrollable}
@@ -121,7 +127,15 @@
121
127
  {:else if item === "selector"}
122
128
  <Selector {appliance} {theme} {btn_props} on:click={selector} content={c.selector} />
123
129
  {:else if item === "pencil"}
124
- <Pencil {appliance} {theme} {btn_props} on:click={pencil} content={c.pencil} menu={pencil_panel} />
130
+ <Pencil
131
+ {hasUseLaserPen}
132
+ {appliance}
133
+ {theme}
134
+ {btn_props}
135
+ on:click={pencil}
136
+ content={c.pencil}
137
+ menu={pencil_panel}
138
+ />
125
139
  {:else if item === "text"}
126
140
  <Text {appliance} {theme} {btn_props} on:click={text} content={c.text} menu={text_panel} />
127
141
  {:else if item === "shapes"}
@@ -156,6 +170,23 @@
156
170
 
157
171
  <div class="{name}-panel-wrapper" style="display:none">
158
172
  <div class="{name}-panel pencil" bind:this={pencil_panel}>
173
+ <div class="{name}-panel-switch-pencil">
174
+ {#if !!app?.appliancePlugin && hasUseLaserPen}
175
+ <Button class="{name}-panel-switch-btn" {...btn_props} on:click={pencil}>
176
+ <Icons.Pencil {theme} />
177
+ </Button>
178
+ <Button class="{name}-panel-switch-btn" {...btn_props}>
179
+ <Icons.LaserPenFilled {theme} active />
180
+ </Button>
181
+ {:else if !!app?.appliancePlugin}
182
+ <Button class="{name}-panel-switch-btn" {...btn_props}>
183
+ <Icons.PencilFilled {theme} active />
184
+ </Button>
185
+ <Button class="{name}-panel-switch-btn" {...btn_props} on:click={useLaserPen}>
186
+ <Icons.LaserPen {theme} />
187
+ </Button>
188
+ {/if}
189
+ </div>
159
190
  <StrokeWidth {app} {theme} {disabled} />
160
191
  <div class="{name}-panel-divider" />
161
192
  <StrokeColor {app} {theme} {disabled} {colors} />
@@ -9,10 +9,13 @@
9
9
  export let menu: ButtonProps["menu"] | undefined;
10
10
  export let appliance: ApplianceNames | undefined;
11
11
  export let theme: Theme = "light";
12
+ export let hasUseLaserPen: boolean = false;
12
13
  </script>
13
14
 
14
15
  <Button class="pencil" {...btn_props} on:click {content} {menu}>
15
- {#if appliance === "pencil"}
16
+ {#if appliance === "pencil" && hasUseLaserPen}
17
+ <Icons.LaserPenFilled {theme} active />
18
+ {:else if appliance === "pencil"}
16
19
  <Icons.PencilFilled {theme} active />
17
20
  {:else}
18
21
  <Icons.Pencil {theme} />