@netless/fastboard 0.0.10 → 0.2.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.
Files changed (103) hide show
  1. package/LICENSE.txt +1 -1
  2. package/dist/index.js +32 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +7 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +26 -79
  7. package/src/index.ts +2 -34
  8. package/README.md +0 -126
  9. package/dist/index.cjs.js +0 -14
  10. package/dist/index.cjs.js.map +0 -1
  11. package/dist/index.es.js +0 -2642
  12. package/dist/index.es.js.map +0 -1
  13. package/dist/svelte.cjs.js +0 -2
  14. package/dist/svelte.cjs.js.map +0 -1
  15. package/dist/svelte.es.js +0 -31
  16. package/dist/svelte.es.js.map +0 -1
  17. package/dist/vue.cjs.js +0 -2
  18. package/dist/vue.cjs.js.map +0 -1
  19. package/dist/vue.es.js +0 -42
  20. package/dist/vue.es.js.map +0 -1
  21. package/src/WhiteboardApp.ts +0 -146
  22. package/src/behaviors/register-apps.ts +0 -39
  23. package/src/behaviors/style.ts +0 -17
  24. package/src/components/PageControl.scss +0 -80
  25. package/src/components/PageControl.tsx +0 -181
  26. package/src/components/PlayerControl/PlayerControl.scss +0 -145
  27. package/src/components/PlayerControl/PlayerControl.tsx +0 -158
  28. package/src/components/PlayerControl/components/Button.tsx +0 -55
  29. package/src/components/PlayerControl/hooks.ts +0 -88
  30. package/src/components/PlayerControl/icons/Loading.tsx +0 -13
  31. package/src/components/PlayerControl/icons/Pause.tsx +0 -13
  32. package/src/components/PlayerControl/icons/Play.tsx +0 -13
  33. package/src/components/PlayerControl/icons/index.ts +0 -10
  34. package/src/components/PlayerControl/index.ts +0 -1
  35. package/src/components/RedoUndo.scss +0 -56
  36. package/src/components/RedoUndo.tsx +0 -95
  37. package/src/components/Root.scss +0 -55
  38. package/src/components/Root.tsx +0 -61
  39. package/src/components/Toolbar/Content.tsx +0 -93
  40. package/src/components/Toolbar/Toolbar.scss +0 -247
  41. package/src/components/Toolbar/Toolbar.tsx +0 -82
  42. package/src/components/Toolbar/components/ApplianceButtons.tsx +0 -132
  43. package/src/components/Toolbar/components/AppsButton.tsx +0 -106
  44. package/src/components/Toolbar/components/Button.tsx +0 -54
  45. package/src/components/Toolbar/components/ColorBox.tsx +0 -56
  46. package/src/components/Toolbar/components/CutLine.tsx +0 -8
  47. package/src/components/Toolbar/components/PencilButton.tsx +0 -70
  48. package/src/components/Toolbar/components/ShapesButton.tsx +0 -143
  49. package/src/components/Toolbar/components/Slider.tsx +0 -27
  50. package/src/components/Toolbar/components/TextButton.tsx +0 -66
  51. package/src/components/Toolbar/components/UpDownButtons.tsx +0 -49
  52. package/src/components/Toolbar/components/assets/cocos.png +0 -0
  53. package/src/components/Toolbar/components/assets/countdown.png +0 -0
  54. package/src/components/Toolbar/components/assets/geogebra.png +0 -0
  55. package/src/components/Toolbar/components/assets/vscode.png +0 -0
  56. package/src/components/Toolbar/const.ts +0 -32
  57. package/src/components/Toolbar/hooks.ts +0 -113
  58. package/src/components/Toolbar/icons/Apps.tsx +0 -16
  59. package/src/components/Toolbar/icons/Arrow.tsx +0 -16
  60. package/src/components/Toolbar/icons/Circle.tsx +0 -21
  61. package/src/components/Toolbar/icons/Clean.tsx +0 -16
  62. package/src/components/Toolbar/icons/Clicker.tsx +0 -19
  63. package/src/components/Toolbar/icons/Collapse.tsx +0 -17
  64. package/src/components/Toolbar/icons/Diamond.tsx +0 -17
  65. package/src/components/Toolbar/icons/Down.tsx +0 -17
  66. package/src/components/Toolbar/icons/Eraser.tsx +0 -16
  67. package/src/components/Toolbar/icons/Expand.tsx +0 -17
  68. package/src/components/Toolbar/icons/Line.tsx +0 -13
  69. package/src/components/Toolbar/icons/Pencil.tsx +0 -16
  70. package/src/components/Toolbar/icons/Rectangle.tsx +0 -13
  71. package/src/components/Toolbar/icons/Selector.tsx +0 -16
  72. package/src/components/Toolbar/icons/SpeechBalloon.tsx +0 -17
  73. package/src/components/Toolbar/icons/Star.tsx +0 -17
  74. package/src/components/Toolbar/icons/Text.tsx +0 -16
  75. package/src/components/Toolbar/icons/Triangle.tsx +0 -17
  76. package/src/components/Toolbar/icons/Up.tsx +0 -17
  77. package/src/components/Toolbar/icons/index.ts +0 -42
  78. package/src/components/Toolbar/index.ts +0 -1
  79. package/src/components/ZoomControl.scss +0 -80
  80. package/src/components/ZoomControl.tsx +0 -221
  81. package/src/i18n/en.json +0 -31
  82. package/src/i18n/index.ts +0 -22
  83. package/src/i18n/zh-CN.json +0 -32
  84. package/src/icons/ChevronLeft.tsx +0 -21
  85. package/src/icons/ChevronRight.tsx +0 -21
  86. package/src/icons/FilePlus.tsx +0 -18
  87. package/src/icons/Minus.tsx +0 -21
  88. package/src/icons/Plus.tsx +0 -21
  89. package/src/icons/Redo.tsx +0 -24
  90. package/src/icons/Reset.tsx +0 -23
  91. package/src/icons/Undo.tsx +0 -24
  92. package/src/icons/index.tsx +0 -11
  93. package/src/internal/Instance.tsx +0 -275
  94. package/src/internal/helpers.ts +0 -86
  95. package/src/internal/hooks.ts +0 -9
  96. package/src/internal/index.ts +0 -3
  97. package/src/internal/mount-whiteboard.ts +0 -90
  98. package/src/react.tsx +0 -52
  99. package/src/style.scss +0 -35
  100. package/src/svelte.ts +0 -45
  101. package/src/theme/index.ts +0 -36
  102. package/src/types/index.ts +0 -22
  103. package/src/vue.ts +0 -74
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Collapse = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="m8 10-2 2 2 2m10-8H6m12 12H6m12-4h-8m8-4h-8"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Diamond = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="M4.222 12 12 4.222 19.778 12 12 19.778z"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Down = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="m16 13-2 2-2 2-2-2-2-2m8-6-2 2-2 2-2-2-2-2"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,16 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Eraser = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill={stroke}
12
- d="m14.333 5.183.165.007c.494.037.978.245 1.356.623l2.333 2.333a2.15 2.15 0 0 1 0 3.04l-5.833 5.834a3.8 3.8 0 0 1-5.374 0l-1.167-1.166a2.15 2.15 0 0 1 0-3.04l7-7c.42-.42.97-.63 1.52-.63ZM11.52 8.52l-4.999 5a1.15 1.15 0 0 0 0 1.626l1.167 1.167a2.8 2.8 0 0 0 3.96 0l3.832-3.833-3.96-3.96Z"
13
- />
14
- </svg>
15
- );
16
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Expand = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="m16 10 2 2-2 2M6 6h12M6 18h12M6 14h8m-8-4h8"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,13 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Line = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path fill={stroke} d="m18.01 5.282.708.708L5.99 18.718l-.708-.708z" />
11
- </svg>
12
- );
13
- };
@@ -1,16 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Pencil = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill={stroke}
12
- d="m17.497 4.84.116.105 1.442 1.442a1.52 1.52 0 0 1 .104 2.034l-.104.116L8.733 18.858l-4.347.756.756-4.347L15.463 4.945a1.52 1.52 0 0 1 2.034-.104ZM5.967 16.349l-.353 2.037 2.037-.354-1.683-1.683Zm8.407-8.901-7.946 7.946 2.178 2.178 7.946-7.946-2.178-2.178Zm-.728 2.2.708.707-5 5-.708-.708 5-5Zm2.596-4.055-.072.06-1.09 1.088 2.179 2.178 1.089-1.088a.52.52 0 0 0 .105-.584l-.045-.08-.06-.072-1.442-1.442a.52.52 0 0 0-.664-.06Z"
13
- />
14
- </svg>
15
- );
16
- };
@@ -1,13 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Rectangle = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path fill="none" stroke={stroke} d="M5.5 5.5h13v13h-13z" />
11
- </svg>
12
- );
13
- };
@@ -1,16 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Selector = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill={stroke}
12
- d="m12 12 8 2.667-3.556 1.777L14.667 20 12 12Zm3-8v7.5h-1V5H5v9h6.5v1H4V4h11Z"
13
- />
14
- </svg>
15
- );
16
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const SpeechBalloon = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="M17 4.5c.414 0 .79.168 1.06.44.272.27.44.646.44 1.06v9c0 .414-.168.79-.44 1.06a1.49 1.49 0 0 1-1.06.44h-4.207l-2.715 2.715-1.81-2.715H7a1.49 1.49 0 0 1-1.06-.44A1.495 1.495 0 0 1 5.5 15V6c0-.414.168-.79.44-1.06A1.49 1.49 0 0 1 7 4.5Z"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Star = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="m12 3.523 1.993 5.734 6.07.123-4.838 3.668 1.758 5.81L12 15.391l-4.983 3.467 1.758-5.81L3.938 9.38l6.069-.123L12 3.523Z"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,16 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Text = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill={stroke}
12
- d="M18.5 5.5V8h-1V6.5H13v11h2v1H9v-1h2v-11H6.5V8h-1V5.5h13Z"
13
- />
14
- </svg>
15
- );
16
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Triangle = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="M12 6.008 19.138 18.5H4.862L12 6.008Z"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,17 +0,0 @@
1
- import type { IconProps } from "../../../types";
2
-
3
- import React from "react";
4
- import { getStroke } from "../../../theme";
5
-
6
- export const Up = (props: IconProps) => {
7
- const stroke = getStroke(props);
8
- return (
9
- <svg viewBox="0 0 24 24">
10
- <path
11
- fill="none"
12
- stroke={stroke}
13
- d="m16 11-2-2-2-2-2 2-2 2m8 6-2-2-2-2-2 2-2 2"
14
- />
15
- </svg>
16
- );
17
- };
@@ -1,42 +0,0 @@
1
- import { memo } from "react";
2
- import { Apps } from "./Apps";
3
- import { Arrow } from "./Arrow";
4
- import { Circle } from "./Circle";
5
- import { Clean } from "./Clean";
6
- import { Clicker } from "./Clicker";
7
- import { Collapse } from "./Collapse";
8
- import { Diamond } from "./Diamond";
9
- import { Down } from "./Down";
10
- import { Eraser } from "./Eraser";
11
- import { Expand } from "./Expand";
12
- import { Line } from "./Line";
13
- import { Pencil } from "./Pencil";
14
- import { Rectangle } from "./Rectangle";
15
- import { Selector } from "./Selector";
16
- import { SpeechBalloon } from "./SpeechBalloon";
17
- import { Star } from "./Star";
18
- import { Text } from "./Text";
19
- import { Triangle } from "./Triangle";
20
- import { Up } from "./Up";
21
-
22
- export const Icons = {
23
- Clicker: memo(Clicker),
24
- Collapse: memo(Collapse),
25
- Eraser: memo(Eraser),
26
- Expand: memo(Expand),
27
- Pencil: memo(Pencil),
28
- Selector: memo(Selector),
29
- Rectangle: memo(Rectangle),
30
- Text: memo(Text),
31
- Apps: memo(Apps),
32
- Clean: memo(Clean),
33
- Circle: memo(Circle),
34
- Line: memo(Line),
35
- Arrow: memo(Arrow),
36
- Star: memo(Star),
37
- Diamond: memo(Diamond),
38
- SpeechBalloon: memo(SpeechBalloon),
39
- Triangle: memo(Triangle),
40
- Up: memo(Up),
41
- Down: memo(Down),
42
- };
@@ -1 +0,0 @@
1
- export { name, Toolbar, type ToolbarProps } from "./Toolbar";
@@ -1,80 +0,0 @@
1
- $name: "fastboard-zoom-control";
2
-
3
- .#{$name} {
4
- position: relative;
5
- display: inline-flex;
6
- align-items: center;
7
- gap: 4px;
8
- padding: 4px;
9
- border-radius: 4px;
10
- backdrop-filter: blur(2px);
11
- -webkit-backdrop-filter: blur(2px);
12
-
13
- &.light {
14
- color: #333;
15
- background-color: rgba($color: #fff, $alpha: 0.85);
16
- border: 1px solid rgba(0, 0, 0, 0.15);
17
- }
18
-
19
- &.dark {
20
- color: #ddd;
21
- background-color: rgba($color: #333, $alpha: 0.85);
22
- border: 1px solid rgba(0, 0, 0, 0.45);
23
- }
24
- }
25
-
26
- .#{$name}-btn {
27
- appearance: none;
28
- cursor: pointer;
29
- margin: 0;
30
- border: 0;
31
- padding: 0;
32
- width: 24px;
33
- height: 24px;
34
- background-color: transparent;
35
- border-radius: 4px;
36
- font-size: 24px;
37
- line-height: 1;
38
-
39
- svg,
40
- img {
41
- width: 1em;
42
- height: 1em;
43
- }
44
-
45
- &:disabled {
46
- opacity: 0.5;
47
- cursor: not-allowed;
48
- }
49
-
50
- &.light:not(:disabled):hover {
51
- background-color: rgba(51, 129, 255, 0.1);
52
- }
53
-
54
- &.dark:not(:disabled):hover {
55
- background-color: rgba(51, 129, 255, 0.25);
56
- }
57
- }
58
-
59
- .#{$name}-cut-line {
60
- height: 24px;
61
- width: 0.5px;
62
-
63
- &.light {
64
- background-color: #e7e7e7;
65
- }
66
-
67
- &.dark {
68
- background-color: rgba(255, 255, 255, 0.15);
69
- }
70
- }
71
-
72
- .#{$name}-percent {
73
- opacity: 0.6;
74
- }
75
-
76
- .#{$name}-scale,
77
- .#{$name}-percent {
78
- font-size: 12px;
79
- font-variant-numeric: tabular-nums;
80
- }
@@ -1,221 +0,0 @@
1
- import type { RoomState } from "white-web-sdk";
2
- import type { CommonProps, GenericIcon } from "../types";
3
-
4
- import clsx from "clsx";
5
- import React, { useCallback, useEffect, useState } from "react";
6
- import Tippy from "@tippyjs/react";
7
-
8
- import { clamp } from "../internal";
9
- import { TopOffset } from "../theme";
10
- import { Icon } from "../icons";
11
- import { Minus } from "../icons/Minus";
12
- import { Plus } from "../icons/Plus";
13
- import { Reset } from "../icons/Reset";
14
-
15
- export const name = "fastboard-zoom-control";
16
-
17
- export const ScalePoints: readonly number[] = [
18
- 0.10737418240000011, 0.13421772800000012, 0.16777216000000014,
19
- 0.20971520000000016, 0.26214400000000015, 0.3276800000000002,
20
- 0.4096000000000002, 0.5120000000000001, 0.6400000000000001, 0.8, 1, 1.26,
21
- 1.5876000000000001, 2.000376, 2.5204737600000002, 3.1757969376000004,
22
- 4.001504141376, 5.041895218133761, 6.352787974848539, 8.00451284830916, 10,
23
- ];
24
-
25
- function nextScale(scale: number, delta: 1 | -1) {
26
- const { length } = ScalePoints;
27
- const last = length - 1;
28
- if (scale < ScalePoints[0]) return ScalePoints[0];
29
- if (scale > ScalePoints[last]) return ScalePoints[last];
30
- for (let i = 0; i < length; ++i) {
31
- const curr = ScalePoints[i];
32
- const prev = i === 0 ? -Infinity : (ScalePoints[i - 1] + curr) / 2;
33
- const next = i === last ? Infinity : (ScalePoints[i + 1] + curr) / 2;
34
- if (prev <= scale && scale <= next)
35
- return ScalePoints[clamp(i + delta, 0, last)];
36
- }
37
- return 1;
38
- }
39
-
40
- export type ZoomControlProps = CommonProps &
41
- GenericIcon<"reset" | "minus" | "plus">;
42
-
43
- export function ZoomControl({
44
- room,
45
- manager,
46
- theme = "light",
47
- resetIcon,
48
- resetIconDisable,
49
- minusIcon,
50
- minusIconDisable,
51
- plusIcon,
52
- plusIconDisable,
53
- i18n,
54
- }: ZoomControlProps) {
55
- const [writable, setWritable] = useState(false);
56
- const [scale, setScale] = useState(1);
57
-
58
- const resetCamera = useCallback(() => {
59
- if (room?.isWritable) {
60
- if (manager) {
61
- manager.mainView.moveCamera({ scale: 1, centerX: 0, centerY: 0 });
62
- } else {
63
- const { scenes, index } = room.state.sceneState;
64
- if (scenes[index].ppt) {
65
- room.scalePptToFit();
66
- } else {
67
- room.moveCamera({ scale: 1, centerX: 0, centerY: 0 });
68
- }
69
- }
70
- }
71
- }, [room, manager]);
72
-
73
- const zoomIn = useCallback(() => {
74
- if (room?.isWritable) {
75
- if (manager) {
76
- manager.mainView.moveCamera({
77
- scale: nextScale(scale, 1),
78
- centerX: 0,
79
- centerY: 0,
80
- });
81
- } else {
82
- room.moveCamera({
83
- scale: nextScale(scale, 1),
84
- centerX: 0,
85
- centerY: 0,
86
- });
87
- }
88
- }
89
- }, [room, manager, scale]);
90
-
91
- const zoomOut = useCallback(() => {
92
- if (room?.isWritable) {
93
- if (manager) {
94
- manager.mainView.moveCamera({
95
- scale: nextScale(scale, -1),
96
- centerX: 0,
97
- centerY: 0,
98
- });
99
- } else {
100
- room.moveCamera({
101
- scale: nextScale(scale, -1),
102
- centerX: 0,
103
- centerY: 0,
104
- });
105
- }
106
- }
107
- }, [room, manager, scale]);
108
-
109
- useEffect(() => {
110
- if (room) {
111
- setWritable(room.isWritable);
112
- setScale(room.state.cameraState.scale);
113
- }
114
-
115
- if (manager) {
116
- setScale(manager.mainView.camera.scale);
117
- }
118
-
119
- const onRoomStateChanged = (modifyState: Partial<RoomState>) => {
120
- if (modifyState.cameraState) {
121
- setScale(modifyState.cameraState.scale);
122
- }
123
- };
124
-
125
- const onCameraUpdated = ({ scale }: { scale: number }) => setScale(scale);
126
-
127
- const updateWritable = () => setWritable(room?.isWritable || false);
128
-
129
- if (room) {
130
- room.callbacks.on("onEnableWriteNowChanged", updateWritable);
131
- if (manager) {
132
- manager.mainView.callbacks.on("onCameraUpdated", onCameraUpdated);
133
- } else {
134
- room.callbacks.on("onRoomStateChanged", onRoomStateChanged);
135
- }
136
- }
137
-
138
- return () => {
139
- if (room) {
140
- room.callbacks.off("onEnableWriteNowChanged", updateWritable);
141
- room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
142
- manager?.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
143
- }
144
- };
145
- }, [room, manager]);
146
-
147
- const disabled = !writable;
148
-
149
- return (
150
- <div className={clsx(name, theme)}>
151
- {/* <span className={clsx(`${name}-cut-line`, theme)} /> */}
152
- <Tippy
153
- className="fastboard-tip"
154
- content={i18n?.t("zoomOut")}
155
- theme={theme}
156
- disabled={disabled}
157
- placement="top"
158
- duration={300}
159
- offset={TopOffset}
160
- >
161
- <button
162
- className={clsx(`${name}-btn`, "minus", theme)}
163
- disabled={disabled}
164
- onClick={zoomOut}
165
- >
166
- <Icon
167
- fallback={<Minus theme={theme} />}
168
- src={disabled ? minusIconDisable : minusIcon}
169
- alt="[minus]"
170
- />
171
- </button>
172
- </Tippy>
173
- <span className={clsx(`${name}-scale`, theme)}>
174
- {Math.ceil(scale * 100)}
175
- </span>
176
- <span className={clsx(`${name}-percent`, theme)}>%</span>
177
- <Tippy
178
- className="fastboard-tip"
179
- content={i18n?.t("zoomIn")}
180
- theme={theme}
181
- disabled={disabled}
182
- placement="top"
183
- duration={300}
184
- offset={TopOffset}
185
- >
186
- <button
187
- className={clsx(`${name}-btn`, "plus", theme)}
188
- disabled={disabled}
189
- onClick={zoomIn}
190
- >
191
- <Icon
192
- fallback={<Plus theme={theme} />}
193
- src={disabled ? plusIconDisable : plusIcon}
194
- alt="[plus]"
195
- />
196
- </button>
197
- </Tippy>
198
- <Tippy
199
- className="fastboard-tip"
200
- content={i18n?.t("reset")}
201
- theme={theme}
202
- disabled={disabled}
203
- placement="top"
204
- duration={300}
205
- offset={TopOffset}
206
- >
207
- <button
208
- className={clsx(`${name}-btn`, "reset", theme)}
209
- disabled={disabled}
210
- onClick={resetCamera}
211
- >
212
- <Icon
213
- fallback={<Reset theme={theme} />}
214
- src={disabled ? resetIconDisable : resetIcon}
215
- alt="[reset]"
216
- />
217
- </button>
218
- </Tippy>
219
- </div>
220
- );
221
- }
package/src/i18n/en.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "translation": {
3
- "clicker": "clicker",
4
- "selector": "selector",
5
- "text": "text",
6
- "pencil": "pencil",
7
- "arrow": "arrow",
8
- "hand": "hand",
9
- "eraser": "eraser",
10
- "laser": "laser",
11
- "collapse": "Collapse",
12
- "expand": "Expand",
13
- "zoomIn": "Zoom In",
14
- "zoomOut": "Zoom Out",
15
- "reset": "Reset",
16
- "prevPage": "Prev Page",
17
- "nextPage": "Next Page",
18
- "addPage": "Add Page",
19
- "redo": "Redo",
20
- "undo": "Undo",
21
- "shape": "Shape",
22
- "triangle": "Triangle",
23
- "rhombus": "Rhombus",
24
- "pentagram": "Pentagram",
25
- "speechBalloon": "Speech Balloon",
26
- "rectangle": "Rectangle",
27
- "ellipse": "Ellipse",
28
- "straight": "Straight",
29
- "speed": "Speed"
30
- }
31
- }
package/src/i18n/index.ts DELETED
@@ -1,22 +0,0 @@
1
- import i18next from "i18next";
2
- import en from "./en.json";
3
- import zhCN from "./zh-CN.json";
4
-
5
- export type CreateI18nParams = {
6
- language?: string;
7
- };
8
-
9
- export const createI18n = async (params: CreateI18nParams) => {
10
- const defaultLang = navigator.language || "zh-CN";
11
- const lng = params.language || defaultLang;
12
-
13
- await i18next.init({
14
- lng,
15
- resources: {
16
- en: en,
17
- "zh-CN": zhCN,
18
- },
19
- });
20
-
21
- return i18next;
22
- };
@@ -1,32 +0,0 @@
1
- {
2
- "translation": {
3
- "clicker": "点击",
4
- "selector": "选择",
5
- "text": "文字",
6
- "pencil": "铅笔",
7
- "arrow": "箭头",
8
- "hand": "抓手",
9
- "eraser": "橡皮",
10
- "laser": "激光笔",
11
- "zoomIn": "放大",
12
- "zoomOut": "缩小",
13
- "reset": "重置",
14
- "prevPage": "上一页",
15
- "nextPage": "下一页",
16
- "addPage": "添加页面",
17
- "redo": "重做",
18
- "undo": "撤销",
19
- "collapse": "收起",
20
- "expand": "展开",
21
- "clean": "清屏",
22
- "shape": "形状",
23
- "triangle": "三角形",
24
- "rhombus": "菱形",
25
- "pentagram": "五角星",
26
- "speechBalloon": "气球",
27
- "rectangle": "矩形",
28
- "ellipse": "椭圆",
29
- "straight": "直线",
30
- "speed": "速度"
31
- }
32
- }