@netless/fastboard-react 0.1.0 → 0.2.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 +426 -487
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +368 -425
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -13
- package/src/components/Fastboard.tsx +27 -17
- package/src/components/PageControl/PageControl.tsx +2 -4
- package/src/components/PageControl/hooks.ts +18 -61
- package/src/components/Toolbar/Content.tsx +19 -4
- package/src/components/Toolbar/Toolbar.scss +13 -3
- package/src/components/Toolbar/Toolbar.tsx +15 -47
- package/src/components/hooks.ts +1 -1
- package/src/index.ts +1 -0
- package/src/vanilla/index.tsx +18 -0
- package/dist/behaviors/style.d.ts +0 -1
- package/dist/components/Fastboard.d.ts +0 -15
- package/dist/components/PageControl/PageControl.d.ts +0 -5
- package/dist/components/PageControl/hooks.d.ts +0 -9
- package/dist/components/PageControl/index.d.ts +0 -2
- package/dist/components/PlayerControl/PlayerControl.d.ts +0 -9
- package/dist/components/PlayerControl/hooks.d.ts +0 -11
- package/dist/components/PlayerControl/icons/Loading.d.ts +0 -3
- package/dist/components/PlayerControl/icons/Pause.d.ts +0 -3
- package/dist/components/PlayerControl/icons/Play.d.ts +0 -3
- package/dist/components/PlayerControl/icons/index.d.ts +0 -6
- package/dist/components/PlayerControl/index.d.ts +0 -2
- package/dist/components/RedoUndo/RedoUndo.d.ts +0 -5
- package/dist/components/RedoUndo/hooks.d.ts +0 -6
- package/dist/components/RedoUndo/index.d.ts +0 -2
- package/dist/components/Toolbar/Content.d.ts +0 -2
- package/dist/components/Toolbar/Toolbar.d.ts +0 -14
- package/dist/components/Toolbar/components/ApplianceButtons.d.ts +0 -7
- package/dist/components/Toolbar/components/AppsButton.d.ts +0 -6
- package/dist/components/Toolbar/components/ColorBox.d.ts +0 -2
- package/dist/components/Toolbar/components/CutLine.d.ts +0 -2
- package/dist/components/Toolbar/components/Mask.d.ts +0 -7
- package/dist/components/Toolbar/components/PencilButton.d.ts +0 -2
- package/dist/components/Toolbar/components/ShapesButton.d.ts +0 -3
- package/dist/components/Toolbar/components/Slider.d.ts +0 -2
- package/dist/components/Toolbar/components/TextButton.d.ts +0 -2
- package/dist/components/Toolbar/components/UpDownButtons.d.ts +0 -7
- package/dist/components/Toolbar/const.d.ts +0 -18
- package/dist/components/Toolbar/hooks.d.ts +0 -12
- package/dist/components/Toolbar/icons/Apps.d.ts +0 -3
- package/dist/components/Toolbar/icons/Arrow.d.ts +0 -3
- package/dist/components/Toolbar/icons/Circle.d.ts +0 -3
- package/dist/components/Toolbar/icons/Clean.d.ts +0 -3
- package/dist/components/Toolbar/icons/Clicker.d.ts +0 -3
- package/dist/components/Toolbar/icons/Collapse.d.ts +0 -3
- package/dist/components/Toolbar/icons/Diamond.d.ts +0 -3
- package/dist/components/Toolbar/icons/Down.d.ts +0 -3
- package/dist/components/Toolbar/icons/Eraser.d.ts +0 -3
- package/dist/components/Toolbar/icons/Expand.d.ts +0 -3
- package/dist/components/Toolbar/icons/Line.d.ts +0 -3
- package/dist/components/Toolbar/icons/Pencil.d.ts +0 -3
- package/dist/components/Toolbar/icons/Rectangle.d.ts +0 -3
- package/dist/components/Toolbar/icons/Selector.d.ts +0 -3
- package/dist/components/Toolbar/icons/SpeechBalloon.d.ts +0 -3
- package/dist/components/Toolbar/icons/Star.d.ts +0 -3
- package/dist/components/Toolbar/icons/Text.d.ts +0 -3
- package/dist/components/Toolbar/icons/Triangle.d.ts +0 -3
- package/dist/components/Toolbar/icons/Up.d.ts +0 -3
- package/dist/components/Toolbar/icons/index.d.ts +0 -22
- package/dist/components/Toolbar/index.d.ts +0 -2
- package/dist/components/ZoomControl/ZoomControl.d.ts +0 -5
- package/dist/components/ZoomControl/hooks.d.ts +0 -7
- package/dist/components/ZoomControl/index.d.ts +0 -2
- package/dist/components/hooks.d.ts +0 -13
- package/dist/i18n/index.d.ts +0 -12
- package/dist/icons/ChevronLeft.d.ts +0 -3
- package/dist/icons/ChevronRight.d.ts +0 -3
- package/dist/icons/FilePlus.d.ts +0 -3
- package/dist/icons/Minus.d.ts +0 -3
- package/dist/icons/Plus.d.ts +0 -3
- package/dist/icons/Redo.d.ts +0 -3
- package/dist/icons/Reset.d.ts +0 -3
- package/dist/icons/Undo.d.ts +0 -3
- package/dist/icons/index.d.ts +0 -7
- package/dist/index.d.ts +0 -9
- package/dist/internal/helpers.d.ts +0 -16
- package/dist/internal/hooks.d.ts +0 -3
- package/dist/internal/index.d.ts +0 -2
- package/dist/theme.d.ts +0 -16
- package/dist/typings.d.ts +0 -10
- package/src/components/Toolbar/components/Mask.tsx +0 -44
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface UpButtonProps {
|
|
3
|
-
disabled: boolean;
|
|
4
|
-
scrollTo: (height: number) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function UpButton({ disabled, scrollTo }: UpButtonProps): JSX.Element;
|
|
7
|
-
export declare function DownButton({ disabled, scrollTo }: UpButtonProps): JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ApplianceNames, ShapeType } from "white-web-sdk";
|
|
3
|
-
export declare const ShapesMap: {
|
|
4
|
-
readonly rectangle: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
5
|
-
readonly ellipse: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
6
|
-
readonly straight: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
7
|
-
readonly arrow: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
8
|
-
readonly pentagram: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
9
|
-
readonly rhombus: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
10
|
-
readonly triangle: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
11
|
-
readonly speechBalloon: import("react").MemoExoticComponent<(props: import("../..").IconProps) => JSX.Element>;
|
|
12
|
-
};
|
|
13
|
-
export declare const ApplianceShapes: readonly [ApplianceNames.rectangle, ApplianceNames.ellipse, ApplianceNames.straight, ApplianceNames.arrow];
|
|
14
|
-
export declare const Shapes: readonly [ShapeType.Pentagram, ShapeType.Rhombus, ShapeType.Triangle, ShapeType.SpeechBalloon];
|
|
15
|
-
export declare const ItemHeight: number;
|
|
16
|
-
export declare const ItemsCount = 8;
|
|
17
|
-
export declare const MaxHeight: number;
|
|
18
|
-
export declare const MinHeight: number;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ApplianceNames, Color, MemberState, ShapeType } from "white-web-sdk";
|
|
2
|
-
export interface ToolbarHook {
|
|
3
|
-
readonly writable: boolean;
|
|
4
|
-
readonly memberState: MemberState | undefined;
|
|
5
|
-
cleanCurrentScene(): void;
|
|
6
|
-
setAppliance(appliance: ApplianceNames, shape?: ShapeType): void;
|
|
7
|
-
setStrokeWidth(width: number): void;
|
|
8
|
-
setStrokeColor(color: Color): void;
|
|
9
|
-
}
|
|
10
|
-
export declare function useRoomState(): any;
|
|
11
|
-
export declare function useToolbar(): ToolbarHook;
|
|
12
|
-
export declare const EmptyToolbarHook: ToolbarHook;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Icons: {
|
|
3
|
-
Clicker: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
4
|
-
Collapse: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
5
|
-
Eraser: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
6
|
-
Expand: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
7
|
-
Pencil: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
8
|
-
Selector: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
9
|
-
Rectangle: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
10
|
-
Text: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
11
|
-
Apps: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
12
|
-
Clean: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
13
|
-
Circle: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
14
|
-
Line: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
15
|
-
Arrow: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
16
|
-
Star: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
17
|
-
Diamond: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
18
|
-
SpeechBalloon: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
19
|
-
Triangle: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
20
|
-
Up: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
21
|
-
Down: import("react").MemoExoticComponent<(props: import("../../..").IconProps) => JSX.Element>;
|
|
22
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { CommonProps, GenericIcon } from "../../typings";
|
|
3
|
-
export declare const name = "fastboard-zoom-control";
|
|
4
|
-
export declare type ZoomControlProps = CommonProps & GenericIcon<"reset" | "minus" | "plus">;
|
|
5
|
-
export declare function ZoomControl({ theme, resetIcon, resetIconDisable, minusIcon, minusIconDisable, plusIcon, plusIconDisable, }: ZoomControlProps): JSX.Element;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { FastboardReadable } from "@netless/fastboard";
|
|
3
|
-
import type { Theme } from "../typings";
|
|
4
|
-
export declare const FastboardAppContext: import("react").Context<any>;
|
|
5
|
-
export declare const ThemeContext: import("react").Context<Theme>;
|
|
6
|
-
export declare function useTheme(userTheme?: Theme | null): Theme;
|
|
7
|
-
export declare function useFastboardApp(): any;
|
|
8
|
-
export declare function useFastboardValue<T>(val: FastboardReadable<T>): any;
|
|
9
|
-
export declare function useWritable(): any;
|
|
10
|
-
export declare function useBoxState(): any;
|
|
11
|
-
export declare function useFocusedApp(): any;
|
|
12
|
-
export declare function useMaximized(): boolean;
|
|
13
|
-
export declare function useHideControls(): boolean | "toolbar-only";
|
package/dist/i18n/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { i18n } from "i18next";
|
|
3
|
-
import type { Language } from "../typings";
|
|
4
|
-
export interface CreateI18nParams {
|
|
5
|
-
language?: Language;
|
|
6
|
-
}
|
|
7
|
-
export declare const createI18n: ({ language, }?: CreateI18nParams) => Promise<i18n>;
|
|
8
|
-
export declare const I18nContext: import("react").Context<i18n | null>;
|
|
9
|
-
export declare function useTranslation(): {
|
|
10
|
-
t: import("i18next").TFunction | ((id: string) => string);
|
|
11
|
-
i18n: i18n | null;
|
|
12
|
-
};
|
package/dist/icons/FilePlus.d.ts
DELETED
package/dist/icons/Minus.d.ts
DELETED
package/dist/icons/Plus.d.ts
DELETED
package/dist/icons/Redo.d.ts
DELETED
package/dist/icons/Reset.d.ts
DELETED
package/dist/icons/Undo.d.ts
DELETED
package/dist/icons/index.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "./behaviors/style";
|
|
2
|
-
export * from "./typings";
|
|
3
|
-
export * from "./components/hooks";
|
|
4
|
-
export * from "./components/RedoUndo";
|
|
5
|
-
export * from "./components/ZoomControl";
|
|
6
|
-
export * from "./components/PageControl";
|
|
7
|
-
export * from "./components/Toolbar";
|
|
8
|
-
export * from "./components/PlayerControl";
|
|
9
|
-
export * from "./components/Fastboard";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare function noop(): void;
|
|
2
|
-
export declare function applyStyles(css: string): HTMLStyleElement;
|
|
3
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
4
|
-
export declare function isEqualArray<T>(a: T[], b: T[]): boolean;
|
|
5
|
-
export declare const defaultHotKeys: {
|
|
6
|
-
changeToSelector: string;
|
|
7
|
-
changeToLaserPointer: string;
|
|
8
|
-
changeToPencil: string;
|
|
9
|
-
changeToRectangle: string;
|
|
10
|
-
changeToEllipse: string;
|
|
11
|
-
changeToEraser: string;
|
|
12
|
-
changeToText: string;
|
|
13
|
-
changeToStraight: string;
|
|
14
|
-
changeToArrow: string;
|
|
15
|
-
changeToHand: string;
|
|
16
|
-
};
|
package/dist/internal/hooks.d.ts
DELETED
package/dist/internal/index.d.ts
DELETED
package/dist/theme.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IconProps } from "./typings";
|
|
2
|
-
export interface ThemeConfig {
|
|
3
|
-
color: string;
|
|
4
|
-
activeColor: string;
|
|
5
|
-
backgroundColor: string;
|
|
6
|
-
hoverBackgroundColor: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const light: ThemeConfig;
|
|
9
|
-
export declare const dark: ThemeConfig;
|
|
10
|
-
export declare const themes: {
|
|
11
|
-
light: ThemeConfig;
|
|
12
|
-
dark: ThemeConfig;
|
|
13
|
-
};
|
|
14
|
-
export declare const getStroke: (props: IconProps) => string;
|
|
15
|
-
export declare const TopOffset: [number, number];
|
|
16
|
-
export declare const RightOffset: [number, number];
|
package/dist/typings.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare type Theme = "light" | "dark";
|
|
2
|
-
export declare type Language = "en" | "zh-CN";
|
|
3
|
-
export interface IconProps {
|
|
4
|
-
theme?: Theme;
|
|
5
|
-
active?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface CommonProps {
|
|
8
|
-
theme?: Theme;
|
|
9
|
-
}
|
|
10
|
-
export declare type GenericIcon<K extends string, E extends string = "disable"> = Partial<Record<`${K}Icon${Capitalize<E | "">}`, string>>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
-
import ReactDOM from "react-dom";
|
|
3
|
-
|
|
4
|
-
interface MaskProps {
|
|
5
|
-
toolbar: HTMLDivElement | null;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Mask = React.memo(({ toolbar, children }: MaskProps) => {
|
|
10
|
-
const [rootElement] = useState<HTMLDivElement | null>(() => {
|
|
11
|
-
const element = document.createElement("div");
|
|
12
|
-
element.style.position = "absolute";
|
|
13
|
-
return element;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (toolbar && rootElement) {
|
|
18
|
-
toolbar.appendChild(rootElement);
|
|
19
|
-
}
|
|
20
|
-
}, [rootElement, toolbar]);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (rootElement && toolbar) {
|
|
24
|
-
toolbar.appendChild(rootElement);
|
|
25
|
-
|
|
26
|
-
const toolbarRect = toolbar.getBoundingClientRect();
|
|
27
|
-
const halfHeight = toolbarRect.height / 2 - 31;
|
|
28
|
-
rootElement.style.top = halfHeight + "px";
|
|
29
|
-
rootElement.style.left = "41px";
|
|
30
|
-
rootElement.style.width = "17px";
|
|
31
|
-
rootElement.style.height = "62px";
|
|
32
|
-
|
|
33
|
-
return () => {
|
|
34
|
-
toolbar.removeChild(rootElement);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}, [rootElement, toolbar]);
|
|
38
|
-
|
|
39
|
-
if (rootElement) {
|
|
40
|
-
return ReactDOM.createPortal(children, rootElement);
|
|
41
|
-
} else {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
});
|