@sanity/runtime-cli 12.1.0 → 12.3.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/README.md +20 -19
- package/dist/actions/blueprints/assets.d.ts +3 -4
- package/dist/actions/blueprints/assets.js +118 -2
- package/dist/actions/blueprints/blueprint.d.ts +3 -2
- package/dist/actions/blueprints/stacks.d.ts +8 -4
- package/dist/actions/blueprints/stacks.js +6 -32
- package/dist/commands/blueprints/doctor.d.ts +1 -0
- package/dist/commands/blueprints/doctor.js +4 -0
- package/dist/commands/functions/dev.d.ts +2 -2
- package/dist/commands/functions/dev.js +3 -2
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +7 -0
- package/dist/cores/blueprints/deploy.js +29 -12
- package/dist/cores/blueprints/doctor.d.ts +1 -0
- package/dist/cores/blueprints/doctor.js +36 -5
- package/dist/cores/blueprints/info.js +2 -2
- package/dist/cores/functions/env/add.js +2 -2
- package/dist/cores/functions/env/list.js +2 -2
- package/dist/cores/functions/env/remove.js +2 -2
- package/dist/cores/functions/logs.js +2 -2
- package/dist/cores/functions/test.js +31 -23
- package/dist/server/app.js +32 -21
- package/dist/server/handlers/invoke.d.ts +2 -2
- package/dist/server/handlers/invoke.js +2 -2
- package/dist/server/static/components/api-base.js +3 -0
- package/dist/server/static/components/app.css +120 -95
- package/dist/server/static/components/clear-button.js +1 -1
- package/dist/server/static/components/console-panel.js +6 -6
- package/dist/server/static/components/fetch-button.js +1 -1
- package/dist/server/static/components/filter-api-version.js +3 -3
- package/dist/server/static/components/filter-document-id.js +5 -5
- package/dist/server/static/components/filter-with-token.js +4 -4
- package/dist/server/static/components/filters.js +2 -2
- package/dist/server/static/components/function-list.js +14 -5
- package/dist/server/static/components/help-button.js +4 -1
- package/dist/server/static/components/payload-panel.js +9 -9
- package/dist/server/static/components/response-panel.js +8 -8
- package/dist/server/static/components/rule-panel.js +4 -4
- package/dist/server/static/components/run-panel.js +4 -4
- package/dist/server/static/components/select-dropdown.js +5 -25
- package/dist/server/static/index.html +9 -9
- package/dist/server/static/vendor/m-.css +1 -0
- package/dist/server/static/vendor/m-.woff2 +0 -0
- package/dist/utils/display/blueprints-formatting.d.ts +3 -2
- package/dist/utils/display/blueprints-formatting.js +102 -50
- package/dist/utils/display/resources-formatting.d.ts +6 -2
- package/dist/utils/display/resources-formatting.js +71 -17
- package/dist/utils/find-function.d.ts +2 -2
- package/dist/utils/find-function.js +9 -2
- package/dist/utils/invoke-local.d.ts +2 -2
- package/dist/utils/invoke-local.js +27 -16
- package/dist/utils/types.d.ts +66 -24
- package/dist/utils/types.js +25 -2
- package/dist/utils/validate/resource.js +144 -23
- package/oclif.manifest.json +14 -1
- package/package.json +2 -2
|
@@ -498,29 +498,7 @@
|
|
|
498
498
|
/* ---------------------------------- */
|
|
499
499
|
/* Used for padding, margin, gap, etc. Assumed px units. */
|
|
500
500
|
|
|
501
|
-
--space-0: 0px;
|
|
502
|
-
--space-1: 4px;
|
|
503
|
-
--space-2: 8px;
|
|
504
|
-
--space-3: 12px;
|
|
505
|
-
--space-4: 20px;
|
|
506
|
-
--space-5: 32px;
|
|
507
|
-
--space-6: 52px;
|
|
508
501
|
--space-7: 84px;
|
|
509
|
-
--space-8: 136px;
|
|
510
|
-
--space-9: 220px;
|
|
511
|
-
|
|
512
|
-
/* ---------------------------------- */
|
|
513
|
-
/* Border Radius (Numerical Scale) */
|
|
514
|
-
/* ---------------------------------- */
|
|
515
|
-
/* Assumed px units. Index 7 is 'pill' shape. */
|
|
516
|
-
--radius-0: 0px;
|
|
517
|
-
--radius-1: 1px;
|
|
518
|
-
--radius-2: 3px;
|
|
519
|
-
--radius-3: 6px;
|
|
520
|
-
--radius-4: 9px;
|
|
521
|
-
--radius-5: 12px;
|
|
522
|
-
--radius-6: 21px;
|
|
523
|
-
--radius-7: 9999px; /* Pill / Full round */
|
|
524
502
|
|
|
525
503
|
/* ---------------------------------- */
|
|
526
504
|
/* Container Widths (Numerical Scale) */
|
|
@@ -681,18 +659,15 @@ body {
|
|
|
681
659
|
.capitalize {
|
|
682
660
|
text-transform: capitalize;
|
|
683
661
|
}
|
|
684
|
-
.flex {
|
|
685
|
-
display: flex;
|
|
686
|
-
}
|
|
687
|
-
.flex-column {
|
|
688
|
-
flex-direction: column;
|
|
689
|
-
}
|
|
690
662
|
.items-center {
|
|
691
663
|
align-items: center;
|
|
692
664
|
}
|
|
693
665
|
.space-between {
|
|
694
666
|
justify-content: space-between;
|
|
695
667
|
}
|
|
668
|
+
.flex-end {
|
|
669
|
+
justify-content: flex-end;
|
|
670
|
+
}
|
|
696
671
|
|
|
697
672
|
.sticky {
|
|
698
673
|
position: sticky;
|
|
@@ -710,13 +685,19 @@ body {
|
|
|
710
685
|
.left-0 {
|
|
711
686
|
left: 0;
|
|
712
687
|
}
|
|
713
|
-
.bottom-0 {
|
|
714
|
-
bottom: 0;
|
|
715
|
-
}
|
|
716
688
|
|
|
689
|
+
.z-10 {
|
|
690
|
+
z-index: 10;
|
|
691
|
+
}
|
|
692
|
+
.z-32 {
|
|
693
|
+
z-index: 32;
|
|
694
|
+
}
|
|
717
695
|
.z-100 {
|
|
718
696
|
z-index: 100;
|
|
719
697
|
}
|
|
698
|
+
.w-100 {
|
|
699
|
+
width: 100%;
|
|
700
|
+
}
|
|
720
701
|
.h-100 {
|
|
721
702
|
height: 100%;
|
|
722
703
|
}
|
|
@@ -731,7 +712,7 @@ body {
|
|
|
731
712
|
}
|
|
732
713
|
|
|
733
714
|
.border-color {
|
|
734
|
-
border-color:
|
|
715
|
+
border-color: var(--card-border-color);
|
|
735
716
|
}
|
|
736
717
|
.border-left {
|
|
737
718
|
border-left-width: 1px;
|
|
@@ -754,10 +735,6 @@ body {
|
|
|
754
735
|
border-top-color: var(--card-border-color);
|
|
755
736
|
}
|
|
756
737
|
|
|
757
|
-
.bg-transparent {
|
|
758
|
-
background-color: transparent;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
738
|
.hr-border {
|
|
762
739
|
margin-top: 0;
|
|
763
740
|
margin-bottom: 0;
|
|
@@ -790,7 +767,7 @@ footer {
|
|
|
790
767
|
/* Default (Mobile) Styles */
|
|
791
768
|
filters-component form {
|
|
792
769
|
display: block; /* Stack direct children */
|
|
793
|
-
padding: var(--space-3); /* Consistent padding */
|
|
770
|
+
padding: var(--m-space-3); /* Consistent padding */
|
|
794
771
|
border-bottom: 1px solid var(--card-border-color);
|
|
795
772
|
}
|
|
796
773
|
|
|
@@ -798,7 +775,7 @@ filters-component form > * {
|
|
|
798
775
|
/* Target direct children: dropdowns, fieldset */
|
|
799
776
|
display: block; /* Ensure they are block level */
|
|
800
777
|
width: 100%; /* Make them take full width */
|
|
801
|
-
margin-bottom: var(--space-3); /* Add space below each item when stacked */
|
|
778
|
+
margin-bottom: var(--m-space-3); /* Add space below each item when stacked */
|
|
802
779
|
}
|
|
803
780
|
|
|
804
781
|
filters-component form > *:last-child {
|
|
@@ -807,7 +784,7 @@ filters-component form > *:last-child {
|
|
|
807
784
|
|
|
808
785
|
filters-component form label {
|
|
809
786
|
display: block; /* Ensure label stacks above input if needed */
|
|
810
|
-
margin-bottom: var(--space-1); /* Small space between label and input */
|
|
787
|
+
margin-bottom: var(--m-space-1); /* Small space between label and input */
|
|
811
788
|
}
|
|
812
789
|
|
|
813
790
|
filters-component form input {
|
|
@@ -907,9 +884,9 @@ console-panel {
|
|
|
907
884
|
display: flex;
|
|
908
885
|
flex-direction: row;
|
|
909
886
|
align-items: flex-end; /* Align form elements along their bottom edge */
|
|
910
|
-
gap: var(--space-3); /* Space between elements */
|
|
911
|
-
padding-left: var(--space-3);
|
|
912
|
-
padding-bottom: var(--space-3);
|
|
887
|
+
gap: var(--m-space-3); /* Space between elements */
|
|
888
|
+
padding-left: var(--m-space-3);
|
|
889
|
+
padding-bottom: var(--m-space-3);
|
|
913
890
|
}
|
|
914
891
|
|
|
915
892
|
filters-component form > * {
|
|
@@ -933,12 +910,6 @@ footer {
|
|
|
933
910
|
border-top: 1px solid var(--card-border-color);
|
|
934
911
|
}
|
|
935
912
|
|
|
936
|
-
.logo {
|
|
937
|
-
display: flex;
|
|
938
|
-
align-items: center;
|
|
939
|
-
gap: 0.25rem;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
913
|
.logo-image {
|
|
943
914
|
height: 25px;
|
|
944
915
|
width: 25px;
|
|
@@ -961,7 +932,6 @@ footer {
|
|
|
961
932
|
appearance: none;
|
|
962
933
|
-webkit-appearance: none;
|
|
963
934
|
display: flex;
|
|
964
|
-
align-items: center;
|
|
965
935
|
gap: 6px;
|
|
966
936
|
background-color: light-dark(var(--gray-900), white) !important;
|
|
967
937
|
color: light-dark(white, var(--gray-950)) !important;
|
|
@@ -969,7 +939,7 @@ footer {
|
|
|
969
939
|
border-radius: 3px !important;
|
|
970
940
|
outline: 0;
|
|
971
941
|
font-size: 14px !important;
|
|
972
|
-
line-height: 1;
|
|
942
|
+
line-height: 1 !important;
|
|
973
943
|
padding: 0px 12px !important;
|
|
974
944
|
height: 24px !important;
|
|
975
945
|
max-width: 160px;
|
|
@@ -992,7 +962,6 @@ footer {
|
|
|
992
962
|
}
|
|
993
963
|
|
|
994
964
|
.function-list-item {
|
|
995
|
-
padding: 8px;
|
|
996
965
|
font-size: 0.875rem;
|
|
997
966
|
border-radius: 3px;
|
|
998
967
|
margin: 0 0 1px 0;
|
|
@@ -1002,7 +971,7 @@ footer {
|
|
|
1002
971
|
.function-list-item-label {
|
|
1003
972
|
color: light-dark(var(--gray-800), var(--gray-400));
|
|
1004
973
|
font-weight: var(--font-weight-3);
|
|
1005
|
-
padding-bottom: var(--space-1);
|
|
974
|
+
padding-bottom: var(--m-space-1);
|
|
1006
975
|
}
|
|
1007
976
|
|
|
1008
977
|
.function-list-item-type {
|
|
@@ -1025,50 +994,12 @@ ol[type='content'] li:hover:not(.selected:not(.selected)) {
|
|
|
1025
994
|
background-color: light-dark(var(--gray-100), var(--gray-800)) !important;
|
|
1026
995
|
}
|
|
1027
996
|
|
|
1028
|
-
|
|
1029
|
-
background-color: var(--card-bg-color) !important;
|
|
1030
|
-
border-color: var(--card-border-color) !important;
|
|
1031
|
-
color: var(--text-color) !important;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
m-tabs {
|
|
1035
|
-
font-size: 0.8125rem;
|
|
1036
|
-
display: flex;
|
|
1037
|
-
align-items: center;
|
|
1038
|
-
gap: 16px;
|
|
1039
|
-
padding: 10px 0 10px 40px;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
m-tabs {
|
|
1043
|
-
& > :is(a, button) {
|
|
1044
|
-
padding: 4px 12px !important;
|
|
1045
|
-
color: light-dark(var(--gray-900), var(--gray-300)) !important;
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
m-tabs {
|
|
1050
|
-
& > :is(a, button) {
|
|
1051
|
-
&[aria-selected='true'] {
|
|
1052
|
-
background: light-dark(var(--gray-100), var(--gray-800));
|
|
1053
|
-
color: light-dark(var(--gray-800), var(--gray-100)) !important;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
:is(ul, ol)[type='content'] {
|
|
997
|
+
:is(ol)[type='content'] {
|
|
1059
998
|
& > li:not(:last-of-type) {
|
|
1060
999
|
border-bottom: 0 !important;
|
|
1061
1000
|
}
|
|
1062
1001
|
}
|
|
1063
1002
|
|
|
1064
|
-
.tab {
|
|
1065
|
-
font-size: 11px;
|
|
1066
|
-
font-weight: 500;
|
|
1067
|
-
border-radius: 0.1875rem;
|
|
1068
|
-
padding: 8px;
|
|
1069
|
-
border: 0 !important;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
1003
|
#payload {
|
|
1073
1004
|
height: 100%;
|
|
1074
1005
|
}
|
|
@@ -1131,11 +1062,7 @@ m-tabs {
|
|
|
1131
1062
|
}
|
|
1132
1063
|
|
|
1133
1064
|
.slab-stat {
|
|
1134
|
-
display: flex;
|
|
1135
|
-
align-items: center;
|
|
1136
1065
|
gap: 0 8px;
|
|
1137
|
-
margin: 0;
|
|
1138
|
-
padding: var(--space-3);
|
|
1139
1066
|
}
|
|
1140
1067
|
|
|
1141
1068
|
.slab-stat dt {
|
|
@@ -1259,3 +1186,101 @@ body:has(#nav-toggle:checked) {
|
|
|
1259
1186
|
/ 40px 1fr !important;
|
|
1260
1187
|
}
|
|
1261
1188
|
}
|
|
1189
|
+
|
|
1190
|
+
.bg-base {
|
|
1191
|
+
background-color: var(--base-background-color);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
.pre-wrap {
|
|
1195
|
+
white-space: pre-wrap;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
.nowrap {
|
|
1199
|
+
white-space: nowrap;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
.break-word {
|
|
1203
|
+
word-wrap: break-word;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.block {
|
|
1207
|
+
display: block;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
.inline-block {
|
|
1211
|
+
display: inline-block;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
.transparent {
|
|
1215
|
+
background: transparent;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
.component-color {
|
|
1219
|
+
color: light-dark(var(--gray-950), var(--gray-300));
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
.component-height {
|
|
1223
|
+
height: 2.5rem;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
.hidden {
|
|
1227
|
+
display: none;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.mar-l-specific {
|
|
1231
|
+
margin-left: 31px;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
.overflow-hidden {
|
|
1235
|
+
overflow: hidden;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
.overflow-auto {
|
|
1239
|
+
overflow: auto;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
.response-panel-grid {
|
|
1243
|
+
display: grid;
|
|
1244
|
+
grid-template-rows: auto 1fr;
|
|
1245
|
+
grid-template-columns: 1fr;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.gap-25 {
|
|
1249
|
+
gap: 0.25rem;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
.appearance-none {
|
|
1253
|
+
appearance: none;
|
|
1254
|
+
-webkit-appearance: none;
|
|
1255
|
+
-moz-appearance: none;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
.dropdown-template {
|
|
1259
|
+
padding-right: 2rem;
|
|
1260
|
+
border: 1px solid var(--gray-400);
|
|
1261
|
+
border-radius: var(--m-border-radius-2);
|
|
1262
|
+
height: var(--input-height, 2.5rem);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
.dropdown-template-div {
|
|
1266
|
+
position: absolute;
|
|
1267
|
+
top: 50%;
|
|
1268
|
+
right: 0.4rem;
|
|
1269
|
+
transform: translateY(-50%);
|
|
1270
|
+
pointer-events: none;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
.nav-min-width {
|
|
1274
|
+
min-width: 200px;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.nav-label {
|
|
1278
|
+
position: absolute;
|
|
1279
|
+
top: var(--m-space-2);
|
|
1280
|
+
right: var(--m-space-3);
|
|
1281
|
+
cursor: pointer;
|
|
1282
|
+
padding: 4px;
|
|
1283
|
+
border-radius: 2px;
|
|
1284
|
+
background: var(--color-surface-subtle);
|
|
1285
|
+
border: 1px solid var(--color-border-default);
|
|
1286
|
+
}
|
|
@@ -3,19 +3,19 @@ import {ApiBaseElement} from './api-base.js'
|
|
|
3
3
|
|
|
4
4
|
// Template for the console panel
|
|
5
5
|
const template = `
|
|
6
|
-
<div id="console-container"
|
|
7
|
-
<div
|
|
8
|
-
<h3 class="config-label mar-t-0 mar-b-0
|
|
6
|
+
<div id="console-container" class="relative y-scroll h-100 max-h-100 bg-base pad-t-0 pad-r-3 pad-b-7 pad-l-5 border-top">
|
|
7
|
+
<div class="sticky top-0 left-0 right-0 mar-t-0 mar-b-0">
|
|
8
|
+
<h3 class="config-label mar-t-0 mar-b-0 pad-t-3 bg-base z-32">
|
|
9
9
|
Console
|
|
10
10
|
</h3>
|
|
11
|
-
<div
|
|
11
|
+
<div class="bg-base flex items-center pad-0 pad-b-2 flex-end">
|
|
12
12
|
<toggle-switch toggle-key="preserveLog">
|
|
13
|
-
<span class="slab-text
|
|
13
|
+
<span class="slab-text mar-l-1">Preserve Log</span>
|
|
14
14
|
</toggle-switch>
|
|
15
15
|
<clear-button></clear-button>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
|
-
<pre id="console-output"
|
|
18
|
+
<pre id="console-output" class="pad-0 mar-t-0 mar-r-0 mar-b-5 mar-l-0 pre-wrap break-word"></pre>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
21
|
`
|
|
@@ -64,7 +64,7 @@ export class FetchButton extends ApiBaseElement {
|
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
66
|
// TODO: This assumes only two functions types for the sake of releasing today
|
|
67
|
-
if (this.api.store.selectedFunctionType ===
|
|
67
|
+
if (this.api.store.selectedFunctionType === this.SANITY_FUNCTION_DOCUMENT) {
|
|
68
68
|
await this.api.document({
|
|
69
69
|
projectId: this.api.store.selectedProject,
|
|
70
70
|
dataset: this.api.store.selectedDataset,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class ApiVersionComponent extends HTMLElement {
|
|
2
2
|
connectedCallback() {
|
|
3
3
|
this.innerHTML = `
|
|
4
|
-
<fieldset class="mar-t-
|
|
4
|
+
<fieldset class="mar-t-2">
|
|
5
5
|
<label class="slab-text">
|
|
6
|
-
<span
|
|
7
|
-
<input name="apiVersion" id="apiversion"
|
|
6
|
+
<span class="block mar-b-1">API Version</span>
|
|
7
|
+
<input name="apiVersion" id="apiversion" class="transparent border-color component-color component-height">
|
|
8
8
|
</label>
|
|
9
9
|
</fieldset>
|
|
10
10
|
`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class DocumentIdFilter extends HTMLElement {
|
|
2
2
|
connectedCallback() {
|
|
3
3
|
this.innerHTML = `
|
|
4
|
-
<fieldset class="mar-t-
|
|
4
|
+
<fieldset class="mar-t-2">
|
|
5
5
|
<label class="slab-text">
|
|
6
|
-
<span
|
|
7
|
-
<span
|
|
6
|
+
<span class="block mar-b-1">
|
|
7
|
+
<span class="flex items-center">
|
|
8
8
|
Document ID
|
|
9
9
|
<help-button>
|
|
10
10
|
<p>Fill out "Document ID" text field and then click the "Fetch Document" button to pre-populate the Document panel.</p>
|
|
@@ -13,8 +13,8 @@ class DocumentIdFilter extends HTMLElement {
|
|
|
13
13
|
</help-button>
|
|
14
14
|
</span>
|
|
15
15
|
</span>
|
|
16
|
-
<div
|
|
17
|
-
<input name="docid" id="docid"
|
|
16
|
+
<div class="flex flex-direction-row gap-2">
|
|
17
|
+
<input name="docid" id="docid" class="transparent component-color border-color component-height">
|
|
18
18
|
<fetch-button></fetch-button>
|
|
19
19
|
</div>
|
|
20
20
|
</label>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class WithTokenComponent extends HTMLElement {
|
|
2
2
|
connectedCallback() {
|
|
3
3
|
this.innerHTML = `
|
|
4
|
-
<fieldset class="mar-t-
|
|
5
|
-
<span class="slab-text
|
|
6
|
-
<span
|
|
4
|
+
<fieldset class="mar-t-2" class="flex flex-col">
|
|
5
|
+
<span class="slab-text block mar-b-1">
|
|
6
|
+
<span class="flex items-center">
|
|
7
7
|
With Token
|
|
8
8
|
<help-button>
|
|
9
9
|
<p><strong>With Token</strong> controls whether your function runs with or without authentication.</p>
|
|
@@ -12,7 +12,7 @@ class WithTokenComponent extends HTMLElement {
|
|
|
12
12
|
</help-button>
|
|
13
13
|
</span>
|
|
14
14
|
</span>
|
|
15
|
-
<toggle-switch toggle-key="withToken"
|
|
15
|
+
<toggle-switch toggle-key="withToken" class="flex component-height"></toggle-switch>
|
|
16
16
|
</fieldset>
|
|
17
17
|
`
|
|
18
18
|
}
|
|
@@ -8,8 +8,8 @@ class FiltersComponent extends ApiBaseElement {
|
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
this.innerHTML = `
|
|
11
|
-
<form
|
|
12
|
-
<fieldset
|
|
11
|
+
<form class="gap-2 pad-l-3 pad-b-3 border-bottom">
|
|
12
|
+
<fieldset class="flex gap-2">
|
|
13
13
|
<legend class="config-label">Client Options</legend>
|
|
14
14
|
${
|
|
15
15
|
docFunction
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* globals customElements */
|
|
2
2
|
import {ApiBaseElement} from './api-base.js'
|
|
3
3
|
|
|
4
|
-
const template = `<ol class="hidden-lg" type="content"
|
|
5
|
-
<fieldset class="hidden block-lg
|
|
4
|
+
const template = `<ol class="hidden-lg pad-t-0 pad-b-0 pad-r-4 pad-l-4" type="content"></ol>
|
|
5
|
+
<fieldset class="hidden block-lg pad-t-0 pad-b-0 pad-r-3 pad-l-3 mar-b-3"><select class="dropdown-select"></select></fieldset>
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
class FunctionList extends ApiBaseElement {
|
|
@@ -17,13 +17,22 @@ class FunctionList extends ApiBaseElement {
|
|
|
17
17
|
}
|
|
18
18
|
renderListItem = (func) => {
|
|
19
19
|
const selected = this.api.store.selectedIndex === func.name ? 'selected' : ''
|
|
20
|
-
return `<li data-name="${func.name}" class="function-list-item ${selected} flex flex-
|
|
20
|
+
return `<li data-name="${func.name}" class="function-list-item ${selected} flex flex-col pad-t-4 pad-b-4 pad-r-6 pad-l-6">
|
|
21
21
|
<span class="function-list-item-label">${func.name}</span>
|
|
22
22
|
<span class="function-list-item-type capitalize">${this.renderType(func.type)}</span>
|
|
23
23
|
</li>`
|
|
24
24
|
}
|
|
25
25
|
renderType = (type) => {
|
|
26
|
-
|
|
26
|
+
switch (type) {
|
|
27
|
+
case this.SANITY_FUNCTION_DOCUMENT:
|
|
28
|
+
return 'Document'
|
|
29
|
+
case this.SANITY_FUNCTION_MEDIA_LIBRARY_ASSET:
|
|
30
|
+
return 'Media Library'
|
|
31
|
+
case this.SANITY_FUNCTION_SCHEDULE:
|
|
32
|
+
return 'Schedule'
|
|
33
|
+
default:
|
|
34
|
+
return type.split('.').pop().replaceAll('-', ' ')
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
renderFunctions = () => {
|
|
29
38
|
if (this.api.store.functions.length > 0) {
|
|
@@ -39,7 +48,7 @@ class FunctionList extends ApiBaseElement {
|
|
|
39
48
|
})
|
|
40
49
|
.join('')
|
|
41
50
|
} else {
|
|
42
|
-
this.list.innerHTML = '<option class="pad-
|
|
51
|
+
this.list.innerHTML = '<option class="pad-2">No Blueprint found</li>'
|
|
43
52
|
this.select.innerHTML = '<option>No blueprint.json file found</option>'
|
|
44
53
|
}
|
|
45
54
|
}
|
|
@@ -36,12 +36,15 @@ div[popover] {
|
|
|
36
36
|
opacity: 1;
|
|
37
37
|
visibility: visible;
|
|
38
38
|
}
|
|
39
|
+
.help-button-padding {
|
|
40
|
+
padding: 0.75rem;
|
|
41
|
+
}
|
|
39
42
|
</style>
|
|
40
43
|
<button title="Info" popovertarget="popover-el">
|
|
41
44
|
<svg data-sanity-icon="help-circle" width="1em" height="1em" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 13C12.5 11 14 11.5 14 10C14 9.34375 13.5 8.5 12.5 8.5C11.5 8.5 11 9 10.5 9.5M12.5 16V14.5M20.5 12.5C20.5 16.9183 16.9183 20.5 12.5 20.5C8.08172 20.5 4.5 16.9183 4.5 12.5C4.5 8.08172 8.08172 4.5 12.5 4.5C16.9183 4.5 20.5 8.08172 20.5 12.5Z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path></svg>
|
|
42
45
|
</button>
|
|
43
46
|
<div popover="" id="popover-el">
|
|
44
|
-
<div
|
|
47
|
+
<div class="help-button-padding">
|
|
45
48
|
<slot>
|
|
46
49
|
</slot>
|
|
47
50
|
</div>
|
|
@@ -5,31 +5,31 @@ import {ApiBaseElement} from './api-base.js'
|
|
|
5
5
|
import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
6
6
|
|
|
7
7
|
function template({selectedEvent}) {
|
|
8
|
-
const singleModeStyle = selectedEvent === 'update' ? '
|
|
9
|
-
const deltaModeStyle = selectedEvent !== 'update' ? '' : '
|
|
8
|
+
const singleModeStyle = selectedEvent === 'update' ? ' class="hidden"' : ''
|
|
9
|
+
const deltaModeStyle = selectedEvent !== 'update' ? '' : ' class="hidden"'
|
|
10
10
|
return `<div id="payloadContainer" class="gutter-gradient relative h-100 max-h-100 y-scroll border-top border-top-none-l"${singleModeStyle}>
|
|
11
11
|
<div class="bg gutter-gradient sticky top-0 right-0 left-0 z-100">
|
|
12
|
-
<div class="flex items-center space-between
|
|
12
|
+
<div class="flex items-center space-between pad-t-2 pad-r-5 pad-b-2 pad-l-12">
|
|
13
13
|
<h2 class="config-label mar-t-0 mar-b-0">Document</h2>
|
|
14
14
|
</div>
|
|
15
|
-
<hr class='hr-border
|
|
15
|
+
<hr class='hr-border mar-l-specific' />
|
|
16
16
|
</div>
|
|
17
17
|
<div id="payload" name="payload" class='max-h-100 min-h-0'></div>
|
|
18
18
|
</div>
|
|
19
19
|
<div id="deltaPayloadContainer" class="gutter-gradient relative h-100 max-h-100 y-scroll border-top border-top-none-l"${deltaModeStyle}>
|
|
20
20
|
<div class="bg gutter-gradient sticky top-0 right-0 left-0 z-100">
|
|
21
|
-
<div class="flex items-center space-between
|
|
21
|
+
<div class="flex items-center space-between pad-t-2 pad-r-5 pad-b-2 pad-l-12">
|
|
22
22
|
<h2 class="config-label mar-t-0 mar-b-0">Before Document</h2>
|
|
23
23
|
</div>
|
|
24
|
-
<hr class='hr-border'
|
|
24
|
+
<hr class='hr-border' class="mar-l-specific" />
|
|
25
25
|
</div>
|
|
26
26
|
<div id="beforePayload" name="beforePayload" class='max-h-50 min-h-0'></div>
|
|
27
27
|
<div class="bg gutter-gradient sticky top-0 right-0 left-0 z-100">
|
|
28
|
-
<hr class='hr-border
|
|
29
|
-
<div class="flex items-center space-between
|
|
28
|
+
<hr class='hr-border mar-l-specific' />
|
|
29
|
+
<div class="flex items-center space-between pad-t-2 pad-r-5 pad-b-2 pad-l-12">
|
|
30
30
|
<h2 class="config-label mar-t-0 mar-b-0">After Document</h2>
|
|
31
31
|
</div>
|
|
32
|
-
<hr class='hr-border
|
|
32
|
+
<hr class='hr-border mar-l-specific' />
|
|
33
33
|
</div>
|
|
34
34
|
<div id="afterPayload" name="afterPayload" class='max-h-50 min-h-0'></div>
|
|
35
35
|
</div>
|
|
@@ -12,17 +12,17 @@ import {
|
|
|
12
12
|
import {ApiBaseElement} from './api-base.js'
|
|
13
13
|
import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
14
14
|
|
|
15
|
-
const template = `<div class="border-left border-top border-top-none-l h-100 gutter-gradient
|
|
15
|
+
const template = `<div class="border-left border-top border-top-none-l h-100 gutter-gradient max-h-100 overflow-hidden response-panel-grid">
|
|
16
16
|
<!-- Response Section -->
|
|
17
|
-
<div
|
|
18
|
-
<div
|
|
19
|
-
<h3 class="config-label
|
|
17
|
+
<div class="y-scroll min-h-0">
|
|
18
|
+
<div class="pad-b-12">
|
|
19
|
+
<h3 class="config-label mar-t-0 hidden">Response</h3>
|
|
20
20
|
<header class='flex space-between'>
|
|
21
|
-
<dl class='slab-stat'>
|
|
22
|
-
<dt
|
|
23
|
-
<dd id="size"
|
|
21
|
+
<dl class='flex items-center margin-0 pad-3 slab-stat'>
|
|
22
|
+
<dt class='nowrap'>Response size</dt>
|
|
23
|
+
<dd id="size" class='nowrap'></dd>
|
|
24
24
|
</dl>
|
|
25
|
-
<dl class='slab-stat'>
|
|
25
|
+
<dl class='flex items-center margin-0 pad-3 slab-stat'>
|
|
26
26
|
<dt>Time</dt>
|
|
27
27
|
<dd><time id="time" datetime=""></time></dd>
|
|
28
28
|
</dl>
|
|
@@ -5,12 +5,12 @@ import {basicSetup, EditorState, EditorView, json} from '../vendor/vendor.bundle
|
|
|
5
5
|
import {ApiBaseElement} from './api-base.js'
|
|
6
6
|
import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
7
7
|
|
|
8
|
-
const template = `<div class="border-left
|
|
8
|
+
const template = `<div class="border-left y-scroll min-h-0">
|
|
9
9
|
<div>
|
|
10
|
-
<h3 class="config-label
|
|
10
|
+
<h3 class="config-label mar-t-0 hidden">Filter/Projection</h3>
|
|
11
11
|
<header class='flex space-between'>
|
|
12
|
-
<dl class='slab-stat'>
|
|
13
|
-
<dt
|
|
12
|
+
<dl class='flex items-center margin-0 pad-3 slab-stat'>
|
|
13
|
+
<dt class='nowrap'>Filter/Projection</dt>
|
|
14
14
|
</dl>
|
|
15
15
|
</header>
|
|
16
16
|
<div id="rule" name="rule" class="cm-s-dracula"></div>
|
|
@@ -4,9 +4,9 @@ import {ApiBaseElement} from './api-base.js'
|
|
|
4
4
|
const runTemplate = `<svg data-sanity-icon="play" width="1em" height="1em" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.5 18.5V6.5L17.5 12.5L7.5 18.5Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path></svg>
|
|
5
5
|
<span title="Type CTRL + Enter to Run">Run</span>`
|
|
6
6
|
|
|
7
|
-
const template = `<div
|
|
8
|
-
<button ord="primary" class="sanity-button">
|
|
9
|
-
<span
|
|
7
|
+
const template = `<div class="pad-3">
|
|
8
|
+
<button ord="primary" class="items-center sanity-button">
|
|
9
|
+
<span class="flex pad-3 gap-25 justify-content-center flex-row">
|
|
10
10
|
${runTemplate}
|
|
11
11
|
</span>
|
|
12
12
|
</button>
|
|
@@ -15,7 +15,7 @@ const template = `<div style="padding: var(--space-3);">
|
|
|
15
15
|
class RunPanel extends ApiBaseElement {
|
|
16
16
|
invoke = () => {
|
|
17
17
|
const selectedEvent = this.api.store.selectedEvent
|
|
18
|
-
const docFunction = this.api.store.selectedFunctionType ===
|
|
18
|
+
const docFunction = this.api.store.selectedFunctionType === this.SANITY_FUNCTION_DOCUMENT
|
|
19
19
|
|
|
20
20
|
this.api.store.result = {logs: '', time: 0}
|
|
21
21
|
let event = {}
|