@rogatio/cli 5.11.2 → 5.13.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.
@@ -39,8 +39,12 @@
39
39
  --rogatio-surface: #161b22;
40
40
  --rogatio-surface-raised: #1c222c;
41
41
  --rogatio-surface-inset: #10131a;
42
- --rogatio-primary: #007aff;
43
- --rogatio-primary-strong: #0066d6;
42
+ --rogatio-card-group: #171d28;
43
+ --rogatio-card-rule: #1a222e;
44
+ --rogatio-card-rule-edge: #2ec4b6;
45
+ --rogatio-primary: #3b9eff;
46
+ --rogatio-primary-strong: #1f87f0;
47
+ --rogatio-primary-bg: rgba(59, 158, 255, 0.16);
44
48
  --rogatio-secondary: #64748b;
45
49
  --rogatio-tertiary: #0f172a;
46
50
  --rogatio-neutral: #1e293b;
@@ -48,8 +52,9 @@
48
52
  --rogatio-muted: #94a3b8;
49
53
  --rogatio-faint: #64748b;
50
54
  --rogatio-border: rgba(148, 163, 184, 0.16);
51
- --rogatio-danger: #f87171;
52
- --rogatio-danger-bg: rgba(248, 113, 113, 0.12);
55
+ --rogatio-danger: #f07178;
56
+ --rogatio-danger-strong: #e2555d;
57
+ --rogatio-danger-bg: rgba(240, 113, 120, 0.12);
53
58
  --rogatio-success: #4ade80;
54
59
  --rogatio-success-bg: rgba(74, 222, 128, 0.12);
55
60
  --rogatio-warning: #fbbf24;
@@ -100,7 +105,8 @@
100
105
  transition:
101
106
  background-color 120ms ease,
102
107
  border-color 120ms ease,
103
- color 120ms ease;
108
+ color 120ms ease,
109
+ box-shadow 120ms ease;
104
110
  }
105
111
  .rogatio-editor button:hover:not(:disabled) {
106
112
  background: var(--rogatio-surface-raised);
@@ -110,6 +116,37 @@
110
116
  cursor: not-allowed;
111
117
  opacity: 0.55;
112
118
  }
119
+ .rogatio-editor button[data-btn=primary] {
120
+ border-color: transparent;
121
+ background: var(--rogatio-primary);
122
+ color: #061018;
123
+ font-weight: 700;
124
+ }
125
+ .rogatio-editor button[data-btn=primary]:hover:not(:disabled) {
126
+ background: var(--rogatio-primary-strong);
127
+ border-color: transparent;
128
+ color: #061018;
129
+ box-shadow: 0 0 0 3px var(--rogatio-primary-bg);
130
+ }
131
+ .rogatio-editor button[data-btn=secondary] {
132
+ border-color: rgba(148, 163, 184, 0.28);
133
+ background: transparent;
134
+ color: var(--rogatio-text);
135
+ }
136
+ .rogatio-editor button[data-btn=secondary]:hover:not(:disabled) {
137
+ background: var(--rogatio-surface-raised);
138
+ border-color: rgba(148, 163, 184, 0.4);
139
+ }
140
+ .rogatio-editor button[data-btn=danger] {
141
+ border-color: rgba(240, 113, 120, 0.35);
142
+ background: var(--rogatio-danger-bg);
143
+ color: var(--rogatio-danger);
144
+ }
145
+ .rogatio-editor button[data-btn=danger]:hover:not(:disabled) {
146
+ border-color: var(--rogatio-danger);
147
+ background: rgba(240, 113, 120, 0.22);
148
+ color: #fecaca;
149
+ }
113
150
  .rogatio-editor :focus-visible {
114
151
  outline: 3px solid var(--rogatio-primary);
115
152
  outline-offset: 2px;
@@ -128,8 +165,9 @@
128
165
  align-items: center;
129
166
  gap: 0.35rem;
130
167
  border-bottom: 1px solid var(--rogatio-border);
131
- background: var(--rogatio-surface);
168
+ background: color-mix(in srgb, var(--rogatio-surface) 92%, #000);
132
169
  padding: 0.6rem 1rem;
170
+ backdrop-filter: blur(8px);
133
171
  }
134
172
  .rogatio-editor [data-desktop-route-rail] button {
135
173
  border: 1px solid transparent;
@@ -143,8 +181,8 @@
143
181
  color: var(--rogatio-text);
144
182
  }
145
183
  .rogatio-editor [data-desktop-route-rail] button[aria-current=page] {
146
- border-color: rgba(0, 122, 255, 0.45);
147
- background: rgba(0, 122, 255, 0.14);
184
+ border-color: rgba(59, 158, 255, 0.45);
185
+ background: var(--rogatio-primary-bg);
148
186
  color: var(--rogatio-text);
149
187
  font-weight: 700;
150
188
  }
@@ -240,6 +278,10 @@
240
278
  flex-wrap: wrap;
241
279
  gap: 0.5rem;
242
280
  margin-block: 1rem;
281
+ padding: 0.65rem 0.75rem;
282
+ border: 1px solid var(--rogatio-border);
283
+ border-radius: var(--rogatio-radius);
284
+ background: var(--rogatio-surface-raised);
243
285
  }
244
286
  .rogatio-editor [data-editor-form] {
245
287
  display: grid;
@@ -249,7 +291,7 @@
249
291
  min-width: 0;
250
292
  border: 1px solid var(--rogatio-border);
251
293
  border-radius: var(--rogatio-radius);
252
- background: var(--rogatio-surface);
294
+ background: var(--rogatio-card-group);
253
295
  padding: 1rem;
254
296
  }
255
297
  .rogatio-editor legend {
@@ -287,34 +329,131 @@
287
329
  align-items: end;
288
330
  margin-bottom: 0.5rem;
289
331
  }
332
+ .rogatio-editor [data-editor-hint] {
333
+ margin: 0 0 0.75rem;
334
+ color: var(--rogatio-muted);
335
+ font-size: 0.8125rem;
336
+ }
337
+ .rogatio-editor [data-editor-check-groups] {
338
+ display: grid;
339
+ gap: 0.85rem;
340
+ }
341
+ .rogatio-editor [data-editor-check-group-label] {
342
+ margin: 0 0 0.35rem;
343
+ font-weight: 700;
344
+ font-family: var(--rogatio-font-mono);
345
+ font-size: 0.75rem;
346
+ text-transform: uppercase;
347
+ letter-spacing: 0.06em;
348
+ color: var(--rogatio-muted);
349
+ }
290
350
  .rogatio-editor [data-editor-checks] {
291
351
  display: grid;
292
- grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
293
- gap: 0.35rem 0.7rem;
352
+ grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
353
+ gap: 0.45rem 0.7rem;
294
354
  }
295
355
  .rogatio-editor [data-editor-checks] label {
296
356
  display: flex;
297
357
  gap: 0.4rem;
298
- align-items: center;
358
+ align-items: flex-start;
299
359
  font-weight: 500;
300
360
  color: var(--rogatio-muted);
301
361
  }
362
+ .rogatio-editor [data-editor-check-text] {
363
+ display: grid;
364
+ gap: 0.1rem;
365
+ min-width: 0;
366
+ }
367
+ .rogatio-editor [data-editor-check-text] small {
368
+ font-weight: 400;
369
+ font-size: 0.75rem;
370
+ line-height: 1.25;
371
+ color: var(--rogatio-muted);
372
+ }
373
+ .rogatio-editor [data-group-heading],
374
+ .rogatio-editor [data-section-heading],
375
+ .rogatio-editor [data-rule-heading] {
376
+ display: flex;
377
+ flex-wrap: wrap;
378
+ align-items: center;
379
+ justify-content: space-between;
380
+ gap: 0.65rem;
381
+ }
382
+ .rogatio-editor [data-group-heading] h2,
383
+ .rogatio-editor [data-section-heading] h2,
384
+ .rogatio-editor [data-rule-heading] h3 {
385
+ margin: 0;
386
+ min-width: 0;
387
+ }
388
+ .rogatio-editor [data-group-list] {
389
+ list-style: none;
390
+ margin: 0;
391
+ padding: 0;
392
+ display: grid;
393
+ gap: 0.5rem;
394
+ }
395
+ .rogatio-editor [data-group-row] {
396
+ display: flex;
397
+ flex-wrap: wrap;
398
+ align-items: center;
399
+ justify-content: space-between;
400
+ gap: 0.5rem;
401
+ border: 1px solid var(--rogatio-border);
402
+ border-radius: var(--rogatio-radius);
403
+ background: var(--rogatio-card-group);
404
+ padding: 0.65rem 0.85rem;
405
+ }
406
+ .rogatio-editor [data-group-card] {
407
+ background: var(--rogatio-card-group);
408
+ border-color: rgba(148, 163, 184, 0.2);
409
+ }
410
+ .rogatio-editor [data-rules-section] {
411
+ display: grid;
412
+ gap: 0.85rem;
413
+ }
414
+ .rogatio-editor [data-rule-list] {
415
+ display: grid;
416
+ gap: 1rem;
417
+ }
418
+ .rogatio-editor [data-empty-rules] {
419
+ margin: 0;
420
+ color: var(--rogatio-muted);
421
+ border: 1px dashed var(--rogatio-border);
422
+ border-radius: var(--rogatio-radius);
423
+ padding: 1rem;
424
+ background: var(--rogatio-surface-inset);
425
+ }
302
426
  .rogatio-editor [data-rule-card] {
303
427
  display: grid;
304
428
  gap: 1rem;
305
- border: 1px solid var(--rogatio-border);
429
+ border: 1px solid rgba(46, 196, 182, 0.22);
430
+ border-left: 3px solid var(--rogatio-card-rule-edge);
306
431
  border-radius: var(--rogatio-radius);
307
- background: var(--rogatio-surface);
432
+ background:
433
+ linear-gradient(
434
+ 180deg,
435
+ color-mix(in srgb, var(--rogatio-card-rule) 92%, #2ec4b6) 0%,
436
+ var(--rogatio-card-rule) 2.5rem);
308
437
  padding: 1rem;
438
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
309
439
  }
310
440
  .rogatio-editor [data-rule-card] h3 {
311
441
  margin: 0;
312
442
  font-weight: 700;
313
443
  }
444
+ .rogatio-editor [data-rule-card] > fieldset {
445
+ background: color-mix(in srgb, var(--rogatio-surface-inset) 55%, transparent);
446
+ border-color: rgba(148, 163, 184, 0.14);
447
+ }
314
448
  .rogatio-editor [data-rule-actions] {
315
449
  display: flex;
316
450
  flex-wrap: wrap;
317
- gap: 0.5rem;
451
+ gap: 0.4rem;
452
+ justify-content: flex-end;
453
+ }
454
+ .rogatio-editor [data-rule-actions] button {
455
+ font-size: 0.8125rem;
456
+ padding: 0.35rem 0.55rem;
318
457
  }
319
458
  .rogatio-editor [data-search-results] {
320
459
  margin-block: 1rem;
@@ -352,7 +491,7 @@
352
491
  width: min(32rem, 100%);
353
492
  border: 1px solid var(--rogatio-border);
354
493
  border-radius: var(--rogatio-radius);
355
- background: var(--rogatio-surface);
494
+ background: var(--rogatio-surface-raised);
356
495
  box-shadow: 0 20px 50px rgb(0 0 0 / 45%);
357
496
  padding: 1rem;
358
497
  }
@@ -433,6 +572,15 @@
433
572
  .rogatio-editor [data-editor-header] {
434
573
  grid-template-columns: 1fr;
435
574
  }
575
+ .rogatio-editor [data-rule-heading],
576
+ .rogatio-editor [data-group-heading],
577
+ .rogatio-editor [data-section-heading] {
578
+ align-items: flex-start;
579
+ }
580
+ .rogatio-editor [data-rule-actions] {
581
+ justify-content: flex-start;
582
+ width: 100%;
583
+ }
436
584
  }
437
585
  @media (forced-colors: active) {
438
586
  .rogatio-editor {
@@ -443,6 +591,7 @@
443
591
  --rogatio-danger: Mark;
444
592
  --rogatio-success: ButtonText;
445
593
  --rogatio-warning: ButtonText;
594
+ --rogatio-card-rule-edge: Highlight;
446
595
  color: CanvasText;
447
596
  background: Canvas;
448
597
  }
@@ -451,7 +600,8 @@
451
600
  .rogatio-editor select,
452
601
  .rogatio-editor textarea,
453
602
  .rogatio-editor fieldset,
454
- .rogatio-editor [data-rule-card] {
603
+ .rogatio-editor [data-rule-card],
604
+ .rogatio-editor [data-group-row] {
455
605
  border-color: ButtonText;
456
606
  background: Canvas;
457
607
  }
@@ -488,7 +638,7 @@
488
638
  gap: 0.5rem;
489
639
  border: 1px solid var(--rogatio-border);
490
640
  border-radius: var(--rogatio-radius);
491
- background: var(--rogatio-surface);
641
+ background: var(--rogatio-card-group);
492
642
  padding: 0.75rem;
493
643
  margin-bottom: 0.75rem;
494
644
  }
@@ -506,6 +656,7 @@
506
656
  padding: 0.5rem;
507
657
  border-radius: var(--rogatio-radius-sm);
508
658
  background: var(--rogatio-surface-inset);
659
+ border-left: 2px solid var(--rogatio-card-rule-edge);
509
660
  }
510
661
  .rogatio-editor [data-test-rule-header] {
511
662
  display: flex;
@@ -1621,6 +1621,42 @@ var RESOURCE_TYPES2 = [
1621
1621
  "webbundle",
1622
1622
  "other"
1623
1623
  ];
1624
+ var RESOURCE_TYPE_GLOSS = {
1625
+ main_frame: "Top-level page navigation",
1626
+ sub_frame: "iframe / embedded frame",
1627
+ stylesheet: "CSS stylesheet",
1628
+ script: "JavaScript file",
1629
+ image: "Image",
1630
+ font: "Web font",
1631
+ object: "Plugin / <object> / <embed>",
1632
+ media: "Audio / video",
1633
+ xmlhttprequest: "XHR and fetch",
1634
+ ping: "Hyperlink ping / beacon",
1635
+ csp_report: "CSP violation report",
1636
+ websocket: "WebSocket",
1637
+ webtransport: "WebTransport",
1638
+ webbundle: "Web Bundle",
1639
+ other: "Anything else"
1640
+ };
1641
+ var RESOURCE_TYPE_GROUPS = [
1642
+ { label: "Page", types: ["main_frame", "sub_frame"] },
1643
+ {
1644
+ label: "Assets",
1645
+ types: ["stylesheet", "script", "image", "font", "media", "object"]
1646
+ },
1647
+ {
1648
+ label: "Network",
1649
+ types: [
1650
+ "xmlhttprequest",
1651
+ "websocket",
1652
+ "webtransport",
1653
+ "ping",
1654
+ "csp_report",
1655
+ "webbundle"
1656
+ ]
1657
+ },
1658
+ { label: "Other", types: ["other"] }
1659
+ ];
1624
1660
  var HTTP_METHODS2 = [
1625
1661
  "GET",
1626
1662
  "POST",
@@ -3171,7 +3207,7 @@ var EditorControllerImpl = class {
3171
3207
  }
3172
3208
  const testOption = this.document.createElement("option");
3173
3209
  testOption.value = "test";
3174
- testOption.textContent = "Test rules";
3210
+ testOption.textContent = "Test console";
3175
3211
  select.append(testOption);
3176
3212
  if (this.route.kind === "project") {
3177
3213
  select.value = "project";
@@ -3212,7 +3248,7 @@ var EditorControllerImpl = class {
3212
3248
  }
3213
3249
  this.rail.append(button);
3214
3250
  }
3215
- const testBtn = this.createButton("Test rules", "route:test");
3251
+ const testBtn = this.createButton("Test console", "route:test");
3216
3252
  testBtn.dataset.route = "test";
3217
3253
  testBtn.dataset.editorKey = "route:test";
3218
3254
  if (this.route.kind === "test")
@@ -3248,44 +3284,38 @@ var EditorControllerImpl = class {
3248
3284
  }
3249
3285
  this.commandBar.append(
3250
3286
  this.createCommandButton("Validate", "validate", this.saving),
3251
- this.createCommandButton("Save", "save", this.saving || !this.isDirty()),
3287
+ this.createCommandButton(
3288
+ "Save",
3289
+ "save",
3290
+ this.saving || !this.isDirty(),
3291
+ {},
3292
+ "primary"
3293
+ ),
3252
3294
  this.createCommandButton("Cancel", "cancel", this.saving)
3253
3295
  );
3254
3296
  if (this.route.kind === "project") {
3255
3297
  this.commandBar.append(
3256
- this.createCommandButton("Add group", "add-group", this.saving)
3298
+ this.createCommandButton(
3299
+ "Add group",
3300
+ "add-group",
3301
+ this.saving,
3302
+ {},
3303
+ "primary"
3304
+ )
3257
3305
  );
3258
3306
  return;
3259
3307
  }
3260
3308
  if (this.route.kind === "test") {
3261
3309
  this.commandBar.append(
3262
- this.createCommandButton("Run test", "test:run", this.saving)
3310
+ this.createCommandButton(
3311
+ "Run test",
3312
+ "test:run",
3313
+ this.saving,
3314
+ {},
3315
+ "primary"
3316
+ )
3263
3317
  );
3264
- return;
3265
3318
  }
3266
- const group = this.groupById(this.route.groupId);
3267
- if (!group) return;
3268
- const index = this.groupIndex(this.route.groupId);
3269
- this.commandBar.append(
3270
- this.createCommandButton("Add rule", "add-rule", this.saving, {
3271
- groupId: this.route.groupId
3272
- }),
3273
- this.createCommandButton(
3274
- "Move group up",
3275
- "move-group-up",
3276
- this.saving || index <= 0,
3277
- { groupId: this.route.groupId }
3278
- ),
3279
- this.createCommandButton(
3280
- "Move group down",
3281
- "move-group-down",
3282
- this.saving || index >= this.draft.groups.length - 1,
3283
- { groupId: this.route.groupId }
3284
- ),
3285
- this.createCommandButton("Remove group", "remove-group", this.saving, {
3286
- groupId: this.route.groupId
3287
- })
3288
- );
3289
3319
  }
3290
3320
  renderProject() {
3291
3321
  const heading = this.document.createElement("h2");
@@ -3314,6 +3344,7 @@ var EditorControllerImpl = class {
3314
3344
  fields.append(fieldGrid);
3315
3345
  this.form.append(fields);
3316
3346
  const groups = this.document.createElement("section");
3347
+ groups.dataset.groupListSection = "true";
3317
3348
  const groupsHeading = this.document.createElement("h2");
3318
3349
  groupsHeading.textContent = "Groups";
3319
3350
  groups.append(groupsHeading);
@@ -3323,15 +3354,28 @@ var EditorControllerImpl = class {
3323
3354
  groups.append(empty);
3324
3355
  } else {
3325
3356
  const list = this.document.createElement("ul");
3357
+ list.dataset.groupList = "true";
3326
3358
  for (const group of this.draft.groups) {
3359
+ const groupId = safeText(group.id);
3360
+ const groupName = displayName(group.name, "Unnamed group");
3327
3361
  const item = this.document.createElement("li");
3328
- const button = this.createButton(
3329
- `Edit group ${displayName(group.name, "Unnamed group")}`,
3330
- `route:group:${safeText(group.id)}`
3362
+ item.dataset.groupRow = "true";
3363
+ const open = this.createButton(
3364
+ `Edit group ${groupName}`,
3365
+ `route:group:${groupId}`
3331
3366
  );
3332
- button.dataset.route = "group";
3333
- button.dataset.groupId = safeText(group.id);
3334
- item.append(button);
3367
+ open.dataset.route = "group";
3368
+ open.dataset.groupId = groupId;
3369
+ open.dataset.btn = "secondary";
3370
+ const remove = this.createCommandButton(
3371
+ "Remove group",
3372
+ "remove-group",
3373
+ this.saving,
3374
+ { groupId },
3375
+ "danger"
3376
+ );
3377
+ remove.setAttribute("aria-label", `Remove group ${groupName}`);
3378
+ item.append(open, remove);
3335
3379
  list.append(item);
3336
3380
  }
3337
3381
  groups.append(list);
@@ -3342,10 +3386,22 @@ var EditorControllerImpl = class {
3342
3386
  const group = this.groupById(groupId);
3343
3387
  if (!group) return;
3344
3388
  const groupIndex = this.groupIndex(groupId);
3389
+ const groupName = displayName(group.name, "Unnamed group");
3390
+ const headingRow = this.document.createElement("div");
3391
+ headingRow.dataset.groupHeading = "true";
3345
3392
  const heading = this.document.createElement("h2");
3346
- heading.textContent = displayName(group.name, "Unnamed group");
3347
- this.form.append(heading);
3393
+ heading.textContent = groupName;
3394
+ const removeGroup = this.createCommandButton(
3395
+ "Remove group",
3396
+ "remove-group",
3397
+ this.saving,
3398
+ { groupId },
3399
+ "danger"
3400
+ );
3401
+ headingRow.append(heading, removeGroup);
3402
+ this.form.append(headingRow);
3348
3403
  const settings = this.document.createElement("fieldset");
3404
+ settings.dataset.groupCard = "true";
3349
3405
  const legend = this.document.createElement("legend");
3350
3406
  legend.textContent = "Group details";
3351
3407
  settings.append(legend);
@@ -3383,9 +3439,20 @@ var EditorControllerImpl = class {
3383
3439
  groupIndex
3384
3440
  );
3385
3441
  const rulesSection = this.document.createElement("section");
3442
+ rulesSection.dataset.rulesSection = "true";
3443
+ const rulesHeadingRow = this.document.createElement("div");
3444
+ rulesHeadingRow.dataset.sectionHeading = "true";
3386
3445
  const rulesHeading = this.document.createElement("h2");
3387
3446
  rulesHeading.textContent = "Rules";
3388
- rulesSection.append(rulesHeading);
3447
+ const addRule = this.createCommandButton(
3448
+ "Add rule",
3449
+ "add-rule",
3450
+ this.saving,
3451
+ { groupId },
3452
+ "primary"
3453
+ );
3454
+ rulesHeadingRow.append(rulesHeading, addRule);
3455
+ rulesSection.append(rulesHeadingRow);
3389
3456
  const list = this.document.createElement("div");
3390
3457
  list.dataset.ruleList = groupId;
3391
3458
  for (let ruleIndex = 0; ruleIndex < group.rules.length; ruleIndex += 1) {
@@ -3395,7 +3462,8 @@ var EditorControllerImpl = class {
3395
3462
  }
3396
3463
  if (group.rules.length === 0) {
3397
3464
  const empty = this.document.createElement("p");
3398
- empty.textContent = "No rules yet.";
3465
+ empty.dataset.emptyRules = "true";
3466
+ empty.textContent = "No rules yet. Add a rule to start matching requests.";
3399
3467
  list.append(empty);
3400
3468
  }
3401
3469
  rulesSection.append(list);
@@ -3403,7 +3471,7 @@ var EditorControllerImpl = class {
3403
3471
  }
3404
3472
  renderTest() {
3405
3473
  const heading = this.document.createElement("h2");
3406
- heading.textContent = "Test rules (dry-run)";
3474
+ heading.textContent = "Test console";
3407
3475
  this.form.append(heading);
3408
3476
  const description = this.document.createElement("p");
3409
3477
  description.dataset.testDescription = "true";
@@ -3492,6 +3560,8 @@ var EditorControllerImpl = class {
3492
3560
  const runBtn = this.createButton("Run test", "test:run");
3493
3561
  runBtn.type = "button";
3494
3562
  runBtn.dataset.testRun = "true";
3563
+ runBtn.dataset.command = "test:run";
3564
+ runBtn.dataset.btn = "primary";
3495
3565
  runBtn.disabled = this.saving || this.testRunning;
3496
3566
  panel.append(runBtn);
3497
3567
  this.form.append(panel);
@@ -3517,11 +3587,37 @@ var EditorControllerImpl = class {
3517
3587
  card.dataset.ruleId = ruleId;
3518
3588
  card.id = `rogatio-rule-${groupId}-${ruleId}`;
3519
3589
  card.tabIndex = -1;
3590
+ const headingRow = this.document.createElement("div");
3591
+ headingRow.dataset.ruleHeading = "true";
3520
3592
  const heading = this.document.createElement("h3");
3521
3593
  heading.id = `${this.instanceId}-rule-title-${groupIndex}-${ruleIndex}`;
3522
3594
  heading.textContent = ruleName;
3523
3595
  card.setAttribute("aria-labelledby", heading.id);
3524
- card.append(heading);
3596
+ const actions = this.document.createElement("div");
3597
+ actions.dataset.ruleActions = "true";
3598
+ actions.append(
3599
+ this.createCommandButton(
3600
+ "Move rule up",
3601
+ "move-rule-up",
3602
+ this.saving || ruleIndex <= 0,
3603
+ { groupId, ruleId }
3604
+ ),
3605
+ this.createCommandButton(
3606
+ "Move rule down",
3607
+ "move-rule-down",
3608
+ this.saving || ruleIndex >= group.rules.length - 1,
3609
+ { groupId, ruleId }
3610
+ ),
3611
+ this.createCommandButton(
3612
+ "Remove rule",
3613
+ "remove-rule",
3614
+ this.saving,
3615
+ { groupId, ruleId },
3616
+ "danger"
3617
+ )
3618
+ );
3619
+ headingRow.append(heading, actions);
3620
+ card.append(headingRow);
3525
3621
  const fields = this.document.createElement("fieldset");
3526
3622
  const legend = this.document.createElement("legend");
3527
3623
  legend.textContent = "Common rule matcher";
@@ -3551,7 +3647,8 @@ var EditorControllerImpl = class {
3551
3647
  "Convert to regex",
3552
3648
  "convert-url",
3553
3649
  this.saving,
3554
- { groupId, ruleId }
3650
+ { groupId, ruleId },
3651
+ "secondary"
3555
3652
  );
3556
3653
  grid.append(convert);
3557
3654
  fields.append(grid);
@@ -3654,27 +3751,6 @@ var EditorControllerImpl = class {
3654
3751
  extensionError.textContent = match.error.message;
3655
3752
  card.append(extensionError);
3656
3753
  }
3657
- const actions = this.document.createElement("div");
3658
- actions.dataset.ruleActions = "true";
3659
- actions.append(
3660
- this.createCommandButton(
3661
- "Move rule up",
3662
- "move-rule-up",
3663
- this.saving || ruleIndex <= 0,
3664
- { groupId, ruleId }
3665
- ),
3666
- this.createCommandButton(
3667
- "Move rule down",
3668
- "move-rule-down",
3669
- this.saving || ruleIndex >= group.rules.length - 1,
3670
- { groupId, ruleId }
3671
- ),
3672
- this.createCommandButton("Remove rule", "remove-rule", this.saving, {
3673
- groupId,
3674
- ruleId
3675
- })
3676
- );
3677
- card.append(actions);
3678
3754
  return card;
3679
3755
  }
3680
3756
  renderOrigins(parent, label, values, owner, groupId, ruleId, groupIndex, ruleIndex) {
@@ -3703,7 +3779,8 @@ var EditorControllerImpl = class {
3703
3779
  `Remove ${owner} origin ${index + 1}`,
3704
3780
  owner === "group" ? "remove-group-origin" : "remove-rule-origin",
3705
3781
  this.saving,
3706
- { groupId, ruleId, index: String(index) }
3782
+ { groupId, ruleId, index: String(index) },
3783
+ "danger"
3707
3784
  );
3708
3785
  row.append(remove);
3709
3786
  fieldset.append(row);
@@ -3713,7 +3790,8 @@ var EditorControllerImpl = class {
3713
3790
  "Add origin",
3714
3791
  owner === "group" ? "add-group-origin" : "add-rule-origin",
3715
3792
  this.saving,
3716
- { groupId, ruleId }
3793
+ { groupId, ruleId },
3794
+ "secondary"
3717
3795
  )
3718
3796
  );
3719
3797
  parent.append(fieldset);
@@ -3723,20 +3801,50 @@ var EditorControllerImpl = class {
3723
3801
  const legend = this.document.createElement("legend");
3724
3802
  legend.textContent = "Resource types";
3725
3803
  fieldset.append(legend);
3726
- const checks = this.document.createElement("div");
3727
- checks.dataset.editorChecks = "true";
3728
- for (const resourceType of RESOURCE_TYPES2) {
3729
- const label = this.document.createElement("label");
3730
- const input = this.document.createElement("input");
3731
- input.type = "checkbox";
3732
- input.dataset.resourcePath = `${rulePath}/resourceTypes`;
3733
- input.dataset.resourceType = resourceType;
3734
- input.checked = rule.resourceTypes.includes(resourceType);
3735
- input.disabled = this.saving;
3736
- label.append(input, this.document.createTextNode(resourceType));
3737
- checks.append(label);
3804
+ const hint = this.document.createElement("p");
3805
+ hint.dataset.editorHint = "true";
3806
+ hint.textContent = "Chrome request categories this rule can match.";
3807
+ fieldset.append(hint);
3808
+ const groups = this.document.createElement("div");
3809
+ groups.dataset.editorCheckGroups = "true";
3810
+ for (const group of RESOURCE_TYPE_GROUPS) {
3811
+ const groupEl = this.document.createElement("div");
3812
+ groupEl.dataset.editorCheckGroup = "true";
3813
+ groupEl.setAttribute("role", "group");
3814
+ const groupLabel = this.document.createElement("p");
3815
+ groupLabel.dataset.editorCheckGroupLabel = "true";
3816
+ groupLabel.id = `${this.instanceId}-resource-type-group-${group.label.toLowerCase()}-${safeText(rule.id)}`;
3817
+ groupLabel.textContent = group.label;
3818
+ groupEl.setAttribute("aria-labelledby", groupLabel.id);
3819
+ groupEl.append(groupLabel);
3820
+ const checks = this.document.createElement("div");
3821
+ checks.dataset.editorChecks = "true";
3822
+ for (const resourceType of group.types) {
3823
+ const gloss = RESOURCE_TYPE_GLOSS[resourceType];
3824
+ const label = this.document.createElement("label");
3825
+ label.title = gloss;
3826
+ const input = this.document.createElement("input");
3827
+ input.type = "checkbox";
3828
+ input.dataset.resourcePath = `${rulePath}/resourceTypes`;
3829
+ input.dataset.resourceType = resourceType;
3830
+ input.checked = rule.resourceTypes.includes(resourceType);
3831
+ input.disabled = this.saving;
3832
+ input.title = gloss;
3833
+ const text = this.document.createElement("span");
3834
+ text.dataset.editorCheckText = "true";
3835
+ const idSpan = this.document.createElement("span");
3836
+ idSpan.dataset.editorCheckId = "true";
3837
+ idSpan.textContent = resourceType;
3838
+ const glossEl = this.document.createElement("small");
3839
+ glossEl.textContent = gloss;
3840
+ text.append(idSpan, glossEl);
3841
+ label.append(input, text);
3842
+ checks.append(label);
3843
+ }
3844
+ groupEl.append(checks);
3845
+ groups.append(groupEl);
3738
3846
  }
3739
- fieldset.append(checks);
3847
+ fieldset.append(groups);
3740
3848
  parent.append(fieldset);
3741
3849
  }
3742
3850
  mountExtension(parent, extension, groupId, ruleId, rulePath) {
@@ -4005,6 +4113,7 @@ var EditorControllerImpl = class {
4005
4113
  cancel.type = "button";
4006
4114
  cancel.dataset.command = this.confirmation.kind === "cancel" ? "cancel-confirmation" : "remove-confirmation";
4007
4115
  cancel.dataset.editorKey = "confirm-cancel";
4116
+ cancel.dataset.btn = "secondary";
4008
4117
  cancel.textContent = this.confirmation.kind === "cancel" ? "Keep editing" : "Cancel removal";
4009
4118
  const confirm = this.document.createElement("button");
4010
4119
  confirm.type = "button";
@@ -4014,14 +4123,17 @@ var EditorControllerImpl = class {
4014
4123
  title.textContent = "Discard unsaved changes?";
4015
4124
  message.textContent = "Your current edits will be replaced by the last saved project.";
4016
4125
  confirm.textContent = "Discard changes";
4126
+ confirm.dataset.btn = "danger";
4017
4127
  } else if (this.confirmation.kind === "remove-group") {
4018
4128
  title.textContent = "Remove group?";
4019
4129
  message.textContent = `Remove group ${this.confirmation.name} and its rules?`;
4020
4130
  confirm.textContent = "Remove group";
4131
+ confirm.dataset.btn = "danger";
4021
4132
  } else {
4022
4133
  title.textContent = "Remove rule?";
4023
4134
  message.textContent = `Remove rule ${this.confirmation.name}?`;
4024
4135
  confirm.textContent = "Remove rule";
4136
+ confirm.dataset.btn = "danger";
4025
4137
  }
4026
4138
  dialog.setAttribute("aria-labelledby", title.id);
4027
4139
  actions.append(cancel, confirm);
@@ -4036,12 +4148,13 @@ var EditorControllerImpl = class {
4036
4148
  button.dataset.editorKey = `button:${key}`;
4037
4149
  return button;
4038
4150
  }
4039
- createCommandButton(label, command, disabled, data = {}) {
4151
+ createCommandButton(label, command, disabled, data = {}, tone = "secondary") {
4040
4152
  const button = this.createButton(
4041
4153
  label,
4042
4154
  `command:${command}:${Object.values(data).join(":")}`
4043
4155
  );
4044
4156
  button.dataset.command = command;
4157
+ button.dataset.btn = tone;
4045
4158
  button.disabled = disabled;
4046
4159
  for (const [key, value] of Object.entries(data)) {
4047
4160
  if (value !== void 0) button.dataset[key] = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogatio/cli",
3
- "version": "5.11.2",
3
+ "version": "5.13.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Local-first browser request and response rules — editor host, file verification, test runner, and runtime dispatch.",