@scalar/api-client-react 2.0.3 → 2.0.4

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,11 @@
1
1
  # @scalar/api-client-react
2
2
 
3
+ ## 2.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#8943](https://github.com/scalar/scalar/pull/8943): feat: added customFetch config to the client
8
+
3
9
  ## 2.0.3
4
10
 
5
11
  ## 2.0.2
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lazy-load.ts","../src/use-api-client.ts"],"sourcesContent":["import type { ApiClientModalOptions } from '@scalar/api-client/modal'\n\n/**\n * Creates a lazy singleton getter: the factory runs at most once, caches the resulting promise,\n * and clears the cache on failure so the next call can retry.\n *\n * Optional args are forwarded to the factory on the first (cache-miss) call only.\n * Subsequent calls return the cached promise regardless of the args passed.\n */\nconst makeLazySingleton = <T, Args extends unknown[] = []>(\n factory: (...args: Args) => Promise<T>,\n): ((...args: Args) => Promise<T>) => {\n let cached: Promise<T> | undefined\n return (...args: Args) => {\n cached ??= factory(...args).catch((error) => {\n cached = undefined\n throw error\n })\n return cached\n }\n}\n\n/** Lazy load the client modal creator */\nexport const getClientModalCreator = makeLazySingleton(() =>\n import('@scalar/api-client/modal').then(({ createApiClientModal }) => createApiClientModal),\n)\n\n/** Module-scoped singleton workspace store (lazy-loaded on first use). */\nexport const getWorkspaceStoreSingleton = makeLazySingleton(() =>\n import('@scalar/workspace-store/client').then(({ createWorkspaceStore }) => createWorkspaceStore()),\n)\n\n/** Module-scoped singleton workspace event bus (lazy-loaded on first use). */\nexport const getWorkspaceEventBusSingleton = makeLazySingleton(() =>\n import('@scalar/workspace-store/events').then(({ createWorkspaceEventBus }) => createWorkspaceEventBus()),\n)\n\n/**\n * Lazily creates the singleton Vue app, mounts it as the last child of document.body,\n * and returns the controller. Subsequent calls return the same promise.\n *\n * Only modal-supported options are accepted here. Document-specific fields\n * (`url`, `content`) must be registered via `workspaceStore.addDocument` after the client\n * is ready — they are not part of the modal constructor.\n */\nexport const getOrCreateApiClient = makeLazySingleton(async (options: ApiClientModalOptions = {}) => {\n const el = document.createElement('div')\n el.className = 'scalar-app'\n document.body.appendChild(el)\n\n try {\n const [createModal, workspaceStore, eventBus] = await Promise.all([\n getClientModalCreator(),\n getWorkspaceStoreSingleton(),\n getWorkspaceEventBusSingleton(),\n ])\n\n const apiClient = createModal({\n el,\n eventBus,\n workspaceStore,\n options,\n // TODO: map plugins from configuration when available\n // plugins: mapConfigPlugins(options),\n })\n\n return { apiClient, workspaceStore }\n } catch (error) {\n el.remove()\n throw error\n }\n})\n","'use client'\n\nimport type { ApiClientModal, ApiClientModalOptions, RoutePayload } from '@scalar/api-client/modal'\nimport { useEffect, useRef, useState } from 'react'\n\nimport './style.css'\n\nimport { isObjectEqual } from '@scalar/helpers/object/is-object-equal'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport { getOrCreateApiClient } from './lazy-load'\n\nglobalThis.__VUE_OPTIONS_API__ = true\nglobalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true\nglobalThis.__VUE_PROD_DEVTOOLS__ = false\n\nexport type ApiClientConfigurationReact = ApiClientModalOptions & {\n // content?: Record<string, unknown>\n url: string\n}\n\nexport type UseApiClientModalProps = {\n /** Configuration for the Api Client (url or inline content) */\n configuration: ApiClientConfigurationReact\n}\n\n/** Tracks which documents are/have been loaded so we dont duplicate */\nconst documentSet = new Set<string>()\n\n/**\n * Returns the singleton Api Client\n *\n * On first call the Vue app is lazily created and appended to document.body where it\n * lives for the lifetime of the page — it is never unmounted, so it survives client-side\n * navigation without losing state.\n *\n * Subsequent calls from any component share the same instance of the client but can use the same\n * or different documents\n */\nexport const useApiClient = ({\n configuration,\n}: UseApiClientModalProps): (Omit<ApiClientModal, 'open'> & { open: (payload: RoutePayload) => void }) | undefined => {\n const [client, setClient] = useState<ApiClientModal | undefined>(undefined)\n const [workspaceStore, setWorkspaceStore] = useState<WorkspaceStore | undefined>(undefined)\n const documentSlugRef = useRef('')\n const previousModalOptionsRef = useRef<ApiClientModalOptions | undefined>(undefined)\n\n /** Small wrapper to set the documentSlug */\n const open = (payload: RoutePayload) => client?.open({ documentSlug: documentSlugRef.current, ...payload })\n\n useEffect(() => {\n let cancelled = false\n\n // Strip document-specific fields before passing to the modal constructor.\n const { url, ...modalOptions } = configuration\n\n void getOrCreateApiClient(modalOptions)?.then((_client) => {\n if (cancelled || !_client) {\n return\n }\n\n // Compute the slug here so we can batch all three state updates into one render,\n // preventing a render where `client` is set but `documentSlug` is still ''.\n const slug = url || ''\n\n // React always provides the complete modal option set for this hook instance,\n // so we overwrite to clear options removed by consumers.\n _client.apiClient.updateOptions(modalOptions, true)\n previousModalOptionsRef.current = modalOptions\n\n setClient(_client.apiClient)\n setWorkspaceStore(_client.workspaceStore)\n documentSlugRef.current = slug\n\n if (slug && !documentSet.has(slug)) {\n documentSet.add(slug)\n void _client.workspaceStore.addDocument({ name: slug, url })\n }\n })\n\n return () => {\n cancelled = true\n }\n\n // Only run once per mount\n }, [])\n\n // Register new document when we detect the url has changed\n useEffect(() => {\n if (!client || !workspaceStore) {\n return\n }\n\n const slug = configuration.url || 'default'\n documentSlugRef.current = slug\n\n if (documentSet.has(slug)) {\n return\n }\n documentSet.add(slug)\n\n void workspaceStore.addDocument({ name: slug, url: configuration.url })\n }, [client, configuration.url, workspaceStore])\n\n // Update the modal options when the configuration changes\n useEffect(() => {\n if (!client || !configuration) {\n return\n }\n\n const { url: _, ...modalOptions } = configuration\n if (isObjectEqual(previousModalOptionsRef.current, modalOptions)) {\n return\n }\n\n client.updateOptions(modalOptions, true)\n previousModalOptionsRef.current = modalOptions\n }, [client, configuration])\n\n return client\n ? {\n ...client,\n open,\n }\n : undefined\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAM,qBACJ,YACoC;CACpC,IAAI;AACJ,SAAQ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iBAAiB;AAE5B,uBAAqB,aAAa,EAAE,MAAM,YAAY;AACzD,OAAI,aAAa,CAAC,QAChB;GAKF,MAAM,OAAO,OAAO;AAIpB,WAAQ,UAAU,cAAc,cAAc,KAAK;AACnD,2BAAwB,UAAU;AAElC,aAAU,QAAQ,UAAU;AAC5B,qBAAkB,QAAQ,eAAe;AACzC,mBAAgB,UAAU;AAE1B,OAAI,QAAQ,CAAC,YAAY,IAAI,KAAK,EAAE;AAClC,gBAAY,IAAI,KAAK;AAChB,YAAQ,eAAe,YAAY;KAAE,MAAM;KAAM;KAAK,CAAC;;IAE9D;AAEF,eAAa;AACX,eAAY;;IAIb,EAAE,CAAC;AAGN,iBAAgB;AACd,MAAI,CAAC,UAAU,CAAC,eACd;EAGF,MAAM,OAAO,cAAc,OAAO;AAClC,kBAAgB,UAAU;AAE1B,MAAI,YAAY,IAAI,KAAK,CACvB;AAEF,cAAY,IAAI,KAAK;AAEhB,iBAAe,YAAY;GAAE,MAAM;GAAM,KAAK,cAAc;GAAK,CAAC;IACtE;EAAC;EAAQ,cAAc;EAAK;EAAe,CAAC;AAG/C,iBAAgB;AACd,MAAI,CAAC,UAAU,CAAC,cACd;EAGF,MAAM,EAAE,KAAK,GAAG,GAAG,iBAAiB;AACpC,MAAI,cAAc,wBAAwB,SAAS,aAAa,CAC9D;AAGF,SAAO,cAAc,cAAc,KAAK;AACxC,0BAAwB,UAAU;IACjC,CAAC,QAAQ,cAAc,CAAC;AAE3B,QAAO,SACH;EACE,GAAG;EACH;EACD,GACD,KAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lazy-load.ts","../src/use-api-client.ts"],"sourcesContent":["import type { ApiClientOptions } from '@scalar/api-client/modal'\n\n/**\n * Creates a lazy singleton getter: the factory runs at most once, caches the resulting promise,\n * and clears the cache on failure so the next call can retry.\n *\n * Optional args are forwarded to the factory on the first (cache-miss) call only.\n * Subsequent calls return the cached promise regardless of the args passed.\n */\nconst makeLazySingleton = <T, Args extends unknown[] = []>(\n factory: (...args: Args) => Promise<T>,\n): ((...args: Args) => Promise<T>) => {\n let cached: Promise<T> | undefined\n return (...args: Args) => {\n cached ??= factory(...args).catch((error) => {\n cached = undefined\n throw error\n })\n return cached\n }\n}\n\n/** Lazy load the client modal creator */\nexport const getClientModalCreator = makeLazySingleton(() =>\n import('@scalar/api-client/modal').then(({ createApiClientModal }) => createApiClientModal),\n)\n\n/** Module-scoped singleton workspace store (lazy-loaded on first use). */\nexport const getWorkspaceStoreSingleton = makeLazySingleton(() =>\n import('@scalar/workspace-store/client').then(({ createWorkspaceStore }) => createWorkspaceStore()),\n)\n\n/** Module-scoped singleton workspace event bus (lazy-loaded on first use). */\nexport const getWorkspaceEventBusSingleton = makeLazySingleton(() =>\n import('@scalar/workspace-store/events').then(({ createWorkspaceEventBus }) => createWorkspaceEventBus()),\n)\n\n/**\n * Lazily creates the singleton Vue app, mounts it as the last child of document.body,\n * and returns the controller. Subsequent calls return the same promise.\n *\n * Only modal-supported options are accepted here. Document-specific fields\n * (`url`, `content`) must be registered via `workspaceStore.addDocument` after the client\n * is ready — they are not part of the modal constructor.\n */\nexport const getOrCreateApiClient = makeLazySingleton(async (options: ApiClientOptions = {}) => {\n const el = document.createElement('div')\n el.className = 'scalar-app'\n document.body.appendChild(el)\n\n try {\n const [createModal, workspaceStore, eventBus] = await Promise.all([\n getClientModalCreator(),\n getWorkspaceStoreSingleton(),\n getWorkspaceEventBusSingleton(),\n ])\n\n const apiClient = createModal({\n el,\n eventBus,\n workspaceStore,\n options,\n // TODO: map plugins from configuration when available\n // plugins: mapConfigPlugins(options),\n })\n\n return { apiClient, workspaceStore }\n } catch (error) {\n el.remove()\n throw error\n }\n})\n","'use client'\n\nimport type { ApiClientModal, ApiClientOptions, RoutePayload } from '@scalar/api-client/modal'\nimport { useEffect, useRef, useState } from 'react'\n\nimport './style.css'\n\nimport { isObjectEqual } from '@scalar/helpers/object/is-object-equal'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport { getOrCreateApiClient } from './lazy-load'\n\nglobalThis.__VUE_OPTIONS_API__ = true\nglobalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true\nglobalThis.__VUE_PROD_DEVTOOLS__ = false\n\nexport type ApiClientConfigurationReact = ApiClientOptions & {\n // content?: Record<string, unknown>\n url: string\n}\n\nexport type UseApiClientModalProps = {\n /** Configuration for the Api Client (url or inline content) */\n configuration: ApiClientConfigurationReact\n}\n\n/** Tracks which documents are/have been loaded so we dont duplicate */\nconst documentSet = new Set<string>()\n\n/**\n * Returns the singleton Api Client\n *\n * On first call the Vue app is lazily created and appended to document.body where it\n * lives for the lifetime of the page — it is never unmounted, so it survives client-side\n * navigation without losing state.\n *\n * Subsequent calls from any component share the same instance of the client but can use the same\n * or different documents\n */\nexport const useApiClient = ({\n configuration,\n}: UseApiClientModalProps): (Omit<ApiClientModal, 'open'> & { open: (payload: RoutePayload) => void }) | undefined => {\n const [client, setClient] = useState<ApiClientModal | undefined>(undefined)\n const [workspaceStore, setWorkspaceStore] = useState<WorkspaceStore | undefined>(undefined)\n const documentSlugRef = useRef('')\n const previousModalOptionsRef = useRef<ApiClientOptions | undefined>(undefined)\n\n /** Small wrapper to set the documentSlug */\n const open = (payload: RoutePayload) => client?.open({ documentSlug: documentSlugRef.current, ...payload })\n\n useEffect(() => {\n let cancelled = false\n\n // Strip document-specific fields before passing to the modal constructor.\n const { url, ...modalOptions } = configuration\n\n void getOrCreateApiClient(modalOptions)?.then((_client) => {\n if (cancelled || !_client) {\n return\n }\n\n // Compute the slug here so we can batch all three state updates into one render,\n // preventing a render where `client` is set but `documentSlug` is still ''.\n const slug = url || ''\n\n // React always provides the complete modal option set for this hook instance,\n // so we overwrite to clear options removed by consumers.\n _client.apiClient.updateOptions(modalOptions, true)\n previousModalOptionsRef.current = modalOptions\n\n setClient(_client.apiClient)\n setWorkspaceStore(_client.workspaceStore)\n documentSlugRef.current = slug\n\n if (slug && !documentSet.has(slug)) {\n documentSet.add(slug)\n void _client.workspaceStore.addDocument({ name: slug, url })\n }\n })\n\n return () => {\n cancelled = true\n }\n\n // Only run once per mount\n }, [])\n\n // Register new document when we detect the url has changed\n useEffect(() => {\n if (!client || !workspaceStore) {\n return\n }\n\n const slug = configuration.url || 'default'\n documentSlugRef.current = slug\n\n if (documentSet.has(slug)) {\n return\n }\n documentSet.add(slug)\n\n void workspaceStore.addDocument({ name: slug, url: configuration.url })\n }, [client, configuration.url, workspaceStore])\n\n // Update the modal options when the configuration changes\n useEffect(() => {\n if (!client || !configuration) {\n return\n }\n\n const { url: _, ...modalOptions } = configuration\n if (isObjectEqual(previousModalOptionsRef.current, modalOptions)) {\n return\n }\n\n client.updateOptions(modalOptions, true)\n previousModalOptionsRef.current = modalOptions\n }, [client, configuration])\n\n return client\n ? {\n ...client,\n open,\n }\n : undefined\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAM,qBACJ,YACoC;CACpC,IAAI;AACJ,SAAQ,GAAG,SAAe;AACxB,aAAW,QAAQ,GAAG,KAAK,CAAC,OAAO,UAAU;AAC3C,YAAS,KAAA;AACT,SAAM;IACN;AACF,SAAO;;;;AAKX,IAAa,wBAAwB,wBACnC,OAAO,4BAA4B,MAAM,EAAE,2BAA2B,qBAAqB,CAC5F;;AAGD,IAAa,6BAA6B,wBACxC,OAAO,kCAAkC,MAAM,EAAE,2BAA2B,sBAAsB,CAAC,CACpG;;AAGD,IAAa,gCAAgC,wBAC3C,OAAO,kCAAkC,MAAM,EAAE,8BAA8B,yBAAyB,CAAC,CAC1G;;;;;;;;;AAUD,IAAa,uBAAuB,kBAAkB,OAAO,UAA4B,EAAE,KAAK;CAC9F,MAAM,KAAK,SAAS,cAAc,MAAM;AACxC,IAAG,YAAY;AACf,UAAS,KAAK,YAAY,GAAG;AAE7B,KAAI;EACF,MAAM,CAAC,aAAa,gBAAgB,YAAY,MAAM,QAAQ,IAAI;GAChE,uBAAuB;GACvB,4BAA4B;GAC5B,+BAAA;GACD,CAAC;AAWF,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C;IACtE;EAAC;EAAQ,cAAc;EAAK;EAAe,CAAC;AAG/C,iBAAgB;AACd,MAAI,CAAC,UAAU,CAAC,cACd;EAGF,MAAM,EAAE,KAAK,GAAG,GAAG,iBAAiB;AACpC,MAAI,cAAc,wBAAwB,SAAS,aAAa,CAC9D;AAGF,SAAO,cAAc,cAAc,KAAK;AACxC,0BAAwB,UAAU;IACjC,CAAC,QAAQ,cAAc,CAAC;AAE3B,QAAO,SACH;EACE,GAAG;EACH;EACD,GACD,KAAA"}
@@ -1,4 +1,4 @@
1
- import type { ApiClientModalOptions } from '@scalar/api-client/modal';
1
+ import type { ApiClientOptions } from '@scalar/api-client/modal';
2
2
  /** Lazy load the client modal creator */
3
3
  export declare const getClientModalCreator: () => Promise<({ el, eventBus, mountOnInitialize, plugins, workspaceStore, options, }: {
4
4
  el: HTMLElement | null;
@@ -6,7 +6,7 @@ export declare const getClientModalCreator: () => Promise<({ el, eventBus, mount
6
6
  eventBus?: import("@scalar/workspace-store/events").WorkspaceEventBus;
7
7
  workspaceStore: import("@scalar/workspace-store/client").WorkspaceStore;
8
8
  plugins?: import("@scalar/oas-utils/helpers").ClientPlugin[];
9
- options?: import("vue").MaybeRefOrGetter<ApiClientModalOptions>;
9
+ options?: import("vue").MaybeRefOrGetter<ApiClientOptions>;
10
10
  }) => import("@scalar/api-client/modal").ApiClientModal>;
11
11
  /** Module-scoped singleton workspace store (lazy-loaded on first use). */
12
12
  export declare const getWorkspaceStoreSingleton: () => Promise<import("@scalar/workspace-store/client").WorkspaceStore>;
@@ -20,7 +20,7 @@ export declare const getWorkspaceEventBusSingleton: () => Promise<import("@scala
20
20
  * (`url`, `content`) must be registered via `workspaceStore.addDocument` after the client
21
21
  * is ready — they are not part of the modal constructor.
22
22
  */
23
- export declare const getOrCreateApiClient: (options?: Partial<Pick<import("@scalar/types/api-reference").ApiReferenceConfigurationRaw, "authentication" | "baseServerURL" | "hideClientButton" | "proxyUrl" | "oauth2RedirectUri" | "servers" | "hiddenClients">> | undefined) => Promise<{
23
+ export declare const getOrCreateApiClient: (options?: ApiClientOptions | undefined) => Promise<{
24
24
  apiClient: import("@scalar/api-client/modal").ApiClientModal;
25
25
  workspaceStore: import("@scalar/workspace-store/client").WorkspaceStore;
26
26
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-load.d.ts","sourceRoot":"","sources":["../src/lazy-load.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAsBrE,yCAAyC;AACzC,eAAO,MAAM,qBAAqB;;;;;;;wDAEjC,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,wEAEtC,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,2EAEzC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;EA0B/B,CAAA"}
1
+ {"version":3,"file":"lazy-load.d.ts","sourceRoot":"","sources":["../src/lazy-load.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAsBhE,yCAAyC;AACzC,eAAO,MAAM,qBAAqB;;;;;;;wDAEjC,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,wEAEtC,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,2EAEzC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;EA0B/B,CAAA"}
package/dist/style.css CHANGED
@@ -6298,23 +6298,23 @@
6298
6298
  /*
6299
6299
  Deep styling for customizing Codemirror
6300
6300
  */
6301
- [data-v-167b1bd5] .cm-editor {
6301
+ [data-v-6499ec1f] .cm-editor {
6302
6302
  height: 100%;
6303
6303
  outline: none;
6304
6304
  padding: 0;
6305
6305
  background: transparent;
6306
6306
  }
6307
- [data-v-167b1bd5] .cm-placeholder {
6307
+ [data-v-6499ec1f] .cm-placeholder {
6308
6308
  color: var(--scalar-color-3);
6309
6309
  }
6310
- [data-v-167b1bd5] .cm-content {
6310
+ [data-v-6499ec1f] .cm-content {
6311
6311
  font-family: var(--scalar-font-code);
6312
6312
  font-size: var(--scalar-small);
6313
6313
  max-height: 20px;
6314
6314
  padding: 8px 0;
6315
6315
  }
6316
6316
  /* Tooltip helper */
6317
- [data-v-167b1bd5] .cm-tooltip {
6317
+ [data-v-6499ec1f] .cm-tooltip {
6318
6318
  background: transparent !important;
6319
6319
  filter: brightness(var(--scalar-lifted-brightness));
6320
6320
  border-radius: var(--scalar-radius);
@@ -6323,43 +6323,43 @@
6323
6323
  outline: none !important;
6324
6324
  overflow: hidden !important;
6325
6325
  }
6326
- [data-v-167b1bd5] .cm-tooltip-autocomplete ul li {
6326
+ [data-v-6499ec1f] .cm-tooltip-autocomplete ul li {
6327
6327
  padding: 3px 6px !important;
6328
6328
  }
6329
- [data-v-167b1bd5] .cm-completionIcon-type:after {
6329
+ [data-v-6499ec1f] .cm-completionIcon-type:after {
6330
6330
  color: var(--scalar-color-3) !important;
6331
6331
  }
6332
- [data-v-167b1bd5] .cm-tooltip-autocomplete ul li[aria-selected] {
6332
+ [data-v-6499ec1f] .cm-tooltip-autocomplete ul li[aria-selected] {
6333
6333
  background: var(--scalar-background-2) !important;
6334
6334
  color: var(--scalar-color-1) !important;
6335
6335
  }
6336
- [data-v-167b1bd5] .cm-tooltip-autocomplete ul {
6336
+ [data-v-6499ec1f] .cm-tooltip-autocomplete ul {
6337
6337
  padding: 6px !important;
6338
6338
  position: relative;
6339
6339
  }
6340
- [data-v-167b1bd5] .cm-tooltip-autocomplete ul li:hover {
6340
+ [data-v-6499ec1f] .cm-tooltip-autocomplete ul li:hover {
6341
6341
  border-radius: 3px;
6342
6342
  color: var(--scalar-color-1) !important;
6343
6343
  background: var(--scalar-background-3) !important;
6344
6344
  }
6345
6345
  /* Disable active line highlighting */
6346
- [data-v-167b1bd5] .cm-activeLine,[data-v-167b1bd5] .cm-activeLineGutter {
6346
+ [data-v-6499ec1f] .cm-activeLine,[data-v-6499ec1f] .cm-activeLineGutter {
6347
6347
  background-color: transparent;
6348
6348
  }
6349
6349
  /* Color selection matching */
6350
- [data-v-167b1bd5] .cm-selectionMatch,[data-v-167b1bd5] .cm-matchingBracket {
6350
+ [data-v-6499ec1f] .cm-selectionMatch,[data-v-6499ec1f] .cm-matchingBracket {
6351
6351
  border-radius: var(--scalar-radius);
6352
6352
  background: var(--scalar-background-4) !important;
6353
6353
  }
6354
6354
  /* Color Picker Swatches */
6355
- [data-v-167b1bd5] .cm-css-color-picker-wrapper {
6355
+ [data-v-6499ec1f] .cm-css-color-picker-wrapper {
6356
6356
  display: inline-flex;
6357
6357
  outline: 1px solid var(--scalar-background-3);
6358
6358
  border-radius: 3px;
6359
6359
  overflow: hidden;
6360
6360
  }
6361
6361
  /* Number gutter */
6362
- [data-v-167b1bd5] .cm-gutters {
6362
+ [data-v-6499ec1f] .cm-gutters {
6363
6363
  background-color: transparent;
6364
6364
  border-right: none;
6365
6365
  color: var(--scalar-color-3);
@@ -6367,7 +6367,7 @@
6367
6367
  line-height: 22px;
6368
6368
  border-radius: 0 0 0 3px;
6369
6369
  }
6370
- [data-v-167b1bd5] .cm-gutters:before {
6370
+ [data-v-6499ec1f] .cm-gutters:before {
6371
6371
  content: '';
6372
6372
  position: absolute;
6373
6373
  top: 2px;
@@ -6377,7 +6377,7 @@
6377
6377
  border-radius: var(--scalar-radius) 0 0 var(--scalar-radius);
6378
6378
  background-color: var(--scalar-background-1);
6379
6379
  }
6380
- [data-v-167b1bd5] .cm-gutterElement {
6380
+ [data-v-6499ec1f] .cm-gutterElement {
6381
6381
  font-family: var(--scalar-font-code) !important;
6382
6382
  padding-left: 0px !important;
6383
6383
  padding-right: 6px !important;
@@ -6386,16 +6386,16 @@
6386
6386
  justify-content: flex-end;
6387
6387
  position: relative;
6388
6388
  }
6389
- [data-v-167b1bd5] .cm-lineNumbers .cm-gutterElement {
6389
+ [data-v-6499ec1f] .cm-lineNumbers .cm-gutterElement {
6390
6390
  min-width: fit-content;
6391
6391
  }
6392
- [data-v-167b1bd5] .cm-gutter + .cm-gutter :not(.cm-foldGutter) .cm-gutterElement {
6392
+ [data-v-6499ec1f] .cm-gutter + .cm-gutter :not(.cm-foldGutter) .cm-gutterElement {
6393
6393
  padding-left: 0 !important;
6394
6394
  }
6395
- [data-v-167b1bd5] .cm-scroller {
6395
+ [data-v-6499ec1f] .cm-scroller {
6396
6396
  overflow: auto;
6397
6397
  }
6398
- .line-wrapping[data-v-167b1bd5]:focus-within .cm-content {
6398
+ .line-wrapping[data-v-6499ec1f]:focus-within .cm-content {
6399
6399
  display: inline-table;
6400
6400
  min-height: fit-content;
6401
6401
  padding: 3px 6px;
@@ -6712,7 +6712,7 @@
6712
6712
  var(--scalar-background-2) 20px
6713
6713
  );
6714
6714
  }
6715
- [data-v-e861924b] .cm-content {
6715
+ [data-v-06778e40] .cm-content {
6716
6716
  font-size: var(--scalar-small);
6717
6717
  }
6718
6718
  .form-group[data-v-678c9f4a] {
@@ -6730,10 +6730,10 @@
6730
6730
  -ms-overflow-style: none;
6731
6731
  scrollbar-width: none;
6732
6732
  }
6733
- [data-v-3157c3c7] .cm-editor {
6733
+ [data-v-819cea32] .cm-editor {
6734
6734
  padding: 0;
6735
6735
  }
6736
- [data-v-3157c3c7] .cm-content {
6736
+ [data-v-819cea32] .cm-content {
6737
6737
  align-items: center;
6738
6738
  background-color: transparent;
6739
6739
  display: flex;
@@ -6742,30 +6742,30 @@
6742
6742
  padding: 5px 8px;
6743
6743
  width: 100%;
6744
6744
  }
6745
- [data-v-3157c3c7] .cm-content:has(.cm-pill) {
6745
+ [data-v-819cea32] .cm-content:has(.cm-pill) {
6746
6746
  padding: 5px 8px;
6747
6747
  }
6748
- [data-v-3157c3c7] .cm-content .cm-pill:not(:last-of-type) {
6748
+ [data-v-819cea32] .cm-content .cm-pill:not(:last-of-type) {
6749
6749
  margin-right: 0.5px;
6750
6750
  }
6751
- [data-v-3157c3c7] .cm-content .cm-pill:not(:first-of-type) {
6751
+ [data-v-819cea32] .cm-content .cm-pill:not(:first-of-type) {
6752
6752
  margin-left: 0.5px;
6753
6753
  }
6754
- [data-v-3157c3c7] .cm-line {
6754
+ [data-v-819cea32] .cm-line {
6755
6755
  overflow: hidden;
6756
6756
  padding: 0;
6757
6757
  text-overflow: ellipsis;
6758
6758
  word-break: break-word;
6759
6759
  }
6760
- .required[data-v-3157c3c7]::after {
6760
+ .required[data-v-819cea32]::after {
6761
6761
  content: 'Required';
6762
6762
  }
6763
6763
  /* Tailwind placeholder is busted */
6764
- input[data-v-3157c3c7]::placeholder {
6764
+ input[data-v-819cea32]::placeholder {
6765
6765
  color: var(--scalar-color-3);
6766
6766
  }
6767
6767
  /* we want our inputs to look like a password input but not be one */
6768
- .scalar-password-input[data-v-3157c3c7] {
6768
+ .scalar-password-input[data-v-819cea32] {
6769
6769
  text-security: disc;
6770
6770
  -webkit-text-security: disc;
6771
6771
  -moz-text-security: disc;
@@ -6910,33 +6910,33 @@ to {
6910
6910
  transform: translateY(0);
6911
6911
  }
6912
6912
  }
6913
- .request-card[data-v-0e4ddc16] {
6913
+ .request-card[data-v-59da314d] {
6914
6914
  font-size: var(--scalar-font-size-3);
6915
6915
  }
6916
- .request-method[data-v-0e4ddc16] {
6916
+ .request-method[data-v-59da314d] {
6917
6917
  font-family: var(--scalar-font-code);
6918
6918
  text-transform: uppercase;
6919
6919
  margin-right: 6px;
6920
6920
  }
6921
- .request-card-footer[data-v-0e4ddc16] {
6921
+ .request-card-footer[data-v-59da314d] {
6922
6922
  display: flex;
6923
6923
  justify-content: flex-end;
6924
6924
  padding: 6px;
6925
6925
  flex-shrink: 0;
6926
6926
  position: relative;
6927
6927
  }
6928
- .request-card-footer-addon[data-v-0e4ddc16] {
6928
+ .request-card-footer-addon[data-v-59da314d] {
6929
6929
  display: flex;
6930
6930
  align-items: center;
6931
6931
 
6932
6932
  flex: 1;
6933
6933
  min-width: 0;
6934
6934
  }
6935
- .request-editor-section[data-v-0e4ddc16] {
6935
+ .request-editor-section[data-v-59da314d] {
6936
6936
  display: flex;
6937
6937
  flex: 1;
6938
6938
  }
6939
- .request-card-simple[data-v-0e4ddc16] {
6939
+ .request-card-simple[data-v-59da314d] {
6940
6940
  display: flex;
6941
6941
  align-items: center;
6942
6942
  justify-content: space-between;
@@ -6945,7 +6945,7 @@ to {
6945
6945
 
6946
6946
  font-size: var(--scalar-small);
6947
6947
  }
6948
- .code-snippet[data-v-0e4ddc16] {
6948
+ .code-snippet[data-v-59da314d] {
6949
6949
  display: flex;
6950
6950
  flex-direction: column;
6951
6951
  width: 100%;
@@ -7400,15 +7400,15 @@ to {
7400
7400
  .full-size-styles:has(.sync-conflict-modal-root)::after {
7401
7401
  display: none;
7402
7402
  }
7403
- .scalar-collection-auth[data-v-6bba6b78] {
7403
+ .scalar-collection-auth[data-v-d3bc49bd] {
7404
7404
  border: var(--scalar-border-width) solid var(--scalar-border-color);
7405
7405
  border-radius: var(--scalar-radius-lg);
7406
7406
  overflow: hidden;
7407
7407
  }
7408
- [data-v-ddfccc08] .cm-editor {
7408
+ [data-v-2f13118d] .cm-editor {
7409
7409
  padding: 0;
7410
7410
  }
7411
- [data-v-ddfccc08] .cm-content {
7411
+ [data-v-2f13118d] .cm-content {
7412
7412
  align-items: center;
7413
7413
  background-color: transparent;
7414
7414
  display: flex;
@@ -7417,16 +7417,16 @@ to {
7417
7417
  padding: 5px 8px;
7418
7418
  width: 100%;
7419
7419
  }
7420
- [data-v-ddfccc08] .cm-content:has(.cm-pill) {
7420
+ [data-v-2f13118d] .cm-content:has(.cm-pill) {
7421
7421
  padding: 5px 8px;
7422
7422
  }
7423
- [data-v-ddfccc08] .cm-content .cm-pill:not(:last-of-type) {
7423
+ [data-v-2f13118d] .cm-content .cm-pill:not(:last-of-type) {
7424
7424
  margin-right: 0.5px;
7425
7425
  }
7426
- [data-v-ddfccc08] .cm-content .cm-pill:not(:first-of-type) {
7426
+ [data-v-2f13118d] .cm-content .cm-pill:not(:first-of-type) {
7427
7427
  margin-left: 0.5px;
7428
7428
  }
7429
- [data-v-ddfccc08] .cm-line {
7429
+ [data-v-2f13118d] .cm-line {
7430
7430
  overflow: hidden;
7431
7431
  padding: 0;
7432
7432
  text-overflow: ellipsis;
@@ -1,6 +1,6 @@
1
- import type { ApiClientModal, ApiClientModalOptions, RoutePayload } from '@scalar/api-client/modal';
1
+ import type { ApiClientModal, ApiClientOptions, RoutePayload } from '@scalar/api-client/modal';
2
2
  import './style.css';
3
- export type ApiClientConfigurationReact = ApiClientModalOptions & {
3
+ export type ApiClientConfigurationReact = ApiClientOptions & {
4
4
  url: string;
5
5
  };
6
6
  export type UseApiClientModalProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"use-api-client.d.ts","sourceRoot":"","sources":["../src/use-api-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGnG,OAAO,aAAa,CAAA;AAWpB,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,GAAG;IAEhE,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,+DAA+D;IAC/D,aAAa,EAAE,2BAA2B,CAAA;CAC3C,CAAA;AAKD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,oBAE1B,sBAAsB,KAAG,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,CAAC,GAAG,SAoFxG,CAAA"}
1
+ {"version":3,"file":"use-api-client.d.ts","sourceRoot":"","sources":["../src/use-api-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG9F,OAAO,aAAa,CAAA;AAWpB,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,GAAG;IAE3D,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,+DAA+D;IAC/D,aAAa,EAAE,2BAA2B,CAAA;CAC3C,CAAA;AAKD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,oBAE1B,sBAAsB,KAAG,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,CAAC,GAAG,SAoFxG,CAAA"}
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "testing",
20
20
  "react"
21
21
  ],
22
- "version": "2.0.3",
22
+ "version": "2.0.4",
23
23
  "engines": {
24
24
  "node": ">=22"
25
25
  },
@@ -39,9 +39,9 @@
39
39
  "CHANGELOG.md"
40
40
  ],
41
41
  "dependencies": {
42
+ "@scalar/api-client": "3.2.0",
42
43
  "@scalar/helpers": "0.5.1",
43
- "@scalar/api-client": "3.1.0",
44
- "@scalar/workspace-store": "0.46.1"
44
+ "@scalar/workspace-store": "0.46.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@testing-library/dom": "^10.4.1",