@netless/fastboard-ui 1.0.1 → 1.0.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/dist/index.js +2014 -1058
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2014 -1058
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +2007 -1055
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +5 -5
- package/src/components/Icons/MarkPen.svelte +20 -0
- package/src/components/Icons/MarkPenFilled.svelte +20 -0
- package/src/components/Icons/index.ts +4 -0
- package/src/components/Toolbar/components/Contents.svelte +70 -17
- package/src/components/Toolbar/definitions/Pencil.svelte +19 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The front-end of @netless/fastboard-core.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"svelte": "dist/index.svelte.mjs",
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
],
|
|
13
13
|
"repository": "netless-io/fastboard",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@netless/fastboard-core": "1.0.
|
|
15
|
+
"@netless/fastboard-core": "1.0.3"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"tippy.js": "^6.3.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@netless/
|
|
22
|
-
"@netless/fastboard-core": "1.0.
|
|
23
|
-
"@netless/
|
|
21
|
+
"@netless/esbuild-plugin-inline-sass": "0.1.0",
|
|
22
|
+
"@netless/fastboard-core": "1.0.3",
|
|
23
|
+
"@netless/buildtool": "0.1.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"cleanup": "rimraf dist",
|
|
@@ -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
|
|
10
|
+
stroke-width="1"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
transform="scale(0.85 0.9) translate(2, 0)"
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
class="fastboard-icon-stroke-color"
|
|
17
|
+
d="m15.95 2.39l5.657 5.657a1 1 0 0 1 0 1.414l-7.778 7.778l-2.122.707l-1.414 1.415a1 1 0 0 1-1.414 0l-4.243-4.243a1 1 0 0 1 0-1.414L6.05 12.29l.707-2.122l7.779-7.778a1 1 0 0 1 1.414 0m.707 3.536l-6.364 6.364l1.414 1.414l6.364-6.364zM4.283 16.886l2.828 2.828l-1.414 1.415l-4.243-1.415z"
|
|
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
|
|
10
|
+
stroke-width="1"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
transform="scale(0.85 0.9) translate(2, 0)"
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
class="fastboard-icon-fill-color"
|
|
17
|
+
d="m15.95 2.39l5.657 5.657a1 1 0 0 1 0 1.414l-7.778 7.778l-2.122.707l-1.414 1.415a1 1 0 0 1-1.414 0l-4.243-4.243a1 1 0 0 1 0-1.414L6.05 12.29l.707-2.122l7.779-7.778a1 1 0 0 1 1.414 0m.707 3.536l-6.364 6.364l1.414 1.414l6.364-6.364zM4.283 16.886l2.828 2.828l-1.414 1.415l-4.243-1.415z"
|
|
18
|
+
/>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -47,6 +47,8 @@ import Pause from "./Pause.svelte";
|
|
|
47
47
|
import Loading from "./Loading.svelte";
|
|
48
48
|
import LaserPen from "./LaserPen.svelte";
|
|
49
49
|
import LaserPenFilled from "./LaserPenFilled.svelte";
|
|
50
|
+
import MarkPen from "./MarkPen.svelte";
|
|
51
|
+
import MarkPenFilled from "./MarkPenFilled.svelte";
|
|
50
52
|
|
|
51
53
|
const Icons = {
|
|
52
54
|
Apps,
|
|
@@ -98,6 +100,8 @@ const Icons = {
|
|
|
98
100
|
Loading,
|
|
99
101
|
LaserPen,
|
|
100
102
|
LaserPenFilled,
|
|
103
|
+
MarkPen,
|
|
104
|
+
MarkPenFilled,
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
export default Icons;
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
|
|
77
77
|
$: hasAppliancePlugin = !!app?.appliancePlugin;
|
|
78
78
|
$: hasUseLaserPen = (hasAppliancePlugin && ($memberState as ExtendMemberState)?.useLaserPen) || false;
|
|
79
|
+
$: hasUseMarkPen =
|
|
80
|
+
(hasAppliancePlugin && ($memberState as ExtendMemberState)?.strokeOpacity === 0.5) || false;
|
|
81
|
+
$: pencilType = hasUseLaserPen ? "laser" : hasUseMarkPen ? "mark" : "pencil";
|
|
79
82
|
|
|
80
83
|
let top = writable(0);
|
|
81
84
|
|
|
@@ -93,7 +96,19 @@
|
|
|
93
96
|
app?.setAppliance("selector");
|
|
94
97
|
}
|
|
95
98
|
function pencil() {
|
|
96
|
-
|
|
99
|
+
if (hasAppliancePlugin) {
|
|
100
|
+
if (appliance !== "pencil") {
|
|
101
|
+
if (pencilType === "mark") {
|
|
102
|
+
useMarkPen();
|
|
103
|
+
} else if (pencilType === "laser") {
|
|
104
|
+
useLaserPen();
|
|
105
|
+
} else {
|
|
106
|
+
usePencil();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
usePencil();
|
|
111
|
+
}
|
|
97
112
|
}
|
|
98
113
|
function text() {
|
|
99
114
|
app?.setAppliance("text");
|
|
@@ -110,8 +125,30 @@
|
|
|
110
125
|
function clear() {
|
|
111
126
|
app?.cleanCurrentScene();
|
|
112
127
|
}
|
|
128
|
+
function usePencil() {
|
|
129
|
+
if (hasAppliancePlugin) {
|
|
130
|
+
app?.appliancePlugin?.setMemberState({
|
|
131
|
+
currentApplianceName: "pencil",
|
|
132
|
+
useLaserPen: false,
|
|
133
|
+
strokeOpacity: 1,
|
|
134
|
+
} as ExtendMemberState);
|
|
135
|
+
} else {
|
|
136
|
+
app?.setAppliance("pencil");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
113
139
|
function useLaserPen() {
|
|
114
|
-
app?.
|
|
140
|
+
app?.appliancePlugin?.setMemberState({
|
|
141
|
+
currentApplianceName: "laserPen",
|
|
142
|
+
useLaserPen: true,
|
|
143
|
+
strokeOpacity: 1,
|
|
144
|
+
} as ExtendMemberState);
|
|
145
|
+
}
|
|
146
|
+
function useMarkPen() {
|
|
147
|
+
app?.appliancePlugin?.setMemberState({
|
|
148
|
+
currentApplianceName: "pencil",
|
|
149
|
+
useLaserPen: false,
|
|
150
|
+
strokeOpacity: 0.5,
|
|
151
|
+
} as ExtendMemberState);
|
|
115
152
|
}
|
|
116
153
|
</script>
|
|
117
154
|
|
|
@@ -128,7 +165,7 @@
|
|
|
128
165
|
<Selector {appliance} {theme} {btn_props} on:click={selector} content={c.selector} />
|
|
129
166
|
{:else if item === "pencil"}
|
|
130
167
|
<Pencil
|
|
131
|
-
{
|
|
168
|
+
{pencilType}
|
|
132
169
|
{appliance}
|
|
133
170
|
{theme}
|
|
134
171
|
{btn_props}
|
|
@@ -171,20 +208,36 @@
|
|
|
171
208
|
<div class="{name}-panel-wrapper" style="display:none">
|
|
172
209
|
<div class="{name}-panel pencil" bind:this={pencil_panel}>
|
|
173
210
|
<div class="{name}-panel-switch-pencil">
|
|
174
|
-
{#if !!app?.appliancePlugin
|
|
175
|
-
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
211
|
+
{#if !!app?.appliancePlugin}
|
|
212
|
+
{#if pencilType !== "pencil"}
|
|
213
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={usePencil}>
|
|
214
|
+
<Icons.Pencil {theme} />
|
|
215
|
+
</Button>
|
|
216
|
+
{:else if pencilType === "pencil"}
|
|
217
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
218
|
+
<Icons.PencilFilled {theme} active />
|
|
219
|
+
</Button>
|
|
220
|
+
{/if}
|
|
221
|
+
|
|
222
|
+
{#if pencilType === "laser"}
|
|
223
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
224
|
+
<Icons.LaserPenFilled {theme} active />
|
|
225
|
+
</Button>
|
|
226
|
+
{:else if pencilType !== "laser"}
|
|
227
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={useLaserPen}>
|
|
228
|
+
<Icons.LaserPen {theme} />
|
|
229
|
+
</Button>
|
|
230
|
+
{/if}
|
|
231
|
+
|
|
232
|
+
{#if pencilType === "mark"}
|
|
233
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
234
|
+
<Icons.MarkPenFilled {theme} active />
|
|
235
|
+
</Button>
|
|
236
|
+
{:else if pencilType !== "mark"}
|
|
237
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={useMarkPen}>
|
|
238
|
+
<Icons.MarkPen {theme} />
|
|
239
|
+
</Button>
|
|
240
|
+
{/if}
|
|
188
241
|
{/if}
|
|
189
242
|
</div>
|
|
190
243
|
<StrokeWidth {app} {theme} {disabled} />
|
|
@@ -9,15 +9,27 @@
|
|
|
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
|
|
12
|
+
export let pencilType: string = "pencil";
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<Button class="pencil" {...btn_props} on:click {content} {menu}>
|
|
16
|
-
{#if
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
{#if pencilType === "mark"}
|
|
17
|
+
{#if appliance === "pencil"}
|
|
18
|
+
<Icons.MarkPenFilled {theme} active />
|
|
19
|
+
{:else}
|
|
20
|
+
<Icons.MarkPen {theme} />
|
|
21
|
+
{/if}
|
|
22
|
+
{:else if pencilType === "laser"}
|
|
23
|
+
{#if appliance === "pencil"}
|
|
24
|
+
<Icons.LaserPenFilled {theme} active />
|
|
25
|
+
{:else}
|
|
26
|
+
<Icons.LaserPen {theme} />
|
|
27
|
+
{/if}
|
|
28
|
+
{:else if pencilType === "pencil"}
|
|
29
|
+
{#if appliance === "pencil"}
|
|
30
|
+
<Icons.PencilFilled {theme} active />
|
|
31
|
+
{:else}
|
|
32
|
+
<Icons.Pencil {theme} />
|
|
33
|
+
{/if}
|
|
22
34
|
{/if}
|
|
23
35
|
</Button>
|