@netless/fastboard-ui 1.0.1 → 1.0.2
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 +1126 -471
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1126 -471
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +1101 -450
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- 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 +55 -17
- package/src/components/Toolbar/definitions/Pencil.svelte +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "The front-end of @netless/fastboard-core.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"svelte": "dist/index.svelte.mjs",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
],
|
|
13
13
|
"repository": "netless-io/fastboard",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@netless/fastboard-core": "1.0.
|
|
15
|
+
"@netless/fastboard-core": "1.0.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"tippy.js": "^6.3.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@netless/fastboard-core": "1.0.2",
|
|
21
22
|
"@netless/buildtool": "0.1.0",
|
|
22
|
-
"@netless/fastboard-core": "1.0.1",
|
|
23
23
|
"@netless/esbuild-plugin-inline-sass": "0.1.0"
|
|
24
24
|
},
|
|
25
25
|
"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
|
|
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,15 @@
|
|
|
93
96
|
app?.setAppliance("selector");
|
|
94
97
|
}
|
|
95
98
|
function pencil() {
|
|
96
|
-
|
|
99
|
+
if (hasAppliancePlugin) {
|
|
100
|
+
app?.appliancePlugin?.setMemberState({
|
|
101
|
+
currentApplianceName: "pencil",
|
|
102
|
+
useLaserPen: false,
|
|
103
|
+
strokeOpacity: 1,
|
|
104
|
+
} as ExtendMemberState);
|
|
105
|
+
} else {
|
|
106
|
+
app?.setAppliance("pencil");
|
|
107
|
+
}
|
|
97
108
|
}
|
|
98
109
|
function text() {
|
|
99
110
|
app?.setAppliance("text");
|
|
@@ -111,7 +122,18 @@
|
|
|
111
122
|
app?.cleanCurrentScene();
|
|
112
123
|
}
|
|
113
124
|
function useLaserPen() {
|
|
114
|
-
app?.
|
|
125
|
+
app?.appliancePlugin?.setMemberState({
|
|
126
|
+
currentApplianceName: "laserPen",
|
|
127
|
+
useLaserPen: true,
|
|
128
|
+
strokeOpacity: 1,
|
|
129
|
+
} as ExtendMemberState);
|
|
130
|
+
}
|
|
131
|
+
function useMarkPen() {
|
|
132
|
+
app?.appliancePlugin?.setMemberState({
|
|
133
|
+
currentApplianceName: "pencil",
|
|
134
|
+
useLaserPen: false,
|
|
135
|
+
strokeOpacity: 0.5,
|
|
136
|
+
} as ExtendMemberState);
|
|
115
137
|
}
|
|
116
138
|
</script>
|
|
117
139
|
|
|
@@ -128,7 +150,7 @@
|
|
|
128
150
|
<Selector {appliance} {theme} {btn_props} on:click={selector} content={c.selector} />
|
|
129
151
|
{:else if item === "pencil"}
|
|
130
152
|
<Pencil
|
|
131
|
-
{
|
|
153
|
+
{pencilType}
|
|
132
154
|
{appliance}
|
|
133
155
|
{theme}
|
|
134
156
|
{btn_props}
|
|
@@ -171,20 +193,36 @@
|
|
|
171
193
|
<div class="{name}-panel-wrapper" style="display:none">
|
|
172
194
|
<div class="{name}-panel pencil" bind:this={pencil_panel}>
|
|
173
195
|
<div class="{name}-panel-switch-pencil">
|
|
174
|
-
{#if !!app?.appliancePlugin
|
|
175
|
-
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
196
|
+
{#if !!app?.appliancePlugin}
|
|
197
|
+
{#if pencilType !== "pencil"}
|
|
198
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={pencil}>
|
|
199
|
+
<Icons.Pencil {theme} />
|
|
200
|
+
</Button>
|
|
201
|
+
{:else if pencilType === "pencil"}
|
|
202
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
203
|
+
<Icons.PencilFilled {theme} active />
|
|
204
|
+
</Button>
|
|
205
|
+
{/if}
|
|
206
|
+
|
|
207
|
+
{#if pencilType === "laser"}
|
|
208
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
209
|
+
<Icons.LaserPenFilled {theme} active />
|
|
210
|
+
</Button>
|
|
211
|
+
{:else if pencilType !== "laser"}
|
|
212
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={useLaserPen}>
|
|
213
|
+
<Icons.LaserPen {theme} />
|
|
214
|
+
</Button>
|
|
215
|
+
{/if}
|
|
216
|
+
|
|
217
|
+
{#if pencilType === "mark"}
|
|
218
|
+
<Button class="{name}-panel-switch-btn" {...btn_props}>
|
|
219
|
+
<Icons.MarkPenFilled {theme} active />
|
|
220
|
+
</Button>
|
|
221
|
+
{:else if pencilType !== "mark"}
|
|
222
|
+
<Button class="{name}-panel-switch-btn" {...btn_props} on:click={useMarkPen}>
|
|
223
|
+
<Icons.MarkPen {theme} />
|
|
224
|
+
</Button>
|
|
225
|
+
{/if}
|
|
188
226
|
{/if}
|
|
189
227
|
</div>
|
|
190
228
|
<StrokeWidth {app} {theme} {disabled} />
|
|
@@ -9,13 +9,15 @@
|
|
|
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 appliance === "pencil" &&
|
|
16
|
+
{#if appliance === "pencil" && pencilType === "mark"}
|
|
17
|
+
<Icons.MarkPenFilled {theme} active />
|
|
18
|
+
{:else if appliance === "pencil" && pencilType === "laser"}
|
|
17
19
|
<Icons.LaserPenFilled {theme} active />
|
|
18
|
-
{:else if appliance === "pencil"}
|
|
20
|
+
{:else if appliance === "pencil" && pencilType === "pencil"}
|
|
19
21
|
<Icons.PencilFilled {theme} active />
|
|
20
22
|
{:else}
|
|
21
23
|
<Icons.Pencil {theme} />
|