datool 0.0.3 → 0.0.4

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 CHANGED
@@ -36,7 +36,16 @@ export default defineDatoolConfig({
36
36
  },
37
37
  columns: [
38
38
  { accessorKey: "ts", header: "Timestamp", kind: "date" },
39
- { accessorKey: "level", header: "Level", kind: "enum" },
39
+ {
40
+ accessorKey: "level",
41
+ enumColors: {
42
+ error: "red",
43
+ info: "blue",
44
+ warn: "amber",
45
+ },
46
+ header: "Level",
47
+ kind: "enum",
48
+ },
40
49
  { accessorKey: "message", header: "Message" },
41
50
  { accessorKey: "meta", header: "Meta", kind: "json", truncate: false },
42
51
  ],
@@ -100,7 +109,16 @@ export default defineDatoolConfig({
100
109
  },
101
110
  columns: [
102
111
  { accessorKey: "ts", header: "Timestamp", kind: "date" },
103
- { accessorKey: "level", header: "Level", kind: "enum" },
112
+ {
113
+ accessorKey: "level",
114
+ enumColors: {
115
+ error: "red",
116
+ info: "blue",
117
+ warn: "amber",
118
+ },
119
+ header: "Level",
120
+ kind: "enum",
121
+ },
104
122
  { accessorKey: "message", header: "Message" },
105
123
  { accessorKey: "payload", header: "Payload", kind: "json" },
106
124
  ],
@@ -122,6 +140,25 @@ Each stream defines:
122
140
  - `open({ emit, query, signal })`: opens the underlying line stream
123
141
  - `getRowId(...)`: optional custom row id function
124
142
 
143
+ Enum columns can also define `enumColors` to pin specific values to named badge colors:
144
+
145
+ ```ts
146
+ {
147
+ accessorKey: "level",
148
+ kind: "enum",
149
+ enumColors: {
150
+ error: "red",
151
+ info: "blue",
152
+ warn: "amber",
153
+ },
154
+ }
155
+ ```
156
+
157
+ Available `enumColors` values:
158
+ `"emerald"`, `"purple"`, `"sky"`, `"pink"`, `"red"`, `"zinc"`, `"lime"`, `"violet"`, `"fuchsia"`, `"teal"`, `"amber"`, `"rose"`, `"orange"`, `"cyan"`, `"indigo"`, `"yellow"`, `"green"`, `"coral"`, `"blue"`, `"stone"`.
159
+
160
+ Any enum values not listed in `enumColors` continue using the default rotating color assignment.
161
+
125
162
  ## Row actions
126
163
 
127
164
  Define stream actions in `actions`. Each action: