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/ui/timeline.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Timeline, TimelineProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = TimelineProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Timeline",
|
|
8
|
+
description: "The timeline UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
propsDef: {
|
|
11
|
+
active: { type: "number", label: "Active Item" },
|
|
12
|
+
color: { type: "color", label: "Color" },
|
|
13
|
+
radius: { type: "size", label: "Radius" },
|
|
14
|
+
bulletSize: { type: "number", label: "Bullet Size" },
|
|
15
|
+
lineWidth: { type: "number", label: "Line Width" },
|
|
16
|
+
reverseActive: { type: "switch", label: "Reverse Active" },
|
|
17
|
+
align: {
|
|
18
|
+
type: "select",
|
|
19
|
+
options: ["left", "right"],
|
|
20
|
+
label: "Align",
|
|
21
|
+
},
|
|
22
|
+
...spacingPropsDef,
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
delete this.props["mount_animation"];
|
|
26
|
+
const { children, ...other } = this.props;
|
|
27
|
+
return <Timeline {...other}>{children}</Timeline>;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export default Component;
|
package/ui/title.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Title, TitleProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { CommonProps } from "./props";
|
|
4
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
5
|
+
|
|
6
|
+
type Props = CommonProps &
|
|
7
|
+
Omit<TitleProps, "children"> & {
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
const Component = create_component({
|
|
11
|
+
name: "Title",
|
|
12
|
+
description: "The title UI element",
|
|
13
|
+
props: { text: "A title", order: 1 } as Props,
|
|
14
|
+
propsDef: {
|
|
15
|
+
text: {
|
|
16
|
+
label: "A title",
|
|
17
|
+
multiline: true,
|
|
18
|
+
type: "text",
|
|
19
|
+
},
|
|
20
|
+
order: {
|
|
21
|
+
type: "number",
|
|
22
|
+
label: "Order",
|
|
23
|
+
step: 1,
|
|
24
|
+
min: 1,
|
|
25
|
+
max: 6,
|
|
26
|
+
},
|
|
27
|
+
size: { type: "size", label: "Size" },
|
|
28
|
+
textWrap: {
|
|
29
|
+
type: "select",
|
|
30
|
+
options: ["wrap", "nowrap", "balance", "pretty"],
|
|
31
|
+
label: "Text Wrap",
|
|
32
|
+
},
|
|
33
|
+
...spacingPropsDef,
|
|
34
|
+
...colorPropsDef,
|
|
35
|
+
},
|
|
36
|
+
render() {
|
|
37
|
+
delete this.props["mount_animation"];
|
|
38
|
+
const { text, ...other } = this.props;
|
|
39
|
+
return <Title {...other}>{text}</Title>;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
export default Component;
|
package/ui/tooltip.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tooltip, TooltipProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef, colorPropsDef } from "./propsDef";
|
|
4
|
+
|
|
5
|
+
type Props = TooltipProps;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Tooltip",
|
|
8
|
+
description: "The tooltip UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: <div>Tooltip content</div>,
|
|
11
|
+
} as Props,
|
|
12
|
+
propsDef: {
|
|
13
|
+
label: { type: "text", label: "Label" },
|
|
14
|
+
opened: { type: "switch", label: "Opened" },
|
|
15
|
+
position: {
|
|
16
|
+
type: "select",
|
|
17
|
+
options: ["bottom", "top", "left", "right"],
|
|
18
|
+
label: "Position",
|
|
19
|
+
},
|
|
20
|
+
withArrow: { type: "switch", label: "With Arrow" },
|
|
21
|
+
openDelay: { type: "number", label: "Open Delay" },
|
|
22
|
+
closeDelay: { type: "number", label: "Close Delay" },
|
|
23
|
+
...spacingPropsDef,
|
|
24
|
+
...colorPropsDef,
|
|
25
|
+
},
|
|
26
|
+
render() {
|
|
27
|
+
delete this.props["mount_animation"];
|
|
28
|
+
const { children, ...other } = this.props;
|
|
29
|
+
return <Tooltip {...other}>{children}</Tooltip>;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default Component;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Transition, TransitionProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = TransitionProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "Transition",
|
|
7
|
+
description: "The transition UI element",
|
|
8
|
+
props: {
|
|
9
|
+
transition: "fade",
|
|
10
|
+
duration: 300,
|
|
11
|
+
timingFunction: "ease",
|
|
12
|
+
mounted: true,
|
|
13
|
+
children: (styles) => <div style={styles}>Transition child</div>,
|
|
14
|
+
} as Props,
|
|
15
|
+
render() {
|
|
16
|
+
delete this.props["mount_animation"];
|
|
17
|
+
const { children, ...other } = this.props;
|
|
18
|
+
return <Transition {...other}>{children}</Transition>;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export default Component;
|
package/ui/tree.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Group, Tree, TreeProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { spacingPropsDef } from "./propsDef";
|
|
4
|
+
import { IconChevronRight } from "@tabler/icons-react";
|
|
5
|
+
|
|
6
|
+
type Props = TreeProps;
|
|
7
|
+
const Component = create_component({
|
|
8
|
+
name: "Tree",
|
|
9
|
+
description: "The tree UI element",
|
|
10
|
+
props: {
|
|
11
|
+
renderNode: ({ node, expanded, hasChildren, elementProps }) => (
|
|
12
|
+
<Group gap={5} {...elementProps}>
|
|
13
|
+
{hasChildren && (
|
|
14
|
+
<IconChevronRight
|
|
15
|
+
size={18}
|
|
16
|
+
style={{ transform: expanded ? "rotate(180deg)" : "rotate(0deg)" }}
|
|
17
|
+
/>
|
|
18
|
+
)}
|
|
19
|
+
|
|
20
|
+
<span>{node.label}</span>
|
|
21
|
+
</Group>
|
|
22
|
+
),
|
|
23
|
+
data: [
|
|
24
|
+
{
|
|
25
|
+
value: "1",
|
|
26
|
+
label: "Tree parent",
|
|
27
|
+
children: [
|
|
28
|
+
{ value: "2", label: "Item 2" },
|
|
29
|
+
{ value: "3", label: "Item 3" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
} as Props,
|
|
34
|
+
propsDef: {
|
|
35
|
+
levelOffset: { type: "number", label: "Level Offset" },
|
|
36
|
+
...spacingPropsDef,
|
|
37
|
+
},
|
|
38
|
+
render() {
|
|
39
|
+
return <Tree {...this.props} />;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
export default Component;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TypographyStylesProvider,
|
|
3
|
+
TypographyStylesProviderProps,
|
|
4
|
+
} from "@mantine/core";
|
|
5
|
+
import { create_component } from "../modules/component";
|
|
6
|
+
|
|
7
|
+
type Props = TypographyStylesProviderProps;
|
|
8
|
+
const Component = create_component({
|
|
9
|
+
name: "TypographyStylesProvider",
|
|
10
|
+
description: "The typographystylesprovider UI element",
|
|
11
|
+
props: {} as Props,
|
|
12
|
+
render() {
|
|
13
|
+
delete this.props["mount_animation"];
|
|
14
|
+
const { children, ...other } = this.props;
|
|
15
|
+
return (
|
|
16
|
+
<TypographyStylesProvider {...other}>{children}</TypographyStylesProvider>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export default Component;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Text, UnstyledButton, UnstyledButtonProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = PropsWithChildren<UnstyledButtonProps>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "UnstyledButton",
|
|
8
|
+
description: "The unstyledbutton UI element",
|
|
9
|
+
props: {
|
|
10
|
+
children: <Text>Unstyled</Text>,
|
|
11
|
+
} as Props,
|
|
12
|
+
render() {
|
|
13
|
+
delete this.props["mount_animation"];
|
|
14
|
+
const { children, ...other } = this.props;
|
|
15
|
+
return <UnstyledButton {...other}>{children}</UnstyledButton>;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export default Component;
|
package/ui/video.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Box, BoxProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
import { VideoHTMLAttributes } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = BoxProps & VideoHTMLAttributes<HTMLVideoElement>;
|
|
6
|
+
const Component = create_component({
|
|
7
|
+
name: "Video",
|
|
8
|
+
description: "The video UI element",
|
|
9
|
+
props: {} as Props,
|
|
10
|
+
render() {
|
|
11
|
+
delete this.props["mount_animation"];
|
|
12
|
+
const { ...other } = this.props;
|
|
13
|
+
return <Box component="video" {...other} />;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export default Component;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VisuallyHidden, VisuallyHiddenProps } from "@mantine/core";
|
|
2
|
+
import { create_component } from "../modules/component";
|
|
3
|
+
|
|
4
|
+
type Props = VisuallyHiddenProps;
|
|
5
|
+
const Component = create_component({
|
|
6
|
+
name: "VisuallyHidden",
|
|
7
|
+
description: "The visuallyhidden UI element",
|
|
8
|
+
props: {} as Props,
|
|
9
|
+
render() {
|
|
10
|
+
delete this.props["mount_animation"];
|
|
11
|
+
const { children, ...other } = this.props;
|
|
12
|
+
return <VisuallyHidden {...other}>{children}</VisuallyHidden>;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export default Component;
|
package/utils/index.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export const UTILS = {
|
|
2
|
+
string: {
|
|
3
|
+
toTitleCase(str: string) {
|
|
4
|
+
return str.replace(
|
|
5
|
+
/\w\S*/g,
|
|
6
|
+
(word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(),
|
|
7
|
+
);
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
event: {
|
|
11
|
+
dispatch(name: string, detail: any) {
|
|
12
|
+
const event = new CustomEvent(name, { detail });
|
|
13
|
+
document.dispatchEvent(event);
|
|
14
|
+
},
|
|
15
|
+
listen(name: string, cb: (detail: any) => void) {
|
|
16
|
+
document.addEventListener(name, (e) => {
|
|
17
|
+
const event = e as CustomEvent;
|
|
18
|
+
cb(event.detail);
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
url: {
|
|
23
|
+
isImageUrl(url: string) {
|
|
24
|
+
const imageExtensions = [
|
|
25
|
+
".jpg",
|
|
26
|
+
".jpeg",
|
|
27
|
+
".png",
|
|
28
|
+
".gif",
|
|
29
|
+
".bmp",
|
|
30
|
+
".webp",
|
|
31
|
+
".svg",
|
|
32
|
+
".ico",
|
|
33
|
+
];
|
|
34
|
+
const extension = url.toLowerCase().slice(url.lastIndexOf("."));
|
|
35
|
+
return imageExtensions.includes(extension);
|
|
36
|
+
},
|
|
37
|
+
parsePath(filePath: string): { fileName: string; ext: string } {
|
|
38
|
+
const parts = filePath.split("/");
|
|
39
|
+
const fileWithExt = parts[parts.length - 1];
|
|
40
|
+
const lastDotIndex = fileWithExt.lastIndexOf(".");
|
|
41
|
+
|
|
42
|
+
const fileName = fileWithExt.substring(0, lastDotIndex);
|
|
43
|
+
const ext = fileWithExt.substring(lastDotIndex + 1);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
fileName,
|
|
47
|
+
ext,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
async fetchCdnContent(url: string): Promise<string> {
|
|
51
|
+
try {
|
|
52
|
+
const response = await fetch(url);
|
|
53
|
+
if (response.ok) {
|
|
54
|
+
const text = await response.text();
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
throw new Error(`Failed to fetch`);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return `Failed to fetch from ${url}: ${(error as Error).message}`;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
input: {
|
|
64
|
+
debounce<T extends (...args: any[]) => void>(
|
|
65
|
+
func: T,
|
|
66
|
+
wait: number,
|
|
67
|
+
): (...args: Parameters<T>) => void {
|
|
68
|
+
let timeout: ReturnType<typeof setTimeout>;
|
|
69
|
+
|
|
70
|
+
return function (...args: Parameters<T>) {
|
|
71
|
+
clearTimeout(timeout);
|
|
72
|
+
timeout = setTimeout(() => func(...args), wait);
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|