@axle-lang/ui 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 +70 -0
- package/dist/app.css +337 -0
- package/dist/components/Seo.svelte +38 -0
- package/dist/components/Seo.svelte.d.ts +8 -0
- package/dist/components/atoms/Badge.svelte +11 -0
- package/dist/components/atoms/Badge.svelte.d.ts +8 -0
- package/dist/components/atoms/Button.svelte +32 -0
- package/dist/components/atoms/Button.svelte.d.ts +12 -0
- package/dist/components/atoms/Callout.svelte +11 -0
- package/dist/components/atoms/Callout.svelte.d.ts +8 -0
- package/dist/components/atoms/CodeChip.svelte +11 -0
- package/dist/components/atoms/CodeChip.svelte.d.ts +8 -0
- package/dist/components/atoms/Eyebrow.svelte +9 -0
- package/dist/components/atoms/Eyebrow.svelte.d.ts +8 -0
- package/dist/components/atoms/HandNote.svelte +15 -0
- package/dist/components/atoms/HandNote.svelte.d.ts +9 -0
- package/dist/components/atoms/Icon.svelte +40 -0
- package/dist/components/atoms/Icon.svelte.d.ts +11 -0
- package/dist/components/atoms/Kbd.svelte +11 -0
- package/dist/components/atoms/Kbd.svelte.d.ts +8 -0
- package/dist/components/atoms/Logo.svelte +18 -0
- package/dist/components/atoms/Logo.svelte.d.ts +6 -0
- package/dist/components/atoms/SearchButton.svelte +23 -0
- package/dist/components/atoms/SearchButton.svelte.d.ts +8 -0
- package/dist/components/atoms/Tag.svelte +21 -0
- package/dist/components/atoms/Tag.svelte.d.ts +10 -0
- package/dist/components/atoms/ThemeToggle.svelte +30 -0
- package/dist/components/atoms/ThemeToggle.svelte.d.ts +6 -0
- package/dist/components/code/Code.svelte +22 -0
- package/dist/components/code/Code.svelte.d.ts +9 -0
- package/dist/components/code/CodeWindow.svelte +42 -0
- package/dist/components/code/CodeWindow.svelte.d.ts +13 -0
- package/dist/components/code/CopyCommand.svelte +28 -0
- package/dist/components/code/CopyCommand.svelte.d.ts +7 -0
- package/dist/components/landing/BenchExplorer.svelte +157 -0
- package/dist/components/landing/BenchExplorer.svelte.d.ts +7 -0
- package/dist/components/landing/CTASection.svelte +12 -0
- package/dist/components/landing/CTASection.svelte.d.ts +11 -0
- package/dist/components/landing/ComparisonPanel.svelte +75 -0
- package/dist/components/landing/ComparisonPanel.svelte.d.ts +19 -0
- package/dist/components/landing/FeatureCard.svelte +19 -0
- package/dist/components/landing/FeatureCard.svelte.d.ts +10 -0
- package/dist/components/landing/FeatureGrid.svelte +26 -0
- package/dist/components/landing/FeatureGrid.svelte.d.ts +13 -0
- package/dist/components/landing/Hero.svelte +23 -0
- package/dist/components/landing/Hero.svelte.d.ts +14 -0
- package/dist/components/landing/RecipeDeck.svelte +137 -0
- package/dist/components/landing/RecipeDeck.svelte.d.ts +19 -0
- package/dist/components/layout/DocLayout.svelte +36 -0
- package/dist/components/layout/DocLayout.svelte.d.ts +21 -0
- package/dist/components/layout/PageShell.svelte +15 -0
- package/dist/components/layout/PageShell.svelte.d.ts +7 -0
- package/dist/components/molecules/Card.svelte +18 -0
- package/dist/components/molecules/Card.svelte.d.ts +9 -0
- package/dist/components/molecules/DataTable.svelte +43 -0
- package/dist/components/molecules/DataTable.svelte.d.ts +12 -0
- package/dist/components/molecules/PageHeading.svelte +23 -0
- package/dist/components/molecules/PageHeading.svelte.d.ts +10 -0
- package/dist/components/molecules/Section.svelte +20 -0
- package/dist/components/molecules/Section.svelte.d.ts +10 -0
- package/dist/components/molecules/SectionHeading.svelte +27 -0
- package/dist/components/molecules/SectionHeading.svelte.d.ts +10 -0
- package/dist/components/nav/DocHeader.svelte +44 -0
- package/dist/components/nav/DocHeader.svelte.d.ts +7 -0
- package/dist/components/nav/Footer.svelte +67 -0
- package/dist/components/nav/Footer.svelte.d.ts +3 -0
- package/dist/components/nav/Header.svelte +55 -0
- package/dist/components/nav/Header.svelte.d.ts +6 -0
- package/dist/components/nav/PrevNext.svelte +27 -0
- package/dist/components/nav/PrevNext.svelte.d.ts +13 -0
- package/dist/components/nav/RightRail.svelte +30 -0
- package/dist/components/nav/RightRail.svelte.d.ts +11 -0
- package/dist/components/nav/Sidebar.svelte +33 -0
- package/dist/components/nav/Sidebar.svelte.d.ts +18 -0
- package/dist/components/reference/MethodDetail.svelte +72 -0
- package/dist/components/reference/MethodDetail.svelte.d.ts +7 -0
- package/dist/components/reference/MethodSummary.svelte +41 -0
- package/dist/components/reference/MethodSummary.svelte.d.ts +8 -0
- package/dist/i18n/index.d.ts +47 -0
- package/dist/i18n/index.js +23 -0
- package/dist/i18n/messages/en.d.ts +43 -0
- package/dist/i18n/messages/en.js +50 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +54 -0
- package/dist/site/site.d.ts +45 -0
- package/dist/site/site.js +66 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/cn.js +9 -0
- package/dist/utils/icons.d.ts +26 -0
- package/dist/utils/icons.js +55 -0
- package/dist/utils/tokenizer.d.ts +12 -0
- package/dist/utils/tokenizer.js +181 -0
- package/dist/utils/types.d.ts +50 -0
- package/dist/utils/types.js +4 -0
- package/dist/utils/variants.d.ts +20 -0
- package/dist/utils/variants.js +50 -0
- package/package.json +77 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Prev / Next footer for doc pages.
|
|
3
|
+
let {
|
|
4
|
+
prev,
|
|
5
|
+
next
|
|
6
|
+
}: {
|
|
7
|
+
prev?: { label: string; href: string };
|
|
8
|
+
next?: { label: string; href: string };
|
|
9
|
+
} = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div class="mt-14 pt-6 border-t border-line flex items-center justify-between">
|
|
13
|
+
{#if prev}
|
|
14
|
+
<a href={prev.href} class="flex flex-col gap-1 text-[13px] text-muted hover:text-fg">
|
|
15
|
+
<span class="text-faint">Previous</span>
|
|
16
|
+
<span class="font-medium">← {prev.label}</span>
|
|
17
|
+
</a>
|
|
18
|
+
{:else}
|
|
19
|
+
<span></span>
|
|
20
|
+
{/if}
|
|
21
|
+
{#if next}
|
|
22
|
+
<a href={next.href} class="flex flex-col gap-1 text-right text-[13px] text-muted hover:text-fg">
|
|
23
|
+
<span class="text-faint">Next</span>
|
|
24
|
+
<span class="font-medium text-accent">{next.label} →</span>
|
|
25
|
+
</a>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
prev?: {
|
|
3
|
+
label: string;
|
|
4
|
+
href: string;
|
|
5
|
+
};
|
|
6
|
+
next?: {
|
|
7
|
+
label: string;
|
|
8
|
+
href: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare const PrevNext: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type PrevNext = ReturnType<typeof PrevNext>;
|
|
13
|
+
export default PrevNext;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '../atoms/Icon.svelte';
|
|
3
|
+
|
|
4
|
+
// Right "On this page" table of contents.
|
|
5
|
+
let {
|
|
6
|
+
items = [],
|
|
7
|
+
editHref = '#'
|
|
8
|
+
}: { items?: { id: string; label: string; sub?: boolean }[]; editHref?: string } = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<aside
|
|
12
|
+
class="hidden xl:block w-[232px] shrink-0 sticky top-14 self-start h-[calc(100vh-3.5rem)] overflow-y-auto axle-scroll py-10 px-6"
|
|
13
|
+
>
|
|
14
|
+
<div class="text-[11px] font-semibold uppercase tracking-[0.08em] text-faint mb-3">
|
|
15
|
+
On this page
|
|
16
|
+
</div>
|
|
17
|
+
{#each items as t}
|
|
18
|
+
<a
|
|
19
|
+
href={`#${t.id}`}
|
|
20
|
+
class="block py-1.5 text-[13px] text-muted hover:text-fg transition-colors {t.sub
|
|
21
|
+
? 'pl-3 text-[12.5px]'
|
|
22
|
+
: ''}">{t.label}</a
|
|
23
|
+
>
|
|
24
|
+
{/each}
|
|
25
|
+
<div class="mt-6 pt-5 border-t border-line">
|
|
26
|
+
<a href={editHref} class="flex items-center gap-2 text-[13px] text-muted hover:text-fg">
|
|
27
|
+
<Icon name="edit" size={15} /> Suggest an edit
|
|
28
|
+
</a>
|
|
29
|
+
</div>
|
|
30
|
+
</aside>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
items?: {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
sub?: boolean;
|
|
6
|
+
}[];
|
|
7
|
+
editHref?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const RightRail: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type RightRail = ReturnType<typeof RightRail>;
|
|
11
|
+
export default RightRail;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { page } from '$app/state';
|
|
3
|
+
import { getSite, type NavSection } from '../../site/site.js';
|
|
4
|
+
import { navItem } from '../../utils/variants.js';
|
|
5
|
+
|
|
6
|
+
// Sidebar sections come from the site context (generated from
|
|
7
|
+
// docs/src/SUMMARY.md by gen-nav). The active item is derived from
|
|
8
|
+
// the current URL — no prop to thread through every page.
|
|
9
|
+
const { nav } = getSite();
|
|
10
|
+
const sections: NavSection[] = nav ?? [];
|
|
11
|
+
|
|
12
|
+
const norm = (p: string) => (p === '/' ? '/' : p.replace(/\/$/, ''));
|
|
13
|
+
|
|
14
|
+
const itemClass = (href: string, indent?: boolean) =>
|
|
15
|
+
navItem({ active: norm(page.url.pathname) === norm(href), indent: !!indent });
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<aside
|
|
19
|
+
class="hidden lg:block w-[280px] shrink-0 sticky top-14 self-start h-[calc(100vh-3.5rem)] overflow-y-auto axle-scroll border-r border-line px-4 py-6"
|
|
20
|
+
>
|
|
21
|
+
{#each sections as sec}
|
|
22
|
+
<div class="mb-1">
|
|
23
|
+
<div
|
|
24
|
+
class="px-3 mt-4 mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-faint"
|
|
25
|
+
>
|
|
26
|
+
{sec.title}
|
|
27
|
+
</div>
|
|
28
|
+
{#each sec.items as it}
|
|
29
|
+
<a href={it.href} class={itemClass(it.href, it.indent)}>{it.label}</a>
|
|
30
|
+
{/each}
|
|
31
|
+
</div>
|
|
32
|
+
{/each}
|
|
33
|
+
</aside>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Sidebar: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Sidebar = InstanceType<typeof Sidebar>;
|
|
18
|
+
export default Sidebar;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { t } from 'svelte-i18n';
|
|
3
|
+
import { K } from '../../i18n/index.js';
|
|
4
|
+
import type { DocMethod } from '../../utils/types.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Full per-method detail block (signature, params, returns, throws).
|
|
8
|
+
*/
|
|
9
|
+
let { methods = [] }: { methods: DocMethod[] } = $props();
|
|
10
|
+
|
|
11
|
+
const anchorId = (m: DocMethod) => 'fn-' + m.name.toLowerCase();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<h3 class="mt-12 text-[18px] font-semibold tracking-tight" id="detail">
|
|
15
|
+
{$t(K.method.detail)}
|
|
16
|
+
</h3>
|
|
17
|
+
|
|
18
|
+
{#each methods as m}
|
|
19
|
+
<div id={anchorId(m)} class="scroll-mt-20 border-t border-line pt-7 mt-7 first:mt-5">
|
|
20
|
+
<h4 class="group flex items-center gap-2 text-[16px] font-mono font-medium">
|
|
21
|
+
<span class="text-line group-hover:text-accent transition-colors select-none">#</span>{m.name}
|
|
22
|
+
</h4>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="mt-3 rounded-lg border border-line bg-surface px-4 py-3 font-mono text-[13.5px] overflow-x-auto axle-scroll"
|
|
26
|
+
>
|
|
27
|
+
{m.sig}
|
|
28
|
+
</div>
|
|
29
|
+
<p class="mt-3 text-[14.5px] leading-relaxed text-muted">{m.desc}</p>
|
|
30
|
+
|
|
31
|
+
{#if m.params?.length}
|
|
32
|
+
<div class="mt-4">
|
|
33
|
+
<div class="text-[11px] font-semibold uppercase tracking-wider text-faint mb-1">
|
|
34
|
+
{$t(K.method.parameters)}
|
|
35
|
+
</div>
|
|
36
|
+
{#each m.params as p}
|
|
37
|
+
<div class="flex gap-3 py-1.5 border-t border-line text-[13.5px]">
|
|
38
|
+
<code class="font-mono text-accent shrink-0">{p.name}</code>
|
|
39
|
+
<span class="text-muted leading-relaxed">{p.desc}</span>
|
|
40
|
+
</div>
|
|
41
|
+
{/each}
|
|
42
|
+
</div>
|
|
43
|
+
{/if}
|
|
44
|
+
|
|
45
|
+
{#if m.returns}
|
|
46
|
+
<div class="mt-4 flex gap-3 text-[13.5px]">
|
|
47
|
+
<span
|
|
48
|
+
class="text-[11px] font-semibold uppercase tracking-wider text-faint shrink-0 w-[68px] pt-0.5"
|
|
49
|
+
>{$t(K.method.returns)}</span
|
|
50
|
+
>
|
|
51
|
+
<span class="text-muted leading-relaxed">{m.returns}</span>
|
|
52
|
+
</div>
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
{#if m.throws?.length}
|
|
56
|
+
<div class="mt-4">
|
|
57
|
+
<div class="text-[11px] font-semibold uppercase tracking-wider text-faint mb-1.5">
|
|
58
|
+
{$t(K.method.throws)}
|
|
59
|
+
</div>
|
|
60
|
+
{#each m.throws as th}
|
|
61
|
+
<div class="flex gap-2.5 py-1.5 border-t border-line text-[13.5px] items-baseline">
|
|
62
|
+
<code
|
|
63
|
+
class="font-mono text-[12.5px] rounded-md bg-[#dc2626]/10 text-[#dc2626] dark:text-[#f87171] dark:bg-[#f87171]/10 px-2 py-0.5 shrink-0"
|
|
64
|
+
>{th.type}</code
|
|
65
|
+
>
|
|
66
|
+
<span class="text-muted leading-relaxed">{th.desc}</span>
|
|
67
|
+
</div>
|
|
68
|
+
{/each}
|
|
69
|
+
</div>
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
72
|
+
{/each}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocMethod } from '../../utils/types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
methods: DocMethod[];
|
|
4
|
+
};
|
|
5
|
+
declare const MethodDetail: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type MethodDetail = ReturnType<typeof MethodDetail>;
|
|
7
|
+
export default MethodDetail;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Code from '../code/Code.svelte';
|
|
3
|
+
import { t } from 'svelte-i18n';
|
|
4
|
+
import { K } from '../../i18n/index.js';
|
|
5
|
+
import type { DocMethod } from '../../utils/types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Method summary table (Type | Method and description).
|
|
9
|
+
*/
|
|
10
|
+
let { methods = [], dense = false }: { methods: DocMethod[]; dense?: boolean } = $props();
|
|
11
|
+
|
|
12
|
+
const pad = $derived(dense ? 'py-2 px-4' : 'py-3 px-4');
|
|
13
|
+
const anchorId = (m: DocMethod) => 'fn-' + m.name.toLowerCase();
|
|
14
|
+
const shortSig = (m: DocMethod) => m.sig.split(' ! ')[0];
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="rounded-xl border border-line overflow-hidden overflow-x-auto axle-scroll">
|
|
18
|
+
<table class="w-full text-[13px] border-separate border-spacing-0">
|
|
19
|
+
<thead>
|
|
20
|
+
<tr class="bg-surface text-left text-[12px] uppercase tracking-wider text-faint">
|
|
21
|
+
<th class="font-semibold py-2.5 px-4 w-[1%] whitespace-nowrap">{$t(K.method.type)}</th>
|
|
22
|
+
<th class="font-semibold py-2.5 px-4">{$t(K.method.summary)}</th>
|
|
23
|
+
</tr>
|
|
24
|
+
</thead>
|
|
25
|
+
<tbody>
|
|
26
|
+
{#each methods as m}
|
|
27
|
+
<tr class="align-top hover:bg-surface/60 transition-colors">
|
|
28
|
+
<td class="{pad} border-t border-line font-mono text-[12px] whitespace-nowrap">
|
|
29
|
+
<Code code={m.ret} fontSize={12} lineHeight={18} class="!overflow-visible" />
|
|
30
|
+
</td>
|
|
31
|
+
<td class="{pad} border-t border-line">
|
|
32
|
+
<a href={`#${anchorId(m)}`} class="font-mono text-[13px] text-accent hover:underline"
|
|
33
|
+
>{shortSig(m)}</a
|
|
34
|
+
>
|
|
35
|
+
<span class="block text-muted mt-0.5 text-[13px] leading-snug">{m.desc}</span>
|
|
36
|
+
</td>
|
|
37
|
+
</tr>
|
|
38
|
+
{/each}
|
|
39
|
+
</tbody>
|
|
40
|
+
</table>
|
|
41
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocMethod } from '../../utils/types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
methods: DocMethod[];
|
|
4
|
+
dense?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const MethodSummary: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type MethodSummary = ReturnType<typeof MethodSummary>;
|
|
8
|
+
export default MethodSummary;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare function initI18n(): void;
|
|
2
|
+
export type Keys<T> = {
|
|
3
|
+
[P in keyof T]: T[P] extends object ? Keys<T[P]> : string;
|
|
4
|
+
};
|
|
5
|
+
export declare function keysOf<T extends Record<string, unknown>>(obj: T, prefix?: string): Keys<T>;
|
|
6
|
+
export declare const K: Keys<{
|
|
7
|
+
nav: {
|
|
8
|
+
guide: string;
|
|
9
|
+
reference: string;
|
|
10
|
+
benchmarks: string;
|
|
11
|
+
recipes: string;
|
|
12
|
+
getStarted: string;
|
|
13
|
+
};
|
|
14
|
+
search: {
|
|
15
|
+
docs: string;
|
|
16
|
+
};
|
|
17
|
+
footer: {
|
|
18
|
+
docs: string;
|
|
19
|
+
project: string;
|
|
20
|
+
language: string;
|
|
21
|
+
link: {
|
|
22
|
+
guide: string;
|
|
23
|
+
reference: string;
|
|
24
|
+
recipes: string;
|
|
25
|
+
repo: string;
|
|
26
|
+
roadmap: string;
|
|
27
|
+
issues: string;
|
|
28
|
+
memory: string;
|
|
29
|
+
simd: string;
|
|
30
|
+
ffi: string;
|
|
31
|
+
};
|
|
32
|
+
tagline: string;
|
|
33
|
+
note: string;
|
|
34
|
+
};
|
|
35
|
+
bench: {
|
|
36
|
+
variant: string;
|
|
37
|
+
source: string;
|
|
38
|
+
};
|
|
39
|
+
method: {
|
|
40
|
+
type: string;
|
|
41
|
+
summary: string;
|
|
42
|
+
detail: string;
|
|
43
|
+
parameters: string;
|
|
44
|
+
returns: string;
|
|
45
|
+
throws: string;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { addMessages, init } from 'svelte-i18n';
|
|
2
|
+
import en from './messages/en.js';
|
|
3
|
+
// Register synchronously (not async `register`) so `$t` is ready during
|
|
4
|
+
// SSR / prerender without a `waitLocale`. Idempotent — safe to call from
|
|
5
|
+
// every app layout.
|
|
6
|
+
let started = false;
|
|
7
|
+
export function initI18n() {
|
|
8
|
+
if (started)
|
|
9
|
+
return;
|
|
10
|
+
started = true;
|
|
11
|
+
addMessages('en', en);
|
|
12
|
+
init({ fallbackLocale: 'en', initialLocale: 'en' });
|
|
13
|
+
}
|
|
14
|
+
export function keysOf(obj, prefix = '') {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
17
|
+
const path = prefix ? `${prefix}.${k}` : k;
|
|
18
|
+
out[k] =
|
|
19
|
+
v !== null && typeof v === 'object' ? keysOf(v, path) : path;
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
export const K = keysOf(en);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
nav: {
|
|
3
|
+
guide: string;
|
|
4
|
+
reference: string;
|
|
5
|
+
benchmarks: string;
|
|
6
|
+
recipes: string;
|
|
7
|
+
getStarted: string;
|
|
8
|
+
};
|
|
9
|
+
search: {
|
|
10
|
+
docs: string;
|
|
11
|
+
};
|
|
12
|
+
footer: {
|
|
13
|
+
docs: string;
|
|
14
|
+
project: string;
|
|
15
|
+
language: string;
|
|
16
|
+
link: {
|
|
17
|
+
guide: string;
|
|
18
|
+
reference: string;
|
|
19
|
+
recipes: string;
|
|
20
|
+
repo: string;
|
|
21
|
+
roadmap: string;
|
|
22
|
+
issues: string;
|
|
23
|
+
memory: string;
|
|
24
|
+
simd: string;
|
|
25
|
+
ffi: string;
|
|
26
|
+
};
|
|
27
|
+
tagline: string;
|
|
28
|
+
note: string;
|
|
29
|
+
};
|
|
30
|
+
bench: {
|
|
31
|
+
variant: string;
|
|
32
|
+
source: string;
|
|
33
|
+
};
|
|
34
|
+
method: {
|
|
35
|
+
type: string;
|
|
36
|
+
summary: string;
|
|
37
|
+
detail: string;
|
|
38
|
+
parameters: string;
|
|
39
|
+
returns: string;
|
|
40
|
+
throws: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// English chrome catalog for @axle-lang/ui — ONLY the labels the components in
|
|
2
|
+
// this package render themselves (their own vocabulary). Page-level copy
|
|
3
|
+
// (titles, leads, intros) lives with the pages in the consuming apps,
|
|
4
|
+
// merged into the same locale via svelte-i18n `addMessages`.
|
|
5
|
+
//
|
|
6
|
+
// Call sites use the `K` keys object ($t(K.nav.guide)), never raw strings.
|
|
7
|
+
export default {
|
|
8
|
+
nav: {
|
|
9
|
+
guide: 'Guide',
|
|
10
|
+
reference: 'Reference',
|
|
11
|
+
benchmarks: 'Benchmarks',
|
|
12
|
+
recipes: 'Recipes',
|
|
13
|
+
getStarted: 'Get started'
|
|
14
|
+
},
|
|
15
|
+
search: {
|
|
16
|
+
docs: 'Search docs'
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
docs: 'Docs',
|
|
20
|
+
project: 'Project',
|
|
21
|
+
language: 'Language',
|
|
22
|
+
link: {
|
|
23
|
+
guide: 'Guide',
|
|
24
|
+
reference: 'Stdlib reference',
|
|
25
|
+
recipes: 'Recipes',
|
|
26
|
+
repo: 'GitLab',
|
|
27
|
+
roadmap: 'Roadmap',
|
|
28
|
+
issues: 'Issues',
|
|
29
|
+
memory: 'Memory model',
|
|
30
|
+
simd: 'SIMD',
|
|
31
|
+
ffi: 'FFI'
|
|
32
|
+
},
|
|
33
|
+
tagline: 'TypeScript-grade ergonomics, compiled to the machine code a careful C programmer would have written by hand.',
|
|
34
|
+
note: 'escape analysis included'
|
|
35
|
+
},
|
|
36
|
+
// BenchExplorer table chrome.
|
|
37
|
+
bench: {
|
|
38
|
+
variant: 'Variant',
|
|
39
|
+
source: 'Source'
|
|
40
|
+
},
|
|
41
|
+
// MethodSummary / MethodDetail table chrome (stdlib reference).
|
|
42
|
+
method: {
|
|
43
|
+
type: 'Type',
|
|
44
|
+
summary: 'Method and description',
|
|
45
|
+
detail: 'Method detail',
|
|
46
|
+
parameters: 'Parameters',
|
|
47
|
+
returns: 'Returns',
|
|
48
|
+
throws: 'Throws'
|
|
49
|
+
}
|
|
50
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { default as Icon } from './components/atoms/Icon.svelte';
|
|
2
|
+
export { default as Logo } from './components/atoms/Logo.svelte';
|
|
3
|
+
export { default as Button } from './components/atoms/Button.svelte';
|
|
4
|
+
export { default as Badge } from './components/atoms/Badge.svelte';
|
|
5
|
+
export { default as Kbd } from './components/atoms/Kbd.svelte';
|
|
6
|
+
export { default as CodeChip } from './components/atoms/CodeChip.svelte';
|
|
7
|
+
export { default as Eyebrow } from './components/atoms/Eyebrow.svelte';
|
|
8
|
+
export { default as Callout } from './components/atoms/Callout.svelte';
|
|
9
|
+
export { default as HandNote } from './components/atoms/HandNote.svelte';
|
|
10
|
+
export { default as ThemeToggle } from './components/atoms/ThemeToggle.svelte';
|
|
11
|
+
export { default as SearchButton } from './components/atoms/SearchButton.svelte';
|
|
12
|
+
export { default as Tag } from './components/atoms/Tag.svelte';
|
|
13
|
+
export { default as Code } from './components/code/Code.svelte';
|
|
14
|
+
export { default as CodeWindow } from './components/code/CodeWindow.svelte';
|
|
15
|
+
export { default as CopyCommand } from './components/code/CopyCommand.svelte';
|
|
16
|
+
export { default as DataTable } from './components/molecules/DataTable.svelte';
|
|
17
|
+
export { default as PageHeading } from './components/molecules/PageHeading.svelte';
|
|
18
|
+
export { default as Section } from './components/molecules/Section.svelte';
|
|
19
|
+
export { default as SectionHeading } from './components/molecules/SectionHeading.svelte';
|
|
20
|
+
export { default as Card } from './components/molecules/Card.svelte';
|
|
21
|
+
export { default as Header } from './components/nav/Header.svelte';
|
|
22
|
+
export { default as DocHeader } from './components/nav/DocHeader.svelte';
|
|
23
|
+
export { default as Sidebar } from './components/nav/Sidebar.svelte';
|
|
24
|
+
export { default as RightRail } from './components/nav/RightRail.svelte';
|
|
25
|
+
export { default as PrevNext } from './components/nav/PrevNext.svelte';
|
|
26
|
+
export { default as Footer } from './components/nav/Footer.svelte';
|
|
27
|
+
export { default as DocLayout } from './components/layout/DocLayout.svelte';
|
|
28
|
+
export { default as PageShell } from './components/layout/PageShell.svelte';
|
|
29
|
+
export { default as Hero } from './components/landing/Hero.svelte';
|
|
30
|
+
export { default as RecipeDeck } from './components/landing/RecipeDeck.svelte';
|
|
31
|
+
export { default as ComparisonPanel } from './components/landing/ComparisonPanel.svelte';
|
|
32
|
+
export { default as FeatureGrid } from './components/landing/FeatureGrid.svelte';
|
|
33
|
+
export { default as FeatureCard } from './components/landing/FeatureCard.svelte';
|
|
34
|
+
export { default as BenchExplorer } from './components/landing/BenchExplorer.svelte';
|
|
35
|
+
export { default as CTASection } from './components/landing/CTASection.svelte';
|
|
36
|
+
export { default as MethodSummary } from './components/reference/MethodSummary.svelte';
|
|
37
|
+
export { default as MethodDetail } from './components/reference/MethodDetail.svelte';
|
|
38
|
+
export { buildSite, createRoute, setSite, getSite, DEFAULT_DOMAINS } from './site/site.js';
|
|
39
|
+
export { default as Seo } from './components/Seo.svelte';
|
|
40
|
+
export { initI18n, K, keysOf } from './i18n/index.js';
|
|
41
|
+
export type { Keys } from './i18n/index.js';
|
|
42
|
+
export { cn } from './utils/cn.js';
|
|
43
|
+
export { highlight } from './utils/tokenizer.js';
|
|
44
|
+
export { icons } from './utils/icons.js';
|
|
45
|
+
export type { IconName } from './utils/icons.js';
|
|
46
|
+
export type { DocMethod, DocParam, DocThrow, Metric, BenchResult, BenchProgram, BenchCategory, BenchData } from './utils/types.js';
|
|
47
|
+
export type { NavItem, NavSection, Site, RouteFn, RouteConfig } from './site/site.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Atoms
|
|
2
|
+
export { default as Icon } from './components/atoms/Icon.svelte';
|
|
3
|
+
export { default as Logo } from './components/atoms/Logo.svelte';
|
|
4
|
+
export { default as Button } from './components/atoms/Button.svelte';
|
|
5
|
+
export { default as Badge } from './components/atoms/Badge.svelte';
|
|
6
|
+
export { default as Kbd } from './components/atoms/Kbd.svelte';
|
|
7
|
+
export { default as CodeChip } from './components/atoms/CodeChip.svelte';
|
|
8
|
+
export { default as Eyebrow } from './components/atoms/Eyebrow.svelte';
|
|
9
|
+
export { default as Callout } from './components/atoms/Callout.svelte';
|
|
10
|
+
export { default as HandNote } from './components/atoms/HandNote.svelte';
|
|
11
|
+
export { default as ThemeToggle } from './components/atoms/ThemeToggle.svelte';
|
|
12
|
+
export { default as SearchButton } from './components/atoms/SearchButton.svelte';
|
|
13
|
+
export { default as Tag } from './components/atoms/Tag.svelte';
|
|
14
|
+
// Code
|
|
15
|
+
export { default as Code } from './components/code/Code.svelte';
|
|
16
|
+
export { default as CodeWindow } from './components/code/CodeWindow.svelte';
|
|
17
|
+
export { default as CopyCommand } from './components/code/CopyCommand.svelte';
|
|
18
|
+
// Molecules
|
|
19
|
+
export { default as DataTable } from './components/molecules/DataTable.svelte';
|
|
20
|
+
export { default as PageHeading } from './components/molecules/PageHeading.svelte';
|
|
21
|
+
export { default as Section } from './components/molecules/Section.svelte';
|
|
22
|
+
export { default as SectionHeading } from './components/molecules/SectionHeading.svelte';
|
|
23
|
+
export { default as Card } from './components/molecules/Card.svelte';
|
|
24
|
+
// Navigation
|
|
25
|
+
export { default as Header } from './components/nav/Header.svelte';
|
|
26
|
+
export { default as DocHeader } from './components/nav/DocHeader.svelte';
|
|
27
|
+
export { default as Sidebar } from './components/nav/Sidebar.svelte';
|
|
28
|
+
export { default as RightRail } from './components/nav/RightRail.svelte';
|
|
29
|
+
export { default as PrevNext } from './components/nav/PrevNext.svelte';
|
|
30
|
+
export { default as Footer } from './components/nav/Footer.svelte';
|
|
31
|
+
// Layout
|
|
32
|
+
export { default as DocLayout } from './components/layout/DocLayout.svelte';
|
|
33
|
+
export { default as PageShell } from './components/layout/PageShell.svelte';
|
|
34
|
+
// Landing (shells — the route fills them with content)
|
|
35
|
+
export { default as Hero } from './components/landing/Hero.svelte';
|
|
36
|
+
export { default as RecipeDeck } from './components/landing/RecipeDeck.svelte';
|
|
37
|
+
export { default as ComparisonPanel } from './components/landing/ComparisonPanel.svelte';
|
|
38
|
+
export { default as FeatureGrid } from './components/landing/FeatureGrid.svelte';
|
|
39
|
+
export { default as FeatureCard } from './components/landing/FeatureCard.svelte';
|
|
40
|
+
export { default as BenchExplorer } from './components/landing/BenchExplorer.svelte';
|
|
41
|
+
export { default as CTASection } from './components/landing/CTASection.svelte';
|
|
42
|
+
// Reference (business)
|
|
43
|
+
export { default as MethodSummary } from './components/reference/MethodSummary.svelte';
|
|
44
|
+
export { default as MethodDetail } from './components/reference/MethodDetail.svelte';
|
|
45
|
+
// Site / routing (cross-domain links + injected version via context)
|
|
46
|
+
export { buildSite, createRoute, setSite, getSite, DEFAULT_DOMAINS } from './site/site.js';
|
|
47
|
+
export { default as Seo } from './components/Seo.svelte';
|
|
48
|
+
// i18n (chrome catalog; keys via K; keysOf lets apps build keys for their
|
|
49
|
+
// own page-level messages, merged into the locale with addMessages)
|
|
50
|
+
export { initI18n, K, keysOf } from './i18n/index.js';
|
|
51
|
+
// Utilities & data
|
|
52
|
+
export { cn } from './utils/cn.js';
|
|
53
|
+
export { highlight } from './utils/tokenizer.js';
|
|
54
|
+
export { icons } from './utils/icons.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Built-in production domains; apps override via env. */
|
|
2
|
+
export declare const DEFAULT_DOMAINS: {
|
|
3
|
+
readonly landing: "https://axle-lang.dev";
|
|
4
|
+
readonly docs: "https://doc.axle-lang.dev";
|
|
5
|
+
};
|
|
6
|
+
type SiteKind = 'landing' | 'docs';
|
|
7
|
+
/** Resolver returned by `createRoute`: maps a route key to an href. */
|
|
8
|
+
export type RouteFn = (key: string) => string;
|
|
9
|
+
export interface RouteConfig {
|
|
10
|
+
landing?: string;
|
|
11
|
+
docs?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The site this app *is*, so same-site links stay relative (work in
|
|
14
|
+
* local dev) and cross-site links go absolute to the configured domain.
|
|
15
|
+
*/
|
|
16
|
+
current?: SiteKind;
|
|
17
|
+
}
|
|
18
|
+
/** Build a `route(key)` resolver. */
|
|
19
|
+
export declare function createRoute({ landing, docs, current }?: RouteConfig): RouteFn;
|
|
20
|
+
export interface NavItem {
|
|
21
|
+
label: string;
|
|
22
|
+
href: string;
|
|
23
|
+
indent?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface NavSection {
|
|
26
|
+
title: string;
|
|
27
|
+
items: NavItem[];
|
|
28
|
+
}
|
|
29
|
+
/** The injected site config consumed via context by the components. */
|
|
30
|
+
export interface Site {
|
|
31
|
+
version: string;
|
|
32
|
+
origin: string;
|
|
33
|
+
route: RouteFn;
|
|
34
|
+
nav?: NavSection[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Per-app site config from `PUBLIC_*` env. Keeps the domain/version
|
|
38
|
+
* resolution in one place so each app's `$lib/site.ts` is a one-liner.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildSite(env: Record<string, string | undefined>, current: SiteKind): Omit<Site, 'nav'>;
|
|
41
|
+
/** Provide `{ route, version, origin, nav }` to descendant components. */
|
|
42
|
+
export declare function setSite(site: Site): void;
|
|
43
|
+
/** Read the site config; falls back to defaults when none was set. */
|
|
44
|
+
export declare function getSite(): Site;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Centralised, injectable site config: the version badge and every
|
|
2
|
+
// link. Components never hardcode an href — they call `route(key)`,
|
|
3
|
+
// which resolves cross-domain (landing vs docs) from the domains the
|
|
4
|
+
// app injects, and a version string, both provided via Svelte context
|
|
5
|
+
// (`setSite` in the app layout, `getSite` in the component).
|
|
6
|
+
import { getContext, setContext } from 'svelte';
|
|
7
|
+
/** Built-in production domains; apps override via env. */
|
|
8
|
+
export const DEFAULT_DOMAINS = {
|
|
9
|
+
landing: 'https://axle-lang.dev',
|
|
10
|
+
docs: 'https://doc.axle-lang.dev'
|
|
11
|
+
};
|
|
12
|
+
/** Canonical source repository — single source for repo/issues/roadmap links. */
|
|
13
|
+
const REPO = 'https://gitlab.com/axle-lang/axle';
|
|
14
|
+
/**
|
|
15
|
+
* Route table. Each key resolves to either an internal page on the
|
|
16
|
+
* landing or docs site, or an external link (used verbatim).
|
|
17
|
+
*/
|
|
18
|
+
const ROUTES = {
|
|
19
|
+
home: { site: 'landing', path: '/' },
|
|
20
|
+
benchmarks: { site: 'landing', path: '/benchmarks' },
|
|
21
|
+
guide: { site: 'docs', path: '/guide' },
|
|
22
|
+
reference: { site: 'docs', path: '/reference' },
|
|
23
|
+
recipes: { site: 'docs', path: '/recipes' },
|
|
24
|
+
memory: { site: 'docs', path: '/memory' },
|
|
25
|
+
simd: { site: 'docs', path: '/simd' },
|
|
26
|
+
ffi: { site: 'docs', path: '/ffi' },
|
|
27
|
+
repo: { url: REPO },
|
|
28
|
+
issues: { url: `${REPO}/-/issues` },
|
|
29
|
+
roadmap: { url: REPO }
|
|
30
|
+
};
|
|
31
|
+
/** Build a `route(key)` resolver. */
|
|
32
|
+
export function createRoute({ landing = DEFAULT_DOMAINS.landing, docs = DEFAULT_DOMAINS.docs, current = 'landing' } = {}) {
|
|
33
|
+
const origin = { landing, docs };
|
|
34
|
+
return function route(key) {
|
|
35
|
+
const r = ROUTES[key];
|
|
36
|
+
if (!r)
|
|
37
|
+
return '#';
|
|
38
|
+
if ('url' in r)
|
|
39
|
+
return r.url;
|
|
40
|
+
return r.site === current ? r.path : origin[r.site] + r.path;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Per-app site config from `PUBLIC_*` env. Keeps the domain/version
|
|
45
|
+
* resolution in one place so each app's `$lib/site.ts` is a one-liner.
|
|
46
|
+
*/
|
|
47
|
+
export function buildSite(env, current) {
|
|
48
|
+
const landing = env.PUBLIC_LANDING_DOMAIN || DEFAULT_DOMAINS.landing;
|
|
49
|
+
const docs = env.PUBLIC_DOCS_DOMAIN || DEFAULT_DOMAINS.docs;
|
|
50
|
+
return {
|
|
51
|
+
// The version badge is the app's to provide — the design system holds
|
|
52
|
+
// no compiler version. Empty when the app injects none.
|
|
53
|
+
version: env.PUBLIC_AXLE_VERSION ?? '',
|
|
54
|
+
origin: current === 'docs' ? docs : landing,
|
|
55
|
+
route: createRoute({ landing, docs, current })
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const SITE_KEY = Symbol('axle.site');
|
|
59
|
+
/** Provide `{ route, version, origin, nav }` to descendant components. */
|
|
60
|
+
export function setSite(site) {
|
|
61
|
+
setContext(SITE_KEY, site);
|
|
62
|
+
}
|
|
63
|
+
/** Read the site config; falls back to defaults when none was set. */
|
|
64
|
+
export function getSite() {
|
|
65
|
+
return getContext(SITE_KEY) ?? { route: createRoute(), version: '', origin: '' };
|
|
66
|
+
}
|