rockin 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,71 @@
1
+ // src/utils/openai.ts
2
+ import { OpenAI as AI } from "openai";
3
+ var client;
4
+ function OpenAI() {
5
+ const apiKey = process.env.OPENAI_API_KEY;
6
+ if (!apiKey) {
7
+ throw new Error("OPENAI_API_KEY is not configured");
8
+ }
9
+ client ??= new AI({ apiKey });
10
+ return client;
11
+ }
12
+
13
+ // src/utils/parms.ts
14
+ import { createLoader } from "nuqs/server";
15
+ import {
16
+ createParser,
17
+ parseAsString,
18
+ parseAsStringLiteral
19
+ } from "nuqs/server";
20
+ var parseAsPage = createParser({
21
+ parse(value) {
22
+ const page = Number(value);
23
+ return Number.isInteger(page) && page > 0 ? page : null;
24
+ },
25
+ serialize: String
26
+ }).withDefault(1);
27
+ var parseAsFlag = createParser({
28
+ parse(value) {
29
+ return value === "" || value === "1" || value === "true" ? true : null;
30
+ },
31
+ serialize(value) {
32
+ return value ? "1" : "";
33
+ }
34
+ });
35
+ var searchParams = {
36
+ tab: parseAsString.withDefault(""),
37
+ query: parseAsString.withDefault(""),
38
+ category: parseAsString.withDefault(""),
39
+ productStatus: parseAsStringLiteral([
40
+ "active",
41
+ "draft",
42
+ "archived"
43
+ ]).withDefault("active"),
44
+ user: parseAsString.withDefault(""),
45
+ transaction: parseAsString.withDefault(""),
46
+ page: parseAsPage,
47
+ transactionPage: parseAsPage,
48
+ cart: parseAsFlag.withDefault(false),
49
+ notification: parseAsFlag.withDefault(false)
50
+ };
51
+ var searchParamKeys = {
52
+ tab: "tab",
53
+ query: "q",
54
+ category: "c",
55
+ productStatus: "status",
56
+ user: "u",
57
+ transaction: "id",
58
+ page: "page",
59
+ transactionPage: "tp",
60
+ cart: "cart",
61
+ notification: "notification"
62
+ };
63
+ var SearchParams = createLoader(searchParams, {
64
+ urlKeys: searchParamKeys
65
+ });
66
+ export {
67
+ OpenAI,
68
+ SearchParams,
69
+ searchParamKeys,
70
+ searchParams
71
+ };
@@ -0,0 +1,61 @@
1
+ import * as nuqs from 'nuqs';
2
+
3
+ type SearchParamSource = Pick<URLSearchParams, "has" | "toString">;
4
+ declare const searchParams: {
5
+ tab: Omit<nuqs.SingleParserBuilder<string>, "parseServerSide"> & {
6
+ readonly defaultValue: string;
7
+ parseServerSide(value: string | string[] | undefined): string;
8
+ };
9
+ query: Omit<nuqs.SingleParserBuilder<string>, "parseServerSide"> & {
10
+ readonly defaultValue: string;
11
+ parseServerSide(value: string | string[] | undefined): string;
12
+ };
13
+ category: Omit<nuqs.SingleParserBuilder<string>, "parseServerSide"> & {
14
+ readonly defaultValue: string;
15
+ parseServerSide(value: string | string[] | undefined): string;
16
+ };
17
+ productStatus: Omit<nuqs.SingleParserBuilder<"active" | "draft" | "archived">, "parseServerSide"> & {
18
+ readonly defaultValue: NonNullable<"active" | "draft" | "archived">;
19
+ parseServerSide(value: string | string[] | undefined): NonNullable<"active" | "draft" | "archived">;
20
+ };
21
+ user: Omit<nuqs.SingleParserBuilder<string>, "parseServerSide"> & {
22
+ readonly defaultValue: string;
23
+ parseServerSide(value: string | string[] | undefined): string;
24
+ };
25
+ transaction: Omit<nuqs.SingleParserBuilder<string>, "parseServerSide"> & {
26
+ readonly defaultValue: string;
27
+ parseServerSide(value: string | string[] | undefined): string;
28
+ };
29
+ page: Omit<nuqs.SingleParserBuilder<number>, "parseServerSide"> & {
30
+ readonly defaultValue: number;
31
+ parseServerSide(value: string | string[] | undefined): number;
32
+ };
33
+ transactionPage: Omit<nuqs.SingleParserBuilder<number>, "parseServerSide"> & {
34
+ readonly defaultValue: number;
35
+ parseServerSide(value: string | string[] | undefined): number;
36
+ };
37
+ cart: Omit<nuqs.SingleParserBuilder<boolean>, "parseServerSide"> & {
38
+ readonly defaultValue: boolean;
39
+ parseServerSide(value: string | string[] | undefined): boolean;
40
+ };
41
+ notification: Omit<nuqs.SingleParserBuilder<boolean>, "parseServerSide"> & {
42
+ readonly defaultValue: boolean;
43
+ parseServerSide(value: string | string[] | undefined): boolean;
44
+ };
45
+ };
46
+ declare const searchParamKeys: {
47
+ tab: string;
48
+ query: string;
49
+ category: string;
50
+ productStatus: string;
51
+ user: string;
52
+ transaction: string;
53
+ page: string;
54
+ transactionPage: string;
55
+ cart: string;
56
+ notification: string;
57
+ };
58
+ declare function hasFlagSearchParam(searchParams: SearchParamSource, key: "cart" | "notification"): boolean;
59
+ declare function buildFlagSearchParamHref(pathname: string, searchParams: SearchParamSource, key: "cart" | "notification", enabled: boolean): string;
60
+
61
+ export { buildFlagSearchParamHref, hasFlagSearchParam, searchParamKeys, searchParams };
@@ -0,0 +1,12 @@
1
+ import {
2
+ buildFlagSearchParamHref,
3
+ hasFlagSearchParam,
4
+ searchParamKeys,
5
+ searchParams
6
+ } from "../chunk-BDQJCK4S.js";
7
+ export {
8
+ buildFlagSearchParamHref,
9
+ hasFlagSearchParam,
10
+ searchParamKeys,
11
+ searchParams
12
+ };
package/package.json ADDED
@@ -0,0 +1,128 @@
1
+ {
2
+ "name": "rockin",
3
+ "version": "0.0.1",
4
+ "description": "Shared React UI components, icons, hooks, utilities, and styles.",
5
+ "type": "module",
6
+ "private": false,
7
+ "sideEffects": false,
8
+ "imports": {
9
+ "#components/*": "./src/ui/*.tsx",
10
+ "#hooks/*": "./src/hooks/*.ts",
11
+ "#lib/*": "./src/lib/*.ts"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
24
+ },
25
+ "./lucide": {
26
+ "types": "./dist/lucide.d.ts",
27
+ "import": "./dist/lucide.js"
28
+ },
29
+ "./gravity": {
30
+ "types": "./dist/gravity.d.ts",
31
+ "import": "./dist/gravity.js"
32
+ },
33
+ "./icon": {
34
+ "types": "./dist/icon/index.d.ts",
35
+ "import": "./dist/icon/index.js"
36
+ },
37
+ "./hooks": {
38
+ "types": "./dist/hooks/index.d.ts",
39
+ "import": "./dist/hooks/index.js"
40
+ },
41
+ "./lib": {
42
+ "types": "./dist/lib/index.d.ts",
43
+ "import": "./dist/lib/index.js"
44
+ },
45
+ "./utils": {
46
+ "types": "./dist/utils/index.d.ts",
47
+ "import": "./dist/utils/index.js"
48
+ },
49
+ "./utils/parms-client": {
50
+ "types": "./dist/utils/parms-client.d.ts",
51
+ "import": "./dist/utils/parms-client.js"
52
+ },
53
+ "./styles.css": "./dist/styles.css",
54
+ "./package.json": "./package.json"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/rockstar-bio/ui.git"
59
+ },
60
+ "homepage": "https://github.com/rockstar-bio/ui#readme",
61
+ "bugs": {
62
+ "url": "https://github.com/rockstar-bio/ui/issues"
63
+ },
64
+ "license": "MIT",
65
+ "scripts": {
66
+ "build": "tsup",
67
+ "format": "prettier --write .",
68
+ "format:check": "prettier --check .",
69
+ "typecheck": "tsc -p tsconfig.json --noEmit"
70
+ },
71
+ "peerDependencies": {
72
+ "next": "^16.0.0",
73
+ "react": "^19.0.0",
74
+ "react-dom": "^19.0.0"
75
+ },
76
+ "dependencies": {
77
+ "@ariakit/react": "^0.4.40",
78
+ "@base-ui/react": "^1.6.0",
79
+ "@dnd-kit/core": "^6.3.1",
80
+ "@dnd-kit/modifiers": "^9.0.0",
81
+ "@dnd-kit/sortable": "^10.0.0",
82
+ "@dnd-kit/utilities": "^3.2.2",
83
+ "@gravity-ui/icons": "^2.3.0",
84
+ "@number-flow/react": "^0.6.2",
85
+ "@radix-ui/react-collapsible": "^1.1.20",
86
+ "@radix-ui/react-scroll-area": "^1.2.18",
87
+ "@radix-ui/react-select": "^2.3.7",
88
+ "@shadcn/react": "^0.3.0",
89
+ "@visx/curve": "4.0.1-alpha.0",
90
+ "@visx/event": "4.0.1-alpha.0",
91
+ "@visx/gradient": "4.0.1-alpha.0",
92
+ "@visx/grid": "4.0.1-alpha.0",
93
+ "@visx/responsive": "4.0.1-alpha.0",
94
+ "@visx/scale": "4.0.1-alpha.0",
95
+ "@visx/shape": "4.0.1-alpha.0",
96
+ "class-variance-authority": "^0.7.1",
97
+ "cmdk": "^1.1.1",
98
+ "cn": "^0.3.0",
99
+ "d3-array": "^3.2.4",
100
+ "d3-shape": "^3.2.0",
101
+ "embla-carousel-react": "^8.6.0",
102
+ "feral-blob": "^0.2.0",
103
+ "goey-toast": "^0.5.0",
104
+ "input-otp": "^1.4.2",
105
+ "lucide-react": "^1.27.0",
106
+ "motion": "^12.42.2",
107
+ "next-themes": "^0.4.6",
108
+ "nuqs": "^2.9.4",
109
+ "openai": "^7.4.0",
110
+ "qrcode": "^1.5.4",
111
+ "recharts": "^3.8.0",
112
+ "shadcn": "^4.13.0",
113
+ "sonner": "^2.0.7",
114
+ "tailwindcss": "^4",
115
+ "tw-animate-css": "^1.4.0"
116
+ },
117
+ "devDependencies": {
118
+ "@types/node": "^20.19.43",
119
+ "@types/qrcode": "^1.5.6",
120
+ "@types/react": "^19",
121
+ "@types/react-dom": "^19",
122
+ "next": "^16.0.0",
123
+ "prettier": "^3.8.3",
124
+ "prettier-plugin-tailwindcss": "^0.8.0",
125
+ "tsup": "^8.5.0",
126
+ "typescript": "^5"
127
+ }
128
+ }