@netless/fastboard 0.0.8 → 0.1.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 (107) hide show
  1. package/LICENSE.txt +1 -1
  2. package/dist/index.js +426 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +393 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +16 -71
  7. package/src/base.ts +55 -0
  8. package/src/core.ts +307 -0
  9. package/src/emitter.ts +21 -0
  10. package/src/index.ts +70 -24
  11. package/src/{behaviors/register-apps.ts → register-apps.ts} +6 -14
  12. package/src/utils.ts +74 -0
  13. package/src/value.ts +74 -0
  14. package/README.md +0 -134
  15. package/dist/index.cjs.js +0 -14
  16. package/dist/index.cjs.js.map +0 -1
  17. package/dist/index.es.js +0 -2538
  18. package/dist/index.es.js.map +0 -1
  19. package/dist/svelte.cjs.js +0 -2
  20. package/dist/svelte.cjs.js.map +0 -1
  21. package/dist/svelte.es.js +0 -31
  22. package/dist/svelte.es.js.map +0 -1
  23. package/dist/vue.cjs.js +0 -2
  24. package/dist/vue.cjs.js.map +0 -1
  25. package/dist/vue.es.js +0 -42
  26. package/dist/vue.es.js.map +0 -1
  27. package/src/WhiteboardApp.ts +0 -80
  28. package/src/behaviors/style.ts +0 -17
  29. package/src/components/PageControl.scss +0 -80
  30. package/src/components/PageControl.tsx +0 -181
  31. package/src/components/PlayerControl/PlayerControl.scss +0 -145
  32. package/src/components/PlayerControl/PlayerControl.tsx +0 -158
  33. package/src/components/PlayerControl/components/Button.tsx +0 -55
  34. package/src/components/PlayerControl/hooks.ts +0 -95
  35. package/src/components/PlayerControl/icons/Loading.tsx +0 -13
  36. package/src/components/PlayerControl/icons/Pause.tsx +0 -13
  37. package/src/components/PlayerControl/icons/Play.tsx +0 -13
  38. package/src/components/PlayerControl/icons/index.ts +0 -10
  39. package/src/components/PlayerControl/index.ts +0 -1
  40. package/src/components/RedoUndo.scss +0 -56
  41. package/src/components/RedoUndo.tsx +0 -95
  42. package/src/components/Root.scss +0 -55
  43. package/src/components/Root.tsx +0 -61
  44. package/src/components/Toolbar/Content.tsx +0 -93
  45. package/src/components/Toolbar/Toolbar.scss +0 -247
  46. package/src/components/Toolbar/Toolbar.tsx +0 -82
  47. package/src/components/Toolbar/components/ApplianceButtons.tsx +0 -132
  48. package/src/components/Toolbar/components/AppsButton.tsx +0 -106
  49. package/src/components/Toolbar/components/Button.tsx +0 -54
  50. package/src/components/Toolbar/components/ColorBox.tsx +0 -56
  51. package/src/components/Toolbar/components/CutLine.tsx +0 -8
  52. package/src/components/Toolbar/components/PencilButton.tsx +0 -70
  53. package/src/components/Toolbar/components/ShapesButton.tsx +0 -143
  54. package/src/components/Toolbar/components/Slider.tsx +0 -27
  55. package/src/components/Toolbar/components/TextButton.tsx +0 -66
  56. package/src/components/Toolbar/components/UpDownButtons.tsx +0 -49
  57. package/src/components/Toolbar/components/assets/cocos.png +0 -0
  58. package/src/components/Toolbar/components/assets/countdown.png +0 -0
  59. package/src/components/Toolbar/components/assets/geogebra.png +0 -0
  60. package/src/components/Toolbar/components/assets/vscode.png +0 -0
  61. package/src/components/Toolbar/const.ts +0 -32
  62. package/src/components/Toolbar/hooks.ts +0 -113
  63. package/src/components/Toolbar/icons/Apps.tsx +0 -16
  64. package/src/components/Toolbar/icons/Arrow.tsx +0 -16
  65. package/src/components/Toolbar/icons/Circle.tsx +0 -21
  66. package/src/components/Toolbar/icons/Clean.tsx +0 -16
  67. package/src/components/Toolbar/icons/Clicker.tsx +0 -19
  68. package/src/components/Toolbar/icons/Collapse.tsx +0 -17
  69. package/src/components/Toolbar/icons/Diamond.tsx +0 -17
  70. package/src/components/Toolbar/icons/Down.tsx +0 -17
  71. package/src/components/Toolbar/icons/Eraser.tsx +0 -16
  72. package/src/components/Toolbar/icons/Expand.tsx +0 -17
  73. package/src/components/Toolbar/icons/Line.tsx +0 -13
  74. package/src/components/Toolbar/icons/Pencil.tsx +0 -16
  75. package/src/components/Toolbar/icons/Rectangle.tsx +0 -13
  76. package/src/components/Toolbar/icons/Selector.tsx +0 -16
  77. package/src/components/Toolbar/icons/SpeechBalloon.tsx +0 -17
  78. package/src/components/Toolbar/icons/Star.tsx +0 -17
  79. package/src/components/Toolbar/icons/Text.tsx +0 -16
  80. package/src/components/Toolbar/icons/Triangle.tsx +0 -17
  81. package/src/components/Toolbar/icons/Up.tsx +0 -17
  82. package/src/components/Toolbar/icons/index.ts +0 -42
  83. package/src/components/Toolbar/index.ts +0 -1
  84. package/src/components/ZoomControl.scss +0 -80
  85. package/src/components/ZoomControl.tsx +0 -221
  86. package/src/hooks.ts +0 -53
  87. package/src/i18n/en.json +0 -31
  88. package/src/i18n/index.ts +0 -22
  89. package/src/i18n/zh-CN.json +0 -32
  90. package/src/icons/ChevronLeft.tsx +0 -21
  91. package/src/icons/ChevronRight.tsx +0 -21
  92. package/src/icons/FilePlus.tsx +0 -18
  93. package/src/icons/Minus.tsx +0 -21
  94. package/src/icons/Plus.tsx +0 -21
  95. package/src/icons/Redo.tsx +0 -24
  96. package/src/icons/Reset.tsx +0 -23
  97. package/src/icons/Undo.tsx +0 -24
  98. package/src/icons/index.tsx +0 -11
  99. package/src/internal/Instance.tsx +0 -251
  100. package/src/internal/helpers.ts +0 -42
  101. package/src/internal/index.ts +0 -3
  102. package/src/internal/mount-whiteboard.ts +0 -90
  103. package/src/style.scss +0 -29
  104. package/src/svelte.ts +0 -45
  105. package/src/theme/index.ts +0 -36
  106. package/src/types/index.ts +0 -22
  107. package/src/vue.ts +0 -74
@@ -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/hooks.ts DELETED
@@ -1,53 +0,0 @@
1
- import type { WhiteboardApp, WhiteboardAppConfig } from "./WhiteboardApp";
2
-
3
- import { useEffect, useState } from "react";
4
- import { createWhiteboardApp } from "./index";
5
-
6
- export type FastBoardConfig = WhiteboardAppConfig;
7
-
8
- /**
9
- * @example
10
- * const [app, ref] = useFastboard({ sdkConfig, joinRoom })
11
- * if (app) {
12
- * app.insertDocs({...})
13
- * }
14
- * return <div style={{ width: '100%', height: '100%' }} ref={ref} />
15
- */
16
- export function useFastboard(config: FastBoardConfig): readonly [
17
- app: WhiteboardApp | null,
18
- ref: (div: HTMLDivElement | null) => void,
19
- collectorRef: (div: HTMLDivElement | null) => void
20
- ] & {
21
- readonly app: WhiteboardApp | null;
22
- readonly ref: (div: HTMLDivElement | null) => void;
23
- readonly collectorRef: (div: HTMLDivElement | null) => void;
24
- } {
25
- const [app, setApp] = useState<WhiteboardApp | null>(null);
26
- const [currentTarget, ref] = useState<HTMLDivElement | null>(null);
27
- const [collector, collectorRef] = useState<HTMLDivElement | null>(null);
28
-
29
- useEffect(() => {
30
- let isMounted = true;
31
- const promise = createWhiteboardApp(config).then(app => {
32
- if (isMounted) setApp(app);
33
- });
34
- return () => {
35
- isMounted = false;
36
- promise.then(() => app?.dispose());
37
- };
38
- // ignore config and app change
39
- // eslint-disable-next-line react-hooks/exhaustive-deps
40
- }, []);
41
-
42
- useEffect(() => {
43
- if (app) {
44
- app.bindElement(currentTarget, collector);
45
- }
46
- }, [app, collector, currentTarget]);
47
-
48
- return Object.assign([app, ref, collectorRef] as const, {
49
- app,
50
- ref,
51
- collectorRef,
52
- });
53
- }
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
- }
@@ -1,21 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function ChevronLeft({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <path
13
- fill="none"
14
- stroke={stroke}
15
- strokeLinecap="round"
16
- strokeLinejoin="round"
17
- d="m14 16-2-2-2-2 2-2 2-2"
18
- />
19
- </svg>
20
- );
21
- }
@@ -1,21 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function ChevronRight({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <path
13
- fill="none"
14
- stroke={stroke}
15
- strokeLinecap="round"
16
- strokeLinejoin="round"
17
- d="m10 16 2-2 2-2-2-2-2-2"
18
- />
19
- </svg>
20
- );
21
- }
@@ -1,18 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function FilePlus({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <path
13
- fill={stroke}
14
- d="M12 7.5a.5.5 0 0 1 .09.992L12 8.5H8a1.5 1.5 0 0 0-1.493 1.356L6.5 10v6a1.5 1.5 0 0 0 1.356 1.493L8 17.5h6a1.5 1.5 0 0 0 1.493-1.356L15.5 16v-4a.5.5 0 0 1 .992-.09l.008.09v4a2.5 2.5 0 0 1-2.336 2.495L14 18.5H8a2.5 2.5 0 0 1-2.495-2.336L5.5 16v-6a2.5 2.5 0 0 1 2.336-2.495L8 7.5h4Zm4-2a.5.5 0 0 1 .492.41L16.5 6v1.5H18a.5.5 0 0 1 .09.992L18 8.5h-1.5V10a.5.5 0 0 1-.992.09L15.5 10V8.5H14a.5.5 0 0 1-.09-.992L14 7.5h1.5V6a.5.5 0 0 1 .5-.5Z"
15
- />
16
- </svg>
17
- );
18
- }
@@ -1,21 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function Minus({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <path
13
- fill="none"
14
- stroke={stroke}
15
- strokeLinecap="round"
16
- strokeLinejoin="round"
17
- d="M7 12h10"
18
- />
19
- </svg>
20
- );
21
- }
@@ -1,21 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function Plus({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <path
13
- fill="none"
14
- stroke={stroke}
15
- strokeLinecap="round"
16
- strokeLinejoin="round"
17
- d="M12 7v10m-5-5h10"
18
- />
19
- </svg>
20
- );
21
- }
@@ -1,24 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function Redo({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <g
13
- fill="none"
14
- fillRule="evenodd"
15
- stroke={stroke}
16
- strokeLinecap="round"
17
- strokeLinejoin="round"
18
- >
19
- <path d="M14 14h4v-4" />
20
- <path d="m18 14-.788-.9A7.005 7.005 0 0 0 6 14h0" />
21
- </g>
22
- </svg>
23
- );
24
- }
@@ -1,23 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function Reset({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <g fill="none" fillRule="evenodd" transform="translate(-176 -684)">
13
- <path
14
- stroke={stroke}
15
- strokeLinejoin="round"
16
- d="M188 688v4m0 8v4m8-8h-4m-8 0h-4"
17
- />
18
- <circle cx="188" cy="696" r="6" stroke={stroke} />
19
- <circle cx="188" cy="696" r="1" fill={stroke} />
20
- </g>
21
- </svg>
22
- );
23
- }
@@ -1,24 +0,0 @@
1
- import type { IconProps } from "../types";
2
-
3
- import React from "react";
4
- import { themes } from "../theme";
5
-
6
- export function Undo({ theme = "light", active }: IconProps) {
7
- const config = themes[theme];
8
- const stroke = active ? config.activeColor : config.color;
9
-
10
- return (
11
- <svg viewBox="0 0 24 24">
12
- <g
13
- fill="none"
14
- fillRule="evenodd"
15
- stroke={stroke}
16
- strokeLinecap="round"
17
- strokeLinejoin="round"
18
- >
19
- <path d="M10 14H6v-4" />
20
- <path d="m6 14 .788-.9A7.005 7.005 0 0 1 18 14h0" />
21
- </g>
22
- </svg>
23
- );
24
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
-
3
- export interface IconPropsWithFallback {
4
- fallback: React.ReactElement;
5
- src?: string;
6
- alt?: string;
7
- }
8
-
9
- export function Icon({ fallback, src, alt = "[icon]" }: IconPropsWithFallback) {
10
- return src ? <img src={src} alt={alt} title={alt} /> : fallback;
11
- }