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/modules/store.ts
ADDED
|
@@ -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
|
+
};
|
package/modules/theme.ts
ADDED
|
@@ -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
|
+
}
|