radiant-docs 0.1.57 → 0.1.58
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
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"preact": "^10.29.0",
|
|
44
44
|
"prism-themes": "^1.9.0",
|
|
45
45
|
"prismjs": "^1.30.0",
|
|
46
|
-
"radiant-docs-validator": "^0.1.
|
|
46
|
+
"radiant-docs-validator": "^0.1.17",
|
|
47
47
|
"rehype-autolink-headings": "^7.1.0",
|
|
48
48
|
"rehype-slug": "^6.0.0",
|
|
49
49
|
"remark-gfm": "^4.0.1",
|
|
@@ -11633,9 +11633,9 @@
|
|
|
11633
11633
|
"license": "MIT"
|
|
11634
11634
|
},
|
|
11635
11635
|
"node_modules/radiant-docs-validator": {
|
|
11636
|
-
"version": "0.1.
|
|
11637
|
-
"resolved": "https://registry.npmjs.org/radiant-docs-validator/-/radiant-docs-validator-0.1.
|
|
11638
|
-
"integrity": "sha512-
|
|
11636
|
+
"version": "0.1.17",
|
|
11637
|
+
"resolved": "https://registry.npmjs.org/radiant-docs-validator/-/radiant-docs-validator-0.1.17.tgz",
|
|
11638
|
+
"integrity": "sha512-r7+1M//tK7Iuk0J56BgQca+a+NNHWAywl+m7OkTu/oFYPHawZ4MEoCdoq3pbKnTVaZ6Fgxiz5PmrqgwL4rb1Rw==",
|
|
11639
11639
|
"license": "MIT",
|
|
11640
11640
|
"dependencies": {
|
|
11641
11641
|
"@iconify-json/fluent": "^1.2.47",
|
package/template/package.json
CHANGED
|
@@ -6,13 +6,22 @@ interface Props {
|
|
|
6
6
|
alt?: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
width?: number | string;
|
|
9
|
+
align?: "left" | "center" | "right";
|
|
9
10
|
zoom?: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const imageProps = Astro.props as Record<string, unknown>;
|
|
13
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
src,
|
|
16
|
+
alt,
|
|
17
|
+
title,
|
|
18
|
+
width,
|
|
19
|
+
align = "center",
|
|
20
|
+
zoom = true,
|
|
21
|
+
} = imageProps as Props;
|
|
14
22
|
const zoomEnabled = zoom !== false;
|
|
15
23
|
const rawWidth = width;
|
|
24
|
+
const imageAlign = align === "left" || align === "right" ? align : "center";
|
|
16
25
|
|
|
17
26
|
function normalizeImageSource(value: Props["src"]): {
|
|
18
27
|
light: string;
|
|
@@ -103,6 +112,12 @@ const hasCustomImageWidth = isConstrainedWidthValue(rawWidth);
|
|
|
103
112
|
const contentWidthStyle = hasCustomImageWidth
|
|
104
113
|
? `width: ${toCssWidthValue(rawWidth) ?? "auto"};`
|
|
105
114
|
: undefined;
|
|
115
|
+
const constrainedWidthAlignmentClass =
|
|
116
|
+
imageAlign === "left"
|
|
117
|
+
? "w-fit max-w-full ml-0 mr-auto"
|
|
118
|
+
: imageAlign === "right"
|
|
119
|
+
? "w-fit max-w-full ml-auto mr-0"
|
|
120
|
+
: "w-fit max-w-full mx-auto";
|
|
106
121
|
|
|
107
122
|
const slotCaptionHtml = Astro.slots.has("default")
|
|
108
123
|
? (await Astro.slots.render("default")).trim()
|
|
@@ -113,7 +128,7 @@ const hasCaption = slotCaptionHtml.length > 0;
|
|
|
113
128
|
<figure
|
|
114
129
|
class:list={[
|
|
115
130
|
"rd-prose-block p-1.5 pb-1 xs:pb-1.5 group border-[0.5px] border-neutral-900/8 dark:border-white/6 bg-(--rd-code-surface) rounded-2xl shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-8px_rgba(0,0,0,0.08)] dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-8px_rgba(0,0,0,0.2)]",
|
|
116
|
-
hasCustomImageWidth ?
|
|
131
|
+
hasCustomImageWidth ? constrainedWidthAlignmentClass : "w-full",
|
|
117
132
|
]}
|
|
118
133
|
x-data="{
|
|
119
134
|
open: false,
|