@mintlify/msft-sdk 1.1.59 → 1.1.60

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.
@@ -1,12 +1,13 @@
1
1
  import "react/jsx-runtime";
2
- import $ from "@sindresorhus/slugify";
3
- const c = (r, e, t, i) => $(
4
- `${r ? `${r}-` : ""}${t ? `${t}-` : ""}${e || ""}-`,
2
+ import i from "@sindresorhus/slugify";
3
+ import "../../../contexts/EndpointLocationContext.js";
4
+ const s = (r, t, e, $) => i(
5
+ `${r ? `${r}-` : ""}${e ? `${e}-` : ""}${t || ""}-`,
5
6
  {
6
7
  decamelize: !0
7
8
  }
8
- ), s = (r, e) => r ? `${e ? `${e}` : ""}${r}.` : "";
9
+ ), m = (r, t) => r ? `${t ? `${t}` : ""}${r}.` : "";
9
10
  export {
10
- c as buildRecursiveParamFieldId,
11
- s as getRecursiveParentName
11
+ s as buildRecursiveParamFieldId,
12
+ m as getRecursiveParentName
12
13
  };
@@ -1,6 +1,7 @@
1
1
  import "react/jsx-runtime";
2
- import { useOpenApiEndpoint as n } from "../../hooks/useEndpoint.js";
3
- const p = () => (n(), null);
2
+ import "../../contexts/EndpointLocationContext.js";
3
+ import { useOpenApiEndpoint as t } from "../../hooks/useEndpoint.js";
4
+ const i = () => (t(), null);
4
5
  export {
5
- p as default
6
+ i as default
6
7
  };
@@ -1,6 +1,6 @@
1
- import { jsx as r, jsxs as N } from "react/jsx-runtime";
2
- import { ClipboardCheckmarkRegular as I, Copy20Regular as S } from "@fluentui/react-icons";
3
- import h from "prismjs";
1
+ import { jsxs as w, jsx as o } from "react/jsx-runtime";
2
+ import { ClipboardCheckmarkRegular as j, Copy20Regular as E } from "@fluentui/react-icons";
3
+ import g from "prismjs";
4
4
  import "prismjs/components/prism-bash.js";
5
5
  import "prismjs/components/prism-csharp.js";
6
6
  import "prismjs/components/prism-javascript.js";
@@ -9,167 +9,173 @@ import "prismjs/components/prism-markdown.js";
9
9
  import "prismjs/components/prism-powershell.js";
10
10
  import "prismjs/components/prism-python.js";
11
11
  import "prismjs/components/prism-typescript.js";
12
- import A, { useState as k, useEffect as R } from "react";
13
- import { cn as d } from "../../utils/cn.js";
14
- import { getNodeText as j } from "../../utils/get-node-text.js";
15
- import { getCodeBlockScrollbarClassname as E } from "../../utils/getScrollbarClassname.js";
16
- const w = ["image/png", "text/plain"];
12
+ import P, { useState as _, useEffect as z } from "react";
13
+ import { cn as p } from "../../utils/cn.js";
14
+ import { getNodeText as F } from "../../utils/get-node-text.js";
15
+ import { getCodeBlockScrollbarClassname as D } from "../../utils/getScrollbarClassname.js";
16
+ const v = ["image/png", "text/plain"];
17
17
  function y() {
18
- const [t, e] = k(!1), o = async (n) => {
18
+ const [t, e] = _(!1), r = async (n) => {
19
19
  try {
20
20
  await navigator.clipboard.writeText(n), e(!0), setTimeout(() => e(!1), 2e3);
21
- } catch (m) {
22
- console.error("Failed to copy to clipboard:", m);
21
+ } catch (i) {
22
+ console.error("Failed to copy to clipboard:", i);
23
23
  }
24
24
  };
25
- return { isCopied: t, copy: o, copyBlob: async (n, m) => {
25
+ return { isCopied: t, copy: r, copyBlob: async (n, i) => {
26
26
  try {
27
- if (w.includes(m)) {
28
- const i = await n.arrayBuffer(), a = new Blob([i], { type: m }), f = new ClipboardItem({
29
- [m]: a
27
+ if (v.includes(i)) {
28
+ const a = await n.arrayBuffer(), m = new Blob([a], { type: i }), u = new ClipboardItem({
29
+ [i]: m
30
30
  });
31
- await navigator.clipboard.write([f]), e(!0), setTimeout(() => e(!1), 2e3);
31
+ await navigator.clipboard.write([u]), e(!0), setTimeout(() => e(!1), 2e3);
32
32
  } else {
33
- const i = await n.text();
34
- await o(i);
33
+ const a = await n.text();
34
+ await r(a);
35
35
  }
36
- } catch (i) {
37
- console.error("Failed to copy blob to clipboard:", i);
36
+ } catch (a) {
37
+ console.error("Failed to copy blob to clipboard:", a);
38
38
  try {
39
- const a = await n.text();
40
- await o(a);
41
- } catch (a) {
42
- console.error("Failed to copy as text fallback:", a);
39
+ const m = await n.text();
40
+ await r(m);
41
+ } catch (m) {
42
+ console.error("Failed to copy as text fallback:", m);
43
43
  }
44
44
  }
45
45
  } };
46
46
  }
47
- function _({ onClick: t, isCopied: e, showTooltip: o = !0 }) {
48
- return /* @__PURE__ */ N("div", { className: "mint:relative", children: [
49
- o && e && /* @__PURE__ */ r("div", { className: "mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]", children: "Copied!" }),
50
- /* @__PURE__ */ r(
47
+ function C({ onClick: t, isCopied: e, showTooltip: r = !0 }) {
48
+ return /* @__PURE__ */ w("div", { className: "mint:relative", children: [
49
+ r && e && /* @__PURE__ */ o("div", { className: "mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]", children: "Copied!" }),
50
+ /* @__PURE__ */ o(
51
51
  "button",
52
52
  {
53
53
  onClick: t,
54
54
  className: "mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]",
55
55
  "aria-label": e ? "Copied" : "Copy code",
56
- children: e ? /* @__PURE__ */ r(I, { className: "mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]" }) : /* @__PURE__ */ r(S, { className: "mint:w-5 mint:h-5" })
56
+ children: e ? /* @__PURE__ */ o(j, { className: "mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]" }) : /* @__PURE__ */ o(E, { className: "mint:w-5 mint:h-5" })
57
57
  }
58
58
  )
59
59
  ] });
60
60
  }
61
- function V({
61
+ function G({
62
62
  textToCopy: t,
63
63
  showTooltip: e = !0
64
64
  }) {
65
- const { isCopied: o, copy: c } = y();
66
- return /* @__PURE__ */ r(_, { onClick: () => {
65
+ const { isCopied: r, copy: c } = y();
66
+ return /* @__PURE__ */ o(C, { onClick: () => {
67
67
  c(t);
68
- }, isCopied: o, showTooltip: e });
68
+ }, isCopied: r, showTooltip: e });
69
69
  }
70
- function W({
70
+ function tt({
71
71
  data: t,
72
72
  showTooltip: e = !0
73
73
  }) {
74
- const { isCopied: o, copy: c, copyBlob: n } = y();
75
- return /* @__PURE__ */ r(_, { onClick: () => {
76
- t.contentType && w.includes(t.contentType) ? n(t.blob, t.contentType) : t.type === "other" && t.content ? c(t.content) : console.error("Unsupported content type for clipboard");
77
- }, isCopied: o, showTooltip: e });
74
+ const { isCopied: r, copy: c, copyBlob: n } = y();
75
+ return /* @__PURE__ */ o(C, { onClick: () => {
76
+ t.contentType && v.includes(t.contentType) ? n(t.blob, t.contentType) : t.type === "other" && t.content ? c(t.content) : console.error("Unsupported content type for clipboard");
77
+ }, isCopied: r, showTooltip: e });
78
78
  }
79
- function X({
79
+ function et({
80
80
  children: t,
81
81
  className: e,
82
- fileName: o,
82
+ fileName: r,
83
83
  language: c,
84
84
  blob: n,
85
- contentType: m,
86
- dataGroup: i = !1
85
+ contentType: i,
86
+ dataGroup: a = !1
87
87
  }) {
88
- const [a, f] = k("");
89
- y();
90
- const s = c || (e == null ? void 0 : e.replace(/^language-/, "")) || "text", u = j(t), T = !!o, g = A.useMemo(() => {
91
- var x, C;
88
+ const [m, u] = _(""), { isCopied: T, copy: B, copyBlob: N } = y(), s = c || (e == null ? void 0 : e.replace(/^language-/, "")) || "text", d = F(t), I = !!r, h = P.useMemo(() => {
89
+ var x, k;
92
90
  if (typeof t != "object" || t == null)
93
91
  return !1;
94
- const p = Array.isArray(t) ? t : [t];
95
- for (const l of p)
92
+ const f = Array.isArray(t) ? t : [t];
93
+ for (const l of f)
96
94
  if (typeof l == "object" && l != null && "props" in l && ((x = l.props) != null && x.children)) {
97
- const B = Array.isArray(l.props.children) ? l.props.children : [l.props.children];
98
- for (const b of B)
99
- if (typeof b == "object" && b != null && "props" in b && ((C = b.props) != null && C.className))
95
+ const R = Array.isArray(l.props.children) ? l.props.children : [l.props.children];
96
+ for (const b of R)
97
+ if (typeof b == "object" && b != null && "props" in b && ((k = b.props) != null && k.className))
100
98
  return !0;
101
99
  }
102
100
  return !1;
103
101
  }, [t]);
104
- R(() => {
105
- if (!g)
102
+ z(() => {
103
+ if (!h)
106
104
  try {
107
- const p = h.languages[s] || h.languages.plaintext, x = h.highlight(u, p, s);
108
- f(x);
109
- } catch (p) {
110
- console.error("Failed to highlight code:", p), f(u);
105
+ const f = g.languages[s] || g.languages.plaintext, x = g.highlight(d, f, s);
106
+ u(x);
107
+ } catch (f) {
108
+ console.error("Failed to highlight code:", f), u(d);
111
109
  }
112
- }, [u, s, g]);
113
- const v = E("system", i);
114
- return /* @__PURE__ */ r(
110
+ }, [d, s, h]);
111
+ const S = () => {
112
+ n && i ? N(n, i) : B(d);
113
+ }, A = D("system", a);
114
+ return /* @__PURE__ */ w(
115
115
  "div",
116
116
  {
117
- className: T ? "mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden" : void 0,
118
- "data-group": i,
119
- children: /* @__PURE__ */ r(
120
- "div",
121
- {
122
- className: d(
123
- "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414] code-block-wrapper",
124
- "mint:px-4 mint:py-2 mint:overflow-scroll mint:[scrollbar-gutter:stable] mint:scrollbar-track-zinc-200 mint:dark:scrollbar-track-zinc-800",
125
- v,
126
- i && "mint:group"
127
- ),
128
- children: /* @__PURE__ */ r(
129
- "pre",
130
- {
131
- className: d(
132
- "mint:m-0 mint:whitespace-pre mint:text-sm"
133
- ),
134
- children: g ? /* @__PURE__ */ r(
135
- "code",
136
- {
137
- className: d(
138
- `language-${s}`,
139
- "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
140
- ),
141
- children: t
142
- }
143
- ) : a ? /* @__PURE__ */ r(
144
- "code",
145
- {
146
- className: d(
147
- `language-${s}`,
148
- "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
149
- ),
150
- dangerouslySetInnerHTML: { __html: a }
151
- }
152
- ) : /* @__PURE__ */ r(
153
- "code",
154
- {
155
- className: d(
156
- `language-${s}`,
157
- "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
158
- ),
159
- children: u
160
- }
161
- )
162
- }
163
- )
164
- }
165
- )
117
+ className: p(
118
+ "mint:relative",
119
+ I ? "mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden" : void 0
120
+ ),
121
+ "data-group": a,
122
+ children: [
123
+ /* @__PURE__ */ o("div", { className: "mint:absolute mint:top-2 mint:right-2 mint:z-10", children: /* @__PURE__ */ o(C, { onClick: S, isCopied: T, showTooltip: !0 }) }),
124
+ /* @__PURE__ */ o(
125
+ "div",
126
+ {
127
+ className: p(
128
+ "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414] code-block-wrapper",
129
+ "mint:px-4 mint:py-2 mint:overflow-scroll mint:[scrollbar-gutter:stable] mint:scrollbar-track-zinc-200 mint:dark:scrollbar-track-zinc-800",
130
+ A,
131
+ a && "mint:group"
132
+ ),
133
+ children: /* @__PURE__ */ o(
134
+ "pre",
135
+ {
136
+ className: p(
137
+ "mint:m-0 mint:whitespace-pre mint:text-sm"
138
+ ),
139
+ children: h ? /* @__PURE__ */ o(
140
+ "code",
141
+ {
142
+ className: p(
143
+ `language-${s}`,
144
+ "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
145
+ ),
146
+ children: t
147
+ }
148
+ ) : m ? /* @__PURE__ */ o(
149
+ "code",
150
+ {
151
+ className: p(
152
+ `language-${s}`,
153
+ "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
154
+ ),
155
+ dangerouslySetInnerHTML: { __html: m }
156
+ }
157
+ ) : /* @__PURE__ */ o(
158
+ "code",
159
+ {
160
+ className: p(
161
+ `language-${s}`,
162
+ "mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
163
+ ),
164
+ children: d
165
+ }
166
+ )
167
+ }
168
+ )
169
+ }
170
+ )
171
+ ]
166
172
  }
167
173
  );
168
174
  }
169
175
  export {
170
- X as CodeBlock,
171
- W as CopyDataToClipboardButton,
172
- _ as CopyIconButton,
173
- V as CopyToClipboardButton,
176
+ et as CodeBlock,
177
+ tt as CopyDataToClipboardButton,
178
+ C as CopyIconButton,
179
+ G as CopyToClipboardButton,
174
180
  y as useCopyToClipboard
175
181
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/msft-sdk",
3
- "version": "1.1.59",
3
+ "version": "1.1.60",
4
4
  "description": "Lightweight SDK for Microsoft documentation with MDX rendering",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",