fontisan 0.4.54-java → 0.4.55-java

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +1 -1
  3. data/docs/.gitignore +4 -0
  4. data/docs/astro.config.mjs +16 -0
  5. data/docs/package-lock.json +4022 -1496
  6. data/docs/package.json +12 -5
  7. data/docs/scripts/sitemap-base.mjs +81 -0
  8. data/docs/src/content.config.ts +32 -0
  9. data/docs/{.vitepress/config.ts → src/data/sidebar.ts} +235 -146
  10. data/docs/src/layouts/Site.astro +320 -0
  11. data/docs/src/pages/404.astro +14 -0
  12. data/docs/src/pages/api/[...slug].astro +22 -0
  13. data/docs/src/pages/api/index.astro +12 -0
  14. data/docs/src/pages/cli/[...slug].astro +22 -0
  15. data/docs/src/pages/cli/index.astro +12 -0
  16. data/docs/src/pages/guide/[...slug].astro +22 -0
  17. data/docs/src/pages/guide/index.astro +12 -0
  18. data/docs/src/pages/history/[...slug].astro +22 -0
  19. data/docs/src/pages/history/index.astro +24 -0
  20. data/docs/src/pages/index.astro +234 -0
  21. data/docs/src/pages/root/[...slug].astro +20 -0
  22. data/docs/src/styles/site.css +88 -0
  23. data/lib/fontisan/byte_ops.rb +0 -5
  24. data/lib/fontisan/ffi/darwin-arm64/libfontisan_cdylib.dylib +0 -0
  25. data/lib/fontisan/ffi/darwin-x86_64/libfontisan_cdylib.dylib +0 -0
  26. data/lib/fontisan/ffi/linux-x86_64/libfontisan_cdylib.so +0 -0
  27. data/lib/fontisan/ffi/windows-x86_64/fontisan_cdylib.dll +0 -0
  28. data/lib/fontisan/native.rb +1 -1
  29. data/lib/fontisan/version.rb +1 -1
  30. metadata +18 -10
  31. data/docs/.vitepress/theme/components/ApiMethod.vue +0 -127
  32. data/docs/.vitepress/theme/components/Badge.vue +0 -51
  33. data/docs/.vitepress/theme/components/FeatureComparison.vue +0 -87
  34. data/docs/.vitepress/theme/components/HeroCodeBlock.vue +0 -98
  35. data/docs/.vitepress/theme/components/WithinHero.vue +0 -30
  36. data/docs/.vitepress/theme/index.ts +0 -22
  37. data/docs/.vitepress/theme/style.css +0 -628
  38. data/docs/scripts/post-build.mjs +0 -81
@@ -0,0 +1,234 @@
1
+ ---
2
+ import Site from "../layouts/Site.astro";
3
+
4
+ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
5
+
6
+ const features = [
7
+ { title: "🔄 Font Conversion", details: "Convert between TTF, OTF, WOFF, WOFF2, Type 1 (PFB/PFA), and SVG formats with curve conversion and optimization." },
8
+ { title: "✅ Font Validation", details: "Comprehensive validation with 5 profiles (OpenType, Google Fonts, Microsoft, Adobe, Production), 56 helpers, and custom DSL." },
9
+ { title: "🎨 Color Fonts", details: "Full support for COLR/CPAL layered color fonts, sbix bitmap fonts, and SVG-based color fonts." },
10
+ { title: "⚡ Variable Fonts", details: "Process OpenType variable fonts with instance generation, format conversion, and named instance support." },
11
+ { title: "🔧 Font Hinting", details: "Bidirectional hint conversion between TrueType and PostScript formats — a unique Fontisan capability." },
12
+ { title: "📦 Type 1 Support", details: "Adobe Type 1 fonts (PFB/PFA) with eexec decryption, CharString parsing, and conversion to modern formats." },
13
+ { title: "📚 Collections", details: "TTC/OTC/dfont collection support with pack, unpack, table deduplication, and format conversion." },
14
+ { title: "💎 Pure Ruby", details: "Zero external dependencies. No Python, no C++, no C# required. Works anywhere Ruby runs." },
15
+ ];
16
+ ---
17
+ <Site title="Fontisan — Universal font processing library for Ruby" description="The most comprehensive font processing library for Ruby — 100% Pure Ruby, no Python, no C++, no C# dependencies.">
18
+ <section class="fontisan-hero">
19
+ <div class="pure-ruby-hero">💎 100% Pure Ruby</div>
20
+ <h1 class="hero-name">Fontisan</h1>
21
+ <p class="hero-text">Universal font processing library for Ruby</p>
22
+ <p class="hero-tagline">The most comprehensive font library — 100% Pure Ruby, no Python, no C++, no C# dependencies.</p>
23
+ <div class="hero-actions">
24
+ <a class="action brand" href={`${base}/guide/`}>Get Started</a>
25
+ <a class="action alt" href="https://github.com/fontist/fontisan">View on GitHub</a>
26
+ <a class="action alt" href={`${base}/guide/migrations/fonttools`}>Migrate from fonttools</a>
27
+ </div>
28
+ <div class="hero-terminal">
29
+ <div class="term-title">fontisan</div>
30
+ <div class="term-body">
31
+ <div class="line"><span class="comment"># Get detailed font information</span></div>
32
+ <div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> info OpenSans-Regular.ttf</div>
33
+ <div class="line">Family: Open Sans Style: Regular Format: TTF</div>
34
+ <div class="line"><span class="comment"># Convert between formats</span></div>
35
+ <div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> convert font.ttf --to woff2</div>
36
+ <div class="line"><span class="success">✓</span> font.woff2 created (45% smaller)</div>
37
+ <div class="line"><span class="comment"># Validate with Google Fonts profile</span></div>
38
+ <div class="line"><span class="prompt">$</span> <span class="cmd">fontisan</span> validate font.ttf -p google_fonts</div>
39
+ <div class="line"><span class="success">✓</span> All 56 checks passed</div>
40
+ </div>
41
+ </div>
42
+ </section>
43
+
44
+ <section class="features-grid">
45
+ {features.map((f) => (
46
+ <div class="feature-card">
47
+ <div class="feature-title">{f.title}</div>
48
+ <div class="feature-details">{f.details}</div>
49
+ </div>
50
+ ))}
51
+ </section>
52
+
53
+ <article class="prose home-prose">
54
+ <h2>Why Fontisan?</h2>
55
+ <p>
56
+ Fontisan is the <strong>most comprehensive font processing library in pure Ruby</strong>, combining the
57
+ capabilities of:
58
+ </p>
59
+ <ul>
60
+ <li><strong>fonttools</strong> (Python) — 100+ OpenType tables, variable fonts, subsetting</li>
61
+ <li><strong>lcdf-typetools</strong> (C++) — otfinfo, cfftot1, Type 1 validation</li>
62
+ <li><strong>Font-Validator</strong> (C#) — Comprehensive validation with coverage reports</li>
63
+ </ul>
64
+ <p>
65
+ <strong>The key differentiator</strong>: Fontisan is 100% pure Ruby. No Python, no C++, no C# dependencies.
66
+ Install and run anywhere Ruby runs.
67
+ </p>
68
+
69
+ <h2>Feature Comparison</h2>
70
+ <table>
71
+ <thead>
72
+ <tr><th>Feature</th><th>fonttools</th><th>lcdf-typetools</th><th>Font-Validator</th><th><strong>Fontisan</strong></th></tr>
73
+ </thead>
74
+ <tbody>
75
+ <tr><td>Pure Ruby</td><td>❌</td><td>❌</td><td>❌</td><td>✅</td></tr>
76
+ <tr><td>Python-free</td><td>❌</td><td>✅</td><td>✅</td><td>✅</td></tr>
77
+ <tr><td>Font conversion</td><td>✅</td><td>✅</td><td>❌</td><td>✅</td></tr>
78
+ <tr><td>Validation</td><td>❌</td><td>❌</td><td>✅</td><td>✅</td></tr>
79
+ <tr><td>Bidirectional hints</td><td>❌</td><td>Partial</td><td>❌</td><td>✅</td></tr>
80
+ <tr><td>Variable fonts</td><td>✅</td><td>❌</td><td>❌</td><td>✅</td></tr>
81
+ <tr><td>Type 1 support</td><td>Partial</td><td>✅</td><td>❌</td><td>✅</td></tr>
82
+ </tbody>
83
+ </table>
84
+ <p><a href={`${base}/guide/comparisons/`}>See full comparison →</a></p>
85
+
86
+ <h2>CLI Usage</h2>
87
+ <pre><code>{`# Get font information
88
+ fontisan info font.ttf
89
+
90
+ # Convert fonts
91
+ fontisan convert input.ttf --to otf --output output.otf
92
+
93
+ # Validate fonts
94
+ fontisan validate font.ttf --profile google_fonts
95
+
96
+ # Work with collections
97
+ fontisan unpack fonts.ttc --output-dir ./extracted`}</code></pre>
98
+ </article>
99
+ </Site>
100
+
101
+ <style>
102
+ .fontisan-hero {
103
+ text-align: center;
104
+ padding: 3.5rem 1.5rem 2rem;
105
+ }
106
+ .hero-name {
107
+ font-family: var(--spec-font-display);
108
+ font-size: 3.5rem;
109
+ font-weight: 700;
110
+ letter-spacing: -0.03em;
111
+ margin: 1rem 0 0.25rem;
112
+ background: linear-gradient(120deg, var(--fontist-rose) 30%, var(--fontist-rose-light));
113
+ -webkit-background-clip: text;
114
+ background-clip: text;
115
+ color: transparent;
116
+ }
117
+ .hero-text {
118
+ font-size: 1.35rem;
119
+ font-weight: 600;
120
+ color: var(--vp-c-text-1);
121
+ margin: 0;
122
+ }
123
+ .hero-tagline {
124
+ color: var(--vp-c-text-2);
125
+ margin: 0.5rem auto 1.25rem;
126
+ max-width: 620px;
127
+ }
128
+ .pure-ruby-hero {
129
+ display: inline-flex;
130
+ align-items: center;
131
+ gap: 0.5rem;
132
+ padding: 0.25rem 0.75rem;
133
+ background: linear-gradient(135deg, #bf4e6a, #d4718a);
134
+ color: white;
135
+ border-radius: 9999px;
136
+ font-size: 0.85rem;
137
+ font-weight: 700;
138
+ text-transform: uppercase;
139
+ letter-spacing: 0.05em;
140
+ margin-top: 0.5rem;
141
+ }
142
+ .hero-actions {
143
+ display: flex;
144
+ justify-content: center;
145
+ gap: 0.75rem;
146
+ margin-bottom: 2rem;
147
+ flex-wrap: wrap;
148
+ }
149
+ .action {
150
+ padding: 0.6rem 1.4rem;
151
+ border-radius: 10px;
152
+ font-weight: 500;
153
+ text-decoration: none;
154
+ font-size: 0.95rem;
155
+ }
156
+ .action.brand {
157
+ background: var(--spec-rose);
158
+ color: #fff;
159
+ }
160
+ .action.brand:hover {
161
+ background: #a3435a;
162
+ color: #fff;
163
+ }
164
+ .action.alt {
165
+ border: 1px solid var(--spec-rule-strong);
166
+ color: var(--vp-c-text-1);
167
+ }
168
+ .action.alt:hover {
169
+ border-color: var(--spec-rose);
170
+ color: var(--spec-rose);
171
+ }
172
+ .hero-terminal {
173
+ max-width: 640px;
174
+ margin: 0 auto;
175
+ text-align: left;
176
+ border-radius: 12px;
177
+ overflow: hidden;
178
+ border: 1px solid var(--spec-rule);
179
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
180
+ }
181
+ .term-title {
182
+ background: var(--spec-term-bg);
183
+ color: var(--spec-term-ink);
184
+ font-family: var(--vp-font-family-mono);
185
+ font-size: 0.8rem;
186
+ padding: 0.5rem 1rem;
187
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
188
+ }
189
+ .term-body {
190
+ background: var(--spec-term-bg);
191
+ color: var(--spec-term-ink);
192
+ font-family: var(--vp-font-family-mono);
193
+ font-size: 0.85rem;
194
+ line-height: 1.7;
195
+ padding: 1rem 1.25rem;
196
+ }
197
+ .term-body .comment { color: #8f887e; }
198
+ .term-body .prompt { color: var(--spec-rose-soft); }
199
+ .term-body .cmd { color: #ecdfd0; font-weight: 500; }
200
+ .term-body .success { color: #7fbf7f; }
201
+ .features-grid {
202
+ display: grid;
203
+ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
204
+ gap: 1rem;
205
+ max-width: 1080px;
206
+ margin: 1rem auto 2rem;
207
+ padding: 0 1.5rem;
208
+ }
209
+ .feature-card {
210
+ border: 1px solid var(--spec-rule);
211
+ border-radius: 12px;
212
+ padding: 1.25rem;
213
+ background: var(--vp-c-bg-soft);
214
+ transition: border-color 0.2s;
215
+ }
216
+ .feature-card:hover {
217
+ border-color: var(--spec-rose);
218
+ }
219
+ .feature-title {
220
+ font-weight: 600;
221
+ color: var(--vp-c-text-1);
222
+ margin-bottom: 0.4rem;
223
+ }
224
+ .feature-details {
225
+ font-size: 0.875rem;
226
+ color: var(--vp-c-text-2);
227
+ line-height: 1.6;
228
+ }
229
+ .home-prose {
230
+ max-width: 860px;
231
+ margin: 0 auto;
232
+ padding: 0 1.5rem 2rem;
233
+ }
234
+ </style>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import Site from "../../layouts/Site.astro";
3
+ import { getCollection, render } from "astro:content";
4
+
5
+ export async function getStaticPaths() {
6
+ const entries = await getCollection("rootPages");
7
+ return entries.map((entry) => ({
8
+ params: { slug: entry.id },
9
+ props: { entry },
10
+ }));
11
+ }
12
+
13
+ const { entry } = Astro.props;
14
+ const { Content } = await render(entry);
15
+ ---
16
+ <Site title={entry.data?.title ?? entry.id} description={entry.data?.description}>
17
+ <article class="prose doc-page">
18
+ <Content />
19
+ </article>
20
+ </Site>
@@ -0,0 +1,88 @@
1
+ @import "tailwindcss";
2
+
3
+ /* Fontisan docs site — Astro 7 + Tailwind 4.
4
+ Palette ported from the specimen design system in the VitePress theme.
5
+ The --vp-c-* variables stay as aliases so ported CSS applies unchanged. */
6
+ :root {
7
+ --fontist-rose: #bf4e6a;
8
+ --fontist-rose-light: #d4718a;
9
+ --fontist-dark: #4d4b54;
10
+ --fontist-gray: #676565;
11
+ --fontist-cream: #e1dfd2;
12
+ --fontist-beige: #bebbac;
13
+ --fontist-pale: #dddac8;
14
+
15
+ --spec-paper: #f1ece1;
16
+ --spec-paper-deep: #e7e0d1;
17
+ --spec-ink: #1c1a18;
18
+ --spec-ink-soft: #4a4744;
19
+ --spec-mute: #75716c;
20
+ --spec-rose: #b8475f;
21
+ --spec-rose-soft: #d4718a;
22
+ --spec-rule: rgba(28, 26, 24, 0.16);
23
+ --spec-rule-strong: rgba(28, 26, 24, 0.5);
24
+ --spec-term-bg: #1c1a18;
25
+ --spec-term-ink: #ecdfd0;
26
+
27
+ --vp-c-brand-1: var(--spec-rose);
28
+ --vp-c-brand-2: #a3435a;
29
+ --vp-c-brand-3: var(--spec-ink);
30
+ --vp-c-brand-soft: rgba(184, 71, 95, 0.12);
31
+ --vp-c-text-1: var(--spec-ink);
32
+ --vp-c-text-2: var(--spec-ink-soft);
33
+ --vp-c-text-3: var(--spec-mute);
34
+ --vp-c-bg: var(--spec-paper);
35
+ --vp-c-bg-soft: var(--spec-paper-deep);
36
+ --vp-c-divider: var(--spec-rule);
37
+ --vp-font-family-mono: "IBM Plex Mono", ui-monospace, monospace;
38
+ --spec-font-display: "Spectral", Georgia, serif;
39
+ --spec-font-body: "IBM Plex Sans", system-ui, sans-serif;
40
+ }
41
+
42
+ html.dark {
43
+ --spec-paper: #211e1c;
44
+ --spec-paper-deep: #2a2623;
45
+ --spec-ink: #ecdfd0;
46
+ --spec-ink-soft: #c9bda9;
47
+ --spec-mute: #8f887e;
48
+ --spec-rose: #d4718a;
49
+ --spec-rule: rgba(236, 223, 208, 0.16);
50
+ --spec-term-bg: #0d0c0c;
51
+ --vp-c-bg: var(--spec-paper);
52
+ --vp-c-bg-soft: var(--spec-paper-deep);
53
+ }
54
+
55
+ @theme {
56
+ --color-rose: var(--fontist-rose);
57
+ --color-rose-light: var(--fontist-rose-light);
58
+ --color-paper: var(--spec-paper);
59
+ --color-paper-deep: var(--spec-paper-deep);
60
+ --color-ink: var(--spec-ink);
61
+ --color-ink-soft: var(--spec-ink-soft);
62
+ --color-mute: var(--spec-mute);
63
+ --font-display: "Spectral", Georgia, serif;
64
+ --font-body: "IBM Plex Sans", system-ui, sans-serif;
65
+ }
66
+
67
+ body {
68
+ background: var(--vp-c-bg);
69
+ color: var(--vp-c-text-1);
70
+ font-family: var(--spec-font-body);
71
+ }
72
+
73
+ /* Markdown content (prose) */
74
+ .prose h1 { font-family: var(--spec-font-display); font-size: 2.1rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 1rem; color: var(--vp-c-text-1); }
75
+ .prose h2 { font-family: var(--spec-font-display); font-size: 1.5rem; font-weight: 600; margin: 2rem 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--spec-rule); color: var(--vp-c-text-1); }
76
+ .prose h3 { font-family: var(--spec-font-display); font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--vp-c-text-1); }
77
+ .prose p, .prose li { line-height: 1.7; color: var(--vp-c-text-1); }
78
+ .prose a { color: var(--spec-rose); }
79
+ .prose a:hover { color: #a3435a; }
80
+ .prose code { font-family: var(--vp-font-family-mono); font-size: 0.875em; background: var(--vp-c-bg-soft); padding: 0.15em 0.4em; border-radius: 6px; }
81
+ .prose pre { background: var(--spec-term-bg); color: var(--spec-term-ink); padding: 1rem 1.25rem; border-radius: 10px; overflow-x: auto; margin: 1rem 0; }
82
+ .prose pre code { background: none; padding: 0; color: inherit; }
83
+ .prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
84
+ .prose th, .prose td { border: 1px solid var(--spec-rule); padding: 0.5rem 0.75rem; text-align: left; }
85
+ .prose th { background: var(--vp-c-bg-soft); }
86
+ .prose blockquote { border-left: 3px solid var(--spec-rose); padding-left: 1rem; color: var(--vp-c-text-2); margin: 1rem 0; }
87
+ .prose img { max-width: 100%; }
88
+ .prose hr { border-color: var(--spec-rule); margin: 2rem 0; }
@@ -115,11 +115,6 @@ module Fontisan
115
115
  return %i[woff woff2].include?(source)
116
116
  end
117
117
 
118
- # A variable source keeps the type1 conversion with Ruby: the goldens
119
- # pin the pipeline's instanced bytes, and the engine's instancing walk
120
- # is not byte-identical to the pipeline's for type1 output yet.
121
- return false if target == :type1 && variable_font?(path)
122
-
123
118
  (collection_file?(path) ? COLLECTION_TARGETS : SINGLE_TARGETS).include?(target)
124
119
  end
125
120
 
@@ -26,7 +26,7 @@ module Fontisan
26
26
  # engine pin in ext/*/Cargo.toml, which each build embeds. ABI_VERSION does
27
27
  # not move on a repin, so this is what keeps a stale binary from serving old
28
28
  # behaviour. A repin seds it with the Cargo files (repin-push162.sh).
29
- ENGINE_REV = "4cf3789693ffcf43d9312308017620ab5c817bb5"
29
+ ENGINE_REV = "89c64de798794e271e289a3f51ec394eb7db3fee"
30
30
 
31
31
  # Operations served natively. Convert, extract, instance and subset are
32
32
  # path-based only (card 2f): the object-based entry points
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fontisan
4
- VERSION = "0.4.54"
4
+ VERSION = "0.4.55"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontisan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.54
4
+ version: 0.4.55
5
5
  platform: java
6
6
  authors:
7
7
  - Ribose Inc.
@@ -193,14 +193,6 @@ files:
193
193
  - benchmark/tier_baseline.json
194
194
  - benchmark/variation_quick_bench.rb
195
195
  - docs/.gitignore
196
- - docs/.vitepress/config.ts
197
- - docs/.vitepress/theme/components/ApiMethod.vue
198
- - docs/.vitepress/theme/components/Badge.vue
199
- - docs/.vitepress/theme/components/FeatureComparison.vue
200
- - docs/.vitepress/theme/components/HeroCodeBlock.vue
201
- - docs/.vitepress/theme/components/WithinHero.vue
202
- - docs/.vitepress/theme/index.ts
203
- - docs/.vitepress/theme/style.css
204
196
  - docs/AFDKO_MIGRATION.adoc
205
197
  - docs/APPLE_LEGACY_FONTS.adoc
206
198
  - docs/CFF2_SUPPORT.adoc
@@ -234,6 +226,7 @@ files:
234
226
  - docs/api/validators/font-validator.md
235
227
  - docs/api/validators/helper.md
236
228
  - docs/api/validators/profile.md
229
+ - docs/astro.config.mjs
237
230
  - docs/cli/convert.md
238
231
  - docs/cli/dump-table.md
239
232
  - docs/cli/export.md
@@ -332,7 +325,22 @@ files:
332
325
  - docs/public/web-app-manifest-192x192.png
333
326
  - docs/public/web-app-manifest-512x512.png
334
327
  - docs/reference-facade.md
335
- - docs/scripts/post-build.mjs
328
+ - docs/scripts/sitemap-base.mjs
329
+ - docs/src/content.config.ts
330
+ - docs/src/data/sidebar.ts
331
+ - docs/src/layouts/Site.astro
332
+ - docs/src/pages/404.astro
333
+ - docs/src/pages/api/[...slug].astro
334
+ - docs/src/pages/api/index.astro
335
+ - docs/src/pages/cli/[...slug].astro
336
+ - docs/src/pages/cli/index.astro
337
+ - docs/src/pages/guide/[...slug].astro
338
+ - docs/src/pages/guide/index.astro
339
+ - docs/src/pages/history/[...slug].astro
340
+ - docs/src/pages/history/index.astro
341
+ - docs/src/pages/index.astro
342
+ - docs/src/pages/root/[...slug].astro
343
+ - docs/src/styles/site.css
336
344
  - exe/fontisan
337
345
  - lib/fontisan.rb
338
346
  - lib/fontisan/audit.rb
@@ -1,127 +0,0 @@
1
- <template>
2
- <div class="api-method">
3
- <div class="method-header">
4
- <code class="method-signature">
5
- <span class="method-name">{{ name }}</span
6
- ><span class="method-params"
7
- >({{ params.map((p) => p.name).join(", ") }})</span
8
- >
9
- </code>
10
- <span v-if="returns" class="method-returns"> → {{ returns }}</span>
11
- </div>
12
- <p v-if="description" class="method-description">{{ description }}</p>
13
- <div v-if="params.length" class="method-params-list">
14
- <h4>Parameters</h4>
15
- <ul>
16
- <li v-for="param in params" :key="param.name">
17
- <code>{{ param.name }}</code>
18
- <span v-if="param.type" class="param-type">: {{ param.type }}</span>
19
- <span v-if="param.required" class="param-required">*</span>
20
- <span v-if="param.description" class="param-desc"
21
- >— {{ param.description }}</span
22
- >
23
- </li>
24
- </ul>
25
- </div>
26
- <div v-if="example" class="method-example">
27
- <h4>Example</h4>
28
- <pre><code :class="`language-${exampleLang}`">{{ example }}</code></pre>
29
- </div>
30
- </div>
31
- </template>
32
-
33
- <script setup lang="ts">
34
- interface Param {
35
- name: string;
36
- type?: string;
37
- required?: boolean;
38
- description?: string;
39
- }
40
-
41
- defineProps<{
42
- name: string;
43
- params?: Param[];
44
- returns?: string;
45
- description?: string;
46
- example?: string;
47
- exampleLang?: string;
48
- }>();
49
- </script>
50
-
51
- <style scoped>
52
- .api-method {
53
- margin: 1.5rem 0;
54
- padding: 1rem;
55
- border: 1px solid var(--vp-c-divider);
56
- border-radius: 8px;
57
- background: var(--vp-c-bg-soft);
58
- }
59
-
60
- .method-header {
61
- display: flex;
62
- align-items: center;
63
- gap: 0.5rem;
64
- flex-wrap: wrap;
65
- }
66
-
67
- .method-signature {
68
- font-size: 1rem;
69
- font-weight: 500;
70
- }
71
-
72
- .method-name {
73
- color: var(--vp-c-brand-1);
74
- }
75
-
76
- .method-params {
77
- color: var(--vp-c-text-2);
78
- }
79
-
80
- .method-returns {
81
- color: var(--vp-c-text-2);
82
- font-size: 0.9rem;
83
- }
84
-
85
- .method-description {
86
- margin: 0.75rem 0 0;
87
- color: var(--vp-c-text-2);
88
- }
89
-
90
- .method-params-list h4,
91
- .method-example h4 {
92
- margin: 1rem 0 0.5rem;
93
- font-size: 0.85rem;
94
- font-weight: 600;
95
- color: var(--vp-c-text-1);
96
- }
97
-
98
- .method-params-list ul {
99
- margin: 0;
100
- padding-left: 1.5rem;
101
- list-style: disc;
102
- }
103
-
104
- .method-params-list li {
105
- margin: 0.25rem 0;
106
- }
107
-
108
- .param-type {
109
- color: var(--vp-c-text-3);
110
- }
111
-
112
- .param-required {
113
- color: var(--vp-c-danger-1);
114
- }
115
-
116
- .param-desc {
117
- color: var(--vp-c-text-2);
118
- }
119
-
120
- .method-example pre {
121
- margin: 0.5rem 0;
122
- padding: 1rem;
123
- background: var(--vp-c-bg-alt);
124
- border-radius: 6px;
125
- overflow-x: auto;
126
- }
127
- </style>
@@ -1,51 +0,0 @@
1
- <template>
2
- <span :class="['badge', type]">
3
- <slot />
4
- </span>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- defineProps<{
9
- type?: "tip" | "warning" | "danger" | "info" | "pure-ruby";
10
- }>();
11
- </script>
12
-
13
- <style scoped>
14
- .badge {
15
- display: inline-flex;
16
- align-items: center;
17
- padding: 0.125rem 0.5rem;
18
- border-radius: 9999px;
19
- font-size: 0.75rem;
20
- font-weight: 600;
21
- line-height: 1.25rem;
22
- }
23
-
24
- .tip {
25
- background-color: var(--vp-c-brand-soft);
26
- color: var(--vp-c-brand-1);
27
- }
28
-
29
- .warning {
30
- background-color: rgba(255, 197, 61, 0.14);
31
- color: var(--vp-c-warning-1);
32
- }
33
-
34
- .danger {
35
- background-color: rgba(244, 63, 94, 0.14);
36
- color: var(--vp-c-danger-1);
37
- }
38
-
39
- .info {
40
- background-color: rgba(96, 165, 250, 0.14);
41
- color: var(--vp-c-info-1);
42
- }
43
-
44
- .pure-ruby {
45
- background: linear-gradient(135deg, var(--fontist-rose), #d4718a);
46
- color: white;
47
- font-weight: 700;
48
- text-transform: uppercase;
49
- letter-spacing: 0.05em;
50
- }
51
- </style>