radiant-docs 0.1.47 → 0.1.49
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/package.json +1 -1
- package/template/src/components/LogoLink.astro +2 -2
- package/template/src/components/OpenApiPage.astro +121 -64
- package/template/src/components/PagePagination.astro +1 -1
- package/template/src/components/SidebarSubgroup.astro +1 -1
- package/template/src/components/endpoint/RequestSnippets.astro +201 -24
- package/template/src/components/endpoint/ResponseDisplay.astro +25 -21
- package/template/src/components/endpoint/ResponseSnippets.astro +198 -21
- package/template/src/components/ui/CodeTabEdge.astro +11 -60
- package/template/src/components/user/Accordion.astro +18 -4
- package/template/src/components/user/Callout.astro +1 -1
- package/template/src/components/user/CodeBlock.astro +42 -21
- package/template/src/components/user/CodeGroup.astro +68 -41
- package/template/src/components/user/ComponentPreviewBlock.astro +32 -24
- package/template/src/components/user/Image.astro +88 -24
- package/template/src/components/user/Step.astro +2 -2
- package/template/src/components/user/Tabs.astro +59 -27
- package/template/src/lib/code/code-block.ts +89 -10
- package/template/src/lib/code/shiki-theme-config.ts +16 -0
- package/template/src/lib/validation.ts +137 -0
- package/template/src/styles/global.css +48 -3
|
@@ -72,11 +72,9 @@ import { Icon } from "astro-icon/components";
|
|
|
72
72
|
class="group/prose-code not-prose relative h-full min-h-0 w-full max-w-full min-w-0"
|
|
73
73
|
>
|
|
74
74
|
<div
|
|
75
|
-
class="flex h-full min-h-0 w-full max-w-full min-w-0 flex-col
|
|
75
|
+
class="flex h-full min-h-0 w-full max-w-full min-w-0 flex-col rounded-xl"
|
|
76
76
|
>
|
|
77
|
-
<div
|
|
78
|
-
class="flex items-center justify-between gap-2 border-b border-neutral-200 rounded-t-xl bg-neutral-50 inset-shadow-sm inset-shadow-neutral-100/80 dark:border-neutral-800 dark:bg-neutral-900/60 dark:inset-shadow-neutral-900/80"
|
|
79
|
-
>
|
|
77
|
+
<div class="flex items-center justify-between gap-2">
|
|
80
78
|
<div class="min-w-0 flex-1 overflow-hidden rounded-t-xl">
|
|
81
79
|
<div
|
|
82
80
|
x-ref="tabList"
|
|
@@ -84,7 +82,7 @@ import { Icon } from "astro-icon/components";
|
|
|
84
82
|
>
|
|
85
83
|
<div
|
|
86
84
|
aria-hidden="true"
|
|
87
|
-
class="pointer-events-none absolute top-
|
|
85
|
+
class="pointer-events-none absolute top-0 z-0 h-[28px] rounded-[9px] border-[0.5px] border-(--rd-code-tab-edge-border) bg-(--rd-code-surface) transition-[left,width,opacity] duration-200 ease-out"
|
|
88
86
|
x-bind:class="pillVisible ? 'opacity-100' : 'opacity-0'"
|
|
89
87
|
x-bind:style="'left:' + pillLeft + 'px;width:' + pillWidth + 'px;'"
|
|
90
88
|
>
|
|
@@ -95,20 +93,24 @@ import { Icon } from "astro-icon/components";
|
|
|
95
93
|
type="button"
|
|
96
94
|
x-bind:data-rd-response-tab="tab.id"
|
|
97
95
|
x-on:click="select(tab.id)"
|
|
98
|
-
class="relative z-10 inline-flex h-9 items-
|
|
96
|
+
class="relative z-10 inline-flex h-9 items-start border-0 bg-transparent px-3 py-0 text-xs font-medium transition-colors duration-150 focus:outline-none focus-visible:outline-none cursor-pointer"
|
|
99
97
|
x-bind:class="selected === tab.id ? 'text-foreground' : 'text-muted-foreground'"
|
|
100
98
|
>
|
|
101
|
-
<span
|
|
102
|
-
|
|
99
|
+
<span
|
|
100
|
+
class="pointer-events-none inline-flex h-[28px] items-center whitespace-pre leading-none"
|
|
101
|
+
x-text="tab.label"></span>
|
|
103
102
|
</button>
|
|
104
103
|
</template>
|
|
105
104
|
</div>
|
|
106
105
|
</div>
|
|
107
106
|
|
|
108
107
|
<div
|
|
109
|
-
class="relative h-9 w-fit max-w-full shrink-0 rounded-tr-xl bg-
|
|
108
|
+
class="relative h-9 w-fit max-w-full shrink-0 rounded-tr-xl bg-(--rd-code-surface) border-t-[0.5px] border-r-[0.5px] border-(--rd-code-tab-edge-border)"
|
|
110
109
|
>
|
|
111
|
-
<div
|
|
110
|
+
<div
|
|
111
|
+
class="absolute inset-x-0 -bottom-px h-px bg-(--rd-code-surface)"
|
|
112
|
+
>
|
|
113
|
+
</div>
|
|
112
114
|
<CodeTabEdge
|
|
113
115
|
className="pointer-events-none absolute -top-px right-full z-10 h-[calc(100%+2px)] rotate-y-180"
|
|
114
116
|
/>
|
|
@@ -133,33 +135,33 @@ import { Icon } from "astro-icon/components";
|
|
|
133
135
|
</div>
|
|
134
136
|
</div>
|
|
135
137
|
|
|
136
|
-
<div
|
|
138
|
+
<div
|
|
139
|
+
class="relative min-h-0 min-w-0 flex-1 overflow-hidden rounded-b-xl rounded-tl-xl border-[0.5px] border-(--rd-code-tab-edge-border) bg-(--rd-code-surface)"
|
|
140
|
+
>
|
|
137
141
|
<div
|
|
138
142
|
class="relative h-full overflow-auto [scrollbar-width:thin] [scrollbar-color:var(--color-neutral-300)_transparent] [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-neutral-300/70 hover:[&::-webkit-scrollbar-thumb]:bg-neutral-300/90 dark:[scrollbar-color:var(--color-neutral-700)_transparent] dark:[&::-webkit-scrollbar-thumb]:bg-neutral-700/70 dark:hover:[&::-webkit-scrollbar-thumb]:bg-neutral-700/90"
|
|
139
143
|
>
|
|
140
|
-
<div
|
|
141
|
-
class="pointer-events-none sticky top-0 z-10 -mb-4 h-4 w-full bg-linear-to-b from-white to-transparent dark:from-(--rd-code-surface)"
|
|
142
|
-
>
|
|
143
|
-
</div>
|
|
144
144
|
<div x-show="selected === 'body'" class="h-full">
|
|
145
145
|
<div
|
|
146
146
|
x-show="!response || !response.highlightedData"
|
|
147
147
|
class="text-sm px-4 py-4 xs:py-8 flex flex-col items-center justify-center h-full text-foreground"
|
|
148
148
|
>
|
|
149
|
-
<div class="
|
|
149
|
+
<div class="p-2 rounded-xl mb-1">
|
|
150
150
|
<Icon
|
|
151
151
|
class="size-6 text-neutral-300 dark:text-neutral-600"
|
|
152
152
|
name="lucide:square-arrow-up-right"
|
|
153
153
|
/>
|
|
154
154
|
</div>
|
|
155
155
|
<div class="text-lg font-medium text-center">Send request</div>
|
|
156
|
-
<p
|
|
156
|
+
<p
|
|
157
|
+
class="text-sm text-neutral-500 text-center dark:text-neutral-400"
|
|
158
|
+
>
|
|
157
159
|
Send a request to see the response body.
|
|
158
160
|
</p>
|
|
159
161
|
</div>
|
|
160
162
|
<div x-show="response && response.highlightedData">
|
|
161
163
|
<pre
|
|
162
|
-
class="relative m-0 min-w-full
|
|
164
|
+
class="relative m-0 min-w-full p-0 text-[13px] leading-6"><code data-rd-code-theme class="block min-w-full px-4 py-2.5 font-mono text-neutral-800 dark:text-neutral-200" x-html="response?.highlightedData" /></pre>
|
|
163
165
|
</div>
|
|
164
166
|
</div>
|
|
165
167
|
|
|
@@ -168,20 +170,22 @@ import { Icon } from "astro-icon/components";
|
|
|
168
170
|
x-show="!response || !response.highlightedHeaders"
|
|
169
171
|
class="text-sm px-4 py-4 xs:py-8 flex flex-col items-center justify-center h-full text-foreground"
|
|
170
172
|
>
|
|
171
|
-
<div class="
|
|
173
|
+
<div class="p-2 rounded-xl mb-1">
|
|
172
174
|
<Icon
|
|
173
175
|
class="size-6 text-neutral-300 dark:text-neutral-600"
|
|
174
176
|
name="lucide:square-arrow-up-right"
|
|
175
177
|
/>
|
|
176
178
|
</div>
|
|
177
179
|
<div class="text-lg font-medium text-center">Send request</div>
|
|
178
|
-
<p
|
|
180
|
+
<p
|
|
181
|
+
class="text-sm text-neutral-500 text-center dark:text-neutral-400"
|
|
182
|
+
>
|
|
179
183
|
Send a request to see the response header.
|
|
180
184
|
</p>
|
|
181
185
|
</div>
|
|
182
186
|
<div x-show="response && response.highlightedHeaders">
|
|
183
187
|
<pre
|
|
184
|
-
class="relative m-0 min-w-full bg-
|
|
188
|
+
class="relative m-0 min-w-full bg-(--rd-code-surface) p-0 text-[13px] leading-6"><code data-rd-code-theme class="block min-w-full px-4 py-2.5 font-mono text-neutral-800 dark:text-neutral-200" x-html="response?.highlightedHeaders" /></pre>
|
|
185
189
|
</div>
|
|
186
190
|
</div>
|
|
187
191
|
</div>
|
|
@@ -244,14 +244,52 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
244
244
|
pillLeft: 0,
|
|
245
245
|
pillWidth: 0,
|
|
246
246
|
pillVisible: false,
|
|
247
|
+
previousSelected: null,
|
|
248
|
+
isTransitioning: false,
|
|
249
|
+
isManagedSlot: false,
|
|
250
|
+
transitionDirection: 1,
|
|
251
|
+
transitionDurationMs: 400,
|
|
252
|
+
transitionEasing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
247
253
|
tabSyncHandler: null,
|
|
254
|
+
transitionTimeoutId: null,
|
|
248
255
|
copyTimeoutId: null,
|
|
256
|
+
readMotionTokens() {
|
|
257
|
+
const styles = window.getComputedStyle(document.documentElement);
|
|
258
|
+
const configuredDurationMs = Number.parseFloat(
|
|
259
|
+
styles.getPropertyValue("--rd-panel-transition-duration-ms"),
|
|
260
|
+
);
|
|
261
|
+
this.transitionDurationMs = Number.isFinite(configuredDurationMs)
|
|
262
|
+
? configuredDurationMs
|
|
263
|
+
: this.transitionDurationMs;
|
|
264
|
+
this.transitionEasing =
|
|
265
|
+
styles.getPropertyValue("--rd-panel-transition-easing").trim() ||
|
|
266
|
+
this.transitionEasing;
|
|
267
|
+
},
|
|
249
268
|
init() {
|
|
250
|
-
|
|
251
|
-
|
|
269
|
+
this.isManagedSlot = !!this.$root?.closest("[data-snippet-slot]");
|
|
270
|
+
this.readMotionTokens();
|
|
271
|
+
if (
|
|
272
|
+
typeof window.matchMedia === "function" &&
|
|
273
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
274
|
+
) {
|
|
275
|
+
this.transitionDurationMs = 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const sync = () => {
|
|
279
|
+
this.syncPill();
|
|
280
|
+
this.syncSnippetHeight();
|
|
281
|
+
};
|
|
252
282
|
this.tabSyncHandler = sync;
|
|
253
283
|
this.$nextTick(() => {
|
|
284
|
+
if (this.$refs.snippetPanels) {
|
|
285
|
+
this.$refs.snippetPanels.style.transitionDuration =
|
|
286
|
+
this.transitionDurationMs + "ms";
|
|
287
|
+
this.$refs.snippetPanels.style.transitionTimingFunction =
|
|
288
|
+
this.transitionEasing;
|
|
289
|
+
}
|
|
254
290
|
this.syncPill();
|
|
291
|
+
this.syncSnippetHeight();
|
|
292
|
+
if (!this.hasMultiple) return;
|
|
255
293
|
this.$refs.tabList?.addEventListener("scroll", sync, {
|
|
256
294
|
passive: true,
|
|
257
295
|
});
|
|
@@ -275,13 +313,96 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
275
313
|
this.pillWidth = activeRect.width;
|
|
276
314
|
this.pillVisible = true;
|
|
277
315
|
},
|
|
316
|
+
getPanelHeight(panel) {
|
|
317
|
+
if (!panel) return 0;
|
|
318
|
+
const child = panel.firstElementChild;
|
|
319
|
+
const childHeight =
|
|
320
|
+
child instanceof HTMLElement ? child.scrollHeight : 0;
|
|
321
|
+
return Math.ceil(
|
|
322
|
+
Math.max(panel.scrollHeight, childHeight, panel.getBoundingClientRect().height),
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
syncSnippetHeight() {
|
|
326
|
+
const panels = this.$refs.snippetPanels;
|
|
327
|
+
if (!panels) return;
|
|
328
|
+
if (this.isManagedSlot) {
|
|
329
|
+
panels.style.height = "";
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const activePanel = panels.querySelector(
|
|
333
|
+
'[data-snippet-index="' + this.selected + '"]',
|
|
334
|
+
);
|
|
335
|
+
const activeHeight = this.getPanelHeight(activePanel);
|
|
336
|
+
if (activeHeight > 0) {
|
|
337
|
+
panels.style.height = activeHeight + "px";
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
finishTransition() {
|
|
341
|
+
this.isTransitioning = false;
|
|
342
|
+
this.previousSelected = null;
|
|
343
|
+
this.transitionTimeoutId = null;
|
|
344
|
+
this.$nextTick(() => {
|
|
345
|
+
this.syncSnippetHeight();
|
|
346
|
+
window.dispatchEvent(new CustomEvent("rd:snippet-content-change"));
|
|
347
|
+
});
|
|
348
|
+
},
|
|
278
349
|
select(index) {
|
|
350
|
+
if (index === this.selected) return;
|
|
351
|
+
|
|
352
|
+
if (this.transitionTimeoutId) {
|
|
353
|
+
window.clearTimeout(this.transitionTimeoutId);
|
|
354
|
+
this.transitionTimeoutId = null;
|
|
355
|
+
this.isTransitioning = false;
|
|
356
|
+
this.previousSelected = null;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const previousIndex = this.selected;
|
|
360
|
+
this.previousSelected = previousIndex;
|
|
361
|
+
this.transitionDirection = index > previousIndex ? 1 : -1;
|
|
279
362
|
this.selected = index;
|
|
363
|
+
this.isTransitioning = true;
|
|
280
364
|
this.$nextTick(() => {
|
|
281
365
|
this.syncPill();
|
|
366
|
+
this.syncSnippetHeight();
|
|
282
367
|
window.dispatchEvent(new CustomEvent("rd:snippet-content-change"));
|
|
368
|
+
|
|
369
|
+
if (this.transitionDurationMs === 0) {
|
|
370
|
+
this.finishTransition();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
this.transitionTimeoutId = window.setTimeout(() => {
|
|
375
|
+
this.finishTransition();
|
|
376
|
+
}, this.transitionDurationMs);
|
|
283
377
|
});
|
|
284
378
|
},
|
|
379
|
+
getPanelStyle(index) {
|
|
380
|
+
const base = "position: absolute; top: 0; right: 0; left: 0;";
|
|
381
|
+
const isActive = index === this.selected;
|
|
382
|
+
const isPrevious = this.isTransitioning && index === this.previousSelected;
|
|
383
|
+
|
|
384
|
+
if (!isActive && !isPrevious) {
|
|
385
|
+
return "display: none; opacity: 0; pointer-events: none; visibility: hidden; z-index: 0;";
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (!this.isTransitioning) {
|
|
389
|
+
return "position: relative; transform: translateX(0); opacity: 1; pointer-events: auto; visibility: visible; z-index: 1;";
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (isActive) {
|
|
393
|
+
const animationName =
|
|
394
|
+
this.transitionDirection === 1
|
|
395
|
+
? "rd-snippet-slide-in-from-right"
|
|
396
|
+
: "rd-snippet-slide-in-from-left";
|
|
397
|
+
return "position: relative; opacity: 1; pointer-events: auto; visibility: visible; z-index: 2; animation: " + animationName + " " + this.transitionDurationMs + "ms " + this.transitionEasing + " both;";
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const animationName =
|
|
401
|
+
this.transitionDirection === 1
|
|
402
|
+
? "rd-snippet-slide-out-to-left"
|
|
403
|
+
: "rd-snippet-slide-out-to-right";
|
|
404
|
+
return base + " opacity: 1; pointer-events: none; visibility: visible; z-index: 1; animation: " + animationName + " " + this.transitionDurationMs + "ms " + this.transitionEasing + " both;";
|
|
405
|
+
},
|
|
285
406
|
async copySelected() {
|
|
286
407
|
const snippet = this.snippets[this.selected];
|
|
287
408
|
if (!snippet) return;
|
|
@@ -306,10 +427,10 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
306
427
|
>
|
|
307
428
|
<div class="group/prose-code not-prose relative h-full min-h-0 w-full max-w-full min-w-0">
|
|
308
429
|
<div
|
|
309
|
-
class="flex h-full min-h-0 w-full max-w-full min-w-0 flex-col
|
|
430
|
+
class="flex h-full min-h-0 w-full max-w-full min-w-0 flex-col rounded-xl"
|
|
310
431
|
>
|
|
311
432
|
<div
|
|
312
|
-
class="flex items-center justify-between gap-2
|
|
433
|
+
class="flex items-center justify-between gap-2"
|
|
313
434
|
>
|
|
314
435
|
{
|
|
315
436
|
hasMultipleResponses ? (
|
|
@@ -320,7 +441,7 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
320
441
|
>
|
|
321
442
|
<div
|
|
322
443
|
aria-hidden="true"
|
|
323
|
-
class="pointer-events-none absolute top-
|
|
444
|
+
class="pointer-events-none absolute top-0 z-0 h-[28px] rounded-[9px] border-[0.5px] border-(--rd-code-tab-edge-border) bg-(--rd-code-surface) transition-[left,width,opacity] duration-200 ease-out"
|
|
324
445
|
x-bind:class="pillVisible ? 'opacity-100' : 'opacity-0'"
|
|
325
446
|
x-bind:style="'left:' + pillLeft + 'px;width:' + pillWidth + 'px;'"
|
|
326
447
|
/>
|
|
@@ -333,26 +454,28 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
333
454
|
type="button"
|
|
334
455
|
x-bind:data-rd-snippet-tab="index"
|
|
335
456
|
x-on:click="select(index)"
|
|
336
|
-
class="relative z-10 inline-flex h-9 items-
|
|
457
|
+
class="relative z-10 inline-flex h-9 items-start border-0 bg-transparent px-3 py-0 text-xs font-medium transition-colors duration-150 focus:outline-none focus-visible:outline-none cursor-pointer"
|
|
337
458
|
x-bind:class="selected === index ? 'text-foreground' : 'text-muted-foreground'"
|
|
338
459
|
>
|
|
339
|
-
<span
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
460
|
+
<span class="pointer-events-none inline-flex h-[28px] items-center gap-2">
|
|
461
|
+
<span
|
|
462
|
+
class="size-[7px] shrink-0 rounded-full transition-opacity duration-150"
|
|
463
|
+
x-bind:class="(selected === index ? 'opacity-100 ' : 'opacity-70 ') + snippet.dotClass"></span>
|
|
464
|
+
<span class="whitespace-pre leading-none" x-text="snippet.statusCode"></span>
|
|
465
|
+
</span>
|
|
343
466
|
</button>
|
|
344
467
|
</template>
|
|
345
468
|
</div>
|
|
346
469
|
</div>
|
|
347
470
|
) : (
|
|
348
471
|
<div class="min-w-0 flex-1">
|
|
349
|
-
<div class="relative h-9 w-fit max-w-full rounded-tl-xl bg-
|
|
350
|
-
<div class="absolute inset-x-0 -bottom-px h-px bg-
|
|
472
|
+
<div class="relative h-9 w-fit max-w-full rounded-tl-xl bg-(--rd-code-surface)">
|
|
473
|
+
<div class="absolute inset-x-0 -bottom-px h-px bg-(--rd-code-surface)"></div>
|
|
351
474
|
<CodeTabEdge
|
|
352
|
-
className="pointer-events-none absolute -top-
|
|
475
|
+
className="pointer-events-none absolute -top-[0.5px] left-full z-10 h-[calc(100%+1.5px)]"
|
|
353
476
|
/>
|
|
354
477
|
|
|
355
|
-
<div class="relative z-20 inline-flex h-9 max-w-full items-center gap-2 pl-5 pr-3 py-1.5 text-xs font-medium text-neutral-700 dark:text-neutral-300">
|
|
478
|
+
<div class="relative z-20 inline-flex h-9 max-w-full items-center gap-2 rounded-tl-xl border-t-[0.5px] border-l-[0.5px] border-(--rd-code-tab-edge-border) pl-5 pr-3 py-1.5 text-xs font-medium text-neutral-700 dark:text-neutral-300">
|
|
356
479
|
<span
|
|
357
480
|
class="size-[7px] shrink-0 rounded-full"
|
|
358
481
|
class:list={[firstResponse.dotClass]}></span>
|
|
@@ -363,8 +486,8 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
363
486
|
)
|
|
364
487
|
}
|
|
365
488
|
|
|
366
|
-
<div class="relative h-9 w-5 shrink-0 rounded-tr-xl bg-
|
|
367
|
-
<div class="absolute inset-x-0 -bottom-px h-px bg-
|
|
489
|
+
<div class="relative h-9 w-5 shrink-0 rounded-tr-xl bg-(--rd-code-surface) border-t-[0.5px] border-r-[0.5px] border-(--rd-code-tab-edge-border)">
|
|
490
|
+
<div class="absolute inset-x-0 -bottom-px h-px bg-(--rd-code-surface)"></div>
|
|
368
491
|
<CodeTabEdge
|
|
369
492
|
className="pointer-events-none absolute -top-px right-full z-10 h-[calc(100%+2px)] rotate-y-180"
|
|
370
493
|
/>
|
|
@@ -390,14 +513,22 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
390
513
|
</div>
|
|
391
514
|
</div>
|
|
392
515
|
|
|
393
|
-
<div class="relative min-h-0 min-w-0 flex-1 overflow-hidden rounded-b-xl">
|
|
394
|
-
<div
|
|
395
|
-
|
|
516
|
+
<div class="relative min-h-0 min-w-0 flex-1 overflow-hidden rounded-b-xl rounded-tl-xl border-[0.5px] border-(--rd-code-tab-edge-border) bg-(--rd-code-surface)">
|
|
517
|
+
<div
|
|
518
|
+
x-ref="snippetPanels"
|
|
519
|
+
class="relative h-full overflow-auto transition-[height] motion-reduce:transition-none [scrollbar-width:thin] [scrollbar-color:var(--color-neutral-300)_transparent] [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-neutral-300/70 hover:[&::-webkit-scrollbar-thumb]:bg-neutral-300/90 dark:[scrollbar-color:var(--color-neutral-700)_transparent] dark:[&::-webkit-scrollbar-thumb]:bg-neutral-700/70 dark:hover:[&::-webkit-scrollbar-thumb]:bg-neutral-700/90"
|
|
520
|
+
style="transition-duration: var(--rd-panel-transition-duration); transition-timing-function: var(--rd-panel-transition-easing);"
|
|
521
|
+
>
|
|
396
522
|
{
|
|
397
523
|
responseSnippetItems.map((snippet, index) => (
|
|
398
524
|
<pre
|
|
399
|
-
class="relative m-0 min-w-full
|
|
400
|
-
x-
|
|
525
|
+
class="relative m-0 min-w-full p-0 text-[13px] leading-6"
|
|
526
|
+
x-bind:style={`getPanelStyle(${index})`}
|
|
527
|
+
style={
|
|
528
|
+
index === 0
|
|
529
|
+
? "position: relative;"
|
|
530
|
+
: "display: none; position: absolute; top: 0; right: 0; left: 0; opacity: 0; visibility: hidden; pointer-events: none;"
|
|
531
|
+
}
|
|
401
532
|
{...(index !== 0 ? { "x-cloak": true } : {})}
|
|
402
533
|
data-snippet-index={index}
|
|
403
534
|
><code data-rd-code-theme class="block min-w-full py-2.5 font-mono text-neutral-800 dark:text-neutral-200"><Fragment set:html={snippet.renderedCodeLinesHtml} /></code></pre>
|
|
@@ -408,3 +539,49 @@ const hasMultipleResponses = responseSnippetItems.length > 1;
|
|
|
408
539
|
</div>
|
|
409
540
|
</div>
|
|
410
541
|
</div>
|
|
542
|
+
|
|
543
|
+
<style>
|
|
544
|
+
@keyframes rd-snippet-slide-in-from-right {
|
|
545
|
+
from {
|
|
546
|
+
transform: translateX(100%);
|
|
547
|
+
opacity: 0;
|
|
548
|
+
}
|
|
549
|
+
to {
|
|
550
|
+
transform: translateX(0);
|
|
551
|
+
opacity: 1;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
@keyframes rd-snippet-slide-in-from-left {
|
|
556
|
+
from {
|
|
557
|
+
transform: translateX(-100%);
|
|
558
|
+
opacity: 0;
|
|
559
|
+
}
|
|
560
|
+
to {
|
|
561
|
+
transform: translateX(0);
|
|
562
|
+
opacity: 1;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
@keyframes rd-snippet-slide-out-to-left {
|
|
567
|
+
from {
|
|
568
|
+
transform: translateX(0);
|
|
569
|
+
opacity: 1;
|
|
570
|
+
}
|
|
571
|
+
to {
|
|
572
|
+
transform: translateX(-100%);
|
|
573
|
+
opacity: 0;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
@keyframes rd-snippet-slide-out-to-right {
|
|
578
|
+
from {
|
|
579
|
+
transform: translateX(0);
|
|
580
|
+
opacity: 1;
|
|
581
|
+
}
|
|
582
|
+
to {
|
|
583
|
+
transform: translateX(100%);
|
|
584
|
+
opacity: 0;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
</style>
|
|
@@ -5,18 +5,14 @@ interface Props {
|
|
|
5
5
|
|
|
6
6
|
const { className = "" } = Astro.props;
|
|
7
7
|
|
|
8
|
-
const idPrefix = `code_group_tab_edge_${Math.random().toString(36).slice(2, 9)}`;
|
|
9
|
-
const mask0Id = `code_group_tab_edge_mask0_${idPrefix}`;
|
|
10
|
-
const path1OutsideMaskId = `code_group_tab_edge_path_1_outside_1_${idPrefix}`;
|
|
11
|
-
const path3OutsideMaskId = `code_group_tab_edge_path_3_outside_2_${idPrefix}`;
|
|
12
8
|
const edgeBackgroundColor = "var(--rd-code-tab-edge-bg, #ffffff)";
|
|
13
9
|
const edgeBorderColor = "var(--rd-code-tab-edge-border, #e5e5e5)";
|
|
14
10
|
---
|
|
15
11
|
|
|
16
12
|
<svg
|
|
17
13
|
width="60"
|
|
18
|
-
height="
|
|
19
|
-
viewBox="0 0 60
|
|
14
|
+
height="38"
|
|
15
|
+
viewBox="0 0 60 38"
|
|
20
16
|
fill="none"
|
|
21
17
|
xmlns="http://www.w3.org/2000/svg"
|
|
22
18
|
class:list={["block", className]}
|
|
@@ -24,58 +20,13 @@ const edgeBorderColor = "var(--rd-code-tab-edge-border, #e5e5e5)";
|
|
|
24
20
|
aria-hidden="true"
|
|
25
21
|
data-pagefind-ignore
|
|
26
22
|
>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<mask
|
|
37
|
-
id={path1OutsideMaskId}
|
|
38
|
-
maskUnits="userSpaceOnUse"
|
|
39
|
-
x="0"
|
|
40
|
-
y="-1"
|
|
41
|
-
width="60"
|
|
42
|
-
height="43"
|
|
43
|
-
fill="black"
|
|
44
|
-
>
|
|
45
|
-
<rect fill="white" y="-1" width="60" height="43"></rect>
|
|
46
|
-
<path
|
|
47
|
-
d="M1 0L8.0783 0C15.772 0 22.7836 4.41324 26.111 11.3501L34.8889 29.6498C38.2164 36.5868 45.228 41 52.9217 41H60H1L1 0Z"
|
|
48
|
-
></path>
|
|
49
|
-
</mask>
|
|
50
|
-
<path
|
|
51
|
-
d="M1 0L8.0783 0C15.772 0 22.7836 4.41324 26.111 11.3501L34.8889 29.6498C38.2164 36.5868 45.228 41 52.9217 41H60H1L1 0Z"
|
|
52
|
-
fill={edgeBackgroundColor}></path>
|
|
53
|
-
<path
|
|
54
|
-
d="M1 0V-1H0V0L1 0ZM1 41H0V42H1V41ZM34.8889 29.6498L33.9873 30.0823L34.8889 29.6498ZM26.111 11.3501L27.0127 10.9177L26.111 11.3501ZM1 1H8.0783V-1H1V1ZM60 40H1V42H60V40ZM2 41V0L0 0L0 41H2ZM25.2094 11.7826L33.9873 30.0823L35.7906 29.2174L27.0127 10.9177L25.2094 11.7826ZM52.9217 42H60V40H52.9217V42ZM33.9873 30.0823C37.4811 37.3661 44.8433 42 52.9217 42V40C45.6127 40 38.9517 35.8074 35.7906 29.2174L33.9873 30.0823ZM8.0783 1C15.3873 1 22.0483 5.19257 25.2094 11.7826L27.0127 10.9177C23.5188 3.6339 16.1567 -1 8.0783 -1V1Z"
|
|
55
|
-
fill={edgeBorderColor}
|
|
56
|
-
mask={`url(#${path1OutsideMaskId})`}></path>
|
|
57
|
-
</mask>
|
|
58
|
-
<g mask={`url(#${mask0Id})`}>
|
|
59
|
-
<mask
|
|
60
|
-
id={path3OutsideMaskId}
|
|
61
|
-
maskUnits="userSpaceOnUse"
|
|
62
|
-
x="-1"
|
|
63
|
-
y="0.0244141"
|
|
64
|
-
width="60"
|
|
65
|
-
height="43"
|
|
66
|
-
fill="black"
|
|
67
|
-
>
|
|
68
|
-
<rect fill="white" x="-1" y="0.0244141" width="60" height="43"></rect>
|
|
69
|
-
<path
|
|
70
|
-
d="M0 1.02441H7.0783C14.772 1.02441 21.7836 5.43765 25.111 12.3746L33.8889 30.6743C37.2164 37.6112 44.228 42.0244 51.9217 42.0244H59H0L0 1.02441Z"
|
|
71
|
-
></path>
|
|
72
|
-
</mask>
|
|
73
|
-
<path
|
|
74
|
-
d="M0 1.02441H7.0783C14.772 1.02441 21.7836 5.43765 25.111 12.3746L33.8889 30.6743C37.2164 37.6112 44.228 42.0244 51.9217 42.0244H59H0L0 1.02441Z"
|
|
75
|
-
fill={edgeBackgroundColor}></path>
|
|
76
|
-
<path
|
|
77
|
-
d="M0 1.02441L0 0.0244141H-1V1.02441H0ZM0 42.0244H-1V43.0244H0L0 42.0244ZM33.8889 30.6743L32.9873 31.1068L33.8889 30.6743ZM25.111 12.3746L26.0127 11.9421L25.111 12.3746ZM0 2.02441H7.0783V0.0244141H0L0 2.02441ZM59 41.0244H0L0 43.0244H59V41.0244ZM1 42.0244L1 1.02441H-1L-1 42.0244H1ZM24.2094 12.8071L32.9873 31.1068L34.7906 30.2418L26.0127 11.9421L24.2094 12.8071ZM51.9217 43.0244H59V41.0244H51.9217V43.0244ZM32.9873 31.1068C36.4811 38.3905 43.8433 43.0244 51.9217 43.0244V41.0244C44.6127 41.0244 37.9517 36.8318 34.7906 30.2418L32.9873 31.1068ZM7.0783 2.02441C14.3873 2.02441 21.0483 6.21699 24.2094 12.8071L26.0127 11.9421C22.5188 4.65831 15.1567 0.0244141 7.0783 0.0244141V2.02441Z"
|
|
78
|
-
fill={edgeBorderColor}
|
|
79
|
-
mask={`url(#${path3OutsideMaskId})`}></path>
|
|
80
|
-
</g>
|
|
23
|
+
<path
|
|
24
|
+
d="M0 0.75H7.0783C14.772 0.75 21.7836 4.571 25.111 10.578L33.8889 27.422C37.2164 33.429 44.228 37.25 51.9217 37.25H60V38H0V0.75Z"
|
|
25
|
+
fill={edgeBackgroundColor}></path>
|
|
26
|
+
<path
|
|
27
|
+
d="M0 0.75H7.0783C14.772 0.75 21.7836 4.571 25.111 10.578L33.8889 27.422C37.2164 33.429 44.228 37.25 51.9217 37.25H60"
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke={edgeBorderColor}
|
|
30
|
+
stroke-width="0.5"
|
|
31
|
+
vector-effect="non-scaling-stroke"></path>
|
|
81
32
|
</svg>
|
|
@@ -50,7 +50,7 @@ validateProps(
|
|
|
50
50
|
}`
|
|
51
51
|
x-init="id = (typeof register === 'function') ? register() : Math.random()"
|
|
52
52
|
role="region"
|
|
53
|
-
class="rd-accordion block border-b border-neutral-800/10 dark:border-neutral-700/50 last:border-b-0. [&:first-child>h4>button]:pt-0
|
|
53
|
+
class="rd-accordion block border-b border-neutral-800/10 dark:border-neutral-700/50 last:border-b-0. [&:first-child>h4>button]:pt-0"
|
|
54
54
|
>
|
|
55
55
|
<h4 class="not-prose">
|
|
56
56
|
<button
|
|
@@ -70,9 +70,23 @@ validateProps(
|
|
|
70
70
|
/>
|
|
71
71
|
</button>
|
|
72
72
|
</h4>
|
|
73
|
-
<div
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
<div
|
|
74
|
+
class:list={[
|
|
75
|
+
"grid overflow-hidden transition-[grid-template-rows,opacity] motion-reduce:transition-none",
|
|
76
|
+
defaultOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
|
|
77
|
+
]}
|
|
78
|
+
:class="expanded ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0'"
|
|
79
|
+
:aria-hidden="(!expanded).toString()"
|
|
80
|
+
x-bind:inert="!expanded"
|
|
81
|
+
style="transition-duration: var(--rd-panel-transition-duration); transition-timing-function: var(--rd-panel-transition-easing);"
|
|
82
|
+
>
|
|
83
|
+
<div class="min-h-0 overflow-hidden">
|
|
84
|
+
<div
|
|
85
|
+
data-rd-accordion-content-inner
|
|
86
|
+
class="prose-rules max-w-none! *:max-w-none! pb-4!"
|
|
87
|
+
>
|
|
88
|
+
<slot />
|
|
89
|
+
</div>
|
|
76
90
|
</div>
|
|
77
91
|
</div>
|
|
78
92
|
</div>
|
|
@@ -92,7 +92,7 @@ const hasTitle = typeof resolvedTitle === "string" && resolvedTitle.length > 0;
|
|
|
92
92
|
|
|
93
93
|
<aside
|
|
94
94
|
class:list={[
|
|
95
|
-
"rd-prose-block relative space-y-1 rounded-xl border-[0.5px] bg-neutral-50/70 border-neutral-900/8 px-4 py-3.5 dark:
|
|
95
|
+
"rd-prose-block relative space-y-1 rounded-xl border-[0.5px] bg-neutral-50/70 border-neutral-900/8 dark:border-white/6 px-4 py-3.5 dark:bg-(--rd-code-surface) shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]",
|
|
96
96
|
accent ? "pl-6" : "pl-4",
|
|
97
97
|
]}
|
|
98
98
|
role="note"
|