@studiocubics/next 0.0.1

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.
@@ -0,0 +1,7 @@
1
+
2
+ > @studiocubics/next@0.0.1 build /home/runner/work/StudioCubics/StudioCubics/packages/next
3
+ > rollup -c
4
+
5
+ 
6
+ src/index.ts → dist...
7
+ created dist in 3.1s
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # @studiocubics/next
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - First publish inshallah!
8
+ - Updated dependencies
9
+ - @studiocubics/ui@0.0.1
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @studiocubics/next
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.7. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,21 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import reactHooks from "eslint-plugin-react-hooks";
4
+ import tseslint from "typescript-eslint";
5
+ import { defineConfig, globalIgnores } from "eslint/config";
6
+
7
+ export default defineConfig([
8
+ globalIgnores(["dist"]),
9
+ {
10
+ files: ["**/*.{ts,tsx}"],
11
+ extends: [
12
+ js.configs.recommended,
13
+ tseslint.configs.recommended,
14
+ reactHooks.configs.flat.recommended,
15
+ ],
16
+ languageOptions: {
17
+ ecmaVersion: 2020,
18
+ globals: globals.browser,
19
+ },
20
+ },
21
+ ]);
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@studiocubics/next",
3
+ "description": "Package containing components associated with Next JS by Studio Cubics",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "private": false,
8
+ "version": "0.0.1",
9
+ "keywords": [
10
+ "@studiocubics",
11
+ "cubics",
12
+ "studio",
13
+ "nextjs",
14
+ "next"
15
+ ],
16
+ "author": {
17
+ "name": "Studio Cubics",
18
+ "email": "studiocubics7@gmail.com",
19
+ "url": "https://studio-cubics.vercel.app"
20
+ },
21
+ "license": "MIT",
22
+ "type": "module",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./src/index.d.ts",
26
+ "development": "./src/index.ts",
27
+ "production": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./styles.css": "./dist/index.css"
31
+ },
32
+ "dependencies": {
33
+ "next-themes": "^0.4.6",
34
+ "@studiocubics/ui": "^0.0.1"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/js": "^9.39.1",
38
+ "@rollup/plugin-terser": "^0.4.4",
39
+ "@rollup/plugin-typescript": "^12.3.0",
40
+ "@types/node": "^24.10.1",
41
+ "@types/react": "^19.2.5",
42
+ "@types/react-dom": "^19.2.3",
43
+ "eslint": "^9.39.1",
44
+ "eslint-plugin-react-hooks": "^7.0.1",
45
+ "globals": "^16.5.0",
46
+ "postcss": "^8.5.6",
47
+ "postcss-modules": "^6.0.1",
48
+ "rollup": "^4.53.3",
49
+ "rollup-plugin-postcss": "^4.0.2",
50
+ "rollup-preserve-directives": "^1.1.3",
51
+ "typescript-eslint": "^8.46.4",
52
+ "babel-plugin-react-compiler": "1.0.0",
53
+ "next": "16.1.6",
54
+ "react": "19.2.4",
55
+ "react-dom": "19.2.4",
56
+ "typescript": "^5.9.3"
57
+ },
58
+ "peerDependencies": {
59
+ "babel-plugin-react-compiler": ">= 1.0.0",
60
+ "next": ">= 16.0.0",
61
+ "react": ">= 19.0.0",
62
+ "react-dom": ">= 19.0.0",
63
+ "typescript": ">= 5"
64
+ },
65
+ "scripts": {
66
+ "build": "rollup -c",
67
+ "clean:build": "rimraf dist node_modules && rollup -c",
68
+ "lint": "eslint .",
69
+ "clean": "rimraf dist node_modules"
70
+ }
71
+ }
@@ -0,0 +1,37 @@
1
+ import { defineConfig } from "rollup";
2
+ import typescript from "@rollup/plugin-typescript";
3
+ import postcss from "rollup-plugin-postcss";
4
+ import terser from "@rollup/plugin-terser";
5
+ import preserveDirectives from "rollup-preserve-directives";
6
+
7
+ export default defineConfig({
8
+ input: "src/index.ts",
9
+ output: {
10
+ preserveModules: true,
11
+ preserveModulesRoot: "src",
12
+ dir: "dist",
13
+ format: "esm",
14
+ sourcemap: true,
15
+ },
16
+ plugins: [
17
+ preserveDirectives(),
18
+ postcss({
19
+ include: "**/*.module.css",
20
+ modules: true,
21
+ extract: true,
22
+ // minimize: true,
23
+ }),
24
+ typescript({ tsconfig: "./tsconfig.json" }),
25
+ // terser({ compress: { directives: false } }),
26
+ ],
27
+ external: [
28
+ "react/jsx-runtime",
29
+ "react",
30
+ "react-dom",
31
+ "@studiocubics/ui",
32
+ "next",
33
+ "next-themes",
34
+ "@monaco-editor/react",
35
+ "next/navigation",
36
+ ],
37
+ });
@@ -0,0 +1,32 @@
1
+ .root {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: center;
7
+ justify-content: center;
8
+ gap: var(--spacing-gap-3);
9
+ color: var(--color-error);
10
+ & > h1 {
11
+ font-size: 5rem;
12
+ font-weight: bold;
13
+ color: var(--color-background);
14
+ }
15
+ }
16
+ .message {
17
+ max-width: 100%;
18
+ font-weight: bold;
19
+ text-align: center;
20
+ }
21
+ .tip {
22
+ max-width: 100%;
23
+ font-size: var(--fs-body2);
24
+ color: var(--color-on-background-faint);
25
+ }
26
+ @media (min-width: 600px) {
27
+ .root {
28
+ & > h1 {
29
+ font-size: 10vw;
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,31 @@
1
+ import { Button, GlassCard } from "@studiocubics/ui";
2
+ import styles from "./NextErrorPage.module.css";
3
+ import type { CSSProperties } from "react";
4
+
5
+ export function NextErrorPage({
6
+ error,
7
+ reset,
8
+ }: {
9
+ error: Error & { digest?: string };
10
+ reset: () => void;
11
+ }) {
12
+ return (
13
+ <div className={styles.root}>
14
+ <h1>Oops!</h1>
15
+ <p className={styles.message}>
16
+ {error.message || "Something went wrong!"}
17
+ </p>
18
+ <p className={styles.tip}>
19
+ Try refreshing the page from your browser, or contact an admin if the
20
+ retry button below doesnt work!
21
+ </p>
22
+ <GlassCard
23
+ style={{ "--glass-tint": "var(--color-error)" } as CSSProperties}
24
+ >
25
+ <Button color="error" onClick={() => reset()}>
26
+ Retry
27
+ </Button>
28
+ </GlassCard>
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,16 @@
1
+ import { Spinner } from "@studiocubics/ui";
2
+ export function NextLoadingPage() {
3
+ return (
4
+ <div
5
+ style={{
6
+ width: "100%",
7
+ height: "100%",
8
+ display: "flex",
9
+ justifyContent: "center",
10
+ alignItems: "center",
11
+ }}
12
+ >
13
+ <Spinner width={48} height={48} />
14
+ </div>
15
+ );
16
+ }
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ import { Pagination } from "@studiocubics/ui";
4
+ import { useRouter, useSearchParams } from "next/navigation";
5
+
6
+ export type PaginationParams = {
7
+ page: number;
8
+ total: number;
9
+ limit: number;
10
+ paramKey?: string;
11
+ };
12
+ export function NextSSRPagination({
13
+ page,
14
+ total,
15
+ limit,
16
+ paramKey = "page",
17
+ }: PaginationParams) {
18
+ const router = useRouter();
19
+ const params = useSearchParams();
20
+
21
+ const pageCount = Math.ceil(total / limit);
22
+
23
+ const handleChange = (value: number) => {
24
+ const sp = new URLSearchParams(params.toString());
25
+ sp.set(paramKey, String(value));
26
+ router.push(`?${sp.toString()}`);
27
+ };
28
+ if (pageCount == 1) return;
29
+ return <Pagination count={pageCount} page={page} onChange={handleChange} />;
30
+ }
@@ -0,0 +1,105 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState, type ComponentProps } from "react";
4
+ import { useTheme } from "next-themes";
5
+ import { Tooltip, Button } from "@studiocubics/ui";
6
+
7
+ const Moon = (props: ComponentProps<"svg">) => {
8
+ return (
9
+ <svg
10
+ {...props}
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ viewBox="0 0 24 24"
13
+ fill="none"
14
+ stroke="currentColor"
15
+ stroke-width="2"
16
+ stroke-linecap="round"
17
+ stroke-linejoin="round"
18
+ >
19
+ <path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" />
20
+ </svg>
21
+ );
22
+ };
23
+ const Sun = (props: ComponentProps<"svg">) => {
24
+ return (
25
+ <svg
26
+ {...props}
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ viewBox="0 0 24 24"
29
+ fill="none"
30
+ stroke="currentColor"
31
+ stroke-width="2"
32
+ stroke-linecap="round"
33
+ stroke-linejoin="round"
34
+ >
35
+ <circle cx="12" cy="12" r="4" />
36
+ <path d="M12 2v2" />
37
+ <path d="M12 20v2" />
38
+ <path d="m4.93 4.93 1.41 1.41" />
39
+ <path d="m17.66 17.66 1.41 1.41" />
40
+ <path d="M2 12h2" />
41
+ <path d="M20 12h2" />
42
+ <path d="m6.34 17.66-1.41 1.41" />
43
+ <path d="m19.07 4.93-1.41 1.41" />
44
+ </svg>
45
+ );
46
+ };
47
+ const SunMoon = (props: ComponentProps<"svg">) => {
48
+ return (
49
+ <svg
50
+ {...props}
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ viewBox="0 0 24 24"
53
+ fill="none"
54
+ stroke="currentColor"
55
+ stroke-width="2"
56
+ stroke-linecap="round"
57
+ stroke-linejoin="round"
58
+ >
59
+ <path d="M12 2v2" />
60
+ <path d="M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715" />
61
+ <path d="M16 12a4 4 0 0 0-4-4" />
62
+ <path d="m19 5-1.256 1.256" />
63
+ <path d="M20 12h2" />
64
+ </svg>
65
+ );
66
+ };
67
+
68
+ export function NextSSRThemeToggle() {
69
+ const [mounted, setMounted] = useState(false);
70
+ const { theme, setTheme } = useTheme();
71
+
72
+ useEffect(() => {
73
+ setMounted(true);
74
+ }, []);
75
+
76
+ return (
77
+ <Tooltip
78
+ renderArrow
79
+ title={
80
+ theme == "light" ? "Licht" : theme == "dark" ? "Donker" : "Systeem"
81
+ }
82
+ >
83
+ <Button
84
+ square
85
+ onClick={() =>
86
+ setTheme(
87
+ theme == "system" ? "dark" : theme == "dark" ? "light" : "system",
88
+ )
89
+ }
90
+ >
91
+ {mounted ? (
92
+ theme == "dark" ? (
93
+ <Sun />
94
+ ) : theme == "light" ? (
95
+ <Moon />
96
+ ) : (
97
+ <SunMoon />
98
+ )
99
+ ) : (
100
+ <Moon opacity={0.5} />
101
+ )}
102
+ </Button>
103
+ </Tooltip>
104
+ );
105
+ }
@@ -0,0 +1,4 @@
1
+ declare module "*.module.css" {
2
+ const classes: { [key: string]: string };
3
+ export default classes;
4
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./NextErrorPage/NextErrorPage";
2
+ export * from "./NextLoadingPage";
3
+ export * from "./NextSSRPagination";
4
+ export * from "./NextSSRThemeToggle";
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2022",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "resolveJsonModule": true,
9
+ "allowJs": true,
10
+ "skipLibCheck": true,
11
+
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "verbatimModuleSyntax": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+ // Output
19
+ "declaration": true,
20
+ "outDir": "./dist",
21
+ "rootDir": "./src",
22
+
23
+ /* Linting */
24
+ "strict": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "erasableSyntaxOnly": true,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "noUncheckedSideEffectImports": true
30
+ },
31
+ "include": ["./src"]
32
+ }