@scalar/pre-post-request-scripts 0.4.12 → 0.4.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @scalar/scripts
2
2
 
3
+ ## 0.4.15
4
+
5
+ ## 0.4.14
6
+
7
+ ### Patch Changes
8
+
9
+ - [#9211](https://github.com/scalar/scalar/pull/9211): feat: optimize layout for mobile
10
+ - Hide the document breadcrumb on small screens and surface workspace
11
+ switching from the menu instead, so the top bar stays uncluttered.
12
+ - Convert the document save / discard / pull / push / publish buttons to
13
+ header-button styling and only render the trailing divider when there
14
+ are actual cluster buttons next to it.
15
+ - Stack the address bar onto two rows on small screens so the URL and
16
+ the action cluster (copy / history / send) each get a full row.
17
+ - Hide the "Log in" affordance from the small-screen top bar (the menu
18
+ still owns it) and keep only the primary "Register" CTA there.
19
+ - Give the pre-request and post-response script editors proper vertical
20
+ padding so the help text no longer clips when it wraps.
21
+
22
+ ## 0.4.13
23
+
24
+ ### Patch Changes
25
+
26
+ - [#9135](https://github.com/scalar/scalar/pull/9135): feat: optimize layout for mobile
27
+ - Hide the document breadcrumb on small screens and surface workspace
28
+ switching from the menu instead, so the top bar stays uncluttered.
29
+ - Convert the document save / discard / pull / push / publish buttons to
30
+ header-button styling and only render the trailing divider when there
31
+ are actual cluster buttons next to it.
32
+ - Stack the address bar onto two rows on small screens so the URL and
33
+ the action cluster (copy / history / send) each get a full row.
34
+ - Hide the "Log in" affordance from the small-screen top bar (the menu
35
+ still owns it) and keep only the primary "Register" CTA there.
36
+ - Give the pre-request and post-response script editors proper vertical
37
+ padding so the help text no longer clips when it wraps.
38
+
3
39
  ## 0.4.12
4
40
 
5
41
  ## 0.4.11
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptsSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"names":[],"mappings":"AA+EA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAOnG,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,iBAAiB,CAAC,CAAA;CACvE,CAAC;AA2KF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ScriptsSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"names":[],"mappings":"AAiFA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAOnG,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,iBAAiB,CAAC,CAAA;CACvE,CAAC;AA6KF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptsSection.vue.js","names":[],"sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport ScriptEditor from '@/components/ScriptEditor.vue'\nimport { ViewLayoutCollapse } from '@/components/ViewLayout'\nimport ExampleScripts from '@/plugins/request-scripts/components/ExampleScripts.vue'\n\nconst { operation } = defineProps<{\n operation?: Pick<OperationObject, 'x-pre-request' | 'x-post-response'>\n}>()\n\nconst emit = defineEmits<{\n (e: 'operation:update:extension', payload: any): void\n}>()\n\nconst preRequestScript = computed(\n () => (operation?.['x-pre-request'] as string) ?? '',\n)\nconst postResponseScript = computed(\n () => (operation?.['x-post-response'] as string) ?? '',\n)\n\nconst hasAnyScript = computed(\n () =>\n preRequestScript.value.length > 0 || postResponseScript.value.length > 0,\n)\n\nconst updatePreRequestScript = (value: string) => {\n emit('operation:update:extension', { 'x-pre-request': value })\n}\nconst updatePostResponseScript = (value: string) => {\n emit('operation:update:extension', { 'x-post-response': value })\n}\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"w-full\"\n :defaultOpen=\"true\">\n <template #title>Scripts</template>\n <template #suffix>\n <!-- Show an indicator whether we have a script -->\n <div class=\"mr-2\">\n <div\n v-if=\"hasAnyScript\"\n class=\"bg-green h-2 w-2 rounded-full\" />\n </div>\n </template>\n\n <!-- Pre-request -->\n <div class=\"text-c-3 flex h-8 items-center border-y px-3 text-sm\">\n Pre-request — run before the request is sent (e.g. set variables,\n headers).\n </div>\n <ScriptEditor\n :modelValue=\"preRequestScript\"\n @update:modelValue=\"updatePreRequestScript\" />\n\n <!-- Post-response -->\n <div class=\"text-c-3 flex h-8 items-center border-y px-3 text-sm\">\n Post-response — run after the response is received (e.g. tests,\n assertions).\n </div>\n <ScriptEditor\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n <div class=\"border-y p-3\">\n <ExampleScripts\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n </div>\n </ViewLayoutCollapse>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScriptsSection.vue.js","names":[],"sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport ScriptEditor from '@/components/ScriptEditor.vue'\nimport { ViewLayoutCollapse } from '@/components/ViewLayout'\nimport ExampleScripts from '@/plugins/request-scripts/components/ExampleScripts.vue'\n\nconst { operation } = defineProps<{\n operation?: Pick<OperationObject, 'x-pre-request' | 'x-post-response'>\n}>()\n\nconst emit = defineEmits<{\n (e: 'operation:update:extension', payload: any): void\n}>()\n\nconst preRequestScript = computed(\n () => (operation?.['x-pre-request'] as string) ?? '',\n)\nconst postResponseScript = computed(\n () => (operation?.['x-post-response'] as string) ?? '',\n)\n\nconst hasAnyScript = computed(\n () =>\n preRequestScript.value.length > 0 || postResponseScript.value.length > 0,\n)\n\nconst updatePreRequestScript = (value: string) => {\n emit('operation:update:extension', { 'x-pre-request': value })\n}\nconst updatePostResponseScript = (value: string) => {\n emit('operation:update:extension', { 'x-post-response': value })\n}\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"w-full\"\n :defaultOpen=\"true\">\n <template #title>Scripts</template>\n <template #suffix>\n <!-- Show an indicator whether we have a script -->\n <div class=\"mr-2\">\n <div\n v-if=\"hasAnyScript\"\n class=\"bg-green h-2 w-2 rounded-full\" />\n </div>\n </template>\n\n <!-- Pre-request -->\n <div\n class=\"text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm\">\n Pre-request — run before the request is sent (e.g. set variables,\n headers).\n </div>\n <ScriptEditor\n :modelValue=\"preRequestScript\"\n @update:modelValue=\"updatePreRequestScript\" />\n\n <!-- Post-response -->\n <div\n class=\"text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm\">\n Post-response — run after the response is received (e.g. tests,\n assertions).\n </div>\n <ScriptEditor\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n <div class=\"border-y p-3\">\n <ExampleScripts\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n </div>\n </ViewLayoutCollapse>\n </div>\n</template>\n"],"mappings":""}
@@ -33,12 +33,12 @@ var ScriptsSection_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
33
33
  title: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Scripts", -1)])]),
34
34
  suffix: withCtx(() => [createElementVNode("div", _hoisted_2, [hasAnyScript.value ? (openBlock(), createElementBlock("div", _hoisted_3)) : createCommentVNode("", true)])]),
35
35
  default: withCtx(() => [
36
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "text-c-3 flex h-8 items-center border-y px-3 text-sm" }, " Pre-request — run before the request is sent (e.g. set variables, headers). ", -1)),
36
+ _cache[1] || (_cache[1] = createElementVNode("div", { class: "text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm" }, " Pre-request — run before the request is sent (e.g. set variables, headers). ", -1)),
37
37
  createVNode(ScriptEditor_default, {
38
38
  modelValue: preRequestScript.value,
39
39
  "onUpdate:modelValue": updatePreRequestScript
40
40
  }, null, 8, ["modelValue"]),
41
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "text-c-3 flex h-8 items-center border-y px-3 text-sm" }, " Post-response — run after the response is received (e.g. tests, assertions). ", -1)),
41
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm" }, " Post-response — run after the response is received (e.g. tests, assertions). ", -1)),
42
42
  createVNode(ScriptEditor_default, {
43
43
  modelValue: postResponseScript.value,
44
44
  "onUpdate:modelValue": updatePostResponseScript
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptsSection.vue.script.js","names":[],"sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport ScriptEditor from '@/components/ScriptEditor.vue'\nimport { ViewLayoutCollapse } from '@/components/ViewLayout'\nimport ExampleScripts from '@/plugins/request-scripts/components/ExampleScripts.vue'\n\nconst { operation } = defineProps<{\n operation?: Pick<OperationObject, 'x-pre-request' | 'x-post-response'>\n}>()\n\nconst emit = defineEmits<{\n (e: 'operation:update:extension', payload: any): void\n}>()\n\nconst preRequestScript = computed(\n () => (operation?.['x-pre-request'] as string) ?? '',\n)\nconst postResponseScript = computed(\n () => (operation?.['x-post-response'] as string) ?? '',\n)\n\nconst hasAnyScript = computed(\n () =>\n preRequestScript.value.length > 0 || postResponseScript.value.length > 0,\n)\n\nconst updatePreRequestScript = (value: string) => {\n emit('operation:update:extension', { 'x-pre-request': value })\n}\nconst updatePostResponseScript = (value: string) => {\n emit('operation:update:extension', { 'x-post-response': value })\n}\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"w-full\"\n :defaultOpen=\"true\">\n <template #title>Scripts</template>\n <template #suffix>\n <!-- Show an indicator whether we have a script -->\n <div class=\"mr-2\">\n <div\n v-if=\"hasAnyScript\"\n class=\"bg-green h-2 w-2 rounded-full\" />\n </div>\n </template>\n\n <!-- Pre-request -->\n <div class=\"text-c-3 flex h-8 items-center border-y px-3 text-sm\">\n Pre-request — run before the request is sent (e.g. set variables,\n headers).\n </div>\n <ScriptEditor\n :modelValue=\"preRequestScript\"\n @update:modelValue=\"updatePreRequestScript\" />\n\n <!-- Post-response -->\n <div class=\"text-c-3 flex h-8 items-center border-y px-3 text-sm\">\n Post-response — run after the response is received (e.g. tests,\n assertions).\n </div>\n <ScriptEditor\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n <div class=\"border-y p-3\">\n <ExampleScripts\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n </div>\n </ViewLayoutCollapse>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAYA,MAAM,OAAO;EAIb,MAAM,mBAAmB,eAChB,QAAA,YAAY,oBAA+B,GACpD;EACA,MAAM,qBAAqB,eAClB,QAAA,YAAY,sBAAiC,GACtD;EAEA,MAAM,eAAe,eAEjB,iBAAiB,MAAM,SAAS,KAAK,mBAAmB,MAAM,SAAS,EAC3E;EAEA,MAAM,0BAA0B,UAAkB;AAChD,QAAK,8BAA8B,EAAE,iBAAiB,OAAO,CAAA;;EAE/D,MAAM,4BAA4B,UAAkB;AAClD,QAAK,8BAA8B,EAAE,mBAAmB,OAAO,CAAA;;;uBAK/D,mBAqCM,OArCN,YAqCM,CApCJ,YAmCqB,MAAA,2BAAA,EAAA;IAlCnB,OAAM;IACL,aAAa;;IACH,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;IACb,QAAM,cAMT,CAJN,mBAIM,OAJN,YAIM,CAFI,aAAA,SAAA,WAAA,EADR,mBAE0C,OAF1C,WAE0C,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,CAAA,CAAA;2BAQxC;+BAHN,mBAGM,OAAA,EAHD,OAAM,wDAAsD,EAAC,iFAGlE,GAAA;KACA,YAEgD,sBAAA;MAD7C,YAAY,iBAAA;MACZ,uBAAmB;;+BAGtB,mBAGM,OAAA,EAHD,OAAM,wDAAsD,EAAC,kFAGlE,GAAA;KACA,YAEkD,sBAAA;MAD/C,YAAY,mBAAA;MACZ,uBAAmB;;KACtB,mBAIM,OAJN,YAIM,CAHJ,YAEkD,wBAAA;MAD/C,YAAY,mBAAA;MACZ,uBAAmB"}
1
+ {"version":3,"file":"ScriptsSection.vue.script.js","names":[],"sources":["../../../../src/plugins/request-scripts/components/ScriptsSection.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport ScriptEditor from '@/components/ScriptEditor.vue'\nimport { ViewLayoutCollapse } from '@/components/ViewLayout'\nimport ExampleScripts from '@/plugins/request-scripts/components/ExampleScripts.vue'\n\nconst { operation } = defineProps<{\n operation?: Pick<OperationObject, 'x-pre-request' | 'x-post-response'>\n}>()\n\nconst emit = defineEmits<{\n (e: 'operation:update:extension', payload: any): void\n}>()\n\nconst preRequestScript = computed(\n () => (operation?.['x-pre-request'] as string) ?? '',\n)\nconst postResponseScript = computed(\n () => (operation?.['x-post-response'] as string) ?? '',\n)\n\nconst hasAnyScript = computed(\n () =>\n preRequestScript.value.length > 0 || postResponseScript.value.length > 0,\n)\n\nconst updatePreRequestScript = (value: string) => {\n emit('operation:update:extension', { 'x-pre-request': value })\n}\nconst updatePostResponseScript = (value: string) => {\n emit('operation:update:extension', { 'x-post-response': value })\n}\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"w-full\"\n :defaultOpen=\"true\">\n <template #title>Scripts</template>\n <template #suffix>\n <!-- Show an indicator whether we have a script -->\n <div class=\"mr-2\">\n <div\n v-if=\"hasAnyScript\"\n class=\"bg-green h-2 w-2 rounded-full\" />\n </div>\n </template>\n\n <!-- Pre-request -->\n <div\n class=\"text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm\">\n Pre-request — run before the request is sent (e.g. set variables,\n headers).\n </div>\n <ScriptEditor\n :modelValue=\"preRequestScript\"\n @update:modelValue=\"updatePreRequestScript\" />\n\n <!-- Post-response -->\n <div\n class=\"text-c-3 flex min-h-8 items-center border-y px-3 py-2 text-sm\">\n Post-response — run after the response is received (e.g. tests,\n assertions).\n </div>\n <ScriptEditor\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n <div class=\"border-y p-3\">\n <ExampleScripts\n :modelValue=\"postResponseScript\"\n @update:modelValue=\"updatePostResponseScript\" />\n </div>\n </ViewLayoutCollapse>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAYA,MAAM,OAAO;EAIb,MAAM,mBAAmB,eAChB,QAAA,YAAY,oBAA+B,GACpD;EACA,MAAM,qBAAqB,eAClB,QAAA,YAAY,sBAAiC,GACtD;EAEA,MAAM,eAAe,eAEjB,iBAAiB,MAAM,SAAS,KAAK,mBAAmB,MAAM,SAAS,EAC3E;EAEA,MAAM,0BAA0B,UAAkB;AAChD,QAAK,8BAA8B,EAAE,iBAAiB,OAAO,CAAA;;EAE/D,MAAM,4BAA4B,UAAkB;AAClD,QAAK,8BAA8B,EAAE,mBAAmB,OAAO,CAAA;;;uBAK/D,mBAuCM,OAvCN,YAuCM,CAtCJ,YAqCqB,MAAA,2BAAA,EAAA;IApCnB,OAAM;IACL,aAAa;;IACH,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;IACb,QAAM,cAMT,CAJN,mBAIM,OAJN,YAIM,CAFI,aAAA,SAAA,WAAA,EADR,mBAE0C,OAF1C,WAE0C,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,CAAA,CAAA;2BASxC;+BAJN,mBAIM,OAAA,EAHJ,OAAM,iEAA+D,EAAC,iFAGxE,GAAA;KACA,YAEgD,sBAAA;MAD7C,YAAY,iBAAA;MACZ,uBAAmB;;+BAGtB,mBAIM,OAAA,EAHJ,OAAM,iEAA+D,EAAC,kFAGxE,GAAA;KACA,YAEkD,sBAAA;MAD/C,YAAY,mBAAA;MACZ,uBAAmB;;KACtB,mBAIM,OAJN,YAIM,CAHJ,YAEkD,wBAAA;MAD/C,YAAY,mBAAA;MACZ,uBAAmB"}
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "post-response scripts",
20
20
  "api client"
21
21
  ],
22
- "version": "0.4.12",
22
+ "version": "0.4.15",
23
23
  "engines": {
24
24
  "node": ">=22"
25
25
  },
@@ -54,10 +54,10 @@
54
54
  "postman-collection": "^5.3.0",
55
55
  "postman-sandbox": "^6.6.1",
56
56
  "vue": "^3.5.30",
57
- "@scalar/components": "0.24.2",
57
+ "@scalar/components": "0.25.0",
58
58
  "@scalar/use-codemirror": "0.14.11",
59
- "@scalar/oas-utils": "0.15.3",
60
- "@scalar/workspace-store": "0.49.3"
59
+ "@scalar/oas-utils": "0.17.0",
60
+ "@scalar/workspace-store": "0.51.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@vitejs/plugin-vue": "^6.0.3",