@oaspect/react 0.1.0
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/LICENSE +21 -0
- package/README.md +14 -0
- package/dist/api-reference.js +476 -0
- package/dist/api-reference.js.map +1 -0
- package/dist/auth-panel.js +116 -0
- package/dist/auth-panel.js.map +1 -0
- package/dist/code-block.js +105 -0
- package/dist/code-block.js.map +1 -0
- package/dist/i18n/ar.js +89 -0
- package/dist/i18n/ar.js.map +1 -0
- package/dist/i18n/context.js +50 -0
- package/dist/i18n/context.js.map +1 -0
- package/dist/i18n/en.js +89 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.js +37 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/tr.js +89 -0
- package/dist/i18n/tr.js.map +1 -0
- package/dist/icons.js +55 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/intro.js +132 -0
- package/dist/intro.js.map +1 -0
- package/dist/lazy.js +41 -0
- package/dist/lazy.js.map +1 -0
- package/dist/logo.js +12 -0
- package/dist/logo.js.map +1 -0
- package/dist/markdown.js +170 -0
- package/dist/markdown.js.map +1 -0
- package/dist/method-badge.js +37 -0
- package/dist/method-badge.js.map +1 -0
- package/dist/models.js +27 -0
- package/dist/models.js.map +1 -0
- package/dist/oaspect.css +1703 -0
- package/dist/operation.js +267 -0
- package/dist/operation.js.map +1 -0
- package/dist/samples.js +129 -0
- package/dist/samples.js.map +1 -0
- package/dist/schema-tree.js +160 -0
- package/dist/schema-tree.js.map +1 -0
- package/dist/send.js +58 -0
- package/dist/send.js.map +1 -0
- package/dist/sidebar.js +125 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/spec-context.js +23 -0
- package/dist/spec-context.js.map +1 -0
- package/dist/storage.js +30 -0
- package/dist/storage.js.map +1 -0
- package/dist/try-it.js +277 -0
- package/dist/try-it.js.map +1 -0
- package/package.json +66 -0
- package/tailwind.css +21 -0
package/dist/i18n/tr.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const messages = {
|
|
2
|
+
"auth.accessToken": "Access token",
|
|
3
|
+
"auth.getToken": "Token al",
|
|
4
|
+
"auth.gettingToken": "Token al\u0131n\u0131yor\u2026",
|
|
5
|
+
"auth.mutualTls": "Taray\u0131c\u0131 d\u0131\u015F\u0131nda ayarlanan bir istemci sertifikas\u0131 kullan\u0131r.",
|
|
6
|
+
"auth.password": "\u015Eifre",
|
|
7
|
+
"auth.redirectFlows": "Bu ak\u0131\u015F taray\u0131c\u0131 y\xF6nlendirmesiyle giri\u015F yapar; access token'\u0131 ba\u015Fka yerden al\u0131p yukar\u0131ya yap\u0131\u015Ft\u0131r\u0131n.",
|
|
8
|
+
"auth.scopes": "Scope'lar (bo\u015Flukla ayr\u0131lm\u0131\u015F)",
|
|
9
|
+
"auth.title": "Kimlik do\u011Frulama",
|
|
10
|
+
"auth.tokenFailed": "Token al\u0131namad\u0131: {error}",
|
|
11
|
+
"auth.username": "Kullan\u0131c\u0131 ad\u0131",
|
|
12
|
+
"connection.customServer": "\xD6zel URL\u2026",
|
|
13
|
+
"connection.server": "Sunucu",
|
|
14
|
+
"connection.title": "Ba\u011Flant\u0131",
|
|
15
|
+
"connection.tokenNote": "Token yaln\u0131zca bu taray\u0131c\u0131da saklan\u0131r; kod \xF6rneklerinde ve \u201CDene\u201D penceresinde kullan\u0131l\u0131r.",
|
|
16
|
+
"connection.tokenPlaceholder": "\xD6rnek isteklere Authorization header'\u0131 ekler",
|
|
17
|
+
"copy.copied": "Kopyaland\u0131",
|
|
18
|
+
"copy.copy": "Kopyala",
|
|
19
|
+
"dialog.close": "Kapat",
|
|
20
|
+
"header.language": "Dil de\u011Fi\u015Ftir",
|
|
21
|
+
"header.menu": "Men\xFC",
|
|
22
|
+
"header.skip": "\u0130\xE7eri\u011Fe ge\xE7",
|
|
23
|
+
"header.theme": "Temay\u0131 de\u011Fi\u015Ftir",
|
|
24
|
+
"intro.download": "OpenAPI dok\xFCman\u0131n\u0131 indir",
|
|
25
|
+
"intro.endpoints": "Endpoint",
|
|
26
|
+
"intro.groups": "Grup",
|
|
27
|
+
"intro.models": "Model",
|
|
28
|
+
"models.title": "Modeller",
|
|
29
|
+
"operation.callbacks": "Callback'ler",
|
|
30
|
+
"operation.links": "Ba\u011Flant\u0131lar",
|
|
31
|
+
"operation.requestBody": "Request body",
|
|
32
|
+
"operation.responses": "Yan\u0131tlar",
|
|
33
|
+
"operation.security": "Gerekli yetki",
|
|
34
|
+
"operation.securityOptional": "iste\u011Fe ba\u011Fl\u0131",
|
|
35
|
+
"operation.securityOr": "veya",
|
|
36
|
+
"params.cookie": "Cookie parametreleri",
|
|
37
|
+
"params.header": "Header parametreleri",
|
|
38
|
+
"params.path": "Path parametreleri",
|
|
39
|
+
"params.query": "Query parametreleri",
|
|
40
|
+
"schema.arrayItem": "Dizi eleman\u0131",
|
|
41
|
+
"schema.circular": "d\xF6ng\xFCsel",
|
|
42
|
+
"schema.default": "Varsay\u0131lan:",
|
|
43
|
+
"schema.example": "\xD6rnek:",
|
|
44
|
+
"schema.mapValue": "Map de\u011Feri",
|
|
45
|
+
"schema.none": "\u015Eema tan\u0131mlanmam\u0131\u015F.",
|
|
46
|
+
"schema.values": "De\u011Ferler:",
|
|
47
|
+
"sidebar.introduction": "Giri\u015F",
|
|
48
|
+
"sidebar.label": "Dok\xFCmantasyon",
|
|
49
|
+
"sidebar.noResults": "Sonu\xE7 bulunamad\u0131.",
|
|
50
|
+
"sidebar.search": "Endpoint ya da model ara",
|
|
51
|
+
"snippets.client": "\u0130stemci",
|
|
52
|
+
"snippets.language": "Dil",
|
|
53
|
+
"source.chooseFile": "JSON ya da YAML dosyas\u0131 se\xE7\u2026",
|
|
54
|
+
"source.default": "Varsay\u0131lan",
|
|
55
|
+
"source.file": "Dosya: {name}",
|
|
56
|
+
"source.loadUrl": "URL'den y\xFCkle",
|
|
57
|
+
"source.title": "Kaynak",
|
|
58
|
+
"spec.fallback": "Canl\u0131 API dok\xFCman\u0131na ula\u015F\u0131lamad\u0131; yedek kopya g\xF6steriliyor ve g\xFCncel olmayabilir.",
|
|
59
|
+
"spec.loadFailed": "Spec y\xFCklenemedi: {error}",
|
|
60
|
+
"spec.loading": "Dok\xFCman y\xFCkleniyor\u2026",
|
|
61
|
+
"spec.unreadableFile": "{name} okunamad\u0131: {error}",
|
|
62
|
+
"tryIt.confirm.body": "{method} iste\u011Fi {host} adresine g\xF6nderilecek. \xD6rnek de\u011Ferler ger\xE7ek kay\u0131tlar\u0131n \xFCzerine yazabilir ya da onlar\u0131 silebilir.",
|
|
63
|
+
"tryIt.confirm.cancel": "Vazge\xE7",
|
|
64
|
+
"tryIt.confirm.send": "Yine de g\xF6nder",
|
|
65
|
+
"tryIt.confirm.skip": "Bu oturumda tekrar sorma",
|
|
66
|
+
"tryIt.confirm.title": "Bu istek veriyi de\u011Fi\u015Ftirebilir",
|
|
67
|
+
"tryIt.corsHint": "API bu origin'e CORS izni vermiyor olabilir; Proxy modunu deneyin.",
|
|
68
|
+
"tryIt.failed": "\u0130stek g\xF6nderilemedi: {message}",
|
|
69
|
+
"tryIt.fileHint": "Dosya se\xE7ilmeyen dosya alanlar\u0131 iste\u011Fe eklenmez.",
|
|
70
|
+
"tryIt.idle": "\u0130ste\u011Fi g\xF6ndermek i\xE7in \u201CG\xF6nder\u201De bas\u0131n.",
|
|
71
|
+
"tryIt.mode.direct": "Do\u011Frudan",
|
|
72
|
+
"tryIt.mode.directHint": "Taray\u0131c\u0131dan g\xF6nderir; API'nin CORS izni vermesi gerekir",
|
|
73
|
+
"tryIt.mode.label": "G\xF6nderim yolu",
|
|
74
|
+
"tryIt.mode.proxyDisabled": "Proxy bu sunucuda kapal\u0131.",
|
|
75
|
+
"tryIt.mode.proxyHint": "Docs sunucusu \xFCzerinden g\xF6nderir; API'de CORS gerekmez",
|
|
76
|
+
"tryIt.open": "Dene",
|
|
77
|
+
"tryIt.send": "G\xF6nder",
|
|
78
|
+
"tryIt.sending": "G\xF6nderiliyor\u2026",
|
|
79
|
+
"tryIt.settingsHint": "Sunucu ve Bearer token Ba\u011Flant\u0131 b\xF6l\xFCm\xFCnden ayarlan\u0131r.",
|
|
80
|
+
"tryIt.waiting": "Yan\u0131t bekleniyor\u2026",
|
|
81
|
+
"webhooks.hint": "Bu API'nin sizin endpoint'inize g\xF6nderdi\u011Fi istekler.",
|
|
82
|
+
"webhooks.payload": "G\xF6vde",
|
|
83
|
+
"webhooks.title": "Webhook'lar"
|
|
84
|
+
};
|
|
85
|
+
var tr_default = messages;
|
|
86
|
+
export {
|
|
87
|
+
tr_default as default
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=tr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/tr.js"],"sourcesContent":["// Turkish UI messages.\nconst messages = {\n \"auth.accessToken\": \"Access token\",\n \"auth.getToken\": \"Token al\",\n \"auth.gettingToken\": \"Token alınıyor…\",\n \"auth.mutualTls\": \"Tarayıcı dışında ayarlanan bir istemci sertifikası kullanır.\",\n \"auth.password\": \"Şifre\",\n \"auth.redirectFlows\": \"Bu akış tarayıcı yönlendirmesiyle giriş yapar; access token'ı başka yerden alıp yukarıya yapıştırın.\",\n \"auth.scopes\": \"Scope'lar (boşlukla ayrılmış)\",\n \"auth.title\": \"Kimlik doğrulama\",\n \"auth.tokenFailed\": \"Token alınamadı: {error}\",\n \"auth.username\": \"Kullanıcı adı\",\n \"connection.customServer\": \"Özel URL…\",\n \"connection.server\": \"Sunucu\",\n \"connection.title\": \"Bağlantı\",\n \"connection.tokenNote\": \"Token yalnızca bu tarayıcıda saklanır; kod örneklerinde ve “Dene” penceresinde kullanılır.\",\n \"connection.tokenPlaceholder\": \"Örnek isteklere Authorization header'ı ekler\",\n \"copy.copied\": \"Kopyalandı\",\n \"copy.copy\": \"Kopyala\",\n \"dialog.close\": \"Kapat\",\n \"header.language\": \"Dil değiştir\",\n \"header.menu\": \"Menü\",\n \"header.skip\": \"İçeriğe geç\",\n \"header.theme\": \"Temayı değiştir\",\n \"intro.download\": \"OpenAPI dokümanını indir\",\n \"intro.endpoints\": \"Endpoint\",\n \"intro.groups\": \"Grup\",\n \"intro.models\": \"Model\",\n \"models.title\": \"Modeller\",\n \"operation.callbacks\": \"Callback'ler\",\n \"operation.links\": \"Bağlantılar\",\n \"operation.requestBody\": \"Request body\",\n \"operation.responses\": \"Yanıtlar\",\n \"operation.security\": \"Gerekli yetki\",\n \"operation.securityOptional\": \"isteğe bağlı\",\n \"operation.securityOr\": \"veya\",\n \"params.cookie\": \"Cookie parametreleri\",\n \"params.header\": \"Header parametreleri\",\n \"params.path\": \"Path parametreleri\",\n \"params.query\": \"Query parametreleri\",\n \"schema.arrayItem\": \"Dizi elemanı\",\n \"schema.circular\": \"döngüsel\",\n \"schema.default\": \"Varsayılan:\",\n \"schema.example\": \"Örnek:\",\n \"schema.mapValue\": \"Map değeri\",\n \"schema.none\": \"Şema tanımlanmamış.\",\n \"schema.values\": \"Değerler:\",\n \"sidebar.introduction\": \"Giriş\",\n \"sidebar.label\": \"Dokümantasyon\",\n \"sidebar.noResults\": \"Sonuç bulunamadı.\",\n \"sidebar.search\": \"Endpoint ya da model ara\",\n \"snippets.client\": \"İstemci\",\n \"snippets.language\": \"Dil\",\n \"source.chooseFile\": \"JSON ya da YAML dosyası seç…\",\n \"source.default\": \"Varsayılan\",\n \"source.file\": \"Dosya: {name}\",\n \"source.loadUrl\": \"URL'den yükle\",\n \"source.title\": \"Kaynak\",\n \"spec.fallback\": \"Canlı API dokümanına ulaşılamadı; yedek kopya gösteriliyor ve güncel olmayabilir.\",\n \"spec.loadFailed\": \"Spec yüklenemedi: {error}\",\n \"spec.loading\": \"Doküman yükleniyor…\",\n \"spec.unreadableFile\": \"{name} okunamadı: {error}\",\n \"tryIt.confirm.body\": \"{method} isteği {host} adresine gönderilecek. Örnek değerler gerçek kayıtların üzerine yazabilir ya da onları silebilir.\",\n \"tryIt.confirm.cancel\": \"Vazgeç\",\n \"tryIt.confirm.send\": \"Yine de gönder\",\n \"tryIt.confirm.skip\": \"Bu oturumda tekrar sorma\",\n \"tryIt.confirm.title\": \"Bu istek veriyi değiştirebilir\",\n \"tryIt.corsHint\": \"API bu origin'e CORS izni vermiyor olabilir; Proxy modunu deneyin.\",\n \"tryIt.failed\": \"İstek gönderilemedi: {message}\",\n \"tryIt.fileHint\": \"Dosya seçilmeyen dosya alanları isteğe eklenmez.\",\n \"tryIt.idle\": \"İsteği göndermek için “Gönder”e basın.\",\n \"tryIt.mode.direct\": \"Doğrudan\",\n \"tryIt.mode.directHint\": \"Tarayıcıdan gönderir; API'nin CORS izni vermesi gerekir\",\n \"tryIt.mode.label\": \"Gönderim yolu\",\n \"tryIt.mode.proxyDisabled\": \"Proxy bu sunucuda kapalı.\",\n \"tryIt.mode.proxyHint\": \"Docs sunucusu üzerinden gönderir; API'de CORS gerekmez\",\n \"tryIt.open\": \"Dene\",\n \"tryIt.send\": \"Gönder\",\n \"tryIt.sending\": \"Gönderiliyor…\",\n \"tryIt.settingsHint\": \"Sunucu ve Bearer token Bağlantı bölümünden ayarlanır.\",\n \"tryIt.waiting\": \"Yanıt bekleniyor…\",\n \"webhooks.hint\": \"Bu API'nin sizin endpoint'inize gönderdiği istekler.\",\n \"webhooks.payload\": \"Gövde\",\n \"webhooks.title\": \"Webhook'lar\",\n};\n\nexport default messages;\n"],"mappings":"AACA,MAAM,WAAW;AAAA,EACf,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,E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AA,EACd,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,kBAAkB;AACpB;AAEA,IAAO,aAAQ;","names":[]}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function Icon({ className = "size-4", children, strokeWidth = 2 }) {
|
|
3
|
+
return /* @__PURE__ */ jsx(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
focusable: "false",
|
|
9
|
+
className,
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth,
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function ChevronIcon({ className = "size-3.5" }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Icon, { className, strokeWidth: 2.5, children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" }) });
|
|
21
|
+
}
|
|
22
|
+
function MenuIcon({ className }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Icon, { className, children: /* @__PURE__ */ jsx("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
|
|
24
|
+
}
|
|
25
|
+
function SunIcon({ className }) {
|
|
26
|
+
return /* @__PURE__ */ jsxs(Icon, { className, children: [
|
|
27
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
|
28
|
+
/* @__PURE__ */ jsx("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function MoonIcon({ className }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Icon, { className, children: /* @__PURE__ */ jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
|
|
33
|
+
}
|
|
34
|
+
function CloseIcon({ className }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(Icon, { className, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
|
|
36
|
+
}
|
|
37
|
+
function PlayIcon({ className = "size-3" }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", className, fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M7 4.5v15a1 1 0 0 0 1.5.87l12-7.5a1 1 0 0 0 0-1.74l-12-7.5A1 1 0 0 0 7 4.5Z" }) });
|
|
39
|
+
}
|
|
40
|
+
function LockIcon({ className }) {
|
|
41
|
+
return /* @__PURE__ */ jsxs(Icon, { className, children: [
|
|
42
|
+
/* @__PURE__ */ jsx("rect", { x: "4", y: "11", width: "16", height: "10", rx: "2" }),
|
|
43
|
+
/* @__PURE__ */ jsx("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
ChevronIcon,
|
|
48
|
+
CloseIcon,
|
|
49
|
+
LockIcon,
|
|
50
|
+
MenuIcon,
|
|
51
|
+
MoonIcon,
|
|
52
|
+
PlayIcon,
|
|
53
|
+
SunIcon
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/icons.jsx"],"sourcesContent":["// Inline SVG icons (Lucide-style 24px stroke icons) so the package needs no\n// icon dependency. They inherit currentColor and size from their className.\n\nfunction Icon({ className = \"size-4\", children, strokeWidth = 2 }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n focusable=\"false\"\n className={className}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {children}\n </svg>\n );\n}\n\n/** Points right (left in RTL); rotate-90 when open makes it point down. */\nexport function ChevronIcon({ className = \"size-3.5\" }) {\n return (\n <Icon className={className} strokeWidth={2.5}>\n <path d=\"m9 18 6-6-6-6\" />\n </Icon>\n );\n}\n\nexport function MenuIcon({ className }) {\n return (\n <Icon className={className}>\n <path d=\"M4 6h16M4 12h16M4 18h16\" />\n </Icon>\n );\n}\n\nexport function SunIcon({ className }) {\n return (\n <Icon className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41\" />\n </Icon>\n );\n}\n\nexport function MoonIcon({ className }) {\n return (\n <Icon className={className}>\n <path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\" />\n </Icon>\n );\n}\n\nexport function CloseIcon({ className }) {\n return (\n <Icon className={className}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Icon>\n );\n}\n\nexport function PlayIcon({ className = \"size-3\" }) {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" className={className} fill=\"currentColor\">\n <path d=\"M7 4.5v15a1 1 0 0 0 1.5.87l12-7.5a1 1 0 0 0 0-1.74l-12-7.5A1 1 0 0 0 7 4.5Z\" />\n </svg>\n );\n}\n\nexport function LockIcon({ className }) {\n return (\n <Icon className={className}>\n <rect x=\"4\" y=\"11\" width=\"16\" height=\"10\" rx=\"2\" />\n <path d=\"M8 11V7a4 4 0 0 1 8 0v4\" />\n </Icon>\n );\n}\n"],"mappings":"AAKI,cAmCA,YAnCA;AAFJ,SAAS,KAAK,EAAE,YAAY,UAAU,UAAU,cAAc,EAAE,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ist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { OpenAPIDocument } from "@oaspect/core";
|
|
3
|
+
|
|
4
|
+
/** Message overrides or additional languages: { tr: { "sidebar.search": "…" } }. */
|
|
5
|
+
export type Messages = Record<string, Record<string, string>>;
|
|
6
|
+
|
|
7
|
+
export interface ApiReferenceFeatures {
|
|
8
|
+
/** "Source" menu: switch to another URL or a local file. Default true. */
|
|
9
|
+
sourceMenu?: boolean;
|
|
10
|
+
/** UI language switcher. Default true. */
|
|
11
|
+
languageSwitcher?: boolean;
|
|
12
|
+
/** Light/dark toggle. Default true. */
|
|
13
|
+
themeToggle?: boolean;
|
|
14
|
+
/** "Try" request runner. Default true. */
|
|
15
|
+
tryIt?: boolean;
|
|
16
|
+
/** Models section and sidebar entries. Default true. */
|
|
17
|
+
models?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ApiReferenceProps {
|
|
21
|
+
/** OpenAPI document as an object. Takes precedence over specUrl. */
|
|
22
|
+
spec?: OpenAPIDocument;
|
|
23
|
+
/** URL of the OpenAPI JSON document. */
|
|
24
|
+
specUrl?: string;
|
|
25
|
+
/** Title shown in the header; defaults to info.title (localized). */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Logo shown in the header instead of the title. */
|
|
28
|
+
logo?: ReactNode;
|
|
29
|
+
/** UI language (controlled). Use with onLocaleChange. */
|
|
30
|
+
locale?: string;
|
|
31
|
+
/** Initial UI language when uncontrolled. Default "en". */
|
|
32
|
+
defaultLocale?: string;
|
|
33
|
+
/** Called when the reader picks another language. */
|
|
34
|
+
onLocaleChange?: (locale: string) => void;
|
|
35
|
+
/** Extra languages or overrides of built-in messages. */
|
|
36
|
+
messages?: Messages;
|
|
37
|
+
/** Prefix for localStorage/sessionStorage keys. Default "oaspect". */
|
|
38
|
+
storagePrefix?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Endpoint that relays "Try" requests server-side (no CORS needed).
|
|
41
|
+
* null (default) offers only direct browser requests.
|
|
42
|
+
*/
|
|
43
|
+
proxyUrl?: string | null;
|
|
44
|
+
features?: ApiReferenceFeatures;
|
|
45
|
+
/** Initial code sample as "language:client", e.g. "python:requests". Default "shell:curl". */
|
|
46
|
+
defaultSnippet?: string;
|
|
47
|
+
/** Query parameter that loads a spec URL (?url=…). null disables it. Default "url". */
|
|
48
|
+
urlParam?: string | null;
|
|
49
|
+
/** Force a theme instead of the reader's stored or system preference. */
|
|
50
|
+
theme?: "light" | "dark";
|
|
51
|
+
/**
|
|
52
|
+
* Render operations and models only when they come near the viewport.
|
|
53
|
+
* "auto" (default) does so for documents with more than 40 operations.
|
|
54
|
+
*/
|
|
55
|
+
lazy?: boolean | "auto";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export declare function ApiReference(props: ApiReferenceProps): ReactNode;
|
|
59
|
+
|
|
60
|
+
/** Response header a spec endpoint sets to "fallback" when it served a fallback copy. */
|
|
61
|
+
export declare const SPEC_SOURCE_HEADER: "x-oaspect-spec-source";
|
|
62
|
+
|
|
63
|
+
export interface LogoProps {
|
|
64
|
+
/** Logo image URL (light theme, or both themes when `dark` is omitted). */
|
|
65
|
+
light: string;
|
|
66
|
+
/** Logo image URL for the dark theme. */
|
|
67
|
+
dark?: string;
|
|
68
|
+
alt?: string;
|
|
69
|
+
/** Text shown next to the logo on wider screens, e.g. "API Docs". */
|
|
70
|
+
label?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Header logo with an optional dark-theme variant; pass it as `logo`. */
|
|
74
|
+
export declare function Logo(props: LogoProps): ReactNode;
|
|
75
|
+
|
|
76
|
+
export declare const BUILT_IN_MESSAGES: Messages;
|
|
77
|
+
export declare const LOCALE_NAMES: Record<string, string>;
|
|
78
|
+
export declare function directionOf(locale: string): "ltr" | "rtl";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ApiReference, SPEC_SOURCE_HEADER } from "./api-reference.js";
|
|
2
|
+
import { BUILT_IN_MESSAGES, LOCALE_NAMES, directionOf } from "./i18n/index.js";
|
|
3
|
+
import { Logo } from "./logo.js";
|
|
4
|
+
export {
|
|
5
|
+
ApiReference,
|
|
6
|
+
BUILT_IN_MESSAGES,
|
|
7
|
+
LOCALE_NAMES,
|
|
8
|
+
Logo,
|
|
9
|
+
SPEC_SOURCE_HEADER,
|
|
10
|
+
directionOf
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"sourcesContent":["// @oaspect/react: interactive API reference for OpenAPI documents.\nexport { ApiReference, SPEC_SOURCE_HEADER } from \"./api-reference\";\nexport { BUILT_IN_MESSAGES, LOCALE_NAMES, directionOf } from \"./i18n/index\";\nexport { Logo } from \"./logo\";\n"],"mappings":"AACA,SAAS,cAAc,0BAA0B;AACjD,SAAS,mBAAmB,cAAc,mBAAmB;AAC7D,SAAS,YAAY;","names":[]}
|
package/dist/intro.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLocalized, useT } from "./i18n/context.js";
|
|
4
|
+
import Markdown from "./markdown.js";
|
|
5
|
+
import { useSettings } from "./spec-context.js";
|
|
6
|
+
import AuthPanel from "./auth-panel.js";
|
|
7
|
+
function downloadSpec(spec) {
|
|
8
|
+
const blob = new Blob([JSON.stringify(spec, null, 2)], { type: "application/json" });
|
|
9
|
+
const link = document.createElement("a");
|
|
10
|
+
link.href = URL.createObjectURL(blob);
|
|
11
|
+
link.download = "openapi.json";
|
|
12
|
+
link.click();
|
|
13
|
+
URL.revokeObjectURL(link.href);
|
|
14
|
+
}
|
|
15
|
+
function Intro({ spec, model }) {
|
|
16
|
+
const { servers, serverIndex, setServerIndex, customServer, setCustomServer, token, setToken, selectedServer, variableValues, setVariable, securitySchemes } = useSettings();
|
|
17
|
+
const hasSchemes = Object.keys(securitySchemes ?? {}).length > 0;
|
|
18
|
+
const variables = Object.entries(selectedServer?.variables ?? {});
|
|
19
|
+
const { info } = model;
|
|
20
|
+
const t = useT();
|
|
21
|
+
const localized = useLocalized();
|
|
22
|
+
return /* @__PURE__ */ jsx("section", { id: "introduction", "data-anchor": true, className: "border-b border-border pb-14 pt-10", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)] gap-10 xl:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]", children: [
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
25
|
+
info.version && /* @__PURE__ */ jsxs("span", { className: "rounded-md bg-primary/10 px-2 py-0.5 font-mono text-xs font-medium text-primary", children: [
|
|
26
|
+
"v",
|
|
27
|
+
info.version
|
|
28
|
+
] }),
|
|
29
|
+
model.openapi && /* @__PURE__ */ jsxs("span", { className: "rounded-md bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground", children: [
|
|
30
|
+
"OpenAPI ",
|
|
31
|
+
model.openapi
|
|
32
|
+
] })
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx("h1", { className: "mt-4 text-4xl font-bold tracking-tight", children: localized(info, "title") ?? "API" }),
|
|
35
|
+
/* @__PURE__ */ jsx("dl", { className: "mt-6 grid grid-cols-3 gap-3 sm:max-w-md", children: [
|
|
36
|
+
[t("intro.endpoints"), model.operations.length],
|
|
37
|
+
[t("intro.groups"), model.tags.length],
|
|
38
|
+
[t("intro.models"), model.schemas.length]
|
|
39
|
+
].map(([label, value]) => /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card p-3", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: label }),
|
|
41
|
+
/* @__PURE__ */ jsx("dd", { className: "text-2xl font-semibold", children: value })
|
|
42
|
+
] }, label)) }),
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 flex flex-wrap gap-3 text-sm", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: () => downloadSpec(spec),
|
|
49
|
+
className: "rounded-lg border border-border px-3 py-1.5 font-medium hover:border-primary hover:text-primary",
|
|
50
|
+
children: t("intro.download")
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
info.contact?.email && /* @__PURE__ */ jsx("a", { href: `mailto:${info.contact.email}`, className: "rounded-lg border border-border px-3 py-1.5 hover:border-primary hover:text-primary", children: info.contact.name ?? info.contact.email })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsx(Markdown, { source: localized(info, "description"), className: "mt-8 text-base text-muted-foreground" })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsxs("aside", { className: "min-w-0 space-y-4 self-start rounded-2xl border border-border bg-card p-5", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold", children: t("connection.title") }),
|
|
59
|
+
/* @__PURE__ */ jsxs("label", { className: "block space-y-1", children: [
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("connection.server") }),
|
|
61
|
+
/* @__PURE__ */ jsxs(
|
|
62
|
+
"select",
|
|
63
|
+
{
|
|
64
|
+
value: serverIndex,
|
|
65
|
+
onChange: (event) => setServerIndex(Number(event.target.value)),
|
|
66
|
+
dir: "ltr",
|
|
67
|
+
className: "w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs",
|
|
68
|
+
children: [
|
|
69
|
+
servers.map((server, index) => /* @__PURE__ */ jsxs("option", { value: index, children: [
|
|
70
|
+
server.url,
|
|
71
|
+
server.description ? ` \u2014 ${server.description}` : ""
|
|
72
|
+
] }, server.url)),
|
|
73
|
+
/* @__PURE__ */ jsx("option", { value: -1, children: t("connection.customServer") })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] }),
|
|
78
|
+
variables.map(([name, variable]) => /* @__PURE__ */ jsxs("label", { className: "grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] items-center gap-2", children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-mono text-xs text-muted-foreground", title: variable.description ?? name, children: `{${name}}` }),
|
|
80
|
+
variable.enum?.length ? /* @__PURE__ */ jsx(
|
|
81
|
+
"select",
|
|
82
|
+
{
|
|
83
|
+
value: variableValues[name] ?? variable.default ?? "",
|
|
84
|
+
onChange: (event) => setVariable(name, event.target.value),
|
|
85
|
+
dir: "ltr",
|
|
86
|
+
className: "rounded-lg border border-border bg-background px-2 py-1 font-mono text-xs",
|
|
87
|
+
children: variable.enum.map((option) => /* @__PURE__ */ jsx("option", { children: option }, option))
|
|
88
|
+
}
|
|
89
|
+
) : /* @__PURE__ */ jsx(
|
|
90
|
+
"input",
|
|
91
|
+
{
|
|
92
|
+
value: variableValues[name] ?? "",
|
|
93
|
+
placeholder: variable.default ?? "",
|
|
94
|
+
onChange: (event) => setVariable(name, event.target.value),
|
|
95
|
+
dir: "ltr",
|
|
96
|
+
className: "rounded-lg border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus:border-primary"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }, name)),
|
|
100
|
+
serverIndex === -1 && /* @__PURE__ */ jsx(
|
|
101
|
+
"input",
|
|
102
|
+
{
|
|
103
|
+
type: "url",
|
|
104
|
+
value: customServer,
|
|
105
|
+
onChange: (event) => setCustomServer(event.target.value),
|
|
106
|
+
placeholder: "https://api.example.com",
|
|
107
|
+
dir: "ltr",
|
|
108
|
+
className: "w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus:border-primary"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
hasSchemes ? /* @__PURE__ */ jsx(AuthPanel, { schemes: securitySchemes }) : /* @__PURE__ */ jsxs("label", { className: "block space-y-1", children: [
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Bearer token" }),
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
"input",
|
|
115
|
+
{
|
|
116
|
+
type: "password",
|
|
117
|
+
value: token,
|
|
118
|
+
onChange: (event) => setToken(event.target.value),
|
|
119
|
+
placeholder: t("connection.tokenPlaceholder"),
|
|
120
|
+
autoComplete: "off",
|
|
121
|
+
className: "w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus:border-primary"
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("connection.tokenNote") })
|
|
126
|
+
] })
|
|
127
|
+
] }) });
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
Intro as default
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=intro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/intro.jsx"],"sourcesContent":["\"use client\";\n\nimport { useLocalized, useT } from \"./i18n/context\";\nimport Markdown from \"./markdown\";\nimport { useSettings } from \"./spec-context\";\nimport AuthPanel from \"./auth-panel\";\n\nfunction downloadSpec(spec) {\n const blob = new Blob([JSON.stringify(spec, null, 2)], { type: \"application/json\" });\n const link = document.createElement(\"a\");\n link.href = URL.createObjectURL(blob);\n link.download = \"openapi.json\";\n link.click();\n URL.revokeObjectURL(link.href);\n}\n\nexport default function Intro({ spec, model }) {\n const { servers, serverIndex, setServerIndex, customServer, setCustomServer, token, setToken, selectedServer, variableValues, setVariable, securitySchemes } = useSettings();\n const hasSchemes = Object.keys(securitySchemes ?? {}).length > 0;\n const variables = Object.entries(selectedServer?.variables ?? {});\n const { info } = model;\n const t = useT();\n const localized = useLocalized();\n\n return (\n <section id=\"introduction\" data-anchor className=\"border-b border-border pb-14 pt-10\">\n <div className=\"grid grid-cols-[minmax(0,1fr)] gap-10 xl:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]\">\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap gap-2\">\n {info.version && (\n <span className=\"rounded-md bg-primary/10 px-2 py-0.5 font-mono text-xs font-medium text-primary\">v{info.version}</span>\n )}\n {model.openapi && (\n <span className=\"rounded-md bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground\">OpenAPI {model.openapi}</span>\n )}\n </div>\n <h1 className=\"mt-4 text-4xl font-bold tracking-tight\">{localized(info, \"title\") ?? \"API\"}</h1>\n\n {/* Stats and actions sit right under the title so a long\n description never pushes them out of sight. */}\n <dl className=\"mt-6 grid grid-cols-3 gap-3 sm:max-w-md\">\n {[\n [t(\"intro.endpoints\"), model.operations.length],\n [t(\"intro.groups\"), model.tags.length],\n [t(\"intro.models\"), model.schemas.length],\n ].map(([label, value]) => (\n <div key={label} className=\"rounded-xl border border-border bg-card p-3\">\n <dt className=\"text-xs text-muted-foreground\">{label}</dt>\n <dd className=\"text-2xl font-semibold\">{value}</dd>\n </div>\n ))}\n </dl>\n\n <div className=\"mt-6 flex flex-wrap gap-3 text-sm\">\n <button\n type=\"button\"\n onClick={() => downloadSpec(spec)}\n className=\"rounded-lg border border-border px-3 py-1.5 font-medium hover:border-primary hover:text-primary\"\n >\n {t(\"intro.download\")}\n </button>\n {info.contact?.email && (\n <a href={`mailto:${info.contact.email}`} className=\"rounded-lg border border-border px-3 py-1.5 hover:border-primary hover:text-primary\">\n {info.contact.name ?? info.contact.email}\n </a>\n )}\n </div>\n\n <Markdown source={localized(info, \"description\")} className=\"mt-8 text-base text-muted-foreground\" />\n </div>\n\n <aside className=\"min-w-0 space-y-4 self-start rounded-2xl border border-border bg-card p-5\">\n <h2 className=\"text-sm font-semibold\">{t(\"connection.title\")}</h2>\n <label className=\"block space-y-1\">\n <span className=\"text-xs text-muted-foreground\">{t(\"connection.server\")}</span>\n <select\n value={serverIndex}\n onChange={(event) => setServerIndex(Number(event.target.value))}\n dir=\"ltr\"\n className=\"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs\"\n >\n {servers.map((server, index) => (\n <option key={server.url} value={index}>\n {server.url}\n {server.description ? ` — ${server.description}` : \"\"}\n </option>\n ))}\n <option value={-1}>{t(\"connection.customServer\")}</option>\n </select>\n </label>\n {variables.map(([name, variable]) => (\n <label key={name} className=\"grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] items-center gap-2\">\n <span className=\"truncate font-mono text-xs text-muted-foreground\" title={variable.description ?? name}>\n {`{${name}}`}\n </span>\n {variable.enum?.length ? (\n <select\n value={variableValues[name] ?? variable.default ?? \"\"}\n onChange={(event) => setVariable(name, event.target.value)}\n dir=\"ltr\"\n className=\"rounded-lg border border-border bg-background px-2 py-1 font-mono text-xs\"\n >\n {variable.enum.map((option) => (\n <option key={option}>{option}</option>\n ))}\n </select>\n ) : (\n <input\n value={variableValues[name] ?? \"\"}\n placeholder={variable.default ?? \"\"}\n onChange={(event) => setVariable(name, event.target.value)}\n dir=\"ltr\"\n className=\"rounded-lg border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus:border-primary\"\n />\n )}\n </label>\n ))}\n {serverIndex === -1 && (\n <input\n type=\"url\"\n value={customServer}\n onChange={(event) => setCustomServer(event.target.value)}\n placeholder=\"https://api.example.com\"\n dir=\"ltr\"\n className=\"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus:border-primary\"\n />\n )}\n {hasSchemes ? (\n <AuthPanel schemes={securitySchemes} />\n ) : (\n <label className=\"block space-y-1\">\n <span className=\"text-xs text-muted-foreground\">Bearer token</span>\n <input\n type=\"password\"\n value={token}\n onChange={(event) => setToken(event.target.value)}\n placeholder={t(\"connection.tokenPlaceholder\")}\n autoComplete=\"off\"\n className=\"w-full rounded-lg border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus:border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C,MAAK;AAAA,YACL,OAAO;AAAA,YACP,UAAU,CAAC,UAAU,SAAS,MAAM,OAAO,KAAK;AAAA,YAChD,aAAa,EAAE,6BAA6B;AAAA,YAC5C,cAAa;AAAA,YACb,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA,MAEA,oBAAC,OAAE,WAAU,iCACV,YAAE,sBAAsB,GAC3B;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
package/dist/lazy.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
|
+
const LazyContext = createContext(false);
|
|
4
|
+
function useNearViewport(ref, eager = false) {
|
|
5
|
+
const lazy = useContext(LazyContext);
|
|
6
|
+
const [near, setNear] = useState(!lazy || eager);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (near || !ref.current) return;
|
|
9
|
+
const observer = new IntersectionObserver(
|
|
10
|
+
(entries) => {
|
|
11
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
12
|
+
setNear(true);
|
|
13
|
+
observer.disconnect();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{ rootMargin: "1500px 0px" }
|
|
17
|
+
);
|
|
18
|
+
observer.observe(ref.current);
|
|
19
|
+
return () => observer.disconnect();
|
|
20
|
+
}, [near, ref]);
|
|
21
|
+
return near;
|
|
22
|
+
}
|
|
23
|
+
function scrollToAnchor(id) {
|
|
24
|
+
const target = document.getElementById(id);
|
|
25
|
+
if (!target) return;
|
|
26
|
+
target.scrollIntoView();
|
|
27
|
+
let last = target.getBoundingClientRect().top;
|
|
28
|
+
for (const delay of [50, 150, 350, 700]) {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
const top = target.getBoundingClientRect().top;
|
|
31
|
+
if (Math.abs(top - last) > 2) target.scrollIntoView();
|
|
32
|
+
last = target.getBoundingClientRect().top;
|
|
33
|
+
}, delay);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
LazyContext,
|
|
38
|
+
scrollToAnchor,
|
|
39
|
+
useNearViewport
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=lazy.js.map
|
package/dist/lazy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lazy.js"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\n// Whether sections render lazily (set by <ApiReference lazy>).\nexport const LazyContext = createContext(false);\n\n/**\n * True once `ref` comes within ~1.5 screens of the viewport, and from then\n * on. Always true when lazy rendering is off or `eager` is set, so server\n * rendering and the first client render agree.\n */\nexport function useNearViewport(ref, eager = false) {\n const lazy = useContext(LazyContext);\n const [near, setNear] = useState(!lazy || eager);\n\n useEffect(() => {\n if (near || !ref.current) return;\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n setNear(true);\n observer.disconnect();\n }\n },\n { rootMargin: \"1500px 0px\" },\n );\n observer.observe(ref.current);\n return () => observer.disconnect();\n }, [near, ref]);\n\n return near;\n}\n\n/**\n * Scrolls to the element with `id` and keeps it in place while sections\n * above it render and change height.\n */\nexport function scrollToAnchor(id) {\n const target = document.getElementById(id);\n if (!target) return;\n target.scrollIntoView();\n let last = target.getBoundingClientRect().top;\n for (const delay of [50, 150, 350, 700]) {\n setTimeout(() => {\n const top = target.getBoundingClientRect().top;\n if (Math.abs(top - last) > 2) target.scrollIntoView();\n last = target.getBoundingClientRect().top;\n }, delay);\n }\n}\n"],"mappings":";AAEA,SAAS,eAAe,YAAY,WAAW,gBAAgB;AAGxD,MAAM,cAAc,cAAc,KAAK;AAOvC,SAAS,gBAAgB,KAAK,QAAQ,OAAO;AAClD,QAAM,OAAO,WAAW,WAAW;AACnC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,KAAK;AAE/C,YAAU,MAAM;AACd,QAAI,QAAQ,CAAC,IAAI,QAAS;AAC1B,UAAM,WAAW,IAAI;AAAA,MACnB,CAAC,YAAY;AACX,YAAI,QAAQ,KAAK,CAAC,UAAU,MAAM,cAAc,GAAG;AACjD,kBAAQ,IAAI;AACZ,mBAAS,WAAW;AAAA,QACtB;AAAA,MACF;AAAA,MACA,EAAE,YAAY,aAAa;AAAA,IAC7B;AACA,aAAS,QAAQ,IAAI,OAAO;AAC5B,WAAO,MAAM,SAAS,WAAW;AAAA,EACnC,GAAG,CAAC,MAAM,GAAG,CAAC;AAEd,SAAO;AACT;AAMO,SAAS,eAAe,IAAI;AACjC,QAAM,SAAS,SAAS,eAAe,EAAE;AACzC,MAAI,CAAC,OAAQ;AACb,SAAO,eAAe;AACtB,MAAI,OAAO,OAAO,sBAAsB,EAAE;AAC1C,aAAW,SAAS,CAAC,IAAI,KAAK,KAAK,GAAG,GAAG;AACvC,eAAW,MAAM;AACf,YAAM,MAAM,OAAO,sBAAsB,EAAE;AAC3C,UAAI,KAAK,IAAI,MAAM,IAAI,IAAI,EAAG,QAAO,eAAe;AACpD,aAAO,OAAO,sBAAsB,EAAE;AAAA,IACxC,GAAG,KAAK;AAAA,EACV;AACF;","names":[]}
|
package/dist/logo.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function Logo({ light, dark, alt = "", label }) {
|
|
3
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4
|
+
/* @__PURE__ */ jsx("img", { src: light, alt, className: `h-6 w-auto max-w-32 ${dark ? "dark:hidden" : ""}` }),
|
|
5
|
+
dark && /* @__PURE__ */ jsx("img", { src: dark, alt, className: "hidden h-6 w-auto max-w-32 dark:block" }),
|
|
6
|
+
label && /* @__PURE__ */ jsx("span", { className: "hidden text-sm font-medium text-muted-foreground sm:inline", children: label })
|
|
7
|
+
] });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
Logo
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=logo.js.map
|
package/dist/logo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logo.jsx"],"sourcesContent":["// Header logo with optional dark-theme variant and label, e.g.\n// <Logo light=\"/logo.svg\" dark=\"/logo-dark.svg\" alt=\"ACME\" label=\"API Docs\" />.\n// Plain <img> elements: logos are small static files from any host.\nexport function Logo({ light, dark, alt = \"\", label }) {\n return (\n <>\n <img src={light} alt={alt} className={`h-6 w-auto max-w-32 ${dark ? \"dark:hidden\" : \"\"}`} />\n {dark && <img src={dark} alt={alt} className=\"hidden h-6 w-auto max-w-32 dark:block\" />}\n {label && <span className=\"hidden text-sm font-medium text-muted-foreground sm:inline\">{label}</span>}\n </>\n );\n}\n"],"mappings":"AAKI,mBACE,KADF;AAFG,SAAS,KAAK,EAAE,OAAO,MAAM,MAAM,IAAI,MAAM,GAAG;AACrD,SACE,iCACE;AAAA,wBAAC,SAAI,KAAK,OAAO,KAAU,WAAW,uBAAuB,OAAO,gBAAgB,EAAE,IAAI;AAAA,IACzF,QAAQ,oBAAC,SAAI,KAAK,MAAM,KAAU,WAAU,yCAAwC;AAAA,IACpF,SAAS,oBAAC,UAAK,WAAU,8DAA8D,iBAAM;AAAA,KAChG;AAEJ;","names":[]}
|