southpaw 0.2.7
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/README.md +51 -0
- package/api/client.ts +83 -0
- package/api/helpers/fs.ts +98 -0
- package/api/helpers/stream.ts +6 -0
- package/api/index.ts +50 -0
- package/api/server.ts +566 -0
- package/constants/fonts.ts +1583 -0
- package/constants/icons.ts +2124 -0
- package/constants/langs.ts +2592 -0
- package/constants/ssr-loading.tsx +17 -0
- package/contexts/dev.tsx +124 -0
- package/hooks/useDebounceCb.ts +21 -0
- package/modules/app.tsx +102 -0
- package/modules/behaviors.ts +161 -0
- package/modules/component.tsx +483 -0
- package/modules/config/index.ts +8 -0
- package/modules/database.ts +25 -0
- package/modules/document.tsx +23 -0
- package/modules/error.tsx +16 -0
- package/modules/page/autozoom.tsx +92 -0
- package/modules/page/browser.tsx +166 -0
- package/modules/page/index.tsx +327 -0
- package/modules/page/insert-modal.tsx +225 -0
- package/modules/page/inspect/index.tsx +237 -0
- package/modules/page/inspect/wrapper.tsx +88 -0
- package/modules/page/knobs/action.tsx +58 -0
- package/modules/page/knobs/color.tsx +78 -0
- package/modules/page/knobs/helpers.ts +71 -0
- package/modules/page/knobs/icon.tsx +85 -0
- package/modules/page/knobs/linker.tsx +188 -0
- package/modules/page/knobs/list-json.tsx +149 -0
- package/modules/page/knobs/list-text.tsx +129 -0
- package/modules/page/knobs/number.tsx +84 -0
- package/modules/page/knobs/segmented.tsx +81 -0
- package/modules/page/knobs/select.tsx +89 -0
- package/modules/page/knobs/size.tsx +106 -0
- package/modules/page/knobs/switch.tsx +75 -0
- package/modules/page/knobs/text.tsx +93 -0
- package/modules/page/left-tabs.tsx +36 -0
- package/modules/page/right-tabs.tsx +31 -0
- package/modules/page/seo.tsx +69 -0
- package/modules/page/tree.tsx +860 -0
- package/modules/state.ts +787 -0
- package/modules/store.ts +37 -0
- package/modules/theme.ts +105 -0
- package/modules/translations.ts +15 -0
- package/package.json +68 -0
- package/scripts/bin.js +607 -0
- package/scripts/test.js +145 -0
- package/themes/base.tsx +8962 -0
- package/themes/index.ts +4 -0
- package/themes/m2.ts +39 -0
- package/themes/newspaper.ts +39 -0
- package/types/api.ts +57 -0
- package/types/fiber_node.ts +69 -0
- package/types/react_element.ts +14 -0
- package/ui/accordion.tsx +70 -0
- package/ui/actionicon.tsx +41 -0
- package/ui/affix.tsx +14 -0
- package/ui/alert.tsx +37 -0
- package/ui/anchor.tsx +52 -0
- package/ui/arrow.tsx +116 -0
- package/ui/aspectratio.tsx +21 -0
- package/ui/autocomplete.tsx +34 -0
- package/ui/avatar.tsx +36 -0
- package/ui/backgroundimage.tsx +16 -0
- package/ui/badge.tsx +28 -0
- package/ui/blockquote.tsx +15 -0
- package/ui/blocks/faq.tsx +145 -0
- package/ui/blocks/features.tsx +167 -0
- package/ui/blocks/footer.tsx +182 -0
- package/ui/blocks/herobanner.tsx +391 -0
- package/ui/blocks/index.ts +44 -0
- package/ui/blocks/leftnav.tsx +141 -0
- package/ui/blocks/pricing.tsx +210 -0
- package/ui/blocks/testimonials.tsx +149 -0
- package/ui/blocks/uidocs.tsx +1429 -0
- package/ui/box.tsx +27 -0
- package/ui/breadcrumbs.tsx +33 -0
- package/ui/burger.tsx +23 -0
- package/ui/button.tsx +85 -0
- package/ui/card.tsx +28 -0
- package/ui/center.tsx +26 -0
- package/ui/checkbox.tsx +35 -0
- package/ui/chip.tsx +32 -0
- package/ui/closebutton.tsx +15 -0
- package/ui/code.tsx +104 -0
- package/ui/collapse.tsx +16 -0
- package/ui/colorinput.tsx +32 -0
- package/ui/colorpicker.tsx +26 -0
- package/ui/colorswatch.tsx +17 -0
- package/ui/combobox.tsx +80 -0
- package/ui/container.tsx +27 -0
- package/ui/dialog.tsx +15 -0
- package/ui/divider.tsx +58 -0
- package/ui/drawer.tsx +28 -0
- package/ui/fieldset.tsx +15 -0
- package/ui/filebutton.tsx +23 -0
- package/ui/fileinput.tsx +36 -0
- package/ui/flex.tsx +139 -0
- package/ui/focustrap.tsx +15 -0
- package/ui/form.tsx +26 -0
- package/ui/grid.tsx +69 -0
- package/ui/highlight.tsx +15 -0
- package/ui/hoverable.tsx +66 -0
- package/ui/hovercard.tsx +45 -0
- package/ui/icon.tsx +76 -0
- package/ui/image.tsx +32 -0
- package/ui/index.ts +1355 -0
- package/ui/indicator.tsx +42 -0
- package/ui/infobox.tsx +200 -0
- package/ui/input.tsx +18 -0
- package/ui/inviewport.tsx +23 -0
- package/ui/jsoninput.tsx +35 -0
- package/ui/kbd.tsx +20 -0
- package/ui/list.tsx +33 -0
- package/ui/loader.tsx +26 -0
- package/ui/loadingoverlay.tsx +22 -0
- package/ui/mark.tsx +15 -0
- package/ui/menu.tsx +89 -0
- package/ui/modal.tsx +27 -0
- package/ui/multiselect.tsx +42 -0
- package/ui/nativeselect.tsx +17 -0
- package/ui/navlink.tsx +40 -0
- package/ui/notification.tsx +25 -0
- package/ui/numberformatter.tsx +15 -0
- package/ui/numberinput.tsx +37 -0
- package/ui/overlay.tsx +15 -0
- package/ui/pagination.tsx +21 -0
- package/ui/paper.tsx +33 -0
- package/ui/passwordinput.tsx +36 -0
- package/ui/pill.tsx +17 -0
- package/ui/pillsinput.tsx +37 -0
- package/ui/pininput.tsx +30 -0
- package/ui/popover.tsx +43 -0
- package/ui/portal.tsx +15 -0
- package/ui/progress.tsx +49 -0
- package/ui/props.ts +91 -0
- package/ui/propsDef.ts +38 -0
- package/ui/radio.tsx +30 -0
- package/ui/rating.tsx +25 -0
- package/ui/ringprogress.tsx +17 -0
- package/ui/scrollarea.tsx +27 -0
- package/ui/segmentedcontrol.tsx +38 -0
- package/ui/select.tsx +43 -0
- package/ui/simplegrid.tsx +23 -0
- package/ui/skeleton.tsx +15 -0
- package/ui/slider.tsx +31 -0
- package/ui/space.tsx +19 -0
- package/ui/spoiler.tsx +23 -0
- package/ui/stepper.tsx +63 -0
- package/ui/switch.tsx +29 -0
- package/ui/table.tsx +93 -0
- package/ui/tabs.tsx +80 -0
- package/ui/tagsinput.tsx +19 -0
- package/ui/terminal.tsx +44 -0
- package/ui/text.tsx +168 -0
- package/ui/textarea.tsx +36 -0
- package/ui/textinput.tsx +34 -0
- package/ui/timeline.tsx +30 -0
- package/ui/title.tsx +42 -0
- package/ui/tooltip.tsx +32 -0
- package/ui/transition.tsx +21 -0
- package/ui/tree.tsx +42 -0
- package/ui/typographystylesprovider.tsx +20 -0
- package/ui/unstyledbutton.tsx +18 -0
- package/ui/video.tsx +16 -0
- package/ui/visuallyhidden.tsx +15 -0
- package/utils/index.ts +76 -0
package/themes/index.ts
ADDED
package/themes/m2.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { create_theme } from "../modules/theme";
|
|
2
|
+
|
|
3
|
+
const fontFamily = "Roboto";
|
|
4
|
+
const theme = create_theme({
|
|
5
|
+
fontFamily,
|
|
6
|
+
fontFamilyMonospace: "Roboto Mono",
|
|
7
|
+
|
|
8
|
+
colors: {
|
|
9
|
+
primary: "#6200ee",
|
|
10
|
+
secondary: "#03dac6",
|
|
11
|
+
red: "#f44336",
|
|
12
|
+
green: "#4caf50",
|
|
13
|
+
yellow: "#ff9800",
|
|
14
|
+
blue: "#2196f3",
|
|
15
|
+
gray: "#9e9e9e",
|
|
16
|
+
dark: "#212121",
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
primaryColor: "primary",
|
|
20
|
+
primaryShade: 5,
|
|
21
|
+
|
|
22
|
+
defaultRadius: 4,
|
|
23
|
+
|
|
24
|
+
headings: {
|
|
25
|
+
fontFamily,
|
|
26
|
+
fontWeight: "400",
|
|
27
|
+
textWrap: "nowrap",
|
|
28
|
+
sizes: {
|
|
29
|
+
h1: { fontSize: "96px", lineHeight: "auto", fontWeight: "300" }, // Headline 1
|
|
30
|
+
h2: { fontSize: "60px", lineHeight: "auto", fontWeight: "300" }, // Headline 2
|
|
31
|
+
h3: { fontSize: "48px", lineHeight: "auto", fontWeight: "400" }, // Headline 3
|
|
32
|
+
h4: { fontSize: "34px", lineHeight: "auto", fontWeight: "400" }, // Headline 4
|
|
33
|
+
h5: { fontSize: "24px", lineHeight: "auto", fontWeight: "400" }, // Headline 5
|
|
34
|
+
h6: { fontSize: "20px", lineHeight: "auto", fontWeight: "500" }, // Headline 6
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default theme;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { create_theme } from "../modules/theme";
|
|
2
|
+
|
|
3
|
+
const theme = create_theme({
|
|
4
|
+
fontFamily: "Space Grotesk",
|
|
5
|
+
fontFamilyMonospace: "Source Code Pro",
|
|
6
|
+
primaryColor: "red",
|
|
7
|
+
defaultRadius: "md",
|
|
8
|
+
radius: {
|
|
9
|
+
xs: "0px",
|
|
10
|
+
sm: "0px",
|
|
11
|
+
md: "0px",
|
|
12
|
+
lg: "0px",
|
|
13
|
+
xl: "0px",
|
|
14
|
+
},
|
|
15
|
+
fontSizes: {
|
|
16
|
+
xs: "12px",
|
|
17
|
+
sm: "16px",
|
|
18
|
+
md: "18px",
|
|
19
|
+
lg: "20px",
|
|
20
|
+
xl: "22px",
|
|
21
|
+
},
|
|
22
|
+
colors: {
|
|
23
|
+
red: "#ff5722",
|
|
24
|
+
dark: "#3f3634",
|
|
25
|
+
gray: "#777c91",
|
|
26
|
+
},
|
|
27
|
+
components: {
|
|
28
|
+
Badge: {
|
|
29
|
+
styles: () => ({
|
|
30
|
+
root: {
|
|
31
|
+
borderRadius: 0,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
white: "#f6f5ee",
|
|
37
|
+
black: "#252423",
|
|
38
|
+
});
|
|
39
|
+
export default theme;
|
package/types/api.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PageSeoType } from "../modules/page";
|
|
2
|
+
import { FiberNodeType } from "./fiber_node";
|
|
3
|
+
|
|
4
|
+
type ApiResultType<T extends Record<string, unknown>> = {
|
|
5
|
+
type: "error" | "success" | "warning" | "info";
|
|
6
|
+
payload: T;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
export type ApiType = {
|
|
10
|
+
application: {};
|
|
11
|
+
page: {
|
|
12
|
+
writeSEO: (args: {
|
|
13
|
+
seo: PageSeoType;
|
|
14
|
+
source: FiberNodeType["_debugSource"];
|
|
15
|
+
}) => Promise<ApiResultType<{}>>;
|
|
16
|
+
insertNode: (args: {
|
|
17
|
+
code: string;
|
|
18
|
+
insertMode: "within" | "before" | "after";
|
|
19
|
+
source: FiberNodeType["_debugSource"];
|
|
20
|
+
}) => Promise<ApiResultType<{}>>;
|
|
21
|
+
duplicateNode: (args: {
|
|
22
|
+
source: FiberNodeType["_debugSource"];
|
|
23
|
+
}) => Promise<ApiResultType<{}>>;
|
|
24
|
+
deleteNode: (args: {
|
|
25
|
+
source: FiberNodeType["_debugSource"];
|
|
26
|
+
}) => Promise<ApiResultType<{}>>;
|
|
27
|
+
moveUpNode: (args: {
|
|
28
|
+
source: FiberNodeType["_debugSource"];
|
|
29
|
+
}) => Promise<ApiResultType<{}>>;
|
|
30
|
+
moveDownNode: (args: {
|
|
31
|
+
source: FiberNodeType["_debugSource"];
|
|
32
|
+
}) => Promise<ApiResultType<{}>>;
|
|
33
|
+
moveNode: (args: {
|
|
34
|
+
source: FiberNodeType["_debugSource"];
|
|
35
|
+
target: FiberNodeType["_debugSource"];
|
|
36
|
+
position: "before" | "after" | "within";
|
|
37
|
+
}) => Promise<ApiResultType<{}>>;
|
|
38
|
+
setPropNode: (args: {
|
|
39
|
+
source: FiberNodeType["_debugSource"];
|
|
40
|
+
attrs: { name: string; newValue: string | undefined }[];
|
|
41
|
+
}) => Promise<ApiResultType<{}>>;
|
|
42
|
+
getRawPropsNode: (args: {
|
|
43
|
+
source: FiberNodeType["_debugSource"];
|
|
44
|
+
}) => Promise<
|
|
45
|
+
ApiResultType<{
|
|
46
|
+
rawProps: Record<string, string>;
|
|
47
|
+
}>
|
|
48
|
+
>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type StreamCallback = (
|
|
52
|
+
cb: (chunk: string, controller: StreamIterator) => void,
|
|
53
|
+
) => void;
|
|
54
|
+
|
|
55
|
+
export interface StreamIterator extends ReadableStream {
|
|
56
|
+
[Symbol.asyncIterator](): AsyncGenerator<Awaited<any>, void, unknown>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type FiberNodeType = {
|
|
2
|
+
tag: number;
|
|
3
|
+
key: unknown;
|
|
4
|
+
elementType: keyof HTMLElementTagNameMap;
|
|
5
|
+
type: string;
|
|
6
|
+
stateNode: HTMLElement & {
|
|
7
|
+
props: unknown;
|
|
8
|
+
};
|
|
9
|
+
return: unknown;
|
|
10
|
+
child: FiberNodeType;
|
|
11
|
+
sibling: unknown;
|
|
12
|
+
index: number;
|
|
13
|
+
ref: unknown;
|
|
14
|
+
pendingProps: unknown;
|
|
15
|
+
memoizedProps: unknown;
|
|
16
|
+
updateQueue: unknown;
|
|
17
|
+
memoizedState: unknown;
|
|
18
|
+
dependencies: unknown;
|
|
19
|
+
mode: unknown;
|
|
20
|
+
flags: unknown;
|
|
21
|
+
subtreeFlags: unknown;
|
|
22
|
+
deletions: unknown;
|
|
23
|
+
lanes: unknown;
|
|
24
|
+
childLanes: unknown;
|
|
25
|
+
alternate: FiberNodeType;
|
|
26
|
+
actualDuration: number;
|
|
27
|
+
actualStartTime: number;
|
|
28
|
+
selfBaseDuration: number;
|
|
29
|
+
treeBaseDuration: number;
|
|
30
|
+
_debugSource: {
|
|
31
|
+
fileName: string;
|
|
32
|
+
lineNumber: number;
|
|
33
|
+
columnNumber: number;
|
|
34
|
+
};
|
|
35
|
+
_debugOwner: FiberNodeType;
|
|
36
|
+
_debugNeedsRemount: boolean;
|
|
37
|
+
_debugHookTypes: unknown;
|
|
38
|
+
};
|
|
39
|
+
export type FiberRootNodeType = {
|
|
40
|
+
tag: number;
|
|
41
|
+
containerInfo: HTMLElement;
|
|
42
|
+
pendingChildren: null | Array<unknown>;
|
|
43
|
+
current: FiberNodeType;
|
|
44
|
+
pingCache: null;
|
|
45
|
+
finishedWork: null;
|
|
46
|
+
timeoutHandle: number;
|
|
47
|
+
context: Record<string, unknown>;
|
|
48
|
+
pendingContext: null | Record<string, unknown>;
|
|
49
|
+
callbackNode: null;
|
|
50
|
+
callbackPriority: number;
|
|
51
|
+
eventTimes: number[];
|
|
52
|
+
expirationTimes: number[];
|
|
53
|
+
pendingLanes: number;
|
|
54
|
+
suspendedLanes: number;
|
|
55
|
+
pingedLanes: number;
|
|
56
|
+
expiredLanes: number;
|
|
57
|
+
mutableReadLanes: number;
|
|
58
|
+
finishedLanes: unknown;
|
|
59
|
+
entangledLanes: unknown;
|
|
60
|
+
entanglements: number[];
|
|
61
|
+
identifierPrefix: string;
|
|
62
|
+
onRecoverableError: unknown;
|
|
63
|
+
mutableSourceEagerHydrationData: unknown;
|
|
64
|
+
effectDuration: unknown;
|
|
65
|
+
passiveEffectDuration: unknown;
|
|
66
|
+
memoizedUpdaters: unknown;
|
|
67
|
+
pendingUpdatersLaneMap: Set<number>[];
|
|
68
|
+
_debugRootType: "hydrateRoot()";
|
|
69
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefObject, ReactElement } from "react";
|
|
2
|
+
import { FiberNodeType } from "./fiber_node";
|
|
3
|
+
|
|
4
|
+
export type ReactElementType = ReactElement & {
|
|
5
|
+
$$typeof: symbol;
|
|
6
|
+
ref: null | RefObject<unknown>;
|
|
7
|
+
_owner: FiberNodeType;
|
|
8
|
+
_store: {
|
|
9
|
+
validated: boolean;
|
|
10
|
+
};
|
|
11
|
+
_self: unknown;
|
|
12
|
+
type: {};
|
|
13
|
+
_source: FiberNodeType["_debugSource"];
|
|
14
|
+
};
|
package/ui/accordion.tsx
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Accordion, AccordionProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
export type Props = Omit<AccordionProps, "children"> & {
|
|
6
|
+
items: {
|
|
7
|
+
id: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
const Component = create_component({
|
|
14
|
+
name: "Accordion",
|
|
15
|
+
description: "Divide content into collapsible sections",
|
|
16
|
+
props: {
|
|
17
|
+
component: "div",
|
|
18
|
+
variant: "contained",
|
|
19
|
+
items: [
|
|
20
|
+
{
|
|
21
|
+
label: "Accordion 1",
|
|
22
|
+
id: "1",
|
|
23
|
+
content: "Accordion 1 content",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Accordion 2",
|
|
27
|
+
id: "2",
|
|
28
|
+
content: "Accordion 2 content",
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
} as Props,
|
|
32
|
+
propsDef: {
|
|
33
|
+
component: {
|
|
34
|
+
type: "text",
|
|
35
|
+
label: "Root component",
|
|
36
|
+
},
|
|
37
|
+
variant: {
|
|
38
|
+
type: "select",
|
|
39
|
+
label: "Variant style",
|
|
40
|
+
options: [
|
|
41
|
+
{ value: "default", label: "Default" },
|
|
42
|
+
{ value: "contained", label: "Contained" },
|
|
43
|
+
{ value: "filled", label: "Filled" },
|
|
44
|
+
{ value: "separated", label: "Separated" },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
items: {
|
|
48
|
+
type: "list-text",
|
|
49
|
+
label: "Accordion items",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
render() {
|
|
53
|
+
const { items, ...other } = this.props;
|
|
54
|
+
return (
|
|
55
|
+
<Accordion {...other}>
|
|
56
|
+
{items!.map((item) => {
|
|
57
|
+
return (
|
|
58
|
+
<Accordion.Item key={item.id} value={item.id}>
|
|
59
|
+
<Accordion.Control icon={item.icon}>
|
|
60
|
+
{item.label}
|
|
61
|
+
</Accordion.Control>
|
|
62
|
+
<Accordion.Panel>{item.content}</Accordion.Panel>
|
|
63
|
+
</Accordion.Item>
|
|
64
|
+
);
|
|
65
|
+
})}
|
|
66
|
+
</Accordion>
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
export default Component;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ActionIcon, ActionIconProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { PolymorphicComponentProps } from "./props";
|
|
4
|
+
import { spacingPropsDef } from "./propsDef";
|
|
5
|
+
import Icon from "./icon";
|
|
6
|
+
|
|
7
|
+
type Props = PolymorphicComponentProps<"button", ActionIconProps>;
|
|
8
|
+
const Component = create_component({
|
|
9
|
+
name: "ActionIcon",
|
|
10
|
+
description: "The actionicon UI element",
|
|
11
|
+
props: {
|
|
12
|
+
variant: "filled",
|
|
13
|
+
children: <Icon icon="add" />,
|
|
14
|
+
} as Props,
|
|
15
|
+
propsDef: {
|
|
16
|
+
variant: {
|
|
17
|
+
type: "select",
|
|
18
|
+
options: [
|
|
19
|
+
"filled",
|
|
20
|
+
"light",
|
|
21
|
+
"outline",
|
|
22
|
+
"transparent",
|
|
23
|
+
"white",
|
|
24
|
+
"subtle",
|
|
25
|
+
"default",
|
|
26
|
+
],
|
|
27
|
+
label: "Variant",
|
|
28
|
+
},
|
|
29
|
+
color: { type: "color", label: "Color" },
|
|
30
|
+
size: { type: "size", label: "Size" },
|
|
31
|
+
radius: { type: "size", label: "Radius" },
|
|
32
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
33
|
+
loading: { type: "switch", label: "Loading" },
|
|
34
|
+
...spacingPropsDef,
|
|
35
|
+
},
|
|
36
|
+
render() {
|
|
37
|
+
const { children, ...other } = this.props;
|
|
38
|
+
return <ActionIcon {...other}>{children}</ActionIcon>;
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
export default Component;
|
package/ui/affix.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Affix, AffixProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = AffixProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Affix",
|
|
7
|
+
description: "The affix UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
const { children, ...other } = this.props;
|
|
11
|
+
return <Affix {...other}>{children}</Affix>;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export default Component;
|
package/ui/alert.tsx
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Alert, AlertProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = AlertProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Alert",
|
|
8
|
+
description: "The alert UI element",
|
|
9
|
+
props: {
|
|
10
|
+
title: "The alert title",
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
title: { type: "text", label: "Title" },
|
|
14
|
+
variant: {
|
|
15
|
+
type: "select",
|
|
16
|
+
options: [
|
|
17
|
+
"filled",
|
|
18
|
+
"outline",
|
|
19
|
+
"light",
|
|
20
|
+
"transparent",
|
|
21
|
+
"white",
|
|
22
|
+
"default",
|
|
23
|
+
],
|
|
24
|
+
label: "Variant",
|
|
25
|
+
},
|
|
26
|
+
withCloseButton: { type: "switch", label: "Close Button" },
|
|
27
|
+
radius: { type: "size", label: "Radius" },
|
|
28
|
+
...spacingPropsDef,
|
|
29
|
+
...colorPropsDef,
|
|
30
|
+
},
|
|
31
|
+
render() {
|
|
32
|
+
const { children, ...other } = this.props;
|
|
33
|
+
return <Alert {...other}>{children}</Alert>;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default Component;
|
package/ui/anchor.tsx
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Anchor, AnchorProps, Text } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import { AnchorHTMLAttributes, PropsWithChildren } from "react";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
|
|
7
|
+
type Props = PropsWithChildren<AnchorProps> & {
|
|
8
|
+
href: string;
|
|
9
|
+
prefetch?: boolean;
|
|
10
|
+
target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
|
|
11
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
12
|
+
};
|
|
13
|
+
const Component = create_component({
|
|
14
|
+
name: "Anchor",
|
|
15
|
+
description: "The anchor UI element",
|
|
16
|
+
props: { href: "#", children: <Text>Label here</Text> } as Props,
|
|
17
|
+
propsDef: {
|
|
18
|
+
href: { type: "text", label: "Href" },
|
|
19
|
+
target: { type: "text", label: "Target" },
|
|
20
|
+
underline: {
|
|
21
|
+
type: "select",
|
|
22
|
+
options: ["hover", "always", "never"],
|
|
23
|
+
label: "Underline",
|
|
24
|
+
},
|
|
25
|
+
c: { type: "color", label: "Color" },
|
|
26
|
+
...spacingPropsDef,
|
|
27
|
+
},
|
|
28
|
+
render() {
|
|
29
|
+
delete this.props["mount_animation"];
|
|
30
|
+
const { children, prefetch, href, ...other } = this.props;
|
|
31
|
+
const isActive = href === this.router.asPath;
|
|
32
|
+
return (
|
|
33
|
+
<Anchor
|
|
34
|
+
component={Link}
|
|
35
|
+
href={href}
|
|
36
|
+
scroll={false}
|
|
37
|
+
prefetch={prefetch}
|
|
38
|
+
shallow
|
|
39
|
+
passHref
|
|
40
|
+
c={
|
|
41
|
+
isActive
|
|
42
|
+
? "var(--mantine-primary-color-filled)"
|
|
43
|
+
: "var(--mantine-color-text)"
|
|
44
|
+
}
|
|
45
|
+
{...other}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</Anchor>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export default Component;
|
package/ui/arrow.tsx
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { create_component } from "../modules/component";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
fromId: string;
|
|
5
|
+
toId: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
};
|
|
10
|
+
const Component = create_component({
|
|
11
|
+
name: "Arrow",
|
|
12
|
+
description: "The arrow UI element",
|
|
13
|
+
props: {
|
|
14
|
+
color: "black",
|
|
15
|
+
strokeWidth: 2,
|
|
16
|
+
text: "Arrow element",
|
|
17
|
+
} as Props,
|
|
18
|
+
state: {
|
|
19
|
+
points: null as { x1: number; y1: number; x2: number; y2: number } | null,
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
updatePosition() {
|
|
23
|
+
const fromEl = document.getElementById(this.props.fromId);
|
|
24
|
+
const toEl = document.getElementById(this.props.toId);
|
|
25
|
+
if (!fromEl || !toEl) return;
|
|
26
|
+
const fromRect = fromEl.getBoundingClientRect();
|
|
27
|
+
const toRect = toEl.getBoundingClientRect();
|
|
28
|
+
this.state.points = {
|
|
29
|
+
x1: fromRect.left + fromRect.width,
|
|
30
|
+
y1: fromRect.top + fromRect.height,
|
|
31
|
+
x2: toRect.left + toRect.width,
|
|
32
|
+
y2: toRect.top,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
lifecycle: {
|
|
37
|
+
onMount() {
|
|
38
|
+
window.addEventListener("resize", this.methods.updatePosition);
|
|
39
|
+
window.addEventListener("scroll", this.methods.updatePosition);
|
|
40
|
+
},
|
|
41
|
+
onRender() {
|
|
42
|
+
this.methods.updatePosition();
|
|
43
|
+
},
|
|
44
|
+
onUnmount() {
|
|
45
|
+
window.removeEventListener("resize", this.methods.updatePosition);
|
|
46
|
+
window.removeEventListener("scroll", this.methods.updatePosition);
|
|
47
|
+
},
|
|
48
|
+
// onRender() {
|
|
49
|
+
// this.methods.updatePosition();
|
|
50
|
+
// },
|
|
51
|
+
onPropChange(propName, previousProp, currentProp) {
|
|
52
|
+
if (["fromId", "toId"].includes(propName) && currentProp) {
|
|
53
|
+
this.methods.updatePosition();
|
|
54
|
+
this.methods.updatePosition();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
render() {
|
|
59
|
+
const { points } = this.state;
|
|
60
|
+
const { color, strokeWidth, text } = this.props;
|
|
61
|
+
|
|
62
|
+
if (!points) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return (
|
|
66
|
+
<svg
|
|
67
|
+
style={{
|
|
68
|
+
position: "fixed",
|
|
69
|
+
top: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
width: "100%",
|
|
72
|
+
height: "100%",
|
|
73
|
+
pointerEvents: "none",
|
|
74
|
+
zIndex: 9999,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<defs>
|
|
78
|
+
<marker
|
|
79
|
+
id="arrowhead"
|
|
80
|
+
markerWidth="10"
|
|
81
|
+
markerHeight="7"
|
|
82
|
+
refX="10"
|
|
83
|
+
refY="3.5"
|
|
84
|
+
orient="auto"
|
|
85
|
+
>
|
|
86
|
+
<polygon points="0 0, 10 3.5, 0 7" fill={color} />
|
|
87
|
+
</marker>
|
|
88
|
+
</defs>
|
|
89
|
+
<line
|
|
90
|
+
x1={points.x1}
|
|
91
|
+
y1={points.y1}
|
|
92
|
+
x2={points.x2}
|
|
93
|
+
y2={points.y2}
|
|
94
|
+
stroke={color}
|
|
95
|
+
strokeWidth={strokeWidth}
|
|
96
|
+
strokeDasharray={3}
|
|
97
|
+
markerEnd="url(#arrowhead)"
|
|
98
|
+
/>
|
|
99
|
+
{text && (
|
|
100
|
+
<text
|
|
101
|
+
x={(points.x1 + points.x2) / 2}
|
|
102
|
+
y={(points.y1 + points.y2) / 2}
|
|
103
|
+
fill={color}
|
|
104
|
+
fontSize="14"
|
|
105
|
+
textAnchor="middle"
|
|
106
|
+
dominantBaseline="central"
|
|
107
|
+
style={{ userSelect: "none" }}
|
|
108
|
+
>
|
|
109
|
+
{text}
|
|
110
|
+
</text>
|
|
111
|
+
)}
|
|
112
|
+
</svg>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
export default Component;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AspectRatio, AspectRatioProps, Paper } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = AspectRatioProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "AspectRatio",
|
|
7
|
+
description: "The aspectratio UI element",
|
|
8
|
+
props: {
|
|
9
|
+
children: (
|
|
10
|
+
<Paper m="sm" p="xs" withBorder opacity={0.5}>
|
|
11
|
+
Add aspectratio children here
|
|
12
|
+
</Paper>
|
|
13
|
+
),
|
|
14
|
+
} as Props,
|
|
15
|
+
render() {
|
|
16
|
+
delete this.props["mount_animation"];
|
|
17
|
+
const { children, ...other } = this.props;
|
|
18
|
+
return <AspectRatio {...other}>{children}</AspectRatio>;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export default Component;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Autocomplete, AutocompleteProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { PolymorphicComponentProps } from "./props";
|
|
4
|
+
import { spacingPropsDef } from "./propsDef";
|
|
5
|
+
|
|
6
|
+
type Props = PolymorphicComponentProps<"autocomplete", AutocompleteProps>;
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "Autocomplete",
|
|
9
|
+
description: "The autocomplete UI element",
|
|
10
|
+
props: {
|
|
11
|
+
placeholder: "Autocomplete...",
|
|
12
|
+
} as Props,
|
|
13
|
+
propsDef: {
|
|
14
|
+
placeholder: { type: "text", label: "Placeholder" },
|
|
15
|
+
label: { type: "text", label: "Label" },
|
|
16
|
+
description: { type: "text", label: "Description" },
|
|
17
|
+
error: { type: "text", label: "Error" },
|
|
18
|
+
disabled: { type: "switch", label: "Disabled" },
|
|
19
|
+
size: { type: "size", label: "Size" },
|
|
20
|
+
radius: { type: "size", label: "Radius" },
|
|
21
|
+
variant: {
|
|
22
|
+
type: "select",
|
|
23
|
+
options: ["default", "filled", "unstyled"],
|
|
24
|
+
label: "Variant",
|
|
25
|
+
},
|
|
26
|
+
...spacingPropsDef,
|
|
27
|
+
},
|
|
28
|
+
render() {
|
|
29
|
+
delete this.props["mount_animation"];
|
|
30
|
+
const { children, ...other } = this.props;
|
|
31
|
+
return <Autocomplete {...other} />
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export default Component;
|
package/ui/avatar.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Avatar, AvatarProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = AvatarProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Avatar",
|
|
8
|
+
description: "The avatar UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
src: { type: "text", label: "Source" },
|
|
12
|
+
alt: { type: "text", label: "Alt Text" },
|
|
13
|
+
size: { type: "size", label: "Size" },
|
|
14
|
+
color: { type: "color", label: "Color" },
|
|
15
|
+
radius: { type: "size", label: "Radius" },
|
|
16
|
+
variant: {
|
|
17
|
+
type: "select",
|
|
18
|
+
options: [
|
|
19
|
+
"filled",
|
|
20
|
+
"light",
|
|
21
|
+
"outline",
|
|
22
|
+
"transparent",
|
|
23
|
+
"white",
|
|
24
|
+
"default",
|
|
25
|
+
],
|
|
26
|
+
label: "Variant",
|
|
27
|
+
},
|
|
28
|
+
...spacingPropsDef,
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
delete this.props["mount_animation"];
|
|
32
|
+
const { children, ...other } = this.props;
|
|
33
|
+
return <Avatar {...other}>{children}</Avatar>;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export default Component;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BackgroundImage, BackgroundImageProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = PropsWithChildren<BackgroundImageProps>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "BackgroundImage",
|
|
8
|
+
description: "The backgroundimage UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
render() {
|
|
11
|
+
delete this.props["mount_animation"];
|
|
12
|
+
const { children, ...other } = this.props;
|
|
13
|
+
return <BackgroundImage {...other}>{children}</BackgroundImage>;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export default Component;
|