@scalar/api-reference 1.52.2 → 1.52.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/browser/standalone.js +210 -202
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +1 -1
  6. package/dist/components/ApiReference.vue.js.map +1 -1
  7. package/dist/components/ApiReference.vue.script.js +6 -2
  8. package/dist/components/ApiReference.vue.script.js.map +1 -1
  9. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  10. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  11. package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
  12. package/dist/components/Content/Schema/SchemaProperty.vue.script.js +1 -1
  13. package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
  14. package/dist/components/SectionFlare/SectionFlare.vue.d.ts.map +1 -1
  15. package/dist/components/SectionFlare/SectionFlare.vue.js +2 -2
  16. package/dist/components/SectionFlare/SectionFlare.vue.js.map +1 -1
  17. package/dist/features/Operation/components/OperationParameters.vue.d.ts +10 -1
  18. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  19. package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
  20. package/dist/features/Operation/components/OperationParameters.vue.script.js +17 -8
  21. package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
  22. package/dist/features/Operation/components/RequestBody.vue.d.ts +9 -1
  23. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  24. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  25. package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
  26. package/dist/features/Operation/components/RequestBody.vue.script.js +8 -4
  27. package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
  28. package/dist/features/Operation/helpers/filter-selected-security.js +3 -3
  29. package/dist/features/Operation/helpers/filter-selected-security.js.map +1 -1
  30. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  31. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  32. package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
  33. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +10 -3
  34. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
  35. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  36. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  37. package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
  38. package/dist/features/Operation/layouts/ModernLayout.vue.script.js +9 -2
  39. package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
  40. package/dist/helpers/map-config-plugins.d.ts.map +1 -1
  41. package/dist/helpers/map-config-plugins.js +2 -1
  42. package/dist/helpers/map-config-plugins.js.map +1 -1
  43. package/dist/plugins/plugin-manager.d.ts +17 -0
  44. package/dist/plugins/plugin-manager.d.ts.map +1 -1
  45. package/dist/plugins/plugin-manager.js +14 -0
  46. package/dist/plugins/plugin-manager.js.map +1 -1
  47. package/dist/plugins/posthog/index.d.ts +16 -0
  48. package/dist/plugins/posthog/index.d.ts.map +1 -0
  49. package/dist/plugins/posthog/index.js +54 -0
  50. package/dist/plugins/posthog/index.js.map +1 -0
  51. package/dist/style.css +245 -167
  52. package/package.json +22 -17
@@ -0,0 +1,16 @@
1
+ import { type PostHogConfig } from '@scalar/api-client/plugins/posthog';
2
+ import type { ApiReferencePlugin } from '../plugin-manager.js';
3
+ export type { PostHogConfig };
4
+ /**
5
+ * PostHog analytics plugin for the API Reference.
6
+ *
7
+ * Loading this plugin opts in to analytics for both the API Reference
8
+ * and the embedded API Client (tracked as separate products).
9
+ *
10
+ * Respects the `telemetry` configuration option — when set to `false`,
11
+ * capturing is disabled. Reacts dynamically to config changes at runtime.
12
+ *
13
+ * If the plugin is not loaded, no tracking occurs.
14
+ */
15
+ export declare const PostHogPlugin: (config: PostHogConfig) => ApiReferencePlugin;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/posthog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,YAAY,EAAE,aAAa,EAAE,CAAA;AAE7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,KAAG,kBAuDrD,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { PostHogClientPlugin } from "@scalar/api-client/plugins/posthog";
2
+ import ph from "posthog-js";
3
+ //#region src/plugins/posthog/index.ts
4
+ /**
5
+ * PostHog analytics plugin for the API Reference.
6
+ *
7
+ * Loading this plugin opts in to analytics for both the API Reference
8
+ * and the embedded API Client (tracked as separate products).
9
+ *
10
+ * Respects the `telemetry` configuration option — when set to `false`,
11
+ * capturing is disabled. Reacts dynamically to config changes at runtime.
12
+ *
13
+ * If the plugin is not loaded, no tracking occurs.
14
+ */
15
+ var PostHogPlugin = (config) => {
16
+ let posthog = null;
17
+ const clientPlugin = PostHogClientPlugin(config);
18
+ return () => ({
19
+ name: "posthog",
20
+ extensions: [],
21
+ apiClientPlugins: [clientPlugin],
22
+ hooks: {
23
+ onInit({ config: referenceConfig }) {
24
+ if (typeof window === "undefined") return;
25
+ const instance = ph.init(config.apiKey, {
26
+ api_host: config.apiHost,
27
+ ...config.uiHost ? { ui_host: config.uiHost } : {},
28
+ ...config.defaults ? { defaults: config.defaults } : {},
29
+ opt_out_capturing_by_default: true
30
+ }, "scalar-api-reference");
31
+ if (instance) {
32
+ posthog = instance;
33
+ posthog.register({ product: "api-reference" });
34
+ if (referenceConfig.telemetry !== false) posthog.opt_in_capturing();
35
+ }
36
+ clientPlugin.lifecycle?.onInit?.({ config: referenceConfig });
37
+ },
38
+ onConfigChange({ config: referenceConfig }) {
39
+ if (posthog) if (referenceConfig.telemetry === false) posthog.opt_out_capturing();
40
+ else posthog.opt_in_capturing();
41
+ clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig });
42
+ },
43
+ onDestroy() {
44
+ posthog?.reset();
45
+ posthog = null;
46
+ clientPlugin.lifecycle?.onDestroy?.();
47
+ }
48
+ }
49
+ });
50
+ };
51
+ //#endregion
52
+ export { PostHogPlugin };
53
+
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import { PostHogClientPlugin, type PostHogConfig } from '@scalar/api-client/plugins/posthog'\nimport type { PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nimport type { ApiReferencePlugin } from '../plugin-manager'\n\nexport type { PostHogConfig }\n\n/**\n * PostHog analytics plugin for the API Reference.\n *\n * Loading this plugin opts in to analytics for both the API Reference\n * and the embedded API Client (tracked as separate products).\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n *\n * If the plugin is not loaded, no tracking occurs.\n */\nexport const PostHogPlugin = (config: PostHogConfig): ApiReferencePlugin => {\n let posthog: PostHog | null = null\n const clientPlugin = PostHogClientPlugin(config)\n\n return () => ({\n name: 'posthog',\n extensions: [],\n apiClientPlugins: [clientPlugin],\n hooks: {\n onInit({ config: referenceConfig }) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-reference',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-reference' })\n\n if (referenceConfig.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onInit?.({ config: referenceConfig })\n },\n onConfigChange({ config: referenceConfig }) {\n if (posthog) {\n if (referenceConfig.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig })\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n\n clientPlugin.lifecycle?.onDestroy?.()\n },\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAa,iBAAiB,WAA8C;CAC1E,IAAI,UAA0B;CAC9B,MAAM,eAAe,oBAAoB,OAAO;AAEhD,eAAc;EACZ,MAAM;EACN,YAAY,EAAE;EACd,kBAAkB,CAAC,aAAa;EAChC,OAAO;GACL,OAAO,EAAE,QAAQ,mBAAmB;AAClC,QAAI,OAAO,WAAW,YACpB;IAGF,MAAM,WAAW,GAAG,KAClB,OAAO,QACP;KACE,UAAU,OAAO;KACjB,GAAI,OAAO,SAAS,EAAE,SAAS,OAAO,QAAQ,GAAG,EAAE;KACnD,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,UAAU,GAAG,EAAE;KACxD,8BAA8B;KAC/B,EACD,uBACD;AAED,QAAI,UAAU;AACZ,eAAU;AACV,aAAQ,SAAS,EAAE,SAAS,iBAAiB,CAAC;AAE9C,SAAI,gBAAgB,cAAc,MAChC,SAAQ,kBAAkB;;AAI9B,iBAAa,WAAW,SAAS,EAAE,QAAQ,iBAAiB,CAAC;;GAE/D,eAAe,EAAE,QAAQ,mBAAmB;AAC1C,QAAI,QACF,KAAI,gBAAgB,cAAc,MAChC,SAAQ,mBAAmB;QAE3B,SAAQ,kBAAkB;AAI9B,iBAAa,WAAW,iBAAiB,EAAE,QAAQ,iBAAiB,CAAC;;GAEvE,YAAY;AACV,aAAS,OAAO;AAChB,cAAU;AAEV,iBAAa,WAAW,aAAa;;GAExC;EACF"}