@kyro-cms/core 0.1.7 → 0.1.8
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 +25 -2
- package/dist/{WebhookService-BPVJUgTl.d.ts → WebhookService-CXJ5oz6L.d.ts} +1 -1
- package/dist/{WebhookService-BCgL1bLF.d.cts → WebhookService-Dqx9Is7m.d.cts} +1 -1
- package/dist/{base-DaP-5PPG.d.ts → base-CciYzoDF.d.ts} +1 -1
- package/dist/{base-B0Y6isUJ.d.cts → base-Cfek4fp3.d.cts} +1 -1
- package/dist/chunk-EWP5AT6A.cjs +268 -0
- package/dist/chunk-EWP5AT6A.cjs.map +1 -0
- package/dist/chunk-QKOFKITP.js +258 -0
- package/dist/chunk-QKOFKITP.js.map +1 -0
- package/dist/client.cjs +45 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +11 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -0
- package/dist/drizzle/index.d.cts +114 -4
- package/dist/drizzle/index.d.ts +114 -4
- package/dist/graphql/index.d.cts +2 -2
- package/dist/graphql/index.d.ts +2 -2
- package/dist/{index-DupWTmW6.d.ts → index-BvZ1iWm2.d.ts} +1 -1
- package/dist/{index-BwE4NueJ.d.cts → index-CTLPjpMH.d.cts} +1 -1
- package/dist/index.cjs +45 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -230
- package/dist/index.d.ts +15 -230
- package/dist/index.js +13 -260
- package/dist/index.js.map +1 -1
- package/dist/mongodb/index.d.cts +2 -2
- package/dist/mongodb/index.d.ts +2 -2
- package/dist/rate-limit-BvUAVCzw.d.cts +223 -0
- package/dist/rate-limit-CJnqG1mG.d.ts +223 -0
- package/dist/rest/index.d.cts +3 -3
- package/dist/rest/index.d.ts +3 -3
- package/dist/templates/index.d.cts +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/trpc/index.d.cts +2 -2
- package/dist/trpc/index.d.ts +2 -2
- package/dist/{index-DtBi3zP0.d.ts → types-BSR91JFN.d.cts} +1 -112
- package/dist/{index-DUKmDSeC.d.cts → types-BSR91JFN.d.ts} +1 -112
- package/dist/{types-BM0s_YOy.d.cts → types-Bt1OEk0S.d.cts} +12 -4
- package/dist/{types-BM0s_YOy.d.ts → types-Bt1OEk0S.d.ts} +12 -4
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -182,6 +182,29 @@ const newPost = await client.posts.create.mutate({
|
|
|
182
182
|
});
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Core Export Splitting (Astro Support)
|
|
188
|
+
|
|
189
|
+
To support **Astro's islands architecture** and prevent Node.js-only dependencies (like Redis, bcrypt, or database drivers) from crashing your browser bundle, Kyro Core provides two distinct entrypoints:
|
|
190
|
+
|
|
191
|
+
### 1. `@kyro-cms/core` (Server-Only)
|
|
192
|
+
Use this for backend logic, API routes, database configuration, and authentication adapters. This entrypoint includes all Node.js built-ins.
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { createKyro, drizzleAdapter, RedisAuthAdapter } from "@kyro-cms/core";
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 2. `@kyro-cms/core/client` (Browser-Safe)
|
|
199
|
+
Use this for **Astro components**, React/Vue/Svelte islands, styling, and types. This entrypoint is guaranteed to be free of Node.js dependencies.
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import type { KyroConfig, CollectionConfig } from "@kyro-cms/core/client";
|
|
203
|
+
import { defaultLightTheme, generateCSSVariables } from "@kyro-cms/core/client";
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
185
208
|
### WebSocket (Real-time)
|
|
186
209
|
|
|
187
210
|
```typescript
|
|
@@ -497,7 +520,7 @@ import {
|
|
|
497
520
|
ecommerce2026Theme,
|
|
498
521
|
generateCSSVariables,
|
|
499
522
|
generateTailwindConfig,
|
|
500
|
-
} from "@kyro-cms/core";
|
|
523
|
+
} from "@kyro-cms/core/client";
|
|
501
524
|
|
|
502
525
|
// Generate CSS variables
|
|
503
526
|
const cssVars = generateCSSVariables(ecommerce2026Theme);
|
|
@@ -506,7 +529,7 @@ const cssVars = generateCSSVariables(ecommerce2026Theme);
|
|
|
506
529
|
const tailwindConfig = generateTailwindConfig(ecommerce2026Theme);
|
|
507
530
|
|
|
508
531
|
// Custom themes
|
|
509
|
-
import { createAdminStyling } from "@kyro-cms/core";
|
|
532
|
+
import { createAdminStyling } from "@kyro-cms/core/client";
|
|
510
533
|
|
|
511
534
|
const myTheme = createAdminStyling({
|
|
512
535
|
primaryColor: "#6366f1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as BaseAdapter, i as CollectionConfig, G as GlobalConfig, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, F as Field, o as RelationshipField, u as UploadField } from './types-Bt1OEk0S.js';
|
|
2
2
|
|
|
3
3
|
declare abstract class AbstractBaseAdapter implements BaseAdapter {
|
|
4
4
|
protected collections: Map<string, CollectionConfig>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as BaseAdapter, i as CollectionConfig, G as GlobalConfig, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, F as Field, o as RelationshipField, u as UploadField } from './types-Bt1OEk0S.cjs';
|
|
2
2
|
|
|
3
3
|
declare abstract class AbstractBaseAdapter implements BaseAdapter {
|
|
4
4
|
protected collections: Map<string, CollectionConfig>;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/styling/index.ts
|
|
4
|
+
var CSSGenerator = class {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
config;
|
|
9
|
+
css = [];
|
|
10
|
+
addRule(selector, properties) {
|
|
11
|
+
const props = Object.entries(properties).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
12
|
+
this.css.push(`${selector} {
|
|
13
|
+
${props}
|
|
14
|
+
}`);
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
addMediaQuery(breakpoint, rules) {
|
|
18
|
+
this.css.push(`@media (min-width: ${breakpoint}) {
|
|
19
|
+
${rules.join("\n ")}
|
|
20
|
+
}`);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
generate() {
|
|
24
|
+
return this.css.join("\n\n");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function generateTailwindConfig(theme) {
|
|
28
|
+
return {
|
|
29
|
+
theme: {
|
|
30
|
+
extend: {
|
|
31
|
+
colors: theme.colors || {},
|
|
32
|
+
fontFamily: theme.fonts || {},
|
|
33
|
+
spacing: theme.spacing || {},
|
|
34
|
+
borderRadius: theme.borderRadius || {},
|
|
35
|
+
boxShadow: theme.shadows || {},
|
|
36
|
+
screens: theme.breakpoints || {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var defaultLightTheme = {
|
|
42
|
+
colors: {
|
|
43
|
+
primary: "#3b82f6",
|
|
44
|
+
secondary: "#6366f1",
|
|
45
|
+
accent: "#ec4899",
|
|
46
|
+
background: "#ffffff",
|
|
47
|
+
surface: "#f9fafb",
|
|
48
|
+
text: "#111827",
|
|
49
|
+
textMuted: "#6b7280",
|
|
50
|
+
border: "#e5e7eb",
|
|
51
|
+
error: "#ef4444",
|
|
52
|
+
warning: "#f59e0b",
|
|
53
|
+
success: "#10b981",
|
|
54
|
+
info: "#3b82f6"
|
|
55
|
+
},
|
|
56
|
+
fonts: {
|
|
57
|
+
sans: "system-ui, -apple-system, sans-serif",
|
|
58
|
+
serif: "Georgia, serif",
|
|
59
|
+
mono: "Menlo, monospace"
|
|
60
|
+
},
|
|
61
|
+
spacing: {
|
|
62
|
+
xs: "0.25rem",
|
|
63
|
+
sm: "0.5rem",
|
|
64
|
+
md: "1rem",
|
|
65
|
+
lg: "1.5rem",
|
|
66
|
+
xl: "2rem",
|
|
67
|
+
"2xl": "3rem",
|
|
68
|
+
"3xl": "4rem"
|
|
69
|
+
},
|
|
70
|
+
borderRadius: {
|
|
71
|
+
sm: "0.125rem",
|
|
72
|
+
md: "0.375rem",
|
|
73
|
+
lg: "0.5rem",
|
|
74
|
+
xl: "0.75rem",
|
|
75
|
+
full: "9999px"
|
|
76
|
+
},
|
|
77
|
+
shadows: {
|
|
78
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
79
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
80
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
|
|
81
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1)"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var defaultDarkTheme = {
|
|
85
|
+
colors: {
|
|
86
|
+
primary: "#60a5fa",
|
|
87
|
+
secondary: "#818cf8",
|
|
88
|
+
accent: "#f472b6",
|
|
89
|
+
background: "#111827",
|
|
90
|
+
surface: "#1f2937",
|
|
91
|
+
text: "#f9fafb",
|
|
92
|
+
textMuted: "#9ca3af",
|
|
93
|
+
border: "#374151",
|
|
94
|
+
error: "#f87171",
|
|
95
|
+
warning: "#fbbf24",
|
|
96
|
+
success: "#34d399",
|
|
97
|
+
info: "#60a5fa"
|
|
98
|
+
},
|
|
99
|
+
fonts: defaultLightTheme.fonts,
|
|
100
|
+
spacing: defaultLightTheme.spacing,
|
|
101
|
+
borderRadius: defaultLightTheme.borderRadius,
|
|
102
|
+
shadows: {
|
|
103
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.3)",
|
|
104
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.4)",
|
|
105
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.5)",
|
|
106
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.6)"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var ecommerce2026Theme = {
|
|
110
|
+
colors: {
|
|
111
|
+
primary: "#FF6B35",
|
|
112
|
+
secondary: "#1A1A2E",
|
|
113
|
+
accent: "#16C79A",
|
|
114
|
+
background: "#FFFFFF",
|
|
115
|
+
surface: "#F8F9FA",
|
|
116
|
+
text: "#1A1A2E",
|
|
117
|
+
textMuted: "#6B7280",
|
|
118
|
+
border: "#E5E7EB",
|
|
119
|
+
error: "#EF4444",
|
|
120
|
+
warning: "#F59E0B",
|
|
121
|
+
success: "#16C79A",
|
|
122
|
+
info: "#3B82F6"
|
|
123
|
+
},
|
|
124
|
+
fonts: {
|
|
125
|
+
sans: '"Inter", "Satoshi", system-ui, sans-serif',
|
|
126
|
+
serif: '"Playfair Display", Georgia, serif',
|
|
127
|
+
mono: '"JetBrains Mono", monospace'
|
|
128
|
+
},
|
|
129
|
+
spacing: {
|
|
130
|
+
xs: "0.125rem",
|
|
131
|
+
sm: "0.25rem",
|
|
132
|
+
md: "0.5rem",
|
|
133
|
+
lg: "1rem",
|
|
134
|
+
xl: "1.5rem",
|
|
135
|
+
"2xl": "2rem",
|
|
136
|
+
"3xl": "3rem",
|
|
137
|
+
"4xl": "4rem"
|
|
138
|
+
},
|
|
139
|
+
borderRadius: {
|
|
140
|
+
sm: "0",
|
|
141
|
+
md: "0",
|
|
142
|
+
lg: "0",
|
|
143
|
+
xl: "0",
|
|
144
|
+
full: "9999px"
|
|
145
|
+
},
|
|
146
|
+
shadows: {
|
|
147
|
+
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
148
|
+
md: "0 4px 6px rgba(0,0,0,0.07)",
|
|
149
|
+
lg: "0 10px 15px rgba(0,0,0,0.1)",
|
|
150
|
+
xl: "0 20px 25px rgba(0,0,0,0.15)"
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
function generateCSSVariables(theme) {
|
|
154
|
+
const variables = [];
|
|
155
|
+
if (theme.colors) {
|
|
156
|
+
for (const [key, value] of Object.entries(theme.colors)) {
|
|
157
|
+
variables.push(` --color-${key}: ${value};`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (theme.fonts) {
|
|
161
|
+
for (const [key, value] of Object.entries(theme.fonts)) {
|
|
162
|
+
variables.push(` --font-${key}: ${value};`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (theme.spacing) {
|
|
166
|
+
for (const [key, value] of Object.entries(theme.spacing)) {
|
|
167
|
+
variables.push(` --spacing-${key}: ${value};`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (theme.borderRadius) {
|
|
171
|
+
for (const [key, value] of Object.entries(theme.borderRadius)) {
|
|
172
|
+
variables.push(` --radius-${key}: ${value};`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (theme.shadows) {
|
|
176
|
+
for (const [key, value] of Object.entries(theme.shadows)) {
|
|
177
|
+
variables.push(` --shadow-${key}: ${value};`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return `:root {
|
|
181
|
+
${variables.join("\n")}
|
|
182
|
+
}`;
|
|
183
|
+
}
|
|
184
|
+
function createAdminStyling(config) {
|
|
185
|
+
const cssVars = generateCSSVariables(config.theme || defaultLightTheme);
|
|
186
|
+
const componentStyles = [];
|
|
187
|
+
if (config.componentOverrides) {
|
|
188
|
+
for (const [selector, styles] of Object.entries(config.componentOverrides)) {
|
|
189
|
+
const props = Object.entries(styles).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
190
|
+
componentStyles.push(`${selector} {
|
|
191
|
+
${props}
|
|
192
|
+
}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return `
|
|
196
|
+
${cssVars}
|
|
197
|
+
${config.customStyles || ""}
|
|
198
|
+
${componentStyles.join("\n")}
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
var defaultFieldStyling = {
|
|
202
|
+
text: {
|
|
203
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
204
|
+
label: {
|
|
205
|
+
display: "block",
|
|
206
|
+
marginBottom: "var(--spacing-xs)",
|
|
207
|
+
fontWeight: "500",
|
|
208
|
+
color: "var(--color-text)"
|
|
209
|
+
},
|
|
210
|
+
input: {
|
|
211
|
+
width: "100%",
|
|
212
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
213
|
+
border: "1px solid var(--color-border)",
|
|
214
|
+
borderRadius: "var(--radius-md)",
|
|
215
|
+
fontSize: "0.875rem"
|
|
216
|
+
},
|
|
217
|
+
error: {
|
|
218
|
+
color: "var(--color-error)",
|
|
219
|
+
fontSize: "0.75rem",
|
|
220
|
+
marginTop: "var(--spacing-xs)"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
number: {
|
|
224
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
225
|
+
label: { display: "block", marginBottom: "var(--spacing-xs)", fontWeight: "500" },
|
|
226
|
+
input: {
|
|
227
|
+
width: "100%",
|
|
228
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
229
|
+
border: "1px solid var(--color-border)",
|
|
230
|
+
borderRadius: "var(--radius-md)"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
checkbox: {
|
|
234
|
+
wrapper: { display: "flex", alignItems: "center", gap: "var(--spacing-sm)" },
|
|
235
|
+
input: { width: "1rem", height: "1rem" },
|
|
236
|
+
label: { cursor: "pointer" }
|
|
237
|
+
},
|
|
238
|
+
select: {
|
|
239
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
240
|
+
input: {
|
|
241
|
+
width: "100%",
|
|
242
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
243
|
+
border: "1px solid var(--color-border)",
|
|
244
|
+
borderRadius: "var(--radius-md)",
|
|
245
|
+
backgroundColor: "white"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// src/auth/security/context.ts
|
|
251
|
+
function createAuditContext(req) {
|
|
252
|
+
return {
|
|
253
|
+
ipAddress: req.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || req.headers.get("x-real-ip") || "unknown",
|
|
254
|
+
userAgent: req.headers.get("user-agent") || "unknown"
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
exports.CSSGenerator = CSSGenerator;
|
|
259
|
+
exports.createAdminStyling = createAdminStyling;
|
|
260
|
+
exports.createAuditContext = createAuditContext;
|
|
261
|
+
exports.defaultDarkTheme = defaultDarkTheme;
|
|
262
|
+
exports.defaultFieldStyling = defaultFieldStyling;
|
|
263
|
+
exports.defaultLightTheme = defaultLightTheme;
|
|
264
|
+
exports.ecommerce2026Theme = ecommerce2026Theme;
|
|
265
|
+
exports.generateCSSVariables = generateCSSVariables;
|
|
266
|
+
exports.generateTailwindConfig = generateTailwindConfig;
|
|
267
|
+
//# sourceMappingURL=chunk-EWP5AT6A.cjs.map
|
|
268
|
+
//# sourceMappingURL=chunk-EWP5AT6A.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/styling/index.ts","../src/auth/security/context.ts"],"names":[],"mappings":";;;AAwEO,IAAM,eAAN,MAAmB;AAAA,EAGxB,YAAoB,MAAA,EAAuB;AAAvB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAAwB;AAAA,EAAxB,MAAA;AAAA,EAFZ,MAAgB,EAAC;AAAA,EAIzB,OAAA,CAAQ,UAAkB,UAAA,EAA0C;AAClE,IAAA,MAAM,QAAQ,MAAA,CAAO,OAAA,CAAQ,UAAU,CAAA,CACpC,GAAA,CAAI,CAAC,CAAC,CAAA,EAAG,CAAC,CAAA,KAAM,KAAK,CAAC,CAAA,EAAA,EAAK,CAAC,CAAA,CAAA,CAAG,CAAA,CAC/B,KAAK,IAAI,CAAA;AACZ,IAAA,IAAA,CA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P,OAAA,EAAS,qCAAA;AAAA,MACT,MAAA,EAAQ,+BAAA;AAAA,MACR,YAAA,EAAc,kBAAA;AAAA,MACd,eAAA,EAAiB;AAAA;AACnB;AAEJ;;;ACrXO,SAAS,mBAAmB,GAAA,EAGjC;AACA,EAAA,OAAO;AAAA,IACL,WACE,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,iBAAiB,GAAG,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,GAAG,IAAA,EAAK,IACxD,IAAI,OAAA,CAAQ,GAAA,CAAI,WAAW,CAAA,IAC3B,SAAA;AAAA,IACF,SAAA,EAAW,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,YAAY,CAAA,IAAK;AAAA,GAC9C;AACF","file":"chunk-EWP5AT6A.cjs","sourcesContent":["// ============================================================================\n// Styling System Abstraction\n// ============================================================================\n\nexport type StylingMode = 'css' | 'tailwind' | 'css-in-js' | 'styled-components' | 'vanilla-extract';\n\nexport interface StylingConfig {\n mode: StylingMode;\n theme?: ThemeConfig;\n customProperties?: Record<string, string>;\n}\n\nexport interface ThemeConfig {\n colors?: ThemeColors;\n fonts?: ThemeFonts;\n spacing?: ThemeSpacing;\n borderRadius?: ThemeBorderRadius;\n shadows?: ThemeShadows;\n breakpoints?: Record<string, string>;\n}\n\nexport interface ThemeColors {\n primary?: string;\n secondary?: string;\n accent?: string;\n background?: string;\n surface?: string;\n text?: string;\n textMuted?: string;\n border?: string;\n error?: string;\n warning?: string;\n success?: string;\n info?: string;\n}\n\nexport interface ThemeFonts {\n sans?: string;\n serif?: string;\n mono?: string;\n}\n\nexport interface ThemeSpacing {\n xs?: string;\n sm?: string;\n md?: string;\n lg?: string;\n xl?: string;\n '2xl'?: string;\n '3xl'?: string;\n '4xl'?: string;\n}\n\nexport interface ThemeBorderRadius {\n sm?: string;\n md?: string;\n lg?: string;\n xl?: string;\n full?: string;\n}\n\nexport interface ThemeShadows {\n sm?: string;\n md?: string;\n lg?: string;\n xl?: string;\n}\n\n// ============================================================================\n// CSS Generator\n// ============================================================================\n\nexport class CSSGenerator {\n private css: string[] = [];\n\n constructor(private config: StylingConfig) {}\n\n addRule(selector: string, properties: Record<string, string>): this {\n const props = Object.entries(properties)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join('\\n');\n this.css.push(`${selector} {\\n${props}\\n}`);\n return this;\n }\n\n addMediaQuery(breakpoint: string, rules: string[]): this {\n this.css.push(`@media (min-width: ${breakpoint}) {\\n ${rules.join('\\n ')}\\n}`);\n return this;\n }\n\n generate(): string {\n return this.css.join('\\n\\n');\n }\n}\n\n// ============================================================================\n// Tailwind Config Generator\n// ============================================================================\n\nexport function generateTailwindConfig(theme: ThemeConfig): Record<string, any> {\n return {\n theme: {\n extend: {\n colors: theme.colors || {},\n fontFamily: theme.fonts || {},\n spacing: theme.spacing || {},\n borderRadius: theme.borderRadius || {},\n boxShadow: theme.shadows || {},\n screens: theme.breakpoints || {},\n },\n },\n };\n}\n\n// ============================================================================\n// Default Themes\n// ============================================================================\n\nexport const defaultLightTheme: ThemeConfig = {\n colors: {\n primary: '#3b82f6',\n secondary: '#6366f1',\n accent: '#ec4899',\n background: '#ffffff',\n surface: '#f9fafb',\n text: '#111827',\n textMuted: '#6b7280',\n border: '#e5e7eb',\n error: '#ef4444',\n warning: '#f59e0b',\n success: '#10b981',\n info: '#3b82f6',\n },\n fonts: {\n sans: 'system-ui, -apple-system, sans-serif',\n serif: 'Georgia, serif',\n mono: 'Menlo, monospace',\n },\n spacing: {\n xs: '0.25rem',\n sm: '0.5rem',\n md: '1rem',\n lg: '1.5rem',\n xl: '2rem',\n '2xl': '3rem',\n '3xl': '4rem',\n },\n borderRadius: {\n sm: '0.125rem',\n md: '0.375rem',\n lg: '0.5rem',\n xl: '0.75rem',\n full: '9999px',\n },\n shadows: {\n sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',\n md: '0 4px 6px -1px rgb(0 0 0 / 0.1)',\n lg: '0 10px 15px -3px rgb(0 0 0 / 0.1)',\n xl: '0 20px 25px -5px rgb(0 0 0 / 0.1)',\n },\n};\n\nexport const defaultDarkTheme: ThemeConfig = {\n colors: {\n primary: '#60a5fa',\n secondary: '#818cf8',\n accent: '#f472b6',\n background: '#111827',\n surface: '#1f2937',\n text: '#f9fafb',\n textMuted: '#9ca3af',\n border: '#374151',\n error: '#f87171',\n warning: '#fbbf24',\n success: '#34d399',\n info: '#60a5fa',\n },\n fonts: defaultLightTheme.fonts,\n spacing: defaultLightTheme.spacing,\n borderRadius: defaultLightTheme.borderRadius,\n shadows: {\n sm: '0 1px 2px 0 rgb(0 0 0 / 0.3)',\n md: '0 4px 6px -1px rgb(0 0 0 / 0.4)',\n lg: '0 10px 15px -3px rgb(0 0 0 / 0.5)',\n xl: '0 20px 25px -5px rgb(0 0 0 / 0.6)',\n },\n};\n\n// ============================================================================\n// E-Commerce Theme (2026 Design Engine)\n// ============================================================================\n\nexport const ecommerce2026Theme: ThemeConfig = {\n colors: {\n primary: '#FF6B35',\n secondary: '#1A1A2E',\n accent: '#16C79A',\n background: '#FFFFFF',\n surface: '#F8F9FA',\n text: '#1A1A2E',\n textMuted: '#6B7280',\n border: '#E5E7EB',\n error: '#EF4444',\n warning: '#F59E0B',\n success: '#16C79A',\n info: '#3B82F6',\n },\n fonts: {\n sans: '\"Inter\", \"Satoshi\", system-ui, sans-serif',\n serif: '\"Playfair Display\", Georgia, serif',\n mono: '\"JetBrains Mono\", monospace',\n },\n spacing: {\n xs: '0.125rem',\n sm: '0.25rem',\n md: '0.5rem',\n lg: '1rem',\n xl: '1.5rem',\n '2xl': '2rem',\n '3xl': '3rem',\n '4xl': '4rem',\n },\n borderRadius: {\n sm: '0',\n md: '0',\n lg: '0',\n xl: '0',\n full: '9999px',\n },\n shadows: {\n sm: '0 1px 2px rgba(0,0,0,0.05)',\n md: '0 4px 6px rgba(0,0,0,0.07)',\n lg: '0 10px 15px rgba(0,0,0,0.1)',\n xl: '0 20px 25px rgba(0,0,0,0.15)',\n },\n};\n\n// ============================================================================\n// CSS Variables Generator\n// ============================================================================\n\nexport function generateCSSVariables(theme: ThemeConfig): string {\n const variables: string[] = [];\n\n // Colors\n if (theme.colors) {\n for (const [key, value] of Object.entries(theme.colors)) {\n variables.push(` --color-${key}: ${value};`);\n }\n }\n\n // Fonts\n if (theme.fonts) {\n for (const [key, value] of Object.entries(theme.fonts)) {\n variables.push(` --font-${key}: ${value};`);\n }\n }\n\n // Spacing\n if (theme.spacing) {\n for (const [key, value] of Object.entries(theme.spacing)) {\n variables.push(` --spacing-${key}: ${value};`);\n }\n }\n\n // Border Radius\n if (theme.borderRadius) {\n for (const [key, value] of Object.entries(theme.borderRadius)) {\n variables.push(` --radius-${key}: ${value};`);\n }\n }\n\n // Shadows\n if (theme.shadows) {\n for (const [key, value] of Object.entries(theme.shadows)) {\n variables.push(` --shadow-${key}: ${value};`);\n }\n }\n\n return `:root {\\n${variables.join('\\n')}\\n}`;\n}\n\n// ============================================================================\n// Admin Styling Config\n// ============================================================================\n\nexport interface AdminStylingConfig {\n mode: StylingMode;\n theme?: ThemeConfig;\n customStyles?: string;\n componentOverrides?: Record<string, Record<string, string>>;\n}\n\nexport function createAdminStyling(config: AdminStylingConfig): string {\n const cssVars = generateCSSVariables(config.theme || defaultLightTheme);\n const componentStyles: string[] = [];\n\n // Generate component overrides\n if (config.componentOverrides) {\n for (const [selector, styles] of Object.entries(config.componentOverrides)) {\n const props = Object.entries(styles)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join('\\n');\n componentStyles.push(`${selector} {\\n${props}\\n}`);\n }\n }\n\n return `\n ${cssVars}\n ${config.customStyles || ''}\n ${componentStyles.join('\\n')}\n `;\n}\n\n// ============================================================================\n// Field Styling\n// ============================================================================\n\nexport interface FieldStyling {\n wrapper?: Record<string, string>;\n label?: Record<string, string>;\n input?: Record<string, string>;\n error?: Record<string, string>;\n description?: Record<string, string>;\n}\n\nexport const defaultFieldStyling: Record<string, FieldStyling> = {\n text: {\n wrapper: { marginBottom: 'var(--spacing-md)' },\n label: { \n display: 'block', \n marginBottom: 'var(--spacing-xs)',\n fontWeight: '500',\n color: 'var(--color-text)',\n },\n input: {\n width: '100%',\n padding: 'var(--spacing-sm) var(--spacing-md)',\n border: '1px solid var(--color-border)',\n borderRadius: 'var(--radius-md)',\n fontSize: '0.875rem',\n },\n error: {\n color: 'var(--color-error)',\n fontSize: '0.75rem',\n marginTop: 'var(--spacing-xs)',\n },\n },\n number: {\n wrapper: { marginBottom: 'var(--spacing-md)' },\n label: { display: 'block', marginBottom: 'var(--spacing-xs)', fontWeight: '500' },\n input: {\n width: '100%',\n padding: 'var(--spacing-sm) var(--spacing-md)',\n border: '1px solid var(--color-border)',\n borderRadius: 'var(--radius-md)',\n },\n },\n checkbox: {\n wrapper: { display: 'flex', alignItems: 'center', gap: 'var(--spacing-sm)' },\n input: { width: '1rem', height: '1rem' },\n label: { cursor: 'pointer' },\n },\n select: {\n wrapper: { marginBottom: 'var(--spacing-md)' },\n input: {\n width: '100%',\n padding: 'var(--spacing-sm) var(--spacing-md)',\n border: '1px solid var(--color-border)',\n borderRadius: 'var(--radius-md)',\n backgroundColor: 'white',\n },\n },\n};\n","export function createAuditContext(req: Request): {\n ipAddress: string;\n userAgent: string;\n} {\n return {\n ipAddress:\n req.headers.get(\"x-forwarded-for\")?.split(\",\")[0]?.trim() ||\n req.headers.get(\"x-real-ip\") ||\n \"unknown\",\n userAgent: req.headers.get(\"user-agent\") || \"unknown\",\n };\n}\n"]}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// src/styling/index.ts
|
|
2
|
+
var CSSGenerator = class {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
this.config = config;
|
|
5
|
+
}
|
|
6
|
+
config;
|
|
7
|
+
css = [];
|
|
8
|
+
addRule(selector, properties) {
|
|
9
|
+
const props = Object.entries(properties).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
10
|
+
this.css.push(`${selector} {
|
|
11
|
+
${props}
|
|
12
|
+
}`);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
addMediaQuery(breakpoint, rules) {
|
|
16
|
+
this.css.push(`@media (min-width: ${breakpoint}) {
|
|
17
|
+
${rules.join("\n ")}
|
|
18
|
+
}`);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
generate() {
|
|
22
|
+
return this.css.join("\n\n");
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function generateTailwindConfig(theme) {
|
|
26
|
+
return {
|
|
27
|
+
theme: {
|
|
28
|
+
extend: {
|
|
29
|
+
colors: theme.colors || {},
|
|
30
|
+
fontFamily: theme.fonts || {},
|
|
31
|
+
spacing: theme.spacing || {},
|
|
32
|
+
borderRadius: theme.borderRadius || {},
|
|
33
|
+
boxShadow: theme.shadows || {},
|
|
34
|
+
screens: theme.breakpoints || {}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
var defaultLightTheme = {
|
|
40
|
+
colors: {
|
|
41
|
+
primary: "#3b82f6",
|
|
42
|
+
secondary: "#6366f1",
|
|
43
|
+
accent: "#ec4899",
|
|
44
|
+
background: "#ffffff",
|
|
45
|
+
surface: "#f9fafb",
|
|
46
|
+
text: "#111827",
|
|
47
|
+
textMuted: "#6b7280",
|
|
48
|
+
border: "#e5e7eb",
|
|
49
|
+
error: "#ef4444",
|
|
50
|
+
warning: "#f59e0b",
|
|
51
|
+
success: "#10b981",
|
|
52
|
+
info: "#3b82f6"
|
|
53
|
+
},
|
|
54
|
+
fonts: {
|
|
55
|
+
sans: "system-ui, -apple-system, sans-serif",
|
|
56
|
+
serif: "Georgia, serif",
|
|
57
|
+
mono: "Menlo, monospace"
|
|
58
|
+
},
|
|
59
|
+
spacing: {
|
|
60
|
+
xs: "0.25rem",
|
|
61
|
+
sm: "0.5rem",
|
|
62
|
+
md: "1rem",
|
|
63
|
+
lg: "1.5rem",
|
|
64
|
+
xl: "2rem",
|
|
65
|
+
"2xl": "3rem",
|
|
66
|
+
"3xl": "4rem"
|
|
67
|
+
},
|
|
68
|
+
borderRadius: {
|
|
69
|
+
sm: "0.125rem",
|
|
70
|
+
md: "0.375rem",
|
|
71
|
+
lg: "0.5rem",
|
|
72
|
+
xl: "0.75rem",
|
|
73
|
+
full: "9999px"
|
|
74
|
+
},
|
|
75
|
+
shadows: {
|
|
76
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
77
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
78
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
|
|
79
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1)"
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var defaultDarkTheme = {
|
|
83
|
+
colors: {
|
|
84
|
+
primary: "#60a5fa",
|
|
85
|
+
secondary: "#818cf8",
|
|
86
|
+
accent: "#f472b6",
|
|
87
|
+
background: "#111827",
|
|
88
|
+
surface: "#1f2937",
|
|
89
|
+
text: "#f9fafb",
|
|
90
|
+
textMuted: "#9ca3af",
|
|
91
|
+
border: "#374151",
|
|
92
|
+
error: "#f87171",
|
|
93
|
+
warning: "#fbbf24",
|
|
94
|
+
success: "#34d399",
|
|
95
|
+
info: "#60a5fa"
|
|
96
|
+
},
|
|
97
|
+
fonts: defaultLightTheme.fonts,
|
|
98
|
+
spacing: defaultLightTheme.spacing,
|
|
99
|
+
borderRadius: defaultLightTheme.borderRadius,
|
|
100
|
+
shadows: {
|
|
101
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.3)",
|
|
102
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.4)",
|
|
103
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.5)",
|
|
104
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.6)"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var ecommerce2026Theme = {
|
|
108
|
+
colors: {
|
|
109
|
+
primary: "#FF6B35",
|
|
110
|
+
secondary: "#1A1A2E",
|
|
111
|
+
accent: "#16C79A",
|
|
112
|
+
background: "#FFFFFF",
|
|
113
|
+
surface: "#F8F9FA",
|
|
114
|
+
text: "#1A1A2E",
|
|
115
|
+
textMuted: "#6B7280",
|
|
116
|
+
border: "#E5E7EB",
|
|
117
|
+
error: "#EF4444",
|
|
118
|
+
warning: "#F59E0B",
|
|
119
|
+
success: "#16C79A",
|
|
120
|
+
info: "#3B82F6"
|
|
121
|
+
},
|
|
122
|
+
fonts: {
|
|
123
|
+
sans: '"Inter", "Satoshi", system-ui, sans-serif',
|
|
124
|
+
serif: '"Playfair Display", Georgia, serif',
|
|
125
|
+
mono: '"JetBrains Mono", monospace'
|
|
126
|
+
},
|
|
127
|
+
spacing: {
|
|
128
|
+
xs: "0.125rem",
|
|
129
|
+
sm: "0.25rem",
|
|
130
|
+
md: "0.5rem",
|
|
131
|
+
lg: "1rem",
|
|
132
|
+
xl: "1.5rem",
|
|
133
|
+
"2xl": "2rem",
|
|
134
|
+
"3xl": "3rem",
|
|
135
|
+
"4xl": "4rem"
|
|
136
|
+
},
|
|
137
|
+
borderRadius: {
|
|
138
|
+
sm: "0",
|
|
139
|
+
md: "0",
|
|
140
|
+
lg: "0",
|
|
141
|
+
xl: "0",
|
|
142
|
+
full: "9999px"
|
|
143
|
+
},
|
|
144
|
+
shadows: {
|
|
145
|
+
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
146
|
+
md: "0 4px 6px rgba(0,0,0,0.07)",
|
|
147
|
+
lg: "0 10px 15px rgba(0,0,0,0.1)",
|
|
148
|
+
xl: "0 20px 25px rgba(0,0,0,0.15)"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
function generateCSSVariables(theme) {
|
|
152
|
+
const variables = [];
|
|
153
|
+
if (theme.colors) {
|
|
154
|
+
for (const [key, value] of Object.entries(theme.colors)) {
|
|
155
|
+
variables.push(` --color-${key}: ${value};`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (theme.fonts) {
|
|
159
|
+
for (const [key, value] of Object.entries(theme.fonts)) {
|
|
160
|
+
variables.push(` --font-${key}: ${value};`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (theme.spacing) {
|
|
164
|
+
for (const [key, value] of Object.entries(theme.spacing)) {
|
|
165
|
+
variables.push(` --spacing-${key}: ${value};`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (theme.borderRadius) {
|
|
169
|
+
for (const [key, value] of Object.entries(theme.borderRadius)) {
|
|
170
|
+
variables.push(` --radius-${key}: ${value};`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (theme.shadows) {
|
|
174
|
+
for (const [key, value] of Object.entries(theme.shadows)) {
|
|
175
|
+
variables.push(` --shadow-${key}: ${value};`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return `:root {
|
|
179
|
+
${variables.join("\n")}
|
|
180
|
+
}`;
|
|
181
|
+
}
|
|
182
|
+
function createAdminStyling(config) {
|
|
183
|
+
const cssVars = generateCSSVariables(config.theme || defaultLightTheme);
|
|
184
|
+
const componentStyles = [];
|
|
185
|
+
if (config.componentOverrides) {
|
|
186
|
+
for (const [selector, styles] of Object.entries(config.componentOverrides)) {
|
|
187
|
+
const props = Object.entries(styles).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
188
|
+
componentStyles.push(`${selector} {
|
|
189
|
+
${props}
|
|
190
|
+
}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return `
|
|
194
|
+
${cssVars}
|
|
195
|
+
${config.customStyles || ""}
|
|
196
|
+
${componentStyles.join("\n")}
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
var defaultFieldStyling = {
|
|
200
|
+
text: {
|
|
201
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
202
|
+
label: {
|
|
203
|
+
display: "block",
|
|
204
|
+
marginBottom: "var(--spacing-xs)",
|
|
205
|
+
fontWeight: "500",
|
|
206
|
+
color: "var(--color-text)"
|
|
207
|
+
},
|
|
208
|
+
input: {
|
|
209
|
+
width: "100%",
|
|
210
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
211
|
+
border: "1px solid var(--color-border)",
|
|
212
|
+
borderRadius: "var(--radius-md)",
|
|
213
|
+
fontSize: "0.875rem"
|
|
214
|
+
},
|
|
215
|
+
error: {
|
|
216
|
+
color: "var(--color-error)",
|
|
217
|
+
fontSize: "0.75rem",
|
|
218
|
+
marginTop: "var(--spacing-xs)"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
number: {
|
|
222
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
223
|
+
label: { display: "block", marginBottom: "var(--spacing-xs)", fontWeight: "500" },
|
|
224
|
+
input: {
|
|
225
|
+
width: "100%",
|
|
226
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
227
|
+
border: "1px solid var(--color-border)",
|
|
228
|
+
borderRadius: "var(--radius-md)"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
checkbox: {
|
|
232
|
+
wrapper: { display: "flex", alignItems: "center", gap: "var(--spacing-sm)" },
|
|
233
|
+
input: { width: "1rem", height: "1rem" },
|
|
234
|
+
label: { cursor: "pointer" }
|
|
235
|
+
},
|
|
236
|
+
select: {
|
|
237
|
+
wrapper: { marginBottom: "var(--spacing-md)" },
|
|
238
|
+
input: {
|
|
239
|
+
width: "100%",
|
|
240
|
+
padding: "var(--spacing-sm) var(--spacing-md)",
|
|
241
|
+
border: "1px solid var(--color-border)",
|
|
242
|
+
borderRadius: "var(--radius-md)",
|
|
243
|
+
backgroundColor: "white"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// src/auth/security/context.ts
|
|
249
|
+
function createAuditContext(req) {
|
|
250
|
+
return {
|
|
251
|
+
ipAddress: req.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || req.headers.get("x-real-ip") || "unknown",
|
|
252
|
+
userAgent: req.headers.get("user-agent") || "unknown"
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export { CSSGenerator, createAdminStyling, createAuditContext, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, ecommerce2026Theme, generateCSSVariables, generateTailwindConfig };
|
|
257
|
+
//# sourceMappingURL=chunk-QKOFKITP.js.map
|
|
258
|
+
//# sourceMappingURL=chunk-QKOFKITP.js.map
|