@alfakit/core 0.1.0 → 0.1.2

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/themes.css CHANGED
@@ -1,3 +1,5 @@
1
+ @import './components.css';
2
+
1
3
  /*
2
4
  * Alfakit themes. Shared by every renderer and imported by their `styles.css`.
3
5
  *
@@ -1004,337 +1006,3 @@
1004
1006
  box-shadow: none;
1005
1007
  outline: none;
1006
1008
  }
1007
-
1008
- /* ------------------------------------------------------------------ Charts */
1009
-
1010
- /*
1011
- * Chart.js paints axes, legends and tooltips on the canvas, so chart widgets read these
1012
- * properties from <html> (re-read when the theme or dark mode changes). Colours take any
1013
- * CSS colour; the widths and radius are unitless numbers. Override them in a theme:
1014
- * :root[data-alfakit-theme~='acme'] { --chart-tooltip-bg: oklch(0.2 0 0); }
1015
- * Stat sparklines (`[data-slot='stat-chart']`) use the `--stat-chart-*` properties.
1016
- */
1017
- :root {
1018
- --chart-text: var(--muted-foreground);
1019
- --chart-grid: var(--border);
1020
- --chart-legend-foreground: var(--muted-foreground);
1021
- --chart-tooltip-bg: var(--popover);
1022
- --chart-tooltip-foreground: var(--popover-foreground);
1023
- --chart-tooltip-border: var(--border);
1024
- --chart-tooltip-border-width: 1;
1025
- --chart-tooltip-radius: 6;
1026
- --stat-chart-stroke-width: 2;
1027
- --stat-chart-fill-opacity: 0.12;
1028
- }
1029
-
1030
- /*
1031
- * RichEditor `grid` column blocks and `lead` / `small` text, in the editor and in rendered
1032
- * content (`RichContentRenderer`). Columns stack on small screens. Stored as
1033
- * `<div data-type="grid" class="alfakit-grid alfakit-grid-cols-2"><div data-type="gridColumn">`
1034
- * and `<p class="alfakit-lead">`; copy these rules when showing content outside a panel.
1035
- */
1036
- :where(.alfakit-grid) {
1037
- display: grid;
1038
- gap: 1rem;
1039
- grid-template-columns: minmax(0, 1fr);
1040
- margin-block: 0.5rem;
1041
- }
1042
- :where(.alfakit-grid-column) {
1043
- min-width: 0;
1044
- }
1045
- :where(.alfakit-grid-column) > :first-child {
1046
- margin-block-start: 0;
1047
- }
1048
- @media (min-width: 768px) {
1049
- :where(.alfakit-grid-cols-2) {
1050
- grid-template-columns: repeat(2, minmax(0, 1fr));
1051
- }
1052
- :where(.alfakit-grid-cols-3) {
1053
- grid-template-columns: repeat(3, minmax(0, 1fr));
1054
- }
1055
- :where(.alfakit-grid-cols-4) {
1056
- grid-template-columns: repeat(4, minmax(0, 1fr));
1057
- }
1058
- :where(.alfakit-grid-cols-5) {
1059
- grid-template-columns: repeat(5, minmax(0, 1fr));
1060
- }
1061
- :where(.alfakit-grid-cols-6) {
1062
- grid-template-columns: repeat(6, minmax(0, 1fr));
1063
- }
1064
- }
1065
- :where([contenteditable] .alfakit-grid-column) {
1066
- border: 1px dashed var(--border);
1067
- border-radius: 0.375rem;
1068
- padding: 0.25rem 0.5rem;
1069
- }
1070
- :where(.alfakit-lead) {
1071
- font-size: 1.125em;
1072
- line-height: 1.6;
1073
- }
1074
- :where(.alfakit-prose small) {
1075
- font-size: 0.8125em;
1076
- }
1077
-
1078
- /* ---------------------------------------------------------- Calendar and tree */
1079
-
1080
- /*
1081
- * The calendar widget (alfasix/alfakit-calendar) draws FullCalendar inside
1082
- * `[data-slot="calendar"]`; FullCalendar reads these `--fc-*` variables, so every theme's
1083
- * tokens (and dark mode) apply. Override them on the slot to restyle one calendar.
1084
- */
1085
- :where(.fc[data-slot='calendar']) {
1086
- --fc-small-font-size: 0.75rem;
1087
- --fc-page-bg-color: var(--card);
1088
- --fc-neutral-bg-color: var(--muted);
1089
- --fc-neutral-text-color: var(--muted-foreground);
1090
- --fc-border-color: var(--border);
1091
- --fc-button-text-color: var(--foreground);
1092
- --fc-button-bg-color: var(--background);
1093
- --fc-button-border-color: var(--border);
1094
- --fc-button-hover-bg-color: var(--accent);
1095
- --fc-button-hover-border-color: var(--border);
1096
- --fc-button-active-bg-color: var(--secondary);
1097
- --fc-button-active-border-color: var(--border);
1098
- --fc-event-bg-color: var(--primary);
1099
- --fc-event-border-color: var(--primary);
1100
- --fc-event-text-color: var(--primary-foreground);
1101
- --fc-event-selected-overlay-color: color-mix(in oklab, var(--foreground) 25%, transparent);
1102
- --fc-more-link-bg-color: var(--muted);
1103
- --fc-more-link-text-color: var(--foreground);
1104
- --fc-non-business-color: color-mix(in oklab, var(--muted) 60%, transparent);
1105
- --fc-bg-event-color: var(--primary);
1106
- --fc-bg-event-opacity: 0.2;
1107
- --fc-highlight-color: color-mix(in oklab, var(--primary) 15%, transparent);
1108
- --fc-today-bg-color: color-mix(in oklab, var(--primary) 6%, transparent);
1109
- --fc-now-indicator-color: var(--destructive);
1110
- --fc-list-event-hover-bg-color: var(--accent);
1111
- color: var(--card-foreground);
1112
- }
1113
- /*
1114
- * FullCalendar puts its `fc` class on the slot element itself and injects its own CSS
1115
- * (`.fc .fc-button`, two classes), so these rules are plain selectors anchored on
1116
- * `.fc[data-slot='calendar']` (three) rather than `:where()`, which would always lose.
1117
- * Restyle one calendar with a more specific selector or with the `--fc-*` variables.
1118
- */
1119
- .fc[data-slot='calendar'] .fc-toolbar-title {
1120
- font-size: 1.125rem;
1121
- font-weight: 600;
1122
- line-height: 1.75rem;
1123
- color: var(--foreground);
1124
- }
1125
- .fc[data-slot='calendar'] .fc-button {
1126
- display: inline-flex;
1127
- align-items: center;
1128
- justify-content: center;
1129
- min-height: 2.25rem;
1130
- padding: 0.375rem 0.75rem;
1131
- border-radius: var(--radius);
1132
- font-size: 0.875rem;
1133
- font-weight: 500;
1134
- line-height: 1.25rem;
1135
- box-shadow: none;
1136
- text-transform: capitalize;
1137
- }
1138
- .fc[data-slot='calendar'] .fc-button .fc-icon {
1139
- font-size: 1.125rem;
1140
- }
1141
- .fc[data-slot='calendar'] .fc-button-group > .fc-button:not(:first-child) {
1142
- border-start-start-radius: 0;
1143
- border-end-start-radius: 0;
1144
- }
1145
- .fc[data-slot='calendar'] .fc-button-group > .fc-button:not(:last-child) {
1146
- border-start-end-radius: 0;
1147
- border-end-end-radius: 0;
1148
- }
1149
- .fc[data-slot='calendar'] .fc-button-primary:disabled {
1150
- opacity: 0.5;
1151
- }
1152
- .fc[data-slot='calendar'] .fc-button-primary:not(:disabled).fc-button-active,
1153
- .fc[data-slot='calendar'] .fc-button-primary:not(:disabled):active {
1154
- color: var(--secondary-foreground);
1155
- }
1156
- .fc[data-slot='calendar'] .fc-button-primary:focus,
1157
- .fc[data-slot='calendar'] .fc-button-primary:not(:disabled).fc-button-active:focus,
1158
- .fc[data-slot='calendar'] .fc-button-primary:not(:disabled):active:focus {
1159
- box-shadow: none;
1160
- }
1161
- .fc[data-slot='calendar'] .fc-button:focus-visible {
1162
- outline: 2px solid var(--ring);
1163
- outline-offset: 2px;
1164
- z-index: 2;
1165
- }
1166
- .fc[data-slot='calendar'] a {
1167
- color: inherit;
1168
- }
1169
- .fc[data-slot='calendar'] .fc-daygrid-day-number,
1170
- .fc[data-slot='calendar'] .fc-col-header-cell-cushion {
1171
- text-decoration: none;
1172
- }
1173
- .fc[data-slot='calendar'] .fc-col-header-cell-cushion {
1174
- padding-block: 0.375rem;
1175
- font-size: 0.75rem;
1176
- font-weight: 500;
1177
- color: var(--muted-foreground);
1178
- }
1179
- .fc[data-slot='calendar'] .fc-daygrid-day-number {
1180
- font-size: 0.875rem;
1181
- }
1182
- .fc[data-slot='calendar'] .fc-day-other .fc-daygrid-day-number {
1183
- color: var(--muted-foreground);
1184
- }
1185
- /* Today: a tinted cell (`--fc-today-bg-color`) and the date in a primary pill. */
1186
- .fc[data-slot='calendar'] .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
1187
- display: inline-flex;
1188
- align-items: center;
1189
- justify-content: center;
1190
- min-width: 1.75rem;
1191
- height: 1.75rem;
1192
- margin: 0.25rem;
1193
- padding: 0 0.375rem;
1194
- border-radius: 9999px;
1195
- background: var(--primary);
1196
- color: var(--primary-foreground);
1197
- font-weight: 600;
1198
- }
1199
- .fc[data-slot='calendar'] .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
1200
- color: var(--primary);
1201
- font-weight: 600;
1202
- }
1203
- .fc[data-slot='calendar'] .fc-event {
1204
- border-radius: min(var(--radius), 0.375rem);
1205
- }
1206
- .fc[data-slot='calendar'] .fc-daygrid-event,
1207
- .fc[data-slot='calendar'] .fc-timegrid-event .fc-event-main,
1208
- .fc[data-slot='calendar'] .fc-list-event td {
1209
- font-size: 0.75rem;
1210
- }
1211
- .fc[data-slot='calendar'] .fc-daygrid-dot-event:hover,
1212
- .fc[data-slot='calendar'] .fc-daygrid-dot-event.fc-event-mirror {
1213
- background: var(--accent);
1214
- }
1215
- .fc[data-slot='calendar'] .fc-list-day-cushion,
1216
- .fc[data-slot='calendar'] .fc-popover-header {
1217
- color: var(--foreground);
1218
- }
1219
- .fc[data-slot='calendar'] .fc-popover {
1220
- border-radius: var(--radius);
1221
- box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
1222
- overflow: hidden;
1223
- }
1224
- .fc[data-slot='calendar'] .fc-timegrid-slot-label,
1225
- .fc[data-slot='calendar'] .fc-timegrid-axis,
1226
- .fc[data-slot='calendar'] .fc-list-event-time {
1227
- color: var(--muted-foreground);
1228
- font-size: 0.75rem;
1229
- }
1230
- /*
1231
- * The list view hides its column headers for screen readers with `left: -10000px`. Right to
1232
- * left that is scrollable overflow: the whole page gains a 10 000 px horizontal scroll and the
1233
- * top bar slides under the sidebar. Clip it in place instead (still read by screen readers).
1234
- */
1235
- .fc[data-slot='calendar'] .fc-list-table thead {
1236
- left: auto;
1237
- inset-inline-start: 0;
1238
- width: 1px;
1239
- height: 1px;
1240
- overflow: hidden;
1241
- clip-path: inset(50%);
1242
- white-space: nowrap;
1243
- }
1244
-
1245
- /*
1246
- * Fields contain what they position. Headless switches, checkboxes and radios render a
1247
- * visually hidden native input beside the control, absolutely positioned (and shifted by
1248
- * -100%); without a positioned field it lands at the page edge and, right to left, widens
1249
- * the page on phones.
1250
- */
1251
- :where([data-slot='field']) {
1252
- position: relative;
1253
- }
1254
-
1255
- /*
1256
- * Narrow screens: FullCalendar keeps its header toolbar on one row, wider than a phone.
1257
- * Its chunks (navigation, title, views) wrap instead, and the title shrinks. Flex gaps and
1258
- * `justify-content` follow the writing direction, so this works right to left too. (Plain
1259
- * selectors: FullCalendar injects its own CSS, which would beat `:where()`; the slot is
1260
- * the `.fc` element itself.)
1261
- */
1262
- @media (max-width: 39.99rem) {
1263
- [data-slot='calendar'] .fc-toolbar.fc-header-toolbar {
1264
- flex-wrap: wrap;
1265
- gap: 0.5rem;
1266
- }
1267
- [data-slot='calendar'] .fc-toolbar .fc-toolbar-chunk {
1268
- display: flex;
1269
- flex-wrap: wrap;
1270
- align-items: center;
1271
- gap: 0.25rem;
1272
- min-width: 0;
1273
- }
1274
- [data-slot='calendar'] .fc-toolbar .fc-toolbar-title {
1275
- font-size: 1rem;
1276
- overflow-wrap: anywhere;
1277
- }
1278
- [data-slot='calendar'] .fc-toolbar .fc-button {
1279
- font-size: 0.8125rem;
1280
- }
1281
- }
1282
-
1283
- /*
1284
- * The tree (alfasix/alfakit-tree): the drop indicator while dragging. Rows carry
1285
- * `data-drop="before|after|inside"`; lines are drawn above or below the row, so they
1286
- * need no direction.
1287
- */
1288
- :where([data-slot='tree-item'][data-drop='before']) {
1289
- box-shadow: inset 0 2px 0 0 var(--primary);
1290
- }
1291
- :where([data-slot='tree-item'][data-drop='after']) {
1292
- box-shadow: inset 0 -2px 0 0 var(--primary);
1293
- }
1294
- :where([data-slot='tree-item'][data-drop='inside']) {
1295
- background-color: color-mix(in oklab, var(--primary) 10%, transparent);
1296
- outline: 1px dashed var(--primary);
1297
- outline-offset: -1px;
1298
- }
1299
-
1300
- /*
1301
- * The Kanban board (alfasix/alfakit-kanban). A card being dragged leaves a dashed
1302
- * placeholder (`data-picked="pointer"`) while a copy follows the pointer
1303
- * (`data-slot="kanban-ghost"`); a card picked up with the keyboard is lifted
1304
- * (`data-picked="keyboard"`). A list the picked card may not enter has `data-refused`.
1305
- */
1306
- :where([data-slot='kanban-card'][data-picked='pointer']) {
1307
- opacity: 0.45;
1308
- }
1309
- :where([data-slot='kanban-card'][data-picked='pointer'] > [data-slot='kanban-card-body']) {
1310
- border-style: dashed;
1311
- box-shadow: none;
1312
- }
1313
- :where([data-slot='kanban-card'][data-picked='keyboard'] > [data-slot='kanban-card-body']) {
1314
- outline: 2px solid var(--primary);
1315
- outline-offset: 2px;
1316
- box-shadow: 0 10px 24px -12px color-mix(in oklab, var(--foreground) 45%, transparent);
1317
- }
1318
- :where([data-slot='kanban-card'][data-saving]) {
1319
- opacity: 0.7;
1320
- }
1321
- :where([data-slot='kanban-ghost']) {
1322
- cursor: grabbing;
1323
- list-style: none;
1324
- box-shadow: 0 18px 40px -16px color-mix(in oklab, var(--foreground) 55%, transparent);
1325
- }
1326
- :where([data-slot='kanban-dropzone'][data-refused]) {
1327
- background-color: color-mix(in oklab, var(--destructive) 8%, transparent);
1328
- outline: 1px dashed var(--destructive);
1329
- outline-offset: -1px;
1330
- }
1331
- :where(body[data-kanban-dragging]) {
1332
- cursor: grabbing;
1333
- user-select: none;
1334
- -webkit-user-select: none;
1335
- }
1336
- @media (prefers-reduced-motion: reduce) {
1337
- :where([data-slot='kanban-card'] > [data-slot='kanban-card-body']) {
1338
- transition: none;
1339
- }
1340
- }