@andymcloid/trakk 1.0.2 → 1.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/src/trakk.css CHANGED
@@ -1,16 +1,42 @@
1
1
  /* Trakk - Timeline Editor Styles */
2
+
3
+ /* CSS Custom Properties - Override these to customize Trakk */
2
4
  .timeline-editor {
5
+ /* Core colors */
6
+ --trakk-bg: #191b1d;
7
+ --trakk-text: #ffffff;
8
+ --trakk-accent: #5297FF;
9
+
10
+ /* Block colors */
11
+ --trakk-block-bg: #2f3134;
12
+ --trakk-block-bg-hover: #3a3d40;
13
+ --trakk-block-bg-selected: #4a7ba7;
14
+
15
+ /* Border & subtle elements */
16
+ --trakk-border: rgba(255, 255, 255, 0.1);
17
+ --trakk-border-strong: rgba(255, 255, 255, 0.3);
18
+
19
+ /* Text variations */
20
+ --trakk-text-muted: rgba(255, 255, 255, 0.6);
21
+ --trakk-text-subtle: rgba(255, 255, 255, 0.4);
22
+
23
+ /* State colors */
24
+ --trakk-danger: #ff6464;
25
+ --trakk-disabled-opacity: 0.6;
26
+ --trakk-locked-opacity: 0.7;
27
+
28
+ /* Base styles */
3
29
  height: 100%;
4
30
  width: 100%;
5
31
  min-height: 100px;
6
32
  position: relative;
7
33
  font-size: 12px;
8
34
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
9
- background-color: #191b1d;
35
+ background-color: var(--trakk-bg);
10
36
  display: flex;
11
37
  flex-direction: column;
12
38
  overflow: hidden;
13
- color: #ffffff;
39
+ color: var(--trakk-text);
14
40
  box-sizing: border-box;
15
41
  user-select: none;
16
42
  }
@@ -20,7 +46,7 @@
20
46
  position: relative;
21
47
  height: 32px;
22
48
  flex: 0 0 auto;
23
- background-color: #191b1d;
49
+ background-color: var(--trakk-bg);
24
50
  overflow: hidden;
25
51
  z-index: 150;
26
52
  }
@@ -41,7 +67,7 @@
41
67
  }
42
68
 
43
69
  .timeline-editor-time-unit {
44
- border-right: 1px solid rgba(255, 255, 255, 0.15);
70
+ border-right: 1px solid var(--trakk-border);
45
71
  position: relative;
46
72
  box-sizing: border-box;
47
73
  height: 6px;
@@ -51,11 +77,11 @@
51
77
 
52
78
  .timeline-editor-time-unit-big {
53
79
  height: 12px;
54
- border-right: 1px solid rgba(255, 255, 255, 0.3);
80
+ border-right: 1px solid var(--trakk-border-strong);
55
81
  }
56
82
 
57
83
  .timeline-editor-time-unit-scale {
58
- color: rgba(255, 255, 255, 0.6);
84
+ color: var(--trakk-text-muted);
59
85
  position: absolute;
60
86
  right: 0;
61
87
  top: 0;
@@ -84,7 +110,7 @@
84
110
 
85
111
  /* Scrollbar - Firefox fallback */
86
112
  .timeline-editor-edit-area {
87
- scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.2);
113
+ scrollbar-color: var(--trakk-border-strong) rgba(0, 0, 0, 0.2);
88
114
  scrollbar-width: auto;
89
115
  }
90
116
 
@@ -100,12 +126,12 @@
100
126
  }
101
127
 
102
128
  .timeline-editor-edit-area::-webkit-scrollbar-thumb {
103
- background-color: rgba(255, 255, 255, 0.3);
129
+ background-color: var(--trakk-border-strong);
104
130
  border-radius: 10px;
105
131
  }
106
132
 
107
133
  .timeline-editor-edit-area::-webkit-scrollbar-thumb:hover {
108
- background-color: rgba(255, 255, 255, 0.45);
134
+ background-color: var(--trakk-text-subtle);
109
135
  }
110
136
 
111
137
  .timeline-editor-edit-area::-webkit-scrollbar-corner {
@@ -116,18 +142,18 @@
116
142
  .timeline-editor-edit-row {
117
143
  --timeline-scale-width: 160px; /* fallback, overridden by JS */
118
144
  background-repeat: no-repeat, repeat;
119
- background-image: linear-gradient(#191b1d, #191b1d), linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 0);
145
+ background-image: linear-gradient(var(--trakk-bg), var(--trakk-bg)), linear-gradient(90deg, var(--trakk-border) 1px, transparent 0);
120
146
  background-size: var(--timeline-scale-width) 100%;
121
147
  display: flex;
122
148
  flex-direction: row;
123
149
  box-sizing: border-box;
124
150
  position: relative;
125
- border-bottom: 1px solid rgba(255, 255, 255, 0.1);
151
+ border-bottom: 1px solid var(--trakk-border);
126
152
  min-height: 32px;
127
153
  }
128
154
 
129
155
  .timeline-editor-edit-row:first-child {
130
- border-top: 1px solid rgba(255, 255, 255, 0.1);
156
+ border-top: 1px solid var(--trakk-border);
131
157
  }
132
158
 
133
159
  .timeline-editor-edit-row::before {
@@ -154,17 +180,17 @@
154
180
  display: flex;
155
181
  align-items: center;
156
182
  padding: 0 8px;
157
- color: rgba(255, 255, 255, 0.7);
183
+ color: var(--trakk-text-muted);
158
184
  font-size: 12px;
159
185
  font-weight: 500;
160
- background-color: #191b1d;
161
- border-right: 1px solid rgba(255, 255, 255, 0.1);
186
+ background-color: var(--trakk-bg);
187
+ border-right: 1px solid var(--trakk-border);
162
188
  z-index: 2;
163
189
  pointer-events: auto;
164
190
  }
165
191
 
166
192
  .timeline-editor-row-label:hover {
167
- color: rgba(255, 255, 255, 0.9);
193
+ color: var(--trakk-text);
168
194
  }
169
195
 
170
196
  .timeline-editor-row-label-locked::after {
@@ -207,11 +233,11 @@
207
233
  }
208
234
 
209
235
  .timeline-editor-row-delete:hover {
210
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(255,100,100,0.9)'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
236
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6464'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
211
237
  }
212
238
 
213
239
  .timeline-editor-action-locked {
214
- opacity: 0.7;
240
+ opacity: var(--trakk-locked-opacity);
215
241
  }
216
242
 
217
243
  .timeline-editor-action-delete {
@@ -235,7 +261,7 @@
235
261
  }
236
262
 
237
263
  .timeline-editor-action-delete:hover {
238
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(255,100,100,0.9)'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
264
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6464'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
239
265
  }
240
266
 
241
267
  /* Action Block */
@@ -243,7 +269,7 @@
243
269
  position: absolute;
244
270
  left: 0;
245
271
  top: 4px;
246
- background-color: #2f3134;
272
+ background-color: var(--trakk-block-bg);
247
273
  border-radius: 4px;
248
274
  cursor: move;
249
275
  user-select: none;
@@ -251,18 +277,18 @@
251
277
  display: flex;
252
278
  align-items: center;
253
279
  justify-content: center;
254
- border: 1px solid rgba(255, 255, 255, 0.1);
280
+ border: 1px solid var(--trakk-border);
255
281
  box-sizing: border-box;
256
282
  transition: background-color 0.2s;
257
283
  }
258
284
 
259
285
  .timeline-editor-action:hover {
260
- background-color: #3a3d40;
286
+ background-color: var(--trakk-block-bg-hover);
261
287
  }
262
288
 
263
289
  .timeline-editor-action.selected {
264
- background-color: #4a7ba7;
265
- border-color: #5297FF;
290
+ background-color: var(--trakk-block-bg-selected);
291
+ border-color: var(--trakk-accent);
266
292
  }
267
293
 
268
294
  .timeline-editor-action-left-stretch,
@@ -295,7 +321,7 @@
295
321
 
296
322
  .timeline-editor-action-left-stretch::after {
297
323
  left: 0;
298
- border-left: 7px solid rgba(255, 255, 255, 0.1);
324
+ border-left: 7px solid var(--trakk-border);
299
325
  border-right: 7px solid transparent;
300
326
  }
301
327
 
@@ -305,7 +331,7 @@
305
331
 
306
332
  .timeline-editor-action-right-stretch::after {
307
333
  right: 0;
308
- border-right: 7px solid rgba(255, 255, 255, 0.1);
334
+ border-right: 7px solid var(--trakk-border);
309
335
  border-left: 7px solid transparent;
310
336
  }
311
337
 
@@ -316,8 +342,8 @@
316
342
  top: 32px;
317
343
  height: calc(100% - 32px);
318
344
  box-sizing: border-box;
319
- border-left: 1px solid #5297FF;
320
- border-right: 1px solid #5297FF;
345
+ border-left: 1px solid var(--trakk-accent);
346
+ border-right: 1px solid var(--trakk-accent);
321
347
  transform: translateX(-50%);
322
348
  pointer-events: none;
323
349
  z-index: 100;
@@ -341,7 +367,7 @@
341
367
  left: 0;
342
368
  width: 8px;
343
369
  height: 12px;
344
- background: #5297FF;
370
+ background: var(--trakk-accent);
345
371
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
346
372
  }
347
373
 
@@ -359,7 +385,7 @@
359
385
  /* Disabled state */
360
386
  .timeline-editor-disable .timeline-editor-action {
361
387
  cursor: not-allowed;
362
- opacity: 0.6;
388
+ opacity: var(--trakk-disabled-opacity);
363
389
  }
364
390
 
365
391
  .timeline-editor-disable .timeline-editor-cursor {
package/src/trakk.js CHANGED
@@ -1264,7 +1264,7 @@ export class Trakk extends HTMLElement {
1264
1264
  // Edit area starts at 0, account for contentPadding, add startLeft for correct time conversion
1265
1265
  const x = e.clientX - rect.left + this._scrollX - contentPadding + this.config.startLeft;
1266
1266
  const time = parserPixelToTime(x, this.config);
1267
- this.callbacks.onClickAction(e, { action, row, time });
1267
+ this.callbacks.onClickAction(e, { action, row, time, button: e.button });
1268
1268
  }
1269
1269
  });
1270
1270
 
@@ -1288,7 +1288,7 @@ export class Trakk extends HTMLElement {
1288
1288
  }
1289
1289
  });
1290
1290
 
1291
- // Context menu event
1291
+ // Context menu event (right-click)
1292
1292
  actionEl.addEventListener('contextmenu', (e) => {
1293
1293
  if (this.callbacks.onContextMenuAction) {
1294
1294
  e.preventDefault();
@@ -1296,7 +1296,7 @@ export class Trakk extends HTMLElement {
1296
1296
  // Edit area starts at 0, account for contentPadding, add startLeft for correct time conversion
1297
1297
  const x = e.clientX - rect.left + this._scrollX - contentPadding + this.config.startLeft;
1298
1298
  const time = parserPixelToTime(x, this.config);
1299
- this.callbacks.onContextMenuAction(e, { action, row, time });
1299
+ this.callbacks.onContextMenuAction(e, { action, row, time, button: e.button });
1300
1300
  }
1301
1301
  });
1302
1302