@rogatio/cli 6.9.1 → 6.10.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/dist/editor/index.css +84 -30
- package/dist/editor/index.js +186 -60
- package/package.json +1 -1
package/dist/editor/index.css
CHANGED
|
@@ -163,28 +163,60 @@
|
|
|
163
163
|
display: flex;
|
|
164
164
|
flex-wrap: wrap;
|
|
165
165
|
align-items: center;
|
|
166
|
-
gap: 0.
|
|
166
|
+
gap: 0.75rem 1rem;
|
|
167
167
|
border-bottom: 1px solid var(--rogatio-border);
|
|
168
168
|
background: color-mix(in srgb, var(--rogatio-surface) 92%, #000);
|
|
169
169
|
padding: 0.6rem 1rem;
|
|
170
170
|
backdrop-filter: blur(8px);
|
|
171
171
|
}
|
|
172
|
-
.rogatio-editor [data-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
.rogatio-editor [data-route-breadcrumb] {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-wrap: wrap;
|
|
175
|
+
align-items: center;
|
|
176
|
+
margin: 0;
|
|
177
|
+
padding: 0;
|
|
178
|
+
list-style: none;
|
|
179
|
+
min-width: 0;
|
|
180
|
+
}
|
|
181
|
+
.rogatio-editor [data-route-breadcrumb] li {
|
|
182
|
+
display: inline-flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
min-width: 0;
|
|
185
|
+
max-width: 18rem;
|
|
186
|
+
}
|
|
187
|
+
.rogatio-editor [data-route-breadcrumb] li + li::before {
|
|
188
|
+
content: "/";
|
|
189
|
+
margin: 0 0.45rem;
|
|
177
190
|
color: var(--rogatio-muted);
|
|
191
|
+
font-weight: 500;
|
|
178
192
|
}
|
|
179
|
-
.rogatio-editor [data-
|
|
180
|
-
|
|
181
|
-
|
|
193
|
+
.rogatio-editor [data-route-breadcrumb] button {
|
|
194
|
+
max-width: 18rem;
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
border-color: transparent;
|
|
197
|
+
background: transparent;
|
|
198
|
+
padding: 0.15rem 0.2rem;
|
|
199
|
+
font-weight: 700;
|
|
200
|
+
text-overflow: ellipsis;
|
|
201
|
+
white-space: nowrap;
|
|
182
202
|
}
|
|
183
|
-
.rogatio-editor [data-
|
|
184
|
-
border-color:
|
|
185
|
-
background:
|
|
203
|
+
.rogatio-editor [data-route-breadcrumb] button:hover:not(:disabled) {
|
|
204
|
+
border-color: transparent;
|
|
205
|
+
background: transparent;
|
|
206
|
+
color: var(--rogatio-primary);
|
|
207
|
+
}
|
|
208
|
+
.rogatio-editor [data-route-breadcrumb] button[aria-current=page] {
|
|
186
209
|
color: var(--rogatio-text);
|
|
187
|
-
|
|
210
|
+
}
|
|
211
|
+
.rogatio-editor [data-route-breadcrumb] button:not([aria-current=page]) {
|
|
212
|
+
color: var(--rogatio-muted);
|
|
213
|
+
font-weight: 600;
|
|
214
|
+
}
|
|
215
|
+
.rogatio-editor [data-search-wrap] {
|
|
216
|
+
margin-left: auto;
|
|
217
|
+
flex: 1 1 12rem;
|
|
218
|
+
min-width: 0;
|
|
219
|
+
max-width: 100%;
|
|
188
220
|
}
|
|
189
221
|
.rogatio-editor [data-editor-main] {
|
|
190
222
|
min-width: 0;
|
|
@@ -192,7 +224,7 @@
|
|
|
192
224
|
}
|
|
193
225
|
.rogatio-editor [data-editor-header] {
|
|
194
226
|
display: grid;
|
|
195
|
-
grid-template-columns: minmax(0, 1fr)
|
|
227
|
+
grid-template-columns: minmax(0, 1fr);
|
|
196
228
|
gap: 1rem;
|
|
197
229
|
align-items: end;
|
|
198
230
|
margin-bottom: 1rem;
|
|
@@ -240,9 +272,6 @@
|
|
|
240
272
|
min-height: 5rem;
|
|
241
273
|
resize: vertical;
|
|
242
274
|
}
|
|
243
|
-
.rogatio-editor [data-mobile-route-nav] {
|
|
244
|
-
display: none;
|
|
245
|
-
}
|
|
246
275
|
.rogatio-editor [data-editor-status] {
|
|
247
276
|
min-height: 1.5rem;
|
|
248
277
|
margin-block: 0.5rem;
|
|
@@ -273,6 +302,17 @@
|
|
|
273
302
|
text-align: left;
|
|
274
303
|
text-decoration: underline;
|
|
275
304
|
}
|
|
305
|
+
.rogatio-editor [data-editor-command-bar] button[aria-current=page] {
|
|
306
|
+
border-color: rgba(59, 158, 255, 0.45);
|
|
307
|
+
background: var(--rogatio-primary-bg);
|
|
308
|
+
font-weight: 700;
|
|
309
|
+
}
|
|
310
|
+
.rogatio-editor [data-project-actions] {
|
|
311
|
+
display: flex;
|
|
312
|
+
flex-wrap: wrap;
|
|
313
|
+
gap: 0.5rem;
|
|
314
|
+
margin-top: 0.75rem;
|
|
315
|
+
}
|
|
276
316
|
.rogatio-editor [data-editor-command-bar] {
|
|
277
317
|
display: flex;
|
|
278
318
|
flex-wrap: wrap;
|
|
@@ -580,7 +620,8 @@
|
|
|
580
620
|
text-decoration: underline;
|
|
581
621
|
color: var(--rogatio-text);
|
|
582
622
|
}
|
|
583
|
-
.rogatio-editor [data-editor-confirmation]
|
|
623
|
+
.rogatio-editor [data-editor-confirmation],
|
|
624
|
+
.rogatio-editor [data-group-picker] {
|
|
584
625
|
position: fixed;
|
|
585
626
|
inset: 0;
|
|
586
627
|
z-index: 2;
|
|
@@ -605,6 +646,27 @@
|
|
|
605
646
|
flex-wrap: wrap;
|
|
606
647
|
gap: 0.5rem;
|
|
607
648
|
}
|
|
649
|
+
.rogatio-editor [data-group-picker-list] {
|
|
650
|
+
list-style: none;
|
|
651
|
+
margin: 0 0 1rem;
|
|
652
|
+
padding: 0;
|
|
653
|
+
display: grid;
|
|
654
|
+
gap: 0.35rem;
|
|
655
|
+
max-height: min(50vh, 20rem);
|
|
656
|
+
overflow: auto;
|
|
657
|
+
}
|
|
658
|
+
.rogatio-editor [data-group-picker-list] button {
|
|
659
|
+
width: 100%;
|
|
660
|
+
display: flex;
|
|
661
|
+
flex-wrap: wrap;
|
|
662
|
+
gap: 0.35rem 0.75rem;
|
|
663
|
+
text-align: left;
|
|
664
|
+
}
|
|
665
|
+
.rogatio-editor [data-group-picker-rules],
|
|
666
|
+
.rogatio-editor [data-group-picker-state] {
|
|
667
|
+
color: var(--rogatio-muted);
|
|
668
|
+
font-size: 0.875rem;
|
|
669
|
+
}
|
|
608
670
|
.rogatio-editor [data-editor-visually-hidden] {
|
|
609
671
|
position: absolute;
|
|
610
672
|
width: 1px;
|
|
@@ -616,17 +678,18 @@
|
|
|
616
678
|
}
|
|
617
679
|
.rogatio-editor [data-search-wrap] {
|
|
618
680
|
position: relative;
|
|
619
|
-
margin-left: auto;
|
|
620
681
|
}
|
|
621
682
|
.rogatio-editor [data-search-label] {
|
|
622
|
-
display:
|
|
683
|
+
display: flex;
|
|
623
684
|
flex-direction: column;
|
|
624
685
|
gap: 0.15rem;
|
|
686
|
+
max-width: 100%;
|
|
625
687
|
font-size: 0.75rem;
|
|
626
688
|
color: var(--rogatio-muted);
|
|
627
689
|
}
|
|
628
690
|
.rogatio-editor [data-search-wrap] input[type=search] {
|
|
629
|
-
width:
|
|
691
|
+
width: 100%;
|
|
692
|
+
max-width: 18rem;
|
|
630
693
|
}
|
|
631
694
|
.rogatio-editor [data-search-results] {
|
|
632
695
|
position: absolute;
|
|
@@ -662,15 +725,6 @@
|
|
|
662
725
|
.rogatio-editor [data-editor-layout] {
|
|
663
726
|
display: block;
|
|
664
727
|
}
|
|
665
|
-
.rogatio-editor [data-desktop-route-rail] {
|
|
666
|
-
display: none;
|
|
667
|
-
}
|
|
668
|
-
.rogatio-editor [data-mobile-route-nav] {
|
|
669
|
-
display: grid;
|
|
670
|
-
gap: 0.3rem;
|
|
671
|
-
margin-block: 1rem;
|
|
672
|
-
color: var(--rogatio-muted);
|
|
673
|
-
}
|
|
674
728
|
.rogatio-editor [data-editor-header] {
|
|
675
729
|
grid-template-columns: 1fr;
|
|
676
730
|
}
|
package/dist/editor/index.js
CHANGED
|
@@ -1784,6 +1784,30 @@ var FORBIDDEN_EXTENSION_FIELDS = /* @__PURE__ */ new Set([
|
|
|
1784
1784
|
var MAX_SNAPSHOT_ARRAY_LENGTH = 4096;
|
|
1785
1785
|
var F2_MAX_URL_REGEX_LENGTH2 = 2048;
|
|
1786
1786
|
var editorInstanceCount = 0;
|
|
1787
|
+
function normalizeProjectActions(value) {
|
|
1788
|
+
if (!Array.isArray(value)) return [];
|
|
1789
|
+
const actions = [];
|
|
1790
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
1791
|
+
if (!Object.hasOwn(value, index)) continue;
|
|
1792
|
+
const item = value[index];
|
|
1793
|
+
if (!isRecord4(item)) continue;
|
|
1794
|
+
const command = item.command;
|
|
1795
|
+
const label = item.label;
|
|
1796
|
+
if (typeof command !== "string" || command.length === 0) continue;
|
|
1797
|
+
if (typeof label !== "string" || label.length === 0) continue;
|
|
1798
|
+
if (item.tone === "danger") {
|
|
1799
|
+
actions.push({ command, label, tone: "danger" });
|
|
1800
|
+
} else {
|
|
1801
|
+
actions.push({ command, label });
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
return actions;
|
|
1805
|
+
}
|
|
1806
|
+
function ruleCountLabel(count) {
|
|
1807
|
+
if (count === 0) return "No rules";
|
|
1808
|
+
if (count === 1) return "1 rule";
|
|
1809
|
+
return `${count} rules`;
|
|
1810
|
+
}
|
|
1787
1811
|
function isRecord4(value) {
|
|
1788
1812
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1789
1813
|
}
|
|
@@ -2262,6 +2286,8 @@ var EditorControllerImpl = class {
|
|
|
2262
2286
|
extensionControls = /* @__PURE__ */ new Map();
|
|
2263
2287
|
extensionCleanups = [];
|
|
2264
2288
|
confirmation;
|
|
2289
|
+
groupPickerOpen = false;
|
|
2290
|
+
projectActions;
|
|
2265
2291
|
focusRequest;
|
|
2266
2292
|
saving = false;
|
|
2267
2293
|
destroyed = false;
|
|
@@ -2291,6 +2317,7 @@ var EditorControllerImpl = class {
|
|
|
2291
2317
|
this.root = options.root;
|
|
2292
2318
|
this.document = options.root.ownerDocument;
|
|
2293
2319
|
this.options = options;
|
|
2320
|
+
this.projectActions = normalizeProjectActions(options.projectActions);
|
|
2294
2321
|
this.extensions = extensions;
|
|
2295
2322
|
this.instanceId = `rogatio-editor-${++editorInstanceCount}`;
|
|
2296
2323
|
this.draft = initial;
|
|
@@ -2408,6 +2435,10 @@ var EditorControllerImpl = class {
|
|
|
2408
2435
|
if (this.destroyed) return;
|
|
2409
2436
|
const target = event.target;
|
|
2410
2437
|
if (!(target instanceof Element)) return;
|
|
2438
|
+
if (this.groupPickerOpen && target instanceof HTMLElement && target.dataset.groupPicker !== void 0 && event.target === target) {
|
|
2439
|
+
this.closeGroupPicker();
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2411
2442
|
const element = target.closest(
|
|
2412
2443
|
"[data-command], [data-route], [data-search-result], [data-error-path]"
|
|
2413
2444
|
);
|
|
@@ -2460,12 +2491,6 @@ var EditorControllerImpl = class {
|
|
|
2460
2491
|
if (!(target instanceof HTMLInputElement || target instanceof HTMLSelectElement)) {
|
|
2461
2492
|
return;
|
|
2462
2493
|
}
|
|
2463
|
-
if (target.dataset.mobileRoute !== void 0 && target instanceof HTMLSelectElement) {
|
|
2464
|
-
const selectedOption = target.options[target.selectedIndex];
|
|
2465
|
-
const groupId = selectedOption?.dataset.groupId;
|
|
2466
|
-
this.navigate(target.value, groupId);
|
|
2467
|
-
return;
|
|
2468
|
-
}
|
|
2469
2494
|
if (target instanceof HTMLInputElement && target.dataset.resourcePath !== void 0) {
|
|
2470
2495
|
this.updateResourceTypes(
|
|
2471
2496
|
target.dataset.resourcePath,
|
|
@@ -2521,6 +2546,11 @@ var EditorControllerImpl = class {
|
|
|
2521
2546
|
this.render();
|
|
2522
2547
|
return;
|
|
2523
2548
|
}
|
|
2549
|
+
if (event.key === "Escape" && this.groupPickerOpen) {
|
|
2550
|
+
event.preventDefault();
|
|
2551
|
+
this.closeGroupPicker();
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2524
2554
|
const target = event.target;
|
|
2525
2555
|
const inRenameInput = target instanceof HTMLElement && target.dataset.renameInput !== void 0;
|
|
2526
2556
|
if (!inRenameInput) return;
|
|
@@ -2677,6 +2707,14 @@ var EditorControllerImpl = class {
|
|
|
2677
2707
|
this.testUrls = url;
|
|
2678
2708
|
this.statusMessage = "";
|
|
2679
2709
|
this.render();
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
if (command === "open-group-picker") {
|
|
2713
|
+
this.openGroupPicker();
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
if (command === "close-group-picker") {
|
|
2717
|
+
this.closeGroupPicker();
|
|
2680
2718
|
}
|
|
2681
2719
|
}
|
|
2682
2720
|
collectDiagnostics(value) {
|
|
@@ -3639,6 +3677,7 @@ var EditorControllerImpl = class {
|
|
|
3639
3677
|
return enablement.isEnabled(id) !== true;
|
|
3640
3678
|
}
|
|
3641
3679
|
navigate(route, groupId) {
|
|
3680
|
+
const returnFocusToGroups = this.groupPickerOpen;
|
|
3642
3681
|
if (route === "project") {
|
|
3643
3682
|
this.route = { kind: "project" };
|
|
3644
3683
|
} else if (route === "test") {
|
|
@@ -3648,6 +3687,8 @@ var EditorControllerImpl = class {
|
|
|
3648
3687
|
} else {
|
|
3649
3688
|
return;
|
|
3650
3689
|
}
|
|
3690
|
+
this.groupPickerOpen = false;
|
|
3691
|
+
if (returnFocusToGroups) this.focusRequest = "route:groups";
|
|
3651
3692
|
this.closeRenameOnLeave();
|
|
3652
3693
|
this.testRequestId += 1;
|
|
3653
3694
|
this.statusMessage = "";
|
|
@@ -3673,6 +3714,7 @@ var EditorControllerImpl = class {
|
|
|
3673
3714
|
}
|
|
3674
3715
|
}
|
|
3675
3716
|
navigateToGroup(groupId) {
|
|
3717
|
+
this.groupPickerOpen = false;
|
|
3676
3718
|
const groupIds = new Set(
|
|
3677
3719
|
this.draft.groups.map((group) => typeof group.id === "string" ? group.id : "").filter((id) => id.length > 0)
|
|
3678
3720
|
);
|
|
@@ -3745,6 +3787,7 @@ var EditorControllerImpl = class {
|
|
|
3745
3787
|
this.revealRuleCard(resolvedGroup, resolvedRule);
|
|
3746
3788
|
}
|
|
3747
3789
|
navigateToSearchResult(path) {
|
|
3790
|
+
this.groupPickerOpen = false;
|
|
3748
3791
|
const segments = decodePointer(path);
|
|
3749
3792
|
if (segments?.[0] !== "groups") {
|
|
3750
3793
|
this.route = { kind: "project" };
|
|
@@ -3836,7 +3879,9 @@ var EditorControllerImpl = class {
|
|
|
3836
3879
|
this.renderSummary();
|
|
3837
3880
|
this.renderMigrationNotices();
|
|
3838
3881
|
this.renderSearchResults();
|
|
3882
|
+
if (this.confirmation) this.groupPickerOpen = false;
|
|
3839
3883
|
this.renderConfirmation();
|
|
3884
|
+
this.renderGroupPicker();
|
|
3840
3885
|
this.restoreFocus();
|
|
3841
3886
|
this.focusRequest = void 0;
|
|
3842
3887
|
}
|
|
@@ -3849,39 +3894,7 @@ var EditorControllerImpl = class {
|
|
|
3849
3894
|
dirty.dataset.dirtyState = "true";
|
|
3850
3895
|
dirty.textContent = this.isDirty() ? "Unsaved changes" : "All changes saved";
|
|
3851
3896
|
titleBlock.append(title, dirty);
|
|
3852
|
-
|
|
3853
|
-
mobileNav.dataset.mobileRouteNav = "true";
|
|
3854
|
-
mobileNav.textContent = "Project section";
|
|
3855
|
-
const select = this.document.createElement("select");
|
|
3856
|
-
select.dataset.mobileRoute = "true";
|
|
3857
|
-
select.dataset.editorKey = "mobile-route";
|
|
3858
|
-
const projectOption = this.document.createElement("option");
|
|
3859
|
-
projectOption.value = "project";
|
|
3860
|
-
projectOption.textContent = "Project";
|
|
3861
|
-
select.append(projectOption);
|
|
3862
|
-
for (const group of this.draft.groups) {
|
|
3863
|
-
const option = this.document.createElement("option");
|
|
3864
|
-
option.value = "group";
|
|
3865
|
-
option.dataset.groupId = safeText(group.id);
|
|
3866
|
-
option.textContent = displayName(group.name, "Unnamed group");
|
|
3867
|
-
select.append(option);
|
|
3868
|
-
}
|
|
3869
|
-
const testOption = this.document.createElement("option");
|
|
3870
|
-
testOption.value = "test";
|
|
3871
|
-
testOption.textContent = "Test console";
|
|
3872
|
-
select.append(testOption);
|
|
3873
|
-
if (this.route.kind === "project") {
|
|
3874
|
-
select.value = "project";
|
|
3875
|
-
} else if (this.route.kind === "test") {
|
|
3876
|
-
select.value = "test";
|
|
3877
|
-
} else {
|
|
3878
|
-
const groupId = this.route.groupId;
|
|
3879
|
-
const options = Array.from(select.options);
|
|
3880
|
-
const option = options.find((value) => value.dataset.groupId === groupId);
|
|
3881
|
-
if (option) select.value = "group";
|
|
3882
|
-
}
|
|
3883
|
-
mobileNav.append(select);
|
|
3884
|
-
this.header.append(titleBlock, mobileNav);
|
|
3897
|
+
this.header.append(titleBlock);
|
|
3885
3898
|
this.status.textContent = this.statusMessage;
|
|
3886
3899
|
this.status.setAttribute("aria-busy", this.saving ? "true" : "false");
|
|
3887
3900
|
}
|
|
@@ -3891,30 +3904,34 @@ var EditorControllerImpl = class {
|
|
|
3891
3904
|
heading.dataset.editorVisuallyHidden = "true";
|
|
3892
3905
|
heading.textContent = "Project sections";
|
|
3893
3906
|
this.rail.append(heading);
|
|
3894
|
-
const
|
|
3907
|
+
const list = this.document.createElement("ol");
|
|
3908
|
+
list.dataset.routeBreadcrumb = "true";
|
|
3909
|
+
const projectItem = this.document.createElement("li");
|
|
3910
|
+
const project = this.createButton(
|
|
3911
|
+
displayName(this.draft.name, "Project"),
|
|
3912
|
+
"route:project"
|
|
3913
|
+
);
|
|
3895
3914
|
project.dataset.route = "project";
|
|
3896
3915
|
project.dataset.editorKey = "route:project";
|
|
3897
|
-
if (this.route.kind === "project")
|
|
3916
|
+
if (this.route.kind === "project") {
|
|
3898
3917
|
project.setAttribute("aria-current", "page");
|
|
3899
|
-
this.rail.append(project);
|
|
3900
|
-
for (const group of this.draft.groups) {
|
|
3901
|
-
const groupId = safeText(group.id);
|
|
3902
|
-
const name = displayName(group.name, "Unnamed group");
|
|
3903
|
-
const button = this.createButton(name, `route:group:${groupId}`);
|
|
3904
|
-
button.dataset.route = "group";
|
|
3905
|
-
button.dataset.groupId = groupId;
|
|
3906
|
-
button.dataset.editorKey = `route:group:${groupId}`;
|
|
3907
|
-
if (this.route.kind === "group" && this.route.groupId === groupId) {
|
|
3908
|
-
button.setAttribute("aria-current", "page");
|
|
3909
|
-
}
|
|
3910
|
-
this.rail.append(button);
|
|
3911
3918
|
}
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3919
|
+
projectItem.append(project);
|
|
3920
|
+
const groupItem = this.document.createElement("li");
|
|
3921
|
+
const openGroup = this.route.kind === "group" ? this.groupById(this.route.groupId) : void 0;
|
|
3922
|
+
const groups = this.createButton(
|
|
3923
|
+
openGroup ? displayName(openGroup.name, "Unnamed group") : "Groups",
|
|
3924
|
+
"route:groups"
|
|
3925
|
+
);
|
|
3926
|
+
groups.dataset.command = "open-group-picker";
|
|
3927
|
+
groups.dataset.editorKey = "route:groups";
|
|
3928
|
+
if (openGroup) {
|
|
3929
|
+
groups.dataset.groupId = safeText(openGroup.id);
|
|
3930
|
+
groups.setAttribute("aria-current", "page");
|
|
3931
|
+
}
|
|
3932
|
+
groupItem.append(groups);
|
|
3933
|
+
list.append(projectItem, groupItem);
|
|
3934
|
+
this.rail.append(list);
|
|
3918
3935
|
const searchWrap = this.document.createElement("div");
|
|
3919
3936
|
searchWrap.dataset.searchWrap = "true";
|
|
3920
3937
|
const searchLabel = this.document.createElement("label");
|
|
@@ -3946,7 +3963,18 @@ var EditorControllerImpl = class {
|
|
|
3946
3963
|
this.createCommandButton("AI Assist", "ai-assist", this.saving)
|
|
3947
3964
|
);
|
|
3948
3965
|
}
|
|
3949
|
-
|
|
3966
|
+
const testBtn = this.createButton("Test console", "route:test");
|
|
3967
|
+
testBtn.dataset.route = "test";
|
|
3968
|
+
testBtn.dataset.editorKey = "route:test";
|
|
3969
|
+
testBtn.dataset.btn = "secondary";
|
|
3970
|
+
testBtn.disabled = this.saving;
|
|
3971
|
+
if (this.route.kind === "test") {
|
|
3972
|
+
testBtn.setAttribute("aria-current", "page");
|
|
3973
|
+
}
|
|
3974
|
+
tools.append(
|
|
3975
|
+
testBtn,
|
|
3976
|
+
this.createCommandButton("Validate", "validate", this.saving)
|
|
3977
|
+
);
|
|
3950
3978
|
const commit = this.document.createElement("div");
|
|
3951
3979
|
commit.dataset.actionCluster = "commit";
|
|
3952
3980
|
commit.append(
|
|
@@ -4123,6 +4151,7 @@ var EditorControllerImpl = class {
|
|
|
4123
4151
|
description
|
|
4124
4152
|
);
|
|
4125
4153
|
fields.append(fieldGrid);
|
|
4154
|
+
this.renderProjectActions(fields);
|
|
4126
4155
|
this.form.append(fields);
|
|
4127
4156
|
const groups = this.document.createElement("section");
|
|
4128
4157
|
groups.dataset.groupListSection = "true";
|
|
@@ -5284,6 +5313,103 @@ var EditorControllerImpl = class {
|
|
|
5284
5313
|
}
|
|
5285
5314
|
return results;
|
|
5286
5315
|
}
|
|
5316
|
+
renderProjectActions(fields) {
|
|
5317
|
+
if (this.projectActions.length === 0) return;
|
|
5318
|
+
const group = this.document.createElement("div");
|
|
5319
|
+
group.dataset.projectActions = "true";
|
|
5320
|
+
group.setAttribute("role", "group");
|
|
5321
|
+
group.setAttribute("aria-label", "Project settings");
|
|
5322
|
+
for (const action of this.projectActions) {
|
|
5323
|
+
group.append(
|
|
5324
|
+
this.createCommandButton(
|
|
5325
|
+
action.label,
|
|
5326
|
+
action.command,
|
|
5327
|
+
false,
|
|
5328
|
+
{},
|
|
5329
|
+
action.tone === "danger" ? "danger" : "secondary"
|
|
5330
|
+
)
|
|
5331
|
+
);
|
|
5332
|
+
}
|
|
5333
|
+
fields.append(group);
|
|
5334
|
+
}
|
|
5335
|
+
openGroupPicker() {
|
|
5336
|
+
this.groupPickerOpen = true;
|
|
5337
|
+
this.focusRequest = this.draft.groups.length > 0 ? "group-picker-first" : "group-picker-close";
|
|
5338
|
+
this.render();
|
|
5339
|
+
}
|
|
5340
|
+
closeGroupPicker() {
|
|
5341
|
+
this.groupPickerOpen = false;
|
|
5342
|
+
this.focusRequest = "route:groups";
|
|
5343
|
+
this.render();
|
|
5344
|
+
}
|
|
5345
|
+
renderGroupPicker() {
|
|
5346
|
+
const existing = this.host.querySelector("[data-group-picker]");
|
|
5347
|
+
existing?.remove();
|
|
5348
|
+
if (!this.groupPickerOpen) return;
|
|
5349
|
+
const overlay = this.document.createElement("div");
|
|
5350
|
+
overlay.dataset.groupPicker = "true";
|
|
5351
|
+
overlay.setAttribute("role", "presentation");
|
|
5352
|
+
const dialog = this.document.createElement("section");
|
|
5353
|
+
dialog.dataset.editorDialog = "true";
|
|
5354
|
+
dialog.setAttribute("role", "dialog");
|
|
5355
|
+
dialog.setAttribute("aria-modal", "true");
|
|
5356
|
+
const title = this.document.createElement("h2");
|
|
5357
|
+
title.id = `${this.instanceId}-group-picker-title`;
|
|
5358
|
+
title.textContent = "Groups";
|
|
5359
|
+
dialog.setAttribute("aria-labelledby", title.id);
|
|
5360
|
+
dialog.append(title);
|
|
5361
|
+
if (this.draft.groups.length === 0) {
|
|
5362
|
+
const empty = this.document.createElement("p");
|
|
5363
|
+
empty.textContent = "No groups yet.";
|
|
5364
|
+
dialog.append(empty);
|
|
5365
|
+
} else {
|
|
5366
|
+
const list = this.document.createElement("ul");
|
|
5367
|
+
list.dataset.groupPickerList = "true";
|
|
5368
|
+
for (let index = 0; index < this.draft.groups.length; index += 1) {
|
|
5369
|
+
const group = this.draft.groups[index];
|
|
5370
|
+
if (!group) continue;
|
|
5371
|
+
const groupId = safeText(group.id);
|
|
5372
|
+
const name = displayName(group.name, "Unnamed group");
|
|
5373
|
+
const item = this.document.createElement("li");
|
|
5374
|
+
const button = this.document.createElement("button");
|
|
5375
|
+
button.type = "button";
|
|
5376
|
+
button.dataset.route = "group";
|
|
5377
|
+
button.dataset.groupId = groupId;
|
|
5378
|
+
button.dataset.btn = "secondary";
|
|
5379
|
+
button.dataset.editorKey = index === 0 ? "group-picker-first" : `group-picker:${groupId}`;
|
|
5380
|
+
if (this.route.kind === "group" && this.route.groupId === groupId) {
|
|
5381
|
+
button.setAttribute("aria-current", "true");
|
|
5382
|
+
}
|
|
5383
|
+
const nameEl = this.document.createElement("span");
|
|
5384
|
+
nameEl.dataset.groupPickerName = "true";
|
|
5385
|
+
nameEl.textContent = name;
|
|
5386
|
+
const rulesEl = this.document.createElement("span");
|
|
5387
|
+
rulesEl.dataset.groupPickerRules = "true";
|
|
5388
|
+
rulesEl.textContent = ruleCountLabel(group.rules.length);
|
|
5389
|
+
button.append(nameEl, rulesEl);
|
|
5390
|
+
const savedId = this.savedGroupId(group);
|
|
5391
|
+
if (this.options.groupEnablement && savedId) {
|
|
5392
|
+
const stateEl = this.document.createElement("span");
|
|
5393
|
+
stateEl.dataset.groupPickerState = "true";
|
|
5394
|
+
stateEl.textContent = this.options.groupEnablement.isEnabled(savedId) ? "Enabled" : "Disabled";
|
|
5395
|
+
button.append(stateEl);
|
|
5396
|
+
}
|
|
5397
|
+
item.append(button);
|
|
5398
|
+
list.append(item);
|
|
5399
|
+
}
|
|
5400
|
+
dialog.append(list);
|
|
5401
|
+
}
|
|
5402
|
+
const actions = this.document.createElement("div");
|
|
5403
|
+
actions.dataset.editorDialogActions = "true";
|
|
5404
|
+
const close = this.createButton("Close", "group-picker-close");
|
|
5405
|
+
close.dataset.command = "close-group-picker";
|
|
5406
|
+
close.dataset.editorKey = "group-picker-close";
|
|
5407
|
+
close.dataset.btn = "secondary";
|
|
5408
|
+
actions.append(close);
|
|
5409
|
+
dialog.append(actions);
|
|
5410
|
+
overlay.append(dialog);
|
|
5411
|
+
this.host.append(overlay);
|
|
5412
|
+
}
|
|
5287
5413
|
renderConfirmation() {
|
|
5288
5414
|
const existing = this.host.querySelector("[data-editor-confirmation]");
|
|
5289
5415
|
existing?.remove();
|
package/package.json
CHANGED