@scalar/api-reference 1.55.0 → 1.55.1
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 +6 -0
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.script.js +5 -5
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.script.js.map +1 -1
- package/dist/browser/standalone.js +219 -219
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.script.js +1 -1
- package/dist/helpers/markdown.d.ts.map +1 -1
- package/dist/helpers/normalize-configurations.d.ts.map +1 -1
- package/dist/helpers/normalize-configurations.js +6 -6
- package/dist/helpers/normalize-configurations.js.map +1 -1
- package/dist/style.css +4 -1
- package/package.json +12 -13
|
@@ -50,7 +50,7 @@ var _hoisted_5 = {
|
|
|
50
50
|
key: 2,
|
|
51
51
|
class: "references-footer"
|
|
52
52
|
};
|
|
53
|
-
var version = "1.55.
|
|
53
|
+
var version = "1.55.1";
|
|
54
54
|
if (typeof window !== "undefined") console.info(`@scalar/api-reference@${version}`);
|
|
55
55
|
var ApiReference_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
56
56
|
__name: "ApiReference",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/helpers/markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/helpers/markdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAUnD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAMhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-configurations.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-configurations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-configurations.d.ts","sourceRoot":"","sources":["../../src/helpers/normalize-configurations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EAGzC,MAAM,6BAA6B,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,4BAA4B,CAAA;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,CAAA;IACnD,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,GAAG,CAAC,EAAE,KAAK,CAAA;KAAE,CAAA;CAC7F,CAAA;AAED,KAAK,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;AAKvE;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,4BAA4B,GAAG,SAAS,KACtD,wBAoDF,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KACnF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAc5B,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { apiReferenceConfigurationWithSourceSchema, isConfigurationWithSources } from "@scalar/types/api-reference";
|
|
2
|
-
import
|
|
2
|
+
import { slugger } from "@scalar/helpers/string/slugger";
|
|
3
3
|
import { parseJsonOrYaml } from "@scalar/oas-utils/helpers";
|
|
4
4
|
//#region src/helpers/normalize-configurations.ts
|
|
5
5
|
/**
|
|
6
6
|
* Take any configuration and return a flat array of configurations.
|
|
7
7
|
*/
|
|
8
8
|
var normalizeConfigurations = (configuration) => {
|
|
9
|
-
const
|
|
9
|
+
const { slug } = slugger();
|
|
10
10
|
const normalized = {};
|
|
11
11
|
if (!configuration) return normalized;
|
|
12
12
|
(Array.isArray(configuration) ? configuration : [configuration]).flatMap((c) => {
|
|
@@ -22,7 +22,7 @@ var normalizeConfigurations = (configuration) => {
|
|
|
22
22
|
/** Validation with migrate deprecated attributes to their new format */
|
|
23
23
|
const validated = apiReferenceConfigurationWithSourceSchema.safeParse(source);
|
|
24
24
|
return validated.success ? validated.data : null;
|
|
25
|
-
}).filter((c) => !!c && (!!c.url || !!c.content)).map((source, index) => addSlugAndTitle(source, index,
|
|
25
|
+
}).filter((c) => !!c && (!!c.url || !!c.content)).map((source, index) => addSlugAndTitle(source, index, slug)).forEach((c) => {
|
|
26
26
|
const { url, content, ...config } = c;
|
|
27
27
|
normalized[c.slug] = {
|
|
28
28
|
config,
|
|
@@ -43,15 +43,15 @@ var normalizeContent = (content) => {
|
|
|
43
43
|
return content;
|
|
44
44
|
};
|
|
45
45
|
/** Process a single spec configuration so that it has a title and a slug */
|
|
46
|
-
var addSlugAndTitle = (source, index = 0,
|
|
46
|
+
var addSlugAndTitle = (source, index = 0, slug) => {
|
|
47
47
|
if (source.title) return {
|
|
48
48
|
...source,
|
|
49
|
-
slug: source.slug ||
|
|
49
|
+
slug: source.slug || slug(source.title),
|
|
50
50
|
title: source.title
|
|
51
51
|
};
|
|
52
52
|
if (source.slug) return {
|
|
53
53
|
...source,
|
|
54
|
-
slug:
|
|
54
|
+
slug: slug(source.slug),
|
|
55
55
|
title: source.slug
|
|
56
56
|
};
|
|
57
57
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-configurations.js","names":[],"sources":["../../src/helpers/normalize-configurations.ts"],"sourcesContent":["import { parseJsonOrYaml } from '@scalar/oas-utils/helpers'\nimport {\n type AnyApiReferenceConfiguration,\n type ApiReferenceConfigurationRaw,\n type ApiReferenceConfigurationWithSource,\n apiReferenceConfigurationWithSourceSchema,\n isConfigurationWithSources,\n} from '@scalar/types/api-reference'\
|
|
1
|
+
{"version":3,"file":"normalize-configurations.js","names":[],"sources":["../../src/helpers/normalize-configurations.ts"],"sourcesContent":["import { slugger } from '@scalar/helpers/string/slugger'\nimport { parseJsonOrYaml } from '@scalar/oas-utils/helpers'\nimport {\n type AnyApiReferenceConfiguration,\n type ApiReferenceConfigurationRaw,\n type ApiReferenceConfigurationWithSource,\n apiReferenceConfigurationWithSourceSchema,\n isConfigurationWithSources,\n} from '@scalar/types/api-reference'\n\n/** Processed API Reference Configuration\n *\n * Creates the required title and slug for the API Reference.\n * Separate the source into a dedicated object\n * Returns the raw configuration to pass to components\n */\nexport type NormalizedConfiguration = {\n title: string\n slug: string\n config: ApiReferenceConfigurationRaw\n default: boolean\n agent: ApiReferenceConfigurationWithSource['agent']\n source: { url: string; content?: never } | { content: Record<string, unknown>; url?: never }\n}\n\ntype NormalizedConfigurations = Record<string, NormalizedConfiguration>\n\ntype ConfigWithRequiredSource = Omit<ApiReferenceConfigurationWithSource, 'url' | 'content'> &\n ({ url: string; content?: never } | { content: Record<string, unknown>; url?: never })\n\n/**\n * Take any configuration and return a flat array of configurations.\n */\nexport const normalizeConfigurations = (\n configuration: AnyApiReferenceConfiguration | undefined,\n): NormalizedConfigurations => {\n const { slug } = slugger()\n\n const normalized: NormalizedConfigurations = {}\n\n if (!configuration) {\n return normalized\n }\n\n const configList = Array.isArray(configuration) ? configuration : [configuration]\n\n configList\n /** Create a flat array of configurations with their document source data integrated. */\n .flatMap((c) => {\n // Check if this config has a 'sources' array property\n if (isConfigurationWithSources(c)) {\n // Destructure to separate sources array from other config properties\n const { sources: configSources, ...rest } = c\n\n // For each source in the array:\n // - Merge the source with the parent config properties\n // - Handle undefined sources by returning empty array via ?? []\n return configSources?.map((source) => ({ ...rest, ...source })) ?? []\n }\n\n // If config doesn't have sources array, treat the config itself as a source\n return [c]\n })\n .map((source) => {\n /** Validation with migrate deprecated attributes to their new format */\n const validated = apiReferenceConfigurationWithSourceSchema.safeParse(source)\n return validated.success ? validated.data : null\n })\n /** Filter out configurations that failed validation or don't have a url or content */\n .filter((c): c is ConfigWithRequiredSource => !!c && (!!c.url || !!c.content))\n /** Add required attributes to the source */\n .map((source, index) => addSlugAndTitle(source, index, slug))\n /** Separate the configuration and sources by slug */\n .forEach((c) => {\n const { url, content, ...config } = c\n normalized[c.slug] = {\n config,\n title: c.title,\n slug: c.slug,\n default: !!c?.default,\n agent: c.agent,\n source: content ? { content: normalizeContent(content) ?? {} } : { url },\n }\n })\n\n // Process them and return normalized\n return normalized\n}\n\n/** Normalize content into a JS object or return null if it is falsey */\nexport const normalizeContent = (\n content: string | Record<string, unknown> | (() => string | Record<string, unknown>),\n): Record<string, unknown> | null => {\n if (!content) {\n return null\n }\n\n if (typeof content === 'function') {\n return normalizeContent(content())\n }\n\n if (typeof content === 'string') {\n return parseJsonOrYaml(content)\n }\n\n return content\n}\n\n/** Process a single spec configuration so that it has a title and a slug */\nconst addSlugAndTitle = (\n source: ConfigWithRequiredSource,\n index = 0,\n slug: (v: string) => string,\n): ConfigWithRequiredSource & { slug: string; title: string } => {\n // Case 1: Title exists, generate slug from it\n if (source.title) {\n return {\n ...source,\n slug: source.slug || slug(source.title),\n title: source.title,\n }\n }\n\n // Case 2: Slug exists but no title, use slug as title\n if (source.slug) {\n return {\n ...source,\n slug: slug(source.slug),\n title: source.slug,\n }\n }\n\n // Case 3: Neither exists, use index\n return {\n ...source,\n slug: `api-${index + 1}`,\n title: `API #${index + 1}`,\n }\n}\n"],"mappings":";;;;;;;AAiCA,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,KAAI,OAAO,KACT,QAAO;EACL,GAAG;EACH,MAAM,KAAK,OAAO,KAAK;EACvB,OAAO,OAAO;EACf;AAIH,QAAO;EACL,GAAG;EACH,MAAM,OAAO,QAAQ;EACrB,OAAO,QAAQ,QAAQ;EACxB"}
|
package/dist/style.css
CHANGED
|
@@ -391,7 +391,7 @@ to {
|
|
|
391
391
|
margin-top: 0;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
.references-classic .introduction-description[data-v-
|
|
394
|
+
.references-classic .introduction-description[data-v-0370764f] img {
|
|
395
395
|
max-width: 720px;
|
|
396
396
|
}
|
|
397
397
|
|
|
@@ -6045,6 +6045,9 @@ to {
|
|
|
6045
6045
|
.scalar-app .min-h-96 {
|
|
6046
6046
|
min-height: 384px;
|
|
6047
6047
|
}
|
|
6048
|
+
.scalar-app .min-h-128 {
|
|
6049
|
+
min-height: 512px;
|
|
6050
|
+
}
|
|
6048
6051
|
.scalar-app .min-h-header {
|
|
6049
6052
|
min-height: 48px;
|
|
6050
6053
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"vue",
|
|
21
21
|
"vue3"
|
|
22
22
|
],
|
|
23
|
-
"version": "1.55.
|
|
23
|
+
"version": "1.55.1",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22"
|
|
26
26
|
},
|
|
@@ -85,25 +85,24 @@
|
|
|
85
85
|
"@unhead/vue": "^2.1.4",
|
|
86
86
|
"@vueuse/core": "13.9.0",
|
|
87
87
|
"fuse.js": "^7.1.0",
|
|
88
|
-
"github-slugger": "2.0.0",
|
|
89
88
|
"microdiff": "^1.5.0",
|
|
90
89
|
"nanoid": "^5.1.6",
|
|
91
90
|
"vue": "^3.5.30",
|
|
92
91
|
"yaml": "^2.8.3",
|
|
93
|
-
"@scalar/agent-chat": "0.10.
|
|
92
|
+
"@scalar/agent-chat": "0.10.13",
|
|
94
93
|
"@scalar/code-highlight": "0.3.4",
|
|
95
|
-
"@scalar/api-client": "3.5.
|
|
96
|
-
"@scalar/components": "0.24.
|
|
94
|
+
"@scalar/api-client": "3.5.1",
|
|
95
|
+
"@scalar/components": "0.24.1",
|
|
97
96
|
"@scalar/icons": "0.7.2",
|
|
98
|
-
"@scalar/helpers": "0.5.
|
|
99
|
-
"@scalar/oas-utils": "0.15.
|
|
100
|
-
"@scalar/
|
|
101
|
-
"@scalar/
|
|
97
|
+
"@scalar/helpers": "0.5.5",
|
|
98
|
+
"@scalar/oas-utils": "0.15.1",
|
|
99
|
+
"@scalar/sidebar": "0.9.9",
|
|
100
|
+
"@scalar/snippetz": "0.9.5",
|
|
102
101
|
"@scalar/themes": "0.15.3",
|
|
102
|
+
"@scalar/types": "0.9.5",
|
|
103
103
|
"@scalar/use-hooks": "0.4.3",
|
|
104
|
-
"@scalar/
|
|
105
|
-
"@scalar/
|
|
106
|
-
"@scalar/types": "0.9.4"
|
|
104
|
+
"@scalar/workspace-store": "0.49.1",
|
|
105
|
+
"@scalar/use-toasts": "0.10.2"
|
|
107
106
|
},
|
|
108
107
|
"devDependencies": {
|
|
109
108
|
"@hono/node-server": "^1.19.10",
|
|
@@ -121,7 +120,7 @@
|
|
|
121
120
|
"vite-plugin-banner": "^0.8.1",
|
|
122
121
|
"vite-plugin-css-injected-by-js": "^5.0.0",
|
|
123
122
|
"vitest": "4.1.0",
|
|
124
|
-
"@scalar/core": "0.5.
|
|
123
|
+
"@scalar/core": "0.5.6",
|
|
125
124
|
"@scalar/galaxy": "0.6.4"
|
|
126
125
|
},
|
|
127
126
|
"scripts": {
|