@netless/fastboard-ui 0.3.2-canary.5 → 0.3.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.
Files changed (110) hide show
  1. package/LICENSE.txt +21 -21
  2. package/README.md +7 -7
  3. package/dist/index.d.ts +102 -102
  4. package/dist/index.js +30 -23
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +30 -23
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/index.svelte.mjs +22 -17
  9. package/dist/index.svelte.mjs.map +1 -1
  10. package/package.json +4 -5
  11. package/src/actions/height.ts +43 -43
  12. package/src/actions/scroll.ts +31 -31
  13. package/src/actions/tippy.ts +71 -71
  14. package/src/behaviors/apps.ts +74 -74
  15. package/src/behaviors/index.ts +1 -1
  16. package/src/components/Button/Button.svelte +51 -51
  17. package/src/components/Button/Button.svelte.d.ts +26 -26
  18. package/src/components/Button/index.ts +2 -2
  19. package/src/components/Fastboard/Fastboard.scss +61 -61
  20. package/src/components/Fastboard/Fastboard.svelte +80 -80
  21. package/src/components/Fastboard/Fastboard.svelte.ts +14 -14
  22. package/src/components/Fastboard/ReplayFastboard.svelte +43 -43
  23. package/src/components/Fastboard/ReplayFastboard.svelte.ts +13 -13
  24. package/src/components/Fastboard/index.ts +5 -5
  25. package/src/components/Icon/Icon.svelte +11 -11
  26. package/src/components/Icon/Icon.svelte.d.ts +10 -10
  27. package/src/components/Icon/index.ts +2 -2
  28. package/src/components/Icons/Apps.svelte +49 -49
  29. package/src/components/Icons/Arrow.svelte +16 -16
  30. package/src/components/Icons/ArrowBolded.svelte +17 -17
  31. package/src/components/Icons/Balloon.svelte +16 -16
  32. package/src/components/Icons/BalloonBolded.svelte +16 -16
  33. package/src/components/Icons/Circle.svelte +20 -20
  34. package/src/components/Icons/CircleBolded.svelte +20 -20
  35. package/src/components/Icons/Clean.svelte +14 -14
  36. package/src/components/Icons/Clear.svelte +16 -16
  37. package/src/components/Icons/Click.svelte +16 -16
  38. package/src/components/Icons/ClickFilled.svelte +10 -10
  39. package/src/components/Icons/Diamond.svelte +16 -16
  40. package/src/components/Icons/Down.svelte +16 -16
  41. package/src/components/Icons/Eraser.svelte +16 -16
  42. package/src/components/Icons/EraserFilled.svelte +16 -16
  43. package/src/components/Icons/Icons.scss +20 -20
  44. package/src/components/Icons/Left.svelte +16 -16
  45. package/src/components/Icons/Line.svelte +16 -16
  46. package/src/components/Icons/LineBolded.svelte +16 -16
  47. package/src/components/Icons/Loading.svelte +10 -10
  48. package/src/components/Icons/Minus.svelte +16 -16
  49. package/src/components/Icons/Pause.svelte +10 -10
  50. package/src/components/Icons/Pencil.svelte +29 -29
  51. package/src/components/Icons/PencilFilled.svelte +16 -16
  52. package/src/components/Icons/Play.svelte +10 -10
  53. package/src/components/Icons/Plus.svelte +16 -16
  54. package/src/components/Icons/Rectangle.svelte +16 -16
  55. package/src/components/Icons/RectangleBolded.svelte +16 -16
  56. package/src/components/Icons/Redo.svelte +15 -15
  57. package/src/components/Icons/Reset.svelte +26 -26
  58. package/src/components/Icons/Rhombus.svelte +16 -16
  59. package/src/components/Icons/RhombusBolded.svelte +16 -16
  60. package/src/components/Icons/Right.svelte +16 -16
  61. package/src/components/Icons/Selector.svelte +24 -24
  62. package/src/components/Icons/SelectorFilled.svelte +18 -18
  63. package/src/components/Icons/SpeechBalloon.svelte +16 -16
  64. package/src/components/Icons/Star.svelte +16 -16
  65. package/src/components/Icons/StarBolded.svelte +16 -16
  66. package/src/components/Icons/Text.svelte +16 -16
  67. package/src/components/Icons/TextFilled.svelte +17 -17
  68. package/src/components/Icons/Triangle.svelte +16 -16
  69. package/src/components/Icons/TriangleBolded.svelte +16 -16
  70. package/src/components/Icons/Undo.svelte +15 -15
  71. package/src/components/Icons/Up.svelte +16 -16
  72. package/src/components/Icons/WhiteboardAdd.svelte +34 -34
  73. package/src/components/Icons/index.ts +93 -93
  74. package/src/components/PageControl/PageControl.scss +15 -15
  75. package/src/components/PageControl/PageControl.svelte +79 -79
  76. package/src/components/PageControl/PageControl.svelte.d.ts +13 -13
  77. package/src/components/PageControl/index.ts +2 -2
  78. package/src/components/PlayerControl/PlayerControl.scss +57 -57
  79. package/src/components/PlayerControl/PlayerControl.svelte +153 -153
  80. package/src/components/PlayerControl/PlayerControl.svelte.d.ts +13 -13
  81. package/src/components/PlayerControl/index.ts +2 -2
  82. package/src/components/RedoUndo/RedoUndo.scss +11 -11
  83. package/src/components/RedoUndo/RedoUndo.svelte +60 -60
  84. package/src/components/RedoUndo/RedoUndo.svelte.d.ts +13 -13
  85. package/src/components/RedoUndo/index.ts +2 -2
  86. package/src/components/Toolbar/README.md +57 -57
  87. package/src/components/Toolbar/Toolbar.scss +78 -78
  88. package/src/components/Toolbar/Toolbar.svelte +62 -62
  89. package/src/components/Toolbar/Toolbar.svelte.d.ts +13 -13
  90. package/src/components/Toolbar/components/Contents.scss +168 -168
  91. package/src/components/Toolbar/components/Contents.svelte +202 -197
  92. package/src/components/Toolbar/components/Shapes.svelte +85 -85
  93. package/src/components/Toolbar/components/Slider.scss +119 -119
  94. package/src/components/Toolbar/components/Slider.svelte +54 -54
  95. package/src/components/Toolbar/components/StrokeColor.svelte +39 -39
  96. package/src/components/Toolbar/components/StrokeWidth.svelte +20 -20
  97. package/src/components/Toolbar/components/TextColor.svelte +39 -39
  98. package/src/components/Toolbar/components/constants.ts +80 -80
  99. package/src/components/Toolbar/components/helper.ts +24 -24
  100. package/src/components/Toolbar/index.ts +2 -2
  101. package/src/components/ZoomControl/ZoomControl.scss +15 -15
  102. package/src/components/ZoomControl/ZoomControl.svelte +99 -99
  103. package/src/components/ZoomControl/ZoomControl.svelte.d.ts +13 -13
  104. package/src/components/ZoomControl/index.ts +2 -2
  105. package/src/components/helpers.ts +3 -3
  106. package/src/components/theme.scss +92 -92
  107. package/src/components/variables.scss +69 -69
  108. package/src/index.ts +13 -13
  109. package/src/style.scss +36 -36
  110. package/src/typings.ts +38 -38
@@ -1,119 +1,119 @@
1
- @use "sass:color";
2
- @import "../../theme.scss";
3
-
4
- $active-shadow-width: 3px;
5
- $thumb-height: 13px;
6
- $track-height: 5px;
7
- $shadow-color: hsl(210deg 15% 16%);
8
- $thumb-color: white;
9
-
10
- @mixin track {
11
- border: 0;
12
- border-radius: calc($track-height / 2);
13
- height: $track-height;
14
- transition: box-shadow 0.3s ease;
15
- user-select: none;
16
- background-color: rgba(grey, $alpha: 0.25);
17
- -webkit-user-select: none;
18
- }
19
-
20
- @mixin thumb {
21
- appearance: none;
22
- background: $thumb-color;
23
- border: 0;
24
- border-radius: 100%;
25
- box-shadow: 0 1px 1px rgba($shadow-color, 0.15), 0 0 0 1px rgba($shadow-color, 0.2);
26
- width: $thumb-height;
27
- height: $thumb-height;
28
- position: relative;
29
- transition: all 0.2s ease;
30
- cursor: grab;
31
- }
32
-
33
- .fastboard-slider {
34
- @include border-box;
35
-
36
- position: relative;
37
- width: 100%;
38
- height: 100%;
39
- display: flex;
40
- align-items: center;
41
- }
42
-
43
- .fastboard-slider-track {
44
- appearance: none;
45
- background: transparent;
46
- border: 0;
47
- border-radius: $thumb-height * 2;
48
-
49
- flex: 1;
50
- display: block;
51
- height: calc($active-shadow-width * 2 + $thumb-height);
52
- margin: 0;
53
- width: 0;
54
- min-width: 0;
55
- padding: 0;
56
- transition: box-shadow 0.3s ease;
57
-
58
- cursor: pointer;
59
- touch-action: manipulation;
60
-
61
- &::-webkit-slider-runnable-track {
62
- @include track;
63
-
64
- background-image: linear-gradient(to right, currentColor var(--value, 0%), transparent var(--value, 0%));
65
- }
66
-
67
- &::-webkit-slider-thumb {
68
- @include thumb;
69
-
70
- appearance: none;
71
- margin-top: calc(($thumb-height - $track-height) / 2 * -1);
72
- }
73
-
74
- &::-moz-range-track {
75
- @include track;
76
- }
77
-
78
- &::-moz-range-thumb {
79
- @include thumb;
80
- }
81
-
82
- &::-moz-range-progress {
83
- background: currentColor;
84
- border-radius: calc($track-height / 2);
85
- height: $track-height;
86
- }
87
-
88
- &::-ms-track {
89
- @include track;
90
-
91
- color: transparent;
92
- }
93
-
94
- &::-ms-thumb {
95
- @include thumb;
96
-
97
- margin-top: 0;
98
- }
99
-
100
- &::-ms-tooltip {
101
- display: none;
102
- }
103
-
104
- &::-moz-focus-outer {
105
- border: 0;
106
- }
107
-
108
- &.grabbing {
109
- &::-webkit-slider-thumb {
110
- cursor: grabbing;
111
- }
112
- }
113
-
114
- @each $name, $theme in $themes {
115
- &.#{$name} {
116
- color: read($theme, "active-color");
117
- }
118
- }
119
- }
1
+ @use "sass:color";
2
+ @import "../../theme.scss";
3
+
4
+ $active-shadow-width: 3px;
5
+ $thumb-height: 13px;
6
+ $track-height: 5px;
7
+ $shadow-color: hsl(210deg 15% 16%);
8
+ $thumb-color: white;
9
+
10
+ @mixin track {
11
+ border: 0;
12
+ border-radius: calc($track-height / 2);
13
+ height: $track-height;
14
+ transition: box-shadow 0.3s ease;
15
+ user-select: none;
16
+ background-color: rgba(grey, $alpha: 0.25);
17
+ -webkit-user-select: none;
18
+ }
19
+
20
+ @mixin thumb {
21
+ appearance: none;
22
+ background: $thumb-color;
23
+ border: 0;
24
+ border-radius: 100%;
25
+ box-shadow: 0 1px 1px rgba($shadow-color, 0.15), 0 0 0 1px rgba($shadow-color, 0.2);
26
+ width: $thumb-height;
27
+ height: $thumb-height;
28
+ position: relative;
29
+ transition: all 0.2s ease;
30
+ cursor: grab;
31
+ }
32
+
33
+ .fastboard-slider {
34
+ @include border-box;
35
+
36
+ position: relative;
37
+ width: 100%;
38
+ height: 100%;
39
+ display: flex;
40
+ align-items: center;
41
+ }
42
+
43
+ .fastboard-slider-track {
44
+ appearance: none;
45
+ background: transparent;
46
+ border: 0;
47
+ border-radius: $thumb-height * 2;
48
+
49
+ flex: 1;
50
+ display: block;
51
+ height: calc($active-shadow-width * 2 + $thumb-height);
52
+ margin: 0;
53
+ width: 0;
54
+ min-width: 0;
55
+ padding: 0;
56
+ transition: box-shadow 0.3s ease;
57
+
58
+ cursor: pointer;
59
+ touch-action: manipulation;
60
+
61
+ &::-webkit-slider-runnable-track {
62
+ @include track;
63
+
64
+ background-image: linear-gradient(to right, currentColor var(--value, 0%), transparent var(--value, 0%));
65
+ }
66
+
67
+ &::-webkit-slider-thumb {
68
+ @include thumb;
69
+
70
+ appearance: none;
71
+ margin-top: calc(($thumb-height - $track-height) / 2 * -1);
72
+ }
73
+
74
+ &::-moz-range-track {
75
+ @include track;
76
+ }
77
+
78
+ &::-moz-range-thumb {
79
+ @include thumb;
80
+ }
81
+
82
+ &::-moz-range-progress {
83
+ background: currentColor;
84
+ border-radius: calc($track-height / 2);
85
+ height: $track-height;
86
+ }
87
+
88
+ &::-ms-track {
89
+ @include track;
90
+
91
+ color: transparent;
92
+ }
93
+
94
+ &::-ms-thumb {
95
+ @include thumb;
96
+
97
+ margin-top: 0;
98
+ }
99
+
100
+ &::-ms-tooltip {
101
+ display: none;
102
+ }
103
+
104
+ &::-moz-focus-outer {
105
+ border: 0;
106
+ }
107
+
108
+ &.grabbing {
109
+ &::-webkit-slider-thumb {
110
+ cursor: grabbing;
111
+ }
112
+ }
113
+
114
+ @each $name, $theme in $themes {
115
+ &.#{$name} {
116
+ color: read($theme, "active-color");
117
+ }
118
+ }
119
+ }
@@ -1,54 +1,54 @@
1
- <script lang="ts">
2
- import type { Theme } from "../../../typings";
3
- import { createEventDispatcher } from "svelte";
4
-
5
- const dispatch = createEventDispatcher<{ change: number }>();
6
-
7
- let className = "";
8
- export { className as class };
9
- export let theme: Theme = "light";
10
- export let min = 0;
11
- export let max = 100;
12
- export let step = 0.01;
13
- export let value = 30;
14
- export let disabled = false;
15
-
16
- const name = "fastboard-slider";
17
-
18
- let real_value = value;
19
- let grabbing = false;
20
-
21
- function on_down() {
22
- grabbing = true;
23
- }
24
-
25
- function on_change() {
26
- grabbing = false;
27
- value = real_value;
28
- dispatch("change", value);
29
- }
30
-
31
- $: if (value !== real_value && !grabbing) {
32
- real_value = value;
33
- }
34
- $: percent = (100 * (real_value - min)) / (max - min);
35
- </script>
36
-
37
- <div class="{name} {className} {theme}" style="--value:{percent}%">
38
- <input
39
- class="{name}-track {theme}"
40
- class:grabbing
41
- type="range"
42
- role="slider"
43
- {disabled}
44
- {min}
45
- {max}
46
- {step}
47
- aria-valuemin={min}
48
- aria-valuemax={max}
49
- aria-valuenow={value}
50
- bind:value={real_value}
51
- on:pointerdown={on_down}
52
- on:change={on_change}
53
- />
54
- </div>
1
+ <script lang="ts">
2
+ import type { Theme } from "../../../typings";
3
+ import { createEventDispatcher } from "svelte";
4
+
5
+ const dispatch = createEventDispatcher<{ change: number }>();
6
+
7
+ let className = "";
8
+ export { className as class };
9
+ export let theme: Theme = "light";
10
+ export let min = 0;
11
+ export let max = 100;
12
+ export let step = 0.01;
13
+ export let value = 30;
14
+ export let disabled = false;
15
+
16
+ const name = "fastboard-slider";
17
+
18
+ let real_value = value;
19
+ let grabbing = false;
20
+
21
+ function on_down() {
22
+ grabbing = true;
23
+ }
24
+
25
+ function on_change() {
26
+ grabbing = false;
27
+ value = real_value;
28
+ dispatch("change", value);
29
+ }
30
+
31
+ $: if (value !== real_value && !grabbing) {
32
+ real_value = value;
33
+ }
34
+ $: percent = (100 * (real_value - min)) / (max - min);
35
+ </script>
36
+
37
+ <div class="{name} {className} {theme}" style="--value:{percent}%">
38
+ <input
39
+ class="{name}-track {theme}"
40
+ class:grabbing
41
+ type="range"
42
+ role="slider"
43
+ {disabled}
44
+ {min}
45
+ {max}
46
+ {step}
47
+ aria-valuemin={min}
48
+ aria-valuemax={max}
49
+ aria-valuenow={value}
50
+ bind:value={real_value}
51
+ on:pointerdown={on_down}
52
+ on:change={on_change}
53
+ />
54
+ </div>
@@ -1,39 +1,39 @@
1
- <script lang="ts">
2
- import type { Color, FastboardApp } from "@netless/fastboard-core";
3
- import type { Theme } from "../../../typings";
4
- import { colorKeys, colors } from "./constants";
5
-
6
- export let app: FastboardApp | null | undefined = null;
7
- export let theme: Theme = "light";
8
- export let disabled = false;
9
-
10
- $: memberState = app?.memberState;
11
- $: strokeColor = $memberState?.strokeColor;
12
-
13
- function is_equal_color(a?: Color, b?: Color) {
14
- return a && b && a.every((v, i) => v === b[i]);
15
- }
16
-
17
- function set_stroke_color(ev: MouseEvent) {
18
- let button = ev.target as HTMLButtonElement | null;
19
- if (button && button.dataset.colorKey) {
20
- let color = colors[button.dataset.colorKey];
21
- if (color && app) {
22
- app.setStrokeColor(color);
23
- }
24
- }
25
- }
26
- </script>
27
-
28
- <div class="fastboard-toolbar-colors {theme}" on:click={set_stroke_color}>
29
- {#each colorKeys as key (key)}
30
- <button
31
- class="fastboard-toolbar-btn fastboard-toolbar-color-btn {theme}"
32
- class:is-active={is_equal_color(strokeColor, colors[key])}
33
- data-color-key={key}
34
- {disabled}
35
- >
36
- <span class="fastboard-toolbar-color-item" style:background-color={key} />
37
- </button>
38
- {/each}
39
- </div>
1
+ <script lang="ts">
2
+ import type { Color, FastboardApp } from "@netless/fastboard-core";
3
+ import type { Theme } from "../../../typings";
4
+ import { colorKeys, colors } from "./constants";
5
+
6
+ export let app: FastboardApp | null | undefined = null;
7
+ export let theme: Theme = "light";
8
+ export let disabled = false;
9
+
10
+ $: memberState = app?.memberState;
11
+ $: strokeColor = $memberState?.strokeColor;
12
+
13
+ function is_equal_color(a?: Color, b?: Color) {
14
+ return a && b && a.every((v, i) => v === b[i]);
15
+ }
16
+
17
+ function set_stroke_color(ev: MouseEvent) {
18
+ let button = ev.target as HTMLButtonElement | null;
19
+ if (button && button.dataset.colorKey) {
20
+ let color = colors[button.dataset.colorKey];
21
+ if (color && app) {
22
+ app.setStrokeColor(color);
23
+ }
24
+ }
25
+ }
26
+ </script>
27
+
28
+ <div class="fastboard-toolbar-colors {theme}" on:click={set_stroke_color}>
29
+ {#each colorKeys as key (key)}
30
+ <button
31
+ class="fastboard-toolbar-btn fastboard-toolbar-color-btn {theme}"
32
+ class:is-active={is_equal_color(strokeColor, colors[key])}
33
+ data-color-key={key}
34
+ {disabled}
35
+ >
36
+ <span class="fastboard-toolbar-color-item" style:background-color={key} />
37
+ </button>
38
+ {/each}
39
+ </div>
@@ -1,20 +1,20 @@
1
- <script lang="ts">
2
- import type { FastboardApp } from "@netless/fastboard-core";
3
- import type { Theme } from "../../../typings";
4
- import Slider from "./Slider.svelte";
5
-
6
- export let app: FastboardApp | null | undefined = null;
7
- export let theme: Theme = "light";
8
- export let disabled = false;
9
-
10
- $: memberState = app?.memberState;
11
- $: value = $memberState?.strokeWidth ?? 1;
12
-
13
- $: props = { value, theme, disabled };
14
-
15
- function set_stroke_width({ detail: value }: CustomEvent<number>) {
16
- app?.setStrokeWidth(value);
17
- }
18
- </script>
19
-
20
- <Slider class="fastboard-toolbar-slider" {...props} min={1} max={32} on:change={set_stroke_width} />
1
+ <script lang="ts">
2
+ import type { FastboardApp } from "@netless/fastboard-core";
3
+ import type { Theme } from "../../../typings";
4
+ import Slider from "./Slider.svelte";
5
+
6
+ export let app: FastboardApp | null | undefined = null;
7
+ export let theme: Theme = "light";
8
+ export let disabled = false;
9
+
10
+ $: memberState = app?.memberState;
11
+ $: value = $memberState?.strokeWidth ?? 1;
12
+
13
+ $: props = { value, theme, disabled };
14
+
15
+ function set_stroke_width({ detail: value }: CustomEvent<number>) {
16
+ app?.setStrokeWidth(value);
17
+ }
18
+ </script>
19
+
20
+ <Slider class="fastboard-toolbar-slider" {...props} min={1} max={32} on:change={set_stroke_width} />
@@ -1,39 +1,39 @@
1
- <script lang="ts">
2
- import type { Color, FastboardApp } from "@netless/fastboard-core";
3
- import type { Theme } from "../../../typings";
4
- import { colorKeys, colors } from "./constants";
5
-
6
- export let app: FastboardApp | null | undefined = null;
7
- export let theme: Theme = "light";
8
- export let disabled = false;
9
-
10
- $: memberState = app?.memberState;
11
- $: textColor = $memberState?.textColor;
12
-
13
- function is_equal_color(a?: Color, b?: Color) {
14
- return a && b && a.every((v, i) => v === b[i]);
15
- }
16
-
17
- function set_stroke_color(ev: MouseEvent) {
18
- let button = ev.target as HTMLButtonElement | null;
19
- if (button && button.dataset.colorKey) {
20
- let color = colors[button.dataset.colorKey];
21
- if (color && app) {
22
- app.setTextColor(color);
23
- }
24
- }
25
- }
26
- </script>
27
-
28
- <div class="fastboard-toolbar-colors {theme}" on:click={set_stroke_color}>
29
- {#each colorKeys as key (key)}
30
- <button
31
- class="fastboard-toolbar-btn fastboard-toolbar-color-btn {theme}"
32
- class:is-active={is_equal_color(textColor, colors[key])}
33
- data-color-key={key}
34
- {disabled}
35
- >
36
- <span class="fastboard-toolbar-color-item" style:background-color={key} />
37
- </button>
38
- {/each}
39
- </div>
1
+ <script lang="ts">
2
+ import type { Color, FastboardApp } from "@netless/fastboard-core";
3
+ import type { Theme } from "../../../typings";
4
+ import { colorKeys, colors } from "./constants";
5
+
6
+ export let app: FastboardApp | null | undefined = null;
7
+ export let theme: Theme = "light";
8
+ export let disabled = false;
9
+
10
+ $: memberState = app?.memberState;
11
+ $: textColor = $memberState?.textColor;
12
+
13
+ function is_equal_color(a?: Color, b?: Color) {
14
+ return a && b && a.every((v, i) => v === b[i]);
15
+ }
16
+
17
+ function set_stroke_color(ev: MouseEvent) {
18
+ let button = ev.target as HTMLButtonElement | null;
19
+ if (button && button.dataset.colorKey) {
20
+ let color = colors[button.dataset.colorKey];
21
+ if (color && app) {
22
+ app.setTextColor(color);
23
+ }
24
+ }
25
+ }
26
+ </script>
27
+
28
+ <div class="fastboard-toolbar-colors {theme}" on:click={set_stroke_color}>
29
+ {#each colorKeys as key (key)}
30
+ <button
31
+ class="fastboard-toolbar-btn fastboard-toolbar-color-btn {theme}"
32
+ class:is-active={is_equal_color(textColor, colors[key])}
33
+ data-color-key={key}
34
+ {disabled}
35
+ >
36
+ <span class="fastboard-toolbar-color-item" style:background-color={key} />
37
+ </button>
38
+ {/each}
39
+ </div>