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.
Files changed (169) hide show
  1. package/README.md +51 -0
  2. package/api/client.ts +83 -0
  3. package/api/helpers/fs.ts +98 -0
  4. package/api/helpers/stream.ts +6 -0
  5. package/api/index.ts +50 -0
  6. package/api/server.ts +566 -0
  7. package/constants/fonts.ts +1583 -0
  8. package/constants/icons.ts +2124 -0
  9. package/constants/langs.ts +2592 -0
  10. package/constants/ssr-loading.tsx +17 -0
  11. package/contexts/dev.tsx +124 -0
  12. package/hooks/useDebounceCb.ts +21 -0
  13. package/modules/app.tsx +102 -0
  14. package/modules/behaviors.ts +161 -0
  15. package/modules/component.tsx +483 -0
  16. package/modules/config/index.ts +8 -0
  17. package/modules/database.ts +25 -0
  18. package/modules/document.tsx +23 -0
  19. package/modules/error.tsx +16 -0
  20. package/modules/page/autozoom.tsx +92 -0
  21. package/modules/page/browser.tsx +166 -0
  22. package/modules/page/index.tsx +327 -0
  23. package/modules/page/insert-modal.tsx +225 -0
  24. package/modules/page/inspect/index.tsx +237 -0
  25. package/modules/page/inspect/wrapper.tsx +88 -0
  26. package/modules/page/knobs/action.tsx +58 -0
  27. package/modules/page/knobs/color.tsx +78 -0
  28. package/modules/page/knobs/helpers.ts +71 -0
  29. package/modules/page/knobs/icon.tsx +85 -0
  30. package/modules/page/knobs/linker.tsx +188 -0
  31. package/modules/page/knobs/list-json.tsx +149 -0
  32. package/modules/page/knobs/list-text.tsx +129 -0
  33. package/modules/page/knobs/number.tsx +84 -0
  34. package/modules/page/knobs/segmented.tsx +81 -0
  35. package/modules/page/knobs/select.tsx +89 -0
  36. package/modules/page/knobs/size.tsx +106 -0
  37. package/modules/page/knobs/switch.tsx +75 -0
  38. package/modules/page/knobs/text.tsx +93 -0
  39. package/modules/page/left-tabs.tsx +36 -0
  40. package/modules/page/right-tabs.tsx +31 -0
  41. package/modules/page/seo.tsx +69 -0
  42. package/modules/page/tree.tsx +860 -0
  43. package/modules/state.ts +787 -0
  44. package/modules/store.ts +37 -0
  45. package/modules/theme.ts +105 -0
  46. package/modules/translations.ts +15 -0
  47. package/package.json +68 -0
  48. package/scripts/bin.js +607 -0
  49. package/scripts/test.js +145 -0
  50. package/themes/base.tsx +8962 -0
  51. package/themes/index.ts +4 -0
  52. package/themes/m2.ts +39 -0
  53. package/themes/newspaper.ts +39 -0
  54. package/types/api.ts +57 -0
  55. package/types/fiber_node.ts +69 -0
  56. package/types/react_element.ts +14 -0
  57. package/ui/accordion.tsx +70 -0
  58. package/ui/actionicon.tsx +41 -0
  59. package/ui/affix.tsx +14 -0
  60. package/ui/alert.tsx +37 -0
  61. package/ui/anchor.tsx +52 -0
  62. package/ui/arrow.tsx +116 -0
  63. package/ui/aspectratio.tsx +21 -0
  64. package/ui/autocomplete.tsx +34 -0
  65. package/ui/avatar.tsx +36 -0
  66. package/ui/backgroundimage.tsx +16 -0
  67. package/ui/badge.tsx +28 -0
  68. package/ui/blockquote.tsx +15 -0
  69. package/ui/blocks/faq.tsx +145 -0
  70. package/ui/blocks/features.tsx +167 -0
  71. package/ui/blocks/footer.tsx +182 -0
  72. package/ui/blocks/herobanner.tsx +391 -0
  73. package/ui/blocks/index.ts +44 -0
  74. package/ui/blocks/leftnav.tsx +141 -0
  75. package/ui/blocks/pricing.tsx +210 -0
  76. package/ui/blocks/testimonials.tsx +149 -0
  77. package/ui/blocks/uidocs.tsx +1429 -0
  78. package/ui/box.tsx +27 -0
  79. package/ui/breadcrumbs.tsx +33 -0
  80. package/ui/burger.tsx +23 -0
  81. package/ui/button.tsx +85 -0
  82. package/ui/card.tsx +28 -0
  83. package/ui/center.tsx +26 -0
  84. package/ui/checkbox.tsx +35 -0
  85. package/ui/chip.tsx +32 -0
  86. package/ui/closebutton.tsx +15 -0
  87. package/ui/code.tsx +104 -0
  88. package/ui/collapse.tsx +16 -0
  89. package/ui/colorinput.tsx +32 -0
  90. package/ui/colorpicker.tsx +26 -0
  91. package/ui/colorswatch.tsx +17 -0
  92. package/ui/combobox.tsx +80 -0
  93. package/ui/container.tsx +27 -0
  94. package/ui/dialog.tsx +15 -0
  95. package/ui/divider.tsx +58 -0
  96. package/ui/drawer.tsx +28 -0
  97. package/ui/fieldset.tsx +15 -0
  98. package/ui/filebutton.tsx +23 -0
  99. package/ui/fileinput.tsx +36 -0
  100. package/ui/flex.tsx +139 -0
  101. package/ui/focustrap.tsx +15 -0
  102. package/ui/form.tsx +26 -0
  103. package/ui/grid.tsx +69 -0
  104. package/ui/highlight.tsx +15 -0
  105. package/ui/hoverable.tsx +66 -0
  106. package/ui/hovercard.tsx +45 -0
  107. package/ui/icon.tsx +76 -0
  108. package/ui/image.tsx +32 -0
  109. package/ui/index.ts +1355 -0
  110. package/ui/indicator.tsx +42 -0
  111. package/ui/infobox.tsx +200 -0
  112. package/ui/input.tsx +18 -0
  113. package/ui/inviewport.tsx +23 -0
  114. package/ui/jsoninput.tsx +35 -0
  115. package/ui/kbd.tsx +20 -0
  116. package/ui/list.tsx +33 -0
  117. package/ui/loader.tsx +26 -0
  118. package/ui/loadingoverlay.tsx +22 -0
  119. package/ui/mark.tsx +15 -0
  120. package/ui/menu.tsx +89 -0
  121. package/ui/modal.tsx +27 -0
  122. package/ui/multiselect.tsx +42 -0
  123. package/ui/nativeselect.tsx +17 -0
  124. package/ui/navlink.tsx +40 -0
  125. package/ui/notification.tsx +25 -0
  126. package/ui/numberformatter.tsx +15 -0
  127. package/ui/numberinput.tsx +37 -0
  128. package/ui/overlay.tsx +15 -0
  129. package/ui/pagination.tsx +21 -0
  130. package/ui/paper.tsx +33 -0
  131. package/ui/passwordinput.tsx +36 -0
  132. package/ui/pill.tsx +17 -0
  133. package/ui/pillsinput.tsx +37 -0
  134. package/ui/pininput.tsx +30 -0
  135. package/ui/popover.tsx +43 -0
  136. package/ui/portal.tsx +15 -0
  137. package/ui/progress.tsx +49 -0
  138. package/ui/props.ts +91 -0
  139. package/ui/propsDef.ts +38 -0
  140. package/ui/radio.tsx +30 -0
  141. package/ui/rating.tsx +25 -0
  142. package/ui/ringprogress.tsx +17 -0
  143. package/ui/scrollarea.tsx +27 -0
  144. package/ui/segmentedcontrol.tsx +38 -0
  145. package/ui/select.tsx +43 -0
  146. package/ui/simplegrid.tsx +23 -0
  147. package/ui/skeleton.tsx +15 -0
  148. package/ui/slider.tsx +31 -0
  149. package/ui/space.tsx +19 -0
  150. package/ui/spoiler.tsx +23 -0
  151. package/ui/stepper.tsx +63 -0
  152. package/ui/switch.tsx +29 -0
  153. package/ui/table.tsx +93 -0
  154. package/ui/tabs.tsx +80 -0
  155. package/ui/tagsinput.tsx +19 -0
  156. package/ui/terminal.tsx +44 -0
  157. package/ui/text.tsx +168 -0
  158. package/ui/textarea.tsx +36 -0
  159. package/ui/textinput.tsx +34 -0
  160. package/ui/timeline.tsx +30 -0
  161. package/ui/title.tsx +42 -0
  162. package/ui/tooltip.tsx +32 -0
  163. package/ui/transition.tsx +21 -0
  164. package/ui/tree.tsx +42 -0
  165. package/ui/typographystylesprovider.tsx +20 -0
  166. package/ui/unstyledbutton.tsx +18 -0
  167. package/ui/video.tsx +16 -0
  168. package/ui/visuallyhidden.tsx +15 -0
  169. package/utils/index.ts +76 -0
@@ -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
+ };