@kidecms/core 0.23.1 → 0.24.0
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/admin/admin-base.css +312 -0
- package/internals/integration.ts +6 -17
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/* Admin chrome — owned by @kidecms/core and updated with it. The project's
|
|
2
|
+
src/styles/admin.css defines only the color tokens this file consumes;
|
|
3
|
+
everything mechanical (layers, focus, editor styles, variants) lives here. */
|
|
4
|
+
@import "tailwindcss";
|
|
5
|
+
@custom-variant dark (&:is(.dark *));
|
|
6
|
+
|
|
7
|
+
/* Token → utility wiring. Which tokens exist is core's contract; their values
|
|
8
|
+
come from the project's :root/.dark blocks. */
|
|
9
|
+
@theme inline {
|
|
10
|
+
--breakpoint-2xl: 100rem; /* 1600px */
|
|
11
|
+
|
|
12
|
+
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
13
|
+
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", monospace;
|
|
14
|
+
|
|
15
|
+
--color-background: var(--background);
|
|
16
|
+
--color-foreground: var(--foreground);
|
|
17
|
+
--color-card: var(--card);
|
|
18
|
+
--color-card-foreground: var(--card-foreground);
|
|
19
|
+
--color-popover: var(--popover);
|
|
20
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
21
|
+
--color-primary: var(--primary);
|
|
22
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
23
|
+
--color-secondary: var(--secondary);
|
|
24
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
25
|
+
--color-muted: var(--muted);
|
|
26
|
+
--color-muted-strong: var(--muted-strong);
|
|
27
|
+
--color-field: var(--field);
|
|
28
|
+
--color-field-subtle: var(--field-subtle);
|
|
29
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
30
|
+
--color-accent: var(--accent);
|
|
31
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
32
|
+
--color-destructive: var(--destructive);
|
|
33
|
+
--color-border: var(--border);
|
|
34
|
+
--color-input: var(--input);
|
|
35
|
+
--color-ring: var(--ring);
|
|
36
|
+
--color-chart-1: var(--chart-1);
|
|
37
|
+
--color-chart-2: var(--chart-2);
|
|
38
|
+
--color-chart-3: var(--chart-3);
|
|
39
|
+
--color-chart-4: var(--chart-4);
|
|
40
|
+
--color-chart-5: var(--chart-5);
|
|
41
|
+
--color-sidebar: var(--sidebar);
|
|
42
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
43
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
44
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
45
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
46
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
47
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
48
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
49
|
+
|
|
50
|
+
--radius-sm: calc(var(--radius) - 2px);
|
|
51
|
+
--radius-md: var(--radius);
|
|
52
|
+
--radius-lg: calc(var(--radius) + 2px);
|
|
53
|
+
--radius-xl: calc(var(--radius) + 6px);
|
|
54
|
+
|
|
55
|
+
/* shadcn component styles (accordion, state variants) */
|
|
56
|
+
@keyframes accordion-down {
|
|
57
|
+
from {
|
|
58
|
+
height: 0;
|
|
59
|
+
}
|
|
60
|
+
to {
|
|
61
|
+
height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
@keyframes accordion-up {
|
|
65
|
+
from {
|
|
66
|
+
height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
|
|
67
|
+
}
|
|
68
|
+
to {
|
|
69
|
+
height: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@custom-variant data-open {
|
|
75
|
+
&:where([data-state="open"]),
|
|
76
|
+
&:where([data-open]:not([data-open="false"])) {
|
|
77
|
+
@slot;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@custom-variant data-closed {
|
|
81
|
+
&:where([data-state="closed"]),
|
|
82
|
+
&:where([data-closed]:not([data-closed="false"])) {
|
|
83
|
+
@slot;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
@custom-variant data-checked {
|
|
87
|
+
&:where([data-state="checked"]),
|
|
88
|
+
&:where([data-checked]:not([data-checked="false"])) {
|
|
89
|
+
@slot;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
@custom-variant data-unchecked {
|
|
93
|
+
&:where([data-state="unchecked"]),
|
|
94
|
+
&:where([data-unchecked]:not([data-unchecked="false"])) {
|
|
95
|
+
@slot;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
@custom-variant data-selected {
|
|
99
|
+
&:where([data-selected="true"]) {
|
|
100
|
+
@slot;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
@custom-variant data-disabled {
|
|
104
|
+
&:where([data-disabled="true"]),
|
|
105
|
+
&:where([data-disabled]:not([data-disabled="false"])) {
|
|
106
|
+
@slot;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
@custom-variant data-active {
|
|
110
|
+
&:where([data-state="active"]),
|
|
111
|
+
&:where([data-active]:not([data-active="false"])) {
|
|
112
|
+
@slot;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
@custom-variant data-horizontal {
|
|
116
|
+
&:where([data-orientation="horizontal"]) {
|
|
117
|
+
@slot;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
@custom-variant data-vertical {
|
|
121
|
+
&:where([data-orientation="vertical"]) {
|
|
122
|
+
@slot;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
@utility no-scrollbar {
|
|
126
|
+
-ms-overflow-style: none;
|
|
127
|
+
scrollbar-width: none;
|
|
128
|
+
&::-webkit-scrollbar {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@layer base {
|
|
134
|
+
* {
|
|
135
|
+
@apply border-border outline-ring/50;
|
|
136
|
+
}
|
|
137
|
+
body {
|
|
138
|
+
@apply bg-background text-foreground;
|
|
139
|
+
}
|
|
140
|
+
html {
|
|
141
|
+
@apply font-sans;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ════════════════════════════════════════════════════════════════════════
|
|
146
|
+
FOCUS — one universal rule for the whole admin.
|
|
147
|
+
Every focusable element (input, button, link, checkbox, radio, [tabindex],
|
|
148
|
+
contenteditable, …) gets the same ring automatically. There is nothing to
|
|
149
|
+
add per component. To restyle focus everywhere, change the three
|
|
150
|
+
--focus-ring-* vars in the project's admin.css. Nothing else sets focus styles.
|
|
151
|
+
════════════════════════════════════════════════════════════════════════ */
|
|
152
|
+
*:focus-visible {
|
|
153
|
+
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
|
154
|
+
outline-offset: var(--focus-ring-offset);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Rich-text editor: the focusable element is the inner contenteditable, but we
|
|
158
|
+
want the ring around the whole bordered box. Ring the container instead, and
|
|
159
|
+
suppress it while a toolbar button has focus (the button shows its own ring). */
|
|
160
|
+
.tiptap:focus-visible {
|
|
161
|
+
outline: none;
|
|
162
|
+
}
|
|
163
|
+
[data-slot="editor"]:focus-within:not(:has([data-slot="button"]:focus-visible)) {
|
|
164
|
+
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
|
165
|
+
outline-offset: var(--focus-ring-offset);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Menus / selects / command palette: items show focus as a background highlight,
|
|
169
|
+
not the ring; and a popup trigger must not keep the ring while its popup is
|
|
170
|
+
open (base-ui re-focuses the trigger on pointer interaction, which would
|
|
171
|
+
otherwise trip :focus-visible). Keyboard focus on the trigger itself, when
|
|
172
|
+
closed, still gets the normal ring. */
|
|
173
|
+
[data-slot="dropdown-menu-item"]:focus-visible,
|
|
174
|
+
[data-slot="dropdown-menu-sub-trigger"]:focus-visible,
|
|
175
|
+
[data-slot="select-item"]:focus-visible,
|
|
176
|
+
[data-slot="command-item"]:focus-visible,
|
|
177
|
+
[data-popup-open]:focus-visible {
|
|
178
|
+
outline: none;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ── Dark mode: native input controls, select arrow, focus ring ──── */
|
|
182
|
+
.dark input::-webkit-calendar-picker-indicator {
|
|
183
|
+
filter: invert(1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.dark select {
|
|
187
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.dark *:focus-visible {
|
|
191
|
+
--tw-ring-offset-color: var(--surface);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ── Strip focus styles from command input ────────────────────────── */
|
|
195
|
+
[data-slot="command-input"] {
|
|
196
|
+
border: none;
|
|
197
|
+
background: transparent;
|
|
198
|
+
padding: 0;
|
|
199
|
+
box-shadow: none;
|
|
200
|
+
outline: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
[data-slot="command-input"]:focus,
|
|
204
|
+
[data-slot="command-input"]:focus-visible {
|
|
205
|
+
border: none;
|
|
206
|
+
box-shadow: none;
|
|
207
|
+
outline: none;
|
|
208
|
+
--tw-ring-shadow: none;
|
|
209
|
+
--tw-ring-offset-shadow: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* ── Tiptap editor styles ────────────────────────────────────────── */
|
|
213
|
+
/* Content typography only — block-card form UI ([data-node-view-wrapper]) is excluded,
|
|
214
|
+
since these unlayered rules would beat its layered Tailwind utilities. The second
|
|
215
|
+
selector re-includes rich-text sub-fields (a nested .tiptap inside a block card). */
|
|
216
|
+
.tiptap {
|
|
217
|
+
outline: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.tiptap p:not([data-node-view-wrapper] *),
|
|
221
|
+
[data-node-view-wrapper] .tiptap p {
|
|
222
|
+
margin: 0.5em 0;
|
|
223
|
+
color: inherit;
|
|
224
|
+
font-size: inherit;
|
|
225
|
+
line-height: 1.6;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Command hint on the empty field / the cursor's empty paragraph ("Type / for commands…"). */
|
|
229
|
+
.tiptap p.is-empty::before {
|
|
230
|
+
content: attr(data-placeholder);
|
|
231
|
+
color: var(--placeholder);
|
|
232
|
+
pointer-events: none;
|
|
233
|
+
float: left;
|
|
234
|
+
height: 0;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.tiptap h2:not([data-node-view-wrapper] *),
|
|
238
|
+
[data-node-view-wrapper] .tiptap h2 {
|
|
239
|
+
font-size: 1.25rem;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
margin: 1em 0 0.5em;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.tiptap h3:not([data-node-view-wrapper] *),
|
|
245
|
+
[data-node-view-wrapper] .tiptap h3 {
|
|
246
|
+
font-size: 1.1rem;
|
|
247
|
+
font-weight: 600;
|
|
248
|
+
margin: 0.75em 0 0.4em;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.tiptap ul:not([data-node-view-wrapper] *),
|
|
252
|
+
[data-node-view-wrapper] .tiptap ul {
|
|
253
|
+
padding-left: 1.5em;
|
|
254
|
+
margin: 0.5em 0;
|
|
255
|
+
list-style-type: disc;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.tiptap ol:not([data-node-view-wrapper] *),
|
|
259
|
+
[data-node-view-wrapper] .tiptap ol {
|
|
260
|
+
padding-left: 1.5em;
|
|
261
|
+
margin: 0.5em 0;
|
|
262
|
+
list-style-type: decimal;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.tiptap li:not([data-node-view-wrapper] *),
|
|
266
|
+
[data-node-view-wrapper] .tiptap li {
|
|
267
|
+
margin: 0.2em 0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.tiptap blockquote:not([data-node-view-wrapper] *),
|
|
271
|
+
[data-node-view-wrapper] .tiptap blockquote {
|
|
272
|
+
border-left: 3px solid var(--border);
|
|
273
|
+
padding-left: 1em;
|
|
274
|
+
margin: 0.5em 0;
|
|
275
|
+
color: var(--muted-foreground);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* ── Toast animations ────────────────────────────────────────────── */
|
|
279
|
+
@keyframes toast-in {
|
|
280
|
+
from {
|
|
281
|
+
opacity: 0;
|
|
282
|
+
transform: translateY(-12px) scale(0.96);
|
|
283
|
+
}
|
|
284
|
+
to {
|
|
285
|
+
opacity: 1;
|
|
286
|
+
transform: translateY(0) scale(1);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
@keyframes toast-out {
|
|
290
|
+
from {
|
|
291
|
+
opacity: 1;
|
|
292
|
+
transform: translateY(0) scale(1);
|
|
293
|
+
}
|
|
294
|
+
to {
|
|
295
|
+
opacity: 0;
|
|
296
|
+
transform: translateY(-8px) scale(0.96);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* ── Dark mode: Tiptap placeholder ───────────────────────────────── */
|
|
301
|
+
.dark .tiptap p.is-empty::before {
|
|
302
|
+
color: var(--placeholder) !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* Fallback marker for a rejected field with no native invalid styling — composite
|
|
306
|
+
controls (pickers, block and rich-text editors) whose focusable element is not
|
|
307
|
+
an input. Anything with [aria-invalid] styles itself and never gets this. */
|
|
308
|
+
[data-cms-invalid]:not([aria-invalid]) {
|
|
309
|
+
outline: 1px solid var(--destructive);
|
|
310
|
+
outline-offset: 3px;
|
|
311
|
+
border-radius: var(--radius-lg);
|
|
312
|
+
}
|
package/internals/integration.ts
CHANGED
|
@@ -116,9 +116,13 @@ export default function cmsIntegration(options?: CmsIntegrationOptions): AstroIn
|
|
|
116
116
|
"astro:config:setup": ({ command, updateConfig, injectRoute, injectScript, addMiddleware }) => {
|
|
117
117
|
const root = process.cwd();
|
|
118
118
|
|
|
119
|
-
// Generate a wrapper CSS
|
|
119
|
+
// Generate a wrapper CSS: Tailwind sources + the core admin chrome +
|
|
120
|
+
// the project's theme file. Chrome (layers, focus, editor styles,
|
|
121
|
+
// variants) is core-owned and updates with the package; the project
|
|
122
|
+
// file defines only color tokens.
|
|
120
123
|
const adminDir = packagePath("admin");
|
|
121
124
|
const routesDir = packagePath("routes");
|
|
125
|
+
const adminBaseCss = path.join(adminDir, "admin-base.css");
|
|
122
126
|
// tw-animate-css is a CSS-only package (exports only a "style" condition),
|
|
123
127
|
// so Node resolution can't reach into it — walk the module paths instead.
|
|
124
128
|
const twAnimateCssPath = resolvePackageFile("tw-animate-css", "dist/tw-animate.css");
|
|
@@ -131,25 +135,10 @@ export default function cmsIntegration(options?: CmsIntegrationOptions): AstroIn
|
|
|
131
135
|
[
|
|
132
136
|
`@source "${adminDir}";`,
|
|
133
137
|
`@source "${routesDir}";`,
|
|
138
|
+
`@import "${adminBaseCss}";`,
|
|
134
139
|
`@import "${twAnimateCssPath}";`,
|
|
135
140
|
`@import "${userAdminCss}";`,
|
|
136
141
|
"",
|
|
137
|
-
"/* shadcn component styles (accordion, state variants) */",
|
|
138
|
-
"@theme inline {",
|
|
139
|
-
" @keyframes accordion-down { from { height: 0 } to { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)) } }",
|
|
140
|
-
" @keyframes accordion-up { from { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)) } to { height: 0 } }",
|
|
141
|
-
"}",
|
|
142
|
-
'@custom-variant data-open { &:where([data-state="open"]), &:where([data-open]:not([data-open="false"])) { @slot; } }',
|
|
143
|
-
'@custom-variant data-closed { &:where([data-state="closed"]), &:where([data-closed]:not([data-closed="false"])) { @slot; } }',
|
|
144
|
-
'@custom-variant data-checked { &:where([data-state="checked"]), &:where([data-checked]:not([data-checked="false"])) { @slot; } }',
|
|
145
|
-
'@custom-variant data-unchecked { &:where([data-state="unchecked"]), &:where([data-unchecked]:not([data-unchecked="false"])) { @slot; } }',
|
|
146
|
-
'@custom-variant data-selected { &:where([data-selected="true"]) { @slot; } }',
|
|
147
|
-
'@custom-variant data-disabled { &:where([data-disabled="true"]), &:where([data-disabled]:not([data-disabled="false"])) { @slot; } }',
|
|
148
|
-
'@custom-variant data-active { &:where([data-state="active"]), &:where([data-active]:not([data-active="false"])) { @slot; } }',
|
|
149
|
-
'@custom-variant data-horizontal { &:where([data-orientation="horizontal"]) { @slot; } }',
|
|
150
|
-
'@custom-variant data-vertical { &:where([data-orientation="vertical"]) { @slot; } }',
|
|
151
|
-
"@utility no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } }",
|
|
152
|
-
"",
|
|
153
142
|
].join("\n"),
|
|
154
143
|
);
|
|
155
144
|
|