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,37 @@
1
+ type StoreParams<
2
+ STATE extends Record<string, unknown>,
3
+ ACTIONS extends Record<
4
+ string,
5
+ (this: { state: STATE }, ...args: unknown[]) => Promise<void>
6
+ >,
7
+ > = {
8
+ state: STATE;
9
+ actions: ACTIONS;
10
+ };
11
+
12
+ type ReturnType<
13
+ STATE extends Record<string, unknown>,
14
+ ACTIONS extends Record<string, (...args: unknown[]) => Promise<void>>,
15
+ > = {
16
+ state: STATE;
17
+ actions: {
18
+ [ACTION_NAME in keyof ACTIONS]: OmitThisParameter<ACTIONS[ACTION_NAME]>;
19
+ };
20
+ };
21
+
22
+ export const create_store = <
23
+ STATE extends Record<string, unknown>,
24
+ ACTIONS extends Record<
25
+ string,
26
+ (this: { state: STATE }, ...args: unknown[]) => Promise<void>
27
+ >,
28
+ >(
29
+ params: StoreParams<STATE, ACTIONS>
30
+ ) /*: ReturnType<STATE, ACTIONS> */ => {
31
+ const $$typeof = Symbol("southpaw.store");
32
+ const result = params as ReturnType<STATE, ACTIONS>;
33
+ return {
34
+ $$typeof,
35
+ ...result,
36
+ };
37
+ };
@@ -0,0 +1,105 @@
1
+ import {
2
+ DefaultMantineColor,
3
+ MantineColorsTuple,
4
+ MantineTheme,
5
+ } from "@mantine/core";
6
+ import { GOOGLE_FONTS } from "../constants/fonts";
7
+
8
+ type ThemeParams = Omit<
9
+ Partial<MantineTheme>,
10
+ "fontFamily" | "fontFamilyMonospace" | "colors"
11
+ > & {
12
+ fontFamily: (typeof GOOGLE_FONTS)[number];
13
+ fontFamilyMonospace: (typeof GOOGLE_FONTS)[number];
14
+ colors: Partial<Record<DefaultMantineColor, string>>;
15
+ };
16
+ export const create_theme = (themeParams: ThemeParams) => {
17
+ const { colors: themeColors, ...other } = themeParams;
18
+ const colors = Object.entries(themeColors).reduce(
19
+ (acc, [color, value]) => {
20
+ if (value) {
21
+ acc[color] = generateColorTupleFromHex(value);
22
+ }
23
+ return acc;
24
+ },
25
+ {} as MantineTheme["colors"],
26
+ );
27
+ const theme: Partial<MantineTheme> = {
28
+ ...other,
29
+ colors,
30
+ };
31
+ return theme as MantineTheme;
32
+ };
33
+
34
+ function hexToHSL(hex: string): { h: number; s: number; l: number } {
35
+ hex = hex.replace(/^#/, "");
36
+
37
+ const bigint = parseInt(hex, 16);
38
+ const r = ((bigint >> 16) & 255) / 255;
39
+ const g = ((bigint >> 8) & 255) / 255;
40
+ const b = (bigint & 255) / 255;
41
+
42
+ const max = Math.max(r, g, b),
43
+ min = Math.min(r, g, b);
44
+ let h = 0,
45
+ s = 0;
46
+ const l = (max + min) / 2;
47
+
48
+ if (max !== min) {
49
+ const d = max - min;
50
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
51
+ switch (max) {
52
+ case r:
53
+ h = (g - b) / d + (g < b ? 6 : 0);
54
+ break;
55
+ case g:
56
+ h = (b - r) / d + 2;
57
+ break;
58
+ case b:
59
+ h = (r - g) / d + 4;
60
+ break;
61
+ }
62
+ h *= 60;
63
+ }
64
+
65
+ return { h, s: s * 100, l: l * 100 };
66
+ }
67
+
68
+ // Convert HSL to HEX
69
+ function hslToHex(h: number, s: number, l: number): string {
70
+ s /= 100;
71
+ l /= 100;
72
+
73
+ const c = (1 - Math.abs(2 * l - 1)) * s;
74
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
75
+ const m = l - c / 2;
76
+
77
+ let r = 0,
78
+ g = 0,
79
+ b = 0;
80
+
81
+ if (h < 60) [r, g, b] = [c, x, 0];
82
+ else if (h < 120) [r, g, b] = [x, c, 0];
83
+ else if (h < 180) [r, g, b] = [0, c, x];
84
+ else if (h < 240) [r, g, b] = [0, x, c];
85
+ else if (h < 300) [r, g, b] = [x, 0, c];
86
+ else [r, g, b] = [c, 0, x];
87
+
88
+ const toHex = (n: number) =>
89
+ Math.round((n + m) * 255)
90
+ .toString(16)
91
+ .padStart(2, "0");
92
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
93
+ }
94
+
95
+ function generateColorTupleFromHex(baseHex: string) {
96
+ const { h, s, l } = hexToHSL(baseHex);
97
+ const shades: string[] = [];
98
+
99
+ for (let i = -1; i < 10; i++) {
100
+ const adjustedLightness = Math.min(95, Math.max(5, l + (i - 4.5) * -8)); // tweak light/darkness
101
+ shades.push(hslToHex(h, s, adjustedLightness));
102
+ }
103
+
104
+ return shades as unknown as MantineColorsTuple;
105
+ }
@@ -0,0 +1,15 @@
1
+ type Translations<KEY extends string> = Record<
2
+ KEY,
3
+ (...args: any[]) => {
4
+ fr?: string;
5
+ ar?: string;
6
+ en?: string;
7
+ }
8
+ >;
9
+ export const create_translations = <KEY extends string>(
10
+ lang: "fr" | "ar" | "en",
11
+ translations: Translations<KEY>,
12
+ ) => {
13
+ const $$typeof = Symbol("southpaw.translations");
14
+ return { $$typeof, lang, translations };
15
+ };
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "southpaw",
3
+ "version": "0.2.7",
4
+ "description": "A behavior-driven Next.js framework",
5
+ "private": false,
6
+ "type": "module",
7
+ "bin": {
8
+ "southpaw": "scripts/bin.js"
9
+ },
10
+ "files": [
11
+ "scripts/",
12
+ "modules/",
13
+ "ui/",
14
+ "hooks/",
15
+ "contexts/",
16
+ "themes/",
17
+ "types/",
18
+ "constants/",
19
+ "utils/",
20
+ "api/"
21
+ ],
22
+ "keywords": [
23
+ "nextjs",
24
+ "framework",
25
+ "react",
26
+ "behavior-driven",
27
+ "southpaw"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/solidsnail/southpaw"
32
+ },
33
+ "license": "MIT",
34
+ "author": "solidsnail",
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
38
+ "dependencies": {
39
+ "@dnd-kit/core": "^6.3.1",
40
+ "@dnd-kit/modifiers": "^9.0.0",
41
+ "@dnd-kit/sortable": "^10.0.0",
42
+ "@dnd-kit/utilities": "^3.2.2",
43
+ "@inquirer/prompts": "^7.4.0",
44
+ "@mantine/core": "^7.11.1",
45
+ "@mantine/hooks": "^7.17.2",
46
+ "@mantine/modals": "^7.11.1",
47
+ "@tabler/icons-react": "^3.31.0",
48
+ "dexie": "^3.2.4",
49
+ "express": "^5.1.0",
50
+ "fast-glob": "^3.3.3",
51
+ "kill-port": "^2.0.1",
52
+ "ollama": "^0.5.16",
53
+ "puppeteer": "^24.4.0",
54
+ "react-fast-compare": "^3.2.2",
55
+ "shelljs": "^0.9.2",
56
+ "shiki": "^3.4.2",
57
+ "ts-morph": "^25.0.1",
58
+ "webfontloader": "^1.6.28"
59
+ },
60
+ "devDependencies": {
61
+ "@types/shelljs": "^0.8.15",
62
+ "@types/webfontloader": "^1.6.38",
63
+ "husky": "^9.1.7"
64
+ },
65
+ "peerDependencies": {
66
+ "next": "^15.2.4"
67
+ }
68
+ }