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/scripts/test.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import puppeteer from "puppeteer";
|
|
2
|
+
import next from "next";
|
|
3
|
+
// import nextBuild from "next/dist/build/index.js";
|
|
4
|
+
import express from "express";
|
|
5
|
+
import killPort from "kill-port";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { styleText } from "node:util";
|
|
9
|
+
|
|
10
|
+
const __dirname = process.cwd();
|
|
11
|
+
const port = 3001;
|
|
12
|
+
const baseUrl = `http://localhost:${port}`;
|
|
13
|
+
const pagesDir = path.join(__dirname, "src/pages");
|
|
14
|
+
function getRoutes(dir, basePath = "") {
|
|
15
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
16
|
+
return entries.flatMap((entry) => {
|
|
17
|
+
const fullPath = path.join(dir, entry.name);
|
|
18
|
+
const routePath = path.join(basePath, entry.name).replace(/\\/g, "/");
|
|
19
|
+
const entrypath = path.parse(entry.name);
|
|
20
|
+
|
|
21
|
+
if (entry.isDirectory() && entrypath.name !== "api") {
|
|
22
|
+
return getRoutes(fullPath, routePath);
|
|
23
|
+
}
|
|
24
|
+
if (
|
|
25
|
+
entry.isFile() &&
|
|
26
|
+
!["_app", "_document", "_error"].includes(entrypath.name)
|
|
27
|
+
) {
|
|
28
|
+
let route = routePath.endsWith("index.tsx")
|
|
29
|
+
? routePath.replace(/\index.tsx?$/, "")
|
|
30
|
+
: routePath.replace(/\.tsx?$/, "");
|
|
31
|
+
return route === "index" ? "/" : `/${route.replace(/\[.*?\]/g, "hello")}`;
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const testRoutes = async () => {
|
|
38
|
+
try {
|
|
39
|
+
await killPort(port, "tcp");
|
|
40
|
+
console.log(styleText("yellowBright", ` ✓ Port ${port} cleared.`));
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(styleText("yellowBright", ` ⚠️ Warning: ${err.message}`));
|
|
43
|
+
}
|
|
44
|
+
// const dir = path.resolve(process.cwd());
|
|
45
|
+
// await nextBuild.default(dir, {});
|
|
46
|
+
const app = next({
|
|
47
|
+
dev: true,
|
|
48
|
+
turbopack: false,
|
|
49
|
+
quiet: true,
|
|
50
|
+
minimalMode: true,
|
|
51
|
+
port,
|
|
52
|
+
});
|
|
53
|
+
await app.prepare();
|
|
54
|
+
console.log(styleText("greenBright", " ○ Next.js app prepared."));
|
|
55
|
+
|
|
56
|
+
const server = express();
|
|
57
|
+
server.all(/(.*)/, (req, res) => app.getRequestHandler()(req, res));
|
|
58
|
+
server.listen(port, async () => {
|
|
59
|
+
console.log(
|
|
60
|
+
styleText("cyanBright", ` ○ Test server running at ${baseUrl}`),
|
|
61
|
+
);
|
|
62
|
+
const browser = await puppeteer.launch({
|
|
63
|
+
headless: "shell",
|
|
64
|
+
});
|
|
65
|
+
const page = await browser.newPage();
|
|
66
|
+
await page.setViewport({ width: 1080, height: 1024 });
|
|
67
|
+
|
|
68
|
+
const routes = getRoutes(pagesDir);
|
|
69
|
+
console.log(
|
|
70
|
+
styleText("blueBright", ` ○ Testing routes: ${routes.join(", ")}`),
|
|
71
|
+
);
|
|
72
|
+
const finalResults = {
|
|
73
|
+
successful: [],
|
|
74
|
+
failed: [],
|
|
75
|
+
};
|
|
76
|
+
for (const route of routes) {
|
|
77
|
+
console.log(styleText("magenta", ` ○ Testing: ${route}`));
|
|
78
|
+
await page.goto(`${baseUrl}${route}`);
|
|
79
|
+
await page.waitForNetworkIdle();
|
|
80
|
+
|
|
81
|
+
const results = await page.evaluate(async () => {
|
|
82
|
+
const results = [];
|
|
83
|
+
for (const [name, test] of Object.entries(globalThis.tdd || {})) {
|
|
84
|
+
try {
|
|
85
|
+
await test();
|
|
86
|
+
results.push({ name, success: true });
|
|
87
|
+
} catch (error) {
|
|
88
|
+
results.push({
|
|
89
|
+
name,
|
|
90
|
+
success: false,
|
|
91
|
+
error: {
|
|
92
|
+
message: error.message,
|
|
93
|
+
stack: error.stack.split("\n"),
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return results;
|
|
99
|
+
});
|
|
100
|
+
if (results.length === 0) {
|
|
101
|
+
console.log(styleText("gray", " - No tests found "));
|
|
102
|
+
}
|
|
103
|
+
for (const result of results) {
|
|
104
|
+
if (result.success) {
|
|
105
|
+
console.log(
|
|
106
|
+
styleText("bgGreenBright", " ✔ PASSED "),
|
|
107
|
+
styleText("bold", `${result.name}`),
|
|
108
|
+
);
|
|
109
|
+
finalResults.successful.push({
|
|
110
|
+
route,
|
|
111
|
+
name: result.name,
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
console.log(
|
|
115
|
+
styleText("bgRedBright", " ✖ FAILED "),
|
|
116
|
+
styleText("bold", `${result.name}`),
|
|
117
|
+
styleText(["underline", "redBright"], `${result.error.message}`),
|
|
118
|
+
);
|
|
119
|
+
finalResults.failed.push({
|
|
120
|
+
route,
|
|
121
|
+
name: result.name,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
console.log(styleText("greenBright", ` ✔ Finished testing: ${route}`));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
await browser.close();
|
|
129
|
+
if (finalResults.failed.length === 0) {
|
|
130
|
+
console.log(styleText("bgGreenBright", " ✔ ALL TESTS PASSED "));
|
|
131
|
+
process.exit();
|
|
132
|
+
} else {
|
|
133
|
+
console.log(
|
|
134
|
+
styleText(
|
|
135
|
+
"bgGreenBright",
|
|
136
|
+
` ${finalResults.successful.length} ✔ PASSED `,
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
console.log(
|
|
140
|
+
styleText("bgRedBright", ` ${finalResults.failed.length} ✖ FAILED `),
|
|
141
|
+
);
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|